As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In the Python community, the term pythonic refers to idiomatic Python[1]. Is there an equivalent term in the Ruby community for idiomatic Ruby[2]?
[1] For example, using enumerate(l) instead of range(len(l)) is pythonic.
[2] For example, using .each instead of for is idiomatic Ruby.
I've not heard of any such shorthand, presumably because there's no convenient suffix you can append to Ruby to turn it into an adjective :)
If you say something's idiomatic, and you're around rubyists, I think everybody will know what you mean.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I can do it with pen & paper but I'm having a really hard time trying to build methods in ruby that calculates simple formulas like the one below.
How can I build a method in ruby that returns CET?
(To make it easier consider (dj-d0)/365 equals j)
This can be translated almost literally to Ruby if you know the structures to use:
sum = (1..n).inject(0) do |s, j|
fc[j] / ((1 + cet) ** (d[j] - d[0]) / 365) - fc[0]
end
If you want to solve for something, that's another story. You might want to try Mathematica.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Trying to master Ruby (not rails yet). What book would you recommend reading next?
Pickaxe
Well Grounded Rubyist
?
My background... I have a CS degree, I feel like I have absorbed the first two books and am getting quite comfortable with Ruby. I want to get better at the Ruby language before I head into Rails.
Next I'd recommend "Eloquent Ruby" (Russ Olsen) and "Ruby Best Practices" (Greg Brown).
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I am relative new in Ruby world. And I don't know, what to think. In 'The Ruby Programming Language' I read I shouldn't use Continuations in new code and use Fibers instead. I found this presentation (from 2008) http://www.atdot.net/~ko1/pub/ContinuationFest-ruby.pdf which says that Continations are broken and creators of their Ruby's implementations are criminals.
On the other hand I read a few blogs where authors were showing their excitement about continuations and they didn't sad anyhing about continuations bugs.
So I don't know what to think. I know than it is better to use Fibers instead of Continuations, but what to do when Fibers aren't enough? Can I use Continuations or are they broken (presentation from 2008 says it)?
Why Matz kicked Continuations to stdlib? Why there are votes, he will kick it out from Ruby?
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
which package would you use for writing algorithms in LaTeX? I know about algorithm, algorithmic and algorithms packages.
Thanks
The listings package is what you are looking for.
alt text http://files.droplr.com/files/35740123/13etch.listings.png
I'd add to your list algorithm2e.
Use Algorithmic for algorithms and psuedocode writing.
http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need learn some algorithms. What is the best collection of algorithm exercises that is like Project Euler?
These are the ones that I know of, which are good and are used by many programmers.
Spoj
Top Coder
Code Chef
USACO
Thanks
Try Spoj, it lets you use a large variety of languages and run and compile them online.