HackerTrans
TopNewTrendsCommentsPastAskShowJobs

developedby

no profile record

comments

developedby
·2 years ago·discuss
That's the main idea!
developedby
·2 years ago·discuss
Bending is an operation similar to folding, both in real life and in the language. While fold is recursive on data, bend is recursive on a boolean condition (like a pure while that supports multiple branching recursion points).

I was actually looking forward to seeing someone from Bend to make a comment like this
developedby
·2 years ago·discuss
The first `fork` is from using bend and passing the initial state

  The program above will initialize a state (`x = 0`), and then, for as long as `x < 3`,
  it will "fork" that state in two, creating a `Tree/Node`, and continuing with `x + 1`.
  When `x >= 3`, it will halt and return a `Tree/Leaf` with `7`.
  When all is done, the result will be assigned to the `tree` variable: