Added pick and select for lists

Pick: (1 2 3 4)?4 or (1 2 3 4)?(3 2)
Select: (1 2 3 4)~2 or (1 2 3 4)~(2 3)
This commit is contained in:
2023-04-26 21:14:21 +03:00
parent cc3497fd29
commit 8f5d8adf48
6 changed files with 57 additions and 7 deletions

View File

@ -56,8 +56,9 @@
right_op: list | number
// Operators that work only on lists: | << >>
list_operator: /(\||<<|>>|<>|#|@)(?=[(\d])/
// /(\||<<|>>|<>|#|@)(?=[(\d])/
// Common operators that works with numbers 3+5 3-5 etc.
operator: /([\+\-\*\/%\&])/
operator: /(\+|-|\*|\/|%|&|\?|~)/
// Euclidean cycles
// TODO: Support randomization etc.
@ -66,7 +67,8 @@
?euclid_operator: /<[0-9]+,[0-9]+(,[0-9])?>/
// Lisp like list operation
lisp_operation: "(" operator WS sequence ")"
lisp_operator: /([\+\-\*\/%\&])/
lisp_operation: "(" lisp_operator WS sequence ")"
// Subdivision
subdivision: "[" subitems "]"