News for hackers. Stuff that matters.
Re:Writing Small CLI Programs in Common Lisp by lambdaba on Wednesday March 17, 2021 @01:17PM (#26494155)
For those unfamiliar with Common Lisp there is also Babashka which allows for Clojure shell scripting without the JVM startup time.

https://github.com/babashka/babashka

Re:Writing Small CLI Programs in Common Lisp by nerdponx on Wednesday March 17, 2021 @02:32PM (#26495097)
Common Lisp itself has Roswell, which I am disappointed to see is not even mentioned in the article.

https://github.com/roswell/roswell

Re:Writing Small CLI Programs in Common Lisp by Jach on Thursday March 18, 2021 @12:31AM (#26499680)
It's sort of mentioned indirectly at the beginning in that source-code scripts that use a shebang, or make use of exit, can introduce development barriers. I've not written many CL scripts but I like Roswell too, and haven't found those barriers significant/odd to work around. I agree Roswell is definitely worth checking out. (Plus at least for me it gets even more use by letting me trivially run my tests with alternate CL implementations...)

Like, I didn't even consider including "some ugly reader macros" to handle the shebang issue, since my approach has been to comment it out while developing and uncomment once I was ready to use it as a script. But I think this simple macro I put just now in my $HOME/.sbclrc file should suffice:

    (set-dispatch-macro-character #\# #\! (lambda (stream subchar arg)
                                            (declare (ignore subchar arg))
                                            (read-line stream nil (values) t)
                                            (values)))
And in some programs (not scripts) where I make use of uiop:quit, I just don't call those paths during dev, but this is the same approach the article has differentiating calling run vs toplevel.
Re:Writing Small CLI Programs in Common Lisp by vindarel on Thursday March 18, 2021 @06:15AM (#26501168)
About uiop:quit, that sometimes are in the middle of a script: lately I have wrapped it around a check of the nature of the terminal: if the terminal is dumb ($TERM), we are very likely inside Emacs/Slime, so we don't quit. https://github.com/vindarel/termp
Re:Writing Small CLI Programs in Common Lisp by bmitc on Wednesday March 17, 2021 @05:38PM (#26497088)
A quote from that link:

> Life's too short to remember how to write Bash code.

Hard agree.

Re:Writing Small CLI Programs in Common Lisp by JasonFruit on Wednesday March 17, 2021 @07:29PM (#26498082)
I really feel bad that I don't write more Bash, but every time I learn some, it's gone. I cannot retain that language, and I don't understand why: I'm a language gourmand, in general. But I throw Python, Scheme, or even Nim at little scripts every time, because I have to look everything up if I do it in Bash.
Re:Writing Small CLI Programs in Common Lisp by azalemeth on Wednesday March 17, 2021 @07:48PM (#26498215)
I've always internally thought that there are some languages that our brains just _don't_ like.

I used to think that there was "something wrong" with me for finding C++ verbose and C expressively dangerous, or to find myself reaching for multi-line awk, sed, and bash scripts that did _stupid_ things when I "knew" that a better solution existed but I didn't know how to _express_ that solution concisely.

Perhaps a more concrete example would be this: I don't use python often and some of its syntactical quirks get me every time -- like, for example, None as a method to insert a new axis by convention in numpy (so much so that numpy define np.newaxis as an alias to it). It makes total sense but at the same time, the fact that the language likes having what almost looks like a C NULL as a method to insert a dimension seems...wrong, like it should be a syntax error.

I've now just come to realise that hey: if you can't express this concept well in one language, and you _can_ in another, it's well worth prototyping the solution in the right domain and one could always write something in a "sensible" language later if it turns out to work.

Re:Writing Small CLI Programs in Common Lisp by aidenn0 on Wednesday March 17, 2021 @10:22PM (#26499141)
I realized at one point that I was writing an awful lot of shell code despite never really learning shell.

The only way I found to learn it that was fun was too write a shell implementation myself. Just POSIX, though so I never learned ksh/bash features.

Re:Writing Small CLI Programs in Common Lisp by JasonFruit on Thursday March 18, 2021 @08:05AM (#26501781)
That's a really great idea, and I expect to get nothing done for the next week thanks to you.
Re:Writing Small CLI Programs in Common Lisp by aidenn0 on Thursday March 18, 2021 @03:46PM (#26506753)
Re:Writing Small CLI Programs in Common Lisp by closeparen on Wednesday March 17, 2021 @10:55PM (#26499306)
Every time I've started to write a shell script, I've finished it in Python.
Re:Writing Small CLI Programs in Common Lisp by fctorial on Thursday March 18, 2021 @07:27AM (#26501564)
Or nodejs. It's python, but better.
Re:Writing Small CLI Programs in Common Lisp by idolaspecus on Wednesday March 17, 2021 @05:47PM (#26497178)
Life’s too short to not learn how to write bash code.
Re:Writing Small CLI Programs in Common Lisp by fctorial on Wednesday March 17, 2021 @06:47PM (#26497748)
I'm astonished that we haven't moved past bash.
Re:Writing Small CLI Programs in Common Lisp by blacktriangle on Friday March 19, 2021 @11:20AM (#26514316)
I'm not. "Everything is a string" is an incredibly powerful worldview for tying systems together where those systems never put any thought into interoperability. Any realistic bash alternative would either need to rewrite the entire user land with a more structured exchange format like JSON or .NET objects, or ship with adapters for most every command line tool we use.
Re:Writing Small CLI Programs in Common Lisp by exdsq on Wednesday March 17, 2021 @06:44PM (#26497710)
I love writing bash!
Re:Writing Small CLI Programs in Common Lisp by Kelamir on Wednesday March 17, 2021 @02:58PM (#26495405)
Judging from the logo, the name is derived from the Russian word Babushka, which stands for a granny.
Re:Writing Small CLI Programs in Common Lisp by lambdaba on Wednesday March 17, 2021 @03:31PM (#26495814)
Indeed, it's a lovely name