{"by":"kserrec","descendants":7,"id":49699477,"kids":[49738235,49734039,49736714],"score":49,"text":"I made a programming language!<p>I call it AttaLambda.<p>The idea is this: a usable Lisp-shaped language where all the meaningful computation is done in untyped lambda calculus. Logic, arithmetic, data structures, control flow, even the types — all untyped lambdas. A small, explicit Racket layer sits at the boundary to handle the outside world, plus some macros for syntactic sugar.<p>This is its story:<p>A couple years ago, I wanted to play with untyped lambda calculus and go beyond where tutorials usually stop. They show booleans, numbers, arithmetic, maybe the Y-combinator — and then stop. I wanted them to keep going.<p>So I started a project called All The Lambdas. Using Racket set to lazy, I used only one Racket construct for actual computation — lambda — and built integers, rationals, lists, binary digit-list number encodings, search algorithms, and more.<p>Then I found Functional Programming Through Lambda Calculus by Greg Michaelson. In it, Michaelson sketches the bones of a language built in untyped lambda calculus, including a type system where typed objects are themselves pair functions containing a type tag and value.<p>I found that intriguing and implemented and extended the idea, still entirely with untyped lambdas. I don&#x27;t have a background in programming language theory, so I was figuring it out as I went.<p>Then I stopped tinkering with it for a while.<p>Recently I came back and thought: why not turn this into a real usable language with the help of coding agents? I reused most of All The Lambdas as the foundation.<p>Thus AttaLambda was born.<p>Some additional details:<p>* Rat, its number type, uses binary digit-list encodings instead of Church numerals, so numbers scale with their number of binary digits rather than their value<p>* errors are lambda-encoded values, not Racket exceptions, and propagate through the language like ordinary data<p>* the Racket host only performs irreducibly external operations; even things like HTTP parsing, routing, and response construction stay in the pure lambda world<p>* recursion uses lambda-calculus recursion: no loops or true self-reference, just the Y-combinator underneath<p>* automated purity checks catch accidental cheating, like native computation leaking into the pure parts<p>* syntax like multi-argument lambdas, let, cond, and list is just macro sugar that reduces to unary lambdas and application<p>A couple code examples:\n(short of print, every single thing here reduces to unary untyped lambdas)<p>Factorial:<p><pre><code>  #lang attalambda\n\n  (rec factorial n =\n    (cond\n      ((eq n 0) 1)\n      (else (mult n (factorial (sub n 1))))))\n\n  (print (factorial 10))\n</code></pre>\nWhich prints:<p><pre><code>  3628800\n\n</code></pre>\nOr an exact harmonic sum:<p><pre><code>  #lang attalambda\n\n  (print\n    (reduce add 0\n      (map (lambda (n)\n             (unwrap-ok (div 1 n)))\n           (range 1 8))))\n</code></pre>\nWhich prints exactly:<p><pre><code>  363&#x2F;140\n</code></pre>\nAs far as I know, no programming language combines all these features: Michaelson-style type tags built from untyped lambdas, exact rationals backed by binary digit lists, errors as lambda values, and real-world programs where almost all computation stays inside the lambda core. None of those pieces are individually new, but I don&#x27;t know of another language combining them this way.<p>Download:\n<a href=\"https:&#x2F;&#x2F;github.com&#x2F;kserrec&#x2F;attalambda&#x2F;releases&#x2F;tag&#x2F;v0.7.0\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;kserrec&#x2F;attalambda&#x2F;releases&#x2F;tag&#x2F;v0.7.0</a><p>Code:\n<a href=\"https:&#x2F;&#x2F;github.com&#x2F;kserrec&#x2F;attalambda\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;kserrec&#x2F;attalambda</a><p>Original All The Lambdas:\n<a href=\"https:&#x2F;&#x2F;github.com&#x2F;kserrec&#x2F;all_the_lambdas\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;kserrec&#x2F;all_the_lambdas</a>","time":1789402870,"title":"Show HN: AttaLambda: a language where types and data are made of untyped lambdas","type":"story","url":"https://attalambda.com"}