asd =: 3 : 0
t =. 2*(1+y)
1+t*(t-1)+i.4
)
|syntax error
| )
asd =: 3 : 0
t =. 2*(1+y)
1+t*(t-1)+i.4
)
asd 1 2 3
|length error: asd
| 1+t*(t-1) +i.4
asd each 1 2 3
┌───────────┬───────────┬───────────┐
│13 17 21 25│31 37 43 49│57 65 73 81│
└───────────┴───────────┴───────────┘
(asd 1), (asd 2), asd 3
13 17 21 25 31 37 43 49 57 65 73 81
;asd each 1 2 3
13 17 21 25 31 37 43 49 57 65 73 81
each
┌──┬─┐
│&.│>│
└──┴─┘
asd &. > 1 2 3
┌───────────┬───────────┬───────────┐
│13 17 21 25│31 37 43 49│57 65 73 81│
└───────────┴───────────┴───────────┘
;asd &. > 1 2 3
13 17 21 25 31 37 43 49 57 65 73 81
2009/8/31 Andrea Ambu <[email protected]>:
> I wrote this simple monad (is it its correct name?):
>
> asd =: 3 : 0
> t =. 2*(1+y)
> 1+t*(t-1)+i.4
> )
>
>
> It works very well if I call it with just a number as parameter. I'd
> like to call it with a list as parameter, for example:
>
> asd 1 2 3
>
> and I'd like to have the same output that
>
> (asd 1), (asd 2), asd 3
>
> would have. I thought I had to look for the map equivalent, in the
> vocabulary I found {:: but I wasn't able to make it work.
> Thank you for any help!
>
> --
> Andrea
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Þerneyjarsundi 23, Hraunborgum
Po Box 127,801 Selfoss ,
t-póst: [email protected]
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