# Frequently-asked questions from the k4 listbox¶

If you notice a question that is asked more then once on the k4 list, please feel free to add it here.

## Where can I find archives of the k4 list?¶

Archives are available to subscribers at the Listbox. When you follow that link, you will be asked for your e-mail address and the mailing list name. Use k4 for the list name, and the e-mail address that you used to subscribe to the k4 list.

## How to post test data on the k4 list?¶

Always post your test data in the executable form. For example,

q)foo:([]a:5?10;b:5?10;c:5?10)


You can generate an executable form of your data using 0N!.

q)0N!foo;
+abc!(4 3 7 1 1;6 1 7 9 8;4 7 5 0 9)


Note use of ; to suppress the default display. If you use the latter form, prefix it with k) in your post, so that others could easily cut and paste it in their q session.

q)k)+abc!(4 3 7 1 1;6 1 7 9 8;4 7 5 0 9)
a b c
-----
4 6 4
3 1 7
7 7 5
1 9 0
1 8 9


## What are the limits on the number of variables in q functions?¶

Reference: Lambdas

Basics: Errors

Locals and globals are different: locals don’t have symbols associated with them, so for example .Q.dpft (you would have to pass in name of table) or x.time does not work with them. As a workaround for the second issue one can always use time$x though. ## How do I query a column of strings for multiple values?¶ If you wish to query a column of strings for a single value either like or ~ (Match) with an extender can be used q)e:([]c:("ams";"lon";"amS";"bar")) q)select from e where c ~\:"ams" c ----- "ams" q)select from e where c like "ams" c ----- "ams" q)select from e where c like "am*" c ----- "ams" "amS"  To query for multiple strings you need to use another extender, then aggregate the results into a single boolean value using sum or any. Generally the like form is easier to understand and more efficient. q)select from e where any c like/:("lon";"am*") c ----- "ams" "lon" "amS"  ## How to kill long/invalid query on a server?¶ You can achieve that by sending SIGINT to the server process. In *nix shell, try $ kill -INT <pid>


You can find the server process ID by examining .z.i.

## How do I recall and edit keyboard input?¶

Start q under rlwrap to get readline support, e.g.

\$ rlwrap l64/q -p 5001


This is available in most Linux repositories, or from utopia.knoware.nl or darwinports.com.

An alternative to rlwrap is tecla's enhance. This is good for vi-mode users who would like more of vi’s keys functionality – eg d f x will delete everything up to the next x` and you can paste it back, too.