-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNOTES
More file actions
27 lines (17 loc) · 681 Bytes
/
NOTES
File metadata and controls
27 lines (17 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
* About exposing Haskell macros as LaTeX ones
Here are some half-backed ideas
newcommand nargs name body = latexCmd "newcommand" name [optional nargs, mandatory (body $ map (('#':).show) [1..nargs-1])]
newcommand2 name body = newcommand name (\[x,y] -> body x y)
-- library example: exposing replicate
rep :: Int -> LatexItem -> LatexItem
rep x y = mconcat (replicate x y)
latexToInt :: LatexItem -> Int
latexToInt (LatexLength ...)
rep' :: LatexItem -> LatexItem -> LatexItem
rep' x y = mconcat (replicate (latexToInt x) y)
librep = newcommand2 "rep" rep ...
-- library example
lam x t = "λ"⊕x⊕". "⊕t
app t u = ...
var x = ...
lib = newcommand2 "lam" lam ⊕ ...