[Jprogramming] Tacit form: Where to put the start value..?
Raul Miller
rauldmiller at gmail.com
Tue Aug 7 15:12:11 UTC 2018
You've gotten some other good answers, but, just in case:
(+:@]^:[&1)3
8
Thanks,
--
Raul
On Tue, Aug 7, 2018 at 6:56 AM Martin Kreuzer <info at airkreuzer.com> wrote:
>
> Hi all -
>
> Have been playing with the Power conjunction using this (not uncommon) example
>
> po2=. 3 : '+:^:y 1' NB. power of two by repeated doubling
> po2 5
> 32
>
> Then I have wanted to come up with a tacit version of *po2 (a monad
> with no of repetions as only argument) and tried
>
> (+:^:])5 NB. does the doubling alright but ...
> 160
>
> and a number of variations of this
>
> (+:^:] 1)5
> |syntax error
> | (+:^:]1)5
>
> Q: Where should I put the start value of 1..?
>
> Thanks
> -M
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list