Skip to content

Array#to_na #17

@dicom

Description

@dicom

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions