Writing ASCII Fortress that will Render Beautifully

The Fortress examples in the Fortress Language Specification 1.0Beta are rendered using a program called fortify.

This page provides some examples which show how to write ASCII Fortress source code that corresponds to the examples in the Specification.

p. 63, matrix multiplication and matrix unpasting

Fortified mm function

 mm [\ nat m, nat n, nat p \] (left:RR^(m BY n), right:RR^(n BY p), result:RR^(m BY p)):() =
    case largest of
      1=> result[0,0] += (left[0,0] right[0,0])
      m=> [ lefttop
            leftbottom ] = left
          [ resulttop
            resultbottom ] = result
          t1 = spawn do mm(lefttop, right, resulttop) end
          mm(leftbottom, right, resultbottom)
          t1.wait()
      p=> [ rightleft rightright ] = right
          [ resultleft resultright ] = result
          t1 = spawn do mm(left, rightleft, resultleft) end
          mm(left, rightright, resultright)
          t1.wait()
      n=> [ leftleft leftright ] = left
          [ righttop
            rightbottom ] = right
          mm(leftleft , righttop , result)
          mm(leftright, rightbottom, result)
    end 

Notes:

  • identifiers such as mm, m, n, p, left, right render in italics mm, m, n, p, left, right
  • reserved words such as case of do end render in fixed width, bold case of do end
  • RR denotes the real number type (ZZ denotes integers)
  • RR^(m BY n) denotes an m by n array array of real numbers, . The dimensions are rendered as a superscript.
  • Use [\ ... \] to enclose the function's parametric types (Appendix E.2.3 p. 377).
  • t1 renders as t1 (Appendix D p. 373)
  • Array indexing such as result[0,0] renders as result0,0
  • => renders as a double arrow (Appendix E.2.3 p. 377); see also Rendering rules for arrows

Attachments