can : enforce monadic usage?

Hi,I noticed Q uses English words for the monadic version of lots ofoperators.Examples:q)flip+:q)neg-:q)first*:The Q does this by adding a “:” after the dyadic operator.What does “:” in this contexts?(It looks to me like “enforcing” the monadic form)Also I noticed that if you use parenthesis to enforce the monadicusage, the parser will insert the “:” for you (the third expressionbelow)q)parse “neg a”-:aq)parse "(-:) a"-:aq)parse “(-) a”-:`aThanks,Petru

charset=us-ascii
X-Mailer: iPhone Mail (8C148)
In-Reply-To: <3d52201a-30ec-4438-9d6a-631679aa5a6f@o14g2000prb.googlegroups.com>
Message-Id:
Date: Fri, 11 Feb 2011 20:19:42 -0500
To: “personal-kdbplus@googlegroups.com

Mime-Version: 1.0 (iPhone Mail 8C148)

You’re are correct. That’s what it’s for: force to monad.

On Feb 12, 8:19?am, Timothy Rieder <trie…> wrote:> You’re are correct. That’s what it’s for: force to monad.Isn’t this a vestige of k? That is, k’s operators gave differentmeanings to 1-ary and 2-ary calls and the k syntax for forcing the 1-ary version used a colon suffix. As I understand it, the q “language"doesn’t have this dichotomy, but it’s built on top of k whichoccasionally prints these things out using the old k-style syntax.The confusing thing is that q does give it’s own meaning to “+:”,namely add something to a value and store the result in place. Whenyou write “foo+:bar” in q, it means “foo: foo+bar” rather than"foo[flip bar]”.</trie…>

It’s really not that confusing if you examine the context. We know
dyadic + is addition and monadic + is flip. If the syntax is ambiguous
you have to give q a hand. i.e.

q)a:0
q)a+:1 / add and assign takes precedence
q)a(+:)1 / force monadic
'type

Don’t forget that things are checked for type and count as well before
an action is evaluated.