This file contains 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/contract/base) | |
(provide | |
(contract-out | |
[sequence-markup? predicate/c] | |
[sequence-markup |
This file contains 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/unsafe/ops) | |
(define s1 (string-append)) | |
(define s2 (string-append)) | |
(immutable? s1) ; false | |
(immutable? s2) ; false | |
(eq? s1 s2) ; true (!!!) |
This file contains 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
-- an asynchronous computation in the monad m that produces an a or dies with SomeException | |
Promise m a | |
immediatePromise : a -> Promise m a | |
immediatePromiseM : m a -> Promise m a | |
immediateFailedPromise : Exception e => e -> Promise m Void | |
immediateFailedPromiseM : Exception e => m e -> Promise m Void | |
unitPromise : Promise m Unit | |
then : Promise m a -> (a -> b) -> Promise m b | |
thenM : Promise m a -> (a -> m b) -> Promise m b |
This file contains 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/list | |
racket/match | |
rebellion/base/option | |
rebellion/collection/list | |
rebellion/streaming/reducer | |
rebellion/streaming/transducer | |
rebellion/type/enum | |
fancy-app) |
This file contains 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 | |
; See the Racket Style Guide for details on why this file is organized the way | |
; it is: https://docs.racket-lang.org/style/Units_of_Code.html | |
; We have to import racket/contract/base first in order to use contract-out. | |
(require racket/contract/base) | |
This file contains 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
;; This is a hypothetical syntax for defining rewrite rules that can be used to create custom optimizations and | |
;; refactoring suggestions. This example assumes there's some sort of geometry library that accepts angles in terms of | |
;; either degrees or radians using wrapper structs like `(struct degrees (value))` and `(struct radians (value))`. If | |
;; the wrapping is done right where the function is called, it allocates garbage that specialized degree-specific and | |
;; radian-specific functions wouldn't allocate. But we don't want to double the API surface, so we instead create inlining | |
;; rules that fire when the wrapping is done at the call site. | |
(define-rewrite-rule rotate-degrees-specialization | |
@explanation{Using the @racket[rotate-degrees] function avoids allocating the intermediate @racket[degrees] value.} | |
#:surface-as hidden-optimization |
This file contains 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 (for-syntax racket/sequence | |
racket/symbol | |
racket/syntax | |
rebellion/collection/vector | |
syntax/parse/class/struct-id) | |
syntax/parse/define) | |
;@------------------------------------------------------------------------------ |
This file contains 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 (for-syntax racket/syntax | |
syntax/parse/class/struct-id) | |
syntax/parse/define) | |
;@------------------------------------------------------------------------------ | |
(struct point (x y)) |
This file contains 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 pict | |
rebellion/collection/immutable-vector | |
rebellion/collection/hash | |
rebellion/streaming/reducer | |
rebellion/streaming/transducer | |
rebellion/type/enum | |
rebellion/type/record | |
rebellion/type/tuple) |
This file contains 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) | |
atomichron | |
racket/pretty | |
racket/set | |
rebellion/collection/list | |
rebellion/streaming/reducer | |
rebellion/streaming/transducer | |
syntax/parse/define) |