dec16_part1 is
input := (io.stdin.with ()->io.buffered.read_lines).val.filter !=""
.map (.as_codepoints)
area := array2 String input.count input[0].count i,j->input[i][j]
part1 =>
lm : mutate.
lm.go ()->
visited := (lm.array u8).type.new lm area.length 0
r => 1
l => 2
u => 4
d => 8
ix(x,y) => y+x*area.length1
trace(x,y,w i32) unit =>
if ((x ∈ area.indices1) &&
(y ∈ area.indices2) &&
visited[ix x y] & d = 0) then
visited[ix x y] = visited[ix x y] | d
c := area[y,x]
trace 0 0 r
(visited.filter !=0).count
say "part1 $part1"
refers to position <built-in> in the error
> ~/fuzion/clean/fuzion/build/bin/fz -XmaxErrors=1 part1_error_at_pos_built-in.fz
/home/fridi/fuzion/advent_of_code/fuzion_aoc/2023/16/part1_error_at_pos_built-in.fz:18:33: error 1: Incompatible types in branches of if expression
(y ∈ area.indices2) &&
--------------------------------^^
Incompatible result types in different branches:
block returns value of type 'u8' at /home/fridi/fuzion/advent_of_code/fuzion_aoc/2023/16/part1_error_at_pos_built-in.fz:19:20:
visited[ix x y] & d = 0) then
-------------------^
block returns value of type 'bool' at <built-in>:
<built-in>: warning 1: Maximum error count reached, terminating.
Maximum error count is 1.
Change this via property 'fuzion.maxErrorCount' or command line option '-XmaxErrors'.
one error and one warning.
This
refers to position
<built-in>
in the error