✓
Passing This code compiles and runs correctly.
Code
// `when` is the only guard word, and it takes either stage position on an
// each arm: before the `{ }` it guards the binding scope, after it guards
// the produced scope. `! each i when c { f }` filters the element, then
// projects — the `when` cannot see produced names. `! each i { f } when c`
// projects, then filters the projection. The chain `when c { f } when c2`
// is the same two operators folded — filter, project, filter again.
import std/io
for(1..8)
! each i when i % 2 == 0 { double: i * 2 } |> std/io:print.ln("a{{ double:d }}")
for(1..8)
! each i { double: i * 2 } when double > 6 |> std/io:print.ln("b{{ double:d }}")
for(1..8)
! each i when i % 2 == 0 { double: i * 2 } when double > 6 |> std/io:print.ln("c{{ double:d }}")
Actual
a4
a8
a12
b8
b10
b12
b14
c8
c12
Expected output
a4
a8
a12
b8
b10
b12
b14
c8
c12
Flows
flow ~for click a branch to expand · @labels scroll to their anchor
for (1..8)
flow ~for click a branch to expand · @labels scroll to their anchor
for (1..8)
flow ~for click a branch to expand · @labels scroll to their anchor
for (1..8)
Test Configuration
MUST_RUN