Skip to content

Wondering if there is a better way to represent the following #235

Answered by j-mie6
DamianReeves asked this question in Q&A
Discussion options

You must be logged in to vote

Ahhhh wait no, I see exactly what it is, the debugger was reporting something a bit unusually (good test case for the traces!)
you are using the .foldLeft combinator on a many, whereas you meant .map(_.foldLeft...) on the list. many can succeed having not consumed input, which makes foldLeft loop forever (I should have figured this out when I saw the original parent name was infix.left1, which is the combinator used to implement foldLeft).

again, what I'd do for this is to write:

val tail = many('-' ~> some(asciiChar)).span

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@j-mie6
Comment options

Comment options

You must be logged in to vote
4 replies
@j-mie6
Comment options

@j-mie6
Comment options

Answer selected by j-mie6
@DamianReeves
Comment options

@j-mie6
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants