Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!mimsy!tove.umd.edu!folta From: folta@tove.umd.edu (Wayne Folta) Newsgroups: comp.lang.smalltalk Subject: Re: Smalltalk (maybe only Smalltalk/V) quest. Summary: Answer discovered (Thanks)) Message-ID: <17288@mimsy.UUCP> Date: 4 May 89 01:54:35 GMT References: <17280@mimsy.UUCP> <14607@louie.udel.EDU> Sender: nobody@mimsy.UUCP Reply-To: folta@tove.umd.edu.UUCP (Wayne Folta) Distribution: usa Organization: U of Maryland, Dept. of Computer Science, gs Lines: 26 You were correct (and I stumbled onto the answer seconds before checking the news again.) A working method is: |s f| s := Prompter prompt: 'enter line' default: ''. f := Bag new. s do: [:c | c isLetter ifTrue: [f add: c asLowerCase]]. ^'abcdefghijklmnopqrstuvwxyz' asArray collect: [:c | f occurrencesOf: c] The asArray did the trick. Am I understanding this construct correctly? Evidently, when a string responds to collect: it insists on building another string, which cannot--of course--contain integers. So, using the asArray, I am "casting" (to use a C term) the string to an array, so that it responds correctly (for my purposes) to the collect:. Is this nearly correct? If so, Smalltalk can be learned (to the level of getting something done, as opposed to the level of guru-nicity) *very* quickly! I just got this thing yesterday, and I have only had a few hours to play with it, as I am presently constructing a compiler for a class. As an historical (maybe?) experiment, I am going to try to teach my computer-phobic parents Smalltalk this summer. Of course, this sample is too small to be statistically valid, but it will be interesting! Wayne Folta (folta@tove.umd.edu 128.8.128.42)