from Hacker News

Lambda Operator in LaTeX

by miguelmurca on 10/19/22, 9:31 AM with 22 comments

  • by zauguin on 10/22/22, 8:35 AM

    You don't have to define `\First` and `\Second` since these are predefined as `\@firstoftwo` and `\@secondoftwo`. Also the Unicode bytes are already active so setting their catcode is useless. Also redefining the first octet breaks LaTeX's UTF-8 handling and the else case forms an infinite loop. Changing the catcodes of `(` and `)` means that this command doesn't work in the arguments of other commands and it breaks other uses of `(` and `)` in the argument.

    Instead you could do this as

      \documentclass{article}
      \usepackage{xparse}
    
      \NewDocumentCommand \LambdaCalc {u{.} r()} {%
        [arg:(#1) body:(#2)]
      }
      \DeclareUnicodeCharacter {03BB} {\LambdaCalc}
    
      \begin{document}
    
      λx.(2x)
    
      \end{document}
  • by MayeulC on 10/21/22, 11:17 PM

    A bit disapointing. It's mostly about parsing, not usage.

    Half of the post is about handling UTF-8, which AFAIK both LuaTeX and XeTeX (you really shoulduse either) do natively.

  • by xeonmc on 10/22/22, 4:29 AM

    Combine this with that paper of C compiler written entirely in lambda terms[0], now LaTeX is a compilation platform as well!

    [0] https://news.ycombinator.com/item?id=33115719

  • by c7b on 10/22/22, 10:25 AM

    Sums up the LaTeX experience quite well imho:

    > LaTeX is great for typesetting math.

    Q: Ok, great! So how do I typeset this bit of common math?

    A: a 20-line barrage of import statements, makeatletter's and definitions that you copy-paste into your preamble and cross your fingers that it won't conflict with the half-dozen other barrages that you copied there to do other bits of common math, often hidden between other Google results with wildly different answers.

  • by ngcc_hk on 10/22/22, 5:35 AM

    Is it possible to do something like Jupiter notebook like so you can demonstrate some (commonn lisp) and then show their result. Like Notebook support some tex.

    Too much to ask for I guess. Continue waiting.

  • by titzer on 10/22/22, 1:34 AM

    Having spent most of the day stepping on LaTeX rakes, I am really at a loss how anyone could think that making it more programmable would think that's a good idea.

    There are very few bits of software that are more arcane and broken by default than this absolute crapstraction of a platform.

  • by b215826 on 10/21/22, 11:53 PM

    "Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should."