On Tue, Aug 9, 2011 at 3:50 AM, Sam Aaron <samaa...@gmail.com> wrote:
> Exciting stuff! > > Do you happen to have any simple descriptions/examples of where and how we > might use this stuff in our daily programming repertoires? I for one am sure > I'm not educated enough as to the value and utility of pattern matching - at > the moment I just think "that looks cool" rather than "I'm definitely going > to use that to do X and Y". > > Sam > > --- > http://sam.aaron.name Think about code for dealing with macros. (defmacro foo [& forms] (match [forms] [(a [x] :else & rest)] ... [(a [x b] :else & rest)] ...)) Also we've reserved vector notation for data structures that support random access and slicing. For example say you're doing some network programming: (match [byte-buffer] ([127 1 38 58 l & rest] ...) ([127 2 0 0 l & rest] ...) ([1 id 0 0 l & rest] ...)) This should of course expand out to highly optimized calls to pull apart the particular data structure. Because of lazy pattern matching it would be efficient without you would having to write such logic by hand (it will automatically check ahead on bytes that actually matter for determining which branch to take). David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en