programgames/capitals/capitals.xtl

source · imports a: games/capitals/Atlas.xtl

p : Int

value · line 15
p ← f̲irst w̲here '{ i → "Paris, France" m̲atch ᵃn̲ame i } e̲ach ᵃp̲ool 0

s : Int

value · line 26
s ← ᵃn̲ew 4

pic : Char

value · line 28
pic ← ⎕S̲HOW ᵃd̲raw s

i : Int

value · line 32
i ← f̲irst ᵃd̲ots s
Used in: t, k

t : Int

value · line 33
t ← s ᵃc̲lick ᵃa̲t i

k : Int

value · line 35
k ← f̲irst w̲here (ᵃc̲hoices i) = ᵃa̲nswer i
Used in: b

b : Float

value · line 36
b ← k s̲elect ᵃm̲enu t
Used in: t

t : Int

value · line 37
t ← t ᵃc̲lick ((f̲irst b) + 0.5 × 3 s̲elect b) c̲at (2 s̲elect b) + 0.5 × 4 s̲elect b

pic : Char

value · line 39
pic ← ⎕S̲HOW ᵃd̲raw t

ok : Unit

value · line 45
ok ← "\"Paris\" m_atch a:t_own a:a_nswer p" a̲ssert< "the nearest city to a capital is the capital"
a̲ssert< expands to
({ @ → ("Paris" m̲atch ᵃt̲own ᵃa̲nswer p) ? @◆ ⎕E̲RR "assertion failed: \"Paris\" m_atch a:t_own a:a_nswer p (the nearest city to a capital is the capital) [games/capitals/capitals.xtl:45]"◆ @ } @)

ok : Unit

value · line 46
ok ← "(a:a_nswer p) m_ember? a:c_hoices p" a̲ssert< "the answer is among the choices"
a̲ssert< expands to
({ @ → ((ᵃa̲nswer p) m̲ember? ᵃc̲hoices p) ? @◆ ⎕E̲RR "assertion failed: (a:a_nswer p) m_ember? a:c_hoices p (the answer is among the choices) [games/capitals/capitals.xtl:46]"◆ @ } @)