merits of Lisp vs Python

André Thieme address.good.until.2006.dec.22 at justmail.de
Fri Dec 15 13:27:03 EST 2006


Neil Cerutti schrieb:

> That's not a real difficulty, is it?
> 
> CL-USER> (mapcar #'(lambda (x)
>                    (funcall (nif x p z n)))
>                '(0 2.5 -8))

Didn't you forget the #' before p, z and n?


>> CL-USER> (mapcar #'(lambda (x)
>>                    (nif x (p) (z) (n)))
>>                '(0 2.5 -8))
>>
>> "no no"
>> "very positive"
>> "very negative"
>> ("zero" "positive" "negative")
>>
>> And the first example also still works the same way.
> 
> That's the part that Python doesn't naturally provide, and I
> believe, Python programmers don't usually want.

Then I have the solution:
they can build their own functional if.
Instead of

if x > 10:
   do()
   something()
else:
   foo()


They can say:

def blah1():
   do()
   something()

def blah2():
  foo()


pythonIF(x > 10,
   # then
     blah1,
   # else
     blah)



I personally thought the first version was the Python way.
Now let's admit that

nif number:
   pos_then:
     p()
   zero_then:
     z()
   neg_then:
     n()

is also the Python way. With just one problem: they can't have it.


André
-- 



More information about the Python-list mailing list