I’m gonna bet yes for the simple reason that various helper scripts exist that do advanced cd history, with fuzzy search and whatnot, and they can’t be implemented as anything other than functions.
Y u no Mamaleek
- 0 Posts
- 20 Comments
where in your pipe you got a non-null exit code
First thing you want is
set -eandset -o pipefail. That should report the errors in human-parseable form.Second, to capture exit codes from each command/program, you have to run each of them in sequence yourself, connected by pipes that you create via
mkfifo— the same way as you would do it in any other programming environment. Bash’s|pipes are just a convenient shorthand for this, so if you want full control, you have to ditch the convenience.
In Emacs Lisp, you use one of these two:
(defun funcname (arg1 arg2) (+ arg1 arg2))(lambda (arg1 arg2) (+ arg1 arg2))— with the latter typically being an argument to another function or macro.
In Lisp, at least the Emacs Lisp with which I have experience, it’s customary to put in
nil(Lisp’s null) for any omitted arguments in the middle that you can’t be arsed to specify — aside from just leaving off arguments at the end. In JS, typing inundefinedin every such case would probably be an annoyance, so I’m guessing coders need to check for bothundefinedandnullin these circumstances.Overall, it’s remarkable how Lisp teaches one to be much more relaxed about programming practices than is typical for mainstream languages. Design patterns? Data structures? Shit, just pass in a list or an assoc array, and maybe a function here and there. Also everything is an expression, enjoy your ternary
(if)at any point anywhere.
Remarkable how if the parenthesis is shifted from
lambda()to(lambda), people lose the ability to comprehend things.
Functions are definitely not subshells in Bash, seeing as anything modifying the environment, like
pyenvand such, is implemented as functions instead of scripts — specifically because functions are run in the same shell instance.Unless ‘subshell’ means something in the vein of ‘like a new shell, but not really’.
I mean, the go-to approach in Lisp, for example, is to have null as the default value (which doubles for false in there). And check for that in the function.
Lisp programmers seeing these ‘amazing things’:

But yeah, every time I’m trying to do a ternary in Lua, I miss being able to just throw in an
if. Thankfully it can be amended with Fennel.
SlurpingPus@lemmy.worldto
Linux@programming.dev•What are the silliest reasons people have given you for not wanting to try Linux?
1·3 days agoDoesn’t git use some kind of shim for symlinks on Windows? So they don’t break when committing back in.
SlurpingPus@lemmy.worldto
Open Source@lemmy.ml•Zork I, Zork II and Zork III are now officially open source
22·3 days agoWhat are you gonna be improving in fifty-year-old classics?
SlurpingPus@lemmy.worldto
Open Source@lemmy.ml•Zork I, Zork II and Zork III are now officially open source
22·3 days agoNot only we had compilers to z-code for a long time, but in fact first third-party languages for the z-machine were better than Infocom’s own, which was discovered from their leaked code. So I’d guess reversing the bytecode isn’t a problem either for a while now.
SlurpingPus@lemmy.worldto
Open Source@lemmy.ml•Zork I, Zork II and Zork III are now officially open source
62·4 days agoConsidering that afaik they were shipped in Z-code, the game code was already visible to any Z-machine implementation and to whoever wanted to fiddle with raw Z-code.
That one is pretty good, though the Roman numerals are rather busy and uneven.
This one is closer, though now I have to wonder if all non-square rectangular clocks have an old-timey whiff for me, or it’s just the border here:

This is also impressive:

I dig the square clock, and am now sad that the numbers can’t be put into the corners on a real clock. Unless they’re shifted from the usual position.
SlurpingPus@lemmy.worldto
Programmer Humor@programming.dev•Some of you guys haven't used luarocks and it shows
4·11 days agoThere’s a Lua module for Nginx, and in particular OpenResty bundles those two. Lua is snappy as hell, especially in the LuaJIT variant, and uses very little memory — so when it’s paired with Nginx, one could probably run a performant web app on a toaster.
SlurpingPus@lemmy.worldto
Programmer Humor@programming.dev•Some of you guys haven't used luarocks and it shows
1·11 days agoThese days there are ten packages for every task.
SlurpingPus@lemmy.worldto
Programmer Humor@programming.dev•Some of you guys haven't used luarocks and it shows
2·11 days agoLua works smooth like butter with binary libraries written in C (since it’s made to be embeddable in C), but also it’s so fast that for many things people just do libraries in plain Lua.
SlurpingPus@lemmy.worldto
Linux@programming.dev•What you do with your windows button on your keyboard?
1·11 days agoI remapped alt to ctrl as God intended, and ‘windows’ and the context-menu keys to alt. Coincidentally, the ctrl keys stopped working on my laptop for some reason, but if they worked, I’d map them to ‘super’ and put some obscure os-wide functions on there, like enabling/disabling Bluetooth. Or would just switch to English and my language with one press of a particular key.

‘c’ and ‘t’ should definitely be hit with different fingers if you do touch-typing. But with one hand, that’s true.