O4ZYFC2AQIWA75Q45T6USQPSR5HZDGFD45HO6IDZZRUJYS5VIQHQC
AQQ7DH2OU4OKCVRQECS427ICA4OAT5NLQBE4TLKFBJ3TAUMQHXKAC
Q62EXKAKNM5FMIW3UZBUAJFKOZLE2O2VIRTJAVDOTTSWX5JSMX4QC
O2DTNJ3ZOJJKDHGPNE2DZSZF7CFU4G5D65RIDOYZHYYBH3JZAAIAC
Y7IBP4INTUL42R7TC7O4DXGR27CKTD6VEEL6BHJNGCVIFVUVGCMQC
ZR7U7TRCUHXMBXQFA3XXNGJPPYFACMOWPQKGUH7E22KGFM35HSNAC
def parse_reducer(data) do parse_reducer(data, &parse/1)
def parse_reducer(data) do
parse_reducer(data, &parse/1)
def stream(data) do Stream.resource( fn -> {data, &parse/1} end, fn {data, parser} -> case parser.(data) do {:ok, {result, rest, next}} -> {[result], {rest, next}} end end, fn _ -> nil end )
def stream(data) do
Stream.resource(
fn -> {data, &parse/1} end,
fn {data, parser} ->
case parser.(data) do
{:ok, {result, rest, next}} ->
{[result], {rest, next}}
end
end,
fn _ -> nil end
)
defp parse_reducer(<<>>, _parser) do :ok end defp parse_reducer(data, parser) do case parser.(data) do {:ok, {result, rest, next}} -> IO.inspect(result) parse_reducer(rest, next) end end
defp parse_reducer(<<>>, _parser) do
:ok
defp parse_reducer(data, parser) do
IO.inspect(result)
parse_reducer(rest, next)