3 ms·
Hi @sillysaurus3, I'll bite. Lumen looks interesting and I dug up some HN comments from over the years. Any example apps or sample code anywhere? What about
by jarpineh 9y ago
Hi @sillysaurus3, I'll bite.
Lumen looks interesting and I dug up some HN comments from over the years.
Any example apps or sample code anywhere?
What about host language access? I'd rather not give up using existing JS and Lua libraries.
I can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser?
Have you used this inside Nginx's Lua module and/or OpenResty?
Why not Python as one target host language? Lists and hashmaps (dictionaries) are pretty prevalent there and I believe continuously developed Lisp dialect is still missing.
Thank you for this. I learned new things already.
- sillysaurus3 9y ago> What about host language access? I'd rather not give up using existing JS and Lua libraries. Easy: $ npm i leftpad $ LUMEN_HOST=node lumen > (require 'leftpad) function > ((require 'leftpad) "foo" 10) "0000000foo" > I can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser? Yes, the entire codebase is only 3k lines. You can use browserify, or simply concatenate all the JS files together. Lumen is unopinionated. I've done this before, and I'm more than happy to set you up with a copy-pastable solution if you want. > Have you used this inside Nginx's Lua module and/or OpenResty? No, but there's no reason it wouldn't work. Here's an example of it working in a WASM Lua implementation: https://news.ycombinator.com/item?id=13900453 https://news.ycombinator.com/item?id=13900453 > Why not Python as one target host language? Lists and hashmaps (dictionaries) are pretty prevalent there and I believe continuously developed Lisp dialect is still missing. I've spent time on this! It's a difficult problem. In Lua and JS, you can attach keys and values to arrays. In other words, an array can also be a hashmap. Not so in Python -- or rather, not with the standard Python dict() type. And then you run into problems of interoperability and performance: if it's a non-standard type, other libraries run into problems consuming it. This is less true of Python than other languages, though, so I've been trying to find a happy medium. There are ways of using solely arrays, but it involves having some sort of Keyword type. A normal lisp has those, and typically they use '(a b :x 42) to create an "array" where the first two elements are "a" and "b" and the key "x" has value 42. You can do something similar for Python, and it's an active area of research for me. > Any example apps or sample code anywhere? This is Lumen's strength and weakness. Very few people know about Lumen because of a lack of examples and documentation. However, it's incredibly cool and quite mysterious, and I like that it has a very small following. It makes changing the language much easier. Here's an extensive example: https://github.com/sctb/motor https://github.com/sctb/motor Note that it won't run on the latest Lumen, because dot syntax was recently removed. You'll need to revert to commit `c146de`. But you see how easy it is to morph the language into whatever shape you want, and how powerful it can be.
- jarpineh 9y ago>> What about host language access? I'd rather not give up using existing JS and Lua libraries. >Easy: $ npm i leftpad $ LUMEN_HOST=node lumen > (require 'leftpad) function > ((require 'leftpad) "foo" 10) "0000000foo" Huh. It just worked. With rlwrap this feels (at least at the very first try) regular REPL! >> I can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser? > Yes, the entire codebase is only 3k lines. You can use browserify, or simply concatenate all the JS files together. Lumen is unopinionated. Amazing. That sounds very compact to me. I'd imagine today's JS build systems can do optimized builds without too much trouble. Also, by that count it should be an afternoon's read to get it. > I've done this before, and I'm more than happy to set you up with a copy-pastable solution if you want. My answer in your other comment. >> Have you used this inside Nginx's Lua module and/or OpenResty? > No, but there's no reason it wouldn't work. Here's an example of it working in a WASM Lua implementation: https://news.ycombinator.com/item?id=13900453 https://news.ycombinator.com/item?id=13900453 Ok, must do some testing. I have nothing against Lua, but having a Lisp within Nginx/OpenResty just seems more fun. >> Why not Python as one target host language? Lists and hashmaps (dictionaries) are pretty prevalent there and I believe continuously developed Lisp dialect is still missing. > I've spent time on this! It's a difficult problem. In Lua and JS, you can attach keys and values to arrays. In other words, an array can also be a hashmap. Not so in Python -- or rather, not with the standard Python dict() type. And then you run into problems of interoperability and performance: if it's a non-standard type, other libraries run into problems consuming it. This is less true of Python than other languages, though, so I've been trying to find a happy medium. > There are ways of using solely arrays, but it involves having some sort of Keyword type. A normal lisp has those, and typically they use '(a b :x 42) to create an "array" where the first two elements are "a" and "b" and the key "x" has value 42. You can do something similar for Python, and it's an active area of research for me. Yeah, I realize there's all sorts of pitfalls. I thought about 3.6 having by default ordered dicts could make things easier. But probably not. Perhaps if I'd do array indexed access in Python with a helper method "transpiled" where necessary. In my own code I could keep from using other, harder to support Pythonisms. >> Any example apps or sample code anywhere? > This is Lumen's strength and weakness. Very few people know about Lumen because of a lack of examples and documentation. However, it's incredibly cool and quite mysterious, and I like that it has a very small following. It makes changing the language much easier. > Here's an extensive example: https://github.com/sctb/motor https://github.com/sctb/motor > Note that it won't run on the latest Lumen, because dot syntax was recently removed. You'll need to revert to commit `c146de`. But you see how easy it is to morph the language into whatever shape you want, and how powerful it can be. I'll check it out, thank you. And thank you for this!
- sillysaurus3 9y agoI can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser? Here's a version of Lumen you can copy-paste directly into your browser console: https://gist.github.com/anonymous/c8e26607668dd6240f606fc2d03f0c3b https://gist.github.com/anonymous/c8e26607668dd6240f606fc2d0... That's not too convenient, but it's easy to create a wrapper around these building blocks. If you have any other questions at all, please don't hesitate to ask. I love talking about this stuff.
- jarpineh 9y ago>> I can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser? > Here's a version of Lumen you can copy-paste directly into your browser console: > https://gist.github.com/anonymous/c8e26607668dd6240f606fc2d0.. https://gist.github.com/anonymous/c8e26607668dd6240f606fc2d0.... > That's not too convenient, but it's easy to create a wrapper around these building blocks. I got Lumen evaluation going on page load with this and it was surprisingly easy! >If you have any other questions at all, please don't hesitate to ask. I love talking about this stuff. It very late here, have to try and get some shut eye. I'll be playing with Lumen more now that I got over the first step, thanks to you. I'll be checking this thread and Lumen's repo soonish, I hope.
- sillysaurus3 9y agoSure thing. G'night!
- sillysaurus3 9y agoAlso if you shoot me an email, we can chat more easily.