-
Notifications
You must be signed in to change notification settings - Fork 15
Adds SymEngine::symbols() and allows Symbol.new to take a Ruby symbol #37
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
Conversation
|
|
||
| context 'with a splatted argument' do | ||
| it 'returns an Enumerable of Symbol objects' do | ||
| @test_symbols_method.call(2, 'x', 'y') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you test the following:
# x, y = SymEngine.symbols(%i{x y})
# x, y = SymEngine.symbols(%w{x y})
# x, y = SymEngine.symbols('x', 'y')
# x, y = SymEngine.symbols('x y')
Based on your comment above, should we also test these:
# x, y = SymEngine.symbols([:x, :y])
# x, y = SymEngine.symbols(['x', 'y'])
I can see that you test SymEngine::Symbol.new('x') and SymEngine::Symbol.new(:x) below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%i{x y} is the same as [:x, :y], and %w{x y} is the same as ['x', 'y'].
I suppose we could also be exhaustive and test SymEngine.symbols(:x, :y), but it follows the same execution path as SymEngine.symbols('x', 'y'), so I think it's redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok. Then all is good.
|
@MohawkJohn thanks for the PR! I left a minor comment. Otherwise it looks good. |
|
There is an error in Ruby 1.9.3 (https://travis-ci.org/symengine/symengine.rb/jobs/121473492): Is this syntax not supported in Ruby 1.9.3? |
|
Thanks a lot @MohawkJohn! This makes the interface better. |
|
I checked that the first release of Ruby 1.9.3 was at the end of 2011. For example, the first release of Python 2.6 was in 2008, but we are dropping it in SymPy this year. Python 2.7 was first released in 2010, and we definitely still support it --- but Python 2.7 is special in that it is the last version of Python 2.x, so it will be around for a long, long time. @MohawkJohn, what is the situation in Ruby --- what is the earliest version that we should support? |
…ultiple symbols simultaneously. Allows Symbol.new to take a Ruby symbol or a string.
|
Oh, bleh. I didn't realize http://stackoverflow.com/questions/17355177/what-is-the-origin-of-i-notation It's probably reasonable to support 1.9.3. We should definitely cut off before 1.9.1. I'd say just require 1.9.3 or higher for now. I've fixed the commit and tested it with 1.9.3-p551 now. |
|
Thanks, that sounds reasonable. Let's support 1.9.3 and up. All tests pass, so I am merging this. |
Fixes #33 and adds a convenience function,
SymEngine::symbolswhich allows us to create multiple symbols simultaneously.