Remix notes
This commit is contained in:
parent
89826bd70d
commit
4bfbaeff15
74
remix/README
Normal file
74
remix/README
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
- No effects or expressions at top-level
|
||||||
|
- "Versioned" libraries
|
||||||
|
- No set! (use data-structure mutation and :=)
|
||||||
|
- Make macros less weird and more like programs, by...
|
||||||
|
- Unified matching (syntax-parse/match/etc)
|
||||||
|
- Unified templates (syntax, quasiquote, etc)
|
||||||
|
|
||||||
|
If x is a list, then...
|
||||||
|
|
||||||
|
(template (list (~seq 1 ,x) ...))
|
||||||
|
=>
|
||||||
|
(append-map (lambda (x) (list 1 x)) x)
|
||||||
|
|
||||||
|
(template (syntax a ,x ... c))
|
||||||
|
=>
|
||||||
|
(syntax-cons a (syntax-append x (syntax c)))
|
||||||
|
|
||||||
|
(template (+ (f ,x) ...))
|
||||||
|
=>
|
||||||
|
(apply + (map f x))
|
||||||
|
|
||||||
|
- @ everywhere
|
||||||
|
- Pattern matching everywhere
|
||||||
|
- New structs (more reflective information, representation control, sealing)
|
||||||
|
- Implicit units and interfaces (with properties)
|
||||||
|
- Bare-bones /base
|
||||||
|
|
||||||
|
#lang racket/base
|
||||||
|
(define BASE-NAMES (namespace-mapped-symbols (make-base-namespace)))
|
||||||
|
(for ([i (in-list BASE-NAMES)])
|
||||||
|
(displayln i))
|
||||||
|
(displayln (length BASE-NAMES))
|
||||||
|
|
||||||
|
returns 1433
|
||||||
|
|
||||||
|
- Generics everywhere
|
||||||
|
- Non-() syntax "mode"
|
||||||
|
|
||||||
|
array.[{1 + 1}].(foo)
|
||||||
|
->
|
||||||
|
(#%dot array (#%brackets (+ 1 1)) (foo))
|
||||||
|
|
||||||
|
(define (foo (var x) (~opt y 17) (posn p))
|
||||||
|
{x := z + 13}
|
||||||
|
{p.x + p.y})
|
||||||
|
|
||||||
|
- Implicit nesting in blocks
|
||||||
|
|
||||||
|
(def (f x)
|
||||||
|
(def y 17)
|
||||||
|
(+ x y))
|
||||||
|
|
||||||
|
- Immutable strings only
|
||||||
|
- Remove letrec weirdness of define?
|
||||||
|
- "define"-transformers for attaching meta-information to definitions, like documentation, tests, contracts, types, etc
|
||||||
|
- Bindings & keywords everywhere
|
||||||
|
- Less representation contraints
|
||||||
|
- Meaningless eq? semantics
|
||||||
|
- Literate programming and inline docs easily
|
||||||
|
- No case-lambda
|
||||||
|
- Optional traditional numbers (num/generic => +)
|
||||||
|
- Optional non-coercing number tower (num/{fl,fx,i32,i64,f32,f64,nat,int,rational,real})
|
||||||
|
-- with maybe impl (num/*/maybe)
|
||||||
|
-- with overflow errors impl (num/*/exn)
|
||||||
|
-- with modulo-X impl (num/*/modulo)
|
||||||
|
-- with modulo-X & carry impl (num/*/carry)
|
||||||
|
- More unicode!
|
||||||
|
- Unboxed, raw data
|
||||||
|
- Remove multiple values?
|
||||||
|
- Rocket-strength super cut:
|
||||||
|
|
||||||
|
λ.(+ $0 $1)
|
||||||
|
|
||||||
|
- Don't use English in exceptions and have more structured exns
|
2
remix/core.rkt
Normal file
2
remix/core.rkt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#lang racket/base
|
||||||
|
(provide #%module-begin)
|
22
remix/examples/rocket.rkt
Normal file
22
remix/examples/rocket.rkt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#lang remix
|
||||||
|
(require remix/struct.0
|
||||||
|
remix/match.0
|
||||||
|
num/int.0
|
||||||
|
gfx/2d.0
|
||||||
|
big-bang.0)
|
||||||
|
|
||||||
|
(struct #rocket
|
||||||
|
([int h]
|
||||||
|
[int dh]))
|
||||||
|
|
||||||
|
(data rocket
|
||||||
|
#:this [#rocket r]
|
||||||
|
(def (rocket [int (~opt h 0)] [int (~opt dh 1)])
|
||||||
|
(#rocket.alloc [h h] [dh dh]))
|
||||||
|
#:implements world/anim^
|
||||||
|
(def (tick)
|
||||||
|
(r.= [h {r.h + r.dh}]))
|
||||||
|
(def (draw)
|
||||||
|
(circle 'yellow 5)))
|
||||||
|
|
||||||
|
(big-bang (new rocket))
|
5
remix/lang/reader.rkt
Normal file
5
remix/lang/reader.rkt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
(module reader syntax/module-reader
|
||||||
|
remix/core
|
||||||
|
#:read remix:read
|
||||||
|
#:read-syntax remix:read-syntax
|
||||||
|
(require (prefix-in remix: remix/stx/read)))
|
25
remix/seq/list.rkt
Normal file
25
remix/seq/list.rkt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#lang remix
|
||||||
|
|
||||||
|
(data seq
|
||||||
|
(struct empty)
|
||||||
|
(def (first t)
|
||||||
|
(error))
|
||||||
|
(def (rest t)
|
||||||
|
(error))
|
||||||
|
(def (empty? t)
|
||||||
|
#t)
|
||||||
|
(def (cons x t)
|
||||||
|
((outer cons) x t))
|
||||||
|
(def (snoc t x)
|
||||||
|
((outer cons) x t)))
|
||||||
|
|
||||||
|
(data seq
|
||||||
|
(struct cons
|
||||||
|
[racket car]
|
||||||
|
[racket cdr])
|
||||||
|
(def (first t)
|
||||||
|
t.car)
|
||||||
|
(def (rest t)
|
||||||
|
t.cdr)
|
||||||
|
(def (empty? t)
|
||||||
|
#f))
|
10
remix/stx/read.rkt
Normal file
10
remix/stx/read.rkt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#lang racket/base
|
||||||
|
|
||||||
|
(define (:read ip) (:read-syntax #f ip))
|
||||||
|
|
||||||
|
(define (:read-syntax name ip)
|
||||||
|
eof)
|
||||||
|
|
||||||
|
(provide
|
||||||
|
(rename-out [:read read]
|
||||||
|
[:read-syntax read-syntax]))
|
Loading…
Reference in New Issue
Block a user