alexr_rwx: (my fandom writes your software)
[personal profile] alexr_rwx
From Paulson's ML for the Working Programmer:
The product of a list of integers can be computed like this:

fun prod ns = if null ns then 1 else (hd ns) * (prod (tl ns));

If you prefer this version of prod, you might as well give up ML for Lisp. For added clarity, Lisp primitives have names like CAR and CDR. Normal people find pattern-matching more readable than hd and tl.
*laughs* I guess I'd better give up ML for LISP, then, because that's exactly how I'd do it. I'm sure that ML is, uh, lovely when you get to know it (perhaps analogous to "I'm sure that deep down inside, he's a really nice guy..."), but it just feels pretentious, as a language. The Paulson text really doesn't help.

And it's not that it's totally debilitating, trying to code in it, anymore... it's just that it's incredibly slow going, and the documentation sucks. And this is me whining that I could whip out the cs4240 project in LISP in like a quarter of the time, if that.

Nyip, off to go do things...

Date: 2004-10-11 02:40 pm (UTC)
From: [identity profile] sstrickl.livejournal.com
And now I reread the quote and see "Normal people find pattern-matching more readable than hd and tl." Oops, I wouldn't have even posted what I did if I'd seen that, though I am still curious as to why you prefer the other :)

I swear I'm not an idiot!

Profile

alexr_rwx: (Default)
Alex R

May 2022

S M T W T F S
1234 567
891011121314
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 23rd, 2025 02:12 pm
Powered by Dreamwidth Studios