Hi Linda,

You might like:

fiba =: 3 : 0
'height width' =. $y
if. (height>:width) do.
  y,.(height,height)$height
else.
  y,(width,width)$width
end.
)

NB. or similarly:

fibb =: 3 : 'y (,`,.) @.(>:/$y)  (s,s) $ s=.>./$y'    NB. wow, gerund

NB. run:

fiba^:7 (1 1$1)
viewmat 5 | fibb^:10 (1 3$1)  NB. Lucas mod 5 

-- 
Kind regards,
Ben

________________________________________
From: Programming [[email protected]] on behalf of Linda 
A Alvord [[email protected]]
Sent: Monday, February 27, 2017 16:37
To: [email protected]
Subject: Re: [Jprogramming] Explicit fib

That's nice, glad you were awake!  Linda

-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf 
Of David Lambert
Sent: Monday, February 27, 2017 9:17 AM
To: programming
Subject: Re: [Jprogramming] Explicit fib

    fib3=: 13 :'}.1|.,''),(fib2 '',"_ 1":i.y,1'

    ". fib3 6
0 1 1 2 3 5


Let's reorganize by grouping all the strings to increase the sentence 
legibility.

    '),(fib2 ' ,"_ 1  ": ,. i. 7
),(fib2 0
),(fib2 1
),(fib2 2
),(fib2 3
),(fib2 4
),(fib2 5
),(fib2 6

 From here ravel, rotate by one position, finally discard the extra comma.


On 02/27/2017 07:00 AM, [email protected] wrote:
> Date: Mon, 27 Feb 2017 05:01:34 -0500
> From: "Linda A Alvord"<[email protected]>
> To:<[email protected]>
> Subject: Re: [Jprogramming] Explicit fib
> Message-ID: <000301d290e0$7ae35ac0$70aa1040$@net>
> Content-Type: text/plain;     charset="utf-8"
>
> I like fib2 and things were going well but I hit a snag:
>
> ]W=:*i.2 2
> 0 1
> 1 1
>         mp=:+/ . *
>         fib2=:3 : '{. W&mp^:y 0 1'
>     ". }:, (14 5$'(fib2'),"1 (' ',"1  ' ',"1 ":,.>:i.14),"1 '),'
> 1 1 2 3 5 8 13 21 34 55 89 144 233 377
>
>     fib3=: 13 :' ". }:, ((y,5)$'(fib2'),"1 (' ',"1  ' ',"1 ":,.>:i.y),"1 '),''
> |domain error: fib2
> |   {.W&mp    ^:y 0 1
>
> It doesn't like the fact that that the fib2 should still be just letters.
>
> It was fun anyway.   Linda

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to