Thanks Henry and Linda
I came up with this:
fib =: (,+/@(_2 _1&{))@]^:[&0 1
fib 8
0 1 1 2 3 5 8 13 21 34
...which works quite well.
With some rearranging, I got the two inputs on the right hand side to
switch after looking at Henry's suggestion.
Also, would you mind explaining the *]^:[* in your code, Henry? The
left/right brackets confuse me and I don't quite
understand how it moves one of the right hand side argument to the left
hand side of the conjunction.
Thanks again!
On Sat, Jul 20, 2019 at 7:08 PM Linda Alvord <[email protected]>
wrote:
> Interesting!
>
>
> newfib=: 13 :' }:}.(,[:+/_2&{.) ^: y (0 1)'
>
> newfib 10
> 1 1 2 3 5 8 13 21 34 55
>
> Linda
>
>
>
> -----Original Message-----
> From: Programming <[email protected]> On Behalf Of
> The3DSquare jOsHUa
> Sent: Saturday, July 20, 2019 6:11 PM
> To: [email protected]
> Subject: [Jprogramming] Question about ^:
>
> Hello, I'm new to this forum. However, I have a quick question. The
> conjugation ^: is represented as u ^: n y. Is there any way to make it like
> u ^: y n?
>
> Ie. Turning this:
> (,[:+/_2&{.) ^: 4 (0 1)
> into this:
> (,[:+/_2&{.) ^: (0 1) 4
>
> So essentially, swapping the two right-hand inputs for ^:.
>
> Thanks!
> ----------------------------------------------------------------------
> For information about J forums see
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C28fe0a3103ab4f8fd47308d70d5f3e9d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636992575030326979&sdata=%2FRIjZTVIO46RzON3REjubsAwM4H9UdiLKyL568m0B2M%3D&reserved=0
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm