Re: [Pharo-users] improving audio/video quality of pharo days recordings

2017-04-26 Thread Sean P. DeNigris
Peter Uhnak wrote
> clip-on microphone

Yes! Even a cheap lapel mic like the Sony ECM-CS3 would make a world of
difference



-
Cheers,
Sean
--
View this message in context: 
http://forum.world.st/improving-audio-video-quality-of-pharo-days-recordings-tp4944070p4944334.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Sending byte array in a JSON format

2017-04-26 Thread Peter Uhnak
It is also possible that ZnEasy is doing some encoding transformations that 
breaks it; after all, you are retrieving binary data as text data, so encoding 
should be applied on it.

Peter

On Wed, Apr 26, 2017 at 04:50:04PM +0200, Sven Van Caekenberghe wrote:
> I am puzzled by how they actually encoded the PNG as a String, I tried a 
> couple of alternatives but I could not get binary data out of it so that it 
> parsed successfully as PNG.
> 
> If I would have to encode binary data in JSON I would use Base64 encoding 
> (but alternatives exist).
> 
> > On 24 Apr 2017, at 20:36, Juraj Kubelka  wrote:
> > 
> > Hi,
> > 
> > I was playing with GitHub Gist API and I have queried the following Gist: 
> > https://gist.github.com/mbostock/5503544
> > I was interested how the PNG image is returned: 
> > https://gist.github.com/mbostock/5503544#file-thumbnail-png 
> > 
> > I can obtain the whole Gist executing:
> > 
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get).
> > 
> > I can get PNG contents executing:
> > 
> > pngData := (ZnEasy get:
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'raw_url')) 
> > contents.
> > PNGReadWriter formFromStream: rawPng readStream.
> > 
> > But the PNG image is part of the Gist query and can be retrieved by:
> > 
> > pngContent := STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'content').
> > 
> > "As pngContent is a WideString, I cannot use:"
> > PNGReadWriter formFromStream: pngContent readStream.
> > 
> > How can I read the PNG image from the pngContent? Any idea? 
> > And the reverse question: How can I send the PNG bytes using JSON format? 
> > 
> > Thanks!
> > Juraj
> > 
> 
> 



Re: [Pharo-users] Sending byte array in a JSON format

2017-04-26 Thread Peter Uhnak
Maybe the content is not properly stored in the JSON on github' side? But you 
can use base64 in `accept:` to make it work.

json := STONJSON fromString: (ZnClient new
  url: 'https://api.github.com/gists/5503544';
  accept: 'application/vnd.github.v3.base64+json';
  get).
b64 := ((json at: 'files') at: 'thumbnail.png') at: 'content'.
PNGReadWriter formFromStream: (Base64MimeConverter mimeDecodeToBytes: content 
readStream).

Peter


On Wed, Apr 26, 2017 at 04:50:04PM +0200, Sven Van Caekenberghe wrote:
> I am puzzled by how they actually encoded the PNG as a String, I tried a 
> couple of alternatives but I could not get binary data out of it so that it 
> parsed successfully as PNG.
> 
> If I would have to encode binary data in JSON I would use Base64 encoding 
> (but alternatives exist).
> 
> > On 24 Apr 2017, at 20:36, Juraj Kubelka  wrote:
> > 
> > Hi,
> > 
> > I was playing with GitHub Gist API and I have queried the following Gist: 
> > https://gist.github.com/mbostock/5503544
> > I was interested how the PNG image is returned: 
> > https://gist.github.com/mbostock/5503544#file-thumbnail-png 
> > 
> > I can obtain the whole Gist executing:
> > 
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get).
> > 
> > I can get PNG contents executing:
> > 
> > pngData := (ZnEasy get:
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'raw_url')) 
> > contents.
> > PNGReadWriter formFromStream: rawPng readStream.
> > 
> > But the PNG image is part of the Gist query and can be retrieved by:
> > 
> > pngContent := STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'content').
> > 
> > "As pngContent is a WideString, I cannot use:"
> > PNGReadWriter formFromStream: pngContent readStream.
> > 
> > How can I read the PNG image from the pngContent? Any idea? 
> > And the reverse question: How can I send the PNG bytes using JSON format? 
> > 
> > Thanks!
> > Juraj
> > 
> 
> 



Re: [Pharo-users] State of Tabular package ?

