Why don't people like lisp?
usenet at consulting.net.nz
Thu Oct 16 10:29:19 CEST 2003
> Here's a more realistic example that illustrates exactly the opposite
> point. Take the task of finding the sum of the square of a bunch of
> Do people really think to themselves when they do this task:
> Umm first make a variable called sum
> then set that variable sum to zero.
> Then get the next number in the list,
> square it,
> add it to the old value of sum,
> store the resulting value into sum,
> then get the next variable,etc....
> No they they think: sum up the square of a bunch of numbers.
> This has an almost direct translation to the lisp style:
> (apply '+ (mapcar #'(lambda(x)(* x x)) numlist)).
Here's my direct translation:
(loop for x in numlist sum (* x x))
More information about the Python-list