brownplt / pyret-docs

The documentation for Pyret.
9 stars 18 forks source link

Spy unbound id error #50

Closed sorawee closed 4 years ago

sorawee commented 5 years ago

In https://www.pyret.org/docs/latest/s_spies.html, the code example:

fun reverse(lst, sofar):
  spy "lengths":
    lst-length: lst.length(),
    sofar-length: sofar.length(),
    sum: lst.length() + sofar.length()
  end
  cases(List<A>) lst:
    | empty => sofar
    | link(first, rest) =>
      reverse(rest, link(first, sofar))
  end
end

check:
  reverse([list: "a", "b", "c"], empty) is [list: "c", "b", "a"]
end

has an unbound id A in List<A>.