7 ms·
I wish Ruby was “the data science language” tbh. Ruby has some of the most beautiful and concise idioms of any language. I remember the first time I learned pro
by faizshah 6y ago
I wish Ruby was “the data science language” tbh. Ruby has some of the most beautiful and concise idioms of any language. I remember the first time I learned procs, blocks and lambdas my mind was blown with how elegant ruby solutions to problems can be. It’s a shame I have to use python instead.
- jbverschoor 6y agoI think 2 reasons: - it looks just easier in python to use c bindings - python is used in universities, just like java is/was I think crystal is the better of both, and would be great for this kind of stuff
- burlesona 6y agoI think it’s about 95% the academic thing. Not sure exactly how Python came into favor as the preferred scripting language of Academia, but once it did that basically ensured the math and science ecosystem would be very robust, which in turn made Python an obvious good choice for data science, ML, etc.
- jbverschoor 6y agoWell, python was created by a Dutch guy who worked at the research center for math, later some other research positions. the CWI has ties with the university, so that makes sense. Python is older than ruby, and matz probably had less ties, and probably uses more JP than guido did Dutch.
- tinco 6y agoYeah even if Ruby is not much younger than Python, it only gained popularity outside of Japan somewhere around 2003, and only extreme popularity after the release of rails.
- jbverschoor 6y agoI always wondered how dhh came into contact with this unknown language
- tinco 6y agoIt was not that unknown, there were definitely people using it in the west before rails was released. It was just not in the mainstream consciousness.
- jhbadger 6y agoI was using Ruby regularly circa 2001. It wasn't unknown in the West, as various magazines had pointed out this neat Smalltalk-like scripting language and the first version of the Pickaxe book was also published in 2001.
- kragen 6y agoI think what happened was that Jim Hugunin wrote Numeric (Numerical Python) in 1995 with help from a bunch of other people, and Travis Oliphant and some other people put together SciPy in 2001 from modules they'd been working on previously. A hecking lot of work had already gone into Numeric and SciPy by the time I first tried using it, around 2003, and so it was already pretty stable, with a broad range of capabilities. It had already left Perl's PDL far behind (except for 3-D plotting support), and Ruby's NArray barely existed, being under 10KLOC when it was imported from CVS in 2001: https://github.com/masa16/narray/commits/master?after=447c960c5d475fa898224e20235d585709739a50+139 https://github.com/masa16/narray/commits/master?after=447c96... So Numeric and then SciPy (2001), numarray (2001), and Numpy (2005) just had a big head start on the other free-software numerical computation libraries, basically because a few early Pythonistas were interested in the field, and it kept accruing more and more powerful stuff: FFTW (1998), SparsePy (1999), the ability to read MATLAB files (1999), matplotlib (2001), IPython (2001), and so on. It got popular enough that dozens of people started contributing code to it, making it grow faster and faster. At the time, most scientists were still using MATLAB; other alternatives for array-based computing included R, Bell Labs's Lush, and if you were a real masochist, PV-WAVE's IDL. Octave, the free-software MATLAB clone, wasn't yet a reasonable replacement. And all of these languages had the disadvantage that they were sort of trapped in their own little library ecosystems: if you wanted to do Gaussian quadrature or calculate a Kullback-Leibler divergence or plot some data, you were golden, but if you wanted to scrape some data out of some web pages with regular expressions, parse command-line flags, read members of a zip file, or run as a CGI process on a web server, you were shit out of luck. Numpy's syntax for a vector of numbers is pretty shitty compared to Octave or APL, but it's worlds better than R or especially IDL, and most people prefer it to Lush's Lisp syntax, although I have a soft spot for Lush myself. And Python and Numpy have reasonable language semantics too, unlike Octave or R. (I think Lush may have been a bit late to the free-software party, too, so it wasn't really an option.) So academia started switching over from MATLAB to Numpy, I think around 2010. The transition isn't over yet; the numerical-methods class I audited last year is still using Octave. R is dominant in statistics and will probably stay that way. But Numpy is pretty broadly adopted. It basically came down to a head start due to a lot of hard work done in the 1990s that just happened to be done in Python. It's maybe not entirely coincidence that the people whose taste ran to reimplementing Gaussian quadrature were fans of Python and not Perl, Ruby, Lua, or Tcl, but they could have been.
- burlesona 6y agoAgreed. Ruby is more consistent than Python IMO, and has especially beautiful semantics for the list processing. It’s interesting, Ruby can be a bit more performant too. I discovered this when I taught some ML stuff to a ruby group, and converted some Q Learning programs and maze navigating stuff from Python to Ruby, and was surprised to see the Ruby version run around 1.3-1.8x faster depending on what the code was doing. It’s not enough difference to really matter, but it just reinforced my “aww shucks” feeling that Ruby could have served that ecosystem very well.
- forgingahead 6y agoSounds fascinating - do you have the lecture / any code samples of that online?
- 7thaccount 6y agoAll the performance benchmarks I've seen over the years have shown Python to be significantly faster than Ruby. Keep in mind it doesn't matter a whole lot as the scientific stuff calls out to C or Fortran anyway.
- peheje 6y agoTake a look at https://crystal-lang.org/ https://crystal-lang.org/ Ruby like syntax, compiled on LLVM so fast
- deathtrader666 6y agoTake a look at Julia.
- tragomaskhalos 6y agoyes it's very much about having to go with the flow: in the past I've used Ruby for a swathe of scripting and prototyping tasks, fell in love with it and assumed it'd always be the go-to tool of choice, but now working on locked-down Red Hat envs where Ruby is not installed but Python is, so purely for that reason was forced to transition to using Python instead. Over the years since I've come to appreciate Python's virtues more, but still agree with your sentiment.
- monadic2 6y agoI’ll admit, despite having developed professionally on ruby for 6+ years I do not get this attitude of ruby being “beautiful”. Some things are easy to read and interpret in ruby (well-written DSLs come to mind) but it doesn’t strike me as anything special in terms of general purpose programming—closures are now common, macros are gaining ground in more formal languages, syntax is carried on in successive languages like Crystal (and is highly subjective anyway, I’d give my hand not to structure my programs with english keywords), and ruby is missing proven features that have hit other languages devs may or may not have noticed. Ruby has a great liquid hiring pool and can be used to write functional software rapidly. That’s the beauty I see, and it comes at a cost like all languages. There’s nothing especially beautiful about the way that it expresses algorithms; most languages have great aesthetic by leaning into the features and idioms designed into the language. How can a language have aesthetic in a general sense if languages have expressive tradeoff?
- ProZsolt 6y agoWhere it really shines, when you have to manipulate, transform data. You can chain commands as you do with Unix pipes. You can read left to right, and know what is your data structure looks like at each step.
- monadic2 6y agoIs all programming not manipulating/transforming data? Regardless, i’m interested in how the syntax actually supports this. You can build monads in any language to support chaining! I’ve found the block syntax often makes this less readable if you can’t use a method identifier—ruby doesn’t have syntax for anonymous arguments that would allow expressions like `arr.map(someFunc(“arg”, @0))`, so the resulting block is more verbose and distracts. There’s also no currying.
- dunefox 6y agoIf anything I wish it was F# on .Net core instead of Python - assuming Julia didn't exist. Now Julia is pretty much the best thing.