Oops my mistake Nil's a typo in this cut-down "for the forum" post...it is NIL in the real thing. Irrespective..thank you for your better version. I also used if (atom Ele) but want to get familiar with the structures. Dean
On 9 December 2016 at 21:59, dean <deangwillia...@gmail.com> wrote: > Hi Alex > > >Is it that you want more than one expression in the true-clause > > YESSS EXACTLY THAT > Thank you very much for 'prog'...I had no idea re it's existence. > > Also thank you for putting me straight re ifn (car Ele) > i.e. I just fiddled until I got some differentiation between an atom and > list. > > Best Regards > Dean > > > > On 9 December 2016 at 21:07, Alexander Burger <a...@software-lab.de> wrote: > >> Hi Dean, >> >> On Fri, Dec 09, 2016 at 08:21:54PM +0000, dean wrote: >> > #{ >> > " is atom -- undefined if I wrap,,, prinl Ele " is atom" >> > in yet another set of brackets >> > i.e. it's already inside 4 sets of brackets >> > inside the function lmnu_to_mnu_tbl(). >> > The only reason I did the last enclosing brackets was that I wanted >> to add >> > some additional statements after the print statement >> > so how would you do that i.e. what are the rules >> > 'cos at present I just put brackets around what I view as distinct >> > operations. >> > .... >> > (de lmnu_to_mnu_tbl (L Lkey) >> > (for Ele L >> > ( >> > if (== (car Ele) Nil) >> > ( >> > # " is atom" undefined if I include this last set of >> brackets >> > #(prinl Ele " is atom") >> > #<-------i.e. >> > prinl Ele " is atom" #by contrast >> this >> > is fine >> > ) >> > ( >> > prinl Ele " is list" >> > ) >> > ) >> > ) >> > ) >> >> Hmm, OK. Where exactly do you want to put brackets, and why? >> >> Do you mean >> >> (if ... >> ((prinl ...)) ? >> >> Note that this says "obtain the function by evaluating (prinl ...)", >> because the >> CAR (i.e. the expected function) of the expression >> >> ((prinl ...)) >> >> is >> >> (prinl ...) >> >> which is probably not what you mean. >> >> >> Is it that you want more than one expression in the true-clause of 'if'? >> Then >> you could use 'prog' >> >> (if ... >> (prog >> (prinl ...) >> (doSomething) ) >> (doSomeThingElse) ) >> >> >> Also, note that >> >> (== (car Ele) Nil) >> >> is a bit strange. The symbol 'Nil' is not bound, may just by chance be >> NIL. >> Then, comparing with NIL is superfluous. Insted of >> >> (if (== (car Ele) NIL) >> >> you better write >> >> (if (not (car Ele)) >> >> or optimally >> >> (ifn (car Ele) >> >> Cheers, >> - Alex >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> > >