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 | |
(module curry-old racket/base | |
(provide curry curryr) | |
(define (make-curry right?) | |
;; The real code is here | |
(define (curry* f args kws kvs) | |
(unless (procedure? f) | |
(raise-argument-error (if right? 'curryr 'curry) "procedure?" f)) |
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 | |
(module s racket/base | |
(require racket/contract/base) | |
(provide (contract-out [f (-> integer? integer?)]) | |
g) | |
(define (f x) x) | |
;; Simulate the expansion of `contract-out`: |
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 | |
(define M 100) | |
(define N 1000000) | |
;; Baseline tail-call loop | |
(time | |
(let loop ([j 0]) | |
(cond | |
[(= j N) 'done] |
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
(let ([M 100] | |
[N 1000000]) | |
(define (report step) (printf "\n~a\n" step)) | |
(report "baseline: plain loop") | |
(time | |
(let loop ([j 0]) | |
(cond | |
[(= j N) 'done] | |
[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
(with-output-to-file "testfile.ss" | |
(lambda () | |
(printf "(\n") | |
(let loop ([i 1000]) | |
(unless (zero? i) | |
(printf "x ") | |
(loop (sub1 i)))) | |
(printf ")\n")) | |
'truncate) |
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
(define ephemeron-key car) | |
(define ephemeron-value cdr) | |
(define (show v) (write v) (newline)) | |
(define (check-same a b) | |
(unless (eq? a b) | |
(error 'check-same "failed"))) | |
(define gdn (make-guardian)) |
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 | |
(module property racket | |
(provide quote-syntax/add-example-property | |
id) | |
(define-for-syntax compile-time (current-inexact-milliseconds)) | |
(define-syntax (quote-syntax/add-example-property stx) | |
(syntax-case 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
### Keybase proof | |
I hereby claim: | |
* I am mflatt on github. | |
* I am mflatt (https://keybase.io/mflatt) on keybase. | |
* I have a public key whose fingerprint is E7B8 3F92 02CB 9F4D D41F 27BA 5F91 2E16 6255 DF85 | |
To claim this, I am signing this object: |
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) | |
;; A singly linked list is either | |
;; - NULL | |
;; - pointer to data and a pointer a sll | |
(struct node (data-ptr next-ptr)) | |
(define n4 (node 4 null)) |
NewerOlder