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

Q&A's, tips, howto's

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

Postby dukester » Sun Aug 07, 2016 12:39 am

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
dukester
 
Posts: 108
Joined: Tue May 08, 2007 1:06 pm
Location: Alberta, Canada

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

Postby TedWalther » Sun Aug 07, 2016 5:05 am

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.
TedWalther
 
Posts: 605
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC

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

Postby dukester » Sun Aug 07, 2016 5:15 am

Thanks for replying! I solved the issue!! So I'm moving on to the next step in my little project!! :)
duke
dukester
 
Posts: 108
Joined: Tue May 08, 2007 1:06 pm
Location: Alberta, Canada


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron