Changes

665 bytes added ,  16:55, 10 June 2024
Line 7: Line 7:  
  ! 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.
 
  ! 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.
    +
====Converting A String To A Function===
 +
 +
A simple string can be converted to a function with ! operator, and parameters are detected automatically using z^3 rules.
 
<pre>
 
<pre>
   Line 41: Line 44:  
// also did not parse
 
// also did not parse
 
("x+"|x+y|1..10)!@1..10
 
("x+"|x+y|1..10)!@1..10
+
</pre>
 +
 
 +
Simple predicate functions (functions that do simple boolean true/false checks) can be created with shortcut notations such as below:
 +
 
 +
"<1"!
 +
 
 +
 
 +
<pre>
 
"<1"!
 
"<1"!
 +
 +
</pre>
 +
 +
<pre>
 +
 
// this gives "" on fixchars
 
// this gives "" on fixchars
 
("x<3"!)(2)
 
("x<3"!)(2)
Line 58: Line 73:  
f1(43!)
 
f1(43!)
 
 
 +
</pre>
 +
 +
The following shows the use of these simple function creations, with generated arrays to create a series of functions. For example, ((1..10|.+|"x")!) creates 10 functions from x+1, x+2, etc. until x+10. Below is a case where these array series of functions are applied to an array to the left of @ operator.
 +
 +
<pre>
 +
 
..5@((1..10|.+|"x")!)
 
..5@((1..10|.+|"x")!)
 
..50@((1..10|.+|"x^")!)
 
..50@((1..10|.+|"x^")!)
2,824

edits