[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tail call elimination
From: |
Paul Smith |
Subject: |
Re: Tail call elimination |
Date: |
Thu, 21 May 2020 11:46:40 -0400 |
On Thu, 2020-05-21 at 15:35 +0000, Tim Murphy wrote:
> There's something to be said for this being able potentially to work
> - not that I'm pushing it mind:
>
> FILE_SIZES:= 5 2 1 4
> TOTAL:=$(+ $(FILE_SIZES)) # TOTAL is 5+2+1+4
>
> Here I'm not objecting to ($math +,$(FILE_SIZES)) or $(op
> +,$(FILE_SIZES)) - whatever on them - I am only trying to point out
> that we naturally iterate over lists of things in make (e.g. of
> targets or filenames) which are space or tab separated and if you
> could put a list of numbers into an operation and it just worked it
> could be quite neat.
I was certainly assuming that arbitrary lists of operands would work,
regardless of the name chosen. In fact if you look back over the
examples I've been posting you'll see virtually every one of them has
more than two operands :)
In my discussion of the way to handle conditions I even mentioned
allowing just one operand which would give the identity function.
After sleeping on it, though, I'm not sure if that's the best idea.
Maybe we should assume "0" for a missing operand regardless of the
operator.
That would mean $(op + 7 $(op < 10 5)) would be 7, but
$(op * 7 $(op < 10 5)) would be 0. That seems like it would be more
useful behavior than always choosing identity.
> It would obviously permit some error cases to be expressed which
> could be undesirable e.g. $(/ 1 2 3) could be a bit ambiguous or at
> least an unwanted possibility.
Seems useful to me. For example:
$(/ $(filesize) 1024 1024 1024)
gives the size in GiB.
- Re: Tail call elimination, (continued)
- Re: Tail call elimination, Paul Smith, 2020/05/20
- Re: Tail call elimination, Pete Dietl, 2020/05/20
- Re: Tail call elimination, Paul Smith, 2020/05/20
- Re: Tail call elimination, Daniel Herring, 2020/05/20
- Re: Tail call elimination, Pete Dietl, 2020/05/20
- Re: Tail call elimination, Pete Dietl, 2020/05/20
- Re: Tail call elimination, Paul Smith, 2020/05/21
- Re: Tail call elimination, Kevin R. Bulgrien, 2020/05/21
- Re: Tail call elimination, Paul Smith, 2020/05/21
- Re: Tail call elimination, Tim Murphy, 2020/05/21
- Re: Tail call elimination,
Paul Smith <=
- Re: Tail call elimination, Paul Smith, 2020/05/21
- Re: Tail call elimination, Kevin R. Bulgrien, 2020/05/21
- Re: Tail call elimination, Kevin R. Bulgrien, 2020/05/21
- Re: Tail call elimination, Paul Smith, 2020/05/21
- Re: Tail call elimination, Pete Dietl, 2020/05/21
- Re: Tail call elimination, Pete Dietl, 2020/05/22
- Re: Tail call elimination, Tim Murphy, 2020/05/22
- Re: Tail call elimination, Pete Dietl, 2020/05/23
- math expressions (was: Re: Tail call elimination), Paul Smith, 2020/05/23
- Re: math expressions (was: Re: Tail call elimination), Pete Dietl, 2020/05/23