Skip to content

Instantly share code, notes, and snippets.

(import (nanopass) )
(define (msg s)
(newline)
(display s)
(newline))
(define-syntax define-constant
(lambda (x)
@akeep
akeep / match.ss
Last active July 31, 2018 03:48
Simple little pattern matcher in a syntax-case macro
;;; match.ss: a simple pattern matcher in scheme
;;;
;;; Copyright Andy Keep
;;; Licensed under the CRAPL: http://matt.might.net/articles/crapl/
;;;
;;; I've used or written variations on this kind of a match syntax
;;; for a long time now and finally decided to pull together one of
;;; my own. It matches some in syntax and probably inadvertantly
;;; steals some of the design pattern (in this case the success and
;;; failure continuations, but was written from scratch and could
@akeep
akeep / cptypes.ss.diff
Created May 24, 2018 00:42
Updated cptypes.ss
65c65
< (define $cptypes
---
> (define $cptypes)
70a71,72
> (define-pass cptypes : Lsrc (ir) -> Lsrc ()
> (definitions
77c79
< (let ([k (eq-hashtable-ref known (prelex-operand x) #f)])
---
@akeep
akeep / my-matrix.ss
Created December 27, 2017 05:16
Optimizing matrix multiple example, side trial 2: use a vector of byte vectors to represent the matrix
#|
usage:
> (import (my-matrix))
> (sanity)
#t
> (run-bench)
500 x 500 matrix multiply in Chez took 2472 msec
500 x 500 matrix multiply in Chez took 2474 msec
...
@akeep
akeep / my-matrix.ss
Last active October 10, 2020 19:56
Optimizing matrix multiple example, side trial: use a flat byte vector to represent the matrix
#|
usage:
> (import (my-matrix))
> (sanity)
#t
> (run-bench)
500 x 500 matrix multiply in Chez took 2472 msec
500 x 500 matrix multiply in Chez took 2474 msec
...
@akeep
akeep / my-matrix.ss
Created December 27, 2017 04:52
Optimizing matrix multiple example, step 2: remove unnecessary set!
#|
usage:
> (import (my-matrix))
> (sanity)
#t
> (run-bench)
500 x 500 matrix multiply in Chez took 2472 msec
500 x 500 matrix multiply in Chez took 2474 msec
...
@akeep
akeep / my-matrix.ss
Created December 27, 2017 04:38
Optimizing matrix multiple example, step 1: get the types consistent and the operators as specific as possible.
#|
usage:
> (import (my-matrix))
> (sanity)
#t
> (run-bench)
500 x 500 matrix multiply in Chez took 2472 msec
500 x 500 matrix multiply in Chez took 2474 msec
...

Keybase proof

I hereby claim:

  • I am akeep on github.
  • I am akeep (https://keybase.io/akeep) on keybase.
  • I have a public key whose fingerprint is B1B5 00D9 1C6B E2AF 6D88 ADBA 5B5B 6B3C 812D 4BC2

To claim this, I am signing this object:

@akeep
akeep / gist:4965768
Last active December 13, 2015 19:49
Trying to unravel @toddaaro's interesting call/cc infite loop
;; So @toddaaro started with the following example (http://hpaste.org/82455)
;;
;; in a scheme script executed via "scheme --script foo.ss"
(let ()
(define foo (map call/cc `(,call/cc ,call/cc)))
(printf "~s ~s\n" 1 (map call/cc foo))
(printf "~s ~s\n" 2 (map call/cc foo))
(printf "~s ~s\n" 3 (map call/cc foo))
(printf "~s ~s\n" 4 (map call/cc foo))
@akeep
akeep / tigervnc-1.0.1.patch
Created September 20, 2010 12:32
Patch to add full screen (F9), view only (F10), and view and edit (F11) hotkeys in the TigerVNC unix vncviewer.
diff -r tigervnc-1.0.1.orig/unix/vncviewer/CConn.cxx tigervnc-1.0.1/unix/vncviewer/CConn.cxx
51a52,60
> StringParameter fullScreenKey("FullScreenKey",
> "The key which toggles fullscreen on and off",
> "F9");
> StringParameter viewOnlyKey("ViewOnlyKey",
> "The key which turns on view only mode",
> "F10");
> StringParameter viewEditKey("ViewEditKey",
> "The key which turns off view only mode",