| Line 1: |
Line 1: |
| | === Hash # Operator === | | === Hash # Operator === |
| | | | |
| − | Hash Operator (#) can have multiple meanings, when used as a binary operator or as suffix. It can be used to: (1) Arrafy Functions, (2) Index, Search and Filter Arrays, and (3) Index and Search Objects. | + | Hash Operator (#) can have multiple meanings, when used as a binary operator or as suffix. It can be used to: (1) Arrafy Functions, (2) Index, Search and Filter Arrays, and (3) Index and Search Objects. Hash operator can be used to create lists of numbers, indices, etc., (similar to APL iota), but in far more powerful ways. |
| | | | |
| | ====# To Arrayfy Functions==== | | ====# To Arrayfy Functions==== |
| Line 255: |
Line 255: |
| | | | |
| | These notations can be called from Calcis containing objects in cells etc. Example: =rs#"first_name,email where rs represents an array of objects. | | These notations can be called from Calcis containing objects in cells etc. Example: =rs#"first_name,email where rs represents an array of objects. |
| | + | |
| | + | ====Generating Arrays and Function Application==== |
| | + | |
| | + | Hash operator can be powerful when applied to simple numbers. |
| | + | |
| | + | List below show several ways a number can be arrayfied to give list comprehensions, iota, indices, generation of powerful arrays with function application and lists, etc. |
| | + | |
| | + | For this behavior, the left side should be a number. The right side can be a number, string, array, function, etc. |
| | + | |
| | + | The array on the right represents parameters such as start, interval, addition to each element, function to apply to each element etc. The added element can be complex numbers etc., giving extremely powerful list comprehensions with complex structures. |
| | + | |
| | + | If the right side is a function, that function is applied over the generated series. |
| | + | |
| | + | <pre> |
| | + | |
| | + | 3# // 0 indexed |
| | + | 3#1 // 1..n |
| | + | 3#2 // start at 1 |
| | + | |
| | + | n=10; |
| | + | n# |
| | + | |
| | + | n=10; |
| | + | n#1 |
| | + | |
| | + | 10#[-2,1] |
| | + | |
| | + | 10#[-2,2,100] |
| | + | |
| | + | 10#[-2,2,2] |
| | + | |
| | + | n=10; |
| | + | (n#[1,2.3,23i]) |
| | + | |
| | + | n=10; |
| | + | n#[-3,2,34i] |
| | + | |
| | + | 30#[1,1,2.3] |
| | + | |
| | + | n=10; |
| | + | n#[-3,2,34i] |
| | + | |
| | + | 30#[0,1] |
| | + | |
| | + | 10#[0,1,SQUARED] |
| | + | |
| | + | 10#[1,1,SQUARED] |
| | + | |
| | + | 10#[0,1,SQUARED] |
| | + | |
| | + | 10#[1,1,10#] |
| | + | |
| | + | 10#[0,1,10#] |
| | + | |
| | + | 10#[0,1,[SIN]] |
| | + | |
| | + | 10#[0,1,[SQUARED]] |
| | + | |
| | + | 10#[0,1,[1,2,-1,-2,SQUARED]] |
| | + | |
| | + | 10#-1i |
| | + | |
| | + | 10#SIN |
| | + | |
| | + | 10#"mm" |
| | + | |
| | + | Z3EVAL((10#"mm") |
| | + | .print())<>cm |
| | + | |
| | + | Z3EVAL((10#"mm") |
| | + | .print())<>cm |
| | + | |
| | + | 10#"3" |
| | + | |
| | + | </pre> |
| | | | |
| | =See Also= | | =See Also= |
| | | | |
| | [[Fabulous_!_Operator | Fabulous ! Operator]] | | [[Fabulous_!_Operator | Fabulous ! Operator]] |