3 ms·
I rarely need to calculate Fibonacci numbers, but I use lists of varied types of objects constantly.
by pg 19y ago
I rarely need to calculate Fibonacci numbers, but I use lists of varied types of objects constantly.
- dfranke 19y agoSo do I -- when I'm working in Lisp. Lisp gives you a Swiss army knife and lets you build specialized tools when you want them. Haskell gives you specialized tools and lets you build a Swiss army knife if you want it.
- rkts 19y agoTo be clear, this is what ML's variant types are all about. You can easily create a list that contains e.g. both ints and chars: let mylist = [`Int 5; `Char '5'] Technically the elements have the same compile-time type, but the question is, what practical difference does that make? In what cases are variants an inadequate solution?