You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
1.6 KiB

#!k
r:("// ngn/k, (c) 2019-2021 ngn, license: GNU AGPLv3 - https://codeberg.org/ngn/k/blob/master/LICENSE"
"// generated by g.k")
R:,/{$[x~"@";*y;x~"$";y 1;x~"%";_y 1;x]}\:;d:{r,:"#define ",/:x[0]R/:+a@'!#'a:1_x;}
v:"xyzu";t:"ACBHILD";T:t,"SMmcildsopqruvwe";K:"FPRzZtT"
/@:arg[0],$:arg[1],%:lower(arg[1])
d("@$ _$(@)" ;v;"knNorRtv") /properties
d("@(a) dex(@,a)" ;v) /free and return other
d("@$ (($*)_V(@))";v;t) /items
d("@% @$[i]" ;v;t) /i-th item
d("@x @A[0]" ;v) /nested
d("@y @A[1]" ;v) /nested
d("@z @A[2]" ;v) /nested
d("@t$ (@t==t$)" ;v;T) /of type?
d("@t$ _t$(@t)" ;v;K) /pseudotypes
d("@t%$ (@t%||@t$)" ;v;1_t,"SMZ") /atom|list of type?
d("@tmt (@tm||@tt)" ;v) /atom|dict?
d("@tMT (@tM||@tT)" ;v) /list|tbl?
d("@tZD (@tZ||@tD)" ;v) /ints|floats?
d("@tzd (@tz||@td)" ;v) /int|float?
d("@tCZ (@tC||@tZ)" ;v) /chars|ints?
d("@tcz (@tc||@tz)" ;v) /char|int?
d("@tCZD (@tC||@tZD)";v) /chars|ints|floats?
d("@tmMA (@tmM||@tA)";v) /container?
d("@2(a...) _2(@,a)" ;v) /2phase free
d("@q(a) _q(@,a)" ;v) /append
d("N@(r) N1(@,r)" ;v) /error pass-through
d("o@ _R(ce[t@])" ;"ACLDS") /empty
d("E@(a...) E_(@,a)" ;"cdilnoprstvz") /errors
d("$@(a...) P(%t@,a)";T,K,(+|_:\"CILDSZ")," "\"mt MT mMA ZD zd CZ cz CZD";"XY")
d'(,"@$ @ $"),/:":"\'" "\"C:bcdknotv BHIL:ijkmnv I:f D:dv A:xyzu N:ijmn O:ACV Q:spq"; /c type+var
"g.h"0:r