pop and find

Started by newdep, May 07, 2008, 09:31:27 AM

Previous topic - Next topic

newdep

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.
-- (define? (Cornflakes))

newdep

#1
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..
-- (define? (Cornflakes))

Lutz

#2
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.

newdep

#3
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! ;-)
-- (define? (Cornflakes))