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 syntax/parse)) | |
(define-for-syntax (transform stx) | |
(syntax-parse stx | |
#:literals (and or) | |
[(and rest ...) #'(p-and rest ...)] | |
[(or rest ...) #'(p-or rest ...)] | |
[_ stx])) |
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
; lower-bound = alpha | |
; upper-bound = beta | |
(define (maximum-value-with-cutoff s depth lower-bound upper-bound) | |
(let-values | |
([(maximum-value new-lower-bound within-upper-bound?) | |
(for*/fold | |
([maximum-so-far -inf.0] | |
[new-lower-bound lower-bound]) | |
([successor (successors s)] | |
[successor-value (in-value (value-with-cutoff successor |
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/class) | |
(provide autocompletion-cursor<%> autocompletion-cursor%) | |
(define autocompletion-cursor<%> | |
(interface () | |
get-completions ; -> (listof string) | |
get-length ; -> int | |
empty? ; -> boolean |
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/load | |
(module m racket | |
(define (f #:x x) x) | |
(provide f)) | |
(module n typed/racket | |
(require/typed 'm | |
[f (#:x Any -> Any)]) | |
(f #:x 3)) |
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 2htdp/universe 2htdp/image) | |
(define (draw n) | |
(overlay (text (number->string n) 20 "green") | |
(empty-scene 200 200))) | |
(big-bang 0 | |
[on-key (lambda (n k) 0)] | |
[on-tick add1] | |
[to-draw draw]) |
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
;; AST style: | |
((equal? term "cond") | |
(define (transform i) | |
(if (or (> i node.children.length) | |
(eq? i node.children.length)) | |
null | |
(let ((n (vector-ref node.children i))) | |
(let ((condition (vector-ref n.children 0)) | |
(res (ast.node ast.LIST |
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
[samth@loki:~ plt] curl -u 'samth:PASSWORD' --data '{"title":"the title"}' https://api.github.com/repos/samth/test-bugs/issues |
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/promise) | |
(provide delay/values) | |
(define-syntax-rule (delay/values n . e) | |
(let ([tmp (lazy (call-with-values (λ () . e) vector))]) | |
(apply values (for/list ([i (in-range n)]) | |
(lazy (vector-ref (force tmp) i)))))) |
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 typed/racket | |
(struct: (T) TryS ()) | |
(struct: (T) Failure TryS ([exception : exn])) | |
(struct: (T) Success TryS ([result : T])) | |
(define-type (Try T) (U (Failure T) (Success T))) | |
(: failed (All (T) (Try T) -> Boolean)) |
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 net/url net/uri-codec) | |
(define url:string "https://myneu.neu.edu/cp/home/login") | |
(define the-url (string->url url:string)) | |
(define ip (post-pure-port | |
the-url | |
(string->bytes/utf-8 | |
(alist->form-urlencoded '((user . "me") (pass . "my_password")))) | |
empty)) |