Skip to content

Instantly share code, notes, and snippets.

View endobson's full-sized avatar

Eric Dobson endobson

  • Mountain View, CA
View GitHub Profile
@endobson
endobson / BUILD
Created February 13, 2016 05:15
repo1
genrule(
name = "gen_foo",
outs = ["foo.txt"],
cmd = "echo foobar > $@"
)
http_file(
name = "racket-minimal-x86_64-6.2.1-osx",
url = "http://mirror.racket-lang.org/installers/6.2.1/racket-minimal-6.2.1-x86_64-macosx.dmg",
sha256 = "84929d97299089a0078c3cbe4b9cb930713e0e055de9071d9b6f1667c9878d56"
)
git_repository(
name = "minimal-racket",
commit = "6a7103026bbd93e4bbcaff2be489c20410155917",
remote = "https://github.com/endobson/minimal-racket.git"
(define (kw-split kws)
(define kw-hash (apply hash kws))
(for/lists (kws vals) ([kw (in-list (sort (hash-keys kw-hash) keyword<?))])
(values kw (hash-ref kw-hash kw))))
@endobson
endobson / .gitignore
Last active November 21, 2015 21:14
Initial Gist
bazel-*
@endobson
endobson / gist:b8d141a04c4a317dc696
Created May 5, 2015 15:13
Output of running tests (racket unit-tests/typecheck-tests.rkt)
--------------------
Typechecker tests > tc-expr tests > 3649 (lambda: ((x : Flonum) (y : Flonum-Zero)) (values (fl<= x y) (fl< x y) (fl= x y) (fl> x y) (fl>= x y)))
3649 (lambda: ((x : Flonum) (y : Flonum-Zero)) (values (fl<= x y) (fl< x y) (fl= x y) (fl> x y) (fl>= x y)))
FAILURE
location: <pkgs>/typed-racket-test/unit-tests/typecheck-tests.rkt:3648:7
actual: (tc-results
(list
(tc-result
(->
(U
Typed Racket Tests > Integration tests > fail > unbound-non-reg.rkt > #f
Unnamed test
FAILURE
name: check-exn
location: main.rkt:88:34
params: #<procedure:...et-test/main.rkt:20:3>
#<procedure:...et-test/main.rkt:73:10>
message: "Wrong exception raised"
exn-message:"make-Name: contract violation\n expected: (or/c #f (listof identifier?))\n given: '(T)\n in: the 2nd argument of\n (->*\n (identifier?\n (or/c #f (listof identifier?))\n boolean?)\n (#:syntax (or/c syntax? #f))\n Name?)\n contract from: \n <pkgs>/typed-racket-lib/typed-racket/rep/type-rep.rkt\n blaming: <pkgs>/typed-racket-lib/typed-racket/typecheck/tc-structs.rkt\n (assuming the contract is correct)\n at: <pkgs>/typed-racket-lib/typed-racket/rep/type-rep.rkt:127.10"
exn: #(struct:exn:fail:contract "make-Name: contract violation\n expected: (or/c #f (listof identifier?))\n given: '(T)\n in: the 2nd argument of\n (->*\n (identifier?\n (or/c #f (listof ident
Source:
(: f (Number [#:y Boolean] -> Number))
(define (f x #:y [y #f] #:z [z 'this-can-be-anything])
(if y "y is truthy" x))
Expanded inner function:
'(lambda (y1 y3 z2 z4 x5)
(let-values (((x) x5))
(let-values (((y) (if y3 y1 '#f)))
endobson@yggdrasil () ~/tmp % racket (0)
Welcome to Racket v6.1.1.8.
-> (require typed/racket)
-> (: f (Number [#:y Number] -> Number)) -> (define (f x #:y [y 0]) (+ x y))
-> f
- : (-> Number [#:y Number] Number)
#<procedure:f>
-> (: g (Number #:y Number -> Number))
#lang racket/load
(module a typed/racket
(provide (all-defined-out))
(struct foo ())
(struct (A) bar foo ([v : (Boxof A)]))
(: b (bar False))
(define b (bar (box #f)))