[Beginner Q] How to map non-vectorized function?

How to map function with list? This not work:

q){$[x<0;0;x]}(1 3 6)
{$[x<0;0;x]}
'type

X-Mailer: Apple Mail (2.926)try{?[x<0;0;x]}1 3 6look up “vector conditional” on code.kx.com/b.yogaOn Sep 8, 2008, at 12:45 PM, Alexandr Batalshikov wrote:> {$[x<0;0;x]}(1 3 6)

in general you will need eachor the more general ’ for multivalent functionq){$[x<0;0;x]}each 1 -3 61 0 6try to avoid each (and its variants) as much as you can and your codeis going to be fast ;) AttilaOn Mon, Sep 8, 2008 at 12:51 PM, Alexandr Batalshikov wrote:>>> On Mon, Sep 8, 2008 at 3:34 PM, brain yoga wrote:>>>> try>>>> {?[x<0;0;x]}1 3 6>>>> look up “vector conditional” on code.kx.com>>>> /b.yoga>>> Thanks you, but this is particular solution.> Let some complicated function f work only for one numeric argument, but> not on list:> f[3] / ok.> f[3 4] / fail!> How to map that function on some arguments list?> This code work, but is very ugly:> map1: {[f;args] r:();i:0; do[count args;r:r,f[args[i]];i+:1];r}> map1[f; (1 3 6)]>> >>

Many thanks!