Page 1 of 1

bad code, strange error

Posted: Wed Nov 02, 2011 2:52 pm
by tomtoo
Hey guys,

this

Code: Select all

(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

Code: Select all

ERR: invalid function : (PLUG)
Ok, so the code is probably a terrible perversion, but I'm curious about the error.

Re: bad code, strange error

Posted: Wed Nov 02, 2011 7:44 pm
by cormullion
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... :)

Re: bad code, strange error

Posted: Thu Nov 03, 2011 1:27 am
by tomtoo
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.