<p>One of the main benefits of Jay's recent work is that it reduces the boilerplate code one needs to write in order to traverse data structures to perform operations such as <em>map</em>. The pattern calculus enables one to write the traversal code once for all data structures and have it applicable to your own data structure. This certainly reduces the amount of code required, but does not enable you to write any programs that you couldn't otherwise write. Certainly there are many interesting ideas in the work, but it remains to be demonstrated that it actually works. </p>

CC BY-SA 2.5
2010-08-27T08:03:42.707Z
2010-08-27T08:03:42.707Z
Dave Clarke
<p>I'm not familiar with Barry Jay's recent work, but his older work includes things that you <em>cannot</em> do in Lisp, because the types give additional information.</p>

<p>For example, suppose you want to define the size of a Lisp data structure. It's 1 for an atom, and <em>n</em> for a list of <em>n</em> atoms, and more generally size(x)+size(y) for <code>(cons x y)</code>.</p>

<p>Now throw in types into the mix. The size of a list would be its length. Now what's the size of a list of lists of atoms? If you consider this data structure as a list (whose elements happen to be lists of atoms), the answer is the length of the list. If you consider this data structure as containing atoms that happen to be stored in a list of lists, the answer is the sum of the lengths of the element lists.</p>

<p>Types allow you to distinguish between these two views (shapes) of the raw data. You need a type system that lets you discriminate between (List) (List Atom) and (List List) (Atom). The most common implementation of this distinction is with type classes (as in Haskell).</p>

CC BY-SA 2.5
2010-08-26T23:01:49.843Z
2010-08-26T23:01:49.843Z
Gilles 'SO- stop being evil'
<p>Barry Jay in his <a href="http://rads.stackoverflow.com/amzn/click/3540891846">book</a> makes some bold claims - basically by saying that, at the core of a program, everything is either atomic or composed. Then things can be easily iterated, filtered, updated, just by 
navigating this composition relationship. </p>

<p>Is this a new <a href="http://bondi.it.uts.edu.au/">frontier</a> in Computer Science for computer languages - or are we just going back to LISP?</p>

CC BY-SA 2.5
2010-08-26T13:09:14.913Z
Going back to Lisp would be a step forward.
Shane
CC BY-SA 2.5
2010-08-26T13:26:29.840Z
This is not a sharply defined question: it should be made community wiki.
Charles Stewart
CC BY-SA 2.5
2010-08-28T01:48:44.547Z
Agree @Shane but think it needs types and a set of modern libraries
hawkeye
<fl.formal-languages>
Does Pattern Calculus represent a step forward in languages or are we just going back to LISP?
hawkeye
# Does Pattern Calculus represent a step forward in languages or are we just going back to LISP?

(Asked by: username_0 on 2010-08-26)

Barry Jay in his [book](http://rads.stackoverflow.com/amzn/click/3540891846) makes some bold claims - basically by saying that, at the core of a program, everything is either atomic or composed. Then things can be easily iterated, filtered, updated, just by
navigating this composition relationship.

Is this a new [frontier](http://bondi.it.uts.edu.au/) in Computer Science for computer languages - or are we just going back to LISP?

**Tags:** fl.formal-languages
> **Comments:**
> **username_1**: Going back to Lisp would be a step forward.  
> **username_2**: This is not a sharply defined question: it should be made community wiki.  
> **username_0**: Agree @Shane but think it needs types and a set of modern libraries  

---

## 2 answers

### Answer by username_3 on 2010-08-27. Score: 6 | Accepted answer

One of the main benefits of Jay's recent work is that it reduces the boilerplate code one needs to write in order to traverse data structures to perform operations such as *map*. The pattern calculus enables one to write the traversal code once for all data structures and have it applicable to your own data structure. This certainly reduces the amount of code required, but does not enable you to write any programs that you couldn't otherwise write. Certainly there are many interesting ideas in the work, but it remains to be demonstrated that it actually works.


---

### Answer by username_4 on 2010-08-26. Score: 6

I'm not familiar with Barry Jay's recent work, but his older work includes things that you *cannot* do in Lisp, because the types give additional information.

For example, suppose you want to define the size of a Lisp data structure. It's 1 for an atom, and *n* for a list of *n* atoms, and more generally size(x)+size(y) for `(cons x y)`.

Now throw in types into the mix. The size of a list would be its length. Now what's the size of a list of lists of atoms? If you consider this data structure as a list (whose elements happen to be lists of atoms), the answer is the length of the list. If you consider this data structure as containing atoms that happen to be stored in a list of lists, the answer is the sum of the lengths of the element lists.

Types allow you to distinguish between these two views (shapes) of the raw data. You need a type system that lets you discriminate between (List) (List Atom) and (List List) (Atom). The most common implementation of this distinction is with type classes (as in Haskell).


---

