

Show HN: A Lispy Calculator in under 50 Lines of OCaml - eatonphil
https://github.com/eatonphil/ocalc

======
tokenrove
As a calculator, wouldn't it make more sense to use Num from the standard
library than int?

FWIW, you don't end up doing a cumbersome amount of matching if you implement
a full Lisp with an expression ADT as mentioned in the README. I have a little
dynamically scoped Lisp interpreter in OCaml lying around somewhere that was
about 100 lines taking that approach.

~~~
eatonphil
Also, a Num implementation is now available; thanks for the suggestion.
However it just hits the 50-line limit :p

[https://github.com/eatonphil/ocalc/tree/use-
num](https://github.com/eatonphil/ocalc/tree/use-num)

~~~
tokenrove
Cool. You might find selective use of "let open Num in" helps cut down on the
added noise.

The #ocaml channel on freenode is a pretty good place to get review comments,
BTW.

~~~
eatonphil
Obviously the branch was done quickly, but at a short glance it was easier not
to use an extra line to add `open Num` at the beginning.

Good call on the irc channel. Thanks!

