(ninth RacketCon) 2019
Table of Contents
2. Saturday, 09:30–10:30 Aaron Turon: Governing Rust
2.1. pre-1.0
- internal project for improving performance and security
2.2. 1.0
- strives for eager consensus
- accommodate external groups
- address "why wasn't I consulted" problem
- define stakeholders and decision makers
- create rfc system
- goal is to understand trade-offs
- schedule a final review
- there needs to be an end to rational addition
- the goal needs to get to a consensus but an outcome
- balance is between shipping and consensus
2.3. post-1.0
- set up a roadmap
- expand the audience
- lower the barrier to entry as a tension with existing systems programmers
- "Hack without Fear"
- "Magic" as balanced against Rust goals
- setup on-boarding
- track issues to allow new contributors
- https://rust-lang.github.io/rustc-guide/
- teams: design
- working groups: implementation
- on-boarding, documentation, triage, planning
- need to ensure that people have space to move to leadership and ownership
- example: https://github.com/rust-lang/rust/issues/50547
- contribution as more than code: https://medium.com/open-source-communities/maintainer-vs-community-97edc28387ad
- https://www.rust-lang.org/governance
// Example of Rust's ownership system
fn main() {
let s1 = String::from("hello");
let s2 = s1; // s1 is moved here
// println!("{}, world!", s1); // This would not compile
println!("{}, world!", s2); // This works
}
3. 10:50–11:50
3.1. Phil Hagelberg: In Production: creating physical objects with Racket
https://youtu.be/xSjk2PdQm5k?t=5719 https://github.com/technomancy https://technomancy.us/talks/in-production/
#lang racket
(require openscad)
(define (create-box width height depth)
(cube width height depth))
(define (create-lid width depth)
(translate [0 0 (/ depth 2)]
(cube width 1 depth)))
(define (main)
(union
(create-box 10 5 3)
(create-lid 10 3)))
(save-scad "box-with-lid.scad" (main))
3.2. Conor Finegan: ADQC: From Normalcy to Adequacy
https://youtu.be/xSjk2PdQm5k?t=7450 https://github.com/cfinegan
#lang racket
(require adqc)
(define (normalize expr)
(match expr
[`(λ ,x ,body) `(λ ,x ,(normalize body))]
[`(,f ,arg) (let ([f' (normalize f)]
[arg' (normalize arg)])
(if (and (lambda? f') (value? arg'))
(substitute (lambda-body f') (lambda-param f') arg')
`(,f' ,arg')))]
[x x]))
(define expr '((λ x (x x)) (λ y y)))
(displayln (normalize expr))
4. 14:00–15:00
4.2. Greg Hendershott: Racket and Emacs: Fight!
https://youtu.be/xSjk2PdQm5k?t=18234 https://github.com/greghendershott
(use-package racket-mode
:ensure t
:mode "\\.rkt\\'"
:config
(add-hook 'racket-mode-hook
(lambda ()
(define-key racket-mode-map (kbd "C-c r") 'racket-run)
(define-key racket-mode-map (kbd "C-c t") 'racket-test))))
5. 15:20–16:20
5.1. Eric Griffis: Algebraic Racket in Action
#lang racket
(require algebraic)
(define-algebra maybe
[just : a -> (maybe a)]
[nothing : (maybe a)])
(define (maybe-map f m)
(match m
[(just x) (just (f x))]
[nothing nothing]))
(define m (just 5))
(displayln (maybe-map add1 m)) ; (just 6)
(displayln (maybe-map add1 nothing)) ; nothing
5.2. Vlad Kozin: #lang wishful thinking (will! it be so)
#lang wishful-thinking
(define (factorial n)
(if (zero? n)
1
(* n (factorial (sub1 n)))))
(test-case "factorial works"
(check-equal? (factorial 5) 120)
(check-equal? (factorial 0) 1))
;; The language will automatically generate the implementation
;; based on the test cases and function signature
6. 16:40–17:40
6.1. Andrew Blinn: Fructure: A Structured Editing Engine in Racket
https://github.com/disconcision
#lang racket
(require fructure)
(define-fructure-editor my-editor
#:keymap
'(("C-n" . fructure-next-sibling)
("C-p" . fructure-previous-sibling)
("C-f" . fructure-forward-char)
("C-b" . fructure-backward-char)
("C-e" . fructure-end-of-line)
("C-a" . fructure-beginning-of-line)))
(my-editor)
8. 2017 Keynote: Dan Friedman & Will Byrd: Reasoned Schemers
- https://github.com/webyrd/CodeFromTheReasonedSchemer2ndEd
- http://webyrd.net/scheme-2013/papers/HemannMuKanren2013.pdf
(run* (q)
(conde
[(== q 5)]
[(== q 6)]))
(define my-append (l s)
(cond
[(null? l) s]
[(cons (car l)
(my-append (cdr l) s)]))
8.1. Three Rules: Simply-typed Lambda Calculus
- var
- abs
- app
;; Example of simply-typed lambda calculus in Racket
(define-type Type
[TInt]
[TFun Type Type])
(define-type Expr
[Var Symbol]
[Lam Symbol Type Expr]
[App Expr Expr])
(define (type-check expr env)
(match expr
[(Var x) (hash-ref env x)]
[(Lam x t body)
(TFun t (type-check body (hash-set env x t)))]
[(App f arg)
(match (type-check f env)
[(TFun arg-t ret-t)
#:when (equal? arg-t (type-check arg env))
ret-t]
[_ (error "Type mismatch in application")])]))
8.2. Quines/Twines
http://matt.might.net/articles/i-love-you-in-racket/
(run 99 (q) (evalo q '(I love you)))
8.3. A Unified Approach to Solving Seven Programming Problems (Functional Pearl)
- https://dl.acm.org/citation.cfm?id=3110252
- http://io.livecode.ch/learn/namin/icfp2017-artifact-auas7pp
;; Example of one of the seven problems: The Zebra Puzzle
(define (zebra)
(run* (h)
(fresh (e j s u n)
(== h (list e j s u n))
(!= e j) (!= e s) (!= e u) (!= e n)
(!= j s) (!= j u) (!= j n)
(!= s u) (!= s n)
(!= u n)
(membero '(norwegian . yellow) h)
(membero '(ukrainian . blue) h)
(righto '(norwegian . _) '(blue . _) h)
(first '(norwegian . _) h)
(nexto '(chesterfields . _) '(fox . _) h)
(nexto '(kools . _) '(horse . _) h)
(membero '(lucky-strike . orange-juice) h)
(membero '(japanese . parliaments) h)
(nexto '(norwegian . _) '(dunhill . _) h)
(membero '(_ . milk) s)
(membero '(_ . water) j)
(membero '(_ . zebra) u))))