Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The point was not lst[0:2] in Python. See the definition of Take in Mathematica - it is quite a bit more capable.

You need also differentiate between 'pattern matching' and 'rewrite system'. Pattern matching is just taking a pattern, some data and see if it matches.

    (match '(+ (* ?a x) ?b) '(+ (* 123.0 x) z)) -> T
Routines like the above are found in many books about Lisp and have been provided in Lisp libraries for decades.

Specifying rewrite rules with patterns for mathematical purposes (simplification, integration, differentiation, ...) is also almost as old as Lisp. Norvig's book 'Paradigm's of AI Programming' explains how it is implemented in Lisp. These things are at the heart of several computer algebra systems written in Lisp - like Macsyma.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: