LectureBlog
Home Syllabus Lecture Blog Resources Piazza Bottlenose
Meeting 29: Mon Apr 8
- Curran's lambda-calc implementation in CoffeeScript
- Ryan's method of fully implementing ObjScript
- final project/paper instead of final exam option?
- discussion of Clojure -- see https://piazza.com/class#spring2013/91531/90
Meeting 28: Fri Apr 5
- working on projects discussion
Meeting 27: Wed Apr 3
- working on projects discussion
Meeting 26: Mon Apr 1
- Scala ?
Meeting 25: Fri Mar 29
- started Scala in earnest
- the range
0 until n
is equivalent to0.until(n)
- discussion of map-from-fold; in particular, that mapping over a
Seq
of things (not necessarily a list sequence) might needs produce an output sequence of the same type as the input sequence (sequences need to be the same type), and furthermore, might produce items in that sequence that are of a different type than the input items. E.g., mapping from a list of ints to a list of strings. - there are a bunch of evil library functions to accomplish this:
scala.collection.Seq
is the generic type of a sequence object;companion.empty[Type]
is a method call that creates a new empty one of these. - we also looked at the bracket syntax for declaring types; e.g.
def map[A,B]
declares a function of two typesA
andB
:+
is append
Meeting 24: Wed Mar 27
- a problem was posted by Ryan, whose subtract wasn't working, except when it was used by his divide!
(λa.(λba.ab)(λb.ba))
(λba.ab)
to its arg (λb.ba)
((λb.ba)/b)
in the former:
(λa.(λa.a(λb.ba)))
a
is bound to the opening λa
, and that
λa.a<blah>
needs to get its a
renamed; e.g. to z
:
(λa.(λz.z(λb.ba)))
- how to do tracing in Haskell:
import Debug.trace
printy a = trace (showLx a) a
printy
around your code
- beta reduction is function application
- alpha reduction is variable renaming
- the Y combinator won't terminate if you reduce using application order;
- then we talked about Scala stuff: how to build; the apply and update operators.
Meeting 23: Mon Mar 25
- understood how
T
andF
work - understood how
and
andor
work - understood how
not
works - understood what predecessor should be doing
- realized that numbers apply their first argument n times to their second argument
- began understanding the Y combinator
Meeting 22: Fri Mar 22
- Discussed two students' solutions to hw27 expression simplifier
- Lambda calculus dup function
- Church numerals: how they work
Meeting 21: Wed Mar 20
- Lambda calculus detailed intro
- Bound and unbound variables
Meeting 20: Mon Mar 18
- discussed append vs. reversing at the end in the map-from-fold problem: reversing at the end is more efficient, because each append is O(n), so walking down the whole list with appends is O(n^2)
- discussed Erlang assignments hw25 concurrent prime sieve and hw26 web stuff
- introduced the lambda calculus: Church and Turing both developed (what were ultimately demonstrated to be) computationally equivalent models of computing. Church's was about functions and rewrite rules; Turing's was about machines.
Fri Mar 8
- snowday; no class
Meeting 19: Wed Mar 6
- we must have talked about Erlang
Meeting 18: Mon Mar 4
!
ends rule (no backtracking afterward)fd_domain
limits variable bindings to a range of integers- improved
findall
rule inuml.pl
(two variables weren't referenced and could be replaced with underscores) - looked at Todd's sort code; fixed it by adding rule matching empty lists (instead of list of one item)
- started talking about Erlang
Meeting 17: Fri Mar 1
- Talked about Sudoku in Prolog.
- More trying to figure out how Prolog works.
Meeting 16: Wed Feb 27
- Rewrote Quicksort about six different ways.
- Discussed differences between
is
,=
, and=!=
.
Meeting 15: Mon Feb 25
- Hand out and go over
hw16
answers. Then you can dohw18
. - Talk about
hw17
. - Introduce Prolog.
Meeting 14: Fri Feb 22
- Went over
hw16
in some detail read through and discussed the code
Meeting 13: Wed Feb 20
Meeting 12: Tue Feb 19
- MoreIo list comprehension
- concurrency in Io actors and futures
- ObjScript intro for Assignment 16
Meeting 11: Fri Feb 15
hw14
due Mon web server/client in Io
Meeting 10: Wed Feb 13
- message reflection
- delayed evaluation of method arguments
- DSL example from the book
hw13
due Fri will be:- Io metaprogramming -- TBD -- (having a block) and (typing the body of the block as an arg) are two different ways to pass code in Io.
- operator overloading
Meeting 9: Mon Feb 11
- introduce Io; assign IoBasics (due Wed)
- in Io, everything is a message
hw12
due Wed will be: iterative and recursive Fib, 2d array, reverse words, T9, and everything else from RubyBasics
Meeting 8: Fri Feb 8
- discussed how regex in Ruby works... here is a transcript of our session:
nat@mirage:~$ irb 1.9.3p194 :001 > "hello".match(/bye/) => nil 1.9.3p194 :002 > "hello".match(/elo/) => nil 1.9.3p194 :003 > "hello".match(/ello/) => #<MatchData "ello">
direct string matches or fails
1.9.3p194 :004 > "hello".match(/^he/) => #<MatchData "he">
^
matches the beginning of a line
1.9.3p194 :005 > "hello".match(/^lo/) => nil 1.9.3p194 :006 > "hello".match(/lo$/) => #<MatchData "lo"> 1.9.3p194 :007 > "hello".match(/he$/) => nil
$
matches the end of a line
1.9.3p194 :008 > "hello".match(/l*/) => #<MatchData "">
*
matches zero or more occurrences
1.9.3p194 :009 > "hello".match(/l+/) => #<MatchData "ll">
+
matches one or more
1.9.3p194 :011 > "hello".match(/./) => #<MatchData "hello">
.
matches the whole thing
1.9.3p194 :012 > "hello".match(/^he(l)o$/) => #<MatchData "hello" 1:"ll">
by using parens, we can excerpt the match. Now there are two match results: the whole match, and what's in parens
1.9.3p194 :013 > mm = "hello".match(/^he(l*)o$/) => #<MatchData "hello" 1:"ll"> 1.9.3p194 :014 > mm[0] => "hello" 1.9.3p194 :015 > mm[1] => "ll"
we assign the match to mm
, and then we can pick out the first and second matches
- discussed metaprogramming in Ruby
- concurrency in Ruby and intro'd
hw11
Meeting 7: Wed Feb 6
- Ruby's
inject
is a fold - code blocks in Ruby (any object can have one); using
&
syntax to pass code block (which is then executed usingyield
) - accessors in Ruby
- scoping: dynamic vs. static
Meeting 6: Mon Feb 4 discussion of Haskell:
- how fold actually works (left vs right)
- how pattern-matching works
- the Sub and Call stubs
discussion of Ruby:
- tryruby and other intro material
Meeting 5: Fri Feb 1
- go over
if
- talk about what's necessary for
while
- talk about what's necessary for subroutines
Meeting 4: Wed Jan 30
- talked about interpreters
Meeting 3: Mon Jan 28
- HaskellBasics feedback
- indentation of if-then-else
- three ways of doing filter: list recursion, list comprehension, and filter
- unnecessary pattern match
- HigherOrder suggestions
- myFoldr
- Primes
- MapFromFold http://fayaa.com/code/view/2225/
Meeting 2: Fri Jan 25
- discussed HaskellBasics assignment
- discussed HigherOrder assignment
- walked through Google CodeJam files