q types

abstract

Data types for the q language are listed here.

basics

contents

q datatypes
n char name bytes literal null inf SQL Java .Net
0 * list
1 b boolean 1 0b Boolean boolean
2 g guid 16 0Ng UUID GUID
4 x byte 1 0x00 Byte byte
5 h short 2 0h 0Nh 0Wh smallint Short int16
6 i int 4 0i 0Ni 0Wi int Integer int32
7 j long 8 0j or 0 0Nj
or 0N
0Wj
or 0W
bigint Long int64
8 e real 4 0e 0Ne 0We real Float single
9 f float 8 0.0 or 0f 0n 0w float Double double
10 c char 1 " " " " Character char
11 s symbol . ` ` varchar String string
12 p timestamp 8 dateDtimespan 0Np 0Wp Timestamp DateTime (read)
13 m month 4 2000.01m 0Nm
14 d date 4 2000.01.01 0Nd 0Wd date Date
15 z datetime 8 dateTtime 0Nz 0wz timestamp Timestamp DateTime (read-only)
16 n timespan 8 00:00:00.000000000 0Nn 0Wn Timespan TimeSpan
17 u minute 4 00:00 0Nu 0Wu
18 v second 4 00:00:00 0Nv 0Nv
19 t time 4 00:00:00.000 0Nt 0Wt time Time TimeSpan
20-76 enums
77 anymap
78-96 mapped list of lists of type
(n - 77)
97 nested sym enum
98 table
99 dictionary
100 lambda
101 unary primitive
102 operator
103 iterator
104 projection
105 composition
106 v' (each)
107 v/ (over)
108 v\ (scan)
109 v': (each prior)
110 v/: (each right)
111 v\: (each left)
112 dynamic load

dependencies

examples

Atoms have negative types. Lists have positive types.

q)type 23
-7h
q)type enlist 23
7h
q)type 1,2,3,4,5
7h
q)type (1;2;3;4;5)
7h
q)type each 1,2,3,4,5
-7 -7 -7 -7 -7h

A string is a list of chars.

q)type "Hello, World!"
10h

Cast a string as a symbol.

q)` $ "Hello, World!"
`Hello, World!
q)-11h $ "Hello, World!"
`Hello, World!

Convert a list of symbols to a list of strings.

q)type `one`two`three`four`five
11h
q)type string `one`two`three`four`five
0h
q)string `one`two`three`four`five
"one"
"two"
"three"
"four"
"five"

faq

Is there an official version of the table?
Kx official datatypes
Email GitHub LinkedIn
return
© Sam Kennerly 2023. Licensed under a CC BY 4.0 license.
Built by a Quarto
with icons by Simple Icons.
samkennerly@gmail.com