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 plot) | |
| (define (interval start end [step .01]) | |
| (stream->list (in-range start end step))) | |
| (define (plot-para f int) | |
| (plot (lines (map f int)))) | |
| (define (lemniscate-of-Bernoulli t) | |
| (list (/ (cos t) (+ 1 (expt (sin t) 2))) |
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 plot) | |
| (define (toroidal-spiral t) | |
| (define n 10) | |
| (list (* (+ 4 (sin (* n t))) (cos t)) | |
| (* (+ 4 (sin (* n t))) (sin t)) | |
| (cos (* n t)))) | |
| (plot3d | |
| (lines3d (map toroidal-spiral |
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 plot) | |
| (define (up x) | |
| (sqrt (- 1 (sqr x)))) | |
| (define (down x) (- (up x))) | |
| (plot (list (function up) | |
| (function down)) | |
| #:x-min -1 #:x-max 1) |
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 racket/control | |
| "with.rkt") | |
| (define (consume str args) | |
| (match args | |
| [(cons head tail) | |
| #:when (string=? str head) | |
| (values tail #t)] | |
| [_ (values args #f)])) |
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
| {-# OPTIONS --postfix-projections #-} | |
| module tuple where | |
| ------------------------------------------------------------------------------ | |
| -- |
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 | |
| BlockArguments | |
| , ImplicitParams | |
| , LambdaCase | |
| , OverloadedStrings | |
| , PatternSynonyms | |
| , Strict | |
| , UnicodeSyntax | |
| #-} | |
| {-# options_ghc -Wincomplete-patterns -Wunused-imports #-} |
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
| module C : sig | |
| type t | |
| val empty : t | |
| val one : char -> t | |
| val union : t -> t -> t | |
| val inter : t -> t -> t | |
| val top : t | |
| val mem : char -> t -> bool | |
| val make : (char -> bool) -> t | |
| val equal : t -> t -> bool |
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
| {-# OPTIONS --cubical #-} | |
| module natmod where | |
| open import Cubical.Foundations.Prelude | |
| data Ctx : Type | |
| data _⊢_ : Ctx → Ctx → Type | |
| data Ty : Ctx → Type | |
| data Tm : Ctx → Type | |
| -- This is halfway between EAT and GAT. | |
| -- GAT is hard! Why is EAT so easy? |
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
| module Main | |
| data Expr = E | |
| data Stmt | |
| = If Expr Stmt Stmt -- if (condition) then A else B | |
| -- loop (condition): | |
| -- do xxx | |
| | Loop Expr Stmt | |
| | SE String |
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
| module Main | |
| import Control.App | |
| import Control.App.Console | |
| import Data.SortedSet | |
| data Op = Add | Sub | Mul | Div | |
| data Expr | |
| = Var String |