You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func shouldBeAnonymous(x: u32) -> bool:
true
-- Imagine a complex library function, like onKademliaNeighborhood(key, cb)
func foo(xs: []u32, cb: u32 -> bool):
for x <- xs:
cb(x)
func actuallyUsed():
xs <- Discovery.getXs()
foo(xs, shouldBeAnonymous)
With sugar:
func foo(xs: []u32, cb: u32 -> bool):
for x <- xs:
cb(x)
func actuallyUsed():
xs <- Discovery.getXs()
foo(xs) do x: -- x is the local parameter, type is derived from the foo definition
true
The text was updated successfully, but these errors were encountered:
Syntax sugar to simplify the composition.
Without sugar:
With sugar:
The text was updated successfully, but these errors were encountered: