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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func main() { | |
limit := int64(math.Pow(10, 8)) | |
ldiv4 := int64(limit / 4) |
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 circular array to let us efficiently walk a window across a sequence. | |
(struct window (elts ;; (vectorof X) of length n | |
capacity ;; natural | |
start ;; natural | |
count ;; natural | |
) | |
#:mutable) |
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 net/url | |
racket/gui/base | |
images/flomap) | |
(define ip (get-pure-port | |
(string->url "http://racket-lang.org/logo.png"))) | |
(define bm (make-object bitmap% ip)) | |
(define big-bm |
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 data/union-find) | |
(define (equal?/id x y) | |
(define ufs (make-hasheq)) | |
(let loop ([x x] | |
[y y]) | |
(cond [(and (identifier? x) (identifier? y)) | |
(free-identifier=? x y)] |
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 | |
(provide unicode-name) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; We want to compute the table at compile-time, so that the result can be saved | |
;; by using raco make. | |
(require (for-syntax net/url | |
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 racket | |
;; A translation of http://tour.golang.org/#63 in Racket | |
(define (sum elts c) | |
(channel-put c (for/sum ([e elts]) e))) | |
(define (main) | |
(define a (list 7 2 8 -9 4 0)) |
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/gui | |
(define program-state 0) | |
(define f (new frame% [label "Example program"])) | |
(define c (new canvas% | |
[parent f] | |
[min-width 500] | |
[min-height 500] | |
[paint-callback |
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-namespace-anchor a) | |
(define (load-plug-in file) | |
(let ([ns (namespace-anchor->namespace a)]) | |
(parameterize ([current-namespace ns]) | |
(dynamic-require file 'print-colored)))) | |
(define print-colored |
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) | |
(current-check-around (let ([original-check-around (current-check-around)]) | |
(lambda (f) | |
(printf "Running test...\n") | |
(original-check-around f)))) | |
(check-equal? (+ 1 1) 2) | |
(check-equal? (+ 1 1) 2) |
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 | |
<variable-code>: 8149 195576 | |
<local-code>: 239 3824 | |
<application-code>: 13043 966232 | |
<unary-application-c: 19538 625216 | |
<binary-application-: 10593 423720 | |
<sequence-code>: 3258 123568 | |
<branch-code>: 7772 310880 | |
<procedure-code>: 15133 1089576 |