2017-04-26 Thread p...@highoctane.be
I am using it for accessing data from XLSX files and it works with several
sheets etc.

I found XLSX creation to have limits in terms of many sheets one can do
(kind of hardcoded up to 3 or something).

It is definitely a package worth some love.

Phil

On Wed, Apr 26, 2017 at 4:53 PM, Sven Van Caekenberghe  wrote:

> Hi,
>
> Does anyone know what the state of the Tabular package is ? Is it
> maintained ? Kept to date ?
>
> It feels a bit unpolished, lacks documentation.
>
> I am using it for XLS report generation and it does seem to work fine for
> simple tables.
>
> Sven
>
>


[Pharo-users] State of Tabular package ?

2017-04-26 Thread Sven Van Caekenberghe
Hi,

Does anyone know what the state of the Tabular package is ? Is it maintained ? 
Kept to date ?

It feels a bit unpolished, lacks documentation.

I am using it for XLS report generation and it does seem to work fine for 
simple tables.

Sven


Re: [Pharo-users] Sending byte array in a JSON format

2017-04-26 Thread Sven Van Caekenberghe
I am puzzled by how they actually encoded the PNG as a String, I tried a couple 
of alternatives but I could not get binary data out of it so that it parsed 
successfully as PNG.

If I would have to encode binary data in JSON I would use Base64 encoding (but 
alternatives exist).

> On 24 Apr 2017, at 20:36, Juraj Kubelka  wrote:
> 
> Hi,
> 
> I was playing with GitHub Gist API and I have queried the following Gist: 
> https://gist.github.com/mbostock/5503544
> I was interested how the PNG image is returned: 
> https://gist.github.com/mbostock/5503544#file-thumbnail-png 
> 
> I can obtain the whole Gist executing:
> 
> STONJSON fromString: 
>   (ZnClient new
>   url: 'https://api.github.com/gists/5503544';
>   accept: 'application/vnd.github.v3+json';
>   get).
> 
> I can get PNG contents executing:
> 
> pngData := (ZnEasy get:
>   STONJSON fromString: 
>   (ZnClient new
>   url: 'https://api.github.com/gists/5503544';
>   accept: 'application/vnd.github.v3+json';
>   get)) at: 'files') at: 'thumbnail.png') at: 'raw_url')) 
> contents.
> PNGReadWriter formFromStream: rawPng readStream.
> 
> But the PNG image is part of the Gist query and can be retrieved by:
> 
> pngContent := STONJSON fromString: 
>   (ZnClient new
>   url: 'https://api.github.com/gists/5503544';
>   accept: 'application/vnd.github.v3+json';
>   get)) at: 'files') at: 'thumbnail.png') at: 'content').
> 
> "As pngContent is a WideString, I cannot use:"
> PNGReadWriter formFromStream: pngContent readStream.
> 
> How can I read the PNG image from the pngContent? Any idea? 
> And the reverse question: How can I send the PNG bytes using JSON format? 
> 
> Thanks!
> Juraj
> 




Re: [Pharo-users] Hot to retrieve values from Nested Dictionaries

2017-04-26 Thread Sven Van Caekenberghe
> On 26 Apr 2017, at 01:01, PBKResearch  wrote:
> 
> Browsing in Pharo, I found that Dictionary has a subclass KeyedTree, which is 
> in effect a set of nested dictionaries. Retrieval is by quoting a path, which 
> is simply an array of keys. So in your case it would read:
> dict1 atPath: #(’key1’ ‘key2’ ‘key3’). 
> This might be more efficient than repeated use of the DNU mechanism. It is 
> not clear (to me, at least) how to construct the nested dictionaries as a 
> KeyedTree in the first place, but this might be an alternative approach.

I saw this too and I thought it was interesting, hence I added it to 
NeoJSONObject. 

Name: Neo-JSON-Core-SvenVanCaekenberghe.40
Author: SvenVanCaekenberghe
Time: 26 April 2017, 4:35:49.433269 pm
UUID: c336587e-740a-0d00-b51a-dacd0088e41c
Ancestors: Neo-JSON-Core-SvenVanCaekenberghe.39

Name: Neo-JSON-Tests-SvenVanCaekenberghe.38
Author: SvenVanCaekenberghe
Time: 26 April 2017, 4:36:04.583272 pm
UUID: 73623f7f-740a-0d00-b51b-f488e41c
Ancestors: Neo-JSON-Tests-SvenVanCaekenberghe.37

From the class comment:

Additionally, I support path access for nested instances of me, using #atPath: 
and #atPath:put:

The first is special because it returns nil as soon as a key is missing. The 
second is special because it creates extra levels (instances of me) as needed 
to follow the path of keys.

NeoJSONObject new atPath: #(one two three) put: 42; yourself.
NeoJSONObject new atPath: #(one two three) put: 42; atPath: #(one two 
three).

For the examples given above, the actual JSON looks like this:

{"one":{"two":{"three":42}}}

Sven

> Hope this helps
>  
> Peter Kenny
>  
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
> Markus Böhm
> Sent: 24 April 2017 18:42
> To: pharo-users@lists.pharo.org
> Subject: [Pharo-users] Hot to retrieve values from Nested Dictionaries
>  
> May I ask:
> What's the idiomatic way to retrieve values from nested dictionaries?
>  
> (((dict1 at: 'key1') at: 'key2') at: 'key3')
>  
> Are all the brackets really necessary?
>  
> BR Mike




Re: [Pharo-users] ss3 and gemsource planned downtime today at 1:30 pm PDT (-0700 UTC)

2017-04-26 Thread Stephane Ducasse
tx dale


On Wed, Apr 26, 2017 at 2:00 AM, Dale Henrichs <
dale.henri...@gemtalksystems.com> wrote:

> server is back online...
>
>
>
> On 04/25/2017 05:28 AM, Dale Henrichs wrote:
>
>> The server hosting http://ss3.gemtalksystems.com/ and
>> http://seaside.gemtalksystems.com/ss will be down for a couple of hours
>> today starting at 1:30 pm PDT for maintenance.
>>
>> Dale
>>
>>
>
>


Re: [Pharo-users] little "challenge"

2017-04-26 Thread Stephane Ducasse
splitEvery: n
^ (n
to: self size
by: n)
collect: [:index |
(self copyFrom: index - n + 1 to: index)]

is my solution

On Wed, Apr 26, 2017 at 11:34 AM, p...@highoctane.be 
wrote:

> So the last 20 is left out.
>
> Correct?
>
> Phil
>
> On Wed, Apr 26, 2017 at 11:20 AM, Stephane Ducasse <
> stepharo.s...@gmail.com> wrote:
>
>> Now I fully got the implementation
>>
>>
>> "
>> #(16 17 17 16 18 17 18   19 19 19 18 19 19 20   19 20 19 20 20 20 19
>> 20) groupsOf: 7 atATimeCollect: [ :x | x ]
>> >>> #(#(16 17 17 16 18 17 18) #(19 19 19 18 19 19 20) #(19 20 19 20 20 20
>> 19))
>> "
>> "
>> #(1 1 1 10 10 10 100  100 100)
>> groupsOf: 3 atATimeCollect: [ :x :y :z | x + y + z]
>> >>> #(3 30 300)
>> "
>>
>> "
>> #(1 1 1 10 10 10 100  100 100)
>> groupsOf: 3 atATimeCollect: [ :x | x ]
>> >>> #(#(1 1 1) #(10 10 10) #(100 100 100))
>> "
>>
>> On Wed, Apr 26, 2017 at 8:38 AM, Stephane Ducasse <
>> stepharo.s...@gmail.com> wrote:
>>
>>> we do not have nextOrLess: in Pharo.
>>>
>>> On Wed, Apr 26, 2017 at 6:19 AM, Richard Sargent 
>>> wrote:
>>>
 In 2003, I implemented the following method. It is something that comes
 up from time to time.

 !SequenceableCollection publicMethods !
 splitEvery: chunkSize
  "Answer a collection of sub-collections each of the specified chunk
 size.
   If the receiver size is not a multiple of chunkSize, the last
 sub-collection will be shorter."

  | chunks stream |
  chunkSize < 1 ifTrue: [ ^self splitEvery: 1 ].

  stream := ReadStream on: self.
  chunks := OrderedCollection new.
  [stream atEnd] whileFalse: [
   chunks add: (stream nextOrLess: chunkSize).
  ].

  ^chunks.
 ! !

 --
 *From:* Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] *On
 Behalf Of *Stephane Ducasse
 *Sent:* April 25, 2017 13:08
 *To:* Any question about pharo is welcome
 *Subject:* [Pharo-users] little "challenge"

 #(1617 17 16 18 17 18 1919 19 18 19 19 20 19   20 19 20 20 20
 19 20)

 ->

 { #(17 17 16 18 17 18 19) . #(19 19 18 19 19 20 19) . #(20 19 20 20 20
 19 20)}

 any code?

