[HN Gopher] Zuo: A tiny Racket for scripting
       ___________________________________________________________________
        
       Zuo: A tiny Racket for scripting
        
       Author : soegaard
       Score  : 93 points
       Date   : 2022-11-11 13:19 UTC (9 hours ago)
        
 (HTM) web link (docs.racket-lang.org)
 (TXT) w3m dump (docs.racket-lang.org)
        
       | ryanianian wrote:
       | Any examples that would help to compare against other forms of
       | scripting (e.g. bash)?
        
         | strenholme wrote:
         | 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.
        
           | cheaprentalyeti wrote:
           | Zua?
        
             | strenholme wrote:
             | 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.
        
               | tekknolagi wrote:
               | There's minilua (https://github.com/LuaJIT/LuaJIT/blob/v2
               | .1/src/host/minilua....) which is used to build LuaJIT
               | (dynasm, etc)
        
       | nisa wrote:
       | There is also Otus Lisp (ol) - http://yuriy-chumak.github.io/ol/
        
       | Graziano_M wrote:
       | 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).
        
         | DonaldPShimoda wrote:
         | 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.
        
           | nocman wrote:
           | 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).
        
           | jjnoakes wrote:
           | 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".
        
       | soegaard wrote:
       | 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.
        
       | 0cf8612b2e1e wrote:
       | 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.
        
         | LAC-Tech wrote:
         | 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.
        
       | JonChesterfield wrote:
       | Source is https://github.com/racket/zuo/blob/main/zuo.c - skimmed
       | through it, looks like fairly straightforward C. Quite short
       | implementation.
        
       | butterisgood wrote:
       | 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.
        
         | all2 wrote:
         | Gerbil's docs are incomplete right now, which makes starting
         | out for the uninitiated Schemer rather difficult.
        
           | anentropic wrote:
           | ...and been that way for a couple of years at least
        
       | newaccount2021 wrote:
        
       | soegaard wrote:
       | > 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.
        
         | [deleted]
        
       | homarp wrote:
       | previous discussion https://news.ycombinator.com/item?id=31017057
        
         | dang wrote:
         | Thanks! Macroexpanded:
         | 
         |  _Zuo: A Tiny Racket for Scripting_ -
         | https://news.ycombinator.com/item?id=31017057 - April 2022 (31
         | comments)
        
       | LAC-Tech wrote:
       | 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?
        
         | nerdponx wrote:
         | 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.
        
       ___________________________________________________________________
       (page generated 2022-11-11 23:02 UTC)