We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Daru's vector returns an array when you call the map method.
map
v = Daru::Vector[1,2,3,4] v.map {|i| i} # => [1, 2, 3, 4]
map returns an array when you include module Enumerable. But, there is no rule that the map method must return an array in Ruby. For example,
require 'numo/narray' a = Numo::SFloat.new(10).seq a.map{|i| i} #=> Numo::SFloat#shape=[10] #[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
In Daru, recode return a Vector.
recode
v = Daru::Vector[1,2,3,4] v.recode {|i| i} #=> #<Daru::Vector(4)> # 0 1 # 1 2 # 2 3 # 3 4
This practice is not so common. I think map should return Daru :: Vector.
If there is room to change the API from now, please consider.
The text was updated successfully, but these errors were encountered:
looking into this
Sorry, something went wrong.
Thank you for your work. @him666
But what I suggested was to change the behavior of the map method.
Currently, the map method returns an Array, but I suggested changing it to return Daru::Vector.
Array
Daru::Vector
This is not a technical issue but a user consensus issue.
map_to_vector is similar to recode. So I don't think we need a new method.
map_to_vector
I too, think that map on Daru::Vector should return Daru::Vector and not Array.
No branches or pull requests
Daru's vector returns an array when you call the
map
method.map
returns an array when you include module Enumerable.But, there is no rule that the map method must return an array in Ruby.
For example,
In Daru,
recode
return a Vector.This practice is not so common.
I think map should return Daru :: Vector.
If there is room to change the API from now, please consider.
The text was updated successfully, but these errors were encountered: