This file contains hidden or 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
| {-# LANGUAGE LambdaCase #-} | |
| module Tyck | |
| ( Term (..), | |
| Type (..), | |
| emptyContext, | |
| emptySolution, | |
| topInfer, | |
| infer, | |
| check, |
This file contains hidden or 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 prime-list '(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59)) | |
| (define (factor-list n) | |
| (define p-factor-list | |
| (for/list ([p prime-list] | |
| #:when (= (remainder n p) 0)) | |
| p)) | |
| (println p-factor-list) |
This file contains hidden or 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 syntax/parse/define | |
| (for-syntax syntax/stx)) | |
| (begin-for-syntax | |
| (define-syntax-class type | |
| #:datum-literals (->) | |
| (pattern (~literal Type) | |
| #:attr occurs (λ (D) #f)) | |
| (pattern x:id |
This file contains hidden or 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/future | |
| racket/async-channel | |
| racket/function | |
| racket/match) | |
| (define process-map (make-hasheq)) | |
| (struct pid ()) | |
| (struct process (id fu ch)) |
This file contains hidden or 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 | |
| #| | |
| tree definitions | |
| |# | |
| (struct Tree ([v : String] [sub-tree : (Listof Tree)]) | |
| #:property prop:custom-write | |
| (λ (v port mode) (if (empty? (Tree-sub-tree v)) | |
| (fprintf port "~a" (Tree-v v)) | |
| (fprintf port "~a ~a" (Tree-sub-tree v) (Tree-v v))))) |
This file contains hidden or 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 syntax/parse/define | |
| (for-syntax syntax/stx | |
| racket/string | |
| racket/system) | |
| ffi/unsafe) | |
| (begin-for-syntax | |
| (define-syntax-class c/ty | |
| #:datum-literals (double) |
This file contains hidden or 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 curly-fn racket | |
| (require syntax/parse/define | |
| (for-syntax racket/syntax | |
| syntax/stx)) | |
| (define-syntax-parser List | |
| [(_ ty) (with-disappeared-uses | |
| (record-disappeared-uses/recur #'ty) | |
| #''(List ty))]) | |
| (define-syntax-parser Integer |
This file contains hidden or 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 | |
| (define-type Prog (Listof Instruction)) | |
| (define-type Regsiter (U Symbol)) | |
| (define-type ImmediateValue (U Integer)) | |
| (struct Instruction () #:transparent) | |
| (struct mov Instruction | |
| ([register : Regsiter] |
This file contains hidden or 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
| {-# LANGUAGE PatternSynonyms #-} | |
| type Ix = Int | |
| type Lvl = Int | |
| type ULvl = Int | |
| data Sort = Type ULvl | Prop | |
| deriving (Show, Eq) | |
| data SortType = SType | SProp |
This file contains hidden or 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 (%history ts xs) | |
| (λ args | |
| (cond ((null? args) `(%history ,ts ,xs)) | |
| ((eq? (first args) 'x) | |
| (list-ref xs (second args))) | |
| ((eq? (first args) 't) | |
| (list-ref ts (second args))) | |
| ((eq? (first args) 'extend) |