Re: [Jbeta] syntax for functions and modulo
Explicit definitions like fizzy require you to refer to the arguments explicitly. The right argument is assigned to y locally within the verb (right argument is assigned to x) fizzy =: 3 : 0 if. div35 y do. 'FizzBuzz' elseif. div3 y do. 'Fizz' elseif. div5 y do. 'Buzz' elseif. 1 do. 'd' (8!:0) y end. ) On Sat, Oct 29, 2011 at 2:15 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: To get a feel for J, I'm implementing FizzBuzz, but I keep getting a control error. #!/usr/bin/env jconsole div3 =: 0 = 3 | div5 =: 0 = 5 | div35 =: div3 *. div5 fizzy =: 3 : 0 if. div35 do. 'FizzBuzz' elseif. div3 do. 'Fizz' elseif. div5 do. 'Buzz' elseif. 1 do. 'd' (8!:0) end. ) fizzy 1 exit '' Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Oct 28, 2011 at 8:39 PM, Tom Arneson t...@tomarneson.com wrote: Try mod3=: 3| -Original Message- From: beta-boun...@jsoftware.com [mailto:beta-boun...@jsoftware.com] On Behalf Of Andrew Pennebaker Sent: Friday, October 28, 2011 12:54 To: J Subject: [Jbeta] syntax for functions and modulo I'm trying to make a function mod3 that returns the input modulo three, but my syntax is wrong. I don't see why the syntax would be any different from the double example in the docs. $ jconsole double =: * 2 double 1 2 double 2 4 double 3 6 mod3 =: 3 | |syntax error | mod3=: 3| Cheers, Andrew Pennebaker www.yellosoft.us -- 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
Re: [Jbeta] syntax for functions and modulo
Sorry just noticed that this is in the beta forum. Questions like this would be better asked and answered in the programming forum. On Sat, Oct 29, 2011 at 2:37 PM, Ric Sherlock tikk...@gmail.com wrote: Explicit definitions like fizzy require you to refer to the arguments explicitly. The right argument is assigned to y locally within the verb (right argument is assigned to x) fizzy =: 3 : 0 if. div35 y do. 'FizzBuzz' elseif. div3 y do. 'Fizz' elseif. div5 y do. 'Buzz' elseif. 1 do. 'd' (8!:0) y end. ) On Sat, Oct 29, 2011 at 2:15 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: To get a feel for J, I'm implementing FizzBuzz, but I keep getting a control error. #!/usr/bin/env jconsole div3 =: 0 = 3 | div5 =: 0 = 5 | div35 =: div3 *. div5 fizzy =: 3 : 0 if. div35 do. 'FizzBuzz' elseif. div3 do. 'Fizz' elseif. div5 do. 'Buzz' elseif. 1 do. 'd' (8!:0) end. ) fizzy 1 exit '' Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Oct 28, 2011 at 8:39 PM, Tom Arneson t...@tomarneson.com wrote: Try mod3=: 3| -Original Message- From: beta-boun...@jsoftware.com [mailto:beta-boun...@jsoftware.com] On Behalf Of Andrew Pennebaker Sent: Friday, October 28, 2011 12:54 To: J Subject: [Jbeta] syntax for functions and modulo I'm trying to make a function mod3 that returns the input modulo three, but my syntax is wrong. I don't see why the syntax would be any different from the double example in the docs. $ jconsole double =: * 2 double 1 2 double 2 4 double 3 6 mod3 =: 3 | |syntax error | mod3=: 3| Cheers, Andrew Pennebaker www.yellosoft.us -- 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
Re: [Jbeta] transfers
This is because of a dependency of 'math/misc/simplex' is 'numeric' math/misc/simplex contains: require 'math/misc/matutil' which contains: require 'math/misc/mathutil' which contains: require 'numeric' i.e. the numeric.ijs script is required. On J7 this script resides at: 'general/misc/numeric' On Wed, Jun 20, 2012 at 1:20 PM, Brian Schott schott.br...@gmail.com wrote: load'~addons/math/misc/simplex.ijs' not found: /j/addons/general/misc/numeric.ijs |file name error: script | 0!:0 y[4!:55'y' Good news and bad, again. The files in moth1misc one in their designated directory, but it looks like the `require 'math/misc/matutil'` in simplex.ijs requires a slightly different layout of directories. Where did 'general/' come from in the path? --- (B=) -- For information about J forums see http://www.jsoftware.com/forums.htm -- For information about J forums see http://www.jsoftware.com/forums.htm