Skip to content

Commit

Permalink
Adding a README.
Browse files Browse the repository at this point in the history
  • Loading branch information
colah committed May 7, 2012
1 parent 15731c6 commit b83a4ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BasicAlgs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ a+b = sumS [a,b]
a*b = prodS [a,b]

--expand :: (SymbolicSum a, SymbolicProd a) => a -> a
expand [m|a + b|] = expand a + expand b
expand [m| a+b |] = expand a + expand b
expand [m|a*(b+c)|] = expand (a*b) + expand (a*c)
expand [m|a*b|] = expand a * expand b
expand a = a
expand [m| a*b |] = expand a * expand b
expand a = a

--test2 = prodS [var "a", var "b", sumS [var "a", var "c"]] :: VarPoly Int

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
HaskSymb: An Experiment in Haskell Symbolic Algebra
===================================================

At this point, HaskSymb is just something I'm hacking on as a fun side project. It is not a serious project, and isn't useful for anything. That said, it has some cool features.

The biggest one is that it provides mathematical pattern matching via quasiquoters. So one can write code like this:

```haskell
expand [m| a+b |] = expand a + expand b
expand [m|a*(b+c)|] = expand (a*b) + expand (a*c)
expand [m| a*b |] = expand a * expand b
expand a = a
```

(In fact, at the time of writing that is actual code in BasicAlgs)

There's other cool stuff with extensibility coming up.

0 comments on commit b83a4ca

Please sign in to comment.