-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathh.c
More file actions
224 lines (223 loc) · 6.84 KB
/
Copy pathh.c
File metadata and controls
224 lines (223 loc) · 6.84 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#include "h.h"
#include <stdio.h>
void help(int a) {
if(!a) {
fprintf(stderr,""
"\\0 data\n"
"\\+ verbs\n"
"\\' adverbs\n"
"\\_ reserved verbs/nouns\n"
"\\. assign define control debug\n"
"\\: input/output\n"
"\\- client/server\n"
"\\` os commands\n"
"\\? commands\n");
}
else if(a=='0') {
fprintf(stderr,""
" scalar vector empty inf nul\n"
"i32 0 1 2 !0 0I 0N\n"
"i64 0j 1 2j !0j 0Ij 0Nj\n"
"f32 0.0e 1 2.0e 0#0.0e 0ie 0ne\n"
"f64 0.0 1 2.0 0#0.0 0i 0n\n"
"char \" \" \"12\" \"\" \"\\0\"\n"
"symbol ` `a`b 0#`\n"
"\n"
"lambda {}\n"
"null nul\n"
"list (a;b;c;...) ,a () empty\n"
"\n"
"dict .((`a;1);(`b;2);...)\n"
" !d keys\n"
" d[] values\n"
" d.k d`k d[`k] d@`k d.`k\n"
"\n"
"4:x type: atom(1..9)[ijefcsdnx] list(0..-4)[KIJEFCS]\n"
"5:x ascii representation\n");
}
else if(a=='+') {
fprintf(stderr,""
" monad dyad\n"
"+ flip plus\n"
"- negate minus\n"
"* first times\n"
"%% recip divide\n"
"& where min/and\n"
"| reverse max/or\n"
"< upgrade less\n"
"> downgrade more\n"
"= group equal\n"
"^ shape power\n"
"! enumerate mod/rotate\n"
"~ not match\n"
", enlist join\n"
"# count take/reshape\n"
"_ floor drop/cut\n"
"$ format form\n"
"? unique find/draw/deal\n"
"@ atom at\n"
". value dot\n"
"\n"
" triad tetrad\n"
"_ slide\n"
"@ amend/trap amend\n"
". amend/trap amend\n");
}
else if(a=='\'') {
fprintf(stderr,""
"each f'x\n"
"each x f'y\n"
"each f'[x;y;z]\n"
"\n"
"scanm f\\x\n"
"do n f\\x\n"
"while b f\\x\n"
"eachleft x f\\y\n"
"scand f\\x\n"
"scan f\\[x;y;z]\n"
"\n"
"overm f/x\n"
"do n f/x\n"
"while b f/x\n"
"eachright x f/y\n"
"overd f/x\n"
"over f/[x;y;z]\n"
"\n"
"eachprior ep[f;x]\n");
}
else if(a=='_') {
fprintf(stderr,""
"variables/constants:\n"
" nul null\n"
" .z.h hostname\n"
" .z.P pid\n"
" .z.i cli args\n"
" .z.T days since 2035 (float)\n"
" .z.t seconds since 2035 (int)\n"
" .z.f self reference to current function\n"
" .z.w handle of ipc peer\n"
"\n"
"math: log exp abs sqr sqrt floor ceil dot mul\n"
" sin cos tan asin acos atan sinh cosh tanh x atan2 y\n"
" erf erfc gamma lgamma n choose k\n"
" rint (round to whole number) x round y (round to y) trunc (nearest)\n"
" div (integer) and or xor not rot shift (bitwise)\n"
" prime n factor n gcd[a;b] lcm[a;b] modinv[a;m] (number theory)\n"
" mag v (vector magnitude)\n"
" y lsq A (least squares approximation, y~+/A*lsq[y;A])\n"
" inv A (inverse A, I~A mul inv A)\n"
" svd A (singular value decomposition (U;S;+V), A~mul/svd A)\n"
" lu A (lower/upper decomposition (+P;L;U), A~mul/lu A)\n"
" ldu A (lower/diag/upper decomposition (+P;L;D;U), A~mul/ldu A)\n"
" qr A (qr decomposition (Q;R), A~mul/qr A\n"
" rref A (reduced row echelon form)\n"
" det A (determinant)\n"
"\n"
"rand: x draw y (from !y); x draw -y (deal from !y); x draw 0 (from (0,1))\n"
"\n"
"time: lt ts (local timestamp, days since 2035)\n"
" ltime ts (local day time, ex: 20231225 123005)\n"
" gtime ts (gmt day time)\n"
" jd yyyymmdd (and dj) to/from julian day number (0 is monday)\n"
" sleep ms\n"
"\n"
"list: x at y indexes giving appropriate null values instead of index error\n"
" x in y is 1 if x is an item of y; 0 otherwise (list: lin)\n"
" x dv y and x di y to delete by value and index (list: dvl)\n"
" x sv v (scalar from vector) and x vs s (vector from scalar)\n"
" ci i (character from integer) and ic c (integer from character)\n"
" x sm y is string match. y can have *?[^-].\n"
" x ss y is string/symbol search for start indices. y can have ?[^-].\n"
" ssr[x;y;z] is string/symbol search and replace. z can be a function.\n"
"\n"
"data: bd d (bytes from data) and db b (data from bytes)\n"
" bh d (bytes from hex) and hb b (hex from bytes)\n"
" zb b (compress bytes) and bz z (decompress bytes)\n"
" kv v (list from vector) and vk k (vector from list)\n"
" val f (valence of fun)\n"
" md5 x (128-bit), sha1 x (160-bit), sha2 x (256-bit)\n"
" x is type -3 4 -4 0\n"
" (iv;key) encrypt x, (iv;key) decrypt x (aes256)\n"
" x is type -3 4 -4 0, iv:16 draw 256, key:32 draw 256\n"
"\n"
"sys: v setenv s, getenv v (set/get environment variable)\n"
" del f (delete file), f rename g (rename f to g)\n"
" exit code\n");
}
else if(a=='.') {
fprintf(stderr,""
"assign\n"
"a:1 local\n"
"a::1 global\n"
"\n"
"amend\n"
".[d;i;f] @[d;i;f]\n"
".[d;i;f;y] @[d;i;f;y]\n"
"\n"
"control\n"
" $[c;t;f] conditional\n"
" if[c;...]\n"
" do[n;...]\n"
" while[c;...]\n"
" / comment\n"
" \\ abort/trace\n"
" : return\n"
" ' signal\n"
"\n"
"error trap .[f;(x;y;z);:] and @[f;x;:]\n");
}
else if(a==':') {
fprintf(stderr,""
" 0:f f 0:x read/write text (` for console)\n"
" 1:f f 1:x read (map)/write k data\n"
" f 5:x append k data\n"
" 2:f read k data\n"
" f 2:(e;t) link object code: fn e (valence t) from .so/.dll f\n"
" 6:f f 6:x read/write bytes\n"
" (,f)6:x append bytes\n"
"\n"
" (type;width)0:f fixedwidth text(IJEFCS )\n"
" (type;width)1:f fixedwidth data(cbsijef CS)\n"
" blank skips. f can be (f;index;length).\n");
}
else if(a=='-') {
fprintf(stderr,""
"client:\n"
" w:3:(h;p) open host: sym or string; returns int handle\n"
" w 3:msg async send msg, do not wait for a reply\n"
" w 4:msg sync send msg, block for the remote response\n"
" 3:w close close handle w\n"
" (h;p) 3:msg async with implicit open\n"
" (h;p) 4:msg sync with implicit open\n"
"\n"
"server:\n"
" \\m i PORT start inline listener on PORT (PORT 0 to stop)\n"
" \\m f PORT start forking listener on PORT (POSIX only)\n"
" \\m i show inline listen port (0 if not listening)\n"
" \\m f show forking listen port (0 if not listening)\n"
" \\m show both on separate lines, tagged 'i' / 'f'\n"
"\n"
"server-side dispatch (overridable globals):\n"
" .m.s {. x} handler for w 3:msg (async) result discarded\n"
" .m.g {. x} handler for w 4:msg (sync) result returned\n"
" .m.c \"\" string evaluated on close\n");
}
else if(a=='`') {
fprintf(stderr,""
"`3:\"cmd\" set\n"
"`4:\"cmd\" get stdout\n"
"`8:\"cmd\" get (rc;stdout;stderr)\n");
}
else if(a=='?') {
fprintf(stderr,""
"\\d [d|^] k directory [go to]\n"
"\\e [0|1] error flag [off|on]\n"
"\\l f load script f\n"
"\\m [i|f n] ipc listen port (i: inline, f: forking; \\- for more)\n"
"\\p [n] print precision\n"
"\\t x time in milliseconds to execute x\n"
"\\v variables\n"
"\\V variables (long listing)\n"
"\\zc [0|1] zeroclamp printing to fabs(1e-12)\n");
}
}