bad code, strange error

Q&A's, tips, howto's
Locked
tomtoo
Posts: 46
Joined: Wed Oct 28, 2009 10:00 pm

bad code, strange error

Post 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.

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: bad code, strange error

Post 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... :)

tomtoo
Posts: 46
Joined: Wed Oct 28, 2009 10:00 pm

Re: bad code, strange error

Post 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.

Locked