Janet is awesome but pretty please, work on the tooling. There's very little in the way of working and debugging interactively with the REPL from any IDE that I know of and last time I tried (on Emacs) there was barely a dedicated mode to work with it.
NeutralForest · 25m ago
Since other people mentioned there's been work there, here is my Emacs config now:
(use-package janet-ts-mode
:ensure t
:defer t
:vc (:url "https://github.com/sogaiu/janet-ts-mode"
:rev :newest))
(use-package ajrepl
:ensure t
:defer t
:vc (:url "https://github.com/sogaiu/ajrepl"
:rev :newest)
:hook (janet-ts-mode . ajrepl-interaction-mode))
Also, a fix for treesit auto to not ask for the grammar every time:
I use janet ts mode in emacs and Ajsc netrepl integration, for at least a while now.
You should try again.
NeutralForest · 2h ago
I've been trying to use ajrepl but as mentioned in the README, there's a lot of cruft that gets output. How do you setup ajsc?
zelphirkalt · 56m ago
When I see languages like this, I always wonder, how far the ecosystem is. I have used GNU Guile a lot and there are quite a few libraries for it, so that one can do almost anything. Web things are coming, but maybe not as fully there yet, as one might like. Racket also has lots of libraries. And even a standard library web framework.
So lets say I want to start my next web project in Janet. I already know Scheme and can probably quite easily just start writing another lisp, assuming it has TCO and I can do things mostly like I would in Scheme, except maybe for having to use funcall (which is annoying, but OK). Does Janet have libraries, that enable web projects? Like a web server and SXML or something like that? Or does it have things like a JSON parser? All these little things one would like to have, to not have to develop the basics first, before getting to the actual project.
And what about data structures? Are there functional data structures available? In GNU Guile I have at least the unmaintained guile-pfds. Hopefully, I will one day understand enough about functional data structures to build more or to maybe even maintain that library. But learning resources are scarce. It is already difficult to find a functional version of an AVL tree! Lots and lots of places merely teach non-persistent, non-functional versions of these data structures, and it is not trivial to translate them, might impact performance in ways that are not necessary, if one had great knowledge about how to make these data structures.
And also reproducibility! With GNU Guile I have what I need on Guix, which is great! With other languages, I might need to rely on older package managing approaches, that do not have reproducibility/determinism as the a high goal on their agenda, or might even lack the ability to create lock files/files with checksums. I don't want to go back to non-reproducible.
I am also eyeing statically typed variants like Carp. Same questions arise. Some seem really great and I would probably enjoy using them a lot. Would be a pity to then discover, that the ecosystem is just not there, and one has to create all the basic tools one needs oneself. Sometimes that can be fun, but it can also be exhausting and one never gets around to ones actual project.
bjoli · 6h ago
Is there anything that is janet-unique? I just did a cursory glance, and most of it seems like a scheme with slightly different syntax and a more "modern" standard library.
Why should I switch from my scheme of choice (guile) to Janet?
veqq · 6h ago
It's not a Scheme at all! It doesn't have cons cells after all. It's a Clojure-like (maps everywhere, collection api, immutable data structures) with 1mb executable and [servers](http://janetdocs.org/) running under 10mb of ram.
Fibers are very interesting, even used for error handling. I've not wrapped my head around PEGs yet.
bjoli · 4h ago
That makes sense. I have always thought about what I would do if I could make a "modern scheme". A lot would be taken from clojure but definitely not everything. Cons cells would stay, but the star of the show would be immutable vectors based on rrb trees or maybe finger trees (efficient concatenation, insertion in the middle etc), HAMTs , concurrentML (like guile-fibers) and a nice looping facility (like my own goof-loop[1]) and restricted mutation. Syntax-case and syntax-parse from racket. An extensible pattern matcher (like the one found in racket).
I would also make strings immutable, maybe like Guile's cow-strings, maybe blobs-with-cursors.
Definitely just copy Guile's delimited continuations.
I think I would just ignore most of r7rs, since I don't think it improves things for the progrmmer.
girvo · 3h ago
PEGs (even outside Janet) are amazing and what I reach for all the time :) definitely one of those tools that’s worth learning!
natrys · 2h ago
Yep peg.el[1] is now built-into Emacs since 30.1 (which is how I came to know of it, but actually the library seems much older) and it makes certain things much simpler and faster to do than before (once you figure out its quirks).
If a language lacks cons can it truly be held to be a lisp or has heresy taken over?
exe34 · 4h ago
It's got Lots of Indented Silly Parentheses.
worthless-trash · 5h ago
Thank you for janetdocs.org , I hated having the missing functions from janetdocs.com
3036e4 · 4h ago
I did most of the 2023 Advent of Code using Janet and it was a great experience. I forced myself to use PEGs as much as possible, even when it was overkill, and I really began to like those for the readability and ease compared to other parsers/regexps that I have used.
I like that it is a small language without dependencies. Have it installed everywhere, including in termux on my phone. Good for scripting.
Used to daydream about a native Clojure and Janet is close enough to that. Does not have everything, but the cost in size and dependencies is so much lower. It is simpler and easier and runs well even on a RPi Zero.
asQuirreL · 4h ago
I would tend to use Janet for scripts, especially ones that need to talk to the outside world because of its fast startup and batteries included standard library (particularly for messing with JSON, making HTTPS requests, parsing with PEGs, storing data in maps), while I would use guile for larger projects where things like modularity, performance, or metaprogramming were more important to me.
That being said, these days I use Clojure for both (I use babashka to run scripts: https://babashka.org/)
xigoi · 2h ago
One thing I really like about Janet, compared to Scheme, is that it’s one language instead of a family of similar but incompatible languages.
terminalbraid · 3h ago
One big difference is you can compile Janet programs down to executables without any additional dependencies or runtimes. It makes distribution extremely nice. The ffi is also much easier.
worthless-trash · 5h ago
I don't know enough about guile, but janet was pretty easy to develop for .
Its binaries are quite small, could wrap and embed raylib and a few small c libraries with no hassle. This makes distribution much easier.
For my simple 2d game jaylib (raylib) code.
ls -laoh build/app
-rwxr-xr-x 1 worthless 2.8M 27 Jul 17:28 build/app
otool -L ./build/app
./build/app:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1356.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 24.0.0)
/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 706.41.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2674.3.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 4034.0.0)
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1951.0.4)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 4034.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
I believe those are pretty standard to have on most OSX machines, the situation is similar for my Linux system.
The LLM's really can't deal with janet though, they seem to think its clojure and screw up a lot of things.
johnisgood · 1h ago
Feed your LLMs the documentation and example code (perhaps the whole stdlib if it fits). Tell your LLM that it is not Clojure nor Scheme, it is a different language. I have worked with more niche languages than Janet with Claude before this way, successfully.
atemerev · 3h ago
If you are happy with Guile, I guess Janet is not worth switching (it is faster, though). It is absolutely and explicitly not Scheme, though. More like natively compiled and script-optimized Clojure.
dmpk2k · 3h ago
Does it have a native compiler and/or types? Basically, can it get in the ballpark of SBCL's performance?
It'd be nice to have something cleaner than Common Lisp, and a much smaller image size. If it has decent performance too, I'm sold.
ethan_smith · 2h ago
Janet uses a bytecode VM that's faster than many dynamic languages but won't match SBCL's native compilation performance; it has optional type annotations for documentation but not for optimization.
terminalbraid · 2h ago
Janet does compile to standalone executables with jpm
atemerev · 3h ago
This is not a replacement for Common Lisp. It is in the same niche as Guile (but quite faster).
terminalbraid · 1h ago
Yeah, I see Janet as "what Guile intended itself to be", though it is quite a bit smaller (in some ways that's a postive). I find the choices it made to be more pragmatic and it's far more accessible in non-linux environments since Guile tied itself closely to guix.
It is unfortunate that there doesn't seem to be a GUI library --- if there was one _and_ if one could easily compile to a stand-alone program for distribution, this would be very interesting to me.
For bonus points, compiling to a stand-alone JavaScript wrapped in HTML would be awesome if it could be hosted on a Github page.
3036e4 · 45m ago
For a GUI in a limited sense you can use TIC-80 with its built-in Janet support. It can export to stand-alone binaries too, but I did not try that (and I mostly used TIC-80 with Fennel, not Janet).
Obviously I understand most of the time someone wants to make a GUI they are not thinking about something like TIC-80. I agree a more complete GUI library would be nice.
But if nothing else it may be worth mentioning that TIC-80 is a fun and easy way to install and try Janet. Even the Android version comes with Janet and a built-in code editor. Just run "new janet" in the TIC-80 console and then press F1 (on Android TIC-80 by default uses its own virtual keyboard that has all the keys it needs) to open the code editor.
3036e4 · 27m ago
Problem with the Android version is how ... to access the files it saves (or exports to). They seem to end up in the app-specific data directory that no other app can read on newer versions of Android.
terminalbraid · 1h ago
Given your criterion for what a "fortunate" language would be, what language includes a GUI library, compiles to a stand-alone program for distribution, as well as "Javascript wrapped in HTML"?
WillAdams · 18m ago
It doesn't exist as an opensource option anymore (since Livecode did their rugpull) AFAICT, it's something I've been looking for since then.
Similarly, they were supposed to offer "compile to HTML5", but it never really worked for me.
terminalbraid · 2m ago
Just so I'm clear, you then openly and publicly label every literally programming language as "unfortunate" because it doesn't live up to what LiveCode aspired to be but didn't itself meet?
According to [1], "the 3SUM problem asks if a given set of n real numbers contains three elements that sum to zero."
It's not clear to me what problem the Janet code solves but it's clearly not that 3SUM problem.
On the example input of
it outputs For what it's worth, here's some Common Lisp code that does solve the 3SUM problem in O(n^2). [1] https://en.wikipedia.org/wiki/3SUMhttps://news.ycombinator.com/item?id=23164614
https://news.ycombinator.com/item?id=34843306
https://news.ycombinator.com/item?id=28255116
https://news.ycombinator.com/item?id=28850861
https://github.com/Olical/conjure
The LSP for it works reasonably well.
You should try again.
So lets say I want to start my next web project in Janet. I already know Scheme and can probably quite easily just start writing another lisp, assuming it has TCO and I can do things mostly like I would in Scheme, except maybe for having to use funcall (which is annoying, but OK). Does Janet have libraries, that enable web projects? Like a web server and SXML or something like that? Or does it have things like a JSON parser? All these little things one would like to have, to not have to develop the basics first, before getting to the actual project.
And what about data structures? Are there functional data structures available? In GNU Guile I have at least the unmaintained guile-pfds. Hopefully, I will one day understand enough about functional data structures to build more or to maybe even maintain that library. But learning resources are scarce. It is already difficult to find a functional version of an AVL tree! Lots and lots of places merely teach non-persistent, non-functional versions of these data structures, and it is not trivial to translate them, might impact performance in ways that are not necessary, if one had great knowledge about how to make these data structures.
And also reproducibility! With GNU Guile I have what I need on Guix, which is great! With other languages, I might need to rely on older package managing approaches, that do not have reproducibility/determinism as the a high goal on their agenda, or might even lack the ability to create lock files/files with checksums. I don't want to go back to non-reproducible.
I am also eyeing statically typed variants like Carp. Same questions arise. Some seem really great and I would probably enjoy using them a lot. Would be a pity to then discover, that the ecosystem is just not there, and one has to create all the basic tools one needs oneself. Sometimes that can be fun, but it can also be exhausting and one never gets around to ones actual project.
Why should I switch from my scheme of choice (guile) to Janet?
Fibers are very interesting, even used for error handling. I've not wrapped my head around PEGs yet.
I would also make strings immutable, maybe like Guile's cow-strings, maybe blobs-with-cursors.
Definitely just copy Guile's delimited continuations.
I think I would just ignore most of r7rs, since I don't think it improves things for the progrmmer.
[1] https://github.com/emacs-mirror/emacs/blob/master/lisp/progm...
I like that it is a small language without dependencies. Have it installed everywhere, including in termux on my phone. Good for scripting.
Used to daydream about a native Clojure and Janet is close enough to that. Does not have everything, but the cost in size and dependencies is so much lower. It is simpler and easier and runs well even on a RPi Zero.
That being said, these days I use Clojure for both (I use babashka to run scripts: https://babashka.org/)
Its binaries are quite small, could wrap and embed raylib and a few small c libraries with no hassle. This makes distribution much easier.
For my simple 2d game jaylib (raylib) code.
I believe those are pretty standard to have on most OSX machines, the situation is similar for my Linux system.The LLM's really can't deal with janet though, they seem to think its clojure and screw up a lot of things.
It'd be nice to have something cleaner than Common Lisp, and a much smaller image size. If it has decent performance too, I'm sold.
https://janet-lang.org/1.9.1/docs/fibers/index.html
For bonus points, compiling to a stand-alone JavaScript wrapped in HTML would be awesome if it could be hosted on a Github page.
Obviously I understand most of the time someone wants to make a GUI they are not thinking about something like TIC-80. I agree a more complete GUI library would be nice.
But if nothing else it may be worth mentioning that TIC-80 is a fun and easy way to install and try Janet. Even the Android version comes with Janet and a built-in code editor. Just run "new janet" in the TIC-80 console and then press F1 (on Android TIC-80 by default uses its own virtual keyboard that has all the keys it needs) to open the code editor.
Similarly, they were supposed to offer "compile to HTML5", but it never really worked for me.