Page 1 of 1

pop and find

Posted: Wed May 07, 2008 4:31 pm
by 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.

Posted: Wed May 07, 2008 4:51 pm
by newdep
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..

Posted: Wed May 07, 2008 5:26 pm
by Lutz
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.

Posted: Wed May 07, 2008 7:19 pm
by newdep
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! ;-)