Trading Simulation Language
Trading Simulation Language
Apr 30In designing my simple trading simulation language, I’ve been reading up on Haskell a lot lately. For the same reasons that Rich Hickey documents on the Clojure state and identity page, I like the idea of making a simple functional language. I’ve heard that programs written in functional languages are easier to reason about, and I think that that property makes functional code more intuitive to the reader.
My idea is to translate programs written in my simple language into Clojure (compile to Clojure) similarly to how some high level languages translate to C or C++ (e.g. SequenceL). Clojure is expressive enough to represent all of the constructs in my simple language.
One idea I’m stealing from Haskell is to allow functions of two arguments be called using infix notation. For example, given the following definition of the function elementOf? :
elementOf?(e, sequence) = any?(sequence, (item){ e == item } )
elementOf? can be invoked using either of the following notations:
1. elementOf?(1, [1,2,3])
2. 1 elementOf? [1,2,3]
Both invocations will return true.
One cool thing that Haskell and Erlang both support is pattern matching or destructuring. I’m not planning on implementing destructuring anytime soon. Clojure supports destructuring in let bindings, and it has come in handy every one in a while, but it’s not a must have in my language.
Hopefully, people without a CS background will be able to use my language. That’s the idea.