[Jprogramming] Recurring holiday amusement

km km at math.uh.edu
Mon Dec 24 22:57:30 UTC 2012


OK, conjunction

   recur =: 2 : '(, u)^:n'

and you can still write the verbs.  As you can see, the result of recur applies u to the current list and appends that result to the current list, repeating this operation n times.  Just about any list can be produced by designing an appropriate u .  Your assignment is to design verbs fib, arith, and e .  Kip Murray

Sent from my iPad


On Dec 23, 2012, at 9: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