Skip to content

Instantly share code, notes, and snippets.

@coke

coke/monadic.t Secret

Created January 19, 2021 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coke/94d976b93b5bd41ea5c52f295654bc86 to your computer and use it in GitHub Desktop.
Save coke/94d976b93b5bd41ea5c52f295654bc86 to your computer and use it in GitHub Desktop.
#!/usr/bin/env raku
use Test;
use APL::Operators;
plan 20;
is +2, 2, "conjugate positive";
is +⁻2, ⁻2, "conjugate negative";
is −⁻2, 2, "negate negative";
is ×2, 1, "signum positive";
is ×⁻2, -1, "signum negative";
is ×0, 0, "signum zero";
is ÷10, 0.1, "reciprocal";
is !0, 1, "factorial";
is !4, 24, "factorial";
is ⌈3.14, 4, "ceiling positive";
is ⌈⁻3.14, -3, "ceiling negative";
is ⌊3.14, 3, "floor positive";
is ⌊⁻3.14, ⁻4, "floor negative";
is ~0, 1, "not 0";
is ~1, 0, "not 1";
is *1, 𝑒, "exponential";
is ○1, π, "Pi times 1";
is ○3, π*3, "Pi times 3";
is ⍟𝑒, 1, "natural logarithm";
is*1, 1, "inverse exp/ln";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment