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

Ron Garret ron at flownet.com
Sat Dec 3 05:30:18 UTC 2011


I don't know what's causing this, but if you can't figure it out you might want to try my infix parser (attached).  It integrates seamlessly into the lisp reader by exploiting the normally unused syntax space of a symbol followed by an open paren with no intervening whitespace, e.g.:

? cos(2*pi+1)
0.54030230586814D0

(Uses Tobias Retweiler's named readtables -- http://common-lisp.net/project/named-readtables/)

rg


On Dec 2, 2011, at 5:56 PM, Alexander Repenning 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. 
> 
> Is this a bug or some very special case that is supposed to work like this for no (to me) obvious reason? If this is bug, how could this have slipped through the net for so many years? I know many people have using this software. I tried various versions of infix.lisp. Are D, E, F, L, or S special tokens? If so, what do they mean, and where are they declared?
> 
> Confused,  Alex
> 
> 
> ---- test program spitting out the variable names not working ------
> 
> This should print nothing:
> 
> (map 
>   nil
>   #'(lambda (Char)
>       (when (symbolp (read-from-string (format nil "#i(~A + 1)" Char))) ;; should be a list, NOT a symbol!
>         (print Char)))
>   "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
> 
> but prints:
> 
> #\D 
> #\E 
> #\F 
> #\L 
> #\S 
> 
> 
> 
> Prof. Alexander Repenning
> 
> University of Colorado
> Computer Science Department
> Boulder, CO 80309-430
> 
> vCard: http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf
> 
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parcil.lisp
Type: application/octet-stream
Size: 10181 bytes
Desc: not available
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20111202/99a6274f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: globals.lisp
Type: application/octet-stream
Size: 3071 bytes
Desc: not available
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20111202/99a6274f/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: symbol-reader-macros.lisp
Type: application/octet-stream
Size: 3354 bytes
Desc: not available
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20111202/99a6274f/attachment-0002.obj>


More information about the Openmcl-devel mailing list