>>>
>>>
>>
>


[Pharo-users] Updated tech talk archive

2017-04-26 Thread marcus.den...@inrira.fr
http://pharo.org/TechTalk 

Now has a link to the recoding of yesterday

Marcus

Re: [Pharo-users] little "challenge"

2017-04-26 Thread p...@highoctane.be
So the last 20 is left out.

Correct?

Phil

On Wed, Apr 26, 2017 at 11:20 AM, Stephane Ducasse 
wrote:

> Now I fully got the implementation
>
>
> "
> #(16 17 17 16 18 17 18   19 19 19 18 19 19 20   19 20 19 20 20 20 19   20)
> groupsOf: 7 atATimeCollect: [ :x | x ]
> >>> #(#(16 17 17 16 18 17 18) #(19 19 19 18 19 19 20) #(19 20 19 20 20 20
> 19))
> "
> "
> #(1 1 1 10 10 10 100  100 100)
> groupsOf: 3 atATimeCollect: [ :x :y :z | x + y + z]
> >>> #(3 30 300)
> "
>
> "
> #(1 1 1 10 10 10 100  100 100)
> groupsOf: 3 atATimeCollect: [ :x | x ]
> >>> #(#(1 1 1) #(10 10 10) #(100 100 100))
> "
>
> On Wed, Apr 26, 2017 at 8:38 AM, Stephane Ducasse  > wrote:
>
>> we do not have nextOrLess: in Pharo.
>>
>> On Wed, Apr 26, 2017 at 6:19 AM, Richard Sargent 
>> wrote:
>>
>>> In 2003, I implemented the following method. It is something that comes
>>> up from time to time.
>>>
>>> !SequenceableCollection publicMethods !
>>> splitEvery: chunkSize
>>>  "Answer a collection of sub-collections each of the specified chunk
>>> size.
>>>   If the receiver size is not a multiple of chunkSize, the last
>>> sub-collection will be shorter."
>>>
>>>  | chunks stream |
>>>  chunkSize < 1 ifTrue: [ ^self splitEvery: 1 ].
>>>
>>>  stream := ReadStream on: self.
>>>  chunks := OrderedCollection new.
>>>  [stream atEnd] whileFalse: [
>>>   chunks add: (stream nextOrLess: chunkSize).
>>>  ].
>>>
>>>  ^chunks.
>>> ! !
>>>
>>> --
>>> *From:* Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] *On
>>> Behalf Of *Stephane Ducasse
>>> *Sent:* April 25, 2017 13:08
>>> *To:* Any question about pharo is welcome
>>> *Subject:* [Pharo-users] little "challenge"
>>>
>>> #(1617 17 16 18 17 18 1919 19 18 19 19 20 19   20 19 20 20 20 19
>>> 20)
>>>
>>> ->
>>>
>>> { #(17 17 16 18 17 18 19) . #(19 19 18 19 19 20 19) . #(20 19 20 20 20
>>> 19 20)}
>>>
>>> any code?
>>>
>>
>>
>


Re: [Pharo-users] little "challenge"

2017-04-26 Thread Stephane Ducasse
Now I fully got the implementation


"
#(16 17 17 16 18 17 18   19 19 19 18 19 19 20   19 20 19 20 20 20 19   20)
groupsOf: 7 atATimeCollect: [ :x | x ]
>>> #(#(16 17 17 16 18 17 18) #(19 19 19 18 19 19 20) #(19 20 19 20 20 20
19))
"
"
#(1 1 1 10 10 10 100  100 100)
groupsOf: 3 atATimeCollect: [ :x :y :z | x + y + z]
>>> #(3 30 300)
"

"
#(1 1 1 10 10 10 100  100 100)
groupsOf: 3 atATimeCollect: [ :x | x ]
>>> #(#(1 1 1) #(10 10 10) #(100 100 100))
"

On Wed, Apr 26, 2017 at 8:38 AM, Stephane Ducasse 
wrote:

