diff options
author | Karl Berry <karl@freefriends.org> | 2015-10-25 22:26:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-10-25 22:26:36 +0000 |
commit | 2e5f14f60a516e247773eb44e16fdf71b24ffc6b (patch) | |
tree | dcf766a159ceb803ff37d6fc6093f14de9a57741 /Master/texmf-dist/doc | |
parent | b21104f52f6a326c74adaf89be9b55745d4e65ba (diff) |
lisp-on-tex (25oct15)
git-svn-id: svn://tug.org/texlive/trunk@38706 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
40 files changed, 628 insertions, 1240 deletions
diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/LICENSE b/Master/texmf-dist/doc/latex/lisp-on-tex/LICENSE index 62d704d956e..e9b8a4b284d 100644 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/LICENSE +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/LICENSE @@ -6,7 +6,7 @@ lisp-read.sty, lisp-string.sty, lisp-util.sty, lisp-mod-fpnum.sty, fact.tex, rocket.tex, fpnummodule-mandelbrot.tex -Copyright (c) 2012 2013 2014, HAKUTA Shizuya +Copyright (c) 2012 2013 2014 2015 HAKUTA Shizuya All rights reserved. diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/README b/Master/texmf-dist/doc/latex/lisp-on-tex/README deleted file mode 100644 index d3cec712624..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/README +++ /dev/null @@ -1,278 +0,0 @@ - -%% -%% This is file `README'. -%% -%% License: Modified BSD - see LICENSE file. -%% - -===== LISP on TeX --- A LISP interpreter on TeX ====== -Version 1.3 -Author : HAKUTA Shizuya <hak7a3@live.jp> - -==== Introduction ==== -LISP on TeX is a LISP interpreter written only with TeX macros. -It works as a style file of LaTeX. -LISP on TeX adopts static scoping, dynamic typing, and eager evaluation. -We can program easily with LISP on TeX. - -==== Files ==== - -README : This file. --------------------------------------------------------------------------------------- -LICENCE : About LICENCE. --------------------------------------------------------------------------------------- -lisp-on-tex.sty : Main routine. (evaluator) --------------------------------------------------------------------------------------- -lisp-prim.sty : Primitive functions. (Automatically loaded by lisp.sty) --------------------------------------------------------------------------------------- -lisp-read.sty : Parser. (Automatically loaded by lisp.sty) --------------------------------------------------------------------------------------- -lisp-arith.sty : Arithmetical functions. (Automatically loaded by lisp.sty) --------------------------------------------------------------------------------------- -lisp-string.sty : Functions which manipulates strings. - : (Automatically loaded by lisp.sty) --------------------------------------------------------------------------------------- -lisp-latexutil.sty : Utility functions for LaTeX. - : (Automatically loaded by lisp.sty) --------------------------------------------------------------------------------------- -lisp-util.sty : Utility functions written with LISP on TeX. - : (Automatically loaded by lisp.sty) --------------------------------------------------------------------------------------- -lisp-mod-fpnum.sty : The module which enables us to use fixed point numbers. - : See the "Fixed Point Numbers" section in this document. --------------------------------------------------------------------------------------- -test.tex : test code (using qstest.sty). --------------------------------------------------------------------------------------- -examples/* : Example files. See the "Examples" section. --------------------------------------------------------------------------------------- -tug2013/* : The slide and examples used on TUG2013. --------------------------------------------------------------------------------------- -==== Usage ==== -To use LISP on TeX, write - - \usepackage{lisp} - -in the preamble of document. - -We can load module files -using \usepackage. For example, the command - - \usepackage{lisp-mod-fpnum} - -loads the module of fixed point numbers. - -It the document, we can start LISP interpreter with \lispinterp. -For example, - - \lispinterp{(\texprint :1)} - -outputs "1". - -To get more detail, please read example files. -It is the better way to know about LISP on TeX. - -==== Examples ==== - * fact.tex - -- Calculate the factorial function. - * rocket.tex - -- Show how to use "mutable" locations. - * fpnum-mandelbrot.tex - -- Calculate the mandelbrot set. - -- It takes a long long time to typeset. - * showfont.tex - -- Show glyphs of selected font. - -- It works on XeLaTeX. - * repl.tex - -- The Read-Eval-Print Loop interpretor of lisp-on-tex. - * nqueen.tex - -- Calculate 5-queens problem. - -==== Syntax ==== -The syntax of LISP on TeX is the following; - -<S-exp> ::= <cons> - | <int> - | <string> - | <symbol> - | <bool> - | <nil> - | <p-module> - | <skip> - | <dimen> -<cons> ::= (<S-exp>+) | (<S-exp> . <S-exp>) -<int> ::= :[TeX's integer] -<string> ::= '[TeX's tokens]' -<symbol> ::= [a control sequence] -<bool> ::= /t | /f -<nil> ::= () -<p-module>::= +{<modname>::<tokens>} -<modname> ::= [TeX's tokens] -<tokens> ::= [TeX's tokens] -<skip> ::= @[TeX's skip] -<dimen> ::= ![TeX's dimen] - -==== Functions and Others ==== -=== Special Forms === - * (\define \symbol <S-exp>) - -- Binds the evaluation result of <S-exp> to \symbol. - * (\lambda <ptn> <S-exp>) - -- Lambda abstraction. The bind pattern <ptn> has the following syntax; - <ptn> ::= <symbol> | (<symbol>*) | (<symbol>+ . <symbol>) - * (\quote <S-exp>) - -- Return <S-exp>. - * (\lispif <S-exp 1> <S-exp 2> <S-exp 3>) - -- Branch. The type of the evaluation result of <S-exp 1> must be bool. - * (\defmacro \symbol <Lambda abstraction>) - -- Define a macro. - * (\begin <S-exp>+) - -- Evaluate all arguments in a sequential order - and returns the the evaluation result of the last argument. - * (\defineM \symbol <S-exp>) - -- Binds the evaluation result of <S-exp> to \symbol - and the location which binds \symbol becomes "mutable". - * (\setB \symbol <S-exp>) - -- If location of which binds \symbol is "mutable", - the evaluation result of <S-exp> is stored in the location. - -=== Evaluation === - * (\eval <S-exp>) - -- Evaluate <S-exp> in the current environment. - * (\apply <func> <list>) - -- Evaluate (<func> <args>) where <list> = (<args>). - -=== Types === - * (\intQ <S-exp>) - -- If the evaluation result of <S-exp> is an integer, it returns /t. - Otherwise, it returns /f. - -- Likewise, \pairQ, \booleanQ, \symbolQ, \stringQ, \dimenQ, \skipQ, - \nilQ, \funcQ, \closureQ, and \macroQ are defined. - * (\listQ <S-exp>) - -- Return /t iff <S-exp> is a nil or a cons cell. - Otherwise, it returns /f. - * (\procedureQ <S-exp>) - -- Return /t iff <S-exp> is a closure or a function (or a macro). - * (\intTOstring <integer>) - -- convert the argument into a string. - -=== Arithmetical Functions === - * (\+ <S-exp>*) - -- Addition. - -- If, the argument is empty, it returns 0. - * (\- <S-exp>+) - -- Subtraction. - * (\* <S-exp>*) - -- Multiplication. - -- If, the argument is empty, it returns 1. - * (\/ <S-exp>+) - -- Division. - * (\mod <int 1> <int 2>) - -- Modulus. - * (\< <S-exp 1> <S-exp 2>) - -- Let n be the evaluation result of <S-exp 1> and m be that of <S-exp 2>. - If n < m, it returns /t. Otherwise, it returns /f. - * (\> <S-exp 1> <S-exp 2>) - -- Let n be the evaluation result of <S-exp 1> and m be that of <S-exp 2>. - If n > m, it returns /t. Otherwise, it returns /f. - * (\leq <int 1> <int 2>) - -- Return (<int 1> <= <int 2>) - * (\geq <int 1> <int 2>) - -- Return (<int 1> >= <int 2>) - * (\isZeroQ <int>) - -- Return (<int> == 0) - * (\positiveQ <int>) - -- Return (<int> > 0) - * (\negativeQ <int>) - -- Return (<int> < 0) - * (\max <int 1> <int 2> ... ) - -- Return the max value of the arguments - * (\min <int 1> <int 2> ... ) - -- Return the minimal value of the arguments - -=== Manipulation of Strings === - * (\concat <string 1> <string 2>) - -- Concatenate two strings. - * (\group <string>) - -- Grouping. - -- If <string> is 'foo\bar{baz}', it returns '{foo\bar{baz}}'. - * (\ungroup <string>) - -- Ungrouping. - -- If <string> is '{foo\bar{baz}}', it returns 'foo\bar{baz}'. - * (\expand <string>) - -- Expand macros in string. - -=== Manipulation of Cons Cells === - * (\cons <S-exp 1> <S-exp 2>) - -- Create a cons cell: the CAR of the cell is the evaluation result of - <S-exp 1> and the CDR of the cell is the evaluation result of - <S-exp 2>. - * (\car <cons>) - -- Get CAR part of the argument. - * (\cdr <cons>) - -- Get CAR part of the argument. - * (\length <list>) - -- If the argument is "list", count the length of the argument. - -- We define the term "list" as following; - - The value nil. - - A cons cell whose CDR is "list". - * (\nth <list> <int>) - -- Get the <int>-th element of the <list>. - -- The numbering starts from 0. - -=== Logical Functions === - * (\and <bool 1> <bopl 2> ...) - * (\or <bool 1> <bopl 2> ...) - * (\not <bool>) - -=== Misc === - * (\= <S-exp 1> <S-exp 2>) - -- If the evaluation result of <S-exp 1> equals that of <S-exp 2>, - it returns /t. Otherwise, it returns /f. - * (\print <S-exp>) - -- Write the evaluation result of <S-exp> as LISP on TeX form. - * (\texprint <S-exp>) - -- Write the evaluation result of <S-exp> as useful form in TeX. - * (\immediatewrite) - -- Flush the output buffer immediately. - -- It may brake the evaluation routine. - * (\message <str>) - -- Write <str> to console. - * (\map <proc> <list 1> <list 2> ...) - -- Mapping function like Scheme's map. - * (\let <bindings> <body>) - -- Let bindings. - * (\letM <bindings> <body>) - -- Let bindings (mutable). - * (\letrec <bindings> <body>) - -- Let bindings (recursive and mutable). -==== Fixed Point Numbers ==== - * +{fpnum::<fixed point number>} - -- Create an fixed point number. - * (\fpplus <S-exp>*) - -- Addition. - -- If, the argument is empty, it returns 0.0. - * (\fpmunus <S-exp>+) - -- Subtraction. - * (\fpmul <S-exp>*) - -- Multiplication. - -- If, the argument is empty, it returns 1.0. - * (\fplt <S-exp 1> <S-exp 2>) - -- Let n be the evaluation result of <S-exp 1> and m be that of <S-exp 2>. - If n < m, it returns /t. Otherwise, it returns /f. -==== Continuations ==== - * (\callOCC <closure>) - -- One shot continuations. - -- It calls (<closure> c) where c is the current continuation. - -==== CHANGELOG ==== - * Jul. 12, 2014 : 1.3 - -- Add one shot continuations. - -- Add some arithmetical functions. - -- Debug environment. - * Jan. 03, 2014 : 1.2 - -- Added TUG2013's examples. - -- Improved the performance. - * Aug. 10, 2013 : 1.1 - -- Added \letrec and \expand. - -- debug - * Mar. 04, 2013 : 1.0 -
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/README.md b/Master/texmf-dist/doc/latex/lisp-on-tex/README.md new file mode 100644 index 00000000000..045f98aaed0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/README.md @@ -0,0 +1,597 @@ +# LISP on TeX # + +A LISP interpreter written only with TeX macros. +It works as a style file of LaTeX. +LISP on TeX adopts static scoping, dynamic typing, and eager evaluation. +We can program easily with LISP on TeX. + +## Summary ## + +To use LISP on TeX, you should include the `lisp-on-tex` package. +``` +\usepackage{lisp-on-tex} +``` + +If you do it, you can write LISP codes as a argument of `\lispinterp`. +``` +\lispintrep{ + (\some \LISP 'codes') + % example + (\define (\sum \a \b) (\+ \a \b)) +} +``` + +In LISP on TeX, a symbol is a control sequence; +a string is tokens surrounded by quotation marks; +and an integer is a TeX's integer using colon prefix. + +## Installation ## + +Put all files into your TEXMF tree. + + +## Details ## + +### Class Options ### + +| Option Name | Meaning | +| ----------- | ------------------------------- | +| `noGC` | Never using GC (default) | +| `markGC` | Using Mark-Sweep GC | +| `GCopt=...` | Passing option to the GC engine | + +Currently, LISP on TeX supports Mark-Sweep GC. +If you want to use it, you should use `markGC` option. +You can also control heap size by using `GCopt={heapsize=n}` +where `n` is greater than 3000. The default heap size is 32768. +For example, the code +``` +\usepackage[markGC, GCopt={heapsize=5000}]{lisp-on-tex} +``` +shows that LISP on TeX uses Mark-Sweep GC and the heap size is 5000. + +### Syntax ### + +| Kinds | Literals | Examples | +| ------------------ | ---------------------------------------------- | ---------------- | +| CONS Cell | `(` *obj* ... `.` *obj* `)`, `(` *obj* ... `)` | `(\+ :1 :2)` | +| Integer | `:` *TeX's integer* | `:42`, `:"3A` | +| String | `'` *TeX's balanced tokens* `'` | `'\foo{bar}baz'` | +| Symbol | *TeX's control sequence* | `\cs` | +| Boolean | `/t` or `/f` | | +| Nil | `()` | | +| Skip | `@` *TeX's skip* | `@12pt plus 34cm`| +| Dimen | `!` *TeX's dimen* | `!56pt` | + +### Functions and Special Forms ### + +#### Definition #### + +`\define` : Define a symbol. +************************************ + +``` +% symbol form +(\define \foo :42) % () +\foo % :42 +% function form +(\define (\foo \n) (\* \n :2)) +(\foo :3) % :6 +``` + +`\defineM` : Define a mutable symbol. +************************************* +`\setB` : Rewrite a mutable symbol. +************************************* + +``` +% symbol form +(\defineM \foo :42) % () +\foo % :42 +(\setB \foo 'bar') +\foo % 'bar' +``` + +`\defmacro` : Define a macro. +************************************* +`\macroexpand` : Expand a macro +************************************* + +``` +(\defmacro (\foo \x) (\list (\quote \bar) \x \x \x)) % () +(\macroexpand (\quote (\foo :1))) % (\bar :1 :1 :1) +``` + + +`\lambda` : Create a function. +************************************** + +``` +% normal form +((\lambda (\x) (\+ \x :2)) :3) % :5 +% list form +((\lambda \x \x) :1 :2) % (:1 :2) +% remain argument form +((\lambda (\x . \y) \y) :1 :2 :3) % (:2 :3) +``` + +`\let` : Define local symbols. +***************************************** + +``` +(\define \x 'foo') +(\let ((\x :4) (\y :3)) (\+ \x \y)) % :7 +\x % 'foo' +``` + +`\letM` : Define mutable local symbols. +****************************************** + +``` +(\letM ((\x 'foo')) + (\begin (\setB \x 'bar') \x)) % 'bar' +``` + +`\letrec` : Define local symbols recursively. +******************************************** + +``` +(\letrec + ((\oddQ (\lambda (\n) + (\lispif (\= \n :0) /f (\evenQ (\- \n :1))))) + (\evenQ (\lambda (\n) + (\lispif (\= \n :0) /t (\oddQ (\- \n :1)))))) + (\oddQ :42)) % /f +``` + +#### Control Flow #### + +`\lispif` : Branch. +******************************************** + +``` +(\lispif /t 'true' 'false') % 'true' +(\lispif /f 'true' 'false') % 'false' +``` + +`\begin` : Execute expressions. +******************************************** + +``` +(\letM ((\x :1)) (\begin (\setB \s 'foo') \x)) +% 'foo' +``` + +`\callOCC` : One-shot continuation. +******************************************* + +``` +(\defineM \x 'unchanged') +(\callOCC (\lambda (\c) + (\begin (\c '\foo ') + (\setB \x 'changed')))) % '\foo ' +\x % 'unchanged' +(\callOCC (\lambda (\c) :42)) % :42 +``` + +#### String Manipulations #### + +`\concat` : Concatenate tokens. +************************************ + +``` +(\concat '$' '\foo ' '{bar}' '$') % '$\foo {bar}$' +``` + +`\intTOstring` : Convert a integer to TeX's tokens. +****************************************************** + +``` +(\intTOstring :42) % '42' +``` + +`\group` : Grouping. +******************************* + +``` +(\group '\some {tokens}') % '{\some {tokens}}' +``` + +`\ungroup` : Ungrouping. +************************ + +``` +(\ungroup '{\some {tokens}}') % '\some {tokens}' +``` + +`\expand` : Expand tokens. +****************************** + +``` +\newcommand\foo[1]{I got #1!} +\lispinterp{ + (\expand '\foo{Foo}') % 'I got Foo!' +} +``` + +#### Arithmetical Functions #### + +`\+` : Addition. +*************************** + +``` +(\+) % :0 +(\+ :1 :2) % :3 +(\+ :3 :4 :5) % :12 +``` + +`\-` : Subtraction. +************************ + +``` +(\- :1) % :-1 +(\- :3 :2) % :1 +(\- :3 :2 :1) % :0 +``` + +`\*` : Multiplication. +********************** + +``` +(\*) % :1 +(\* :2 :3) % :6 +(\* :3 :4 :5) % :60 +``` + +`\/` : Division. +************************* + +``` +(\/ 2) % :0 (1/2 -> 0) +(\/ 7 2) % :3 +``` + +`\mod` : Modulo. +************************* + +``` +(\mod :42 :23) % :19 +(\mod :3 :2) % :1 +(\mod :3 :-2) % :1 +(\mod :-3 :2) % :-1 +(\mod :-3 :-2) % :-1 +``` + +`\>`, `\<`, `\geq`, `\leq` : Comparison. +******************************************* + +``` +(\> :3 :2) % /t +(\< :2 :3) % /t +(\geq :3 :2) % /t +(\geq :3 :3) % /t +(\leq :2 :3) % /t +(\leq :3 :3) % /t +``` + +Some predicates. +************************ + +``` +(\isZeroQ :0) % /t +(\positiveQ :42) % /t +(\negativeQ :-2) % /t +``` + +`\max` : Maximum. +*************************** + +``` +(\max :-10 :-5 :0 :5 :10) % :10 +``` + +`\min` : Minimum. +***************************** + +``` +(\min :-10 :-5 :0 :5 :10) % :-10 +``` + +#### Logical functions #### + +`\and`, `\or`, `\not` : Logical and, or, not +********************************************* + +``` +(\and /t /t) % /t +(\and /t /f) % /f +(\or /t /t) % /t +(\or /t /f) % /t +(\not /t) % /f +``` + + +#### Traditional LISP Functions and Special Forms #### + +`\quote` : Quote. +******************* + +``` +(\quote :42) % :42 +(\quote (\+ :1 :2)) % (\+ :1 :2) +``` + +`\cons`, `\car`, `\cdr` : CONS, CAR, CDR +************************************* + +``` +(\cons :42 'foo') % (:42 . 'foo') +(\car (\quote (:1 :2))) % :1 +(\cdr (\quote (:1 :2))) % (:2) +``` + +`\list` : Create a list +*************************** + +``` +(\list :1 :2 (\+ :3 :4)) % (:1 :2 :7) +``` + +`\length` : Get the length of a list. +***************************************** + +``` +(\length ()) % :0 +(\length (\list :1 :2 'three')) % :3 +``` + +`\map` : Map function. +************************** + +``` +(\define (\f \x \y \z) (\+ \x \y \z)) +(\map \f (\list :1 :2 :3) + (\list :4 :5 :6) + (\list :7 :8 :9)) % (:12 :15 :18) +``` + +`\nth` : Get the n-th value of a list (starting with 0). +*********************************************************** + +``` +(\nth (\list 'foo' 'bar' 'baz') :1) % 'bar' +``` + + +`\=` : Equality. +******************* + +``` +(\= '42' :42) % /f +(\= :23 :23) % /t +(\= (\cons :1 'foo') (\cons :1 'foo')) % /f +(\= 'foo' 'foo') % /t +``` +`\texprint` : Convert a object to TeX's tokens and output it to the document +****************************************************************************** + +``` +(\texprint (\concat '\foo' (\group '42'))) % return () andoutput \foo{42} +(\texprint :42) % output 42 +``` + +`\print` : (For test) output a object as TeX's tokens +******************************************************* + +``` +(\print ()) % output () +(\print (\quote \foo)) % output \string\foo +(\print :42) % output :42 +(\print 'bar') % output 'bar' +``` + +Type predicates +********************* + +``` +(\symbolQ (\quote \cs)) +(\stringQ 'foo') +(\intQ :42) +(\booleanQ /f) +(\dimenQ !12pt) +(\skipQ @12pt plus 1in minus 3mm) +(\pairQ (\cons :1 :2)) +(\nilQ ()) +(\funcQ \+) +(\closureQ (\lambda () ())) +(\defmacro (\x) ()) +(\macroQ \x) +(\listQ ()) +(\listQ (\list :1 :2)) +(\atomQ :23) +(\atomQ 'bar') +(\procedureQ \+) +(\procedureQ (\lambda () ())) +``` + +#### LaTeX Utils #### + +`\readLaTeXCounter` : Read an integer from LaTeX +*************************************************** + +``` +\setcounter{foo}{42} +\lispinterp{ + (\readLaTeXCounter 'foo') % :42 +} +``` + +`\message` : Wrapper of LaTeX's \message +******************************************* + +``` +(\message 'output') % output "message" to console and return () +``` + +#### Others #### + +`\read` : Read a LISP expression from stdin +********************************************* + +``` +(\read) % input :42 and return it +``` + +`\fgets` : Read a string from stdin. +*************************************** + +``` +(\fgets) % input \some {tokens} and return '\some {tokens}' +``` + + +##Additional Packages ## + +### Fixed Point Numbers ### + +The package lisp-mod-fpnum adds fixed point numbers +to LISP on TeX. Load it by `\usepackage`: + +``` +\usepackage{lisp-on-tex} +\usepackage{lisp-mod-fpnum} +``` + +#### Syntax #### + +| Kinds | Literals | Examples | +| ------------------ | ---------------------------------------------- | ---------------- | +| Fixed point number | `+{fpnum::` *number* `}` | `+{fpnum::1.23}` | + +#### Functions #### + +`\fpnumTOstring` : Convert a fixed point number to a string. +************************************************************ + +``` +(\fpnumTOstring +{fpnum::1.23}) % '1.23' +``` + +`\fpplus` : Addition. +********************* + +``` +(\fpplus +{fpnum::1.2} +{fpnum::1.4}) % 2.59999 (arithmetical error) +``` + +`\fpminus` : Subtraction. +************************ + +``` +(\fpminus +{fpnum::4.2} +{fpnum::2.3}) % 1.9 +``` + +`\fpmul` : Multiplication. +***************************** + +``` +(\fpmul +{fpnum::1.2} +{fpnum::1.4}) % 1.67998 +``` + +`\fplt` : Comparison. +************************** + +``` +(\fplt +{fpnum::1.2} +{fpnum::2.3}) % /t +``` + + +### Regular Expressions ### + +The package lisp-mod-l3regex is thin wrapper +of l3regex. Load it by `\usepackage`: + +``` +\usepackage{lisp-on-tex} +\usepackage{lisp-mod-l3regex} +``` + +#### Functions #### + +`\regMatch`, `\regMatchResult` : Match. +************************************* + +``` +(\regMatch 'hoge+' 'hogeeeeeee') % /t +(\regMatchResult '(\w+)\s+is\s+(\w+)\.' 'He is crazy.') +% ('He is crazy.' 'He' 'crazy') +``` + +`\regExtract` : Extraction. +**************************** + +``` +(\regExtract '\w+' 'hello regex world') % ('hello' 'regex' 'world') +``` + +`\regReplaceAll`, `\regReplaceOnce` : Replace. +********************************************** + +``` +(\regReplaceAll '(\w+?)to(\w+?)' '$\1\c{to}\2$' 'AtoB BtoC') % '$A\to B$ $B\to C$' +(\regReplaceOnce 'foo+' '[\0]' 'foooofooooooo') % '[foooo]fooooooo' +``` + +`\regSplit` : Split. +*********************** + +``` +(\regSplit '/' '/path/to/hogehoge') % ('' 'path' 'to' 'hogehoge') +``` + + +## TODOs ## + +* Writing user manual +* Add functions and special forms + +## CHANGELOG ## + +Oct. 25, 2015 : 2.0 +************************* + +* Add GC +* Refine some special forms like \define +* Add checking #args for some functions. +* Add thin wrapper of l3regex + +Jul. 12, 2014 : 1.3 +************************* + +* Add one shot continuations. +* Add some arithmetical functions. +* Debug environment. + +Jan. 03, 2014 : 1.2 +************************** + +* Added TUG2013's examples. +* Improved the performance. + +Aug. 10, 2013 : 1.1 +************************** + +* Added \letrec and \expand. +* debug + +Mar. 04, 2013 : 1.0 +************************** + +## Licence ## + +Modified BSD (see LICENCE) + +************************************************ +HAKUTA Shizuya <hak7a3@live.jp> + +https://bitbucket.org/hak7a3/lisp-on-tex/ diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/div2.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/div2.pdf Binary files differnew file mode 100644 index 00000000000..6cb01f55aaa --- /dev/null +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/div2.pdf diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/div2.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/div2.tex new file mode 100644 index 00000000000..ae2cf824ee6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/div2.tex @@ -0,0 +1,30 @@ +\documentclass{article} +%\usepackage{lisp-on-tex} +\usepackage[markGC]{lisp-on-tex} +\lispinterp { + (\define (\create \n) (\createAcc \n ())) + (\define (\createAcc \n \acc) + (\lispif (\= \n :0) \acc (\createAcc (\- \n :1) (\cons () \acc)))) + (\define \ll (\create :200)) + (\define (\divII \l) + (\lispif (\= \l ()) () (\cons (\car \l) (\divII (\cdr (\cdr \l)))))) + (\define (\test \l) (\testAcc \l :500)) % original is 300 + (\define (\testAcc \l \i) + (\lispif (\= \i :0) () + (\begin + (\lispif (\= (\length (\divII \l)) :100) + () (\texprint 'Hmm')) + (\lispif (\= (\length (\divII \l)) :100) + () (\message 'Hmm')) + (\lispif (\= (\length (\divII \l)) :100) + () (\message 'Hmm')) + (\lispif (\= (\length (\divII \l)) :100) + () (\message 'Hmm')) + (\texprint \i) + (\texprint ' ') + (\testAcc \l (\- \i :1))))) +} + +\begin{document} + \lispinterp{(\test \ll)} +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdf Binary files differindex 490cce4e5e8..5bb156ab393 100644 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdf +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fact.pdf diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdf Binary files differindex 19359ec0385..b40e5f7c9b7 100644 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdf +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/fpnummodule-mandelbrot.pdf diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/nqueen.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/nqueen.pdf Binary files differindex 89425e38a5b..c605d4212c8 100644 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/nqueen.pdf +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/nqueen.pdf diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdf Binary files differindex de0e6ca70f6..bfff99d340a 100644 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdf +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/rocket.pdf diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/showfont.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/showfont.pdf Binary files differindex 0960b7a9fed..13ef7fce56a 100644 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/examples/showfont.pdf +++ b/Master/texmf-dist/doc/latex/lisp-on-tex/examples/showfont.pdf diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/test.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/test.tex deleted file mode 100644 index 08b9171d3ab..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/test.tex +++ /dev/null @@ -1,261 +0,0 @@ -\documentclass{article} -\usepackage{lisp-on-tex} -\usepackage{qstest} -\IncludeTests{*} -\def\parserTestCallBack#1#2{\gdef\parsedResult{#1{#2}}} - -\begin{document} - \LogTests{lgout}{*}{*} - \makeatletter - \begin{qstest}{Parser Test}{\@lispread} - \begin{qstest}{cons and list}{\@lispread,\@tlabel@cons} - % dot pair - \def\subtestDot#1#2{\Expect{#1}{\@tlabel@cons}\subtestDotValue#2\relax\relax}% - \def\subtestDotValue#1#2{% - \expandafter\Expect\expandafter{#1}{\@tlabel@int{0}}% - \expandafter\Expect\expandafter{#2}{\@tlabel@int{1}}}% - \setbox0=\hbox{\@lispread\parserTestCallBack(:0.:1)}% - \expandafter\subtestDot\parsedResult - \Expect*{\the\wd0}{0.0pt}% - % list - \def\subtestListI#1#2{\Expect{#1}{\@tlabel@cons}\subtestListValueI#2\relax\relax}% - \def\subtestListValueI#1#2{% - \expandafter\Expect\expandafter{#1}{\@tlabel@int{1}}% - \expandafter\subtestListII#2\relax\relax}% - \def\subtestListII#1#2{\Expect{#1}{\@tlabel@cons}\subtestListValueII#2\relax\relax}% - \def\subtestListValueII#1#2{% - \expandafter\Expect\expandafter{#1}{\@tlabel@int{2}}% - \expandafter\Expect\expandafter{#2}{\@tlabel@nil{}}}% - \setbox0=\hbox{\@lispread\parserTestCallBack(:1 :2)}% - \expandafter\subtestListI\parsedResult - \Expect*{\the\wd0}{0.0pt}% - % list with dot - \def\subtestListDotI#1#2{\Expect{#1}{\@tlabel@cons}\subtestListDotValueI#2\relax\relax}% - \def\subtestListDotValueI#1#2{% - \expandafter\Expect\expandafter{#1}{\@tlabel@int{1}}% - \expandafter\subtestListDotII#2\relax\relax}% - \def\subtestListDotII#1#2{\Expect{#1}{\@tlabel@cons}\subtestListDotValueII#2\relax\relax}% - \def\subtestListDotValueII#1#2{% - \expandafter\Expect\expandafter{#1}{\@tlabel@int{2}}% - \expandafter\Expect\expandafter{#2}{\@tlabel@int{3}}}% - \setbox0=\hbox{\@lispread\parserTestCallBack(:1 :2.:3)}% - \expandafter\subtestListDotI\parsedResult - \Expect*{\the\wd0}{0.0pt}% - \end{qstest} - \def\parserTest#1#2{% - \setbox0=\hbox{\@lispread\parserTestCallBack#1}% - \expandafter\Expect\expandafter{\parsedResult}{#2}% - \Expect*{\the\wd0}{0.0pt}% - } - \begin{qstest}{integer}{\@lispread,\@tlabel@int} - \parserTest{:42}{\@tlabel@int{42}} - \parserTest{:-42}{\@tlabel@int{-42}} - \end{qstest} - \begin{qstest}{string}{\@lispread,\@tlabel@string} - \parserTest{'This is a {{example}} of \TeX : $f^{2x}_s(y)$'} - {\@tlabel@string{This is a {{example}} of \TeX : $f^{2x}_s(y)$}} - \end{qstest} - \begin{qstest}{symbol}{\@lispread,\@tlabel@symbol} - \parserTest{\symbol}{\@tlabel@symbol{\symbol}} - \end{qstest} - \begin{qstest}{bool}{\@lispread,\@tlabel@bool} - \parserTest{/t}{\@tlabel@bool{t}} - \parserTest{/f}{\@tlabel@bool{f}} - \end{qstest} - \begin{qstest}{nil}{\@lispread,\@tlabel@nil} - \parserTest{()}{\@tlabel@nil{}} - \end{qstest} - \begin{qstest}{parser-module}{\@lispread} - \def\@mod@read@dummy#1#2{\gdef#1{\@tlabel@testdummy{#2}}} - \parserTest{+{dummy::testValue}}{\@tlabel@testdummy{testValue}} - \end{qstest} - \begin{qstest}{dimen}{\@lispread,\@tlabel@dimen} - \parserTest{!123.45pt}{\@tlabel@dimen{123.45pt}} - \end{qstest} - \begin{qstest}{skip}{\@lispread,\@tlabel@skip} - \parserTest{@123.45pt plus 1fil minus 0.5pt} - {\@tlabel@skip{123.45pt plus 1.0fil minus 0.5pt}} - \end{qstest} - \end{qstest} - \begin{qstest}{Evaluation}{\@lispeval} - \begin{qstest}{self-evaluating form}{\@lispeval} - \def\selfEvalTest#1{% - \def\selfEvalTarget{#1}% - \setbox0=\hbox{\lispeval\selfEvalTarget\selfEvalResult}% - \Expect*{\the\wd0}{0.0pt}% - \expandafter\expandafter\expandafter\Expect\expandafter\expandafter\expandafter{% - \expandafter\selfEvalTarget\expandafter}\expandafter{\selfEvalResult}}% - \selfEvalTest{\@tlabel@string{foo}} - \selfEvalTest{\@tlabel@int{42}} - \selfEvalTest{\@tlabel@bool{t}} - \selfEvalTest{\@tlabel@dimen{12.3pt}} - \selfEvalTest{\@tlabel@skip{12.3pt plus 1.0 fil minus 0.5pt}} - \selfEvalTest{\@tlabel@nil{}} - \selfEvalTest{\@tlabel@func{\dummy}} - \selfEvalTest{\@tlabel@closure{{\x:\@@unused}{\y{\@ylabel@int{1}}}\@tlabel@int{0}}} - \selfEvalTest{\@tlabel@macro{{\x:\@@unused}{}\@tlabel@int{0}}} - \selfEvalTest{\@tlabel@envfunc{\dummy}} - \selfEvalTest{\@tlabel@mutable{\dummy}} - \selfEvalTest{\@tlabel@exception{3}} - \selfEvalTest{\@tlabel@lambda{}} - \selfEvalTest{\@tlabel@define{}} - \selfEvalTest{\@tlabel@if{}} - \selfEvalTest{\@tlabel@defmacro{}} - \selfEvalTest{\@tlabel@begin{}} - \selfEvalTest{\@tlabel@mdefine{}} - \selfEvalTest{\@tlabel@setb{}} - \selfEvalTest{\@tlabel@@let{}} - \selfEvalTest{\@tlabel@@mlet{}} - \selfEvalTest{\@tlabel@macroexpand{}} - \selfEvalTest{\@tlabel@callocc{}} - \selfEvalTest{\@tlabel@exception{{-1}{\@tlabel@string{dummy}}}} - \selfEvalTest{\@tlabel@continuation{1}} - \end{qstest} - \begin{qstest}{symbol}{\@lispeval} - %global env - \def\selfEvalTarget{\@tlabel@symbol{\=}}% - \setbox0=\hbox{\lispeval\selfEvalTarget\selfEvalResult}% - \Expect*{\the\wd0}{0.0pt}% - \expandafter\Expect\expandafter{\selfEvalResult}{\@tlabel@func{\@lisp@equal}}% - % local env - \def\selfEvalTarget{\@tlabel@symbol{\dummy}}% - \setbox0=\hbox{\expandafter\@eval\selfEvalTarget{\dummy{\@tlabel@int{42}}}\selfEvalResult}% - \Expect*{\the\wd0}{0.0pt}% - \expandafter\Expect\expandafter{\selfEvalResult}{\@tlabel@int{42}}% - % mutable - \def\dummyMutable{\@tlabel@symbol{\dummy}} - \setbox0=\hbox{\expandafter\@eval\selfEvalTarget{\dummy{\@tlabel@mutable{\dummyMutable}}}\selfEvalResult}% - \Expect*{\the\wd0}{0.0pt}% - expandafter\Expect\expandafter{\selfEvalResult}{\@tlabel@symbol{\dummy}}% - \end{qstest} - \begin{qstest}{cons cell and embeded function call}{\@lispeval} - \@lispread\parserTestCallBack(\+ :1 :2) - \setbox0=\hbox{\lispeval\parsedResult\consEvalResult}% - \Expect*{\the\wd0}{0.0pt}% - \expandafter\Expect\expandafter{\consEvalResult}{\@tlabel@int{3}}% - \end{qstest} - \begin{qstest}{special forms}{\@lispeval} - \def\specialFormEval#1{% - \@lispread\parserTestCallBack#1% - \setbox0=\hbox{\lispeval\parsedResult\spEvalResult}% - \Expect*{\the\wd0}{0.0pt}} - %% defineM - \def\getmdefSymbol#1\mdefSymbol#2#3\undefinedSymbol{% - \def\postDefinedEnv{#1}% - \def\testMdef{#2}% - \def\preDefinedEnv{#3}}% - \def\checkMdefinedValue#1#2#3{% - \Expect{#1}{\@tlabel@mutable}% - \expandafter\Expect\expandafter{#2}{#3}% - } - \toks0\expandafter{\@globalenv}% - \specialFormEval{(\defineM \mdefSymbol :42)}% it is also used for setB, if, and begin - \expandafter\getmdefSymbol\@globalenv\undefinedSymbol - \expandafter\Expect\expandafter{\postDefinedEnv}{}% - \expandafter\Expect\expandafter{\preDefinedEnv}*{\the\toks0}% - \expandafter\checkMdefinedValue\testMdef{\@tlabel@int{42}}% - %% setB - \specialFormEval{(\setB \mdefSymbol 'hoge')}% - \expandafter\getmdefSymbol\@globalenv\undefinedSymbol - \expandafter\checkMdefinedValue\testMdef{\@tlabel@string{hoge}}% - %% if - \specialFormEval{(\lispif /t (\setB \mdefSymbol :1) (\setB \mdefSymbol :2))}% - \expandafter\getmdefSymbol\@globalenv\undefinedSymbol - \expandafter\checkMdefinedValue\testMdef{\@tlabel@int{1}}% - \specialFormEval{(\lispif /f (\setB \mdefSymbol :1) (\setB \mdefSymbol :2))}% - \expandafter\getmdefSymbol\@globalenv\undefinedSymbol - \expandafter\checkMdefinedValue\testMdef{\@tlabel@int{2}}% - %% begin - \specialFormEval{(\begin (\setB \mdefSymbol :1) 'hoge')}% - \expandafter\Expect\expandafter{\spEvalResult}{\@tlabel@string{hoge}}% - \expandafter\checkMdefinedValue\testMdef{\@tlabel@int{1}}% - %% lambda - \def\checkClosure#1#2#3#4#5{% - \Expect{#1}{\@tlabel@closure}% - \checkClosureValue#2{#3}{#4}{#5}} - \def\checkClosureValue#1#2#3#4#5#6#7{% - \Expect{#1}{#5}% bind - \Expect{#2}{#6}% env - \Expect{#3{#4}}{#7}% body - } - \specialFormEval{(\lambda (\x \y) :42)}% - \expandafter\checkClosure\spEvalResult{\x\y:\@@unused}{}{\@tlabel@int{42}}% - \specialFormEval{(\lambda (\x . \y) :42)}% - \expandafter\checkClosure\spEvalResult{\x:\y}{}{\@tlabel@int{42}}% - \specialFormEval{(\lambda \x :42)}% - \expandafter\checkClosure\spEvalResult{:\x}{}{\@tlabel@int{42}}% - %% @let - \specialFormEval{(\@let \z 'foo' (\lambda (\x . \y) :42))}% - \expandafter\checkClosure\spEvalResult{\x:\y}{\z{\@tlabel@string{foo}}}{\@tlabel@int{42}}% - %% @mlet - \def\checkClosureMutable#1#2#3#4#5{% - \Expect{#1}{\@tlabel@closure}% - \checkClosureValueMutable#2{#3}{#4}{#5}} - \def\checkClosureValueMutable#1#2#3#4#5#6#7{% - \Expect{#1}{#5}% bind - \Expect{#3{#4}}{#7}% body - \checkClosureEnvMutable#2#6} - \def\checkClosureEnvMutable#1#2#3#4{% - \Expect{#1}{#3} % bineded symbol - \checkClosureEnvMutableInner#2{#4}} - \def\checkClosureEnvMutableInner#1#2#3{% - \Expect{#1}{\@tlabel@mutable}% - \expandafter\Expect\expandafter{#2}{#3}} - \specialFormEval{(\@mlet \z 'foo' (\lambda (\x . \y) :42))}% - \expandafter\checkClosureMutable\spEvalResult{\x:\y}{\z{\@tlabel@string{foo}}}{\@tlabel@int{42}}% - %% quote - \specialFormEval{(\quote :42)}% - \expandafter\Expect\expandafter{\spEvalResult}{\@tlabel@int{42}}% - %% define - \toks0\expandafter{\@globalenv}% - \specialFormEval{(\define \x :42)}% - \edef\hopedGlobalenv{\noexpand\x{\noexpand\@tlabel@int{42}}\the\toks0}% - \expandafter\expandafter\expandafter\Expect\expandafter\expandafter\expandafter{\expandafter\@globalenv\expandafter}\expandafter{\hopedGlobalenv}% - \expandafter\Expect\expandafter{\spEvalResult}{\@tlabel@nil{}}% - %% defmacro - \toks0\expandafter{\@globalenv}% - \specialFormEval{(\defmacro \mac (\lambda (\c) \c))}% it is also used in macroexpand - \edef\hopedGlobalenv{\noexpand\mac{\noexpand\@tlabel@macro{{\noexpand\c:\noexpand\@@unused}{}\noexpand\@tlabel@symbol{\noexpand\c}}}\the\toks0}% - \expandafter\expandafter\expandafter\Expect\expandafter\expandafter\expandafter{\expandafter\@globalenv\expandafter}\expandafter{\hopedGlobalenv}% - \expandafter\Expect\expandafter{\spEvalResult}{\@tlabel@nil{}}% - %% macroexpand - \def\testMacroExpand#1#2{% - \Expect{#1}{\@tlabel@cons}% - \testMacroExpandi#2} - \def\testMacroExpandi#1#2{% - \expandafter\Expect\expandafter{#1}{\@tlabel@symbol{\quote}}% - \expandafter\testMacroExpandii#2} - \def\testMacroExpandii#1#2{% - \Expect{#1}{\@tlabel@cons}% - \testMacroExpandiii#2} - \def\testMacroExpandiii#1#2{% - \expandafter\Expect\expandafter{#1}{\@tlabel@int{1}}% - \expandafter\Expect\expandafter{#2}{\@tlabel@nil{}}} - \specialFormEval{(\macroexpand (\quote (\mac (\quote :1))))}% - \expandafter\testMacroExpand\spEvalResult - \end{qstest} - \begin{qstest}{one-shot continuation}{\@lispeval} - \def\occEval#1{% - \@lispread\parserTestCallBack#1% - \setbox0=\hbox{\lispeval\parsedResult\occEvalResult}% - \Expect*{\the\wd0}{0.0pt}} - \occEval{(\callOCC (\lambda (\c) :1))} - \expandafter\Expect\expandafter{\occEvalResult}{\@tlabel@int{1}} - \occEval{(\callOCC (\lambda (\c) \c))} - \expandafter\Expect\expandafter{\occEvalResult}{\@tlabel@continuation{1}} - \occEval{(\callOCC (\lambda (\c) (\c :42)))} - \expandafter\Expect\expandafter{\occEvalResult}{\@tlabel@int{42}} - \occEval{(\callOCC (\lambda (\c) (\callOCC (\lambda (\d) \d))))} - \expandafter\Expect\expandafter{\occEvalResult}{\@tlabel@continuation{2}} - \end{qstest} - \begin{qstest}{mutiple map}{\@lispeval} - \def\occEval#1{% - \@lispread\parserTestCallBack#1% - \setbox0=\hbox{\lispeval\parsedResult\occEvalResult}% - \Expect*{\the\wd0}{0.0pt}} - \occEval{(\map (\lambda (\k) (\+ \k :1)) (\map (\lambda (\k) (\* \k :2)) (\quote (:1 :2))))} - - \end{qstest} - \end{qstest} - \LogClose{lgout} -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/asts.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/asts.tex deleted file mode 100644 index 0baa79fd69f..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/asts.tex +++ /dev/null @@ -1,9 +0,0 @@ -\documentclass{article} -\usepackage{expl3} -\ExplSyntaxOn -\cs_new:Npn \astsInner #1 {\prg_replicate:nn {#1} {*}} -\ExplSyntaxOff -\newcommand\astsExpliii[1]{\edef\asts{\astsInner{#1}}} -\begin{document} - \astsExpliii{10000} -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/mandel.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/mandel.pdf Binary files differdeleted file mode 100644 index 2594f8edb14..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/mandel.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/mandel.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/mandel.tex deleted file mode 100644 index 5a32abb8eda..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/mandel.tex +++ /dev/null @@ -1,79 +0,0 @@ -\documentclass{article} -\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} -\usepackage{expl3} - -%% draw macros -\newcount\mlength -\mlength0 -\newcount\cstate -\newdimen\mandelunit -\mandelunit=0.5pt - -\def\wp{% - \ifnum\cstate=1 \global\advance\mlength1 - \else\ifnum\cstate=-1 \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi\fi - \global\cstate1} -\def\bp{% - \ifnum\cstate=-1 \global\advance\mlength1 - \else\ifnum\cstate=1 \hspace*{\mlength\mandelunit}\global\mlength1 \fi\fi - \global\cstate-1} -\def\r{% - \ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi - \global\cstate0 \global\mlength0} - -\ExplSyntaxOn - \int_const:Nn \l_hakviiaiii_maxloop {20} - \fp_const:Nn \l_hakviiaiii_scale {0.002} - \int_new:N \l_hakviiaiii_loopismandel - \fp_new:N \l_hakviiaiii_x - \fp_new:N \l_hakviiaiii_xx - \fp_new:N \l_hakviiaiii_y - \fp_new:N \l_hakviiaiii_yy - \fp_new:N \l_hakviiaiii_a - \fp_new:N \l_hakviiaiii_b - \bool_new:N \l_hakviiaiii_check_mandel - \cs_new:Npn \hakviiaiii_ismandel:nn #1#2{% - \int_zero:N \l_hakviiaiii_loopismandel - \fp_zero:N \l_hakviiaiii_x - \fp_zero:N \l_hakviiaiii_y - \fp_set:Nn \l_hakviiaiii_xx {\l_hakviiaiii_x * \l_hakviiaiii_x}% - \fp_set:Nn \l_hakviiaiii_yy {\l_hakviiaiii_y * \l_hakviiaiii_y}% - \bool_set_false:N\l_hakviiaiii_check_mandel - \bool_while_do:nn {% - \int_compare_p:nNn - {\l_hakviiaiii_loopismandel}% - < {\l_hakviiaiii_maxloop + 1}% - && \fp_compare_p:nNn - {\l_hakviiaiii_xx + \l_hakviiaiii_yy}< {4.0}% - } {% - \fp_set:Nn \l_hakviiaiii_y {% - 2.0 * \l_hakviiaiii_x *\l_hakviiaiii_y + #2}% - \fp_set:Nn \l_hakviiaiii_x {\l_hakviiaiii_xx - \l_hakviiaiii_yy + #1}% - \fp_set:Nn \l_hakviiaiii_xx {\l_hakviiaiii_x * \l_hakviiaiii_x}% - \fp_set:Nn \l_hakviiaiii_yy {\l_hakviiaiii_y * \l_hakviiaiii_y}% - \int_set:Nn \l_hakviiaiii_loopismandel - {\l_hakviiaiii_loopismandel + 1}% - }% - \bool_set:Nn \l_hakviiaiii_check_mandel - {\int_compare_p:nNn - {\l_hakviiaiii_loopismandel} > {\l_hakviiaiii_maxloop}}} - \cs_new:Nn \hakviiaiii_loopmandel: {% - \fp_set:Nn \l_hakviiaiii_b {1.0}% - \fp_while_do:nNnn {\l_hakviiaiii_b} > {-1.0 - \l_hakviiaiii_scale} {% - \fp_set:Nn \l_hakviiaiii_a {-1.5}% - \fp_while_do:nNnn{\l_hakviiaiii_a} < {0.5 + \l_hakviiaiii_scale} {% - \hakviiaiii_ismandel:nn{\l_hakviiaiii_a}{\l_hakviiaiii_b}% - \bool_if:nTF - {\l_hakviiaiii_check_mandel}% - {\bp}{\wp}% - \fp_set:Nn \l_hakviiaiii_a {\l_hakviiaiii_a + \l_hakviiaiii_scale}% - } \r\\% - \fp_set:Nn \l_hakviiaiii_b {\l_hakviiaiii_b - \l_hakviiaiii_scale}% - }} - \cs_new_eq:NN \mandel \hakviiaiii_loopmandel: -\ExplSyntaxOff -\begin{document} - \thispagestyle{empty}\noindent - \leavevmode\baselineskip=\mandelunit - \mandel -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/tarai.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/tarai.pdf Binary files differdeleted file mode 100644 index aa9b72aa3b2..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/tarai.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/tarai.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/tarai.tex deleted file mode 100644 index ad61f174b4c..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/expl3/tarai.tex +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{article} -\usepackage{expl3} -\ExplSyntaxOn -\cs_new:Npn \hakviiaiii_tarai:nnn #1#2#3 {% - \int_compare:nTF{#1 <= #2} - {#2} - {\hakviiaiii_tarai:nnn - {\hakviiaiii_tarai:nnn{\int_eval:n{#1 - 1}}{#2}{#3}} - {\hakviiaiii_tarai:nnn{\int_eval:n{#2 - 1}}{#3}{#1}} - {\hakviiaiii_tarai:nnn{\int_eval:n{#3 - 1}}{#1}{#2}}}} -\cs_new_eq:NN \tarai \hakviiaiii_tarai:nnn -\ExplSyntaxOff -\begin{document} - $\mathrm{Tarai}(14,12,10) = \tarai{14}{12}{10}$ -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/ast.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/ast.tex deleted file mode 100644 index 618a49f051b..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/ast.tex +++ /dev/null @@ -1,12 +0,0 @@ -\documentclass{article} -\newcount\n -\newcommand{\astsfast}[1]{% -\n=#1 -\begingroup -\aftergroup\edef\aftergroup\asts\aftergroup{% -\loop \ifnum\n>0 \aftergroup*\advance\n-1 -\repeat -\aftergroup}\endgroup} -\begin{document} - \astsfast{10000} -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/mandel.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/mandel.pdf Binary files differdeleted file mode 100644 index 90245a28c72..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/mandel.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/mandel.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/mandel.tex deleted file mode 100644 index 1166f3f9646..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/mandel.tex +++ /dev/null @@ -1,90 +0,0 @@ -\documentclass{article} -\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} -%% draw macros -\newcount\mlength -\newcount\cstate -\newdimen\mandelunit -\mandelunit=0.5pt -\def\wp{% - \ifnum\cstate=1 \global\advance\mlength1 - \else\ifnum\cstate=-1 \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi\fi - \global\cstate1} -\def\bp{% - \ifnum\cstate=-1 \global\advance\mlength1 - \else\ifnum\cstate=1 \hspace*{\mlength\mandelunit}\global\mlength1 \fi\fi - \global\cstate-1} -\def\r{% - \ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi - \global\cstate0 \global\mlength0} - -% Mandelbrot -\newskip\x -\newskip\y -\newskip\a -\newskip\b -\newskip\xx -\newskip\yy -\newskip\tmp -\newcount\k -\def\maxloop{20} -\def\scale{0.002} - -\def\loopMandel{% - \ifdim\b<-1.0pt\relax - \let\next\relax - \else - \drawMandel - \let\next\loopMandel - \ifdim\a>0.5pt\relax - \r\\ - \a=-1.5pt\relax - \advance\b-\scale pt\relax - \else - \advance\a\scale pt\relax - \fi - \fi - \next} -\def\drawMandel{% - \x=0pt\relax - \y=0pt\relax - \k=0\relax - \checkMandel - \ifnum\k>\maxloop\relax - \bp - \else - \wp - \fi -} -\makeatletter -\def\checkMandel{% - \ifnum\k>\maxloop - \let\checkNext\relax - \else - \xx=\strip@pt\x\x - \yy=\strip@pt\y\y - \tmp\xx \advance\tmp\yy - \ifdim\tmp>4.0pt\relax - \let\checkNext\relax - \else - \let\checkNext\checkMandel - \advance\k1\relax - \tmp=\strip@pt\x\y - \multiply\tmp2\relax - \advance\tmp\b - \y\tmp - \x\a - \advance\x\xx - \advance\x-\yy - \fi - \fi - \checkNext -} -\makeatother - -\begin{document} -\thispagestyle{empty}\noindent -\leavevmode\baselineskip=\mandelunit -\a=-1.5pt\relax -\b=1.0pt\relax -\loopMandel -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/tarai.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/tarai.pdf Binary files differdeleted file mode 100644 index 60898e3f228..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/tarai.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/tarai.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/tarai.tex deleted file mode 100644 index 49cb281e53d..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/latex/tarai.tex +++ /dev/null @@ -1,27 +0,0 @@ -\documentclass{article} -\newcount\d -\def\tarai#1#2#3#4{% - \begingroup - \aftergroup\next - \ifnum#1<#2% - \gdef\next{\def#4{#2}}% - \else\ifnum#1=#2% - \gdef\next{\def#4{#2}}% - \else - \d#1% - \advance\d-1 - \expandafter\tarai\expandafter{\the\d}{#2}{#3}\tx - \d#2% - \advance\d-1 - \expandafter\tarai\expandafter{\the\d}{#3}{#1}\ty - \d#3% - \advance\d-1 - \expandafter\tarai\expandafter{\the\d}{#1}{#2}\tz - \xdef\next{\noexpand\tarai{\tx}{\ty}{\tz}\noexpand#4}% - \fi\fi - \endgroup} -\begin{document} - \tarai{14}{10}{6}\tmp - $\mathrm{Tarai}(14,10,6) = \tmp$ -\end{document} - diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/asts.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/asts.pdf Binary files differdeleted file mode 100644 index d07e5497bfe..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/asts.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/asts.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/asts.tex deleted file mode 100644 index 1e5cdd2b3fb..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/asts.tex +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{article} -\usepackage{lisp-on-tex} -\lispinterp{ - (\define \foldl (\lambda (\func \init \list) - (\lispif (\= \list ()) - \init - (\foldl \func (\func \init (\car \list)) (\cdr \list))))) - (\define \astsLoTInner (\lambda (\n \ret) - (\lispif (\< :0 \n) (\astsLoTInner (\- \n :1) (\concat \ret '*')) - \ret))) - (\define \astsLoT (\lambda (\n) (\texprint (\concat '\def\asts' (\group (\astsLoTInner \n '')))))) -} -\begin{document} -\lispinterp{(\astsLoT :10000)} -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/mandel.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/mandel.pdf Binary files differdeleted file mode 100644 index fafec50f93e..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/mandel.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/mandel.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/mandel.tex deleted file mode 100644 index 7aab7e1e8db..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/mandel.tex +++ /dev/null @@ -1,55 +0,0 @@ -\documentclass{article} -\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} -\newcount\mlength -\newcount\cstate -\newdimen\mandelunit -\mandelunit=0.5pt - -\def\w{% - \ifnum\cstate=1 \global\advance\mlength1 - \else\ifnum\cstate=-1 \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi\fi - \global\cstate1} -\def\b{% - \ifnum\cstate=-1 \global\advance\mlength1 - \else\ifnum\cstate=1 \hspace*{\mlength\mandelunit}\global\mlength1 \fi\fi - \global\cstate-1} -\def\r{% - \ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi - \global\cstate0 \global\mlength0} - -\usepackage{lisp-on-tex} -\usepackage{lisp-mod-fpnum} -\lispinterp{% - (\define \maxloop :20) - (\define \scale +{fpnum::0.002}) - (\define \isMandell - (\lambda (\a \b \k \x \y) - (\lispif (\< \maxloop \k) /t - (\lispif (\fplt +{fpnum::4.0} (\fpplus (\fpmul \x \x) (\fpmul \y \y))) - /f - (\isMandell \a \b (\+ \k :1) - (\fpplus \a (\fpmul \x \x) (\fpminus (\fpmul \y \y))) - (\fpplus \b (\fpmul +{fpnum::2.0} \x \y))))))) - (\define \drawMandell (\lambda (\a \b) - (\begin - (\lispif (\isMandell \a \b :0 +{fpnum::0} +{fpnum::0}) - (\texprint '\b') (\texprint '\w')) - (\immediatewrite)))) - (\define \loopMandell (\lambda (\a \b) - (\lispif (\fplt \b +{fpnum::-1.0}) () - (\begin - (\drawMandell \a \b) - (\lispif (\fplt +{fpnum::0.5} \a) - (\begin - (\texprint '\r\\') - (\immediatewrite) - (\loopMandell +{fpnum::-1.5} (\fpminus \b \scale))) - (\loopMandell (\fpplus \a \scale) \b)))))) -} - -\begin{document} - \thispagestyle{empty} - \noindent - \leavevmode\baselineskip=\mandelunit - \lispinterp{(\loopMandell +{fpnum::-1.5} +{fpnum::1.0})} -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/tarai.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/tarai.pdf Binary files differdeleted file mode 100644 index 5f562c98116..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/tarai.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/tarai.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/tarai.tex deleted file mode 100644 index f443187397f..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/lot/tarai.tex +++ /dev/null @@ -1,12 +0,0 @@ -\documentclass{article} -\usepackage{lisp-on-tex} -%\tracingmacros=1 -\lispinterp{ - (\define \tarai (\lambda (\x \y \z) - (\lispif (\or (\< \x \y) (\= \x \y)) - \y - (\tarai (\tarai (\- \x :1) \y \z) (\tarai (\- \y :1) \z \x) (\tarai (\- \z :1) \x \y))))) -} -\begin{document} - $\mathrm{Tarai}(14,10,6) = \lispinterp{(\texprint (\tarai :14 :10 :6))}$ -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/asts.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/asts.pdf Binary files differdeleted file mode 100644 index d77b8459695..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/asts.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/asts.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/asts.tex deleted file mode 100644 index 2126d07b106..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/asts.tex +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{article} -\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} -\newcommand\astsLua[1]{% - \directlua{ - ret = "" - for i=1,#1 do - ret = ret .. "*" - end - tex.print("\noexpand\\def\noexpand\\asts{"..ret.."}") - } -} - -\begin{document} - \astsLua{10000} -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/mandel.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/mandel.pdf Binary files differdeleted file mode 100644 index f604a37d4a6..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/mandel.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/mandel.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/mandel.tex deleted file mode 100644 index 2efa5d0ec7e..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/mandel.tex +++ /dev/null @@ -1,58 +0,0 @@ -\documentclass{article} -\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} -%% draw macros -\newcount\mlength -\mlength0 -\newcount\cstate -\newdimen\mandelunit -\mandelunit=0.5pt - - -\def\wp{% - \ifnum\cstate=1 \global\advance\mlength1 - \else\ifnum\cstate=-1 \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi\fi - \global\cstate1} -\def\bp{% - \ifnum\cstate=-1 \global\advance\mlength1 - \else\ifnum\cstate=1 \hspace*{\mlength\mandelunit}\global\mlength1 \fi\fi - \global\cstate-1} -\def\r{% - \ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi - \global\cstate0 \global\mlength0} - - -\begin{document} - \thispagestyle{empty}\noindent - \leavevmode\baselineskip=\mandelunit - \directlua{ - maxloop=20 - scale=0.002 - function isMandel(a,b) - x=0 - y=0 - xx=0 - yy=0 - for k=0,maxloop do - xx=x*x - yy=y*y - if (xx + yy) > 4.0 then - return false - else - y=2*x*y+b - x=xx-yy+a - end - end - return true - end - for b=1.0,-1.0,-scale do - for a=-1.5,0.5,scale do - if isMandel(a,b) then - tex.print("\noexpand\\bp") - else - tex.print("\noexpand\\wp") - end - end - tex.print("\noexpand\\r\noexpand\\\noexpand\\") - end - } -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/tarai.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/tarai.pdf Binary files differdeleted file mode 100644 index a4c5ddd3f0f..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/tarai.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/tarai.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/tarai.tex deleted file mode 100644 index e4a51f711ee..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/luatex/tarai.tex +++ /dev/null @@ -1,14 +0,0 @@ -\documentclass{article} -\directlua{ - function tarai(x,y,z) - if(x<=y) then - return y - else - return tarai(tarai(x-1, y, z), tarai(y-1, z, x), tarai(z-1, x, y)) - end - end -} -\newcommand\tarai[3]{\directlua{tex.print(tarai(#1, #2, #3))}} -\begin{document} -$\mathrm{Tarai}(14,10,6) = \tarai{14}{10}{6}$ -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/ast.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/ast.pdf Binary files differdeleted file mode 100644 index d36057e5eb5..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/ast.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/ast.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/ast.tex deleted file mode 100644 index 5b0aebdf708..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/ast.tex +++ /dev/null @@ -1,7 +0,0 @@ -\documentclass{article} -\usepackage{perltex} -\newcommand{\asts}{} -\perlnewcommand{\astsperl}[1]{'\renewcommand{\asts}{'. '*' x $_[0] . '}'} -\begin{document} - \astsperl{10000}\asts -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/mandel.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/mandel.pdf Binary files differdeleted file mode 100644 index c4713aa121a..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/mandel.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/mandel.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/mandel.tex deleted file mode 100644 index f197297135e..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/mandel.tex +++ /dev/null @@ -1,64 +0,0 @@ -\documentclass{article} -\usepackage[pdftex,a3paper,margin=1pt,landscape]{geometry} -\usepackage{perltex} -\newcount\mlength -\newcount\cstate -\newdimen\mandelunit -\mandelunit=0.5pt - -\def\w{% - \ifnum\cstate=1 \global\advance\mlength1 - \else\ifnum\cstate=-1 \vrule width \mlength\mandelunit height \mandelunit depth 0pt \global\mlength1 \fi\fi - \global\cstate1} -\def\b{% - \ifnum\cstate=-1 \global\advance\mlength1 - \else\ifnum\cstate=1 \hspace*{\mlength\mandelunit}\global\mlength1 \fi\fi - \global\cstate-1} -\def\r{% - \ifnum\cstate=1\hspace*{\mlength\mandelunit}\else\vrule width \mlength\mandelunit height \mandelunit depth 0pt \fi - \global\cstate0 \global\mlength0} - -\perlnewcommand{\isMandel}[2]{ - my $maxloop=20; - my $x = 0; - my $y = 0; - my $xx = 0; - my $yy = 0; - for(my $k=0; $k<=$maxloop; $k++){ - $xx = $x ** 2; - $yy = $y ** 2; - if($xx + $yy > 4.0) { return 0; } - $y = 2*$x*$y + $_[1]; - $x = $xx - $yy + $_[0]; - } - return 1; -} -\perlnewcommand{\loopMandel}{ - my $scale=0.002; - my $ret = ""; - for(my $b=1.0; $b >=-1.0; $b-=$scale){ - $ret = $ret . "\\loopMandelInner{" . $b . "}\\r\\\\"; - } - return $ret; -} -\perlnewcommand{\loopMandelInner}[1]{ - my $scale=0.002; - my $ret = ""; - my $b = $_[0]; - for(my $a=-1.5; $a<=0.5; $a+=$scale){ - if(latex_isMandel($a, $b)){ - $ret .= "\\b"; - } else { - $ret .= "\\w"; - } - } - return $ret; -} - - -\begin{document} - \thispagestyle{empty} - \noindent - \leavevmode\baselineskip=\mandelunit - \loopMandel -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.pdf b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.pdf Binary files differdeleted file mode 100644 index 22b8504926e..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex deleted file mode 100644 index 7ee739bbb9d..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/bench/perltex/tarai.tex +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{article} -\usepackage{perltex} -\perlnewcommand{\tarai}[3]{ - if($_[0] <= $_[1]){ - return $_[1]; - } else { - return latex_tarai( - latex_tarai($_[0]-1, $_[1], $_[2]), - latex_tarai($_[1]-1, $_[2], $_[0]), - latex_tarai($_[2]-1, $_[0], $_[1])); - } -} -\begin{document} - $\mathrm{Tarai}(14,10,6) = \tarai{14}{10}{6}$ -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/slide.tex b/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/slide.tex deleted file mode 100644 index 5a46c31348e..00000000000 --- a/Master/texmf-dist/doc/latex/lisp-on-tex/tug2013/slide.tex +++ /dev/null @@ -1,213 +0,0 @@ -\documentclass[pdftex,10pt,c,compress]{beamer} -%Settings for LaTeX beamer -\usetheme{Berkeley} -\usecolortheme{orchid} -\setbeamertemplate{navigation symbols}{} - -%Font Info -\usepackage[T1]{fontenc} -\renewcommand{\sfdefault}{phv} -\renewcommand{\ttdefault}{pcr} -% Font Info(pLaTeX only) -%\renewcommand{\kanjifamilydefault}{\gtdefault} - -%packages -\usepackage{url} -\usepackage{lisp-on-tex} - -%colors -\definecolor{orderzero}{HTML}{04BBFF} -\definecolor{orderi}{HTML}{03A8E5} -\definecolor{orderii}{HTML}{038CBF} -\definecolor{orderiii}{HTML}{025E7F} -\definecolor{orderover}{HTML}{012F40} - -\lispinterp{ - (\define \fact (\lambda (\n) - (\lispif (\= \n :0) :1 - (\* (\fact (\- \n :1)) \n)))) -} - -%Document Info -\title{LISP on \TeX} -\subtitle{A LISP Interpreter Written Using \TeX{} Macros} -\author[S. HAKUTA]{HAKUTA Shizuya} -\date[TUG2013]{The 34th Annual Meeting of the TeX Users Group, 2013} - -\begin{document} - \frame{\titlepage} - - \section{Introduction} - - \begin{frame}{Background} - \begin{itemize} - \item Writing \TeX{} macros is useful. - \begin{itemize} - \item e.g. Calculating some small numeric expressions. - \end{itemize} - \item However, it is difficult for novice users. - \vspace{1cm} - \item To improve, there are some researches that combine - \TeX{} and another programming language. - \end{itemize} - \end{frame} - - \begin{frame}{\TeX{} with Other Languages} - Pakin[TUGboat '03] showed four way to connect \TeX{} - and a foreign programing language; - \begin{enumerate} - \item using \texttt{\string\write18} to call an outer processor, - \begin{itemize} - \item python package (CTAN:macros/latex/contrib/python) - \end{itemize} - \item embedding an interpreter in a \TeX{} engine, - \begin{itemize} - \item Lua\TeX{} (CTAN:systems/luatex) - \end{itemize} - \item constructing macros that enable \LaTeX{} to communicate - with an external interpreter, - \begin{itemize} - \item Perl\TeX{} (CTAN:macros/latex/conrtib/perltex) - \end{itemize} - \item creating a language processor with \TeX{} macros - \begin{itemize} - \item \LaTeX3 project created expl3: a new interface of \TeX{} macros, - but {\color{red}no ordinary language was implemented}. - \end{itemize} - \end{enumerate} - \end{frame} - - \section{Goal and Mean} - \begin{frame}{The Goal and the Mean} - Our goals are - \begin{itemize} - \item Implementing a language's interpreter with \TeX{} macros, and - \item Comparing its performance with other approaches. - \end{itemize} - \vspace{0.5cm} - We take two design choices; - \begin{enumerate} - \item Choosing LISP as a ordinary language, and - \item Creating the product as a LaTeX package. - \end{enumerate} - \end{frame} - - \section{LISP on TeX} - \begin{frame}{LISP on \TeX} - We name the our product {\color{red} LISP on \TeX{}}. - \begin{itemize} - \item It was already archived on CTAN and \TeX Live. - \begin{itemize} - \item \url{macros/latex/contrib/lisp-on-tex} - \end{itemize} - \item We constructed all parts of LISP on \TeX{} with \TeX{} macros; - \begin{itemize} - \item parser, recognizing LISP expressions, - \item evaluator, calculating a expression, and - \item environment, mapping symbols to LISP objects. - \end{itemize} - \item The code is written with traditional TeX macros only, - so it works in all \LaTeX{} engines, - \begin{itemize} - \item \LaTeX, pdf\LaTeX, Lua\LaTeX, Xe\LaTeX, p\LaTeX, \dots - \end{itemize} - \end{itemize} - \end{frame} - - - \begin{frame}[t, fragile]{Examples (1/2)} - \structure{Source} - \begin{footnotesize} - \begin{block}{The Preamble of the Slides}\vspace{-\baselineskip} -\begin{semiverbatim} -\\usepackage\{lisp-on-tex\} - -\\lispinterp\{ - (\\define \\fact - (\\lambda (\\n) - (\\lispif (\\= \\n :0) :1 - (\\* (\\fact (\\- \\n :1)) \\n))))\} -\end{semiverbatim}\vspace{-\baselineskip} - \end{block} - \end{footnotesize} - \structure{Result}\mbox{}\\ - \strut\alt<2->{$10!=\lispinterp{(\texprint (\fact :10))}$}% - {\footnotesize - \texttt{\$10!=\string\lispinterp\{(\string\texprint (\string - \fact :10))\}\$}} - \begin{center}\color{red}\Large - \onslide<3->{LISP codes were evaluated!} - \end{center} -\end{frame} - - \begin{frame}{Examples (2/2)} - \begin{center} - \alt<2>{\includegraphics[scale=0.38]{dest_mandel.png}} - {\includegraphics[scale=0.3]{source_mandel.png}} - \end{center} - \end{frame} - - - \begin{frame}{Memory Management Problems} - \begin{itemize} - \item LISP on \TeX{} uses a lot of memory. - \begin{itemize} - \item Yato showed that LISP on \TeX{} stalls - when using a lot of LISP objects\footnote{% - \url{http://d.hatena.ne.jp/zrbabbler/20121116/1353068217} (Japanese Only)}. - \end{itemize} - \item It is caused by spending a lot of control sequences. - \item Building a garbage collection system is one of our future work. - \end{itemize} - \end{frame} - - - \section{Comparison} - \begin{frame}{Comparison to other approaches} - We compared LISP on \TeX{} and other approaches - by three benchmarks. - \begin{itemize} - \item CPU Core i7 2.2GHz, 8GByte Memory, W32TeX - \end{itemize} - \begin{center} - \begin{tabular}{|c||c|c|c|}\hline - & tarai[sec] & asterisks[sec] & Mandelbrot[sec] \\ \hline\hline - LISP on \TeX & 13 & $1.6 \times 10^2$ & $2.1 \times 10^4$\\ \hline - Perl\TeX & 1.0 & 1.0 & $1.6 \times 10^2$ \\ \hline - Lua\TeX & 0.45 & 0.55 & 7.6 \\ \hline - \TeX{} macros & 0.24 & 0.22 & $1.2 \times 10^2$ \\ \hline - expl3 & 1.1 & 1.0 & $5.7 \times 10^3$\\ \hline - \end{tabular} - \end{center} - \begin{itemize} - \item It shows that LISP on \TeX{} is too slow... :-( - \begin{itemize} - \item It is caused by reading \TeX{} tokens repeatedly. - \item[$\Rightarrow$] We can make LISP on \TeX{} faster - with improving the code. - \end{itemize} - \end{itemize} - \end{frame} - - - \section{Conclusion} - \begin{frame}{Conclusion} - \begin{itemize} - \item We implemented LISP on \TeX{}, a LISP interpreter - written only with \TeX{} macros. - \item It works well, but the product has - problems about memory usage and speed. - \end{itemize} - \end{frame} - - \begin{frame}{Why LISP is Selected?} - There are two reasons why we select LISP. - \begin{enumerate} - \item LISP is Turing complete, so it contains all essence of - programming languages. - \item Because LISP has simple syntax and semantics, we can - implement LISP easily. - \end{enumerate} - \end{frame} - -\end{document}
\ No newline at end of file |