I’m trying to work through Udacity’s CS212 using Scala but had trouble with the Zebra Puzzle,
Some of the concepts in python just doesn’t convert to Scala easily, especially for a beginner like me.

These are the codes I’ve managed so far,
val houses = List(1, 2, 3, 4, 5)
val orderings = houses.permutations
def imright(h1: Int, h2: Int): Boolean = {
if (h1 - h2 == 1) true
else false
}
def nextto(h1: Int, h2: Int): Boolean = {
if (math.abs(h1 - h2) == 1) true
else false
}
the houses = [first, _, middle, _. _] = [1, 2, 3, 4, 5] stumped me.
Furthermore, how do i express the for (red, green, ivory, yellow, blue) in orderings in Scala? Please help me, thanks.
You want
and
respectively. Also, note that in Scala these sorts of destructurings must be assigned to variables starting with a lower-case letter; upper-case indicates that it is instead supposed to match an existing variable (or throw an exception if it does not!).