Hello,
For (eql "foo" "foo") hyperspec says true but clisp (2.46 on windows
+cygwin) says nil. (I tried clisp with maximum ansi compliance as
well)
My reading of Seibel's Practical Common Lisp (Ch. 4, p. 47) suggests
nil.
I did not find anything in the hyperspec errata.
Who is right?
Thanks,
Mirko
"The eql predicate is true if its arguments are eq, or if they are
numbers of the same type with the same value, or if they are character
objects that represent the same character."
you are looking for equal, which identifies isomorphic objects
On Dec 15, 3:31 pm, ··················@gmail.com wrote:
> "The eql predicate is true if its arguments are eq, or if they are
> numbers of the same type with the same value, or if they are character
> objects that represent the same character."
>
> you are looking for equal, which identifies isomorphic objects
Yep, I knew about e`qual'. I got there by way of `eql'.
I was not clear, (nor careful) enough about hyperspec. Here is the
example from hyperspec under eql:
(eql "Foo" "Foo")
=> true
OR=> false
Which one?
In article
<····································@g38g2000yqd.googlegroups.com>,
Mirko <·············@gmail.com> wrote:
> On Dec 15, 3:31�pm, ··················@gmail.com wrote:
> > "The eql predicate is true if its arguments are eq, or if they are
> > numbers of the same type with the same value, or if they are character
> > objects that represent the same character."
> >
> > you are looking for equal, which identifies isomorphic objects
>
> Yep, I knew about e`qual'. I got there by way of `eql'.
>
> I was not clear, (nor careful) enough about hyperspec. Here is the
> example from hyperspec under eql:
>
> (eql "Foo" "Foo")
> => true
> OR=> false
>
> Which one?
It's implementation-dependent, and likely even context-dependent. The
compiler is allowed to coalesce constants, making all the "Foo" literals
within a compilation unit be EQL to each other. But it's not required
to do this, so it could keep them distinct like the reader does.
If the implementation's REPL compiles the expression before executing
it, it might coalesce the constants, resulting in true.
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Mirko <·············@gmail.com> writes:
> On Dec 15, 3:31�pm, ··················@gmail.com wrote:
>> "The eql predicate is true if its arguments are eq, or if they are
>> numbers of the same type with the same value, or if they are character
>> objects that represent the same character."
>>
>> you are looking for equal, which identifies isomorphic objects
>
> Yep, I knew about e`qual'. I got there by way of `eql'.
>
> I was not clear, (nor careful) enough about hyperspec. Here is the
> example from hyperspec under eql:
>
> (eql "Foo" "Foo")
> => true
> OR=> false
>
> Which one?
For this specific form, Barry answered.
Notice that:
(eql #1="Foo" #1#) --> true
(let ((f "Foo")) (eql f f)) --> true
(let ((f "Foo") (g (copy-string "Foo"))) (eql f g)) --> NIL
What CLHS says here, is that reading "Foo" twice may or may not give the same object.
With the reader macros #= and ##, we can ensure that the same object
is used in several places in the s-exp read. But in general you will
have your string objects bound to variables, and you will pass the
values bound to variables to EQL, so you get determinately true or NIL
depending on whether you give twice the same string object or not.
--
__Pascal Bourguignon__
On Dec 15, 10:55 pm, Mirko <·············@gmail.com> wrote:
> Hello,
>
> For (eql "foo" "foo") hyperspec says true but clisp (2.46 on windows
> +cygwin) says nil. (I tried clisp with maximum ansi compliance as
> well)
Where does it say so?
My hyperspec says:
(eql "Foo" "Foo")
=> true
OR=> false
Note that "OR".
In article
<····································@s24g2000vbp.googlegroups.com>,
Mirko <·············@gmail.com> wrote:
> Hello,
>
> For (eql "foo" "foo") hyperspec says true but clisp (2.46 on windows
> +cygwin) says nil. (I tried clisp with maximum ansi compliance as
> well)
>
If you look at the Hyperspec it says in the examples:
(eql "Foo" "Foo") => true OR => false
See the 'OR'?
If it is the same one string, EQL returns t.
If they are different string objects, but with the same
characters, it is nil.
> My reading of Seibel's Practical Common Lisp (Ch. 4, p. 47) suggests
> nil.
>
> I did not find anything in the hyperspec errata.
>
> Who is right?
>
> Thanks,
>
> Mirko
--
http://lispm.dyndns.org/
On Dec 15, 3:40 pm, Rainer Joswig <······@lisp.de> wrote:
> In article
> <····································@s24g2000vbp.googlegroups.com>,
>
> Mirko <·············@gmail.com> wrote:
> > Hello,
>
> > For (eql "foo" "foo") hyperspec says true but clisp (2.46 on windows
> > +cygwin) says nil. (I tried clisp with maximum ansi compliance as
> > well)
>
> If you look at the Hyperspec it says in the examples:
>
> (eql "Foo" "Foo") => true OR => false
>
> See the 'OR'?
>
> If it is the same one string, EQL returns t.
> If they are different string objects, but with the same
> characters, it is nil.
>
> > My reading of Seibel's Practical Common Lisp (Ch. 4, p. 47) suggests
> > nil.
>
> > I did not find anything in the hyperspec errata.
>
> > Who is right?
>
> > Thanks,
>
> > Mirko
>
> --http://lispm.dyndns.org/
Thanks for the clarification.
Mirko
M> I did not find anything in the hyperspec errata.
JFYI, hyperspecs examples are not normative, they are just illustrations.
in some cases hyperspec examples are incorrect. not in this case, though.