View curried.scrbl
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/manual | |
This is a 3-argument curried function. | |
@defproc[(((lerp [lo number?]) | |
[hi number?]) | |
[alpha number?]) | |
number?]{ | |
Linear interpolation} |
View gist:435f001ab7b3cf92d869
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
> (:print-type andmap) | |
(All (a c d b ...) | |
(case-> | |
(-> (-> a c : d) (Listof a) c) | |
(-> (-> a b ... b c) (Listof a) (Listof b) ... b (U True c)))) | |
> (λ ([a : Real] | |
[b : Symbol] | |
[c : Boolean] |
View gist:555e20f58cb7e56b1836
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 (up-down x [so-far 1]) | |
(if (equal? x so-far) | |
(displayln x) | |
(begin (displayln so-far) | |
(up-down x (add1 so-far)) | |
(displayln so-far)))) |
View gist:e349ade7de6f4ef1868d
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 rackmora | |
(def count10 (R_iota [10])) | |
(R_iota [10]) | |
(fn ((top 0)) | |
(unbox counting count10 1)) | |
(def sum | |
(fn ((top 0)) |
View dpi-trouble.rkt
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 slideshow | |
(require (planet jaymccarthy/slideshow-latex)) | |
(latex-dpi 300) | |
(add-preamble #<<latex | |
\usepackage{amsmath} | |
latex | |
) |
View inference.rkt
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 | |
;;; Typed Racket version of Martin Grabmü̈ller's "Algorithm W Step by Step" | |
;;; http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.65.7733 | |
;;; This is my first use of Typed Racket. I am looking to change this from | |
;;; following Haskell idiom to following Racket idiom. | |
;; An expression is a variable, a literal, an application, |
View gist:5717099
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 redex) | |
(define-language L1 | |
(a integer) | |
(e variable-not-otherwise-mentioned | |
(* e e))) | |
(define-language L2 | |
(b string) |
View gist:5716442
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
(define-language L1 | |
(a integer) | |
(e variable-not-otherwise-mentioned)) | |
(define-language L2 | |
(b string) | |
(e integer)) | |
(define-multilang-metafunction [L1 L2] | |
metafun-name : a L1:e -> b L2:e |
View gist:5099883
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
; typing compose makes use of typechecker code for handling abstracted indices | |
(check-equal? | |
(judgment-holds | |
(type-of [] [] [] | |
(I-λ [(s1 Shape) (s2 Shape) (s3 Shape)] | |
(T-λ [α β γ] | |
(A [] [(λ [(f (Array (S) ((Array s1 α) -> (Array s2 β)))) | |
(g (Array (S) ((Array s2 β) -> (Array s3 γ))))] | |
(A [] [(λ [(x (Array s1 α))] (g (f x)))]))]))) | |
type) type) |
View gist:5095779
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
> (judgment-holds | |
(type-of [] | |
[] | |
[] | |
(Λ [α β γ] | |
(A [] | |
[(λ [(f 0 (Array (S) ((Array (S) α) -> (Array (S) β)))) | |
(g 0 (Array (S) ((Array (S) β) -> (Array (S) γ))))] | |
(A [] [(λ [(x 0 (Array (S) α))] (g (f x)))]))])) | |
type) |
NewerOlder