by d3nj4l · 4y ago · 0 comments
But while I'm interested, I can't find any docs for what's included. For scripting, I think I would at least need the following in the standard library, no package management required:
1. A good API for filesystem ops, such as reading and writing files. Ex: reading the lines of a file into a list, writing a list to a file as lines etc.
2. Making network requests easily, with persistent connections if you need it. (see Net::HTTP in Ruby, which has become extremely usable for all but the most advanced use cases)
3. Parsing JSON at the very least, with YAML and CSV being good to haves.
4. An easy way to run shell commands for stuff that's just better handled there. (like `` in Ruby)
In addition, if the stdout natively supports colouring text that would be super sweet, but that's not a hard requirement.
I can see 1) to some extent in the examples, but without a docs site I'm not sure about the rest. Does anybody here know for sure? Otherwise, is there some other lisp that would meet these requirements?
Why: Python can be verbose, and when I want to write a one-off script to rename some thumbnails in a directory somewhere, that verbosity doesn't help. The strong typing, while good for correctness, also doesn't help much in this use case.
What I tried: V, Nim, Clojure, Scala 2, Scala 3, GNU Smalltalk, Rust, Zig, Clojure, Racket, Emacs Lisp, Raku, Ruby, OCaml, and LiveScript.
Why Raku[1]: expressive power is insane. My test case of writing a script to merge requirement versions coming from two differently formatted files needed ~30 lines of code on average, while Raku needed just 10. The next best was LiveScript with 23 lines, then Elisp with 25 (counting imports; I have all the libraries already imported in an Emacs session, so I could go down to 19 lines, but thought that would be cheating).
The language being "write-only" is not important to my use case, but I also don't feel like Raku is write-only. Yes, reading something like this:
my @toml = "script.toml".IO.lines.grep(none "" | /^'#'/).map:{S/'='.*$//.trim};
can take some getting used to, but it's not really much worse than BASH.[1] https://docs.raku.org/language/faq#Why_should_I_learn_Raku?_...?
As for that line, maybe it's my Ruby heritage, but I didn't find it particularly unreadable! Chaining messages is pretty tight and very useful for one liners.
> maybe it's my Ruby heritage
Definitely :-) My Python-only colleagues screamed in horror after seeing that line...
[1] https://rash-lang.org/ - I have a similar project running on GNU Smalltalk, but didn't get to work on it in half a year :(
Regular racket has all of the things, and if easy interaction with the shell is what you desire, you might try RASH, the Racket Shell DSL.