[Jprogramming] Recurring holiday amusement
Raul Miller
rauldmiller at gmail.com
Tue Dec 25 14:14:13 UTC 2012
recur=: ^:
fib=: , +/@{.~&_2
arith=: ] , +&{:
e=: ] , [ (^t.@] * ^) #@]
--
Raul
On Sun, Dec 23, 2012 at 10:00 PM, km <km at math.uh.edu> wrote:
> Write a conjunction recur and verbs fib, arith, and e that do the following
>
> fib recur 5 [ 1 1 NB. five additional terms of Fibonacci sequence
> 1 1 2 3 5 8 13
> 0.5&arith recur 5 [ 3
> 3 3.5 4 4.5 5 5.5
> 1&e recur 5 [ ''
> 1 1 0.5 0.166667 0.0416667
> +/ 1&e recur 10 [ ''
> 2.71828
> +/ _1&e recur 10 [ ''
> 0.367879
> ^ 1 _1
> 2.71828 0.367879
>
> Conjunction recur helps create "recursive" lists.
>
> Kip Murray
>
> Sent from my iPad
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list