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
The tokens function is untroubled by a leading colon (ultimately because it's defined in terms of runs, which defines its fon parameter default to be true iff the list begins with the separator):
> (tokens ":foo" \:)
("foo")
My Haskell is weak (but enough to appreciate how beautiful parser combinators are!), anyway, this looks relevant:
As shown above by the call to tokens and to read, : can occur not just as a separator, but also at the start.
Just as I wrote this, it also occurred to me to test whether it can also occur at the end. It can, and with the same outcome:
> (read'("foo:\lf"))
(compose foo)
> 'foo:
|
Here the REPL is doing a different thing — it's showing a continuation prompt after I hit Return, because it's thinking of the : as a separator and so there must be something after it. But we've already hit a breakc (\lf), and so the Bel reader knows that the word can't continue.
Both :foo and foo: have untapped potential as syntax-up-for-grabs in some macro-powered DSL or other. 😄
The text was updated successfully, but these errors were encountered:
Using the Windows executable of the 0.4.0 release:
I expected these to give the same output, ultimately because there should be no observable difference between the reader used by the REPL and
read
.Words with colons in them are handled by
parsecom
:The
tokens
function is untroubled by a leading colon (ultimately because it's defined in terms ofruns
, which defines itsfon
parameter default to be true iff the list begins with the separator):My Haskell is weak (but enough to appreciate how beautiful parser combinators are!), anyway, this looks relevant:
As shown above by the call to
tokens
and toread
,:
can occur not just as a separator, but also at the start.Just as I wrote this, it also occurred to me to test whether it can also occur at the end. It can, and with the same outcome:
Here the REPL is doing a different thing — it's showing a continuation prompt after I hit Return, because it's thinking of the
:
as a separator and so there must be something after it. But we've already hit abreakc
(\lf
), and so the Bel reader knows that the word can't continue.Both
:foo
andfoo:
have untapped potential as syntax-up-for-grabs in some macro-powered DSL or other. 😄The text was updated successfully, but these errors were encountered: