record array(a,b,c,d,e,f,g)

procedure dummy(u,v,x,y,z)
   suspend u | v
   return x
end

procedure main()
   p1()
   p2()
   p3()
   p4()
   p5()
   p6()
   p7()
   p8()
   p9()
end

procedure p1()
   write("image(2) ----> ",image(image(2)) | "none")
   write("image('cab') ----> ",image(image('cab')) | "none")
   write("image(&lcase) ----> ",image(image(&lcase)) | "none")
   write("image('abcdefghijklmnopqrstuvwxyz') ----> ",image(image('abcdefghijklmnopqrstuvwxyz')) | "none")
   write("image(&input) ----> ",image(image(&input)) | "none")
   write("image() ----> ",image(image()) | "none")
   write("image(&null) ----> ",image(image(&null)) | "none")
   write("image([1,2,3]) ----> ",image(image([1,2,3])) | "none")
   write("image([]) ----> ",image(image([])) | "none")
   write("image([,]) ----> ",image(image([,])) | "none")
   write("image(table()) ----> ",image(image(table())) | "none")
   write("image(table(3)) ----> ",image(image(table(3))) | "none")
   write("image(list(0)) ----> ",image(image(list(0))) | "none")
   write("image(repl) ----> ",image(image(repl)) | "none")
   write("image(main) ----> ",image(image(main)) | "none")
   write("image(repl(&lcase,10)) ----> ",image(image(repl(&lcase,10))) | "none")
   write("image(array) ----> ",image(image(array)) | "none")
   write("image(a) ----> ",image(image(a)) | "none")
   write("image(array) ----> ",image(image(array)) | "none")
   write("image(image) ----> ",image(image(image)) | "none")
end

procedure p2()
   write("integer(2) ----> ",image(integer(2)) | "none")
   write("integer(\"2\") ----> ",image(integer("2")) | "none")
   write("integer(\" 2\") ----> ",image(integer(" 2")) | "none")
   write("integer(\"2 \") ----> ",image(integer("2 ")) | "none")
   write("integer(\"+2\") ----> ",image(integer("+2")) | "none")
   write("integer(\"-2\") ----> ",image(integer("-2")) | "none")
   write("integer(\"- 2\") ----> ",image(integer("- 2")) | "none")
   write("integer(\" -    2 \") ----> ",image(integer(" -    2 ")) | "none")
   write("integer(\"\") ----> ",image(integer("")) | "none")
   write("integer(\"--2\") ----> ",image(integer("--2")) | "none")
   write("integer(\" \") ----> ",image(integer(" ")) | "none")
   write("integer(\"-\") ----> ",image(integer("-")) | "none")
   write("integer(\"+\") ----> ",image(integer("+")) | "none")
   write("integer(\"7r4\") ----> ",image(integer("7r4")) | "none")
   write("integer(\"4r7\") ----> ",image(integer("4r7")) | "none")
   write("integer(\"4r 7\") ----> ",image(integer("4r 7")) | "none")
   write("integer(\"7r 4\") ----> ",image(integer("7r 4")) | "none")
   write("integer(\"16rff\") ----> ",image(integer("16rff")) | "none")
   write("integer(\"36rcat\") ----> ",image(integer("36rcat")) | "none")
   write("integer(\"36Rcat\") ----> ",image(integer("36Rcat")) | "none")
   write("integer(\"36rCAT\") ----> ",image(integer("36rCAT")) | "none")
   write("integer(\"1r1\") ----> ",image(integer("1r1")) | "none")
   write("integer(\"2r0\") ----> ",image(integer("2r0")) | "none")
   write("integer(integer) ----> ",image(integer(integer)) | "none")
   write("integer := abs ----> ",image(integer := abs) | "none")
end

procedure p3()
   write("numeric(2) ----> ",image(numeric(2)) | "none")
   write("numeric(\"2\") ----> ",image(numeric("2")) | "none")
   write("numeric(\" 2\") ----> ",image(numeric(" 2")) | "none")
   write("numeric(\"2 \") ----> ",image(numeric("2 ")) | "none")
   write("numeric(\"+2\") ----> ",image(numeric("+2")) | "none")
   write("numeric(\"-2\") ----> ",image(numeric("-2")) | "none")
   write("numeric(\"- 2\") ----> ",image(numeric("- 2")) | "none")
   write("numeric(\" -    2 \") ----> ",image(numeric(" -    2 ")) | "none")
   write("numeric(\"\") ----> ",image(numeric("")) | "none")
   write("numeric(\"--2\") ----> ",image(numeric("--2")) | "none")
   write("numeric(\" \") ----> ",image(numeric(" ")) | "none")
   write("numeric(\"-\") ----> ",image(numeric("-")) | "none")
   write("numeric(\"+\") ----> ",image(numeric("+")) | "none")
   write("numeric(\"7r4\") ----> ",image(numeric("7r4")) | "none")
   write("numeric(\"4r7\") ----> ",image(numeric("4r7")) | "none")
   write("numeric(\"4r 7\") ----> ",image(numeric("4r 7")) | "none")
   write("numeric(\"7r 4\") ----> ",image(numeric("7r 4")) | "none")
   write("numeric(\"16rff\") ----> ",image(numeric("16rff")) | "none")
   write("numeric(\"36rcat\") ----> ",image(numeric("36rcat")) | "none")
   write("numeric(\"36Rcat\") ----> ",image(numeric("36Rcat")) | "none")
   write("numeric(\"36rCAT\") ----> ",image(numeric("36rCAT")) | "none")
   write("numeric(\"1r1\") ----> ",image(numeric("1r1")) | "none")
   write("numeric(\"2r0\") ----> ",image(numeric("2r0")) | "none")
