[Phix Tutorial] Basic Sequence Actions
- Posted by _tom
(admin)
Jan 26, 2019
Phix Billiard Ball Diagrams
Item
An "item" works like a variable, you can assign it a new value.
|
To Item |
? |
s = "○◍○○" |
s[2] = '●' |
"○●○○" |
s = "○◍○○" |
s[2] = "●●" |
{'○', "●●", '○','○'} |
Fill
Atom to slice, all items get the same value.
|
Atom Fill |
? |
s = "○◍○○" |
s[2..2] = '●' |
"○●○○" |
s = "○◍◍◍" |
s[2..4] = '●' |
"○●●●" |
New Items
A "gap" starts with nothing, you can not assign an atom to a gap, but you can assign any sequence to a gap.
|
To Any Gap |
? |
s = "○◍○" |
s[2..1] = '●' |
"○◍○" |
s = "○◍○" |
s[2..1] = { '●' } |
"○●◍○" |
s = "○◍○" |
s[2..1] = "●" |
"○●◍○" |
s = "○◍○" |
s[2..1] = "●●" |
"○●●◍○" |
|
To Head Gap |
? |
s = "◍○○○" |
s[1..0] = '●' |
"◍○○○" |
s = "◍○○○" |
s[1..0] = "●" |
"●◍○○○" |
s = "◍○○○" |
s[1..0] = "●●" |
"●●◍○○○" |
|
To Tail Gap |
? |
s = "○○○◍" |
s[$+1..$] = '●' |
"○○○◍" |
s = "○○○◍" |
s[$+1 .. $] = "●" |
"○○○◍●" |
s = "○○○◍" |
s[$+1 .. $] = "●●" |
"○○○◍●●" |
Not Categorized, Please Help
|
|