Closed shriram closed 9 months ago
Already have a fix in https://github.com/brownplt/pyret-docs/pull/74 (though not yet merged)
EDITED: that's just one function though. Will fix another one.
Student also points out:
"Since the set appears to the left of the base b , shouldn't the function be in the form f :: (a, b -> b) instead?"
The issues with foldl
/ foldr
in the list documentation are now fixed.
@shriram: I don't understand what's wrong in your second comment. The method is documented correctly, agreeing with the implementation:
import sets as S
t1 = [S.tree-set: 1, 2, 3]
fun add(acc, elem) block:
acc.add(elem + 100)
end
t1.fold(add, [S.tree-set: ]) # [tree-set: 101, 102, 103]
Perhaps the student meant that the argument ordering of set's .fold
is not consistent with list's .foldl/r
, which is true. But it's not fixable without breaking backward compatibility (then again, perhaps use context
allows us to break backward compat?)
Thanks for PR on docs! Merged that and closing this.
The signature says the first argument must be a function but the expansion shows it as the second argument.
This is for both
fold
andfoldr
.Identified by Luna Wang.