Post #2280767
2025-10-29 20:11 UTC
Replies (2)
-
@sminez@hachyderm.io 2025-10-29 20:14
And if you want to add a little sarcasm into the mix, this script will conditionally replace 'friend' with '"friend"' on lines that mention Dave: , { x/Alice/c/Bob/; x/Bob/c/Alice/; X g/Dave/ x/friends/ c/"friends"/; } This time we end up with: 'Bob and Alice are friends with Claire and Alice and Bob are "friends" with Dave.'
-
@jbert@hachyderm.io 2025-10-30 09:42
@sminez@hachyderm.io I'm not sure I'm understanding the problem with streaming + parallel execution. I'm guessing the issue is knowing whether there is still a match "pending" on received data before you can commit to running the actions/substitutions? If that is the case, is it possible to chunk the input and at the end of each chunk, ask each matcher if it is waiting on more input to see if it should match? (Alternative api - ask each matcher for the offset up to which there is no ambiguity for whether it is matching or not). i.e. if the input stream is currently: aaaaa abaaa then the matcher /ab/ could report an offset of 9. It doesn't (yet) know if the last 'a' is the start of a match or not. That would allow you to process up to the minimum offset which all matchers are OK with. Sorry if this is nonsense. Interesting stuff though. > Ideally I'd like to be able to run "structex" scripts Or perhaps "stawk"? :-)