Tutorial on ATS/Anairiats


This website contains a set of 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 (all-topics-in-one-file)

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.

The name of the ATS home directory is stored in the environment variable ATSHOME, and we often use $ATSHOME to refer to this name. In the tutorial, if a file FILE is mentioned, then the absolute full name for this file is $ATSHOME/FILE unless specified otherwise.

Primary Tutorial Topics

  • Convention for Coloring ATS Syntax
  • Basics
  • Filename Extensions
  • File Inclusion
  • Compilation
  • The Main Function in ATS
  • Fixity Declaration
  • Overloading
  • Macros
  • Function or Closure?
  • Variadic Functions
  • Tail-Recursive Functions
  • Termination Metrics
  • Types with Effects
  • Parametric Polymorphism and Templates
  • (Persistent) Lists
  • Val(ue) and Var(iable) Declarations
  • Call-By-Reference
  • Pointers
  • References
  • (Persistent) Arrays and Matrices
  • Linear Arrays
  • Strings and String Buffers
  • Datatypes
  • Dataprops
  • Dataviews
  • Dataviewtypes
  • Pattern Matching
  • Exceptions
  • Higher-Order Functions
  • Lazy Evaluation
  • Linear Lazy Evaluation
  • Input and Output
  • Combining ATS and C programs
  • Programming with Theorem Proving
  • Secondary Tutorial Topics

  • Casting Functions
  • Allocation in Stack Frames
  • State Types
  • Loop Constructs

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


    SourceForge.net Logo