help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: if vs. when vs. and: style question


From: Pascal J. Bourguignon
Subject: Re: if vs. when vs. and: style question
Date: Tue, 24 Mar 2015 16:18:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:


>> (defun find-thingy (name)
>>   (or (find-thingy-in-whatcha name)
>>       (find-thingy-in-macall name)
>>       (find-thingy-in-it name)
>>       (error "not found")))
>>
>> which is much more concise and clear than ...
>
> But is it clearer than
>
>     (defun look-here () "here")
>
>     (cond
>      ((look-here))
>      ((look-there))
>      (t (message "Not found")))
>
> as well? I always thought of `cond' and `if' as
> identical save for syntax.

In my opinion, yes.  

I believe this cond form is harder to read, 
because it is inhabitual.

Personnally, I would understand it as well, 
but I'm not sure it would be the case of all lispers.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

[Prev in Thread] Current Thread [Next in Thread]