Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!ginosko!uunet!dino!atanasoff!atanasoff.cs.iastate.edu!lakshmin From: lakshmin@atanasoff.cs.iastate.edu (Lakshminarayana Rudrabhatla) Newsgroups: comp.lang.icon Subject: criticism of icon Message-ID: <1489@atanasoff.cs.iastate.edu> Date: 8 Sep 89 16:43:55 GMT Sender: lakshmin@atanasoff.cs.iastate.edu Reply-To: lakshmin@atanasoff.cs.iastate.edu (Lakshminarayana Rudrabhatla) Distribution: usa Organization: Iowa State U. Computer Science Department, Ames, IA Lines: 51 procedure main() words:=table() line_no:=0 while line:=read() do { line_no +:=1 write(left(line_no,6),left(line,40)) line:=map(line) i:=1 while j:=upto(&lcase,line,i) do { i:=many(&lcase,line,j) if *line[i:j] >= 3 then {if \words[line[i:j]] #line 14 then insert(words[line[i:j]],line_no) #line 15 else {words[line[i:j]]:=set() #line 16 insert(words[line[i:j]], line_no) #line 17 } } } } words:=sort(words) i:=0 while pair:=words[i +:=1] do { writes(left(pair[1],10),":") s:=!pair[2] pair[2]:=delete(pair[2],!pair[2]) every s ||:= ", " ||!pair[2] write(s) } end --------------------------------------------------------- question: in lines 14 thru 17 of the above program i had to implicitly declare the type of assigned value of table "words" as set(){ref: line#16} before i could perform the insert op. in line #15. this problem arose because &null would'nt coerce automatically to set(). this inspite of the claim that icon is dynamically typed. As a user, my "natural" impression was to assume that &null could represent an set() or "" or [] , as the case may be, since this facilitates easier and logical manipulation of the assigned value part of the structure "table" in general. does anyone see any problems with modifying the language to allow coercion of &null to set() or "" or [], as the case maybe depending upon the type of operation being performed on the assigned part of the structure "table".