proj-oot-old-150618-ootPatternThoughts

clojure's :as

e.g.

(defn make-rectangle [[p1 p2 p3 p4 :as vertices]] (let [a (distance p1 p2) b (distance p2 p3)] (assert (= a (distance p3 p4))) (assert (= b (distance p4 p1))) { :kind :rectangle , :vertices vertices, :a a, :b b}))

i think it is for binding part of a pattern while also binding the parts of that part

...

clojure's :keys

--- unlike regexps, a pattern matching language must match over graphs that can have loops

however, i bet you could render a regexp-like pattern matching language always terminating (total) by simply detecting when you are re-traversing a loop while trying to match the same sort of thing (this would allow you to terminate that sub-match with either success or failure depending on whether the match condition is forall (success) or exists (failure))

---

allow bounded FOL, e.g.

and, or, not, and any/all over finite structures

or perhaps we should allow any/all over infinite structures but only when the compiler can statically infer whether the any/all is true

--

http://blog.sigfpe.com/2010/08/constraining-types-with-regular.html

--

perl6 may have nailed string grammars

i think its implemented here, in intermediate language NQP:

https://github.com/perl6/nqp/tree/master/src/QRegex

---

here are OMeta like things for Ruby:

" The closest thing to Perl6 grammars in Ruby would be the Ruby-OMeta project (make sure to also take a look at Ryan Davis's fork), which unfortunately ist still under development. (Or rather, no longer under active development.) "

https://github.com/Aquasync/Ruby-OMeta/

https://github.com/ZenSpider/Ruby-OMeta/

---

http://www.tinlizzie.org/ometa-js/#Sample_Project

http://www.tinlizzie.org/ometa-js/#OMeta_Tutorial

https://www.google.com/search?client=ubuntu&channel=fs&q=PyMeta&ie=utf-8&oe=utf-8

---

in OMeta, matching list data is like PCRE regexps which always end in $, that is, the whole thing must be matched. This seems easier to think about, but is perhaps inefficient in cases where you are just ending the match with .*? but i guess the compiler could in theory figure that out.

--