4 ms·
I think they are referring to the nested nature of lisp function calls. (second-fn (first-fn val)) I think that is really just personal preference/what yo
by lkschubert8 7y ago
I think they are referring to the nested nature of lisp function calls.
(second-fn (first-fn val))
I think that is really just personal preference/what you were taught as opposed to good or bad language design. But it really doesn't matter as one of the big benefits of lisp is it's ability to be metaprogrammed. That same example could be rewritten in clojure as
(-> val first-fn second-fn)
thanks to macros and doesn't suffer from the right->left reading.
- coldtea 7y ago> I think they are referring to the nested nature of lisp function calls. (second-fn (first-fn val)) How's this different than: secondFn(firstFn(val)) other than the placement of parenthesis, the two cases read exactly the same, left to right.
- lkschubert8 7y agoI've seen a lot of breaking that out into the following in imperative languages. var intermediaryVal = firstFn(val); var result = secondFn(intermediaryVal);
- slifin 7y ago(let [intermediary-val (first-fn val) result (second-fn intermediary-val)]) Or as one of the parents said (-> val first-fn second-fn)
- phyrex 7y agoI'm on the side of lisp here, but in OOP you'd usually write something like val.firstFn().secondFn()