This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
;; inspired by http://zvon.org/other/haskell/Outputprelude/iterate_f.html | |
(define (iterate f acc) | |
(make-do-sequence | |
(lambda () | |
(values | |
(lambda (x) x) | |
(lambda (x) (f x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define child-insp (make-inspector (current-inspector))) | |
(define parent-insp (current-inspector)) | |
;; Switch to the child inspector. Structures defined next | |
;; will be under its control. | |
(current-inspector child-insp) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/async-channel) | |
(provide multicast? | |
(rename-out (new-multicast multicast)) | |
multicast-put | |
multicast-get-evt) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define cust (make-custodian)) | |
(parameterize ([current-custodian cust]) | |
(custodian-shutdown-all cust) | |
;; The following will fail, since the custodian has shut down: | |
(open-input-file "/usr/share/dict/words")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env racket | |
#lang racket/base | |
(require parser-tools/yacc | |
parser-tools/lex | |
(prefix-in : parser-tools/lex-sre)) | |
(define-empty-tokens empty-tokens-group | |
(EOF | |
TRUE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require (for-syntax racket/base)) | |
(provide swap) | |
;; taken from: | |
;;http://docs.racket-lang.org/guide/syntax-case.html | |
(define-syntax swap | |
(lambda (stx) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require (for-syntax racket/base | |
syntax/parse)) | |
(provide swap) | |
(define-syntax (swap stx) | |
(syntax-parse stx | |
[(_ x:identifier y:identifier) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
;; A small library for setting up a proper evaluation context for SDL and Allegro. | |
(provide initialize-ns-app) | |
(require ffi/unsafe | |
ffi/unsafe/objc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Profiling results | |
----------------- | |
Total cpu time observed: 53988ms (out of 54129ms) | |
Number of samples taken: 988 (once every 55ms) | |
========================================================== | |
Caller | |
Idx Total Self Name+src Local% | |
ms(pct) ms(pct) Callee | |
========================================================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash-3.2$ racket perf.rkt | |
Profiling results | |
----------------- | |
Total cpu time observed: 36182ms (out of 36345ms) | |
Number of samples taken: 634 (once every 57ms) | |
============================================================ | |
Caller | |
Idx Total Self Name+src Local% | |
ms(pct) ms(pct) Callee |