> we do not have nextOrLess: in Pharo.
>
> On Wed, Apr 26, 2017 at 6:19 AM, Richard Sargent 
> wrote:
>
>> In 2003, I implemented the following method. It is something that comes
>> up from time to time.
>>
>> !SequenceableCollection publicMethods !
>> splitEvery: chunkSize
>>  "Answer a collection of sub-collections each of the specified chunk size.
>>   If the receiver size is not a multiple of chunkSize, the last
>> sub-collection will be shorter."
>>
>>  | chunks stream |
>>  chunkSize < 1 ifTrue: [ ^self splitEvery: 1 ].
>>
>>  stream := ReadStream on: self.
>>  chunks := OrderedCollection new.
>>  [stream atEnd] whileFalse: [
>>   chunks add: (stream nextOrLess: chunkSize).
>>  ].
>>
>>  ^chunks.
>> ! !
>>
>> --
>> *From:* Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] *On
>> Behalf Of *Stephane Ducasse
>> *Sent:* April 25, 2017 13:08
>> *To:* Any question about pharo is welcome
>> *Subject:* [Pharo-users] little "challenge"
>>
>> #(1617 17 16 18 17 18 1919 19 18 19 19 20 19   20 19 20 20 20 19
>> 20)
>>
>> ->
>>
>> { #(17 17 16 18 17 18 19) . #(19 19 18 19 19 20 19) . #(20 19 20 20 20 19
>> 20)}
>>
>> any code?
>>
>
>


[Pharo-users] Epicea vs RB refactorings

2017-04-26 Thread Peter Uhnak
Hi,

I'm under the impression that Epicea is supposed to replace RB refactorings at 
some point.

If that is true, is it currently possible to build refactorings by hand?

For example in RB I often do:

```
model := RBNamespace new.

model defineClass: ('<1s> subclass: #<2s>instanceVariableNames: 
<3p>classVariableNames: poolDictionaries: category: 
<4p>' expandMacrosWith: 'Object' with: 'MySomething' with: 'var1 var2' with: 
'MyPackage').
cls := model classNamed: #MySomething.
cls compile: 'var1
^ var1' classified: 'accessing'.

(ChangesBrowser changes: model changes changes) open
```

or

(removing a method from a class)
```
model := RBNamespace new.
model removeMethod: #testTrimRight from: StringTest.
(ChangesBrowser changes: model changes changes) open
```

Thanks,
Peter



Re: [Pharo-users] little "challenge"

2017-04-26 Thread p...@highoctane.be
I implemented it for fun and noticed that in your test data, the first 16
is gone. So, groupings are wrong with all methods proposed in a sense.

With Richard's version, we get this in Pharo

#(16 17 17 16 18 17 18 19 19 19 18 19 19 20 19 20 19 20 20 20 19 20)
 splitEvery: 7

"an OrderedCollection(#(16 17 17 16 18 17 18) #(19 19 19 18 19 19 20) #(19
20 19 20 20 20 19) #(20))"

splitEvery: chunkSize
 "Answer a collection of sub-collections each of the specified chunk size.
  If the receiver size is not a multiple of chunkSize, the last
sub-collection will be shorter."


 | chunks stream |
 chunkSize < 1 ifTrue: [ ^self splitEvery: 1 ].

 stream := ReadStream on: self.
 chunks := OrderedCollection new.
 [stream atEnd] whileFalse: [
  chunks add: (stream next: chunkSize).
 ].

 ^chunks.

Phil


On Wed, Apr 26, 2017 at 8:38 AM, Stephane Ducasse 
wrote:

> we do not have nextOrLess: in Pharo.
>
> On Wed, Apr 26, 2017 at 6:19 AM, Richard Sargent 
> wrote:
>
>> In 2003, I implemented the following method. It is something that comes
>> up from time to time.
>>
>> !SequenceableCollection publicMethods !
>> splitEvery: chunkSize
>>  "Answer a collection of sub-collections each of the specified chunk size.
>>   If the receiver size is not a multiple of chunkSize, the last
>> sub-collection will be shorter."
>>
>>  | chunks stream |
>>  chunkSize < 1 ifTrue: [ ^self splitEvery: 1 ].
>>
>>  stream := ReadStream on: self.
>>  chunks := OrderedCollection new.
>>  [stream atEnd] whileFalse: [
>>   chunks add: (stream nextOrLess: chunkSize).
>>  ].
>>
>>  ^chunks.
>> ! !
>>
>> --
>> *From:* Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] *On
>> Behalf Of *Stephane Ducasse
>> *Sent:* April 25, 2017 13:08
>> *To:* Any question about pharo is welcome
>> *Subject:* [Pharo-users] little "challenge"
>>
>> #(1617 17 16 18 17 18 1919 19 18 19 19 20 19   20 19 20 20 20 19
>> 20)
>>
>> ->
>>
>> { #(17 17 16 18 17 18 19) . #(19 19 18 19 19 20 19) . #(20 19 20 20 20 19
>> 20)}
>>
>> any code?
>>
>
>


