Skip to content

Instantly share code, notes, and snippets.

View keenbug's full-sized avatar

Daniel Krüger keenbug

  • region Karlsruhe/Heidelberg, Germany
View GitHub Profile
#lang racket
(require plot)
(plot (line sin)
#:x-min (- pi)
#:x-max pi
#:title "y = sin(x)")
@keenbug
keenbug / homs.scm
Created March 9, 2012 16:12 — forked from ijp/homs.scm
added fast and dirty import
;;; higher order modules for guile
(define-syntax-parameter provide ; an "export" for `module' forms
(lambda (stx)
(syntax-violation 'provide "provide used outside a module form" stx)))
(define-syntax module
(lambda (stx)
(syntax-case stx (import)
((module (import lib libs ...) (params ...) body ...)
@keenbug
keenbug / sparse-sets.scm
Created March 10, 2012 11:10
A sparse-set implementation in Guile
;;; Solution to a Programming Praxis task
;;; see http://programmingpraxis.com/2012/03/09/sparse-sets/
(define-module (programming-praxis sparse-sets)
#:use-module (srfi srfi-9)
#:export (make-sparse-set sparse-set-clear!
sparse-set-member?
sparse-set-add! sparse-set-remove!
sparse-set-for-each)
@keenbug
keenbug / system-repl-command.scm
Created March 28, 2012 15:22
fix for describe meta-command in guile
(define-meta-command (describe repl (form))
"describe OBJ
Show description/documentation."
(display
(object-documentation
(let ((input (repl-parse repl form)))
(if (symbol? input)
(module-ref (current-module) input)
(repl-eval repl input)))))
(newline))
@keenbug
keenbug / frp-test.scm
Created April 5, 2012 14:29
A FRP Implementation for Guile Scheme a la FrTime
#!/usr/bin/guile -s
!#
(use-modules (gnome-2)
(srfi srfi-1)
(imi frp)
(imi frp-standard))
(use-modules (gnome gtk)
(imi frp-gobject))
@keenbug
keenbug / guilerobots.scm
Created April 7, 2012 14:08
The beginning of a gnurobots clone in Guile 2.0
#!/usr/bin/env guile -s
!#
(use-modules (gnome-2)
(cairo)
(system base pmatch)
(srfi srfi-1)
(srfi srfi-8)
(imi frp))
(use-modules (gnome gobject)
@keenbug
keenbug / gist:2371678
Created April 12, 2012 23:08
simple (ice-9 occam-channel) echo example in guile
(define-module (channels)
#:use-module (ice-9 occam-channel)
#:export (start-echo))
;;; use like this:
;;; > (define c (start-echo))
;;; > (! c 'test)
;;; > (? c)
;;; $1 = (echo test)
;;; > (! c '(some more "input data"))