Skip to content

Instantly share code, notes, and snippets.

View gambiteer's full-sized avatar

Bradley Lucier gambiteer

View GitHub Profile
@gambiteer
gambiteer / gist:40d1c2d5a1995df401c873ad9d333e48
Last active June 24, 2025 18:20
Caching exponentials of computable reals
(define basic-expt
(let ((global-exponent-table
(make-table weak-keys: #t weak-values: #t test: eq?)))
;; x is a computable real
;; n is an exact integer
(define (global-return x closure)
(table-set! global-exponent-table x closure)
closure)
@gambiteer
gambiteer / gambit-life.scm
Created April 19, 2025 18:30
Conway's Game of Life in Gambit Scheme with SRFI 231
(declare
(standard-bindings)
(extended-bindings)
(block)
(not inline) ;; inlining distorts what I want to measure
(safe) ;; default declaration, made explicit
)
(import (srfi 231))
(declare (standard-bindings)(extended-bindings)(block)(fixnum)(not safe))
;;; From Text-File Databases at https://sites.google.com/site/schemephil/
;;; READ-CSV-RECORD [SEP] [PORT]
(define (read-csv-record . args)
(define (add-char-to-field c field)
(let ((length (field-length field))