[erlang-questions] : abstract patterns vs macros was:( Floating guard sequences)

Zvi <>
Fri Feb 20 12:01:02 CET 2009


I like Abstract Patterns, I think they make patterns more like first-class
citizens and make ADTs implementation easier. There several comments, which
I'll write later. For now, I just trying to write simple abstract pattern
for inclusive range of integers:

#range(N,M) when is_integer(X) -> N=<X, X<=M.

I just introduced X. Is this right way?

or maybe:

#range(N,M) -> is_integer(X), N=<X, X<=M.

Do I need to specify is_integer(N), is_integer(M) for abstract pattern
arguments too ?
It's getting too complex...

Zvi



Raimo Niskanen-2 wrote:
> 
> On Thu, Feb 19, 2009 at 04:44:35PM -0800, Anthony Molinaro wrote:
>> 
>> On Fri, Feb 20, 2009 at 12:15:20PM +1300, Richard O'Keefe wrote:
>> > 
>> > On 20 Feb 2009, at 7:53 am, fess wrote:
>> > > I'm sure I can learn something by asking,  why not just do this with
>> > > macros?
>> > 
>> > Well, you could start by reading the paper.
>> 
>> I went looking for said paper and it's extremely hard to find.
>> After hunting on google for 10 minutes with keywords like "abstract
>> patterns",
>> "abstract patterns erlang", "abstract patterns o'keefe", I eventually
>> found 2 other papers which reference "Abstract Patterns for Erlang"
>> by Richard O'Keefe, so that must be it, right?  Well another google
>> search returns 3 results
>> 
>> http://www.google.com/search?q=%22Abstract+Patterns+for+Erlang%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
>> 
>> None of which are the paper.  However the 3rd link eventually leads to
>> 
>> http://www.erlang.org/ml-archive/erlang-questions/200309/msg00309.html
>> 
>> Which includes a paper with the title "Pattern Abstraction" apparently
>> by Richard O'Keefe.
> 
> That should be it. You can find it from:
> http://www.erlang.org/faq/faq.html section 10.14.
> There you also find a link to Joe Armstrong's struct suggestion.
> 
>> 
>> So maybe that's the so called paper, or maybe there is another one out
>> there?
> 
> I sincerely hope if this paper you found is wrong, someone will yell,
> because I also had a hard time finding it.
> 
>> 
>> -Anthony
>> 
>> -- 
>> ------------------------------------------------------------------------
>> Anthony Molinaro                                           <>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
> 
> -- 
> 
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 
> 

-- 
View this message in context: http://www.nabble.com/Floating-guard-sequences-tp22067566p22118636.html
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list