Typing the Numeric Tower

  • Vincent St-Amour
  • Sam Tobin-Hochstadt
  • Matthew Flatt
  • Matthias Felleisen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7149)


In the past, the creators of numerical programs had to choose between simple expression of mathematical formulas and static type checking. While the Lisp family and its dynamically typed relatives support the straightforward expression via a rich numeric tower, existing statically typed languages force programmers to pollute textbook formulas with explicit coercions or unwieldy notation. In this paper, we demonstrate how the type system of Typed Racket accommodates both a textbook programming style and expressive static checking. The type system provides a hierarchy of numeric types that can be freely mixed as well as precise specifications of sign, representation, and range information—all while supporting generic operations. In addition, the type system provides information to the compiler so that it can perform standard numeric optimizations.


Type System Error Message Numeric Type Proof Obligation Static Check 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Buneman, P., Pierce, B.: Union types for semistructured data. In: Proc. Works. On Database Programming Languages, pp. 184–207 (1999)Google Scholar
  2. 2.
    Coppo, M., Dezani-Ciancaglin, M.: A new type assignment for λ-terms. Archiv Math. Logik 19, 139–156 (1978)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Dahl, O.-J.: SIMULA 67 Common Base Language. Norwegian Computing Center (1968)Google Scholar
  4. 4.
    Flatt, M., PLT.: Reference: Racket. PLT Inc., PLT-TR-2010-1 (2010),
  5. 5.
    Goldberg, A., Robson, D.: Smalltalk-80: the Language and its Implementation. Addison-Wesley (1983)Google Scholar
  6. 6.
    Gosling, J., Joy, B., Steele Jr., G.L., Bracha, G.: The JavaTM Language Specification, 4th edn. Addison-Wesley (2005)Google Scholar
  7. 7.
    ISO. ISO C Standard 1999 (1999)Google Scholar
  8. 8.
    Jones, M.P.: The Habit programming language: the revised preliminary report (2010)Google Scholar
  9. 9.
    Leroy, X., Doligez, D., Frisch, A., Garrigue, J., Rémy, D., Vouillon, J.: The Objective Caml system, Documentation and user’s manual (2010)Google Scholar
  10. 10.
    Lewis, P.A.W., Goodman, A.S., Miller, J.M.: A pseudo-random number generator for the System/360. IBM Systems Journal 8(2), 136–146 (1969)CrossRefGoogle Scholar
  11. 11.
    Marlow, S. (ed.): Haskell 2010 Language Report (2010)Google Scholar
  12. 12.
    Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML, Revised edn. MIT Press (1997)Google Scholar
  13. 13.
    Pierce, B.C., Turner, D.N.: Local type inference. ACM Transactions on ProgrammingLanguages and Systems 22(1), 1–44 (2000)CrossRefGoogle Scholar
  14. 14.
    Postel, J.: DoD standard Transmission control protocol. IETF RFC 761 (1980)Google Scholar
  15. 15.
    Reynolds, J.C.: Preliminary design of the programming language Forsythe. Technical report CMU-CS-88-159, Carnegie-Mellon University (1988)Google Scholar
  16. 16.
    Sperber, M., Flatt, M., Van Straaten, A., Kent Dybvig, R., Findler, R.B., Matthews, J.: Revised6 report on the algorithmic language Scheme. J. of Functional Programming 19(S1), 1–301 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Steele Jr., G.L.: Common Lisp: the Language, 2nd edn. Digital Press (1994)Google Scholar
  18. 18.
    Stroustrup, B.: The C++ Programming Language, 3rd edn. Addison-Wesley (2000)Google Scholar
  19. 19.
    Tobin-Hochstadt, S., Felleisen, M.: The design and implementation of Typed Scheme. In: Proc. Symp. on Principles of Programming Languages, pp. 395–406 (2008)Google Scholar
  20. 20.
    Tobin-Hochstadt, S., Felleisen, M.: Logical types for untyped languages. In: Proc. International Conf. on Functional Programming, pp. 117–128 (2010)Google Scholar
  21. 21.
    Tobin-Hochstadt, S., St-Amour, V., Culpepper, R., Flatt, M., Felleisen, M.: Languages as libraries. In: Proc. Programming Language Design and Implementation, pp. 132–141 (2011)Google Scholar
  22. 22.
    Wright, A.K., Cartwright, R.: A practical soft type system for Scheme. ACM Transactions on Programming Languages and Systems 19(1), 87–152 (1997)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Vincent St-Amour
    • 1
  • Sam Tobin-Hochstadt
    • 1
  • Matthew Flatt
    • 2
  • Matthias Felleisen
    • 1
  1. 1.Northeastern UniversityUSA
  2. 2.University of UtahUSA

Personalised recommendations