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 | |
(define hangul-data-file "src/racket-unihan/Unihan_Readings.txt") | |
(define-values (_ r) (call-with-input-file hangul-data-file | |
(lambda (in) | |
(for/lists (lines) ([l (in-lines in)] | |
#:unless (eq? '#\# (string-ref l 0)) | |
#:break (= (length lines) 30)) | |
l)))) |
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
(module+ test | |
(require rackunit check-sexp-equal) | |
(define (ts type tok) | |
(token-struct type tok #f #f #f #f #f)) | |
(define (pt val from to) | |
(position-token val (position from #f #f) (position to #f #f))) | |
(define (drain-lexer input) | |
(define ip (open-input-string input)) |
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
(module+ test | |
(require rackunit) | |
(let ([ip (open-input-string "2 + 3")]) | |
(define (ts type tok) | |
(token-struct type tok #f #f #f #f #f)) | |
(define (pt val from to) | |
(position-token val (position from #f #f) (position to #f #f))) | |
(define (check-lex1 type tok 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
(ns typed-play.core | |
(:require-macros [cljs.core.typed :as t]) | |
(:require [cljs.core.typed :as t])) | |
(t/ann my-identity (All [x] (Fn [x -> x]))) | |
(defn my-identity [x] | |
(if (number? x) | |
(do (prn x) x) | |
x)) |
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 | |
(: fir-filter ((Listof (List Nonnegative-Fixnum Real)) -> Any)) | |
(define (fir-filter params) | |
(match params | |
[`((,#{delays : (List Nonnegative-Fixnum)} ,amplitudes) ...) | |
(+ 1 (apply max delays))] | |
[other (error 'ouch)])) |
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
export default f(1, 2, 3); // anonymous export | |
export let foo = 5; // named declaration export | |
export foo // named export of existing identifier | |
export foo, bar; // named export of multiple existing identifiers | |
export foo as f; // named aliasing export | |
export foo as f, bar; // you get the idea | |
import default glob from "glob"; // anonymous import | |
import sync from "glob"; // named import | |
import sync as s from "glob"; // named aliasing import |
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
// A.js | |
import y from "B"; | |
console.log("a"); | |
export var x; | |
// B.js | |
import z from "C"; | |
console.log("b"); | |
export var 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 at-exp racket | |
;; Generate lovely ideas for talks | |
;; Ported from Jason Orendorff's python code: | |
;; https://gist.github.com/jorendorff/4659406 | |
(require math) | |
(define productions | |
#hash(["tech" . ("HTML5" |
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 | |
(define (find-duplicates elts) | |
(define ht (make-hash)) | |
(for/list ([x elts] | |
#:when (hash-update! ht x add1 0) | |
#:when (= 2 (hash-ref ht x))) | |
x)) | |
(find-duplicates '(1 2 2 3 1 4 5 4 4 4)) |
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 |
NewerOlder