Commit c7e261cc authored by Michael Hanus 's avatar Michael Hanus
Browse files

libs and tools updated

parent 27838fd1
currytools @ adcc2ed6
Subproject commit 76e002b683ee1eec12d6f197653103cb8b6a4c84
Subproject commit adcc2ed63566d18b6b7177ddb75209927caff0fd
......@@ -10,13 +10,13 @@ account n (Deposit a : ms) = account (n+a) ms
account n (Withdraw a : ms) = account (n-a) ms
account n (Balance b : ms) = b=:=n & account n ms
make_account s = account 0 (ensureSpine s) -- create bank account
makeAccount s = account 0 (ensureSpine s) -- create bank account
-- goals:
goal1 b = let s free in
make_account s & s=:=[Deposit 200, Deposit 50, Balance b]
makeAccount s & s=:=[Deposit 200, Deposit 50, Balance b]
goal2 b = let s free in
make_account s &
makeAccount s &
s=:=[Deposit 200, Withdraw 100, Deposit 50, Balance b]
-- send a message:
......@@ -29,6 +29,6 @@ client s | s1 =:= sendMsg (Balance b) s =
else client (sendMsg (Deposit 70) s1) -- work
where s1,b free
goal3 s = make_account s & client (sendMsg (Deposit 100) s) -- simulation
goal3 s = makeAccount s & client (sendMsg (Deposit 100) s) -- simulation
......@@ -25,21 +25,20 @@ diff x y = (ensureNotFree x == ensureNotFree y) =:= False
data Color = Red | Green | Yellow | Blue
isColor :: Color -> Success
isColor Red = success
isColor Yellow = success
isColor Green = success
isColor Blue = success
isColor :: Color -> Bool
isColor Red = True
isColor Yellow = True
isColor Green = True
isColor Blue = True
coloring :: Color -> Color -> Color -> Color -> Success
coloring :: Color -> Color -> Color -> Color -> Bool
coloring l1 l2 l3 l4 = isColor l1 & isColor l2 & isColor l3 & isColor l4
-- correct coloring:
correct :: Color -> Color -> Color -> Color -> Success
correct l1 l2 l3 l4
= diff l1 l2 & diff l1 l3 & diff l2 l3 & diff l2 l4 & diff l3 l4
correct :: Color -> Color -> Color -> Color -> Bool
correct l1 l2 l3 l4 = l1 /= l2 & l1 /= l3 & l2 /= l3 & l2 /= l4 & l3 /= l4
-- generate+test solution:
......
lib-trunk @ 51d33cee
Subproject commit cfb63d51206303d919efc199694ed6b2bb391bb1
Subproject commit 51d33ceeed11bfdfa534e6bd7947ffb32e348deb
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment