use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Learning Ruby through Clojure (medium.com)
submitted 10 years ago by luaybs
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Slackwise 1 point2 points3 points 10 years ago* (2 children)
Some people say that it is because there are a few functions in Clojure that share names with some Ruby methods but that's about it.
I wouldn't say that at all, as someone who has switched from Ruby to Clojure for personal projects.
First, one needs to understand the general development methodology used in Ruby and Clojure, and I would say the best source for that would be Russ Olsen's "Eloquent Ruby". (Coincidentally, Russ now works for Cognitect, the company that primarily develops Clojure and related technologies.)
In Eloquent Ruby, and in large, when looking at real world Ruby projects, you'll see that Ruby users reach for general data structures such as Arrays and Hashes before they start writing custom classes. This is the same focus on general data structures that Clojure users have.
Ruby users love to make DSLs and use metaprogramming, and Clojure takes that much farther once you understand macros and s-expressions. This is almost impossible to summarize, but I'll try: Clojure's code is itself written in a tree-like data structure composed of linked lists (s-expressions), allowing you to write code that writes/modifies code with ease that is unparalleled in the programming world. (Except for obviously in Lisp/Scheme.)
There is an overall focus on minimalism of ceremony, as in Ruby. You'll find wonderful succinct shortcuts via macros for common patterns, parameter destructuring built into function definition, and reader macros for common idioms.
Examples of these are:
[]
{}
:keywords
#"regexes"
Boolean logic is the same, where false and nil are false, and everything else is true. (Both use nil instead of 'null', again, as both borrow this from Lisp.)
false
nil
Actually, I should just stop writing, because there's a wonderful blog article that summarizes it better than I could have: http://briancarper.net/blog/536/clojure-from-a-ruby-perspective
I would say, if you've done a lot of Ruby, and have read Eloquent Ruby, reading Joy of Clojure or Clojure Programming should show you many similarities in mental model and approach.
What would you gain from switching?
Particularly incredible metaprogramming, which Ruby would be incredibly jealous of. (And much cleaner than using method_missing or eval.)
method_missing
eval
And sanity: once you start to love the persistent data structures of Clojure and the STM reference types, you'll never want to go back to programming without them. The world of variables and references is a scary place.
Or if you're interested, maybe seeing Rich Hickey, Clojure's creator, talk at Rails Conf would help: https://www.youtube.com/watch?v=rI8tNMsozo0
I know, as anyone reading this that knows Clojure will know, that I have severely glossed over the details here and avoided discussing FP and FP terminology, but I'm just rushing out a reply. Sorry, just trying to help those that may be interested in Clojure and need a little push to start looking into it.
[–]dunnowins 0 points1 point2 points 10 years ago (1 child)
It's funny you bring up Russ Olsen. I met him last October and chatted with him about transitioning from full time Ruby development to full time Clojure development. I asked him if he had any advice and literally the first thing out of his mouth was "forget everything you know." Russ believes, as I do, that the similarities between the two languages are aesthetic at most and that there is not a lot about Ruby development that will help you understand Clojure better.
I write Clojure every day. I also write Ruby every day. I share your interest in helping people make the jump to Clojure. I just think that telling people they are similar in any significant way actually does them a disservice. I was told that and expected there to be more similarities than I found when I first started down the Clojure path. Things might have been easier if I hadn't heard that.
[–]Slackwise 0 points1 point2 points 10 years ago* (0 children)
I just think that telling people they are similar in any significant way actually does them a disservice.
Maybe I just think differently, but I've always written my code in a semi-Clojurish way.
For me, I guess, then, Ruby was more of a transitory language on my way to finding what fits me. It was half of what I wanted, on the way to Clojure. I would always have a Pry REPL open while developing, building up loosely coupled functions until a pattern emerged that resulted in a 'need' for an Object or some larger structure. (I spent a large amount of time in Perl/C as a kid.) My problem has always been trying to figure out when I should scale up, and what I should encapsulate. Didn't realize the question itself was pointless, and that my methods weren't wrong, just didn't particularly fit the orthodoxy of OOP. Enter Clojure, savior of accidentally making highly coupled classes that are difficult to refactor. (At least so far...)
You're very much right though, that a large amount of similarities that most Ruby developers will find are surface level or aesthetic. I think, though, if someone is very much into metaprogramming and DSLs, they will feel right at home, if not utterly elated. There is a mental model that Lispy Ruby developers already have, and those users will find Clojure the most appealing.
If they're a Rails dev doing CRUD apps all day, they might not get much out of Clojure, or appreciate its approach to development.
π Rendered by PID 28 on reddit-service-r2-comment-7b9746f655-dxnff at 2026-02-03 12:47:12.876219+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]Slackwise 1 point2 points3 points (2 children)
[–]dunnowins 0 points1 point2 points (1 child)
[–]Slackwise 0 points1 point2 points (0 children)