> Instead of regular expressions, Janet’s text wrangling is based around parsing expression grammars. Parsing expression grammars are simpler, more powerful, and more predictable than regular expressions. I would dispute that this is the case. In PEGs, alternatives are not commutative, unlike in regular expressions. This can lead to quite frustrating debugging. While a valid choice, the advantage over REs is overstat…
Why Janet? (2023)
211–220 of 292 posts
Re: Why Janet? (2023)
#212janet has replaced sh, python, awk, etc. for me, for system scripts over a certain length! it has a very fast startup time (on my system, 1.4ms via hyperfine vs. 1ms for dash) for scripts (not compiled executables), and its sh-dsl module allows typing shell commands very elegantly, like ($ cmda w x | cmdb y z). the ability to load an image to debug is a big help, too. i've started using it very recently but it's prob…
babashka did that for me.
Re: Why Janet? (2023)
#213Earlier quoted context omitted.
You can... just not use square (and curly) brackets. Instead of `[1 2 3]` just write `(array 1 2 3)`. Instead of `(fn [x] (+ 1 x))` just write `(f (x) (+ 1 x))`. They are never necessary.
Huh! So like some Schemes and Racket? Yet I must read them in code that isn't mine, which is a large part of the problem.
Re: Why Janet? (2023)
#214Earlier quoted context omitted.
you ever try to explain object oriented programming languages and their benefits to the "average person on the street"?
Pretty straight-forward, as the world as we perceive it is made of objects with attributes, interacting with each other via their methods. OOP easily fits the brain of the average person in the street.
Of course easier to explain the "strategy pattern" to a florist, instead of saying "imagine a function that takes a function". Who the hell understands functions? Such a mind-bending concept, literally nobody really knows how they work. Einstein famously complained about it. Too bad he didn't know OOP - would've been so much easier. I couldn't grok general and special relativity for so long, thank god I've found Java - it made it so much easier. I don't know what Persian mathematicians been smoking in 12th century to come up with this utterly fucked up idea of a function. And fuck Leibniz as well.
Re: Why Janet? (2023)
#215> Instead of regular expressions, Janet’s text wrangling is based around parsing expression grammars. Parsing expression grammars are simpler, more powerful, and more predictable than regular expressions. I would dispute that this is the case. In PEGs, alternatives are not commutative, unlike in regular expressions. This can lead to quite frustrating debugging. While a valid choice, the advantage over REs is overstat…
Something I'd observe here: without expressing an opinion about PEGs vs regexes, I'd note that regexes are much more widely used. They're also completely sufficient for an awful lot of text processing tasks. PCRE regexes would be a great inclusion to the stdlib, and would probably be popular.
Why? Anything that can be done with a regex can also be done with a PEG, and the PEG will be much more readable.
Re: Why Janet? (2023)
#216> Instead of regular expressions, Janet’s text wrangling is based around parsing expression grammars. Parsing expression grammars are simpler, more powerful, and more predictable than regular expressions. I would dispute that this is the case. In PEGs, alternatives are not commutative, unlike in regular expressions. This can lead to quite frustrating debugging. While a valid choice, the advantage over REs is overstat…
Came here for this comment. Janet would score positively in my mind if the evolutionary dead-end PEG were replaced with a grammar parser that is known to work under all circumstances.
Re: Why Janet? (2023)
#217why is it called Janet? perhaps to prevent it to be identified with the acronym for Lots of Irritating Single Parenthesis?
I know that Lisp has lots of paranthesis and I don't have enough experience with Lisp at all. But from the looks of it, Janet has some great ideas like the one that @ramblurr shared here about sandboxing ("Disable feature sets to prevent the interpreter from using certain system resources. Once a feature is disabled, there is no way to re-enable it.") Lisp from my understanding is incredibly polarizing and many peopl…
No it's not! It's as "polarizing" as "group theory" or "set theory". Lisp is fucking math - it maps closely to formal mathematical/logical notation. You just can't "hate" math - you can be confused by it, be unfamiliar with it, intimidated by it. But hatred directed at something that is simply precise and consistent says more about the person than the thing.
This is basically a reoccurring theme on every programming forum, whenever a Lispy PL gets mentioned. There are tons of confused programmers who look at Lisp examples and "hate" it. Without a single practical experience of using Lisp. They don't know anything about structural editing, they never experienced REPL-driven development. And I'm not talking about shit like "Python REPL", which is a bleak attempt, a shallow shell compared to the "true Lisp REPL".
It takes a bit of time and curiosity to realize how enormously powerful, beautiful and practical the idea of Lisp is. And it's really sad that smart people refuse it outright, without even attempting to understand it. Sure, it may take some time to discard the old habits that took years to build and accept this unfamiliar thing. Yet there's a point, after which comes the realization that Lisp can literally replace every single programming language with better ergonomics. I'm so mad at myself for wasting huge chunk of my life, chasing things of lesser importance, instead of just figuring out Lisp sooner.
I guess, to a degree you're right - you either hate Lisp or love Lisp, there's no in-between. But "hate" means you simply don't know it. Once you do - there's no way not to fall in love.
Re: Why Janet? (2023)
#218Earlier quoted context omitted.
I'm starting to prefer the s expression syntax when dealing with tree structures like json. I wonder if we were raised on tree based algebra if math would be easier to do, or harder. Like, solve for x. (= (+ (* 2 x) 3) 11) (= (* 2 x) (- 11 3)) (= (* 2 x) 8) (= x (/ 8 2)) (= x 4) Though this isn't too bad. (= (+ (pow x 2) (pow y 2)) (pow r 2))
I think also a lot of my objections could be worked around if one simply had a "math" macro that evaluates infix math notation as a DSL, similarly to how the CL "loop" macro does a DSL for iteration. Perhaps this exists already somewhere?
Re: Why Janet? (2023)
#219I have my qualms with Janet. Mostly, it's lack of package management versioning and lack of libraries in general (advanced HTTP routing, etc). I do LOVE that Janet can create binaries with JPM, scripts, and is very portable. I once put the Janet programming language on the Playdate game console as POC. I actually do enjoy writing Janet, but every time I do people think I created the language (I did not).
Julia Evans has a fun blog post using Julia to visualize Gunzip: https://jvns.ca/blog/2013/10/24/day-16-gzip-plus-poetry-equa... you should totally do a "Janet writes Janet" version
Re: Why Janet? (2023)
#220Damn it, Janet. No proper namespaces. Hard pass.