You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to grab a list of all the words enclosed in brackets up until the input contains the string END. On small inputs it works once I filter out nils from the resulting vector, but many-till fails pretty quickly on larger inputs such as https://gist.github.com/jpe90/05c2af77c54de5d5dc1ae3e19bdc03d1.
If I'm doing anything dumb please let me know, I'm brand new to clojure. As a workaround I tried writing a recursive parser that parses character by character and acts based on whether it's looking at a "between brackets" or a terminal sequence, but I ran into situations where I would be writing logic into the tail position, which seems to conflict with the "recur" keyword and I wasn't sure how to proceed.
P.S. thanks for the library, this is so cool!!
The text was updated successfully, but these errors were encountered:
I'm hitting stack overflows while using many-till on non-small inputs. The parsers I'm working on are:
(def between-brackets (between (sym* \{) (sym* \}) (many (none-of* "}"))))
(def parse-enclosed-words (many-till (<|> between-brackets (skip any-char)) (token* "END")))
I'm trying to grab a list of all the words enclosed in brackets up until the input contains the string END. On small inputs it works once I filter out nils from the resulting vector, but many-till fails pretty quickly on larger inputs such as https://gist.github.com/jpe90/05c2af77c54de5d5dc1ae3e19bdc03d1.
If I'm doing anything dumb please let me know, I'm brand new to clojure. As a workaround I tried writing a recursive parser that parses character by character and acts based on whether it's looking at a "between brackets" or a terminal sequence, but I ran into situations where I would be writing logic into the tail position, which seems to conflict with the "recur" keyword and I wasn't sure how to proceed.
P.S. thanks for the library, this is so cool!!
The text was updated successfully, but these errors were encountered: