Your verb is a simple way to introduce control structures.

Thanks, it may be as simple as it gets.  Linda 

-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf 
Of Louis de Forcrand
Sent: Sunday, February 26, 2017 4:29 PM
To: [email protected]
Subject: Re: [Jprogramming] Explicit fib

Perhaps use the recursive definition; slower but possibly easiest to understand 
(you can sneak in an M. if you don't talk about computation speed).

fib=: 3 : 0 M.  NB. 0-indexed
 if. y <: 1 do. y
 else. (fib y-1) + fib y-2
 end.
)

Louis

> On 26 Feb 2017, at 20:37, Raul Miller <[email protected]> wrote:
> 
> Then perhaps something like this:
> 
> fib=:verb define
>  series=. 0 1
>  needed=. >./, y
>  while. needed >: #series do.
>    series=. series, +/_1 _2 { series
>  end.
>  y { series return.
> )
> 
> Thanks,
> 
> --
> Raul
> 
> 
> 
>> On Sun, Feb 26, 2017 at 1:42 PM, Linda A Alvord <[email protected]> 
>> wrote:
>> I only know the one in my example.  1, 1, 2, 3, 5 ...
>> Next tern us tge sum of the previous two or in this case 8. It an infinite 
>> series.
>> 
>> Linda
>> 
>> -----Original Message-----
>> From: Programming [mailto:[email protected]] 
>> On Behalf Of Raul Miller
>> Sent: Sunday, February 26, 2017 1:03 PM
>> To: Programming forum
>> Subject: Re: [Jprogramming] Explicit fib
>> 
>> Which english definition of fibonacci's series are you working with?
>> 
>> Thanks,
>> 
>> --
>> Raul
>> 
>> 
>> On Sun, Feb 26, 2017 at 12:48 PM, Linda A Alvord 
>> <[email protected]> wrote:
>>> I have been working on finding an explicit definition for the 
>>> Fibonacci series. (without tie)
>>> 
>>> 
>>> 
>>> fib 14
>>> 
>>> 5!:4 <'fib'
>>> 
>>> load 'debug'
>>> 
>>> dissect'fib 14'
>>> 
>>> 
>>> 
>>> To see the dissection, place cursor on  fib  and click right mouse.
>>> 
>>> 
>>> 
>>> I want a definition which will work for the youngest children.
>>> 
>>> 
>>> 
>>> Thanks for any ideas.  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
> ----------------------------------------------------------------------
> 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