I was using select/case yesterday and I wanted to send in the argument in
boxed.
It took me a few minutes to figure out that the case argument needed an
atom.
It could be a bit confusing for beginners I guess.

   v1=.verb define
t=.>}.y
NB. t=.{.>}.y
smoutput 't is: ',":t
smoutput '$t is: ',":$t
select. t
  case. 1 do.  smoutput 'case 1'
  case. 2 do.  smoutput 'case 2'
end.
)

   v2=.verb define
NB. t=.>}.y
t=.{.>}.y
smoutput 't is: ',":t
smoutput '$t is: ',":$t
select. t
  case. 1 do.  smoutput 'case 1'
  case. 2 do.  smoutput 'case 2'
end.
)

   v1 34;2
t is: 2
$t is: 1

   v2 34;2
t is: 2
$t is:
case 2


PS: I was creating some plots and doing estimates with lsfit.
      It was surprisingly easy.
      For some reason I have been thinking there were no utilities to do
this and I have not been getting replies on former questions about it.
      Maybe everyone else thought it so trivial to do that they did not
bother to answer.

-- 
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf, Þerneyjarsund 23, Box 127
801 Grímsnes ,t-póst: [EMAIL PROTECTED]
Skype: gosiminn, gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
          /|_      .-----------------------------------.
         ,'  .\  /  | Með léttri lund verður        |
     ,--'    _,'   | Dagurinn í dag                     |
    /       /       | Enn betri en gærdagurinn  |
   (   -.  |        `-----------------------------------'
   |     ) |        (\_ _/)
  (`-.  '--.)       (='.'=)
   `. )----'        (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to