steven@cwi.nl (Steven Pemberton) (01/29/88)
Concerning the discussion about initial teaching languages, and in particular ABC: ABC was originally designed as a beginner's language, as a suitable replacement for BASIC: it is as simple as BASIC to learn, and it is interactive. However, it is much easier to use than BASIC, and of course has structured commands and data types. In the course of its development, it has become an attractive language for non-beginners too, despite its simplicity. - There are only 5 data-types: 2 basic types (numbers and strings), and 3 constructors (records, sorted lists and sorted tables). - There are no limits to the size of values (apart from memory size), so numbers for instance are unbounded (no maxint, or the like). - The type system is completely orthogonal, so you can have lists of any other type, for instance. - There are no declarations, but it is strongly typed, using type inference. - Global variables are 'persistent': if you come back after logging out, all your variables are still there as you left them. This means that there is no need for separate file-handling commands or data-types. - It is an algorithmic language; the commands are what you'd expect: IF, WHILE, assignment, etc. You can define your own commands and functions. As Tim Budd pointed out, there are refinements which directly support top-down programming. - Indentation is used rather than BEGIN-END or { } to indicate nesting. Here's a simple example: building a telephone list. >>> PUT {} IN tel (>>> is the prompt; 'PUT expr IN location' is assignment; this initialises tel with the empty table) >>> PUT 4141 IN tel["Lambert"] >>> PUT 4071 IN tel["Steven"] >>> PUT 4159 IN tel["Tim"] >>> WRITE tel["Steven"] 4071 >>> WRITE tel (You can write any ABC value) {["Lambert"]: 4141; ["Steven"]: 4071; ["Tim"]: 4159} (Sorted on the keys) >>> WRITE keys tel {"Lambert"; "Steven"; "Tim"} >>> FOR name IN keys tel: WRITE name, ":", tel[name] / ( / gives a newline) Lambert: 4141 Steven: 4071 Tim: 4159 >>> HOW TO DISPLAY table: (Define a command to do the same. FOR key IN keys table: ABC is polymorphic, so DISPLAY WRITE key<<10, table[key] / works for any kind of table; << gives a field width) >>> DISPLAY tel Lambert 4141 Steven 4071 Tim 4159 >>> PUT {} IN user (Create the inverse table, >>> FOR name IN keys tel: from numbers to names) PUT name IN user[tel[name]] >>> WRITE user[4071] Steven >>> HOW TO RETURN inverse table: (Make it a function; again, this PUT {} IN inv will invert any kind of table) FOR key IN keys table: PUT key IN inv[table[key]] RETURN inv >>> WRITE inverse tel {[4071]: "Steven"; [4141]: "Lambert"; [4159]: "Tim"} (Sorted on the keys) To give an idea of the use of refinements, here is a function to create a cross-reference of a text document. Text documents are represented in ABC using a table with line numbers as keys, and a string as items. For instance: >>> DISPLAY poem 1 I've never seen a purple cow 2 I hope I never see one 3 But I can tell you anyhow 4 I'd rather see than be one Here's the function: HOW TO RETURN index doc: (index is the name, doc the parameter) PUT {} IN index FOR line.no IN keys doc: TREAT LINE RETURN index TREAT LINE: (This is a refinement) FOR word IN split doc[line.no]: ('split' splits a string into words) SAVE WORD SAVE WORD: IF word not.in keys index: PUT {} IN index[word] INSERT line.no IN index[word] (Insert line.no in list of numbers stored for the word) >>> DISPLAY index poem I {2; 2; 3} I'd {4} I've {1} a {1} anyhow {3} be {4} but {3} can {3} cow {1} hope {2} never {1; 2} one {2; 4} purple {1} rather {4} see {2; 4} seen {1} tell {3} than {4} you {3} Now, to reply to some of Tim Budd's remarks: > For a long time it only ran under Unix (I believe this may have since > changed). It now runs under Unix, MS-DOS, on the Macintosh and on the Atari ST. > It is not noted for its speed. It's an interpreter; still it compares well with the Unix Pascal interpreter, and the arithmetic is often faster than Unix bc. > It uses a lot of memory. Yes, the current version does everything in store. We have an experimental version with virtual store running, but not released. > For more information, write > ABC Implementation > CWI / AA > Postbox 4079 > 1009 AB Amsterdam > the Netherlands > or send a note to my good friend steven pemberton (who will > probably regret I mentioned this) at steven@mcvax.uucp I don't regret it at all. Send me your paper-mail address, and I'll send more information, and put you on our mailing list. steven@cwi.nl is the official address, for modern mailers. Steven Pemberton, CWI, Amsterdam; steven@cwi.nl
kers@otter.hple.hp.com (Christopher Dollin) (01/30/88)
/ otter:comp.lang.misc / steven@cwi.nl (Steven Pemberton) / 5:21 pm Jan 28, 1988 / Concerning the discussion about initial teaching languages, and in particular ABC: ABC was originally designed as a beginner's language, as a suitable replacement for BASIC: it is as simple as BASIC to learn, and it is interactive. However, it is much easier to use than BASIC, and of course has structured commands and data types. In the course of its development, it has become an attractive language for non-beginners too, despite its simplicity. - There are only 5 data-types: 2 basic types (numbers and strings), and 3 constructors (records, sorted lists and sorted tables). - There are no limits to the size of values (apart from memory size), so numbers for instance are unbounded (no maxint, or the like). - The type system is completely orthogonal, so you can have lists of any other type, for instance. - There are no declarations, but it is strongly typed, using type inference. - Global variables are 'persistent': if you come back after logging out, all your variables are still there as you left them. This means that there is no need for separate file-handling commands or data-types. - It is an algorithmic language; the commands are what you'd expect: IF, WHILE, assignment, etc. You can define your own commands and functions. As Tim Budd pointed out, there are refinements which directly support top-down programming. - Indentation is used rather than BEGIN-END or { } to indicate nesting. Here's a simple example: building a telephone list. >>> PUT {} IN tel (>>> is the prompt; 'PUT expr IN location' is assignment; this initialises tel with the empty table) >>> PUT 4141 IN tel["Lambert"] >>> PUT 4071 IN tel["Steven"] >>> PUT 4159 IN tel["Tim"] >>> WRITE tel["Steven"] 4071 >>> WRITE tel (You can write any ABC value) {["Lambert"]: 4141; ["Steven"]: 4071; ["Tim"]: 4159} (Sorted on the keys) >>> WRITE keys tel {"Lambert"; "Steven"; "Tim"} >>> FOR name IN keys tel: WRITE name, ":", tel[name] / ( / gives a newline) Lambert: 4141 Steven: 4071 Tim: 4159 >>> HOW TO DISPLAY table: (Define a command to do the same. FOR key IN keys table: ABC is polymorphic, so DISPLAY WRITE key<<10, table[key] / works for any kind of table; << gives a field width) >>> DISPLAY tel Lambert 4141 Steven 4071 Tim 4159 >>> PUT {} IN user (Create the inverse table, >>> FOR name IN keys tel: from numbers to names) PUT name IN user[tel[name]] >>> WRITE user[4071] Steven >>> HOW TO RETURN inverse table: (Make it a function; again, this PUT {} IN inv will invert any kind of table) FOR key IN keys table: PUT key IN inv[table[key]] RETURN inv >>> WRITE inverse tel {[4071]: "Steven"; [4141]: "Lambert"; [4159]: "Tim"} (Sorted on the keys) To give an idea of the use of refinements, here is a function to create a cross-reference of a text document. Text documents are represented in ABC using a table with line numbers as keys, and a string as items. For instance: >>> DISPLAY poem 1 I've never seen a purple cow 2 I hope I never see one 3 But I can tell you anyhow 4 I'd rather see than be one Here's the function: HOW TO RETURN index doc: (index is the name, doc the parameter) PUT {} IN index FOR line.no IN keys doc: TREAT LINE RETURN index TREAT LINE: (This is a refinement) FOR word IN split doc[line.no]: ('split' splits a string into words) SAVE WORD SAVE WORD: IF word not.in keys index: PUT {} IN index[word] INSERT line.no IN index[word] (Insert line.no in list of numbers stored for the word) >>> DISPLAY index poem I {2; 2; 3} I'd {4} I've {1} a {1} anyhow {3} be {4} but {3} can {3} cow {1} hope {2} never {1; 2} one {2; 4} purple {1} rather {4} see {2; 4} seen {1} tell {3} than {4} you {3} Now, to reply to some of Tim Budd's remarks: > For a long time it only ran under Unix (I believe this may have since > changed). It now runs under Unix, MS-DOS, on the Macintosh and on the Atari ST. > It is not noted for its speed. It's an interpreter; still it compares well with the Unix Pascal interpreter, and the arithmetic is often faster than Unix bc. > It uses a lot of memory. Yes, the current version does everything in store. We have an experimental version with virtual store running, but not released. > For more information, write > ABC Implementation > CWI / AA > Postbox 4079 > 1009 AB Amsterdam > the Netherlands > or send a note to my good friend steven pemberton (who will > probably regret I mentioned this) at steven@mcvax.uucp I don't regret it at all. Send me your paper-mail address, and I'll send more information, and put you on our mailing list. steven@cwi.nl is the official address, for modern mailers. Steven Pemberton, CWI, Amsterdam; steven@cwi.nl ----------
kers@otter.hple.hp.com (Christopher Dollin) (01/30/88)
/ otter:comp.lang.misc / kers@otter.hple.hp.com (Christopher Dollin) / 4:25 pm Jan 29, 1988 / / otter:comp.lang.misc / steven@cwi.nl (Steven Pemberton) / 5:21 pm Jan 28, 1988 / Concerning the discussion about initial teaching languages, and in particular ABC: ABC was originally designed as a beginner's language, as a suitable replacement for BASIC: it is as simple as BASIC to learn, and it is interactive. However, it is much easier to use than BASIC, and of course has structured commands and data types. In the course of its development, it has become an attractive language for non-beginners too, despite its simplicity. - There are only 5 data-types: 2 basic types (numbers and strings), and 3 constructors (records, sorted lists and sorted tables). - There are no limits to the size of values (apart from memory size), so numbers for instance are unbounded (no maxint, or the like). - The type system is completely orthogonal, so you can have lists of any other type, for instance. - There are no declarations, but it is strongly typed, using type inference. - Global variables are 'persistent': if you come back after logging out, all your variables are still there as you left them. This means that there is no need for separate file-handling commands or data-types. - It is an algorithmic language; the commands are what you'd expect: IF, WHILE, assignment, etc. You can define your own commands and functions. As Tim Budd pointed out, there are refinements which directly support top-down programming. - Indentation is used rather than BEGIN-END or { } to indicate nesting. Here's a simple example: building a telephone list. >>> PUT {} IN tel (>>> is the prompt; 'PUT expr IN location' is assignment; this initialises tel with the empty table) >>> PUT 4141 IN tel["Lambert"] >>> PUT 4071 IN tel["Steven"] >>> PUT 4159 IN tel["Tim"] >>> WRITE tel["Steven"] 4071 >>> WRITE tel (You can write any ABC value) {["Lambert"]: 4141; ["Steven"]: 4071; ["Tim"]: 4159} (Sorted on the keys) >>> WRITE keys tel {"Lambert"; "Steven"; "Tim"} >>> FOR name IN keys tel: WRITE name, ":", tel[name] / ( / gives a newline) Lambert: 4141 Steven: 4071 Tim: 4159 >>> HOW TO DISPLAY table: (Define a command to do the same. FOR key IN keys table: ABC is polymorphic, so DISPLAY WRITE key<<10, table[key] / works for any kind of table; << gives a field width) >>> DISPLAY tel Lambert 4141 Steven 4071 Tim 4159 >>> PUT {} IN user (Create the inverse table, >>> FOR name IN keys tel: from numbers to names) PUT name IN user[tel[name]] >>> WRITE user[4071] Steven >>> HOW TO RETURN inverse table: (Make it a function; again, this PUT {} IN inv will invert any kind of table) FOR key IN keys table: PUT key IN inv[table[key]] RETURN inv >>> WRITE inverse tel {[4071]: "Steven"; [4141]: "Lambert"; [4159]: "Tim"} (Sorted on the keys) To give an idea of the use of refinements, here is a function to create a cross-reference of a text document. Text documents are represented in ABC using a table with line numbers as keys, and a string as items. For instance: >>> DISPLAY poem 1 I've never seen a purple cow 2 I hope I never see one 3 But I can tell you anyhow 4 I'd rather see than be one Here's the function: HOW TO RETURN index doc: (index is the name, doc the parameter) PUT {} IN index FOR line.no IN keys doc: TREAT LINE RETURN index TREAT LINE: (This is a refinement) FOR word IN split doc[line.no]: ('split' splits a string into words) SAVE WORD SAVE WORD: IF word not.in keys index: PUT {} IN index[word] INSERT line.no IN index[word] (Insert line.no in list of numbers stored for the word) >>> DISPLAY index poem I {2; 2; 3} I'd {4} I've {1} a {1} anyhow {3} be {4} but {3} can {3} cow {1} hope {2} never {1; 2} one {2; 4} purple {1} rather {4} see {2; 4} seen {1} tell {3} than {4} you {3} Now, to reply to some of Tim Budd's remarks: > For a long time it only ran under Unix (I believe this may have since > changed). It now runs under Unix, MS-DOS, on the Macintosh and on the Atari ST. > It is not noted for its speed. It's an interpreter; still it compares well with the Unix Pascal interpreter, and the arithmetic is often faster than Unix bc. > It uses a lot of memory. Yes, the current version does everything in store. We have an experimental version with virtual store running, but not released. > For more information, write > ABC Implementation > CWI / AA > Postbox 4079 > 1009 AB Amsterdam > the Netherlands > or send a note to my good friend steven pemberton (who will > probably regret I mentioned this) at steven@mcvax.uucp I don't regret it at all. Send me your paper-mail address, and I'll send more information, and put you on our mailing list. steven@cwi.nl is the official address, for modern mailers. Steven Pemberton, CWI, Amsterdam; steven@cwi.nl ---------- ----------