From 567ca6641f7c2f470cd0003e32efeab52ab9c9c9 Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 09:48:38 -0400 Subject: [PATCH 01/16] --- assignment1.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment1.mdwn b/assignment1.mdwn index 12cd7059..bfaafdc0 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -29,11 +29,11 @@ In Racket, these can be defined like this: * Define a "neg" operator that negates "true" and "false". Expected behavior: - (((neg true) 10) 20) + (((neg true) 10) 20) evaluates to 20, and - (((neg false) 10) 20) + (((neg false) 10) 20) evaluates to 10. -- 2.11.0 From 2e244b24ef343b5d85a25fc50b5058a1f221f178 Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 09:49:06 -0400 Subject: [PATCH 02/16] --- assignment1.mdwn | 1 + 1 file changed, 1 insertion(+) diff --git a/assignment1.mdwn b/assignment1.mdwn index bfaafdc0..bbb393b9 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -27,6 +27,7 @@ In Racket, these can be defined like this: (define false (lambda (t) (lambda (f) f))) * Define a "neg" operator that negates "true" and "false". + Expected behavior: (((neg true) 10) 20) -- 2.11.0 From 7958db26a9129e5264f05f835090ae894b4f828b Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 09:49:27 -0400 Subject: [PATCH 03/16] --- assignment1.mdwn | 1 + 1 file changed, 1 insertion(+) diff --git a/assignment1.mdwn b/assignment1.mdwn index bbb393b9..b65cc177 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -41,6 +41,7 @@ evaluates to 10. * Define an "and" operator. * Define an "xor" operator. + (If you haven't seen this term before, here's a truth table: true xor true = false -- 2.11.0 From 8f9abe589a3b7c615b72adc6cbf57e7de1d931d3 Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 09:50:53 -0400 Subject: [PATCH 04/16] --- assignment1.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment1.mdwn b/assignment1.mdwn index b65cc177..560d288e 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -84,8 +84,8 @@ To extract the first element of a pair p, you write: Here are some defintions in Racket: (define make-pair (lambda (fst) (lambda (snd) (lambda (f) ((f fst) snd))))) - (define get-first (lamda (fst) (lambda (snd) fst))) - (define get-second (lamda (fst) (lambda (snd) snd))) + (define get-first (lambda (fst) (lambda (snd) fst))) + (define get-second (lambda (fst) (lambda (snd) snd))) Now we can write: -- 2.11.0 From 043cdafb6314cb4e7afb5c474e96064ad6ffa7cf Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 09:54:24 -0400 Subject: [PATCH 05/16] --- assignment1.mdwn | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/assignment1.mdwn b/assignment1.mdwn index 560d288e..ef1c561c 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -111,7 +111,8 @@ instead of: However, the latter is still what's going on under the hood. -13. Define a "swap" function that reverses the elements of a pair. +* Define a "swap" function that reverses the elements of a pair. + Expected behavior: (define p ((make-pair 10) 20)) @@ -121,27 +122,27 @@ Expected behavior: Write out the definition of swap in Racket. -14. Define a "dup" function that duplicates its argument to form a pair +* Define a "dup" function that duplicates its argument to form a pair whose elements are the same. Expected behavior: ((dup 10) get-first) ; evaluates to 10 ((dup 10) get-second) ; evaluates to 10 -15. Define a "sixteen" function that makes +* Define a "sixteen" function that makes sixteen copies of its argument (and stores them in a data structure of your choice). -16. Inspired by our definition of ordered pairs, propose a data structure capable of representing ordered tripes. That is, +* Inspired by our definition of ordered pairs, propose a data structure capable of representing ordered tripes. That is, (((make-triple M) N) P) should return an object that behaves in a reasonable way to serve as a triple. In addition to defining the make-triple function, you have to show how to extraxt elements of your triple. Write a get-first-of-triple function, that does for triples what get-first does for pairs. Also write get-second-of-triple and get-third-of-triple functions. -17. Write a function second-plus-third that when given to your triple, returns the result of adding the second and third members of the triple. +* Write a function second-plus-third that when given to your triple, returns the result of adding the second and third members of the triple. You can help yourself to the following definition: (define add (lambda (x) (lambda (y) (+ x y)))) -18. [Super hard, unless you have lots of experience programming] Write a function that reverses the order of the elements in a list. +* [Only attempt this if you're feeling frisky, it's super hard unless you have lots of experience programming] Write a function that reverses the order of the elements in a list. -- 2.11.0 From 6501d908788cd4be578ab1aa55db3e43e80f87be Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 09:55:57 -0400 Subject: [PATCH 06/16] --- assignment1.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment1.mdwn b/assignment1.mdwn index ef1c561c..d0868501 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -145,4 +145,4 @@ You can help yourself to the following definition: (define add (lambda (x) (lambda (y) (+ x y)))) -* [Only attempt this if you're feeling frisky, it's super hard unless you have lots of experience programming] Write a function that reverses the order of the elements in a list. +* Write a function that reverses the order of the elements in a list. [Only attempt this problem if you're feeling frisky, it's super hard unless you have lots of experience programming.] -- 2.11.0 From c88cb71f06a27b98822b3580c5871c7429665674 Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 10:00:19 -0400 Subject: [PATCH 07/16] --- assignment1.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment1.mdwn b/assignment1.mdwn index d0868501..d14f792f 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -93,7 +93,7 @@ Now we can write: (p get-first) ; will evaluate to 10 (p get-second) ; will evaluate to 20 -If you're bothered by having the pair to the left and the function that operates on it come second, think about why it's being done this way: the pair is a package that takes a function for operating on its elements as an argument, and returns the result of operating on its elemens with that function. In other words, the pair is also a function. +If you're bothered by having the pair to the left and the function that operates on it come second, think about why it's being done this way: the pair is a package that takes a function for operating on its elements as an argument, and returns the result of operating on its elemens with that function. In other words, the pair is also a function. (Of course, in the untyped lambda calculus, absolutely *everything* is a function: functors, arguments, abstracts, redexes, values---everything.) If you like, you can disguise what's going on like this: -- 2.11.0 From aa7244316365eb60642e4ab70bee7cfcc427593b Mon Sep 17 00:00:00 2001 From: barker Date: Mon, 13 Sep 2010 10:01:52 -0400 Subject: [PATCH 08/16] --- assignment1.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment1.mdwn b/assignment1.mdwn index d14f792f..9c7eaf55 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -81,7 +81,7 @@ To extract the first element of a pair p, you write: p (\fst \snd. fst) -Here are some defintions in Racket: +Here are some definitions in Racket: (define make-pair (lambda (fst) (lambda (snd) (lambda (f) ((f fst) snd))))) (define get-first (lambda (fst) (lambda (snd) fst))) @@ -137,7 +137,7 @@ your choice). (((make-triple M) N) P) -should return an object that behaves in a reasonable way to serve as a triple. In addition to defining the make-triple function, you have to show how to extraxt elements of your triple. Write a get-first-of-triple function, that does for triples what get-first does for pairs. Also write get-second-of-triple and get-third-of-triple functions. +should return an object that behaves in a reasonable way to serve as a triple. In addition to defining the make-triple function, you have to show how to extract elements of your triple. Write a get-first-of-triple function, that does for triples what get-first does for pairs. Also write get-second-of-triple and get-third-of-triple functions. * Write a function second-plus-third that when given to your triple, returns the result of adding the second and third members of the triple. -- 2.11.0 From c0551f471b3bf05e5ce76e7cd0221b62eeca8b99 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Mon, 13 Sep 2010 10:23:12 -0400 Subject: [PATCH 09/16] fixed ambiguity in explanation of 'normal form' Signed-off-by: Jim Pryor --- assignment1.mdwn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/assignment1.mdwn b/assignment1.mdwn index 9c7eaf55..1c5dc981 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -1,8 +1,7 @@ Reduction --------- -Find "normal forms" for the following (that is, reduce them as far as it's possible to reduce -them): +Find "normal forms" for the following (that is, reduce them until no more reductions are possible): 1. (\x \y. y x) z 2. (\x (x x)) z -- 2.11.0 From 1848c1a9d840884193ba721c84902a146ab5eef8 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Mon, 13 Sep 2010 14:55:23 -0400 Subject: [PATCH 10/16] syncing --- offsite_reading.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/offsite_reading.mdwn b/offsite_reading.mdwn index d4b71012..43390920 100644 --- a/offsite_reading.mdwn +++ b/offsite_reading.mdwn @@ -1,4 +1,4 @@ -Many off these links are to Wikipedia. You can learn a lot from such articles, +Many of these links are to Wikipedia. You can learn a lot from such articles, so long as you remember they may sometimes mislead or make mistakes. However, I hope at this point in your education you'll have learned to be a guarded reader even of authoritative treatises by eminent authors. So you shouldn't need any @@ -55,7 +55,7 @@ get more out of. (Rinse and repeat.) * [[!wikipedia B,C,K,W system]] -* [Chris Barker's Iota and Jot]() (broken link)

