




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





For Grading
local fun {MyF I} 10I end in {Test {SumValues MyF 1 3} ’==’ 60} end {Test {SumValues fun {$ I} 3 end 1 10} ’==’ 30} {Test {SumValues fun {$ I} I end 1 10} ’==’ 55} {Test {SumValues fun {$ I} I end 2 10} ’==’ 54} {Test {SumValues fun {$ I} vals(3 7 9 2).I end 1 4} ’==’ 21} {Test {SumValues fun {$ I} II+1 end 2 10} ’==’ 393}
{Test {Positive nil} ’==’ nil} {Test {Positive [~1]} ’==’ nil} {Test {Positive [3 7 ~1]} ’==’ [3 7]} {Test {Positive [~3 3 7 ~1]} ’==’ [3 7]} {Test {Positive [~2 0 5 ~3 3 7 ~1]} ’==’ [5 3 7]} {Test {Positive [0 5 ~3 3 7 ~1]} ’==’ [5 3 7]}
{Test {NegateIfs expStmt(numExp(3))} ’==’ expStmt(numExp(3))} {Test {NegateIfs expStmt(varExp(y))} ’==’ expStmt(varExp(y))} {Test {NegateIfs expStmt(equalsExp(varExp(y) varExp(z)))} ’==’ expStmt(equalsExp(varExp(y) varExp(z)))} {Test {NegateIfs assignStmt(x numExp(3))} ’==’ assignStmt(x numExp(3))} {Test {NegateIfs ifStmt(varExp( true ) assignStmt(x numExp(3)))} ’==’ ifStmt(equalsExp(varExp( true ) varExp( false )) assignStmt(x numExp(3)))} {Test {NegateIfs expStmt(beginExp(nil numExp(3)))} ’==’ expStmt(beginExp(nil numExp(3)))} {Test {NegateIfs expStmt(beginExp([ifStmt(varExp( true ) assignStmt(x numExp(3))) assignStmt(y numExp(4))] varExp(y)))} ’==’ expStmt(beginExp([ifStmt(equalsExp(varExp( true ) varExp( false )) assignStmt(x numExp(3))) assignStmt(y numExp(4))] varExp(y)))} {Test {NegateIfs ifStmt(beginExp([ifStmt(varExp( true ) assignStmt(x numExp(3))) assignStmt(y numExp(4))] varExp(y)) assignStmt(q beginExp([ifStmt(varExp(m) expStmt(numExp(7)))] varExp(m))))} ’==’ ifStmt(equalsExp(beginExp([ifStmt(equalsExp(varExp( true ) varExp( false )) assignStmt(x numExp(3))) assignStmt(y numExp(4))] varExp(y)) varExp( false )) assignStmt(q beginExp([ifStmt(equalsExp(varExp(m) varExp( false )) expStmt(numExp(7)))] varExp(m))))}
{Test {Transpose pitch(3) 7} ’==’ pitch(10)} {Test {Transpose pitch(10) 5} ’==’ pitch(15)} {Test {Transpose chord(nil) ~3} ’==’ chord(nil)} {Test {Transpose chord([pitch(1) pitch(5) pitch(8)]) 2} ’==’ chord([pitch(3) pitch(7) pitch(10)])} {Test {Transpose sequence(nil) ~1} ’==’ sequence(nil)} {Test {Transpose sequence([pitch(1) pitch(5) pitch(8)]) 2} ’==’ sequence([pitch(3) pitch(7) pitch(10)])} {Test {Transpose sequence([chord([pitch(1) pitch(5) pitch(8)]) chord([pitch(3) pitch(7) pitch(0)]) chord([pitch(7) pitch(5) pitch(9)])]) 1} ’==’ sequence([chord([pitch(2) pitch(6) pitch(9)]) chord([pitch(4) pitch(8) pitch(1)]) chord([pitch(8) pitch(6) pitch(10)])])} {Test {Transpose chord([sequence([chord([pitch(1) pitch(5) pitch(8)]) chord([pitch(3) pitch(7) pitch(0)]) chord([pitch(7) pitch(5) pitch(9)])]) sequence([pitch(1) pitch(1)]) chord([sequence(nil) sequence([pitch(3)])])]) 1} ’==’ chord([sequence([chord([pitch(2) pitch(6) pitch(9)]) chord([pitch(4) pitch(8) pitch(1)]) chord([pitch(8) pitch(6) pitch(10)])]) sequence([pitch(2) pitch(2)]) chord([sequence(nil) sequence([pitch(4)])])])} {Test {Transpose sequence([chord([sequence([chord([pitch(1) pitch(5) pitch(8)]) chord([pitch(3) pitch(7) pitch(0)]) chord([pitch(7) pitch(5) pitch(9)])]) sequence([pitch(1) pitch(1)]) chord([sequence(nil) sequence([pitch(3)])])]) chord([pitch(1) pitch(9)])]) 1} ’==’ sequence([chord([sequence([chord([pitch(2) pitch(6) pitch(9)]) chord([pitch(4) pitch(8) pitch(1)]) chord([pitch(8) pitch(6) pitch(10)])]) sequence([pitch(2) pitch(2)]) chord([sequence(nil) sequence([pitch(4)])])]) chord([pitch(2) pitch(10)])])}