##- # Author: Brian Tiffin # Dedicated to the public domain # # Date started: April 2017 # Modified: 2017-04-13/15:14-0400 btiffin ##+ # # size-operator.icn, demonstrate size operator for various expressions # # tectonics: unicon -s size-operator.icn -x # link printf record R(f1, f2, f3) procedure main() format := "%-12s %-20s is %2d %s\n" printf(format, "integer:", "*12", *12, "as string") printf(format, "real:", "*12.12", *12.12, "as string") printf(format, "string:", "*\"abc\"", *"abc", "") printf(format, "cset:", "*'aabbcd'", *'aabbcd', "") printf(format, "list:", "*[1,2,3]", *[1,2,3], "") printf(format, "list:", "*[: 1 to 5 :]", *[: 1 to 5 :], "") r1 := R(1,2,3) printf(format, "record:", "*record(f1,f2,f3)", *r1, "") printf(format, "keyword:", "*&file", *&file, "as name: " || &file) db := open("unicon", "o", "", "") printf(format, "odbc:", "*db of ODBC file", *db, "") sql(db, "select * from contacts") printf(format, "odbc:", "*fetch() of contacts", *fetch(db), "") close(db) coexp := create seq()\3 printf(format, "activations:", "*coexp", *coexp, "none from seq()\\3") @coexp printf(format, "activations:", "*coexp", *coexp, "after one") every 1 to 6 do @coexp printf(format, "activations:", "*coexp", *coexp, "after seven") end