To: personal-kdbplus@googlegroups.com
X-Mailer: Apple Mail (2.1257)
nope, close, but not quite
- space is needed between f and .
or one can use .[f]
- monad’a is k, in q one has to say
m’[a] or (m’) or m each a
- even if we use corrent syntax in (1.)
it is not ideal as both these create a projection
which is obviously slower than direct application
q)\t do[10000;(f .)each a]
150
q)\t do[10000;f ./:a]
120
So if you want me to elaborate on why I chose to suggest
f ./:a
because it is
short, fast and simplest (no parentheses)
in all fairness
it could also be one char shorter:
f .'a
and probably that is what you wanted to say
i prefer the /: version as it is a bit more explicit
f .'a - could also mean that f is a list of functions
(f;f;f;f;f). 'a
Regards,
Attila
On 20 Mar 2012, at 10:33, Felix Lungu wrote:
> then
>
> (f.)‘a
>
> On 19 Mar 2012, at 14:45, Attila Vrabecz wrote:
>
>> nope, the OP originally said
>>> imaging that i have a table as follows:
>>> a
>>> 1 2 3
>>> 4 5 6
>>> 3 4 5
>>> 6 7 8
>>> 2 3 5
>>
>> so he has a list of rows
>> not a list of columns
>>
>> however you are of course right
>> if he were to have “a” the other way around
>> that would be the way to compute it
>> and it is actually good idea for performance reasons
>>
>> Cheers,
>> Attila
>>
>> On 19 Mar 2012, at 09:31, Felix Lungu wrote:
>>
>>> nope. the formatting of the sample is bad. a is not a table but a =
matrix.
>>>
>>> for the first iteration x y z is 1 2 3.
>>> q)a:(1 2 3)+:3*til 5
>>> q)a
>>> 1 4 7 10 13
>>> 2 5 8 11 14
>>> 3 6 9 12 15
>>> q)f:{x,y,z}
>>> q)(f’). a
>>> 1 2 3
>>> 4 5 6
>>> 7 8 9
>>> 10 11 12
>>> 13 14 15
>>>
>>> On 17 Mar 2012, at 21:58, Attila Vrabecz wrote:
>>>
>>>> that would need a flip
>>>> (f’) . flip a
>>>>
>>>> Cheers,
>>>> Attila
>>>> On 17 Mar 2012, at 19:53, Felix LUNGU wrote:
>>>>
>>>>> (f’) . a
>>>>>
>>>>> =CEn data de 17 martie 2012, 17:02, CHEN, Cheng =
a scris:
>>>>>> hi, gurus
>>>>>>
>>>>>> imaging that i have a table as follows:
>>>>>> a
>>>>>> 1 2 3
>>>>>> 4 5 6
>>>>>> 3 4 5
>>>>>> 6 7 8
>>>>>> 2 3 5
>>>>>>
>>>>>> how to apply a function func[x;y;z] to each row of this table, so =
that for
>>>>>> each row, the item in the first column is x, the item in the =
second column
>>>>>> is y and the item in the 3rd column is z ?
>>>>>>
>>>>>> any idea?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> –
>>>>>> CHEN, Cheng
>>>>>>
>>>>>> –
>>>>>> You received this message because you are subscribed to the =
Google Groups
>>>>>> “Kdb+ Personal Developers” group.
>>>>>> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> personal-kdbplus+unsubscribe@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/personal-kdbplus?hl=en.
>>>>>
>>>>> –
>>>>> You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
>>>>> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
>>>>> To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at =
http://groups.google.com/group/personal-kdbplus?hl=en.
>>>>>
>>>>
>>>> –
>>>> You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
>>>> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
>>>> To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at =
http://groups.google.com/group/personal-kdbplus?hl=en.
>>>>
>>>
>>> –
>>> You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
>>> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
>>> To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
>>> For more options, visit this group at =
http://groups.google.com/group/personal-kdbplus?hl=en.
>>>
>>
>> –
>> You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
>> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
>> To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
>> For more options, visit this group at =
http://groups.google.com/group/personal-kdbplus?hl=en.
>>
>
> –
> You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
> To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
> For more options, visit this group at =
http://groups.google.com/group/personal-kdbplus?hl=en.
>