Re:The Beauty of Clojure
by owen4d on Wednesday August 26, 2015 @11:08AM
(#10123376)
Ha, yeah, maybe. I guess what I meant is this, say you have some OO/Scala-like code like this:
mydata.doA(blah).doB().doC(blah2).etc()
You can read it left-to-right: I've got some data, I do something to it, I then do something else to that result, etc. Maybe it's just that I've been using Java, and the like, for years but this feels simpler to me than s-expressions. At least initially.
With s-expressions I get something like (ignoring threading macros):
(etc (doC blah2 (doB (doA blah mydata))))
So when reading, from a data perspective, you kind of read outwards from the inner s-expression (which seems right-to-left to me). Or keep a kind of mental stack, as you read inwards (left-to-right). No?
mydata.doA(blah).doB().doC(blah2).etc()
You can read it left-to-right: I've got some data, I do something to it, I then do something else to that result, etc. Maybe it's just that I've been using Java, and the like, for years but this feels simpler to me than s-expressions. At least initially.
With s-expressions I get something like (ignoring threading macros):
(etc (doC blah2 (doB (doA blah mydata))))
So when reading, from a data perspective, you kind of read outwards from the inner s-expression (which seems right-to-left to me). Or keep a kind of mental stack, as you read inwards (left-to-right). No?