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
Begin Dump | |
Begin Racket3m | |
<application-code>: 13037 965792 | |
<unary-application-c: 19475 623200 | |
<binary-application-: 10566 422640 | |
<sequence-code>: 3250 123256 | |
<branch-code>: 7746 309840 | |
<procedure-code>: 15131 1089432 | |
<let-value-code>: 708 28320 | |
<let-void-code>: 557 13368 |
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
Begin Dump | |
Begin Racket3m | |
<application-code>: 13037 965792 | |
<unary-application-c: 19475 623200 | |
<binary-application-: 10566 422640 | |
<sequence-code>: 3250 123256 | |
<branch-code>: 7746 309840 | |
<procedure-code>: 15131 1089432 | |
<let-value-code>: 708 28320 | |
<let-void-code>: 557 13368 |
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 scribble/base | |
@;; Submodule to provide support for a "block"-like form for Scribble documents. | |
@;; | |
@;; Adapted from racket/block | |
@;; | |
@;; The subexpressions are all collected into a list. | |
@;; Perhaps something like this belongs in the scribble library? | |
@(module scribble-block racket/base |
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 scribble/base | |
@title{Larger example} | |
@(define (double x) | |
(list x x)) | |
@; Everything within the following will be escaped. use |^ to unescape. | |
@list|^{ |
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
class p(object): | |
def __init__(self, *elts): | |
"""Construct a representation of a path. | |
(We'll cheat a little by using a list of strings.)""" | |
self.path = elts | |
def interp(self, data): | |
for p in self.path: | |
data = data[p] | |
return data |
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 (f i acc) | |
(cond [(> i 0) | |
(abort-current-continuation (default-continuation-prompt-tag) | |
(lambda () | |
(f (sub1 i) (+ i acc)))) | |
(printf "You should not see this\n") | |
(/ 1 0)] | |
[else |
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 json | |
data/order) | |
(define datum< (order-<? datum-order)) | |
(define (pretty-write-json x | |
#:output-port [o (current-output-port)] | |
#:null [jsnull (json-null)] | |
#:encode [enc 'control] |
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-syntax (verify stx) | |
(syntax-case stx () | |
[(_ exp1 exp2) | |
(with-syntax ([the-line-number (syntax-line stx)]) | |
(syntax/loc stx | |
(begin | |
(printf "~s == ~s : " 'exp1 'exp2) | |
(if (equal? exp1 exp2) |
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 | |
(require rackunit | |
rackunit/text-ui) | |
(define tests | |
(test-suite | |
"my suite of tests" | |
(check-equal? (+ 1 1) 2) | |
(check-equal? (+ 1 1) 3))) |
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 | |
(require test-engine/racket-tests) | |
(check-expect 1 1) | |
(check-expect 3 42) | |
(test-silence #f) | |
(test) |