Compare commits
2 Commits
ae6ad34364
...
aba77569ac
Author | SHA1 | Date | |
---|---|---|---|
|
aba77569ac | ||
|
223823ea68 |
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@ludus/ludus-js-pure",
|
"name": "@ludus/ludus-js-pure",
|
||||||
"version": "0.1.15",
|
"version": "0.1.16",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@ludus/ludus-js-pure",
|
"name": "@ludus/ludus-js-pure",
|
||||||
"version": "0.1.15",
|
"version": "0.1.16",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"shadow-cljs": "^2.26.0",
|
"shadow-cljs": "^2.26.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ludus/ludus-js-pure",
|
"name": "@ludus/ludus-js-pure",
|
||||||
"version": "0.1.15",
|
"version": "0.1.16",
|
||||||
"description": "A Ludus interpreter in a pure JS function.",
|
"description": "A Ludus interpreter in a pure JS function.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "build/ludus.mjs",
|
"main": "build/ludus.mjs",
|
||||||
|
|
|
@ -49,15 +49,37 @@
|
||||||
(set (out :draw) (post :draw))
|
(set (out :draw) (post :draw))
|
||||||
(-> out j/encode string))
|
(-> out j/encode string))
|
||||||
|
|
||||||
(comment
|
# (comment
|
||||||
# (do
|
(do
|
||||||
(def source `
|
(def source `
|
||||||
match :foo with {
|
fn strip_punctuation {
|
||||||
:bar -> :baz
|
("{x},{y}") -> strip_punctuation ("{x}{y}")
|
||||||
:baz -> :quux
|
("{x}.{y}") -> strip_punctuation ("{x}{y}")
|
||||||
"thing {foo}" -> "worste"
|
("{x};{y}") -> strip_punctuation ("{x}{y}")
|
||||||
42 -> 23
|
("{x}:{y}") -> strip_punctuation ("{x}{y}")
|
||||||
|
("{x}?{y}") -> strip_punctuation ("{x}{y}")
|
||||||
|
("{x}!{y}") -> strip_punctuation ("{x}{y}")
|
||||||
|
(x) -> x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn trim_left {
|
||||||
|
(" {x}") -> trim_left ("{x}")
|
||||||
|
("\n{x}") -> trim_left ("{x}")
|
||||||
|
("\t{x}") -> trim_left ("{x}")
|
||||||
|
(x) -> x
|
||||||
|
}
|
||||||
|
|
||||||
|
fn trim_right {
|
||||||
|
("{x} ") -> trim_right ("{x}")
|
||||||
|
("{x}\n") -> trim_right ("{x}")
|
||||||
|
("{x}\t") -> trim_right ("{x}")
|
||||||
|
(x) -> x
|
||||||
|
}
|
||||||
|
|
||||||
|
fn trim (x) -> do x > trim_left > trim_right
|
||||||
|
|
||||||
|
trim_left ("
|
||||||
|
foo")
|
||||||
`)
|
`)
|
||||||
(def out (-> source
|
(def out (-> source
|
||||||
ludus
|
ludus
|
||||||
|
|
Loading…
Reference in New Issue
Block a user