Difference between revisions of "Fabulous ! Operator"
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
<pre> | <pre> | ||
− | "x^2"! | + | "x^2"! |
("x^2"!)(3) | ("x^2"!)(3) | ||
// could make ! binary with similar behavior too. | // could make ! binary with similar behavior too. |
Revision as of 10:50, 10 June 2024
Fabulous ! Operator
! is called the Fabulous Operator in z^3 languate. In the basic form, it is meant to compute the fantastic factorial function. However, based on the arguments provided, it can simply create powerful functions with the simple notation of ! to a string, regular expression, etc. This dramatically simplifies notation to create functions, and makes for powerful and fabulously expressive code. ! Operator can have multiple meanings, when used as a suffix. of course, as a prefix, ! represents NOT as in most C like languages.
! can be used to (1) Compute factorial of numbers (including complex numbers etc), (2) Create functions out of strings, (3) Create predicate functions and search functions out of simple notations with regular expressions, strings, etc.
"x^2"! ("x^2"!)(3) // could make ! binary with similar behavior too. 1..100.$("x^2"!) 1..100.$("SIN(x)"!) ("SIN(x)"!)(3,4) s="x^5"; g=(s!); g(34); s="x^5+y^4"; g=(s!); g(1,3); ("x^5+y^4+z^5"!)(2,3,4); MS(12).$$("SUM(x)"!) MS(1..12).$$("SUM(x)"!) a="x^4"; foured=(a!)#; foured(1..34) (["x^3","x^4"]!)@1..3 // did not work ("x^"|.+|1..10)!@(1..10) //this did not parse ("x^"|x+y|1..10)!@1..10 // also did not parse ("x+"|x+y|1..10)!@1..10 "<1"! // this gives "" on fixchars ("x<3"!)(2) ("x<3&&y>4"!)(2,5) "<'absc'"! "<=3"! ">=3"! "!=3"! ("x<3&&x>4"!)+"" ("SIN(x)"!)(35deg) "==(44)"! "==(44!)"! f1="FEQ(44!,x)"!; f1(43!) ..5@((1..10|.+|"x")!) ..50@((1..10|.+|"x^")!) 1..100.F(">50"!) 1..100.F("x>5&&x<25"!)