+* [Chris Barker's Iota and Jot](http://semarch.linguistics.fas.nyu.edu/barker/Iota/) * [[!wikipedia Church-Rosser theorem]] * [[!wikipedia Normalization property]] * [[!wikipedia Turing completeness]]

-- 2.11.0 From dff7245eca1a2a6837ba6f9cfeb960f3a5f62125 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Mon, 13 Sep 2010 23:08:00 -0400 Subject: [PATCH 11/16] announce re mailing lists Signed-off-by: Jim Pryor --- index.mdwn | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.mdwn b/index.mdwn index 76a54f93..a5655312 100644 --- a/index.mdwn +++ b/index.mdwn @@ -8,11 +8,12 @@ This course will be co-taught by [Chris Barker](http://homepages.nyu.edu/~cb125/ ## Announcements ## The seminar meets on Mondays, starting September 13, from 4-6. -The first meeting will be in the Linguistics building at 10 Washington Place on the first floor (room 104). -(Earlier, we were going to meet in the 2nd floor Philosophy Seminar Room, at 5 -Washington Place, but there were conflicts.) We may be able to shift the time around slightly to suit the -schedule of participants; but it will remain on Mondays late -afternoon/evenings. +We'll be meeting in the Linguistics building at 10 Washington Place on the first floor (room 104). + +We've sent around an email to those who left their email addresses on the roster we passed around. But it's clear that the roster didn't make its way to everyone. So if you didn't receive our email this evening, please email with your email address, and if you're a student, say whether you expect to audit or take the class for credit. + +All students are invited to help us schedule, and then participate in, a regular student session in addition to the Monday seminar meetings. If you didn't receive our email about this, go to + as soon as you can and please tell us when you're available. ## Assignments ## -- 2.11.0 From 2466770c4ba4b1cf44894bce96cbf12434d4f4ed Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 14 Sep 2010 09:09:24 -0400 Subject: [PATCH 12/16] add damn3.rkt Signed-off-by: Jim Pryor --- damn3.rkt | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 damn3.rkt diff --git a/damn3.rkt b/damn3.rkt new file mode 100644 index 00000000..a087b4bc --- /dev/null +++ b/damn3.rkt @@ -0,0 +1,67 @@ +#lang racket +(require racket/control) + +(define damn0 (lambda () + 'id)) + +(define damn1 (lambda () + (cons '("side effect" bad) + 'id))) + +(define damn2 (lambda () (shift k + (cons '("side effect" bad) + (list (k 'id)))))) + +(define damn3 (lambda () (shift k + (list (k 'id) + '("side effect" bad))))) + + +; Now if we use damn0, our compositional semantics will work OK but +; we don't yet have any expressive contribution: + +(list "main content" 'i (list 'like (list 'the (damn0) 'boy))) +; '("main content" i (like (the id boy))) + + +; If we use damn1, we've added in the expressive side-effect: + +(list "main content" 'i (list 'like (list 'the (damn1) 'boy))) +; '("main content" i (like (the (("side effect" bad) . id) boy))) + +; However, the context (list 'the ... 'boy) is now being asked to operate +; on an element (("side effect" bad) . id), and it may complain it doesn't +; know what that is. It knows how to use 'id to get (list 'the 'id 'boy), +; and how to use 'bad to get (list 'the 'bad 'boy), but we're supposed to +; have something different here. + +; To get what we want we need to use (delimited) continuations: +(reset (list "main content" 'i (list 'like (list 'the (damn2) 'boy)))) +; '(("side effect" bad) ("main content" i (like (the id boy)))) + +; or to get the side effect at the end: + +(reset (list "main content" 'i (list 'like (list 'the (damn3) 'boy)))) +; '(("main content" i (like (the id boy))) ("side effect" bad)) + +; If you're working in the interactive interpreter, the outermost "reset" here +; is already in its default position, so it doesn't need to be explicitly +; specified: + +(list "main content" 'i (list 'like (list 'the (damn2) 'boy))) +; '(("side effect" bad) ("main content" i (like (the id boy)))) + +; However, if you're executing this as a file, you would need to include explicit resets. + + + +; Instead of using reset/shift you could use an element like "print" in +; building the side-effect, as we did in class. Here you wouldn't require an +; explicit continuation, but as Chris said, that's because "print" already +; represents an implicit continuation. + +(define damn4 (lambda () (begin (print "bad") 'id))) +(list "main content" 'i (list 'like (list 'the (damn4) 'boy))) +; "bad"'("main content" i (like (the id boy))) +; + -- 2.11.0 From 0bec426ca6b6e8672c487a1b9f0a3ef1823d267a Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 14 Sep 2010 09:29:59 -0400 Subject: [PATCH 13/16] add damn4.rkt Signed-off-by: Jim Pryor --- damn4.rkt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 damn4.rkt diff --git a/damn4.rkt b/damn4.rkt new file mode 100644 index 00000000..65fb49ea --- /dev/null +++ b/damn4.rkt @@ -0,0 +1,17 @@ +#lang racket + +; thanks to Ken! + +(let ((pragma + ; An ordered pair whose first component is the assertion + ; operator, a unary function, and whose second component + ; is the meaning of "damn", a thunk. + (call-with-current-continuation + (lambda (k) + (cons (lambda (prop) prop) + (lambda () (k (cons (lambda (prop) (list 'bad prop)) + (lambda () 'id))))))))) + (let ((assert (car pragma)) + (damn (cdr pragma))) + (assert (list 'the 'student 'read 'the (damn) 'book)))) + -- 2.11.0 From cc05a84c34f869f9c386deafd778b8ea644c7d83 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 14 Sep 2010 10:16:45 -0400 Subject: [PATCH 14/16] racket:scheme::firefox:html Signed-off-by: Jim Pryor --- how_to_get_the_programming_languages_running_on_your_computer.mdwn | 2 ++ index.mdwn | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/how_to_get_the_programming_languages_running_on_your_computer.mdwn b/how_to_get_the_programming_languages_running_on_your_computer.mdwn index 0bfcef28..a54e9ba5 100644 --- a/how_to_get_the_programming_languages_running_on_your_computer.mdwn +++ b/how_to_get_the_programming_languages_running_on_your_computer.mdwn @@ -82,6 +82,8 @@ another Scheme implementation, though, there's no compelling reason to switch.) Since the name change is so recent, you're likely to run across both sets of names. +PLT/Racket stands to Scheme in something like the relation Firefox stands to HTML. It's one program among others for working with the language; and many of the available programs permit different extensions, have small variations, and so on. + PLT Scheme had several components. The two most visible components for us were the command-line interpreter "mzscheme" and a teaching-friendly editor/front-end "DrScheme". In Racket these have been renamed "racket" and "DrRacket", diff --git a/index.mdwn b/index.mdwn index a5655312..e3053dae 100644 --- a/index.mdwn +++ b/index.mdwn @@ -122,7 +122,7 @@ and Caml, which are prominent *functional programming languages*. We'll explain what that means during the course. * **Scheme** is one of two major dialects of *Lisp*, which is a large family -of programming languages. The other dialect is called "CommonLisp." Scheme +of programming languages. The other dialect is called "Common Lisp." Scheme is the more clean and minimalistic dialect, and is what's mostly used in academic circles. Scheme itself has umpteen different "implementations", which share most of @@ -132,6 +132,8 @@ PLT Scheme, and has just in the past few weeks changed their name to Racket. This is what we recommend you use. (If you're already using or comfortable with another Scheme implementation, though, there's no compelling reason to switch.) + Racket stands to Scheme in something like the relation Firefox stands to HTML. + * **Caml** is one of two major dialects of *ML*, which is another large family of programming languages. The other dialect is called "SML" and has several implementations. But Caml has only one active implementation, -- 2.11.0 From 4805a86086b8d072cd68ccbbf03cc52dc7d8b093 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 14 Sep 2010 11:23:47 -0400 Subject: [PATCH 15/16] Firefox analogy tweak Signed-off-by: Jim Pryor --- how_to_get_the_programming_languages_running_on_your_computer.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/how_to_get_the_programming_languages_running_on_your_computer.mdwn b/how_to_get_the_programming_languages_running_on_your_computer.mdwn index a54e9ba5..028b0c64 100644 --- a/how_to_get_the_programming_languages_running_on_your_computer.mdwn +++ b/how_to_get_the_programming_languages_running_on_your_computer.mdwn @@ -82,7 +82,7 @@ another Scheme implementation, though, there's no compelling reason to switch.) Since the name change is so recent, you're likely to run across both sets of names. -PLT/Racket stands to Scheme in something like the relation Firefox stands to HTML. It's one program among others for working with the language; and many of the available programs permit different extensions, have small variations, and so on. +PLT/Racket stands to Scheme in something like the relation Firefox stands to HTML. It's one program among others for working with the language; and many of those programs (or web browsers) permit different extensions, have small variations, and so on. PLT Scheme had several components. The two most visible components for us were the command-line interpreter "mzscheme" and a teaching-friendly editor/front-end "DrScheme". In -- 2.11.0 From d84080ee53c691870c5a8cf462e08bcc5b888104 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 14 Sep 2010 11:26:22 -0400 Subject: [PATCH 16/16] announcements tweak Signed-off-by: Jim Pryor --- index.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.mdwn b/index.mdwn index e3053dae..74aaddf9 100644 --- a/index.mdwn +++ b/index.mdwn @@ -7,8 +7,8 @@ This course will be co-taught by [Chris Barker](http://homepages.nyu.edu/~cb125/ ## Announcements ## -The seminar meets on Mondays, starting September 13, from 4-6. -We'll be meeting in the Linguistics building at 10 Washington Place on the first floor (room 104). +The seminar meets on Mondays from 4-6, in +the Linguistics building at 10 Washington Place, in room 104 (back of the first floor). We've sent around an email to those who left their email addresses on the roster we passed around. But it's clear that the roster didn't make its way to everyone. So if you didn't receive our email this evening, please email with your email address, and if you're a student, say whether you expect to audit or take the class for credit. -- 2.11.0