Skip to content

Instantly share code, notes, and snippets.

@commy2
Last active March 8, 2020 18:33
Show Gist options
  • Save commy2/5c87b2bac8647d81581104166e357bd2 to your computer and use it in GitHub Desktop.
Save commy2/5c87b2bac8647d81581104166e357bd2 to your computer and use it in GitHub Desktop.

forAny

∃xC(x)

private _array = [1,2,3,4,5];
private _condition = {_x > 10};

_array findIf _condition != -1

"There is some X in _array such that X > 10."
-> false

#define FOR_ANY(set,condition) (set findIf {condition} != -1)

forNone (= not forAny)

∀x¬C(x)⇔¬∃xC(x)

private _array = [1,2,3,4,5];
private _condition = {_x > 10};

_array findIf _condition == -1

"There is no X in _array such that X > 10."
-> true

#define FOR_NONE(set,condition) (set findIf {condition} == -1)
#define FOR_NONE(set,condition) !FOR_ANY(set,condition)

forAll

∀xC(x)

private _array = [1,2,3,4,5];
private _condition = {_x > 10};

_array findIf {!call _condition} == -1

"Every X in _array is such that X > 10."
-> false

#define FOR_ALL(set,condition) (set findIf {!(condition)} == -1)

forSomeNot (= not forAll)

∃x¬C(x)⇔¬∀xC(x)

private _array = [1,2,3,4,5];
private _condition = {_x > 10};

_array findIf {!call _condition} != -1

"Not every X in _array is such that X > 10."
-> true

#define FOR_SOME_NOT(set,condition) (set findIf {!(condition)} != -1)
#define FOR_SOME_NOT(set,condition) !FOR_ALL(set,condition)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment