Like json query but for Lisp.
Table of Contents
git clone https://github.com/Ecoral360/lsq.git
cargo install --path ./lsq
lsq --version # will display the version if the installation was successful
lsq 'query' file-name.scm
# OR
some-op | lsq 'query'
The lsq
language is a query language made to access and traverse s-expression with
ease.
A lsq
query is made up of filters separated by the |
symbol. The list of
While the number of builtin filters and builtin functions provided by
lsp
is low at the moment, it is rapidly expanding. If the language doesn't support something you need, feel free to open an Issue!
You have a people.scm
file:
((name "Mathis" info (age 20))
(name "Jean" info (age 28))
(name "Alice" info (age 12))
(name "Enric" info (age 20))
(name "Claudia" info (age 18))
(name "Amelie" info (age 21))
(name "Matteo" info (age 16)))
and you want to get the name of everyone who is major (18+). You could write this query:
cat people.scm | lsq ';() | select >=? ;(;info;age) 18'
Outputs:
(name "Mathis" info (age 20))
(name "Jean" info (age 28))
(name "Enric" info (age 20))
(name "Claudia" info (age 18))
(name "Amelie" info (age 21))
lsq
is distributed under the terms of the MIT license.
- Add good error handling