MCPcopy Create free account
hub / github.com/baku89/glisp

github.com/baku89/glisp @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
462 symbols 1,262 edges 75 files ⚖ MIT 4 documented · 1% ● updated 9d ago★ 1,20110 open issues

Browse by type

⨍ Functions 358◇ Types & classes 104
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Glisp

A small functional language for embedding in creative software, and a vector drawing app built on it. A program can be edited as text, as blocks, or by dragging what it draws on a canvas.

This is a work in progress, and the language may still change.

Glisp Canvas, with a program in the code panel, the shapes it draws with one selected, and the parameters of that shape in the inspector

Example

turn = (/ tau 96)
ring = (map (range 0 96) (=> [i: number]: _
  [(+ 400 (* 290 (cos (* i turn))))
   (+ 400 (* 290 (sin (* i turn))))]))
[
  dots = (spray ring 7 3 26 44 "#ff4d2e" "#ffd23f")
  rays = (map (range 0 24) (=> [i: number]: _
    (style
      (path.line
        [(+ 400 (* 70 (cos (* i 4 turn)))) (+ 400 (* 70 (sin (* i 4 turn))))]
        [(+ 400 (* 215 (cos (* i 4 turn)))) (+ 400 (* 215 (sin (* i 4 turn))))])
      stroke: "#ffffff" width: 3)))
  bg = (solid "#1473e6")
]

A ring of orange dots around white lines on blue, as the program above draws it

About

Glisp stands for Graphical LISP. A project in the drawing app is a Glisp program: dragging a handle on the canvas rewrites a value in the program, and the program can be edited as code at any time. The app is not aimed at one kind of graphics.

In the language:

  • Evaluation does not change the AST or any environment. An effect is an IO value that the host runs.
  • There is no clock or built-in source of entropy. random makes a sequence from a seed, which is part of the program.
  • An error in a program gives () and a diagnostic, rather than throwing. A typed slot turns () into its type's default.
  • Types are sets of values, with structural subtyping.
  • Results are cached on what a node refers to, so a value that an edit did not affect stays ===.
  • solve works out what to write in the program for a value to come out as wanted, which is how dragging works.
  • @glisp/lang has no dependencies.

See the guide and the specification.

Development

git clone --recurse-submodules https://github.com/baku89/glisp
cd glisp
npm install

npm run dev:canvas   # the drawing app
npm run dev          # the website, with the guide and the playground
npm run repl         # a REPL in the terminal
npm test
npm run typecheck
Directory
packages/lang The language, @glisp/lang
packages/repl The terminal REPL
packages/tweeq Editing an AST through Tweeq widgets
site/canvas The drawing app
site/lang The website
spec The specification, whose marked examples run as tests

The drawing app uses pave for paths, geome for geometry, and linearly for vectors.

Not done yet

  • Tools that can be written by the user
  • A timeline, and video export
  • Raster images and GLSL filters
  • Binding controllers over OSC or MIDI

Earlier version

The first version, from 2020, was a design tool with an interpreter based on Make a Lisp. It is still online. This repository has since been rewritten.

Related projects

Credits

By Baku Hashimoto. Thanks to Naoto Hieda for examples, suggestions and translation, and to the sponsors.

MIT License. See LICENSE.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 275
Method 83
Interface 56
Class 46
Enum 2

Languages

TypeScript100%

Modules by API surface

repl/index.js93 symbols
src/mal/types.ts54 symbols
src/mal-lib/path.ts35 symbols
src/mal/schema.ts32 symbols
src/mal/reader.ts27 symbols
public/gif.worker.js24 symbols
src/mal/utils.ts20 symbols
src/@types/modules.d.ts20 symbols
src/mal/env.ts15 symbols
src/mal/scope.ts12 symbols
src/utils.ts11 symbols
src/components/ViewHandles/use-handle.ts8 symbols

For agents

$ claude mcp add glisp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page