using a self defined dyadic function as infix operator

Hi everybody,i would like to store (assign) a dyadic function to a local variableand use it as an infix operator. See the following code snippet:3 {x + y}’ 4;f:{x + y}';3 f 4Here the last line emit an error. How can i avoid this limitation?Thx for your help.Best regards,Kim

hi kim,

yes, i’ve found that i can’t “infix” an assigned function,
but if you’re using an adverb (as in your example) you
can make it work like this:

q)g:{x+y}
q)3 g’ 4
7

Am 12.02.2011 12:36, schrieb Jack Andrews:
> hi kim,
>
> yes, i’ve found that i can’t “infix” an assigned function,
hi Jack,

thanks for your quick reply.

i am the opinion that this can be done, since the built-in function xbar
is also an assigned function which can be used as an infix operator.

Cheers,

Kim
> but if you’re using an adverb (as in your example) you
> can make it work like this:
>
> q)g:{x+y}
> q)3 g’ 4
> 7
>
> On Sat, Feb 12, 2011 at 10:05 PM, kuentang wrote:
>> Hi everybody,
>>
>> i would like to store (assign) a dyadic function to a local variable
>> and use it as an infix operator. See the following code snippet:
>>
>> 3 {x + y}’ 4;
>> f:{x + y}';
>> 3 f 4
>>
>>
>> Here the last line emit an error. How can i avoid this limitation?
>>
>> Thx for your help.
>>
>> Best regards,
>>
>> Kim
>>
>> –
>>

Submitted via Google Groups

A function defined in .q can be infix:q)foo:{x+y}q)2 foo 3 5’typeq).q.goo:{x+y}q)2 goo 3 55 7On Feb 12, 7:47?pm, Kim Kuen Tang <kuent…> wrote:> Am 12.02.2011 12:36, schrieb Jack Andrews:> hi kim,>> > yes, i’ve found that i can’t “infix” an assigned function,>> hi Jack,>> thanks for your quick reply.>> i am the opinion that this can be done, since the built-in function xbar> is also an assigned function which can be used as an infix operator.>> Cheers,>> Kim>>>>>>>> > but if you’re using an adverb (as in your example) you> > can make it work like this:>> > q)g:{x+y}> > q)3 g’ 4> > 7>> > On Sat, Feb 12, 2011 at 10:05 PM, kuentang<kuent…> ?wrote:> >> Hi everybody,>> >> i would like to store (assign) a dyadic function to a local variable> >> and use it as an infix operator. See the following code snippet:>> >> 3 {x + y}’ 4;> >> f:{x + y}';> >> 3 f 4>> >> Here the last line emit an error. How can i avoid this limitation?>> >> Thx for your help.>> >> Best regards,>> >> Kim>> >> –> >>

Submitted via Google Groups</kuent…></kuent…>