3 eval_when([translate,batch,demo],
4 if get('sharem,'version)=false then load(autolo))$
6 herald_package(contrl)$
10 eval_when([translate,batch,demo,loadfile],
12 cond([pair_sequence])::=
13 if pair_sequence=[] then buildq([],false)
15 block([pred:pop(pair_sequence),
16 form:if pair_sequence=[] then error("odd number of cond args")
17 else pop(pair_sequence)],
18 if pred=true then buildq([form],form)
19 else buildq([pred,form,pair_sequence],
20 if pred then form else cond(splice(pair_sequence))))
24 block([predt,statement],
26 buildq([g:gensym(),exp,pairs],block([g:exp],caseq(g,splice(pairs)))),
28 pairs=[],buildq([],false),
30 (predt:pop(pairs),if listp(predt) and length(predt)=1 then predt:predt[1],pairs=[]),
31 error("odd number of caseq case args"),
34 (statement:pop(pairs),
35 if member(predt,'[otherwise,true]) then buildq([statement,exp],statement)
37 buildq([condition:if listp(predt) then
38 buildq([exp,predt],member(exp,'predt))
39 else buildq([exp,predt],exp='predt),
41 if condition then statement
42 else caseq(exp,splice(pairs))))))$