Hi,
I don't really understand why #back goes two step backward:
stream := ReadStream on: 'abc' copy. stream next. stream next. stream peek. ==> $c stream back. ==> $a
If the following character is $c then the previous one should be $b. Don't you think so?
Bye
On 6-Apr-07, at 8:08 AM, Damien Cassou wrote:
Hi,
I don't really understand why #back goes two step backward:
stream := ReadStream on: 'abc' copy. stream next. stream next. stream peek. ==> $c stream back. ==> $a
If the following character is $c then the previous one should be $b. Don't you think so?
If current char is$b, then next is $c and previous is $a.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- If you stand close enough to him, you can hear the ocean
2007/4/6, tim Rowledge tim@rowledge.org:
On 6-Apr-07, at 8:08 AM, Damien Cassou wrote:
Hi,
I don't really understand why #back goes two step backward:
stream := ReadStream on: 'abc' copy. stream next. stream next. stream peek. ==> $c stream back. ==> $a
If the following character is $c then the previous one should be $b. Don't you think so?
If current char is$b, then next is $c and previous is $a.
Ok :-) I didn't know there were a notion of current element. I thought a stream was always between two elements; and there is no notion of current in ANSI Smalltlalk.
Thank you
2007/4/6, Mathieu Suen mathk.sue@gmail.com:
yep but peek return the current char. Isn't it?
According to what I understand:
- #peek returns the next element - #back returns the previous element - #last returns the current one (what a great name, isn't it?)
squeak-dev@lists.squeakfoundation.org