Why don't people like lisp?
Rmagere
rmagere at *the-mail-that-burns*.*figure-it-out*
Thu Oct 16 09:27:38 EDT 2003
Bengt Richter wrote:
> On Thu, 16 Oct 2003 01:25:33 +0200, Michael Walter <cm at leetspeak.org>
> wrote:
>
>> larry wrote:
>>> 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 numbers.
>>> 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)).
>> Well..
>> sum (map (\x -> x ** 2) [1..10])
>> in Haskell, or
>> sum (map ((lambda x: x ** 2), range(1,11)))
>
> Too much line noise ;-)
>
> sum([x*x for x in range(1,11)])
>
Then I would say that a clearer way to express what a person think is:
(loop for number in numberlist sum (expt number power))
rmagere
--
I saw a better version of this signature type can any one give any
indication?
((lambda (a b)
(if (= (length a) (length b))
(loop with string for x across a and y across b do (format t "~a~a"
x y))
(progn (loop with string for x across a and y across b do (format t
"~a~a" x y))
(format t "~a" (char a (- (length a) 1))))))
"raeehtalcm" "mgr at omi.o")
More information about the Python-list
mailing list