| @@ 187-193 (lines=7) @@ | ||
| 184 | * @param number $b |
|
| 185 | * @return number |
|
| 186 | */ |
|
| 187 | function min() { |
|
| 188 | static $min = false; |
|
| 189 | $min = $min ?: curry(function($a, $b){ |
|
| 190 | return $a < $b ? $a : $b; |
|
| 191 | }); |
|
| 192 | return _apply($min, func_get_args()); |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|
| 196 | * Computes the minimum of two elements using a function. |
|
| @@ 210-216 (lines=7) @@ | ||
| 207 | * @param mixed $b |
|
| 208 | * @return mixed |
|
| 209 | */ |
|
| 210 | function minBy() { |
|
| 211 | static $minBy = false; |
|
| 212 | $minBy = $minBy ?: curry(function($fn, $a, $b){ |
|
| 213 | return $fn($a) < $fn($b) ? $a : $b; |
|
| 214 | }); |
|
| 215 | return _apply($minBy, func_get_args()); |
|
| 216 | } |
|
| 217 | ||
| 218 | /** |
|
| 219 | * Computes the maximum of two numbers. |
|
| @@ 232-238 (lines=7) @@ | ||
| 229 | * @param number $b |
|
| 230 | * @return number |
|
| 231 | */ |
|
| 232 | function max() { |
|
| 233 | static $max = false; |
|
| 234 | $max = $max ?: curry(function($a, $b){ |
|
| 235 | return $a > $b ? $a : $b; |
|
| 236 | }); |
|
| 237 | return _apply($max, func_get_args()); |
|
| 238 | } |
|
| 239 | ||
| 240 | /** |
|
| 241 | * Computes the maximum of two elements using a function. |
|
| @@ 23-29 (lines=7) @@ | ||
| 20 | * @param bool $b |
|
| 21 | * @return bool |
|
| 22 | */ |
|
| 23 | function and_() { |
|
| 24 | static $and = false; |
|
| 25 | $and = $and ?: curry(function($a, $b){ |
|
| 26 | return $a && $b; |
|
| 27 | }); |
|
| 28 | return _apply($and, func_get_args()); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Returns `$a || $b`. |
|
| @@ 46-52 (lines=7) @@ | ||
| 43 | * @param bool $b |
|
| 44 | * @return bool |
|
| 45 | */ |
|
| 46 | function or_() { |
|
| 47 | static $or = false; |
|
| 48 | $or = $or ?: curry(function($a, $b){ |
|
| 49 | return $a || $b; |
|
| 50 | }); |
|
| 51 | return _apply($or, func_get_args()); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * Returns `!$x`. |
|
| @@ 107-113 (lines=7) @@ | ||
| 104 | * @param mixed $b |
|
| 105 | * @return bool |
|
| 106 | */ |
|
| 107 | function notEq() { |
|
| 108 | static $notEq = false; |
|
| 109 | $notEq = $notEq ?: curry(function($a, $b){ |
|
| 110 | return $a != $b; |
|
| 111 | }); |
|
| 112 | return _apply($notEq, func_get_args()); |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Returns `$x === $y`. |
|
| @@ 127-133 (lines=7) @@ | ||
| 124 | * @param mixed $b |
|
| 125 | * @return bool |
|
| 126 | */ |
|
| 127 | function eqq() { |
|
| 128 | static $eqq = false; |
|
| 129 | $eqq = $eqq ?: curry(function($a, $b){ |
|
| 130 | return $a === $b; |
|
| 131 | }); |
|
| 132 | return _apply($eqq, func_get_args()); |
|
| 133 | } |
|
| 134 | ||
| 135 | /** |
|
| 136 | * Returns `$x !== $y`. |
|
| @@ 148-154 (lines=7) @@ | ||
| 145 | * @param mixed $b |
|
| 146 | * @return bool |
|
| 147 | */ |
|
| 148 | function notEqq() { |
|
| 149 | static $notEqq = false; |
|
| 150 | $notEqq = $notEqq ?: curry(function($a, $b){ |
|
| 151 | return $a !== $b; |
|
| 152 | }); |
|
| 153 | return _apply($notEqq, func_get_args()); |
|
| 154 | } |
|
| 155 | ||
| 156 | /** |
|
| 157 | * Returns `true` if the two elements have the same type and are deeply equivalent. |
|
| @@ 265-271 (lines=7) @@ | ||
| 262 | * @param mixed $b |
|
| 263 | * @return bool |
|
| 264 | */ |
|
| 265 | function lt() { |
|
| 266 | static $lt = false; |
|
| 267 | $lt = $lt ?: curry(function($a, $b){ |
|
| 268 | return $a < $b; |
|
| 269 | }); |
|
| 270 | return _apply($lt, func_get_args()); |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * Returns `$a <= $b`. |
|
| @@ 287-293 (lines=7) @@ | ||
| 284 | * @param mixed $b |
|
| 285 | * @return bool |
|
| 286 | */ |
|
| 287 | function lte() { |
|
| 288 | static $lte = false; |
|
| 289 | $lte = $lte ?: curry(function($a, $b){ |
|
| 290 | return $a <= $b; |
|
| 291 | }); |
|
| 292 | return _apply($lte, func_get_args()); |
|
| 293 | } |
|
| 294 | ||
| 295 | /** |
|
| 296 | * Returns `$a > $b`. |
|
| @@ 309-315 (lines=7) @@ | ||
| 306 | * @param mixed $b |
|
| 307 | * @return bool |
|
| 308 | */ |
|
| 309 | function gt() { |
|
| 310 | static $gt = false; |
|
| 311 | $gt = $gt ?: curry(function($a, $b){ |
|
| 312 | return $a > $b; |
|
| 313 | }); |
|
| 314 | return _apply($gt, func_get_args()); |
|
| 315 | } |
|
| 316 | ||
| 317 | /** |
|
| 318 | * Returns `$a >= $b`. |
|
| @@ 331-337 (lines=7) @@ | ||
| 328 | * @param mixed $b |
|
| 329 | * @return bool |
|
| 330 | */ |
|
| 331 | function gte() { |
|
| 332 | static $gte = false; |
|
| 333 | $gte = $gte ?: curry(function($a, $b){ |
|
| 334 | return $a >= $b; |
|
| 335 | }); |
|
| 336 | return _apply($gte, func_get_args()); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||