Calling Combinators (Decoders?) as Normal Functions

So I think I've ruled out the concept of trying to do this with anything that "combinates". It's too fuzzy what it would mean in terms of the arity of invocation. Just call PARSE.

However...

This idea has merit.

For reasons of composability, multi-return no longer lets the right hand side "see" what the left hand side requested. (You can read the long winding history to understand why.)

So it's kind of like all of these would need to offer something like TRANSCODE's :next refinement. And I think the convention for those functions returning the series as the primary result is sound.

>> [rest value]: debin:next [le + 3] #{FEFFFF00}
== #{00}

>> value
== 16777214

PARSE would have to ask for the :NEXT to do its job.

DEBIN Seems Like A Good First Target. But ENBIN?

An encoder could be used in UPARSE as well, though its only real meaning would be to splice in data at the current position and then move the tail to after the splice.

You could do that with [insert (/your-encoding call-here)] as a parse rule, so it's not necessary to have access to the parsed series...unless you thought it would be more optimal to have the evil :INTO to say where to put the data...

Maybe encoders have an :INTO and that's what distinguishes them from ordinary run-of-the-mill functions, I don't know.

Anyway, just throwing a couple more thoughts in here...

1 Like