> From: lg...@in...
> To: q-l...@li...
> Subject: [q-lang-users] Why Does This Happen?
>
> People:
>
> I defined the following function in Qpad:
>
> mysign X = cond (X>0,1; X=0,0; X<0,-1) ;
>
> When I run it:
> ==> mysign -1
> mysign-1
>
>
> Why does mysign -1 produce mysign-1, instead of -1?
Q reads "(mysign - 1)" instead of "mysign (-1)" what you wanted, the parsing for negative numbers is a bit odd, see http://q-lang.sourceforge.net/qdoc/qdoc_6.html#SEC15.
Try adding parentheses around the -1 to tell Q that it is looking at a negative number instead of at a substraction.
Greetings,
Peter
|