francesco...@europe.com (Francesco Moi) writes: > I'm NOT using Common Lisp, but a software wich must to be customized > by using a kind-of-Lisp: CoCreate SolidDesigner.
> What I'm trying to do is comparing a String and a Symbol.
> My String is: "John" > And my Symbol is: John
> But always I test: > (string= Name1 Name2)... it's always NIL
Symbols are upcased by default by the Lisp reader (its parser). If you do:
(string= "John" 'John)
you are really executing
(STRING= "John" 'JOHN)
STRING= is a case-sensitive comparison. Use STRING-EQUAL or put ||'s around the symbol John to retain its case.
* Francesco Moi | I'm NOT using Common Lisp, but a software wich must to be customized | by using a kind-of-Lisp: CoCreate SolidDesigner.
This information is crucial to get help. "Lisp" is not one language, but the one people have a right to assume in the absence of antyhing else you mean is Common Lisp. If you do know about the default, it is not an error to overspecify.
| What I'm trying to do is comparing a String and a Symbol.
In Common Lisp, this works because a symbol is a string designator. I.e., when you use a symbol in a string "context", what you get is really (symbol-name symbol). This may not be true for other Lisp, so you may have to make that function call explicitly.
| And then my idea is removing quotes " " from Name1, or adding them to | Name2...
I hope you have made one of those changes at a time.
/// -- The past is not more important than the future, despite what your culture has taught you. Your future observations, conclusions, and beliefs are more important to you than those in your past ever will be. The world is changing so fast the balance between the past and the future has shifted.
francesco...@europe.com (Francesco Moi) writes: > Hi all.
> I'm NOT using Common Lisp, but a software wich must to be customized > by using a kind-of-Lisp: CoCreate SolidDesigner.
That explains a lot of the mis-communication. We are in presence of an instance of Greenspun's Tenth Rule. :)
I do not think that many people on this group are familiar with the "Lisp" implemented by the tool you are using. The answer that I gave and saw were all relating to Common Lisp.
Cheers
-- Marco Antoniotti ======================================================== NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488 719 Broadway 12th Floor fax +1 - 212 - 995 4122 New York, NY 10003, USA http://bioinformatics.cat.nyu.edu "Hello New York! We'll do what we can!" Bill Murray in `Ghostbusters'.
francesco...@europe.com (Francesco Moi) writes: > Hi all.
> I'm NOT using Common Lisp, but a software wich must to be customized > by using a kind-of-Lisp: CoCreate SolidDesigner.
> What I'm trying to do is comparing a String and a Symbol.
> My String is: "John" > And my Symbol is: John
> But always I test: > (string= Name1 Name2)... it's always NIL
> And then my idea is removing quotes " " from Name1, or adding them to > Name2...
> I do not know what to do...
You can try the two approaches:
(string= (symbol-name 'John) "JOHN")
or
(eql 'John (intern "JOHN"))
Note that I put the string in upper case. Common Lisp in default reader mode will translate symbol names to upper. You might have to experiment to see whether your Lisp implementation does the same.
-- Lieven Marchand <m...@wyrd.be> She says, "Honey, you're a Bastard of great proportion." He says, "Darling, I plead guilty to that sin." Cowboy Junkies -- A few simple words