Have you tried making the 1 and 2 verbs 1: and 2:?
Also it looks like you have an extra set of parentheses on
the right and need to add a set on the left.s

+ rec_case  =: fib (] - 1) ( + ( fib (] - 2) ) )
              (           )x                   x



On Sat, 19 May 2007, Terrence Brannon wrote:

+ Ok, I am working on the Alioth Language Shootout recursive Example:
+     
http://shootout.alioth.debian.org/gp4/benchmark.php?test=recursive&lang=ruby&id=2
+
+ And I must implement a naive fibonacci function. I could use
+ if.then.else. but i really want to ge this working using a gerund and
+ @. so I would appreciate some help.
+
+ t =: (>&1)   NB. the function which decides whether to return 1 or recurse
+ base_case =: 1:  NB. what is called when t returns 0
+ rec_case  =: fib (] - 1) ( + ( fib (] - 2) ) )
+
+ the rec_case is where I am failing.
+ ----------------------------------------------------------------------
+ For information about J forums see http://www.jsoftware.com/forums.htm
+

(B=) <----------my "sig"
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to