first=. 0{]
second=. 1{]
third=. 2{]
f=. first + second * third
f 1 2 3
7
On 3/23/06, Sean McGowan <[EMAIL PROTECTED]> wrote:
> Hi there,
>
>
>
> I'm new to J and have a question regarding tacit functions. I need to write
> tacit a J function
>
> that takes a list of 3 numbers as its argument. How do you pass and
> reference the elements
>
> of a list in a function?
>
>
>
> The following seems to work when passing one number:
>
>
>
> tax =: 0.10 & *
>
> tax 10
>
> 1
>
>
>
> I wish to pass 3 numbers in a list and be able to use each number in the
> computation.
>
> I know list elements can be accessed like this:
>
>
>
> list =: 10 0 1
>
> N =: 0 { list
>
> A =: 1 { list
>
> B =: 2 { list
>
>
>
> N
>
> 10
>
> A
>
> 0
>
> B
>
> 1
>
>
>
> Any help would be greatly appreciated.
>
>
>
> Regards,
>
> Sean
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm