bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tail call elimination


From: Pete Dietl
Subject: Re: Tail call elimination
Date: Thu, 21 May 2020 12:39:11 -0500

>   5 + (2 * 9 / (7 + 5 + 4)) * (1024 * 1024) / 19
>
> becomes:
>
>   $(math +, 5 $(math /, $(math *, $(math /, $(math *, 2 9) $(math +, 7 5 4)) 
> $(math *, 1024 1024)) 19))
>
> versus:
>
>   $(op + 5 $(op / $(op * $(op / $(op * 2 9) $(op + 7 5 4)) $(op * 1024 1024)) 
> 19))
>
> or:
>
>   $(+ 5 $(/ $(* $(/ $(* 2 9) $(+ 7 5 4)) $(* 1024 1024)) 19))

I propose the following (a variation of example 2):

$(math + 5 (/ (* (/ (* 2 9) (+ 7 5 4)) (* 1024 1024)) 19))

This would involve doing our own parsing of the argument,
however this should be trivial since we are using prefix notation.

same with cond.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]