7 ms·
Janet for Mortals (2023)
- deleted 2y ago[deleted]
- incanus77 2y agoI enjoyed this book’s practical take. It’s a big part of why I am currently learning Janet by doing Everybody Codes in it right now. https://everybody.codes https://everybody.codes
- gen_greyface 2y ago> ... has a built-in repl. At any point you can press escape and pull it up, and it’s docked to the bottom of the page... probably not a good decision to use `Esc` since browsers have default bindings for it. firefox exits fullscreen on `Esc`
- deleted 2y ago[deleted]
- threatofrain 2y agoThe book. https://janet.guide/ https://janet.guide/ The language. https://janet-lang.org/ https://janet-lang.org/
- MichaelGlass 2y agoI really like the slightly silly writing style! Reminds me of a toned-down Douglas Adams. Honestly, I'm not particularly interested in Janet but the style sucked me in.
- ulbu 2y ago“We’ll start with some numbers” I was expecting he’ll start by proclaiming it’s that language that uses floats for integers.
- 2pEXgD0fZ5cF 2y agoJanet looks really interesting. Especially with how easy to embed it is. If I understand it correctly creating DSLs in it should also be very easy with its macro and PEG feature?
- petee 2y agoI'm pretty new to it, but from what I've seen the answer is yes. And while I haven't wrote any macros yet I think PEGs are fantastic, and sooo readable. Their website has an example PEG to read Janet source - https://janet-lang.org/docs/syntax.html#Grammar https://janet-lang.org/docs/syntax.html#Grammar Embedding is really easy, as is writing c modules. You can link shared, or use an amalgamated c file. Check out https://janet-lang.org/capi/embedding.html https://janet-lang.org/capi/embedding.html Honestly I'm having just as much fun learning Janet as I am writing C modules and embeddings; Janet all the things!
- afranchuk 2y agoWriting DSLs is very easy, and fun! The PEG grammars are very elegant to build up. I wrote a language for programmatic recipes (think scaling, unit conversion, etc) with it and it was a delight. I'd provide an example but I haven't taken the time to write a README so I haven't published it publicly yet.
- 2pEXgD0fZ5cF 2y agoHey that's cool. Are you willing to instead share an example snippet of what the DSL itself looks like?
- afranchuk 2y agoHere's an excerpt (which is in a map passed to peg/compile) for numeric parsing: :nonzero-int (* (range "19") (any (range "09"))) :int (+ "0" :nonzero-int) :decimal (cmt (* (? (<- :int)) "." (<- (some (range "09")))) ,parse-decimal) :fraction (cmt (\* (? (\* (number :nonzero-int) :s+)) (number :nonzero-int) "/" (number :nonzero-int)) ,parse-fraction) :integer (cmt (number :nonzero-int) ,parse-integer) :num (+ :decimal :fraction :integer)
- riggsdk 2y agoThe title made me believe it was just another AI assistant (thinking Janet from "The Good Place" - but for us non-dead people instead. Was pleasantly surprised to see it is a programming language and that the title was just a clever joke on that: The Janet language is named after an immortal being in The Good Place who helps mortals navigate the afterlife, hence the title. It kinda surprised me that they ship the language with a PEG (parsing expression grammer) instead of a basic Regex engine. This has been my wish for any programming language that ships a Regex library by default to also include a capable PEG.
- tmtvl 2y agoGNU Guile also has a PEG library in its standard library (see <https://www.gnu.org/software/guile/manual/html_node/PEG-Parsing.html https://www.gnu.org/software/guile/manual/html_node/PEG-Pars...>).
- petee 2y agoJanet's 'spork' module is kinda like their libc, and has a regex submodule; it's very likely to be installed. Janet is my first exposure to PEGs, so nothing to compare against but I love how powerful and easy they are. I have a better grasp of them in only a few months than dabbling over 20yrs with regex. Also there is quite a bit of The Good Place callbacks within the Janet community; numerous 3rd party modules are named after characters, for example.
- philsnow 2y agoI had also not seen PEGs before, but the way you can use parsing node identifiers recursively (and mutually recursively) seems very intuitive.
- tessierashpool 2y agoElm does something similr. Neither elm/regex nor elm/parser are built-in, but elm/regex encourages you to use elm/parser instead. btw, I like the namesake, but a language named Janet is pretty much obligated to also prioritize control.
- purerandomness 2y agoAbsolutely love the writing style, which was the reason I got sucked into functional programming and the Janet language deeper than I'd had previously wanted to. Thank you!
- Tomte 2y ago> Okay great. I think that’s a totally reasonable second code sample ever for you to look at. I like it.
- prokopton 2y agoI’m holding out for the one written for immortals.
- petee 2y agoMeanwhile I'm waiting on "Janet for Normies" for myself
- sourcepluck 2y agoOoooh, is this the start of a series - who's going to do those two, and then "Janet for Aliens", "Janet for the Rest of Us", "Janet for Dummies", and so on. The titles write themselves!
- rfrey 2y agoPreorder now, delivery in 10,000 years.
- numeromancer 2y agoI am not waiting for Janet for Ethereals. Once it ships, it will always have been available.
- deleted 2y ago[deleted]
- katspaugh 2y agoLove the book! It's fun and inspiring to write programs recreationally!
- petee 2y agoThis book got me started with Janet a few months ago, and I really think it helped me get past the difficulty I've had in the past starting with Lisp-y languages (Janet is Lisp like only in appearance afaik) but this just clicked. I'm having a lot of fun writing Janet and refer back to the book often. I do think the macro example that is early in the book is a little overwhelming; if you can get past that everything is far easier. Whats great is that you can leave the author a comment right from the repl, so I did :)
- sourcepluck 2y agoNot to mention https://bauble.studio/ https://bauble.studio/ from the same author! It doesn't work in my browser - which is understandable because my computer is ancient - but sometimes when I want a break from study in the library I'll spend thirty minutes on a library computer playing in bauble there. I might get around to trying to figure out how the thing works, but the graphics you can make just fiddling with numbers is wild. Long life to Janet.
- zellyn 2y agoFor me, on a 2021 MacBook Pro M1 Max, on MacOs 15.1.1, it appears to work in Chrome but in Firefox shows this error. error: script:16:1: compile error: unknown symbol twist in evaluate [lib/evaluator.janet] on line 81, column 7 in bauble-evaluator/evaluate [lib/init.janet] on line 8, column 12
- ianthehenry 2y agodelete the contents of the script and then refresh — you’ve loaded an old version of bauble before and have the old tutorial cached in localStorage :/
- zellyn 2y agoThanks! That did it.
- subjectsigma 2y agoI couldn’t get into Janet, I’m not sure if this is a personal failing on my part. The only other Lisp I’ve spent any significant time in is Emacs Lisp, and everything in Janet seemed similar enough to that but just subtly different that I was always making silly mistakes. The PEG features were really compelling on paper but I found the syntax unwieldy and confusing. The documentation was complete in that it had descriptions of all the functions, but spartan in that it lacked examples or other helpful usage information. There didn’t seem to be any basic batteries included such as JSON parsing; if I want to write a quick script in a language and I have to first write a JSON or XML parser, task is already failed. This was like four years ago, so maybe the ecosystem is better now. Or maybe scripting was the wrong ruler to measure Janet by. I don’t know but this post is making me want to reinstall it.
- petee 2y agoThey put things like JSON and regex in the 'spork' module, which is kinda like libc; theres a strong internal drive to keep the core light. Many projects depend on spork, so it its likely to be installed on early. The docs are decent, though I agree there are still gaps in practical examples, this has been supplemented by https://janetdocs.com https://janetdocs.com, which are linked as "community examples" per function
- jodrellblank 2y ago> "the turtles are metaphors" :( The turtles were real, not metaphorical: http://classicacorn.computinghistory.org.uk/8bit_focus/logo/logo.html http://classicacorn.computinghistory.org.uk/8bit_focus/logo/... (it fits the definition of metaphor 'One thing conceived as representing another; a symbol' but it has the feel of people saying "my niece thought the floppy disk save icon is a refrigerator because that's where you save leftover food" not realising that it was a real piece of fun/cute hardware many moons ago).
- WJW 2y agoI don't think that what's displayed on that page is a "real" turtle...
- nkrisc 2y agoIt is a real “turtle”, however.
- mannykannot 2y agoHa! You never know when you are going to run into a point-of-view that would be on the fast track to 'closed as off-topic' if anyone asked a question about it on the philosophy stack exchange.
- Smoosh 2y agoCe n'est pas une tortue? https://en.wikipedia.org/wiki/The_Treachery_of_Images https://en.wikipedia.org/wiki/The_Treachery_of_Images
- WJW 2y agoI approve of this level of nitpickery. :)
- nickpeterson 2y agoThe style and tone of this book (website) is quite funny, I really enjoy it.
- debo_ 2y agoIt's neat to compare Janet to GNU Guile. Guile's original pitch is that it's intended to be easily used side-by-side with C. However, because it's an older language, it hasn't (to my knowledge) picked up newer sensibilities like having a package manager shipped with the language toolchain. One thing I like about Guile is how much effort they've put into describing compatibility with the RNRS standards. Not sure how Schemey Janet actually is, but I'm curious to find out.
- packetlost 2y agoJanet it not Scheme-like at all. It's more like if someone made Clojure on top of Lua.
- giraffe_lady 2y agoWhich is really funny because that's basically exactly what fennel is, which was made by the same guy. I don't think he's written about it but fennel compiles to lua while janet is its own thing.
- packetlost 2y agoCorrect. Syntactically it's more similar to Clojure while the runtime is, to my understanding, heavily inspired by the non-JIT versions of Lua. As a language, it's fine. I found the documentation pretty good and the language makes some very sensible decisions but I can't bring myself to use it for anything serious. The lack tooling makes it challenging.
- giraffe_lady 2y agoI have used janet for embedding into another program as an alternative to lua and it was great for that case. Lua doesn't have good tooling either, and I didn't have anything to gain from a tiny runtime and I wanted more powerful tools for making a DSL in there. It worked out perfectly, I'd do it again.
- debo_ 2y agoThis is very cool: > this book contains a repl, and you can summon it whenever you’d like by pressing the escape key on your keyboard. The book will then start downloading like a megabyte of JavaScript and WebAssembly, and once it’s done you will be able to try out Janet right here in the comfort of your browser. No need to install anything; no need to leave the comfort of this book website if you’d like to test something out. > The repl is not just a repl, though. It is also a portal into conversation with me, the author. You can use the repl to report typos or factual errors, ask questions, or express confusion. I won’t be able to respond in the repl, but if you include some kind of contact information in your reports I will make an effort to follow up with you.
- deleted 2y ago[deleted]
- behnamoh 2y agoI've read the book and I found it very fascinating and kind of playful, which actually makes learning the Janet program language much more fun. However, I found the documentation of the language lacking in many ways. Oftentimes there are functions or commands that are just there, but there's no example or explanation. or explanation as to what they do. In fact, there are a lot of those that I found in the book, but I couldn't find in the documentation. So this is one of the reasons I stopped learning Janet, even though I really like the idea of this language, and the fact that it has many sane defaults and similarities to mainstream languages instead of like adhering to archaic Lisp conventions. At the end of the day, it's not actually a LISP because it's not cons lists. And it is fine by me, but again, I found the language not fully documented.
- alectroem 2y agoDo you remember any of the functions/commands that were not documented? I'm semi active in the Janet community and would be able to work on improving the docs where its lacking!
- Lyngbakr 2y agoI had exactly the same experience (minus reading the book). Often, I'd just see the function signature and no further explanation. I do realise that it takes a lot of time and effort to build up extensive docs, but it happened enough that I put it down and started looking for another Lisp that compiles down to a binary.
- jerrygenser 2y agoOff topic - a separate blog post by TFA got me into split mechanical keyboards. It helped me after years of shoulder and wrist pain. Highly recommend exploring other posts by Ian.
- bmitc 2y agoThis is a very "Internet" comment, but what struck me about the title and very many other titles in the software engineering world is that I'm not sure it's the best idea to belittle readers in the title. The implication of "<x> for normal people, mortals, dummies, etc." titles is that the reader is not on the level of the author of the book and the authors of the tool or topic that one is learning about. Specifically, "for mortals" implies the author and programming language author are immortals, or at least not mortal. I realize this is taking the title more seriously than probably intended, but this type of framing pops up a lot in the software and programming world.
- ianthehenry 2y agohi, i am the author of this book and i agree with you. it's not a good connotation. i chose it because: 1. it is kinda memorable (look there are so many programming books with exactly the same name) 2. the language is named after an immortal being who guides mortals through the afterlife in the fictional property the good place, so there's some kinda connection. but i agree the implication that janet is somehow "hard" to learn or that the author is somehow "on a higher plane" is bad. i waffled on this a lot but never came up with another title i could stand and ultimately just pulled the trigger. (but note that i left myself some wiggle room with a neutral domain name.) i hope the tone of the book itself helps to counteract the title, but ya know who knows
- bmitc 2y agoThis isn't really a specific complaint about this book. Just triggered my thoughts on a general theme. Thanks for writing the book. I might look into it, as I'm generally interested in Lisp/Scheme-likes.
- julianeon 2y agoI could see this is if the title was "for morons" (or something like it), something implying a class division. But 100% of humans are mortal. Everyone is mortal, including the author. So there's no real division here, no two tiered system: we are all on the mortal tier.