Re: [Pharo-users] little "challenge"

2017-04-26 Thread p...@highoctane.be
Doesn't matter as next returns if there is less than required.

groups := OrderedCollection new.
input := (String loremIpsum: 20).
input readStream in: [ :s | [s atEnd] whileFalse: [ groups add: (s next: 7)
]].
groups.

Interestingly loremIpsum: adds Character cr to from paragraphs (output
looked strange at first glance).

Phil

On Wed, Apr 26, 2017 at 8:38 AM, Stephane Ducasse 
wrote:

> we do not have nextOrLess: in Pharo.
>
> On Wed, Apr 26, 2017 at 6:19 AM, Richard Sargent 
> wrote:
>
>> In 2003, I implemented the following method. It is something that comes
>> up from time to time.
>>
>> !SequenceableCollection publicMethods !
>> splitEvery: chunkSize
>>  "Answer a collection of sub-collections each of the specified chunk size.
>>   If the receiver size is not a multiple of chunkSize, the last
>> sub-collection will be shorter."
>>
>>  | chunks stream |
>>  chunkSize < 1 ifTrue: [ ^self splitEvery: 1 ].
>>
>>  stream := ReadStream on: self.
>>  chunks := OrderedCollection new.
>>  [stream atEnd] whileFalse: [
>>   chunks add: (stream nextOrLess: chunkSize).
>>  ].
>>
>>  ^chunks.
>> ! !
>>
>> --
>> *From:* Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] *On
>> Behalf Of *Stephane Ducasse
>> *Sent:* April 25, 2017 13:08
>> *To:* Any question about pharo is welcome
>> *Subject:* [Pharo-users] little "challenge"
>>
>> #(1617 17 16 18 17 18 1919 19 18 19 19 20 19   20 19 20 20 20 19
>> 20)
>>
>> ->
>>
>> { #(17 17 16 18 17 18 19) . #(19 19 18 19 19 20 19) . #(20 19 20 20 20 19
>> 20)}
>>
>> any code?
>>
>
>


Re: [Pharo-users] little "challenge"

2017-04-26 Thread Richard Sargent
Sorry, Stephane. Feel free to implement missing methods (or their equivalent).

:-)


On Apr 25, 2017, 23:39, at 23:39, Stephane Ducasse  
wrote:
>we do not have nextOrLess: in Pharo.
>
>On Wed, Apr 26, 2017 at 6:19 AM, Richard Sargent 
>wrote:
>
>> In 2003, I implemented the following method. It is something that
>comes up
>> from time to time.
>>
>> !SequenceableCollection publicMethods !
>> splitEvery: chunkSize
>>  "Answer a collection of sub-collections each of the specified chunk
>size.
>>   If the receiver size is not a multiple of chunkSize, the last
>> sub-collection will be shorter."
>>
>>  | chunks stream |
>>  chunkSize < 1 ifTrue: [ ^self splitEvery: 1 ].
>>
>>  stream := ReadStream on: self.
>>  chunks := OrderedCollection new.
>>  [stream atEnd] whileFalse: [
>>   chunks add: (stream nextOrLess: chunkSize).
>>  ].
>>
>>  ^chunks.
>> ! !
>>
>> --
>> *From:* Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] *On
>> Behalf Of *Stephane Ducasse
>> *Sent:* April 25, 2017 13:08
>> *To:* Any question about pharo is welcome
>> *Subject:* [Pharo-users] little "challenge"
>>
>> #(1617 17 16 18 17 18 1919 19 18 19 19 20 19   20 19 20 20 20
>19
>> 20)
>>
>> ->
>>
>> { #(17 17 16 18 17 18 19) . #(19 19 18 19 19 20 19) . #(20 19 20 20
>20 19
>> 20)}
>>
>> any code?
>>