Re:Functional data structures in JavaScript with Mori
by jkrems on Tuesday November 12, 2013 @01:11AM
(#6716154)
One thing I never understood about - awful generalization - "real" functional languages is their fascination with terrible naming. What I mean is things like `car`, `cdr`, `conj` - words that are impossible to understand if you don't already know what they mean.
[ Parent
| on HN ]
Re:Functional data structures in JavaScript with Mori
by tikhonj on Tuesday November 12, 2013 @06:53AM
(#6717209)
That might just be an age thing: older languages seem particularly bad at this. Lisp has its cars and its cdrs, but C is even worse with ioctl, atoi, fputc, strxfrm and so on.
Assembly is worse yet, and mixing C with assembly is basically a path to Lovecraftian madness: I really hate the way intrinsics look. Here's a real snippet from StackOverflow:
a_i = __mm_load_ps(&A[n*i+k]);
b_i = __mm_load_ps(&B[n*k+j]);
c_i = __mm_load_ps(&C[n*i+j]);
__m128d tmp1 = __mm_mul_ps(a_i,b_i);
__m128d tmp2 = __mm_hadd_ps(tmp1,tmp1);
__m128d tmp3 = __mm_add_ps(tmp2,tmp3);
__mm_store_ps(&C[n*i+j], tmp3)
You can also go too far in the other direction: see Java and especially Objective C.
Re:Functional data structures in JavaScript with Mori
by zachrose on Tuesday November 12, 2013 @01:35AM
(#6716229)
It's the same with C-like syntaxes, or OOP, or *nix stream commands, or the English language, or the phonetic alphabet. It's all a thick pile of history that has been agreed upon piece by piece.
Re:Functional data structures in JavaScript with Mori
by camus2 on Tuesday November 12, 2013 @04:11AM
(#6716654)
I guess there was a time where one had to care about the length of the source code.
that's why some came up with these abbreviations.
Re:Functional data structures in JavaScript with Mori
by lmm on Tuesday November 12, 2013 @05:07AM
(#6716854)
That's only lisp and particularly faithful derivatives (unfortunately including clojure). Haskell uses more natural names - head, tail, last.
Re:Functional data structures in JavaScript with Mori
by mjn on Tuesday November 12, 2013 @07:16AM
(#6717304)
Even most Lisps have first/rest as synonyms of car/cdr (dating back to some very old Lisps, and mandated by the Common Lisp standard). They just don't seem to have culturally caught on as idiomatic.