O6PFGAUDYCMK6SC6V5RB5ELXZ7W54OB7XPYCMECCA4BSBUVLFAPAC
A56GZW6HLIZQ6NX47XFPEPPGLZAA725KNYST7VK2MMK3DCCIXAXAC
GW4AAYNF7I66D72G5PMFTQRK7B4KZVYKAHKRPC2IY7IX37JKEHJQC
UW27LKXM2BJ77FQLTY4WPKDSSWI2RFNFRJ7CB4U3TS7KYVIV72LQC
A2JAXDJWT2FAKADYOY6QOQ7LQRMTTCDIOYT7STSESVHLZQEQJBMAC
6XHALMLUA5B5BBYFSWIFHSJ2BXCL6RSAW5TCKRGJEI2LURH2TQ4AC
KMV35KHLCXIV5YQUDRSTS6PIMLNIL2KTJZS77XXMPA6IX37NHZ2QC
delete CUSTOM_LEVEL[1]
delete log_ats
if(LOG_AT_ERR) {
split(LOG_AT_ERR, log_ats, ",")
for(i in log_ats) CUSTOM_LEVEL[log_ats[i]] = 1;
}
delete log_ats
if(LOG_AT_INF) {
split(LOG_AT_INF, log_ats, ",")
for(i in log_ats) CUSTOM_LEVEL[log_ats[i]] = 2;
}
delete log_ats
if(LOG_AT_DBG) {
split(LOG_AT_DBG, log_ats, ",")
for(i in log_ats) CUSTOM_LEVEL[log_ats[i]] = 3;
}
for(i in CUSTOM_LEVEL) {
print "custom log level " CUSTOM_LEVEL[i] " for " i
}
function logg_dbg(where, x, d) {
if(LOG_LEVEL >= 3)
print "DBG" represent_depth(d) where ": " x >"/dev/stderr"
function logg_dbg(where, x, d, lev) {
lev = LOG_LEVEL
if(where in CUSTOM_LEVEL)
lev = CUSTOM_LEVEL[where]
if(lev >= 3)
print "DBG" represent_depth(d) where ": " x >"/dev/stderr"
function logg_inf(where, x, d) {
if(LOG_LEVEL >= 2)
print "INF" represent_depth(d) where ": " x >"/dev/stderr"
function logg_inf(where, x, d, lev) {
lev = LOG_LEVEL
if(where in CUSTOM_LEVEL)
lev = CUSTOM_LEVEL[where]
if(lev >= 2)
if(!(where in NO_LOG))
print "INF" represent_depth(d) where ": " x >"/dev/stderr"
(setq mapcar (lambda (a b) (mapcar a b))) \
(macro let (lambda (a) \
(label ((vs (mapcar car (car a))) \
(as (mapcar cadr (car a)))) \
(append \
(list (append \
(list (quote lambda) vs) \
(cdr a))) \
as)))) \
) \
(setq mapcar (lambda (f a) \
(label ((map \
(lambda (a r) \
(cond ((eq a nil) (nreverse r)) \
(true (map (cdr a) \
(cons (f (car a)) r))))))) \
(map a nil)))) \
(macro let (lambda (body) \
(label ((names (mapcar car (car body))) \
(values (mapcar cadr (car body)))) \
(list 'progn \
'(print \"names\") (list 'print names) \
(append \
(list (append \
(list (quote lambda) names) \
(cdr body))) \
values))))) \
(macro q (lambda (x) (list (quote quote) (car x)))) \
(macro quasiquote (lambda (lis) \
(label ((qq1 \
(lambda (an) \
(cond ((atom an) an) \
((eq (car an) 'unquote) (eval (cadr an))) \
(true (mapcar qq1 an)))))) \
(cond ((atom (car lis)) (list 'quote (car lis))) \
(true (list (quote quote) \
(mapcar qq1 (car lis)))))))) \
)\
# apply, and we want to apply it to (list (list (quote
# quote) (cdr form))). This thorny awk statement is
# brought to you by the awkify elisp function in the
# otherwise disused lib.awk, which proved to be not as
# fast as saving an image in image.awk.
logg_dbg("_expand macro call", "mpair is " _repr(mpair),
# apply, and we want to apply it to the quoted rest of
# the form.
#
#logg_dbg("_expand macro call", "mpair is " _repr(mpair),
# depth+1)
acc = _cons(_cadr(mpair),
_cons(_cons(_symbol("quote"),
_cons(_cdr(form),
_nil())),
_nil()),
_nil())
logg_dbg("_expand macro call", "_evaling " _repr(acc), depth)
return _expand(_eval(acc, depth+1), depth+1)
}
}
}
}
function _expand1(form, depth, car, mpair, app, acc) {
if(_truthy(_atom(form))) {
return form
} else {
car = _car(form)
if(car == _symbol("quote")) {
return form
} else {
mpair = _assoc(car, _MACROS)
if(_is_null(mpair)) {
logg_dbg("_expand1 not macro", _repr(form), depth)
# unlike expand, don't recurse in to find more macros
return form
} else {
logg_dbg("_expand1 macro call", "mpair is " _repr(mpair),
else if(car == _symbol("mapcar"))
return _mapcar(_eval3(_cadr(form), env, env, d+1),
_eval3(_caddr(form), env, env, d+1),
env)
# else if(car == _symbol("mapcar"))
# return _mapcar(_eval3(_cadr(form), env, env, d+1),
# _eval3(_caddr(form), env, env, d+1),
# env, d+1)
else if(car == _symbol("+")) {
else if(car == _symbol("expand1"))
return _expand1(_eval3(_cadr(form), env, env, d+1),
d+1)
else if(car == _symbol("eval")) {
logg_dbg("_eval3 eval", "expression is " _cadr(form) " -> " _repr(_cadr(form)), d)
a = _eval3(_cadr(form), env, env, d+1)
logg_dbg("_eval3 eval", "value is " a " -> " _repr(a), d)
a = _eval3(a, env, env, d+1)
logg_dbg("_eval3 eval", "and that works out to " a " -> " _repr(a), d)
return a
} else if(car == _symbol("+")) {
function _mapcar(fun, lis, env, app, acc) {
# this is dead code. i tried to make it iterative and write it in awk
# so it would be faster, but it ended up eval-ing things too many
# times and i couldn't figure out where the problem was, even with
# copious debug logging.
function _mapcar(fun, lis, env, d, v, app, acc) {