|
|
1.1 ! root 1: # This program contains samples of all the basic syntactic ! 2: # forms in Icon. ! 3: ! 4: record three(x,y,z) ! 5: record zero() ! 6: record one(z) ! 7: ! 8: global line, count ! 9: ! 10: procedure main() ! 11: end ! 12: procedure expr1() ! 13: local x,y,z ! 14: static e1 ! 15: initial e1 := 0 ! 16: () ! 17: {} ! 18: ();() ! 19: [] ! 20: [,] ! 21: x.y ! 22: x[i] ! 23: x[i:j] ! 24: x[i+:j] ! 25: x[i-:j] ! 26: (,,,) ! 27: x(,,,) ! 28: not x ! 29: |x ! 30: !x ! 31: *x ! 32: +x ! 33: -x ! 34: end ! 35: ! 36: procedure expr2() ! 37: .x ! 38: /x ! 39: =x ! 40: ?x ! 41: \x ! 42: ~x ! 43: @x ! 44: ^x ! 45: x \ i ! 46: x @ y ! 47: i ^ j ! 48: i * j ! 49: i / j ! 50: i % j ! 51: c1 ** c2 ! 52: i + j ! 53: i - j ! 54: c1 ++ c2 ! 55: c1 -- c2 ! 56: s1 || s2 ! 57: a1 ||| a2 ! 58: i < j ! 59: i <= j ! 60: i = j ! 61: i >= j ! 62: i > j ! 63: i ~= j ! 64: s1 << s2 ! 65: s1 == s2 ! 66: s1 >>= s2 ! 67: s1 >> s2 ! 68: s1 ~== s2 ! 69: x === y ! 70: x ~=== y ! 71: x | y ! 72: i to j ! 73: i to j by k ! 74: x := y ! 75: x <- y ! 76: x :=: y ! 77: x <-> y ! 78: i +:= j ! 79: i -:= j ! 80: i *:= j ! 81: end ! 82: ! 83: procedure expr3() ! 84: i /:= j ! 85: i %:= j ! 86: i ^:= j ! 87: i <:= j ! 88: i <=:= j ! 89: i =:= j ! 90: i >=:= j ! 91: i ~=:= j ! 92: c1 ++:= c2 ! 93: c1 --:= c2 ! 94: c1 **:= c2 ! 95: s1 ||:= s2 ! 96: s1 <<:= s2 ! 97: s1 <<=:= s2 ! 98: s1 ==:= s2 ! 99: s1 >>=:= s2 ! 100: s1 >>:= s2 ! 101: s1 ~==:= s2 ! 102: s1 ?:= s2 ! 103: a1 |||:= a2 ! 104: x ===:= y ! 105: x ~===:= y ! 106: x &:= y ! 107: x @:= y ! 108: s ? x ! 109: x & y ! 110: create x ! 111: return ! 112: return x ! 113: suspend x ! 114: fail ! 115: end ! 116: ! 117: procedure expr4() ! 118: while e1 do break ! 119: while e1 do break e2 ! 120: while e1 do next ! 121: case e of { ! 122: x: fail ! 123: (i > j) | 1 : return ! 124: } ! 125: case size(s) of { ! 126: 1: 1 ! 127: default: fail ! 128: } ! 129: if e1 then e2 ! 130: if e1 then e2 else e3 ! 131: repeat e ! 132: while e1 ! 133: while e1 do e2 ! 134: until e1 ! 135: until e1 do e2 ! 136: every e1 ! 137: every e1 do e2 ! 138: x ! 139: X_ ! 140: &cset ! 141: &null ! 142: "abc" ! 143: 'abc' ! 144: "\n" ! 145: "^a" ! 146: "\001" ! 147: "\x01" ! 148: 1 ! 149: 999999 ! 150: 36ra1 ! 151: 3.5 ! 152: 2.5e4 ! 153: 4e-10 ! 154: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.