Guest User

Untitled

a guest
Jun 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. # encoding: utf-8
  2.  
  3. def ∀(arr, &block)
  4. arr.all?(&block)
  5. end
  6.  
  7. def ∃(arr, &block)
  8. arr.any?(&block)
  9. end
  10.  
  11. puts(∀ [1, 2, 3] { |x| x > 1 })
  12. puts(∀ [1, 2, 3] { |x| x >= 1 })
  13. puts(∃ [1, 2, 3] { |x| x > 1 })
  14. puts(∃ [1, 2, 3] { |x| x >= 1 })
  15. puts(∃ [1, 2, 3] { |x| x > 9 })
Add Comment
Please, Sign In to add comment