« I defined an untyped list, but I get a type error when I add more than one element to it? How do I store mixed data in a list? | Main | Why doesn't 'select from tablename where name = `ABC/A' work? »

Does q have closures?

Not quite. q supports what it calls projections, which are functions whose arguments are partially specified. Projections can serve the same purpose as closures, albeit (and ironically, we might add) with some additional typing:

f: {[list; n]
{[nn; item]
/ n cannot be referenced here,
/ so we pass it as nn
nn + item}[n; ] each list
}

See: Closure

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Textile formatting is allowed.