lean4-htt/tests/lean/run/lcnfCheckIssue.lean
2022-09-23 16:45:04 -07:00

14 lines
364 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Lean
abbrev Sequence (α : Type) := List α
def bigop (init : β) (seq : Sequence α) (op : β → β → β) (f : α → Bool × β) : β := Id.run do
let mut result := init
for a in seq do
let (ok, b) := f a
if ok then
result := op result b
return result
set_option trace.Compiler.result true
#eval Lean.Compiler.compile #[``bigop]