summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-util.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/lisp-on-tex/lisp-util.sty')
-rw-r--r--Master/texmf-dist/tex/latex/lisp-on-tex/lisp-util.sty17
1 files changed, 16 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-util.sty b/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-util.sty
index da4244b9f6b..f263d7059cb 100644
--- a/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-util.sty
+++ b/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-util.sty
@@ -48,7 +48,22 @@
(\lambda (\binds \body)
(\lispif (\= \binds ())
\body
- (\list \let (\cdr \binds) (\list \@mlet (\car (\car \binds)) (\car (\cdr (\car \binds))) \body)))))
+ (\list \letM (\cdr \binds) (\list \@mlet (\car (\car \binds)) (\car (\cdr (\car \binds))) \body)))))
+% letrec
+(\defmacro \letrec (\lambda (\binds \body) (\list \@letrec \binds \binds \body)))
+(\defmacro \@letrec
+ (\lambda (\binds \save \body)
+ (\lispif (\= \binds ())
+ (\list \@@letrec \save \body)
+ (\list \@letrec (\cdr \binds) \save
+ (\list \begin
+ (\list \setB (\car (\car \binds)) (\car (\cdr (\car \binds))))
+ \body)))))
+(\defmacro \@@letrec
+ (\lambda (\binds \body)
+ (\lispif (\= \binds ())
+ \body
+ (\list \@@letrec (\cdr \binds) (\list \@mlet (\car (\car \binds)) () \body)))))
% nth
(\define \nth (\lambda (\lst \n)
(\lispif (\= \n :0) (\car \lst) (\nth (\cdr \lst) (\- \n :1)))))