SkillAgentSearch skills...

Goldfish

Goldfish Scheme / 金鱼Scheme

Install / Use

/learn @MoganLab/Goldfish
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Goldfish Scheme / 金鱼 Scheme

Make Scheme as easy to use and practical as Python!

Goldfish Scheme is a Scheme interpreter with the following features:

  • R7RS-small compatible
  • Scala-like functional collection
  • Python-like versatile standard library
  • Small and fast
<img src="GoldfishScheme-logo.png" alt="示例图片" style="width: 360pt;">

Demo Code

Named parameter

(define* (person (name "Bob") (age 21))
  (string-append name ": " (number->string age)))

(person :name "Alice" :age 3)

Unicode Support

(import (liii lang))

($ "你好,世界" 0) ; => 你
($ "你好,世界" 4) ; => 界
($ "你好,世界" :length) ; => 5

Functional Data Pipeline

With prime? provided, filter twin prime numbers in this way:

(import (liii lang))

(($ 1 :to 100)
 :filter prime?
 :filter (lambda (x) (prime? (+ x 2)))
 :map (lambda (x) (cons x (+ x 2)))
 :collect)

Scala like case class

(define-case-class person
  ((name string?)
   (age integer?))

  (define (%to-string)
    (string-append "I am " name " " (number->string age) " years old!"))
  (define (%greet x)
    (string-append "Hi " x ", " (%to-string))))

(define bob (person "Bob" 21))

(bob :to-string) ; => "I am Bob 21 years old!"
(bob :greet "Alice") ; => "Hi Alice, I am Bob 21 years old!"

Performance Warning: define-case-class is implemented via macros and has significant performance overhead. It is suitable for hand-written code and prototyping, but not recommended for AI-generated code or production deployments.

Simplicity is Beauty

Goldfish Scheme still follows the same principle of simplicity as S7 Scheme. Currently, Goldfish Scheme only depends on S7 Scheme, tbox and C++ standard library defined in C++ 98.

Just like S7 Scheme, src/goldfish.hpp and src/goldfish.cpp are the only key source code needed to build the goldfish interpreter binary.

Standard Library

Scala-like collections

| Library | Description | |---------|-------------| | (liii rich-char) | boxed char with rich char and instance methods | | (liii rich-string) | boxed string with rich char and instance methods | | (liii rich-list) | boxed list with rich static and instance methods | | (liii rich-vector) | boxed vector with rich static and instance methods | | (liii rich-hash-table) | boxed hash-table with rich static and instance methods | | (liii rich-path) | boxed path with rich static and instance methods |

Python-like standard library

| Library | Description | Example functions | | ------------------------------------------------- | ------------------------------------ | ---------------------------------------------------------------- | | (liii base) | Basic routines | ==, !=, display* | | (liii error) | Python like Errors | os-error to raise 'os-error just like OSError in Python | | (liii check) | Test framework based on SRFI-78 | check, check-catch | | (liii case) | Pattern matching | case* | | (liii list) | List Library | list-view, fold | | (liii bitwise) | Bitwise Library | bitwise-and, bitwise-or | | (liii string) | String Library | string-join | | (liii vector) | Vector Library | vector-index | | (liii hash-table) | Hash Table Library | hash-table-empty?, hash-table-contains? | | (liii sys) | Library looks like Python sys module | argv | | (liii os) | Library looks like Python os module | getenv, mkdir | | (liii path) | Path Library | path-dir?, path-file? | | (liii range) | Range Library | numeric-range, iota | | (liii option) | Option Type Library | option?, option-map, option-flatten | | (liii uuid) | UUID generation | uuid4 |

SRFI

