Skip to content

Commit

Permalink
print downcased code. and other tweaks. adjust bare @ default behaviour
Browse files Browse the repository at this point in the history
remove headlines in docs file.
add pipe synonym to ||.
  • Loading branch information
inconvergent committed May 19, 2024
1 parent 48b1190 commit 3146775
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 329 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Iterate a datastructure (as if with `?txpr`) and collect the matches in a new

### Transformer Operators - `?xpr`, `?txpr`, `?mxpr`

Perform operation on when pattern or condition is satisfied:
Perform operation when pattern or condition is satisfied:
- `(?xpr sel)`: match current value against `EXPR Selector`. Return the
result if not `nil`.
- `(?xpr sel hit-expr)`: match current value against `EXPR Selector`.
Expand All @@ -203,8 +203,8 @@ Perform operation on when pattern or condition is satisfied:
selectors`. Evaluate `hit-expr` if not `nil`; else evaluate `miss-expr`.
`_` is the matching item.

Recursively traverse a structure of `sequences` and `hts` and return
a new value for each match:
Recursively traverse a nested structure of `sequences` and `hts` and return a
new value for each match:
- `(?txpr sel .. tx-expr)`: recursively traverse current value and replace
matches with `tx-expr`. `tx-expr` can be a function name or expression.
Also traverses vectors and `ht` values.
Expand Down
8 changes: 4 additions & 4 deletions bin/test-sh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ a='[{"v":1},{"v":1},{"v":7},{"v":100}]'
r=`echo '1 x 1 x 7 x 100' |\
sbcl --script ./tqn-sh.lisp -jm '(splt _ :x) int!? #((new$ :v _))'`; check;

a='((:V . 1))
((:V . 3))'
a='((:v . 1))
((:v . 3))'
r=`echo '1 x 3 x ' |\
sbcl --script ./tqn-sh.lisp '(splt _ :x) int!? [is?] #((new$ :v _))'`; check;

a='#(((:V . 1)) ((:V . 1)) ((:V . 7)) ((:V . 100)))'
a='#(((:v . 1)) ((:v . 1)) ((:v . 7)) ((:v . 100)))'
r=`echo '1 x 1 x 7 x 100' |\
sbcl --script ./tqn-sh.lisp -lm '(splt _ :x) int!? #((new$ :v _))'`; check;

Expand All @@ -86,7 +86,7 @@ r=`echo '1 2' | sbcl --script ./jqn-sh.lisp -t '_'`; check;
a='{"_id":1}'
r=`echo '{"_id": 1}' | sbcl --script ./jqn-sh.lisp -jm '{:_id}'`; check;

a='((:_ID . 1))'
a='((:_id . 1))'
r=`echo '{"_id": 1}' | sbcl --script ./jqn-sh.lisp -lm '{:_id}'`; check;

a='{"_id":"65679","things":[{"id":10}]}
Expand Down
Loading

0 comments on commit 3146775

Please sign in to comment.