ausimian

ausimian

Schooner is a sandboxed Scheme interpreter you embed in an Elixir app (like Lua/Luerl but with more parentheses). It targets r7rs-small minus its mutable operations — no set!, set-car!, vector-set!, etc. — which keeps the value model immutable and friendly to BEAM idioms. The host hands a script source to Schooner.eval/2, gets back a tagged Elixir term, and resource-bounds the work with the standard process tools (:max_heap_size, Task.shutdown/2).

alias Schooner.Host

env =
  Schooner.Environment.new(
    libraries: [
      Host.library(
        primitives: [
          {"shout", 1, fn [msg] ->
             text = msg |> Host.to_string!(op: "shout") |> String.upcase()
             Host.string(text <> "!")
           end}
        ]
      )
    ]
  )

Schooner.eval(~s|(import (scheme base)) (shout (string-append "hello, " "world"))|, env)
# => {:ok, "HELLO, WORLD!"}

It implements most of r7rs-small, the deviations are listed in the documentation.

https://github.com/ausimian/schooner

Showing Posts 1 to 3

kip

kip

ex_cldr Core Team

As someone who grew up with Maclisp and John McCarthy I find this unreasonably exciting. And much more of a mental model that works for me than Lua. Thanks for making this happen - I’ll be sure to give it a spin on something. In fact I’ll just have to invent something so I can use it :slight_smile:

I still think the Moonual is one of the best technical manuals ever written. It was my reference during many late night session on the System-M Multics system. Multics, Maclisp and Emacs were probably why I got hooked on computing.

ausimian

ausimian OP

I published 1.1.0 of Schooner. Its a mixture of performance improvements, docs tidy up and bug fixes.

The details are in the changelog.

ausimian

ausimian OP

I published 1.2.0 of Schooner. This was mostly improvements to tooling, notably:

  • Source locations in errors (yay)
  • Backtraces in errors
  • A mix task, schooner.check that will check (but not run) your scripts for unbound names, incorrect arity calls etc
  • A mix task, schooner.expand that will expand macro definitions
  • A mix task schooner.repl that will drop you into a repl where you can load scripts and evaluate expressions - from the tooling docs:
mix schooner.repl --env MyApp.Scripts.environment --load scripts/pricing.scm
Schooner 1.1.0 — environment: MyApp.Scripts.environment/0. ,help for commands.
schooner> (line-total "widget" 3)
30
schooner> (define (with-shipping x)
     ...>   (+ x 5))
schooner> (with-shipping 30)
35
schooner> (char-upcase #\a)
error: unbound variable: char-upcase
schooner> (import (scheme char))
schooner> (char-upcase #\a)
#\A
schooner> ,env unit
unit-price  (myapp catalog)  procedure, 1 arg
schooner> ,expand (when ok (go))
(if ok (begin (go)))
schooner> ,time (order-total '(("widget" . 2) ("gadget" . 1)))
30  ; 0.1ms, 1650 reductions
schooner> ,quit
— All posts loaded —

Where Next? Top

Trending in Announcing Top

restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 12366 136
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New
kip
Following on from my CLDR lbraries I started work on Unicode transforms. But like everything related to CLDR there is a lot of yak-shavin...
New

Other Trending Topics Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews