Highlights from the Ninth RacketCon: Governing Rust, Physical Objects with Racket, and More

Table of Contents

(ninth RacketCon)

Saturday, 09:30–10:30 Aaron Turon: Governing Rust

pre-1.0

  • internal project for improving performance and security

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

post-1.0

// 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
}

10:50–11:50

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))

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))

14:00–15:00

Bradley M. Kuhn: Conservancy and Racket: What We Can Do Together!

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))))

15:20–16:20

Eric Griffis: Algebraic Racket in Action

https://github.com/dedbox

#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

Vlad Kozin: #lang wishful thinking (will! it be so)

https://github.com/vkz

#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

16:40–17:40

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)

John Clements: Computational models and one big problem with the stepper

Sunday, 09:30–10:30 Matthew Flatt: State of Racket

2017 Keynote: Dan Friedman & Will Byrd: Reasoned Schemers

https://github.com/webyrd

(run* (q)
      (conde
       [(== q 5)]
       [(== q 6)]))
(define my-append (l s)
  (cond
   [(null? l) s]
   [(cons (car l)
          (my-append (cdr l) s)]))

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")])]))

A Unified Approach to Solving Seven Programming Problems (Functional Pearl)

;; 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))))

Review

Author: Jason Walsh

j@wal.sh

Last Updated: 2024-10-02 05:00:06