5 ms·
Dunno, ML-based languages have a pretty different feel to Lisp. They're compiled languages, have type inference, heavily rely on pattern matching, type declara
by Mikeb85 13y ago
Dunno, ML-based languages have a pretty different feel to Lisp. They're compiled languages, have type inference, heavily rely on pattern matching, type declarations. An example from OCaml's front page:
type tree = Leaf of int | Node of tree * tree
let rec exists_leaf test tree =
match tree with
| Leaf v -> test v
| Node (left, right) ->
exists_leaf test left
|| exists_leaf test right
let has_even_leaf tree =
exists_leaf (fun n -> n mod 2 = 0) tree
- zhemao 13y agoMost LISP implementations also provide compilers. The difference is that ML variants are statically typed, while LISPs are generally dynamically typed.
- pmelendez 13y ago> "generally dynamically typed" I appreciate the "generally" word here. Racket and Chicken Scheme for instance, both provide statically type extensions.
- sampo 13y agoBut not, I assume, type inference? So you'll end up writing the types in the code all the time.
- pmelendez 13y agoYes... you can have type inference as well (if you wish[1][2]). I guess the philosophy is to use it if you need it but otherwise you might prefer to stick to the dynamic part. ---- [1] http://docs.racket-lang.org/ts-guide/quick.html http://docs.racket-lang.org/ts-guide/quick.html [2] http://docs.racket-lang.org/ts-guide/more.html#(part._.Type_.Inference) http://docs.racket-lang.org/ts-guide/more.html#(part._.Type_...
- asdasf 13y agoBut they are essentially garbage are they not? Adding java-style static typing is not helpful at all. The benefits of static typing are very much tied to the power of the type system in question.
- pmelendez 13y ago>"The benefits of static typing are very much tied to the power of the type system in question." One of the main benefits of static typing is to detect errors at compile time which is a benefit of typed Scheme compilers too. BTW, static typing goes way before Java :)
- asdasf 13y ago>One of the main benefits of static typing is to detect errors at compile time Obviously. But a static type system that lacks power and expressiveness is very constraining and can detect very few classes of errors. Hence the example of java, a very inexpressive static type system. >BTW, static typing goes way before Java :) Again, obviously. Why are you saying random obvious things to me?
- takikawa 13y agoTyped Racket definitely doesn't add a "Java-style static typing" system at all. Its type system is quite specifically designed to accommodate the kinds of programming idioms you find in Racket programs (via occurrence typing, function intersection types, and so on), and comes with local type inference.