Seeking advice on port "pattern" (long)

Garry Hodgson <>
Wed Jun 27 15:20:46 CEST 2001


Torbjorn Tornkvist wrote:
> 
> > Can you provide an example of what you mean? I know Joe posted one some time
> > ago but I can't find it and haven't quite managed to figure it out for
> > myself.
> 
> Ok, below I've whipped up something to show what I meant.
> 
> Cheers /Tobbe
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> -module(abc).
> -export([abc/1]).
> 
> %%%
> %%% Parse strings looking like: "abc"
> %%% Example:
> %%%
> %%%   2> abc:abc("abcdefg").
> %%%   {ok,"abc","defg"}
> %%%   3> {_,C} = abc:abc("a").
> %%%   {needmore,#Fun<abc.1.119051369>}
> %%%   4> {_,C2} = C("b").
> %%%   {needmore,#Fun<abc.2.1309902>}
> %%%   5> C("cdef").
> %%%   {parse_error,{"a",'<here>',"cdef"}}
> %%%   6> C2("cdef").
> %%%   {ok,"abc","def"}
> %%%

very cool.  i reworked my code to use this notion, and it works
just fine.  thanks.

-- 
Garry Hodgson                   sometimes we ride on your horses
Senior Hacker                   sometimes we walk alone
Software Innovation Services    sometimes the songs that we hear
AT&T Labs                       are just songs of our own




More information about the erlang-questions mailing list