end

procedure p4()
end

procedure p5()
   write("numeric(2) ----> ",image(numeric(2)) | "none")
   write("numeric(2) ----> ",image(numeric(2)) | "none")
   write("numeric(+2) ----> ",image(numeric(+2)) | "none")
   write("numeric(-2) ----> ",image(numeric(-2)) | "none")
   write("numeric() ----> ",image(numeric()) | "none")
   write("numeric(7r4) ----> ",image(numeric(7r4)) | "none")
   write("numeric(16rff) ----> ",image(numeric(16rff)) | "none")
   write("numeric(36rcat) ----> ",image(numeric(36rcat)) | "none")
   write("numeric(36Rcat) ----> ",image(numeric(36Rcat)) | "none")
   write("numeric(36rCAT) ----> ",image(numeric(36rCAT)) | "none")
   write("numeric(2r0) ----> ",image(numeric(2r0)) | "none")
   write("numeric(+-2) ----> ",image(numeric(+-2)) | "none")
   write("numeric(++2) ----> ",image(numeric(++2)) | "none")
   write("numeric(--2) ----> ",image(numeric(--2)) | "none")
end

procedure p6()
   write("36 ^ -9 ----> ",image(36 ^ -9) | "none")
   write("-36 ^ -9 ----> ",image(-36 ^ -9) | "none")
end

procedure p7()
   write("f := open(\"foo.baz\",\"w\") ----> ",image(f := open("foo.baz","w")) | "none")
   write("write(f,\"hello world\") ----> ",image(write(f,"hello world")) | "none")
   write("close(f) ----> ",image(close(f)) | "none")
end

procedure p8()
   write("\ncset sizes and images:")
   L := [
      '',
      '<()>',
      '\b\d\e\f\l\n\r\t\v',
      &digits,
      '0123456789',
      '02468' ++ '13579',
      ')!@#$%^&*(',
      'the icon programming language',
      &lcase,
      'abcdefghijklmnopqrstuvwxyz',
      &letters -- &ucase,
      'aBcDeFgHiJkLmNoPqRsTuVwXyZ',
      &ucase,
      'ZYXWVUTSRQPONMLKJIHGFEDCBA',
      &letters -- &lcase,
      'AbcdEfghIjklmnOpqrstUvwxyz',
      'The Quick Brown Fox Jumped Over The Lazy Gray Dog\'s Back',
      &letters,
      'abcdefghijklmnopqrstuvwxyzZYXWVUTSRQPONMLKJIHGFEDCBA',
      &lcase ++ &ucase,
      'abcdefghijk|mn.pqrstuvwxyz2YXWVUT5RQP0NMLKJ1HGFEDCBA',
      &ascii,
      &cset -- ~&ascii,
      &cset,
      &letters ++ ~&ucase,
   &null]
   pull(L)
   every e := !L do {
      s := image(e)	# do this first to make image() calc the cset size
      s[76:0] := ""
      write (right(*e,3), " ", s)
      }
   write()
end

procedure p9()
   write(image(&ascii) | "failed")
#   write(image(&clock) | "failed")
   write(image(&cset) | "failed")
#   write(image(&date) | "failed")
#   write(image(&dateline) | "failed")
   write(image(&e) | "failed")
   write(image(&fail) | "failed")
#   write(image(&host) | "failed")
   write(image(&input) | "failed")
   write(image(&lcase) | "failed")
   write(image(&null) | "failed")
   write(image(&output) | "failed")
   write(image(&phi) | "failed")
   write(image(&pi) | "failed")
   write(image(&pos) | "failed")
   write(image(&random) | "failed")
   write(image(&subject) | "failed")
#   write(image(&time) | "failed")
   write(image(&ucase) | "failed")
#   write(image(&version) | "failed")
   exit(abs(3.0))
end
