Created
March 10, 2025 13:25
-
-
Save jboynyc/23c2650bf1cb5ff36af40cbfb4d378fe to your computer and use it in GitHub Desktop.
Guile Goblins script with Nix shebang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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