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 rackunit) | |
;; int -> string | |
(define (line n) | |
(list->string (build-list n (λ (x) #\*)))) | |
(check-equal? (line 3) "***") | |
(check-equal? (line 1) "*") |
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
. Type Checker: untyped identifier apply-contract imported from module <private/base.rkt> in: #%module-begin | |
. Type Checker: untyped identifier coerce-contract imported from module <private/guts.rkt> in: #%module-begin | |
. Type Checker: untyped identifier flat-named-contract imported from module <racket/contract> in: #%module-begin | |
. Type Checker: untyped identifier build-source-location imported from module <syntax/srcloc> in: #%module-begin | |
. Type Checker: Summary: 4 errors encountered in: | |
#%module-begin | |
#%module-begin | |
#%module-begin | |
#%module-begin |
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
plt/racket-git/collects/typed-racket/utils/tc-utils.rkt:154:0: Internal Typechecker Error: funapp with keyword args ((Unknown Type: #(struct:Keyword 952 #(struct:combined-frees #hasheq() ()) #(struct:combined-frees #hasheq() ()) #f #f #:foo Integer #t))) NYI | |
while typechecking: | |
(#%app f) | |
originally: | |
(f) |
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-match-expander list-or | |
(lambda (stx) | |
(syntax-parse stx | |
[(_ pat) #'(app (lambda (lst) | |
(for/or ([elem lst]) | |
(match elem [pat elem] [_ #f]))) |
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
$ raco pkg install pfds | |
=: contract violation | |
expected: number? | |
given: #<eof> | |
argument position: 1st | |
other arguments...: | |
31 | |
context...: | |
/home/asumu/plt/racket-git/collects/file/untgz.rkt:27:3 | |
/home/asumu/plt/racket-git/collects/planet2/lib.rkt:400:17 |
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 rackunit) | |
(test-begin | |
(parameterize ([current-check-around | |
(λ (thunk) | |
(with-handlers ([exn? (λ (e) ((error-display-handler) "check" e))]) | |
(thunk)))]) | |
(check-equal? 1 2))) |
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 scribble/lp | |
@chunk[<a> (module main racket (provide x) (define x 3))] | |
@chunk[<b> (module test racket | |
(require rackunit (submod ".." main)) | |
(check-equal? x 3))] | |
@chunk[<*> (begin <a> <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
Context: the package taglib is installed in shared scope, but not | |
in the default user scope. The user is trying to remove the | |
package (with the default --user option). | |
Old error message: | |
$ raco pkg remove taglib | |
raco pkg remove: package not currently installed | |
package: taglib | |
currently installed: [none] |
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 rackunit) | |
(define old-handler (current-check-handler)) | |
(parameterize ([current-check-handler | |
(λ (exn) | |
;; put custom processing here | |
(displayln "do something") |
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 | |
;; a fun implementation of balanced brackets from Rosetta Code | |
(define (balanced? str) | |
(with-handlers ([exn:fail? (λ (exn) #f)]) | |
(define in (open-input-string str) | |
(let loop ([x (read in)]) | |
(if (not (eof-object? x)) | |
(loop (read in)) | |
#t)))) |