Skip to content
New issue

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

Array#to_na #17

Open
dicom opened this issue Apr 20, 2012 · 1 comment
Open

Array#to_na #17

dicom opened this issue Apr 20, 2012 · 1 comment

Comments

@dicom
Copy link

dicom commented Apr 20, 2012

Let's say we have a Ruby Array of numbers that we would like to convert to an NArray:

a = [1, 2, 3, 4, 5]

Currently, it is somewhat cumbersome to convert a Ruby Array to a NArray. It requires many characters to type:

na = NArray.to_na(a)

A possible simplification would be for the NArray library to extend the Array class with an NArray conversion method:

class Array
  def to_na
    NArray.to_na(self)
  end
end

Then, we would have a pleasant way of converting Ruby Array to NArray:

na = a.to_na

Do you think this would be a good idea?

@masa16
Copy link
Owner

masa16 commented Apr 20, 2012

Thank you for your proposal. I considered this idea before and rejected it because it modified another class. I may rethink that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants