15 ms·
Janet for Mortals
- deleted 4y ago[deleted]
- superb-owl 4y agoHere I was hoping for an introduction to the work of Pierre Janet.
- BillinghamJ 4y agoI thought it might be about this JANET: https://en.wikipedia.org/wiki/JANET https://en.wikipedia.org/wiki/JANET
- cpufry 4y agothis is neat and all, idk why i feel so exhausted every time i see a new language these days
- nerdponx 4y agoIf you're anything like me, it's because you're getting older and have increasingly limited free time and energy that you can no longer dedicate to learning new programming languages.
- smegsicle 4y agosome people have reported aspirin providing relief from long covid
- replwoacause 4y agohuh?
- smegsicle 4y agoa reference to 'long covid' causing exhaustion, and aspirin breaking up the blood clots thought responsible- you can tell it's a joke by the dim color of the text
- afry1 4y agoIt's the "sadness of mortal men" as Tolkien put it. So many awesome languages in this world, so little time to learn and use them.
- weatherlight 4y agoBecause learning new things is hard and hard things tire us out. we should endeavor to learn new things everyday.
- nerdponx 4y agoOne obvious point I'm missing here, and that I've been missing from Janet discussion in general: why Janet and not Scheme? Gauche for example implements the latest (and IMO greatest) R7RS, its standard library is huge and "batteries-included" including a wide array of RFCs to the point of rivaling Python, and has a package manager in the form of Akku. Chicken has a similar story. Racket is arguably more useful "out of the box", but its community seems so heavily focused on using it for PL research that it's harder to justify using it for day-to-day programming. And there's Clojure as well, which I know comparatively less about, but is well-loved by its users. Heck, even Common Lisp has a lot going for it, but the Standard and the conventional Lisp dev tools are kind of chaotic and idiosyncratic enough that it's understandable if people don't want to use it. To be clear, Janet seems like a great little language. But as someone with limited time and energy who is interested in using it, I want to know why I should spend the time learning it, compared to Scheme
- imwithstoopid 4y agoJanet users are not encumbered with the historical cruft of scheme like hiding libraries behind unmenorable srfi numbers, or the ancient an un-portable oop implementations etc etc
- agumonkey 4y agoThis should be studied a bit. At what point a partial reboot benefits the community/language before.
- giraffe_lady 4y agoJanet has close integration with C going both ways. It has built in C ffi and you can easily build and distribute a janet binary that uses C libraries. It's also easily embeddable in C programs the same way lua is, making it possible to use it as a config, extension, or scripting language in a larger program. Aside from that having used it a fair bit I think it's got a very "practical" orientation. It provides immutable structures, but doesn't enforce immutability semantics the way clojure does. It has a good concurrency system but is cleanly single-threaded and performant by default. And imo the standard lib is a really good balance, neither forcing you to build EVERYTHING yourself (lua) or having the whole last 50 years of CS research in it (racket).
- Graziano_M 4y agoI'm a fan of janet. I did 2021 Advent of Code using it. I am not a fan of Lua, since it's ugly and too barebones (no string split?), but I understand its ubiquity due to its small size and ease of embedding in programs. I wish/hope for Janet to fill this niche.
- catketch 4y agoTake a look at fennel. Same author as Janet, but it transpiles to Lua. https://fennel-lang.org/ https://fennel-lang.org/
- bongobingo1 4y agoFennels cool. I use it a lot, but it inherits all the ugly bits of lua still.
- Graziano_M 4y agoYeah I actually opt to use fennel over Lua at every chance, including my Neovim config.
- toastercat 4y agoSurprised to hear someone call Lua ugly, as I find it pretty and simple. The barebones-ness is part of the appeal for me as well.
- jimmahoney 4y agoI used janet for Advent of Code 2021 too. My first exploration of the language. Small world. I found janet fun but quirky. My work is at https://github.com/jimmahoney/advent-of-code/tree/master/2021/jim https://github.com/jimmahoney/advent-of-code/tree/master/202... .
- djha-skin 4y agoMy question for why Janet was answered: > My favorite feature of Janet, though, is something that sounds really dumb when I say it out loud: you can actually distribute Janet programs to other people. You can compile Janet programs into statically-linked native binaries and give them to people who have never even heard of Janet before. And they can run them without having to install any gems or set up any virtual environments or download any runtimes or anything else like that. The space is ripe for a lisp that is easily distributable. Yes, common lisp can be statically compiled, but their binaries (at least with sbcl) can get pretty big [1], even with compression. Making a lisp specifically good at using to make CLI or desktop tools with good c ffi support is compelling. 1: https://blog.djha.skin/blog/50mb-for-hello-world/ https://blog.djha.skin/blog/50mb-for-hello-world/
- iansinnott 4y agoI wonder if Jank [1] could be such a Lisp? I haven't played around with it, but I really like the idea and would love to see it get more traction. [1]: https://jank-lang.org/ https://jank-lang.org/
- miroljub 4y agoUnless jank rebrands itself as NativeClojure retaining 100% Clojure compatibility with a few more native related goodies, I don't see it offering more than Janet, which is also inspired by Clojure. Given that they have similar goals, why not merge and join efforts? Would help in softening the rough edges and reducing the bus factor.
- cellularmitosis 4y agoLooks like the key difference is that jank is based on persistent data structures, while Janet embraces mutability.
- smegsicle 4y ago'jank' is a good name then- janky immutable structures sounds flexible and fast, while janky mutable structures sounds like a big mucky headache
- Koshkin 4y agoIt's a LISP
- kunley 4y agoIt's alive^Wa lisp!!;)
- _benj 4y agoI’m quite excited about this! Janet looks like a nice small, embeddable, fun language with a lively community! The documentation and site felt like a close-knit community of insiders, which I wanted to become one of them :) hopefully this book shows the path!
- giraffe_lady 4y agoOh cool I love janet, I've been using it everywhere I can recently. There definitely weren't many good resources on it last year, though it wasn't too hard to learn despite that. This language also completely converted me to PEGs for entire classes of problems, and I'm now often annoyed in other languages that don't have them. Libraries exist, but having it built in is so nice, and the s-exp syntax works much much better for them than almost anything else you could come up with. A moderate issue I had was finding functions for what I wanted, since the docs were set up more tutorial style, then there was just a huge list of every function. Spent a lot of time skimming through that guessing what I could be looking for. Another thing I ran into is the concurrency/fiber system still feels like a work in progress. There are several different ways to handle concurrency depending on how you want to combine the abstractions, and some parts of the (otherwise excellent) standard lib don't work well with it. It also combines nastily with a lot of C libraries, which is rough in a language that seems to expect you to use C bindings often. Understandable limitation and there's probably not a good clean solution. Anyway this book looks great, I really hope it brings more people into janet. It's an excellent language for a lot of applications where people reach for the imo extremely overrated lua.
- mentos 4y agoIs the ‘for mortals’ thing a Steve Jobs-ism?
- sph 4y agoGiven that it is a Lisp, it should be "for mortals seeking divine beauty and purity".
- cnasc 4y agoI think a reference to Q For Mortals https://code.kx.com/q4m3/ https://code.kx.com/q4m3/
- ianthehenry 4y agoThe Janet language is named after a fictional immortal being from the television show The Good Place, who exists to help mortals in the afterlife -- that was the inspiration for the title.
- Uehreka 4y agoSo the word LISP does not appear in the entire introduction. If you’re introducing a language thats a LISP, that’s really the kind of thing you’ve got to state up front. You can define the term for those unfamiliar, and you don’t have to dwell on it, but people who are turned off by LISPs will feel a little swindled if they get 3 book-pages in before finding out. And people who specifically like LISPs might pass this over without realizing what it is and miss out.
- superdisk 4y agoHe pokes fun at this type of comment in chapter 1.
- fallat 4y agoI really argue the opposite: it's really something you dont. A ton of people see LISP and get scared away.
- tgv 4y agoThe first (defun will take care of it if you don't. If they stay, and can stomach ))))), I doubt they'd be scared off by mentioning LISP. Hell, you can even mention it after the first examples.
- giraffe_lady 4y agoIf you call it a lisp you summon the lisp lawyer demons who will litigate your namespace & symbol semantics and start a big beef among themselves about what a lisp is and what makes lisp lisp and how much this is lisp and whether lisp even exists it's just a whole huge headache. It uses parens and prefix notation. Not every language that uses parens and prefix notation is a lisp, I guess, maybe, I don't care. But not wanting to have that argument is an excellent reason to never make this assertion about a language imo.
- wodenokoto 4y agoChapter 1 deals with your frustration: > And now you’re just wondering when I’m going to use the L-word. You want me to use it so you can go write a long screed about how Janet isn’t a real one. But I’m not going to give you the satisfaction. I’m not going to use that word until Chapter Fourteen.
- shaicoleman 4y agoThere are no code examples on the home page, so here's one: (defn bottles [n] (match n 0 "No more bottles" 1 "1 bottle" _ (string n " bottles"))) (loop [i :down [99 0]] (print (bottles i) " of beer on the wall\n" (bottles i) " of beer\nTake one down, pass it around\n" (bottles (- i 1)) " of beer on the wall\n\n")) https://rosettacode.org/wiki/99_bottles_of_beer#Janet https://rosettacode.org/wiki/99_bottles_of_beer#Janet
- cmiles74 4y agoI had some time a while back to work on a project of my own, I coded up a bencode parser in Janet. It was a fun project, I liked Janet alot. :-) https://github.com/cmiles74/bencode/blob/master/src/bencode.janet https://github.com/cmiles74/bencode/blob/master/src/bencode....
- mdgrech23 4y agobottles 99 of beer on the wall? That's not the lyrics or am I just not understanding janet?
- bombastry 4y agoThe prefix notation may be throwing you off or perhaps you have mistaken the function `bottles` for the string "bottles". The code `(bottles i)` in the loop is calling the function `bottles` (defined at the top) with the argument `i`. The value of `(bottles 99)` is `(string 99 " bottles")` which evaluates to "99 bottles", as expected.
- colonCapitalDee 4y agoYou aren't understanding Janet. (bottles i) invokes the bottles function with parameter i, so the lyric is "99 bottles of beer on the wall".
- deleted 4y ago[deleted]
- sph 4y agoThanks, I was looking forward to this, after you sent me a draft months ago. I completely forgot about Janet as I've been very busy lately, but this is a good opportunity to get back into it. -- See also, from the same author: https://bauble.studio/ https://bauble.studio/ — interactive 3d sandbox in Janet Previously discussed at: https://news.ycombinator.com/item?id=32738654 https://news.ycombinator.com/item?id=32738654
- billfruit 4y agoHow does this compare with Carp, which is often featured here.
- ianthehenry 4y agoThe only thing they have in common are parentheses. Carp is a statically typed language that compiles to native code without a GC. Janet is a dynamically-typed language that compiles to bytecode and runs in a virtual machine with a GC. Janet’s closest relative is probably Lua, despite appearances.
- oleganza 4y agoAs a wise programmer once said: "Lisps are created by those who are lazy to write proper parsers" Homoiconicity does not mean your syntax should be backwards. Look at Io language: it is basically a Lisp, but it has parens in the familiar places. Same with Forth: it is a small and powerful language, but it's good for implementing low-level stuff. You will quickly run into desire to have normal(language(with, familiar, syntax)) for writing non-trivial programs.
- stefncb 4y agoHow would you write the let macro in Io syntax? I can't think of a good way. Lisp is just less familiar, not necessarily wrong.
- weatherlight 4y agosyntax < semantics
- deleted 4y ago[deleted]
- kazinator 4y agoThe programmer may have been wise, but their remark doesn't testify to that.
- tmtvl 4y agoAllow me to disagree, I personally am very fond of the regularity and structure of plain old S-expressions. They suit the way my brain works. If I weren't as fond of them as I am I would still be using Raku, which is the most pleasant non S-expression based language I've ever used.
- jamesgill 4y agoI'm not in the audience for Janet, but I really appreciate efforts like this--to write about software in a creative and interesting way. I wish there were more.
- kelipso 4y agoIs cutesy language like this as offputting for anyone else? I couldn't get past the second paragraph due to the overly cutesy ridiculously simplified language. Who is the audience here?
- munificent 4y agoNo, I love it. I don't need sesquipedalian nomenclature in order to respect the content of a written work.
- vamega 4y agoI'm reading your book, and have previously read Ian's adventures on Nix. I love the writing style in both of them! It may not be for everyone, but I can appreciate works that use language to make topics less intimidating. Thanks to both you and Ian for your writings.
- cfiggers 4y agoI really like the writing style. I wouldn't describe it as "cutesy" at all, just informal.
- replwoacause 4y agoNope, I like the writing style. It's approachable and enjoyable to me.
- munificent 4y agoThe writing style of this is so good I accidentally got halfway through the first chapter despite not really needing a Lisp or scripting language in my life. I love it.
- vanderZwan 4y agoFor those who don't know, Bob "munificent" Nystrom wrote "Game Programming Patterns" and "Crafting Interpreters", so that's quite a compliment [0] http://gameprogrammingpatterns.com/ http://gameprogrammingpatterns.com/ [1] http://craftinginterpreters.com/ http://craftinginterpreters.com/
- throwaquestion5 4y agoThe site has a Janet repl (downloads pressing Esc) with autocomplete. That's enough, now I have to give the book a spin. The fact the author points out, being able to distribute the program without requirements, is a big plus. Multiple times I have been doing some bash script that later I can't share with my non-techy friends until I translate it in some google sheets or something they can use. If Janet can let me do simple script stuff and let me share it just sending the binary as a file on some chat app, then I'm more than interested
- thyrsus 4y agoI think I read that the image you distribute expects to use a C compiler in it's execution, and not every computer has a C compiler - or did I misunderstand? The run-in-browser blob cannot make that assumption, but perhaps that's a special case?
- whydoineedthis 4y agoI wish Ian Henry (the author) wrote all of my technical books. He is both whimsical, but also to the point. I don't think i'm the biggest fan of Janet, but I really appreciate his writing and may just read the whole book anyways.
- eimrine 4y agoAny sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp [1] . Maybe Janet is a human version of C, and that half of Lisp which is implemented here is the part of Lisp which is relatively easy to learn. [1] Greenspoon's tenth rule
- progre 4y ago> 4. Pegular expressions Good one. PEGs feels like having a parsing superpower compared to regexes.
- sgentle 4y agoFun Janet feature that I don't see in many languages: you can pause a fiber (coroutine), serialise it, deserialise it somewhere else and resume it again. A bunch of caveats to using it in practise, but it's still a little bit magical.
- harryvederci 4y agoThe author is super helpful in the Janet community, I'm sure this is absolute gold. I encourage Ian to put a donate button on the website. What I like about Janet is that anything seems possible with it, and that code from others is very approachable and understandable to me. In no other language do I ever find myself hacking on someone else's library to add a feature that I need. In Janet, it always seems easy. Some stuff I created that I wouldn't quickly find myself doing in other languages: - a wrapper around my web app that runs it like a CGI script (for ultra-cheap deploying on shared web hosts) - a logging function (macro) that logs the input (both the unevaluated way it was called and what it evaluated to) + line number of the code that called it - a framework for creating web apps (not public yet, but used in production on my website) - (with Ian's help) a macro that I can use to create functions that require explicitly specified parameters
- Cyphase 4y agoI was about to comment on the "Chapter Fibe" typo, but I decided to check the chapter contents first. So in case anyone else is thinking about doing the same thing, it's intentional.
- galaxyLogic 4y agoThis would seem like a good tool for creating small binaries which are meant to be combined by shell-pipelines later (?)
- thih9 4y ago> this book contains a repl, and you can summon it whenever you’d like by pressing the escape key on your keyboard. Is there an alternative shortcut for people without an esc key? I’m on iOS and my keyboard doesn’t have one.
- ianthehenry 4y agoYou can click the REPL icon in the bottom left corner, but the experience is pretty bad on mobile.
- deleted 4y ago[deleted]
- bmacho 4y agoAnyone knows how to run multiline programs in the REPL? Nothing works for me (enter, alt/shift/ctrl+enter, etc) in edge and in firefox.
- ianthehenry 4y agoOh hey! Ha. I forgot to implement a way to do that. I just added it -- ctrl-enter or cmd-enter, depending on your OS, should work now.