Code Monkey home page Code Monkey logo

Comments (3)

jclaggett avatar jclaggett commented on August 24, 2024

Fascinating!

I was not aware of this at all. Thank you for pointing it out.
On Jan 6, 2013 9:28 PM, "kovasb" [email protected] wrote:

You might already be aware of this, but there is a pretty good example of
a solution to this, at

http://reference.wolfram.com/mathematica/guide/Patterns.html

(this is within the context of a broader expression pattern matching
language that can deal with trees, but also deals with various form of the
sequence case)


Reply to this email directly or view it on GitHubhttps://github.com//issues/1.

from seqex.

jclaggett avatar jclaggett commented on August 24, 2024

I've just pushed an updated API that you might be interested in.

from seqex.

kovasb avatar kovasb commented on August 24, 2024

The idea of making the patterns into functions is interesting.

If it was me, I'd prefer to separate what is being matched from the repetition specification. http://reference.wolfram.com/mathematica/ref/Repeated.html handles this very well.

You can still have syntactic sugar to express common cases, but still have it boil down to a consistent representation.

I think its possible to simply what you have by leveraging clojure's built in datatypes.

I'm also a fan of using #{} to represent orderless sets. Maybe its possible to do away with the distinction between c and s entirely. Though you'd have to distinguish between matching a literal set versus a set of alternatives. (The literal case is less common, so wrapping it as (literal #{}) within the sequence pattern would do the trick nicely)

From my own experience, verbose symbolic names for the pattern components are much easier to remember and read than regex terse descriptions. Working with http://reference.wolfram.com/mathematica/tutorial/WorkingWithStringPatterns.html#316252289

which is an extension of the general pattern matching to the string case, was way more fun than regex because it was just a lot more evident what was going on.

One big reason regex is so terse is that it is embedded in the string itself, but in this situation you are liberated from that.

from seqex.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.