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