[Openmcl-devel] Mark Kantrowitz infix.lisp easter egg?

Gary Byers gb at clozure.com
Sat Dec 3 00:22:59 PST 2011


That's part of the problem.  The parser tries to read:

(<valid-number><exponent-marker> <sign> <integer>)

as a float in (infix) scientific notation (sorta  ...).  What I'm calling
a <valid-number> is apparently supposed to be a string of decimal digits
containing at most one dot; the function INFIX::VALID-NUMBERP considers
the empty string to match, so things like (s + 1) get turned into S+1.

If you change VALID-NUMBERP to not consider empty strings to be valid numbers,
you get:

? (values (read-from-string "#i(s + 1)"))
(+ S 1)
?

I don't know whether or not the (very old) code contains other similar
problems; the fact that it's been around as long as it has doesn't
seem to have anything to do with that.

On Fri, 2 Dec 2011, Joshua TAYLOR wrote:

> On Fri, Dec 2, 2011 at 8:56 PM, Alexander Repenning
> <ralex at cs.colorado.edu> wrote:
>> Using?Mark Kantrowitz?old but very handy infix we noticed some peculiar
>> pattern of errors where very basic expressions do not correctly convert
>> infix expressions into prefix ones. The version I just tried was this
>> one:?http://www.cliki.net/infix
>>
>> in => pre, red for incorrect
>>
>> "a + 1" ? =>?(+ A 1)
>> "s + 1" ? => ?S+1
>> "s - 1" ? => ?S-1
>> "s * 1" =>?(* S 1)
>> "a + 1.5"? => (+ A 1.5)
>> "s + 1.5"? =>?(+ S 1.5)
>> "s + s" =>?(+ S S)
>> "s + 1 + 1" =>?(+ S+1 1)
>> "s + 1e1" =>?(+ S 10.0)
>>
>> Can somebody see a pattern here? AFAIK, the combination of the one letter
>> variables names that are characters D, E, F, L, or S followed by "+" or "-"
>> and then followed by an int does not work.
>
> Didn't look into the code, but those letters are special?
>
> CL-USER 15 > (list 1.0d+0 1.0d-0
>                   1.0e+10 1.0e-10
>                   1.0f+0 1.0f-0
>                   1.0l+0 1.0f-0
>                   1.0s+0 1.0s-0)
> (1.0D0 1.0D0 1.0E10 1.0E-10 1.0 1.0 1.0D0 1.0 1.0S0 1.0S0)
>
> //JT
>
> -- 
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list