UP | HOME

Special Topics: Functional Languages I-II
Lecture 23

Table of Contents

Writing a research paper

Functional languages

Scheme (a LISP dialiect)

http://www-formal.stanford.edu/jmc/history/lisp/node3.html

Scheme intro

https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/index.html

From https://matt.might.net/articles/implementing-a-programming-language/:

; eval takes an expression and an environment to a value
(define (eval e env) (cond
  ((symbol? e)       (cadr (assq e env)))
  ((eq? (car e) 'λ)  (cons e env))
  (else              (apply (eval (car e) env) (eval (cadr e) env)))))

; apply takes a function and an argument to a value
(define (apply f x)
  (eval (cddr (car f)) (cons (list (cadr (car f)) x) (cdr f))))

; read and parse stdin, then evaluate:
(display (eval (read) '())) (newline)

(eval '((λ x . x) (λ a . a)) '())

(eval '(λ x . x) '())

(eval '(((λ f . (λ x . (f x))) (λ a . a)) (λ b . b)) '())

(eval '((λ f . (f f)) (λ f . (f f))) '())  ; hmmmmm

https://norvig.com/lispy.html

notes

Compiling Closures

https://dl.acm.org/doi/10.1145/278283.278285

comparison to turing machines equivalent more "mathy", "programming languagey"

intuitive lambda calculus

defining common math/pl notions (numbers, booleans, operations on them, etc.)

operational semantics of lambda calculus, call-by-value vs. call-by-name

turing equivalence when would it not halt? what about iteration?

Author: Paul Gazzillo

Created: 2023-04-13 Thu 14:59