Dynamic functions

Q&A's, tips, howto's
Locked
statik
Posts: 58
Joined: Thu Apr 14, 2005 1:12 am

Dynamic functions

Post by statik »

(set 'a "myprogram -abc -use=something example.txt")
(set 'b (parse a))

b => ("myprogram" "-abc" "-use=something" "example.txt")

Now I need a way to execute this as a newlisp function. Something along the lines of:

(eval ((nth 0 b) (nth 1 b) (nth 2 b) (nth 3 b)))

I need newlips to try to turn all that into (myprogram -abc -use=something example.txt), or in other words, I need it to take my string and turn it into a newlisp function.

Any ideas?
-statik

statik
Posts: 58
Joined: Thu Apr 14, 2005 1:12 am

Post by statik »

Ok, I got it running the function using:

(eval-string (append "(" (nth 0 parsed) " " (nth 1 parsed) ")"))

However, the (nth 1 parsed) needs to be a string.

I cant add quotes though using append: eg, (append """ (nth 1 parsed) "'")

Any help is appreciated.
-statik

statik
Posts: 58
Joined: Thu Apr 14, 2005 1:12 am

Post by statik »

grundle got me some working code :) kudos.
-statik

Locked