Page 1 of 1

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

Posted: Sun Aug 07, 2016 12:39 am
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 ...

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

Posted: Sun Aug 07, 2016 5:05 am
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"
> 

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

Posted: Sun Aug 07, 2016 5:15 am
by dukester
Thanks for replying! I solved the issue!! So I'm moving on to the next step in my little project!! :)