Tutorial on ATS/Anairiats


This website contains a set of detailed tutorials for people interested in learning ATS/Anairiats. ATS is a functional language that supports a variety of advanced types such as dependent types and linear types, and Anairiats is the current implementation of ATS. ATS/Anairiats can run with or without (systematic) garbage collection (GC), and its performance is comparable to imperative languages like C and C++.

We encourage ATS programmers to write tutorials on ATS features, which are rich and often complex, and make them available to the ATS community.


Tutorial Topics

This tutorial is written mostly in the style of learn-by-examples. As ATS is first and foremost a functional programming language, knowledge of functional programming should be of great help for learning ATS. In particular, knowledge of Standard ML (SML) or Objective Caml (OCaml) can be a big plus as a considerably large part of the syntax of ATS is adopted from SML. In addition, some solid understanding of C (especially, memory allocation/deallocation in C) can be highly valuable for learning features involving linear types in ATS.
  • Convention for Coloring ATS Syntax
  • Basics
  • Filename Extensions
  • File Inclusion
  • Compilation
  • The Main Function in ATS
  • Fixity Declaration
  • Overloading
  • Function or Closure?
  • Functions with Variable Arguments
  • Tail-Recursive Functions
  • Termination Metrics
  • Types with Effects
  • Call-By-Reference
  • (Persistent) Lists
  • Linear Lists
  • Pointers
  • References
  • (Persistent) Arrays and Matrices
  • Linear Arrays
  • Datatypes
  • Dataprops
  • Dataviews
  • Dataviewtypes
  • Pattern Matching
  • Exceptions
  • Val(ue) and Var(iable) Declarations
  • Higher-Order Functions
  • Lazy Evaluation
  • Macros
  • Templates
  • Memory Allocation/Deallocation
  • Input and Output
  • Combining ATS and C programs
  • Programming with Theorem Proving

  • This page is maintained by Hongwei Xi. As always, your comments are welcome.