| Library | Status | Description | | ----------------- | -------- | ---------------------------- | | (srfi srfi-1) | Part | List Library | | (srfi srfi-8) | Complete | Provide receive | | (srfi srfi-9) | Complete | Provide define-record-type | | (srfi srfi-13) | Complete | String Library | | (srfi srfi-16) | Complete | Provide case-lambda | | (srfi srfi-39) | Complete | Parameter Objects | | (srfi srfi-78) | Part | Lightweigted Test Framework | | (srfi srfi-125) | Part | Hash Table | | (srfi srfi-133) | Part | Vector | | (srfi srfi-151) | Part | Bitwise Operations | | (srfi srfi-196) | Complete | Range Library | | (srfi srfi-216) | Part | SICP |

R7RS Standard Libraries

| Library | Description | | ---------------------- | --------------------- | | (scheme base) | Base library | | (scheme case-lambda) | Provide case-lambda | | (scheme char) | Character Library | | (scheme file) | File operations | | (scheme time) | Time library |

Installation

Goldfish Scheme is bundled in Mogan Research (since v1.2.8), just install Mogan Research to install Goldfish Scheme.

Besides the Goldfish Scheme interpreter, a nice structured Goldfish Scheme REPL is availabe in Mogan Research.

The following guide will help you build and install Goldfish step by step.

GNU/Linux

Here are commandlines to build it on Debian bookworm:

sudo apt install xmake git unzip curl g++
git clone https://gitee.com/LiiiLabs/goldfish.git
# git clone https://github.com/LiiiLabs/goldfish.git
cd goldfish
xmake b goldfish
bin/gf --version

You can also install it to /opt:

sudo xmake i -o /opt/goldfish --root
/opt/goldfish/bin/gf

For uninstallation, just:

sudo rm -rf /opt/goldfish

macOS

Here are commandlines to build it on macOS:

brew tap MoganLab/goldfish
brew install goldfish

For uninstallation, just:

brew uninstall goldfish

Commandlinefu

This section assumes you have executed xmake b goldfish sucessfully and bin/gf is available.

Subcommands

Goldfish Scheme uses subcommands for different operations:

| Subcommand | Description | |------------|-------------| | help | Display help message | | version | Display version information | | eval CODE | Evaluate Scheme code | | load FILE | Load Scheme file and enter REPL | | repl | Enter interactive REPL mode | | run TARGET | Run main function from target | | test | Run tests | | fix PATH | Format Scheme code | | FILE | Load and evaluate Scheme file directly |

Display Help

Without any command, it will print the help message:

> bin/gf
Goldfish Scheme 17.11.32 by LiiiLabs

Commands:
  help               Display this help message
  version            Display version
  eval CODE          Evaluate Scheme code
  load FILE          Load Scheme code from FILE, then enter REPL
  ...

Display Version

version subcommand will print the Goldfish Scheme version and the underlying S7 Scheme version:

> bin/gf version
Goldfish Scheme 17.11.32 by LiiiLabs
based on S7 Scheme 11.5 (22-Sep-2025)

Evaluate Code

eval subcommand helps you evaluate Scheme code on the fly:

> bin/gf eval "(+ 1 2)"
3
> bin/gf eval "(begin (import (srfi srfi-1)) (first (list 1 2 3)))"
1
> bin/gf eval "(begin (import (liii sys)) (display (argv)) (newline))" 1 2 3
("bin/gf" "eval" "(begin (import (liii sys)) (display (argv)) (newline))" "1" "2" "3")

Load File

load subcommand helps you load a Scheme file and enter REPL:

> bin/gf load tests/goldfish/liii/base-test.scm
; load the file and enter REPL

Run File Directly

You can also load and evaluate a Scheme file directly:

> bin/gf tests/goldfish/liii/base-test.scm
; *** checks *** : 1973 correct, 0 failed.

Mode Option

-m or --mode helps you specify the standard library mode:

  • default: -m default is the equiv of -m liii
  • liii: Goldfish Scheme with (liii oop), (liii base) and (liii error)
  • scheme: Goldfish Sch

Related Skills

View on GitHub
GitHub Stars86
CategoryDevelopment
Updated22h ago
Forks32

Languages

C

Security Score

100/100

Audited on Mar 27, 2026

No findings