From: Tim Gathercole
Subject: Utility to convert Std Math to Lisp notation?
Date: 
Message-ID: <551urtg2b2f2bcqr73k5jkmp7seg8v5qia@4ax.com>
I am looking for a little utility that will convert standard math
notation 3+6-2*7 into lisp notation (- (+ 3 6 ) (* 2 7)) 

I have dozens of CAD macros I need to convert to Auto-Lisp and doing
this sort of thing be hand will be a real pain. Does anyone have
something to help automate the process?

Best wishes - Tim

From: Erann Gat
Subject: Re: Utility to convert Std Math to Lisp notation?
Date: 
Message-ID: <1f4c5c5c.0110061022.4515b543@posting.google.com>
Try

http://www.google.com/search?q=lisp+infix

where you will find

http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/infix/0.html

also:

http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/parcil/0.html

Erann Gat
gat at flownet.com

Tim Gathercole <···@timg.demon.co.uk> wrote in message news:<··································@4ax.com>...
> I am looking for a little utility that will convert standard math
> notation 3+6-2*7 into lisp notation (- (+ 3 6 ) (* 2 7)) 
> 
> I have dozens of CAD macros I need to convert to Auto-Lisp and doing
> this sort of thing be hand will be a real pain. Does anyone have
> something to help automate the process?
> 
> Best wishes - Tim
From: Martti Halminen
Subject: Re: Utility to convert Std Math to Lisp notation?
Date: 
Message-ID: <3BC18679.7ECF75B1@kolumbus.fi>
Erann Gat wrote:

> Try
> 
> http://www.google.com/search?q=lisp+infix

http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/infix/0.html

http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/parcil/0.html

> Tim Gathercole <···@timg.demon.co.uk> wrote in message news:<··································@4ax.com>...
> > I am looking for a little utility that will convert standard math
> > notation 3+6-2*7 into lisp notation (- (+ 3 6 ) (* 2 7))
> >
> > I have dozens of CAD macros I need to convert to Auto-Lisp and doing
> > this sort of thing be hand will be a real pain. Does anyone have
> > something to help automate the process?

A little warning, though: both of the above-mentioned point to stuff
written in Common Lisp. If you are trying to do this conversion in
AutoLisp, they won't work as such.

One simpler way, which might be easier to convert to AutoLisp is in
Peter Norvig's book "Paradigms of Artificial Intelligence Programming";
also available on WWW somewhere.

Generally, asking AutoLisp -specific questions might be safer in
comp.cad.autocad. The answers you get here might not recognize its
limitations compared to CL.

--
From: Marco Antoniotti
Subject: Re: Utility to convert Std Math to Lisp notation?
Date: 
Message-ID: <y6clmiozlmq.fsf@octagon.mrl.nyu.edu>
Tim Gathercole <···@timg.demon.co.uk> writes:

> I am looking for a little utility that will convert standard math
> notation 3+6-2*7 into lisp notation (- (+ 3 6 ) (* 2 7)) 
> 
> I have dozens of CAD macros I need to convert to Auto-Lisp and doing
> this sort of thing be hand will be a real pain. Does anyone have
> something to help automate the process?

The INFIX package is available in the AI.Repository at CMU

http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/0.html

	#I(3+6-2*7)  read-macroexpands into (+ 3 6 (- (* 2 7)))

According to (+/-) standard C precedence rules.  Note that the result
is the same, although the grouping of the expressions is different.

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'.