1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#! /usr/bin/env q
Demo for the Q programming language (kx.com)
x:til 10
/
Multi-line
comment
\
/ Line comments that start at the left margin
can be continued on indented lines.
f:{ / but this comment will not continue
x + y}
/ Over and scan
f/1 2 3h
f\1 2 3i
do|if|while|select|update|delete|exec|from|by
div|ij|insert|lj|ljf|mavg|mcount|mdev|mmax|mmin|mmu|mod|msum|over|prior|peach|pj|scan
iasc|idesc|inv|keys|load|log|lsq|ltime|ltrim|maxs|md5|meta|mins|next|parse|plist|prds|prev|rand|rank|ratios
0nh 0Nc 0wt 0Wu
/ Operators
(!;@;#;$;%;^;&;*)
(!:;@:;#:;$:;%:;^:;&:;*:)
(0:;1:;2:)
(';/;\;':;;/:;\:)
/ System namespaces
(.z.i;.Q.K)
/ Strings
("";"x\n";"\007")
y: "string with quote \" inside";
a:1 2 3 / comment with leading whitespaces
b:3 4 5 5 / to bring in line with this comment
10D 10D10 10D10:10 10D10:10:10 10D10:10:10.11
10Dz 10D10p 10D10:10n 10D10:10:10z 10D10:10:10.11p
2001.10.10D 2001.10.10D10 2001.10.10D10:10 2001.10.10D10:10:10 2001.10.10D10:10:10.11
2001.10.10Dz 10D10p 2001.10.10D10:10n 2001.10.10D10:10:10z 2001.10.10D10:10:10.11p
10:10 10:10:10 10:10:10.1111
10:10u 10:10:10u 10:10:10.1111u
10:10v 10:10:10v 10:10:10.1111v
10:10p 10:10:10p 10:10:10.1111p
10:10t 10:10:10t 10:10:10.1111t
10:10n 10:10:10n 10:10:10.1111n
2001.10.10 2001.10.10d 2001.10.10p 2001.10.10n 2001.10.10z 2001.10.10m
10 10.1 10e10 10e-10 .1 .1e+10
10e 10.1e 10e10e 10e-10e .1e .1e+10e
10f 10.1f 10e10f 10e-10f .1f .1e+10f
0x123AF, 0xabcd12
101h, 102i, 103j
`sym`a_b
`:path`:/a/b/c
k)x:!5
\
til eof comment
/
no effect
\
no effect
|