Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] Pattern Matching
- Date: Wed, 4 Nov 2009 10:45:56 +0900
- From: Curt Sampson <cjs@example.com>
- Subject: [tlug] Pattern Matching
- References: <a63167770911010442pd642beco3268ed5c4a41d02@example.com> <20091102082821.GA28406@example.com> <20091102115859.584591f3.attila@example.com> <a63167770911020238q2c68d37bt4efb354c91002470@example.com> <20091102112350.bf06bfd6.attila@example.com> <87hbtdtfch.fsf@example.com> <a63167770911020112q1bd12b27ub5209902a971a6c9@example.com> <20091102150646.GD16339@example.com> <a63167770911021615h14f8c2d4rf7ac6f7e3b44137a@example.com> <20091104013637.GF9636@example.com>
- User-agent: Mutt/1.5.18 (2008-05-17)
Actually, let me extend my pattern matching sample almost trivially by adding another constructor to what used to be called Pair: > data Maybe a = Nothing | Just a -- standard library definition > data N = Singleton Int | Pair Int Int > > nonZeroValueOf :: Maybe N -> Maybe Int > nonZeroValueOf x = > case x of > Nothing -> Nothing > Just (Singleton 0) -> Nothing > Just (Singleton n) -> Just n > Just (Pair 0 0) -> Nothing > Just (Pair 0 m) -> Just m > Just (Pair n _) -> Just n I'm not sure, but I think the extra two lines I've added here will add significant complexity to the Clojure implementation. cjs -- Curt Sampson <cjs@example.com> +81 90 7737 2974 Functional programming in all senses of the word: http://www.starling-software.com
- Follow-Ups:
- Re: [tlug] Pattern Matching
- From: Alan Busby
- References:
- Re: [tlug] recomendations for a functional language
- From: Alan Busby
- Re: [tlug] recomendations for a functional language
- From: Curt Sampson
- Re: [tlug] recomendations for a functional language
- From: Attila Kinali
- Re: [tlug] recomendations for a functional language
- From: Alan Busby
- Re: [tlug] recomendations for a functional language
- From: Attila Kinali
- Re: [tlug] recomendations for a functional language
- From: Stephen J. Turnbull
- Re: [tlug] recomendations for a functional language
- From: Alan Busby
- Re: [tlug] recomendations for a functional language
- From: Curt Sampson
- Re: [tlug] recomendations for a functional language
- From: Alan Busby
- Re: [tlug] recomendations for a functional language
- From: Curt Sampson
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] recomendations for a functional language
- Next by Date: Re: [tlug] recomendations for a functional language
- Previous by thread: Re: [tlug] recomendations for a functional language
- Next by thread: Re: [tlug] Pattern Matching
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links