Stumbled across Janet, a functional programming language that clocks in at 1MB

Janet

Awesome Janet

Humorous Janet Book

Posted in: s/programming

๐Ÿ€ gritty

2025-01-17 ยท 1 year ago ยท ๐Ÿ‘ darkghost, argenkiwi

12 Comments โ†“

๐Ÿ‘ป darkghost ยท 2025-01-17 at 00:41:

I've learned more about programming from this BBS than I did from a year of computer science. I should make my own scripting language. I could call it ghostscript or something. (this is a joke for all of you about to jump in.)

๐Ÿš€ stack ยท 2025-01-17 at 02:39:

Yes, it's a Lisp!

I remember being excited and later disappointed, but not why...

๐Ÿ undefined ยท 2025-01-17 at 03:55:

@darkghost do it!

๐Ÿ€ gritty [OP] ยท 2025-01-17 at 17:10:

@stack looks like it compiles to C. I was looking at lisp. kind of deciding between this and common lisp.

๐Ÿ€ gritty [OP] ยท 2025-01-17 at 17:16:

this guidebook is hilarious

โ€” https://janet.guide/values-and-references/

๐Ÿš€ stack ยท 2025-01-17 at 22:02:

common lisp, definitely! It's a proven (30+ years since standardization), pragmatic language with every imaginable feature -- other languages are slowly adopting things from CL.

I wouldn't use it for CGI scripts, as binaries are huge, but for servers and things that run for a while, a big yes!

Once you know CL, you can do anything.

๐Ÿ€ gritty [OP] ยท 2025-01-18 at 02:20:

good to know, thanks! any lisp based languages you can suggest for cgi?

๐Ÿš€ stack ยท 2025-01-18 at 02:35:

I generally just use C for CGI, precomputing most of the game logic ahead of time when possible...

ECL and GCL for common lisp. If you want scheme (I do not like it personally), Chicken or Gambit is a good choice.

Janet may be a good choice. But it is some flavor of lisp.

๐Ÿš€ stack ยท 2025-01-18 at 02:41:

Earlier I was misleadingly talking about my goto SBCL lisp which is super fast and great, but make a standalone executable you basically dump the memory image to a 100MB file.

ECL and GCL generate smallish executables and interoperate with C. ECL can even be embedded into a C application as a scripting language.

๐Ÿš€ stack ยท 2025-01-18 at 02:58:

Internally, Janet uses arrays to represent code, rather than the traditional lisp way of using linked lists.

Because of that, you cannot use normal lisp list operations to operate on code, which makes it a lisp with awful macro capabilities, even worse than Scheme.

You sort of can use array operations, but dealing with subscripts makes it impossible to create beutifly simple recursive macros of CL.

To me, the raison d'etre of Lisp is being able to manipulate code easily, or in other words, macros. Common Lisp is the only Lisp variant that does not screw it (or anything else) up, as evidenced by its specification remaining unchanged in 40 years.

If you ever wonder why Lisp looks the way it does, it is to enable macros.

๐ŸŽต hedy ยท 2025-01-19 at 09:16:

janet is cool, but my lisp of choice these days is usually fennel. it's a lisp that compiles to lua. I'm familiar with lua, and anything I can do with lua can be done in fennel. there is great tooling support for emacs and it's a joy to use.

๐Ÿš€ stack ยท 2025-01-19 at 18:07:

Funny, I was just admiring Lua from a distance yesterday, having almost never used it