newLISP Fan Club

Forum => newLISP in the real world => Topic started by: tomtoo on November 02, 2011, 07:52:47 AM

Title: bad code, strange error
Post by: tomtoo on November 02, 2011, 07:52:47 AM
Hey guys,



this



(set 'agz (main-args 2))
(set  'onetwo (parse agz "."))
(if (= (length onetwo) 1)(append onetwo ".org")
(set 'onetwotwo (cons (onetwo 0)(onetwo 1))))


results in this



ERR: invalid function : (PLUG)


Ok, so the code is probably a terrible perversion, but I'm curious about the error.
Title: Re: bad code, strange error
Post by: cormullion on November 02, 2011, 12:44:54 PM
How are you calling this? Without any arguments to the script on the command line, I get:



ERR: string expected in function parse : agz



If there is an argument, it gives either:



ERR: list expected in function append :



or



ERR: invalid list index in function cons



if the string's empty. If the string has a period, it doesn't give an error.



It's all a bit weird... :)
Title: Re: bad code, strange error
Post by: tomtoo on November 02, 2011, 06:27:34 PM
I can't reproduce the error. dang.



Still, up 'til now, I've never typed or seen (PLUG) anywhere, ever.



I worked around the problem, so I never saw it again, but I think it's weird too.