newLISP Fan Club

Forum => newLISP in the real world => Topic started by: newdep on May 07, 2008, 09:31:27 AM

Title: pop and find
Post by: newdep on May 07, 2008, 09:31:27 AM
Hi Lutz,



I could be wrong that pop and find worked together previously...?

seems they don't, or was this realy always the case?



(set 'a '( "ab"))

(pop a (find "de" a))



ERR: missing argument



..that because 'find returned 'nil



PS: missing argument is somewhat strange here.. as 'nil is an argument

but not an index.
Title:
Post by: newdep on May 07, 2008, 09:51:07 AM
Actualy i have the same with =>



> (set 'a '( "a" "b" "c" "a"))

("a" "b" "c" "a")



>(pop a (ref "Z" a))



ERR: missing argument

>





I dont understand this, according to the manual list-indexes should

be possible together with 'ref.. Now i always need to check if 'ref isnt 'nil

and cant nest them anymore..



I know the ERR: was introduced someway back...

but Im a true? empty? nil? checking programmer..

(Time to assimilate with the consortium :-)





PS: Would be nice to have a summery in the manual that

displays in an Eye blink What functions return 'nil , '() or ERR: on errors..
Title:
Post by: Lutz on May 07, 2008, 10:26:35 AM
You cannot use an empty list () as an index, there has to be at least one number in it. Nothing has changed here, it always gave an error.
Title:
Post by: newdep on May 07, 2008, 12:19:31 PM
oke...good ;-) I though it was the Sun that hit me ;-)





I find myself more and more using  (and )  &  (or ) inside

newlisp, I almost dont use any begin, unless, if, when,  anymore..



Is that a good thing or a bad thing? basicly it all comes back to 0 or 1..



But programming in the (and ) & (or ) mode is pretty specific and needs

to be secured..but the code looks very very very clean and readable! ;-)