bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Recursive Lambda


From: Juergen Sauermann
Subject: Re: [Bug-apl] Recursive Lambda
Date: Wed, 06 Jul 2016 11:57:54 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi Kacper,

I agree. I was also thinking of the power operator but then could not find the right way of using it.

Your solution is very elegant and clear.

/// Jürgen



On 07/06/2016 03:10 AM, Kacper Gutowski wrote:
I would argue that using fixed strings and idiomatic construction to
select one to eval is less complex than conditionally concatenating
fragments.

Anyway, since other languages conditioned me to avoid eval like the
plague and power operator can also be used to construct arbitrary
control flow, I would try doing it this way:

      fact←{{⍵ × fact ⍵-1}⍣(⍵>2)⊢1⌈⍵}

If you need separate else branch, though, the idiom Xtian posted is
probably the clearest way to do it.

-k



reply via email to

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