Replies: 4 comments 14 replies
-
it could also be interesting to actually write patterns in a more human friendly JSON sibling like https://yaml.org/ |
Beta Was this translation helpful? Give feedback.
-
It'd be also be easy enough to go from that to haskell tidal.. |
Beta Was this translation helpful? Give feedback.
-
@roipoussiere made yaml -> strudel ! https://roipoussiere.frama.io/tidaml/#ws1_multi-lines src: https://framagit.org/roipoussiere/tidaml |
Beta Was this translation helpful? Give feedback.
-
I also need to find a syntax for this: stack(
n("<0 [2 4] <3 5> [~ <4 1>]>*2".add("<0 [0,2,4]>/4")) // problem here
.add("<0 <1 -1>>")
.scale("C5:minor"),
n("0 1 [2 3] 2")
.sound("jazz")
.jux(rev) // and here
).sometimes(x=>x.speed("-1")) // and here, as you mentioned I plan to write it like this: Stack:
- N: <0 [2 4] <3 5> [~ <4 1>]>*2
^:
add: <0 [0,2,4]>/4
add: <0 <1 -1>>
scale: C5:minor
- N: 0 1 [2 3] 2
sound: jazz
jux:
rev:
sometimes:
speed: -1 edit: or maybe like this - N:
M: <0 [2 4] <3 5> [~ <4 1>]>*2 # 'M' stands for Mini-notation
add: <0 [0,2,4]>/4
add: <0 <1 -1>>
scale: C5:minor |
Beta Was this translation helpful? Give feedback.
-
It just struck me that strudel patterns could be expressed as JSON without much change.. Take this pattern:
... translated to JSON:
This assumes the
x=>x.
problem is solved, but generally it looks pretty doable.Because JSON is a much simpler language, it is much easier to analyze / validate / cast with tools like zod. A JSON schema could define the set of possible property and type combinations, enabling strudel to detect an invalid pattern before runtime, which is kind of an alternative for type inference.
With a defined format, it would also be possible to translate back and forth between JS and JSON for serialization.
I have not really tried other patterns, so I could have missed some syntax that cannot be translated that easily.
Beta Was this translation helpful? Give feedback.
All reactions