Skip to content

Instantly share code, notes, and snippets.

@jboynyc
Created March 10, 2025 13:25
Show Gist options
  • Save jboynyc/23c2650bf1cb5ff36af40cbfb4d378fe to your computer and use it in GitHub Desktop.
Save jboynyc/23c2650bf1cb5ff36af40cbfb4d378fe to your computer and use it in GitHub Desktop.
Guile Goblins script with Nix shebang
#!/usr/bin/env nix-shell
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable-small.tar.gz
#! nix-shell -p guile guile-fibers guile-gnutls guile-goblins
#! nix-shell -i "guile --no-auto-compile -s"
!#
(use-modules (goblins)
(goblins actor-lib methods))
(define a-vat (spawn-vat))
(define-actor (^greeter bcom our-name)
(methods
[(greet your-name)
(format #t "Hello ~a, my name is ~a!\n" your-name our-name)]
[(rename new-name)
(bcom (^greeter bcom new-name))]))
(call-with-vat a-vat
(lambda ()
(let ([alice (spawn ^greeter "Alice")])
($ alice 'greet "Sundeep")
($ alice 'rename "Anton")
($ alice 'greet "Sundeep"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment