hi,
i’d like to parameterize :/: with a dyadic function.
i have difficulty passing a dyadic function as illustrated in this example using , (join):
q)“123”,:/: “abc”
“1a” “2a” “3a”
“1b” “2b” “3b”
“1c” “2c” “3c”
q){[f]“123”{f[x;y]}:/:}“abc”[{x,y}]
'type
or is there a more straightforward way to provide operations to ::/ ??
thanks, ? jack.
Attila
January 13, 2012, 9:45am
2
"123"f/::
Should be fine
Note that f is not seen in the inner lambda
Attila
effbiae
January 13, 2012, 10:19am
3
thanks atilla,
> Note that f is not seen in the inner lambda
so is it possible to write a lambda that returns a lambda, keeping state like:
? oneplus:{[n]{1+n}}
? oneplusone:oneplus 1
? oneplusone 0
2
is there a recipe for generating functions specialized on parameters? ?
i guess there is eval…
Attila
January 13, 2012, 10:35am
4
Nope, no closures in q
Why would you need something like this?
Attila
On Fri, Jan 13, 2012 at 5:19 AM, Jack Andrews wrote:> so is it possible to write a lambda that returns a lambda, keeping state> like:>> ? oneplus:{[n]{1+n}}> ? oneplusone:oneplus 1> ? oneplusone 0> 2you can sort of fake it with projectionq)oneplus:{[n;x]1+n}oneplusone:oneplus 1q)oneplusone 02