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 typed/racket/no-check | |
| (require | |
| (for-syntax racket/base) | |
| racket/stxparam | |
| racket/splicing) | |
| (define-syntax-parameter x #f) | |
| (splicing-syntax-parameterize ([x #'foo]) |
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
| -> (require (for-syntax typed-racket/types/printer)) | |
| -> (begin-for-syntax (print-complex-filters? #t)) | |
| -> (:print-type (lambda (x) x)) | |
| (-> Any Any : ((! False @ (0 0)) | (False @ (0 0))) ((0 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/kernel | |
| (module def racket | |
| (provide def) | |
| (define-syntax def | |
| (syntax-rules (macro fn) | |
| [(_ macro name (args ... . rest) body0 bodyn ...) | |
| (define-syntax-rule (name args ... . rest) body0 bodyn ...)] | |
| [(_ fn name (args ... . rest) body0 bodyn ...) | |
| (define (name args ... . rest) body0 bodyn ...)] |
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: 24086ms (out of 24121ms) | |
| Number of samples taken: 328 (once every 73ms) | |
| (Hiding functions with self<1.0% and local<2.0%: 4 of 73 hidden) | |
| ========================================================================= | |
| 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
| (define (drain) | |
| (sync 0 (handle-evt log-rec (λ (v) (handle-msg v) (drain))))) | |
| (let loop () | |
| (sync | |
| (handle-evt log-rec | |
| (λ (v) (handle-msg v) (loop))) | |
| (handle-evt (semaphore-peek-evt sema) | |
| (λ (_) (drain))))) |
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 racket/unsafe/ops) | |
| (define (fw V) | |
| (define distances (make-vector (* V V) +inf.0)) | |
| (define weights | |
| (build-vector (* V V) | |
| (λ (n) (and ;(> (random) .7) |
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 typed/racket/base | |
| (provide partitions reset-partitions-cache) | |
| (require math/private/number-theory/types) | |
| ;;; Partitions are computed using Euler's algorithm: | |
| ; k k(3k+1) k(3k-1) | |
| ; p(n) = sum (-1) [ p( n - --------- ) + p( n - --------- ) ] | |
| ; k>=1 2 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
| #lang racket/load | |
| (module x typed/racket | |
| (provide f) | |
| (define-type B (U (IHashTable Symbol B) | |
| (All (C) (MHashTable Boolean C)) | |
| Symbol)) | |
| (: f (-> B Void)) | |
| (define (f x) (void))) | |
| (require '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 N 100000000) | |
| (define K 50000000) | |
| (for ((j 5)) | |
| (time | |
| (for/fold ([c 0]) ([i (in-range N)] #:break (not c)) | |
| (if (= i K) | |
| #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 | |
| (struct foo (x) #:transparent) | |
| (define foo-a (foo 2)) | |
| (define foo-b (foo 2)) | |
| (define (foo-plus a b) | |
| (foo (+ (foo-x a) (foo-x b)))) | |
| (define N 1000000) | |
| (for ((j 5)) |