6 ms·
Zuo: A Tiny Racket for Scripting
- ciprian_craciun 5y agoI've quickly played with it, and from what I've seen it's almost perfect for scripting, at least due to the following reasons: * it can be linked statically, thus it should run on any Linux with a simple copy; (not by default, use `LDFLAGS=-static`;) * it can embed in the binary the core library (and other libraries of choice), thus there is no need for other files to be installed; (this is not by default, but by using the `image.zuo` directly one can get this;) * it has minimal startup latency, almost 2x lower than Python2.7, and many times less than Python3.10; (this is without the extra libraries embedded, with the extra libraries embedded it's still faster than Python2.7, but not by that a large of a margin;) I haven't yet checked the available API, but it does seem to be quite enough for simple system related scripting.
- mhitza 5y agoFor those interested in another Scheme implementation, that compiles to native code, with a fair amount of community libraries, I recommend Chicken Scheme.
- deleted 5y ago[deleted]
- threatofrain 5y agoPossible contenders. https://janet-lang.org https://janet-lang.org https://fennel-lang.org https://fennel-lang.org
- ciprian_craciun 5y agoA few years ago I've written my own (still experimental) in Rust: https://github.com/volution/vonuvoli-scheme https://github.com/volution/vonuvoli-scheme The main usecase for this was exactly scripting and systems-programming in Scheme.
- dmux 5y agoAnd https://practical-scheme.net/gauche/index.html https://practical-scheme.net/gauche/index.html
- Decabytes 5y agoI think part of the issue with using another language can be highlighted here > The problem with the current build system could be characterized as too large a gap between C and make and the next runnable element, which is either Chez Scheme or Racket BC; neither of those are simple to build. Zuo, a tiny Racket, is an intermediate step to bridge that gap.
- LesZedCB 5y agomaybe babashka too? lightweight clojure with scripting features. https://github.com/babashka/babashka https://github.com/babashka/babashka
- deleted 5y ago[deleted]
- Decabytes 5y agoThere is more information about the reason for this here^1 Below is an excerpt > As in Non-recursive Make Considered Harmful: Build Systems at Scale, we can build a better make. This commit mostly imitates Shake as described there, but in a Racket style and called "Zuo" (based on the Chinese word for "make"). The Zuo implementation started at https://github.com/mflatt/zuo https://github.com/mflatt/zuo, but here it's in the intended long-term home, racket/src/zuo. > The goal is for Racket to be be just as easy for end-users to build as now after converting scripts from make and /bin/sh to zuo. So, make should work in Racket's top-level directory, and configure plus make plus make install should work in a source directory or distribution, all with no new pre-installed packages required. The new makefiles will be small, however, just ensuring that the zuo executable is built and then handing off to Zuo scripts. 1. https://github.com/racket/racket/pull/4179 https://github.com/racket/racket/pull/4179
- rudolfwinestock 5y agoAnother example of using a Scheme for scripting is scsh, the Scheme Shell. The last update was in 2006, but it's (in)famous for the acknowledgements section written by Olin Shivers. Who should I thank? My so-called ``colleagues,'' who laugh at me behind my back, all the while becoming famous on *my* work? My worthless graduate students, whose computer skills appear to be limited to downloading bitmaps off of netnews? My parents, who are still waiting for me to quit ``fooling around with computers,'' go to med school, and become a radiologist? My department chairman, a manager who gives one new insight into and sympathy for disgruntled postal workers? My God, no one could blame me—no one!—if I went off the edge and just lost it completely one day. I couldn't get through the day as it is without the Prozac and Jack Daniels I keep on the shelf, behind my Tops-20 JSYS manuals. I start getting the shakes real bad around 10am, right before my advisor meetings. A 10 oz. Jack 'n Zac helps me get through the meetings without one of my students winding up with his severed head in a bowling-ball bag. They look at me funny; they think I twitch a lot. I'm not twitching. I'm controlling my impulse to snag my 9mm Sig-Sauer out from my day-pack and make a few strong points about the quality of undergraduate education in Amerika. If I thought anyone cared, if I thought anyone would even be reading this, I'd probably make an effort to keep up appearances until the last possible moment. But no one does, and no one will. So I can pretty much say exactly what I think. Oh, yes, the *acknowledgements*. I think not. I did it. I did it all, by myself. https://scsh.net/docu/html/man.html https://scsh.net/docu/html/man.html
- JHonaker 5y agoI really hope that's a very odd joke. This makes me extremely sad for this person.
- bjoli 5y agoThis is one of those before-columbine jokes. Olin likes writing, obviously, and I suspect he started with "I did it. I did it all, by myself" and found a way to get there.
- rubicks 5y agoI came here to see this. I used to hack scsh scripts in grad school, back when I was entirely too obsessed with functional languages. It's weird shell, but fun to use if you like that kind of thing.
- MichaelBurge 5y agoRacket has a lot of fancy features that might have runtime support. Glancing through the reference: Contracts, threads, futures, custodians, impersonators, wills & executors, ephemerons, etc. How feasible is it to run an arbitrary Racket application on top of this small core? (Even if all these features are implemented badly for ease-of-implementation) Standard Scheme seems to allow a small base, but Racket has a lot of things built-in and I'm not sure how much can be done as a library vs. needing runtime support.
- bjoli 5y agoI believe all of #lang racket is written in #lang racket/base. Zuo is only superficially like racket. You likely can't do any of the fancy things in it.
- klibertp 5y agoThere actually is a small base, called racket/base. It excludes a lot of built-in features - you can see a lot of "this module is provided by racket but not racket/base" in the docs - and people tend to use it for modules that don't need the full functionality, because it tends to make the code faster.
- MichaelBurge 5y agoAre there any actual separate implementations of it? Could r7rs Scheme be used to write a library that allows running any racket/base program, for example?
- klibertp 5y agoI'm sorry, I don't know that much about it. I don't think there are any separate implementation of it. I'd guess that as long you have call/cc you could do it, but Racket has its own specific macro system (syntax-parse, but syntax-rules and syntax-case are supported), and I don't know how much of the racket/base is built on syntax-parse; or, on the other hand, how syntax-parse is itself implemented and if it would be possible to port easily to other Schemes. The good news are that once you have racket/base, most other things in stdlib should work.
- d3nj4l 5y agoI'm super interested - I'm always on the lookout for a replacement for Ruby as my primary scripting lang. LISPs seem super cool for scripting because of the exploratory nature of the REPL - writing a script, at least for me, is a process where I have to run it dozens of times, tweaking it every time, and then finally running it regularly without monitoring, and the REPL would save so much time in the first part of this process. 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?