This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def curry(func): | |
def f(*args): | |
outerArgs = args | |
next = lambda *args : f(*args, *outerArgs) | |
next.value = lambda: func(args) | |
return next | |
return f | |
add = curry(sum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://gist.github.com/jcheng5/6141ea7066e62cafb31c | |
# Returns a reactive that debounces the given expression by the given time in | |
# milliseconds. | |
# | |
# This is not a true debounce in that it will not prevent \code{expr} from being | |
# called many times (in fact it may be called more times than usual), but | |
# rather, the reactive invalidation signal that is produced by expr is debounced | |
# instead. This means that this function should be used when \code{expr} is | |
# cheap but the things it will trigger (outputs and reactives that use | |
# \code{expr}) are expensive. |
NewerOlder