Hacker News new | past | comments | ask | show | jobs | submit login
Zuo: A tiny Racket for scripting (racket-lang.org)
105 points by soegaard on Nov 11, 2022 | hide | past | favorite | 25 comments




Thanks! Macroexpanded:

Zuo: A Tiny Racket for Scripting - https://news.ycombinator.com/item?id=31017057 - April 2022 (31 comments)


If I want to write scripts in lisp (and I do!) I use babashka. https://babashka.org/.

If I'm working on one project for some time I'll write a throwaway bb.edn with tasks for things I need to do often, for example to monitor a kubernetes pod, log it, and hit certain API endpoints. Then when I'm in the project directory I can just run `bb tsj` (e.g. test sign job).


I don't understand this brand of comment, which seem to be fairly prevalent here on HN.

Are you saying that you prefer babashka to zuo? Have you actually used zuo? Or did you only want to pontificate on another project with a potentially related goal, but without actually connecting those dots for readers of your comment?

My issue (not quite the right word, but close enough) with this kind of comment is it's kind of rude, in my opinion? Like, imagine if you were standing around with some people, and somebody said "I just learned about Zuo! It's this neat Racket alternative that's very small. It's a super cool project, and I've really enjoyed it!" And you reply with "When I want a small Lisp, I use babashka." And you don't connect it to the conversation at hand, and it's up to the other people to figure out what your point is. It's like... it's almost a non sequitur, in some sense. And comments like these seem super common here for some reason. It just kinda rubs me the wrong way, though I guess judging by their prevalence they are not seen this way by most people here, so perhaps my perception is in the wrong.


Not the commenter you replied to, but I see where you are coming from. I see things differently though, I like comments like the above because if I'm interested in Zuo or scripting lisp/scheme in general, I like finding related projects in the comments. I guess I read comments like those as if they started with an implicit "if the topic interests you, here are related things".


> I guess I read comments like those as if they started with an implicit "if the topic interests you, here are related things".

Hmm maybe I should try to read them that way and I'd be less bothered. Still, I wish they would actually explicitly say as much. It's only a few words, but (in my opinion) it feels like it completely shifts the tone from "the tool this article is about is useless, use this other tool instead" to an educational/helpful thing, which is much nicer.


I think this is another case where the fact that you can't get a person's tone of voice via text causes people to take things the wrong way.

As another person said of themselves, I like the fact that people on HN point to other tools they use in a way that is related to the one being discussed in the comments. That makes HN a good place to find out about tools you hadn't heard of.

I didn't think the original comment was intended to be dismissive of zuo, but they were just pointing out their preference for a tool in that vein (which made sense to me since both are lisp-ish languages made for shell scripting).


I definitely see where you're coming from, but I think what gets me is that a lot of these comments don't actually know much about the specific tool being discussed; they just talk about a related tool instead.

If the parent commenter had said, e.g., "Zuo seems to have chosen to do X to address issue Foo, but this other tool took approach Y instead, and I like that better" — well that seems a lot more constructive, and on-topic. But just saying "I use <other tool>" is like... it doesn't belong. It's off-topic, in a way? Not strictly speaking, but enough so that it makes me a bit uncomfortable. It gives me vibes of, like... questioning the subject tool's "right to exist", so to speak, because "why would I use <tool the article is about> when I already know <other tool>!" without actually showing any effort to understand the differences.

I dunno if I'm explaining my thoughts here well. It's not a huge deal, and I definitely have also found some of these comments to be useful in the past, but their general tone rubs me the wrong way just slightly and I thought maybe it was worth commenting on.


What makes zuo easy to use for other projects:

  Compile "zuo.c" from the Zuo sources with a C compiler. No additional are files 
  needed for compilation, other than system and C-library headers. No compiler 
  flags should be needed, although flags like -o zuo or -O2 are a good idea.


Source is https://github.com/racket/zuo/blob/main/zuo.c - skimmed through it, looks like fairly straightforward C. Quite short implementation.


A long time ago I used to really enjoy scsh (https://scsh.net), for writing scripting applications with scheme. You can get a lot done with it once you get the feel.

The last release was 2006 however, and though some folks have ported it to work 64bit, I've completely lost track of how to set that up.

Wondering how Zuo and Gerbil stack up to scsh or if anyone here has any opinions to share.


I just set up scsh again (64 bit macos). First re-installed scheme48, then re-installed scsh. Took 5 minutes. Now I have to re-learn scsh.


Gerbil's docs are incomplete right now, which makes starting out for the uninitiated Schemer rather difficult.


...and been that way for a couple of years at least


As always with lisps, you’ve got quite a bit of competition in the space of minimal implementations. I like Fennel or Janet. Fennel transpiles to Lua, giving you a pretty big ecosystem for free. Janet was built to be a “modern” tiny Lisp that can run interpreted or AoT compiled.


For something scheme like, my mind immediately goes to chibi-scheme. Larger than this for sure, but still statically linkable.

If you're willing to dynamically link, guile seems like a good choice. Almost 30 years old at this point, and seems to be getting a bit of a revival with guix.


There is also Otus Lisp (ol) - http://yuriy-chumak.github.io/ol/


Single C source file. Very cool, it's one of those "let make the decision easy for you" moves, where you might be hesitant to include a scripting lang in your project.

The docs mention you can embed Zuo almost as an afterthought, but surely that's the main point of it?


The main purpose seems to be something that you can use in the bootstrap/build process for a bigger application. I believe that's what Racket itself uses Zuo for.

A lot more robust than a shell script and just as portable, if not moreso.


Any examples that would help to compare against other forms of scripting (e.g. bash)?


https://github.com/racket/zuo/blob/main/local/tree.zuo is a pretty good example.

It’s nothing like Bash; it’s a Lisp dialect.

The obvious comparison is Lua, which is generally the standard embedded language people use when a scripting language needs to be tiny. I compared its size; Zuo is 55% the size of Lua, so apples to apples, Zuo is only a little over half the size of Lua. On the other hand, Lua uses a Pascal like syntax which is a good deal more Bash like than Zuo.


Zua?


Is Zua a Lua variant the size of Zuo? I like the idea.

Going back to the Bash comparison, Bash is huge but the subset ash is pretty small, somewhat smaller than Zuo. Busybox’s AWK is, as I recall, about half the size of Zuo. We can have a POSIX compliant scripting setup (ash + AWK) using around the same amount of space Zuo takes up.


There's minilua (https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/host/minilua....) which is used to build LuaJIT (dynasm, etc)


    > You should use Racket to write scripts. 
    > But for the case where you need something much smaller than
    > Racket for some reason, or the case you’re trying to script 
    > the build of Racket itself, Zuo is a tiny Racket with 
    > primitives for dealing with files and running processes.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: