23 ms·
Why Janet?
- eimrine 3y agoI would like to compare this thing with real Lisps in the terms of abilities. Also I would like to know the correct transcription of the name.
- behnamoh 3y agoI’m on the verge of trying Racket to write my own DSLs. I wonder if Janet is better for this task?
- soulbadguy 3y agohttps://www.jetbrains.com/mps/ https://www.jetbrains.com/mps/
- ianthehenry 3y agoDepending on what you're doing, Janet might be a great fit! I wrote a DSL for [expressing and shading 3D shapes](https://bauble.studio https://bauble.studio), and it was pretty easy. Depending on exactly what you're trying to do, the ease of embedding the Janet interpreter inside of other programs might be a big point in its favor.
- behnamoh 3y agoEnjoyed reading the post! I think the difference between Racket and Janet DSLs is that with Racket, you can avoid using s-exp altogether. https://beautifulracket.com/stacker/intro.html https://beautifulracket.com/stacker/intro.html
- ianthehenry 3y agoThis is actually true of Janet as well, although it is not as nicely supported as it is in Racket. You can "bring your own parser," but still leverage the Janet bytecode compiler and runtime. Sort of... an advanced topic, though. The Racket path is much better trodden :)
- behnamoh 3y agoWow good to know! I wish there was an easy way to do it in Janet. It’s a much simpler language compared to Racket. And since it started as someone’s hobby project, I think unlike Racket, it isn’t under much pressure from academia. Academic languages tend to be less suitable for production (Haskell, Racket, Julia, etc.)
- elcritch 3y agoNim's great for writing DSLs as well, plus you can make it statically typed. It ends up being a sort of "yaml-expressions" rather than "s-expressions ". Creating DSLs is quite satisfying in general.
- tmtvl 3y agoI mean, let's be real: if you have SBCL and QuickLisp most newer S-expression based languages don't have much to offer.
- runlaszlorun 3y agoApologies for the question, but to clarify you’re saying that you much prefer the libraries that QuickLisp provides and find Lisp languages lacking. I’m debating whether to dive into Common Lisp for a new project. I’ve been a fan of Lisp for a while, much prefer parentheses over other notation, and have dabbled over the years by doing things like SICP and writing my own toy Lisp. Common Lisp comes across as one heck of a battle-tested language and libraries. But I’m debating how much of a learning curve I’ll have on the front end just getting used to SBCL/Emacs/Slime and the various libraries. And I’m not sure that I “get” the interactive workflow yet but def would love to.
- nvy 3y agoI can't speak for parent but I'm currently writing a one-man SaaS using common lisp on the backend and vanilla js on the frontend, and it's been great so far. SBCL's compiler produces very performant code and I find I can be very productive in lisp. The library ecosystem isn't quite as rich as, say, python's but it's still good. My chief complaint is that if you stray too far off the "happy path" of well-known libraries the quality (or even presence of) the documentation tends to decrease dramatically.
- runlaszlorun 3y agoOh, cool. I’m thinking about something similar with SBCL plus vanilla JS. I’m not worried about libraries and these days try to be a library/framework free as possible. The web dev basics of an application server, access to an RDBMS, and possibly help spitting out HTML/CSS/JS are all I need. And it seems like Common Lisp checks those boxes. I’ll give quicklisp props too as everything I’ve tried to install ran on one go. That’s unfortunately not always my experience elsewhere. Out of curiosity, have you done Lisp before? I’m curious if productivity gains would be lost in me ramping up.
- autumn-antlers 3y agoI find it interesting to compare Janet to Guile Scheme because they both claim to be fit as embed-able scripting languages. Haven't done any practical comparison yet bc Janet has only caught my eye recently (;p), but it appears to have a culture of vendoring and an edge in implementation size and complexity which (ideally) enable diving into the language's implementation to scratch your own itches, learn how it (and the stack in general) work more throughly, and allow eg. low level code optimizations with less FFI boilerplate. I wonder how executable size and performance pan out, but with C FFI available in each language (and the reality of how much time optimization is worth), I feel that comforts matter more. Color me intrigued!
- yellowapple 3y agoI keep meaning to try Janet, and I think this post is the push I needed to actually do so. IIRC my previous hesitation was around multithreading, but apparently that's supported now so I really don't have much of an excuse left.
- rayiner 3y agoThe discursion on macros is interesting reading: https://ianthehenry.com/posts/janet-game/the-problem-with-macros/ https://ianthehenry.com/posts/janet-game/the-problem-with-ma.... But it stops at Scheme’s hygienic macros, which address the very problem raised at the beginning of the discussion, in more or less the way Janet seems to work: https://legacy.cs.indiana.edu/ftp/techreports/TR356.pdf https://legacy.cs.indiana.edu/ftp/techreports/TR356.pdf (page 4). The issue is not so much that macros are not merely syntactic transformations, but rather than s-expressions alone aren’t sufficiently expressive to represent the syntax of any Lisp with a package system. The scheme macro system solves that by having macros return syntax objects where identifiers used in a macro can carry around a reference to the original context where the macro was defined. So referencing a function in a macro definition will look up the function in the context of where the macro is defined, and return a syntax object that refers to the correct function. To my knowledge, most modern macro systems work this way (Scheme, Dylan, etc.)
- JonChesterfield 3y agoKind of. Passing around extra context in order to resolve the symbol in the right environment does fix the problem, but it's hard to argue with unqoting the symbol as the better fix. Embed the function foo in the macro instead of the symbol foo and information on how to turn that symbol into the function later.
- ianthehenry 3y agoI agree that Janet's approach is nicer, but here's an argument against it: if you unquote a function in a macro and then later redefine the function (like, while doing interactive development in the same running process), the macro expansion will still have the "old" definition. Whereas if you look up the function by (lexical context +) name every time you run the code, you'll pick up re-definitions automatically.
- rileyphone 3y agoBasically fexprs
- Yahivin 3y agoOk, the shell scripting DSL has got me interested.
- mintplant 3y ago> I like Janet so much that I wrote an entire book about it, and put it on The Internet for free, in the hopes of attracting more Janetors to the language. Thanks for doing this! Would it be possible to get a copy in EPUB form, so I can read through it on my e-reader?
- ianthehenry 3y agoHmm, maybe? https://janet.guide/janet-for-mortals.epub https://janet.guide/janet-for-mortals.epub That's a super hacky epub that I just generated from the markdown source and have not read over thoroughly. Formatting is a bit different, and code blocks have no labels, which are occasionally significant... but from a quick glance it looks pretty close. Also https://janet.guide/all https://janet.guide/all has the full text of the book, which you could save to HTML and convert to an epub with pandoc (or print to a PDF). Not sure if the results would be better or worse.
- xlii 3y agoThis is second article I read about Janet and by the same author (of course) and I’m really intrigued (especially since I am proficient in ELisp). Yet beyond that, I’m really taken by author’s passion for the language. That’s one great language advocacy at work.
- sakras 3y agoI can really feel the author’s excitement in every sentence. Reading his work is great fun, and really does make me want to use Janet
- eggy 3y agoI agree. I prefer Shen, but Janet has been intriguing me for the past few years. Darn, I'm going to spend the weekend (nights) playing with Janet!
- Graziano_M 3y agoHis writing for janet.guide grated me a bit at first, but the guide was good, and then I found myself laughing along. I already liked Janet, but that guide got me back into it. This guide is just confirmation bias for me, but I'll read it because I (now) like the author.
- Nezteb 3y agoIan’s previous post on the subject for anyone curious: https://news.ycombinator.com/item?id=35386405 https://news.ycombinator.com/item?id=35386405 (12 days ago, 157 comments)
- artemonster 3y agoIt is so hard to read. Tried reading the book too and couldnt get past chapter 2 because of this „conversational“ style that jumps all over the place with irrelevant nonsense. Ian, hire an editor, please :(
- ptato 3y agoYeah... he says you can learn the language in an afternoon, but his book is so long-winded... I just want a short intro so that I can start writing programs.
- asymmetric 3y agoI really like the conversational style. If I wanted the quickest, driest way to get started in Janet, I'd probably go to https://learnxinyminutes.com/docs/janet/ https://learnxinyminutes.com/docs/janet/
- lenkite 3y agoSadly that doesn't features such as modules, fibers, PEGs, macros, etc
- ColonelPhantom 3y agoHow about the official Janet documentation? https://janet-lang.org/docs/index.html https://janet-lang.org/docs/index.html
- andriamanitra 3y agoThe book (which I really like so far, 7 chapters in) is more of a deep dive which covers a lot of the gotchas and intricacies without shying away from the nastier parts of the language. The documentation on the official site should get you going in a couple of hours.
- deleted 3y ago[deleted]
- 3y ago
- larsrc 3y agoJanet! Planet! Schmanet! Somebody had to.
- whydoineedthis 3y agoin case your comments get flagged and removed, i just want you to know someone appreciated your humor. Technically speaking though, humor is not allowed on hacker news, it's litterally in the TOS....and I only know that from many flags of my own.
- larsrc 3y agoWe are not amused! Not but that part of the TOS, which I wasn't aware of. I don't see where it says so, though, except maybe the part of the guidelines that say to "Avoid generic tangents". I do see how it helps keep the contents focused and useful, though. So... Ok, I guess? I'll just have to express my sense of humour as part of something useful, not as the only thing. Thanks for pointing this out.
- xyzabcdcrcts 3y ago[flagged]
- xyzabcdcrcts 3y ago[flagged]
- lenkite 3y agoI wish Janet used Option types instead of using nil. No idea why modern Lisps don't borrow from Rust's goodness.
- James_K 3y agoOption types are inherently a bad idea for languages without value semantics. In rust, the Some variant of an option type can just be allocated on the stack at almost no cost, but doing this here would require a million small allocations every time you want to return something. Beyond that, it makes no sense to have union types when every value is already a union of all possible types.
- shakow 3y agoI love option types, but I don't think they make a lot of sense in dynamically typed languages.
- fredrikholm 3y agoAgreed. We used them at work (Clojure) and it didn't solve anything; normal idioms don't apply to monads and the mental overhead of having to know when they are used is the exact same as having to know when something might be nil.
- germandiago 3y agoI would say from Boost C++ or from C++ std. Rust came far later.
- rafaelrc 3y agoOr from Haskell
- butterisgood 3y agoOr OCaml
- NeutralForest 3y agoI know I should build it myself but I wish Janet, as a Lisp, had better integration with Emacs. There are some modes but they're scattered and not really up to date.
- sleepycatgirl 3y agoOh, thats.. certainly not encouraging.. Because other than that, Janet seems interesting. Well.. Maybe one day, we will have good emacs integration, I guess?
- mplanchard 3y agoDoes Janet have a language server yet? That would go a long way, but last time I checked it did not
- beepbooptheory 3y agoDo any lisps have a "language server"? They kinda are their own language server right? If you mean something like SLIME/SLY, than yeah, but I guess I never considered that a language server in the same way as all the other LSP backends.
- _19qg 3y agoWhy not? There is an external IDE (SLIME in GNU Emacs) which interacts with a language server to get information about syntax highlighting, completion, documentation, source locations, ... The idea of an 'inferior Lisp' connected to a GNU Emacs has a long tradition. Usually one did communicate with a Lisp as a process on the same machine. That was long before SLIME. Popular were ILISP (1990) or ELI (for Allegro CL). The purpose is a more general, providing evaluation/compilation, backtraces, inspectors, browsers, etc.
- LanternLight83 3y agoGuiser fills the role of a language server for Guile and a handful of other Schemes.
- EVa5I7bHFq9mnYK 3y agoI started thinking about a new programming language name and ChatGPT returned the following: Jaida Jocly Jovie Jacey Janel Jolyn Jolie Janna Jazzy Jovia
- phonebucket 3y agoI'm eager to jump into a Lisp. Janet seems really tempting for tiny footprint, distributability etc. But I'm currently leaning towards to Racket just because it would be more or less compatible with a whole host of Scheme books that I'd like to read (The Little Schemer/Typer/Learner, SICP, Functional Differential Geometry). Does anyone familiar with Janet know if those books can be easily worked through with Janet for a newbie Lisper?
- cellularmitosis 3y agobecause Janet is a lisp-1, this should be very doable.
- dgb23 3y agoWith a little bit of effort you can make it work. But I believe Racket has specific language definitions for some of these books so you can follow them more or less seamlessly.
- cardanome 3y agoRacket is a great choice for learning but also very batteries included if you want to make real projects in it. Janet has a more Clojure-inspired syntax but the semantics and general ideas should carry over. I think trying to work through the books in Janet would be a great extra challenge. You can always drop that and focus on Racket if it becomes it too much for you.
- medo-bear 3y agodont overwhelm yourself. use the language the book was designed for common lisp also has some really great books, beginner and advanced. paip is probably the most famous of these
- netbioserror 3y agoWhy not try doing the exercises in Janet? It gives you the end-product goal so you don't have to waste energy on ideation, but having to figure out syntactic differences and compatible standard library functions and macros yourself really helps you understand a language top-to-bottom and is arguably the best way to learn. The way I learn languages all the time is to translate exercises on sites like HackerRank or exercism along with toy projects I already have.
- ptato 3y agoCan you write GUIs with Janet?
- cellularmitosis 3y agoIf you count raylib as a GUI, yes! https://github.com/tantona/janetroids/blob/master/main.janet https://github.com/tantona/janetroids/blob/master/main.janet
- eggy 3y agoI was considering Shen[1] for this type of use, since it is implemented in many languages. It is a Lisp with built-in Prolog. Feature list from the site's main page: pattern matching, lambda calculus consistency, macros for defining domain specific languages, optional lazy evaluation, static type checking based on sequent calculus, one of the most powerful systems for typing in functional programming, an integrated fully functional Prolog, an inbuilt compiler-compiler, a BSD kernel under 15 languages (Lisp, Python, Javascript, C ...) and operating systems (Windows, Linux, OS/X), is extensively documented in a book has nearly a decade of use. Aditya Siram made two very good videos on Shen. You can program your front and backend in Shen given Shen is implemented in JavaScript and other PLs. I know somebody did a port to C, but I am not sure if you can then make an exe as described for Janet. https://www.youtube.com/watch?v=lMcRBdSdO_U https://www.youtube.com/watch?v=lMcRBdSdO_U https://www.youtube.com/watch?v=BUJNyHAeAc8 https://www.youtube.com/watch?v=BUJNyHAeAc8 You implement Kλ in your PL of choice if it is not already available, and voila, you can program in Shen! [1] https://shenlanguage.org/ https://shenlanguage.org/
- packetlost 3y agoI looked into Shen recently. I ultimately decided not to use it because their remote compilation model thing seemed... cludgey. I've since landed on Gerbil Scheme (https://cons.io https://cons.io) which is a modern front-end to Gambit Scheme. It seems like the perfect mix of performance, (modern) features, R*RS, and FFI that I want/need. Baring some significant bugs, it will probably be my goto Lisp going forward.
- eggy 3y agoI am not sure what you mean by "remote compilation". I know there was Shen Professional that required a monthly subscription and it was on the server, however, Shen is available in different PL ports for free and local use. It is like a Haskelly Lisp. Very well thought out too with a great book that covers a lot of ground including PL history and logic. I used to use Gambit Scheme, and although I have two linux machines, I work on Windows for my paying jobs. Gerbil doesn't seem to talk about a Windows install. I shy away from WSL, Cygwin, and MSYS2 in general. I am learning Zig, and I have thought about porting Shen to Zig. The CL port of Shen is the main port (SBCL).
- andrewstuart 3y agoI think programming languages should be obvious. Sure you need to learn some hard stuff like async, but it seems to me that the most important thing is languages should work “like you expect them to”. Python, javascript, they’re not perfect but they’re pretty obvious. Zig aims to be obvious. Rust is the opposite of obvious. C++, the small subset of it that I use is pretty obvious. Things are similar to other languages, there is minimal surprises. Functional programming feels non obvious.
- kreco 3y agoFor you Janet is obvious or non obvious?
- shakow 3y agoThey only seem obvious to you because you are used to them. Quite the opposite to you, Rust is obvious to me because I'm used to low-level programming and careful memory management, where JS is more than often very surprising. Another example: I wrote a Lisp-like language in my company for mathematicians to develop constraint systems; now this purely functional, bastard Lisp feels like a second nature to them, whereas they could barely put three lines of Java together to save their lives. Does not mean that I'm more or less right than you are; just that just like human languages, no PL or paradigms are ‶naturally obvious″, we are just more or less used to them.
- agumonkey 3y agoobvious is too subjective here, what is not obvious in FP ? is it the terminology ? or the accumulated culture (monads and such) ? because FP at its core is pretty much very obvious. Functions from domain to domain, that's it.
- unionpivo 3y agoThat depends on what you are used to. I was mostly used to C and Perl when I was young, and Python made a lot of sense. I would not say that javascript was more obvious to me than rust was when I started to use them. A lot of people seem to be hung up on borrow checker, but if you are used to low level C, you had to keep track of that with comments on functions and conventions anyway (and you had to keep it in your head). The thing that I had to get used the most of in rust is using more functional style of programming, but since I liked python comprehensions and collections, It want such a long jump as it otherwise might be.
- whydoineedthis 3y agoI wish the code convention closed brackets in line with the opening brackets rather than at the end of some random line of code. My ADHD/autistic brain does not like the imbalance.
- effnorwood 3y ago[dead]
- syngrog66 3y agoLisp is good "hellp world" being a 784k exe is bad
- q845712 3y agoI'm writing go in my dayjob right now, and my reaction was "hey under a megabyte for a runtime with GC is pretty good!" So I checked just now, and my hello world for go was 1.9M. And you're well within your rights to just declare "the fact that go is even worse doesn't make Janet good" but let's be honest - plenty of people have accepted go's compromises, so something coming in at better than half the size is relatively much better. edit: out of curiosity i used gcc to make hello worlds in C and C++, which came in at 32k and 37k respectively.
- kazinator 3y agoBut those executables have run-times in shared libraries. It sounds as if Janet's run-time is statically linked; it could also be built as a .so? Shared library calls (and variable references) are ugly, though. Unless you have a large number of Janet programs, the space saving isn't worth the shared library tax.
- eigenhombre 3y agoThat doesn't seem that bad to me for a Lisp. Common Lisp / SBCL equivalent for me is 41MB. Clojure überjar size for the same is 4.6MB. There is a cost to having so much language ("all the language, all the time") available at different stages of the program lifecycle (macroexpand, compile, runtime, ...). Not sure if a Janet program can run eval, but it still has a garbage collector, etc. Even a Go equivalent is 1.9MB.
- schemescape 3y agoWhat are you comparing the size to? I think Lua is in the same range, so this seems reasonable (but obviously much larger than anything without an included runtime).
- benbristow 3y agoI thought this was going to be about the British Academia/Government ISP. https://en.wikipedia.org/wiki/JANET https://en.wikipedia.org/wiki/JANET
- connordoner 3y agoAnd me!
- LispSporks22 3y agoIs there SLIME/SLY/NREPL etc. for Janet?
- stutonk 3y agoYes! With spork/netrepl and Conjure in Neovim https://janet-lang.org/api/spork/netrepl.html https://janet-lang.org/api/spork/netrepl.html https://github.com/Olical/conjure https://github.com/Olical/conjure
- nsm 3y agoCould someone compare Janet with Racket? The latter is a much more mature project with a powerful and well designed standard library, so I'm not sure why one would pick Janet. I see the appeal to embed in another app as a scripting language like Lua, but for writing standalone programs?
- ianthehenry 3y agoMm, I don't think it makes a lot of sense to compare Janet and Racket. They're so different that they aren't really bidding for the same projects -- you could ask the same question about Janet and Python, or Janet and Ruby, or Janet and Erlang. They aren't really substitutes for one another -- a comparison with Lua or Tcl makes more sense. That said, I think the original article serves as a decent starting point -- how many of the listed points apply to Racket?
- nsm 3y agoThat is fair, I agree they don't bid for the same projects. In terms of listed points. 1. Simplicity... perhaps? I guess Racket has a larger surface area, but just like all Lisps/Schemes it is built on a simple core. 2. Distribution. Janet probably wins here. Racket can produce static binaries, but they may not be as tiny. Relatedly, there is a Racket subset, Zuo, that ticks this box. 3. Parsing text - Racket's whole shtick is this, given it is a language for writing languages :) 4. Subprocess DSL. `sh` looks like a nice library. I can see the value for using this for quick scripts since you can shell out to bash whenever you want. 5. Embeddable. Janet is better here similar to Lua. Also see Zuo. 6. Mutable and immutable collections. Racket has these. 7. Macros. Racket has these. 8. Compile time to run time. I'm not sure about this, being a Racket newbie. 9 and 10 - very subjective :) Cheers! Thanks for the great article! https://docs.racket-lang.org/zuo/index.html https://docs.racket-lang.org/zuo/index.html In some sense it is a little sad that the Lisp and Scheme like languages diverge so much within themselves, as it makes an already unpopular set of languages even harder to standardize on and evangelize.
- xrd 3y agoFwiw, I love the Janet for Mortals book. I'm super excited about it because I'm fascinated by the author's two other projects, bauble.studio and toodle.studio. It lets me revisit the joy of learning programming and art that I felt when I first go to play with Logo. But in a "serious" and "gorgeous" language and toolset so I can pretend to be an adult in the proper circles. I specifically love the choice of PEG because I've always hated the "regexp are bad" argument and PEG seems closer to my compilers coursework as well as more advanced. So much to love about Janet.
- mmvora 3y agoAnyone here fans of the good place? https://thegoodplace.fandom.com/wiki/Janet https://thegoodplace.fandom.com/wiki/Janet