Skip to content

Instantly share code, notes, and snippets.

@knjname
Created August 10, 2012 16:39
Show Gist options
  • Save knjname/3315437 to your computer and use it in GitHub Desktop.
Save knjname/3315437 to your computer and use it in GitHub Desktop.
satisfy = (fn) ->
_f = (args, length) ->
return fn args... if length is 0
more = (bool) -> _f [args..., bool], length - 1
more(true) or more(false)
_f [], fn.length
console.log (satisfy (a, b) -> a and b)
console.log (satisfy (a) -> false )
console.log (satisfy (a, b, c) -> (a and b) and not(a and b) )
console.log (satisfy (a, b, c) -> (a and b) or not(a and b) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment