Skip to content
geiser-chicken logo

Geiser/Chicken Scheme: 3-Coloring Skill

geiser-chicken

Geiser REPL integration for Chicken Scheme with SplitMixTernary 3-coloring and crdt.el sexp patterns.

SKILL.md

Full skill instructions

Geiser/​Chicken Scheme: 3-Coloring Skill

Geiser is the Emacs mode for Scheme REPLs. This skill provides:

  • Chicken Scheme SplitMix64 implementation
  • 3-coloring via ternary output (-1, 0, +1)
  • crdt.el sexp manipulation
  • Penrose diagram ASCII generation

Chicken Scheme SplitMix64

;;; chicken_splitmix.scm

(define GOLDEN #x9E3779B97F4A7C15)
(define MIX1 #xBF58476D1CE4E5B9)
(define MIX2 #x94D049BB133111EB)
(define MASK64 #xFFFFFFFFFFFFFFFF)

(define (make-splitmix64 seed)
  (let ((state (bitwise-and seed MASK64)))
    (lambda ()
      (set! state (bitwise-and (+ state GOLDEN) MASK64))
      (let* ((z state)
             (z (bitwise-and (* (bitwise-xor z (arithmetic-shift z -30)) MIX1) MASK64))
             (z (bitwise-and (* (bitwise-xor z (arithmetic-shift z -27)) MIX2) MASK64)))
        (bitwise-xor z (arithmetic-shift z -31))))))

(define (splitmix-ternary rng)
  ;; Map u64 to {-1, 0, +1}
  (- (modulo (rng) 3) 1))

(define (color-at seed index)
  (let ((rng (make-splitmix64 seed)))
    (do ((i 0 (+ i 1))) ((= i index))
      (rng))
    (let ((h (rng)))
      (list (+ 10 (* (/ (bitwise-and h #xFF) 255.0) 85))          ; L
            (* (/ (bitwise-and (arithmetic-shift h -8) #xFF) 255.0) 100)  ; C
            (* (/ (bitwise-and (arithmetic-shift h -16) #xFFFF) 65535.0) 360))))) ; H

3-Coloring for Graphs

;;; 3-color a graph using SplitMixTernary

(define (graph-3-color vertices edges seed)
  (let ((rng (make-splitmix64 seed))
        (colors (make-hash-table)))
    ;; Assign initial colors
    (for-each
      (lambda (v)
        (hash-table-set! colors v (splitmix-ternary rng)))
      vertices)
    ;; Verify no adjacent same-color (greedy fix)
    (let loop ((changed #t))
      (when changed
        (set! changed #f)
        (for-each
          (lambda (e)
            (let ((c1 (hash-table-ref colors (car e)))
                  (c2 (hash-table-ref colors (cadr e))))
              (when (= c1 c2)
                (hash-table-set! colors (cadr e) (modulo (+ c2 1) 3))
                (set! changed #t))))
          edges)))
    colors))

Geiser REPL Commands

;; In Emacs with Geiser

;; Start Chicken REPL
M-x geiser-connect RET chicken RET

;; Load color module
,load chicken_splitmix.scm

;; Generate colors
(color-at #x6761795f636f6c6f 1)
;; => (95.64 75.69 40.58)

;; Get ternary stream
(let ((rng (make-splitmix64 1069)))
  (map (lambda (_) (splitmix-ternary rng)) (iota 10)))
;; => (0 1 -1 0 1 1 -1 0 -1 1)

crdt.el Sexp Patterns

For collaborative editing with crdt.el:

;;; Sexp with metadata for crdt.el

(define (sexp-with-meta sexp author timestamp)
  `(,@sexp
    :meta (:author ,author
           :timestamp ,timestamp
           :color ,(color-at (string-hash author) timestamp))))

;;; Damage detection (changed sexps)
(define (sexp-damaged? sexp-old sexp-new)
  (not (equal? sexp-old sexp-new)))

;;; Copy-on-flight: fork sexp with new identity
(define (sexp-fork sexp new-author)
  (let ((old-meta (sexp-meta sexp)))
    (sexp-with-meta (sexp-data sexp)
                    new-author
                    (current-seconds))))

Penrose Diagram Generation

;;; ASCII Penrose tiles (P3 rhombus)

(define (penrose-tile type)
  (case type
    ((thin)
     '("  /\\"
       " /  \\"
       "/​____\\"))
    ((thick)
     '(" /\\"
       "/  \\"
       "\\  /"
       " \\/"))))

(define (penrose-row n seed)
  (let ((rng (make-splitmix64 seed)))
    (map (lambda (_)
           (if (> (splitmix-ternary rng) 0)
               (penrose-tile 'thin)
               (penrose-tile 'thick)))
         (iota n))))

GF(3) Conservation

(define (gf3-conserved? trits)
  ;; Check every window of 3
  (let loop ((ts trits))
    (cond
      ((< (length ts) 3) #t)
      ((not (zero? (modulo (apply + (take ts 3)) 3))) #f)
      (else (loop (cdr ts))))))

(define (enforce-gf3 trits)
  ;; Adjust middle element to conserve GF(3)
  (if (< (length trits) 3)
      trits
      (let* ((a (car trits))
             (b (cadr trits))
             (c (caddr trits))
             (new-b (modulo (- (+ a c)) 3)))
        (cons a (cons (- new-b 1) (enforce-gf3 (cddr trits)))))))

Commands

just geiser-colors      # Generate color palette in Chicken
just geiser-3color      # 3-color a test graph
just penrose-ascii      # Generate Penrose tiling

Scientific Skill Interleaving

This skill connects to the K-Dense-AI/​claude-scientific-skills ecosystem:

Graph Theory

  • networkx [○] via bicomodule
    • Universal graph hub

Bibliography References

  • general: 734 citations in bib.duckdb

SDF Interleaving

This skill connects to Software Design for Flexibility (Hanson & Sussman, 2021):

Primary Chapter: 3. Variations on an Arithmetic Theme

Concepts: generic arithmetic, coercion, symbolic, numeric

GF(3) Balanced Triad

geiser-chicken (○) + SDF.Ch3 (○) + [balancer] (○) = 0

Skill Trit: 0 (ERGODIC - coordination)

Secondary Chapters

  • Ch6: Layering
  • Ch4: Pattern Matching
  • Ch1: Flexibility through Abstraction

Connection Pattern

Generic arithmetic crosses type boundaries. This skill handles heterogeneous data.

Cat# Integration

This skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:

Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826

GF(3) Naturality

The skill participates in triads satisfying:

(-1) + (0) + (+1) ≡ 0 (mod 3)

This ensures compositional coherence in the Cat# equipment structure.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View