- do:
- how to write BlockClosurewith parameters
- isEmpty
- ifTrue
- Order of Operations for methods:
- Unary
- Binary
- Keyword operators
 
Possible Questions:
- explain the algorithm
- write the algorithm in a language of your choice
- list the disadvantages of the algorithm
- Spatial: returning all results at once
- think of heads and tails logic
 
- Temporal: return results one-by-one (semi-colon)
Possible Questions:
- Describe the mechanism when a exception is executed
- Here's some code with exceptions, what does it print?
- Explain longjmp or setjmp
- Construct programs
- Alternatives to smart pointers
- Look at an implementation smart pointer class and spot bugs
- element : list
- list1 ++ list2
mapM is used to apply a monadic operations to elements in a list. If we ran the following code with regular map then we will just get a list of IO () because map doesn't actually execute the monadic operation.
mapM putStrLn ["hello", "there", "noodle"]- Will not need to write code
- Should know the basics
- Be familiar with the inheritance model
- How are inheritance hierarchies created?
- How are methods evaluated?
Answer:
* `foo` returns `Just 7`
* `bar 1 2` returns `Nothing`
* `baz 5` returns `Nothing`
	- We stop immediately when `bar c 1` returns Nothing!
addToAll: val
	self do: [:subset | subset add: val. ].
	^self.
powerset
	|mysubsets|
	self isEmpty
		ifTrue:
			[self class newFrom: {self class new}].
		ifFalse:
			[
				mysubsets := (self allButFirst) powerset.
				mysubsets, mysubsets copy addtoAll: self first.
			].uniq([], []).
uniq([H|T], [H|T2]) :- not(member(H,T)), uniq(T,T2).
uniq([H|T], T2) :- member(H,T), !, uniq(T, T2).
% Without a cut, like below, this would call return
% twice if an element is in a list three times
% uniq([H|T], T2) :- member(H,T), uniq(T, T2).uniq2([H|T], H) :- not(member(H,T)).
uniq2([_|T], X) :- uniq2(T, X).
% We don't need to write the base case explicitly,
% like below, because prolog fails non-existant
% predicates by default
% uniq2([],_) :- fail.map reverse
reverse has the type [a] -> [a].
map has the type (a->b) -> [a] -> [b]
So that means map reverse is a function that takes in and returns a list of lists.
map reverse :: [[a]] -> [[a]]
data Node a = Node a [Node a]
graph1 = Node 1 [
				Node 2 [Node 5[]]
				Node 3 [],
				Node 4 [Node 6 [Node7 [], Node 8 []]]
				]
graph 2 = Node 1 [
				Node 2 [Node 5 []],
				Node 3 [],
				Node 4 [Node 6 [Node 7 [graph2], Node 8 []]]
				]hasCycles :: Eq a => Node a -> Bool
hasCycles node = go [] node
	where go seen (Node val outgoing) = 
		case val `elem` seen of
			True -> True
			False -> 
				let newseen = val : seen
				 in True `elem` (map (go newseen) outgoing)#school/f19/proglang-f19