Testing a symbol against a string ***SOLVED***

Q&A's, tips, howto's
Locked
dukester
Posts: 115
Joined: Tue May 08, 2007 1:06 pm
Location: Alberta, Canada

Testing a symbol against a string ***SOLVED***

Post by dukester »

I've lost a lot of the little LISP-ishness that I managed to acquire over the years. Use it or loose it ....

Anyway, I have a variable/symbol -- let's say:

Code: Select all

(set 'name  "some_name")
Down the road, I want to test te symbol name to see if it is equal to - say "dukester". If it is, I want to execute a function - say "emailPerson".

I thought that the following would work:

Code: Select all

(if (= name "dukester") (emailPerson))
But it's not working! Maybe there's a more LISP-ish of accomplishing this? TIA ...
duke

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: Testing a symbol against a string ***SOLVED***

Post by TedWalther »

That code looks correct. What is the error you are experiencing?

Code: Select all

$ newlisp
newLISP v.10.6.2 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h

> (set 'name "dukester")
"dukester"
> (if (= name "dukester") (println "hello"))
hello
"hello"
> 
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

dukester
Posts: 115
Joined: Tue May 08, 2007 1:06 pm
Location: Alberta, Canada

Re: Testing a symbol against a string ***SOLVED***

Post by dukester »

Thanks for replying! I solved the issue!! So I'm moving on to the next step in my little project!! :)
duke

Locked