<div dir="auto">Hi Pancho,</div><div dir="auto">Is it really more efficient? I think the idea of the original is to take advantage of the bulk primitives in Float32Array and Float64Array, it should be much faster (Although it contains a superfluous copy, it could be improved a bit).</div><div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, May 13, 2026 at 19:31 Francisco Garau via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default"><font face="arial, sans-serif" style="font-family:arial,sans-serif;color:rgb(0,0,0)">I've prepared a more generic and efficient implementation of these methods (with a small difference in behavior) -- I would prefer to submit this changes with a couple of PRs (one for the base image and one for the numerical package). Appreciate if there is any documentation for new contributions. </font></div><div class="gmail_default"><font face="arial, sans-serif" style="font-family:arial,sans-serif;color:rgb(0,0,0)"><br></font>#( 3 5 8 ) successiveRatios = { 1. 5/3 . 8/5} ." -- currently the first element is always 1 -- " <font face="arial, sans-serif" style="font-family:arial,sans-serif;color:rgb(0,0,0)"><br></font>#( 3 5 8 ) successiveRatios = { 5/3 . 8/5} . " -- the ratios will be calculated in between pairs --" </div><div class="gmail_default"><br></div><div class="gmail_default"><b>ArrayedCollection >> successiveRatios</b><br></div><blockquote style="margin:0px 0px 0px 40px;border:medium;padding:0px"><div class="gmail_default"> "</div><div class="gmail_default"> #( 3 5 8 ) successiveRatios = {5/3 . 8/5}.</div><div class="gmail_default"> ([#(3) successiveRatios] on: Error do: [:ex | ex description ] ) = 'Error: this collection is too small'.</div><div class="gmail_default"> " </div><div class="gmail_default"> ^self collectSlidingWindow: [:a :b | b / a ]</div></blockquote><div class="gmail_default"><br><br><b>SequenceableCollection >> collectSlidingWindow: aBlock</b><br></div><blockquote style="margin:0px 0px 0px 40px;border:medium;padding:0px"><div class="gmail_default"> "</div><div class="gmail_default"> (#( 3 5 8 13 ) collectSlidingWindow: [:a :b | a@b]) = {3@5 . 5@8 . 8@13}.</div><div class="gmail_default"> (#( 3 5 8 13 ) collectSlidingWindow: [:a :b :c | {a. b. c}]) = {{3. 5. 8}. {5. 8. 13.}}.</div><div class="gmail_default"> ('hello_word' collectSlidingWindow: [:a | Character codePoint: a codePoint - 32]) = 'HELLO?WORD'.</div><div class="gmail_default"><br></div><div class="gmail_default"> ([#(3) collectWithSlidingWindow: [:a :b | a + b]] on: Error do: [:ex | ex description]) = 'Error: this collection is too small'.</div><div class="gmail_default"> "</div><div class="gmail_default"> | tupleSize newSize answer blockArgs |</div><div class="gmail_default"> tupleSize := aBlock numArgs. </div><div class="gmail_default"> self size < tupleSize ifTrue: [self errorCollectionTooSmall]. </div><div class="gmail_default"> newSize := self size - tupleSize + 1. </div><div class="gmail_default"> answer := self species new: newSize.</div><div class="gmail_default"> blockArgs := Array new: tupleSize.</div><div class="gmail_default"> 1 to: newSize do: [ :i |</div><div class="gmail_default"> 1 to: tupleSize do: [:m | blockArgs at: m put: (self at: i + m -1 )]. </div><div class="gmail_default"> answer at: i put: (aBlock valueWithArguments: blockArgs).].</div><div class="gmail_default"> ^ answer</div><div class="gmail_default"><br></div><div class="gmail_default"><br></div></blockquote></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 11 May 2026 at 20:12, Juan Vuletich via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<p>Hi Ezequiel,</p>
<p>(inline)</p>
<div>On 2026-05-03 1:48 AM, Ezequiel Birman
via Cuis-dev wrote:<br>
</div>
<blockquote type="cite">Hi!,<br>
<br>
I want to collect the successive ratios in a collection of numbers
in order to appreciate how “fast” they grow. I noticed that the
image already implements ArrayedCollection >>
incrementFraction, which is almost equal to ArrayedCollection
>> derivative:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">incrementFraction<br>
"<br>
#(10 12.5 15 20) incrementFraction<br>
"<br>
| displaced answer |<br>
displaced := self class new: self size.<br>
displaced replaceFrom: 2 to: self size with: self startingAt: 1.<br>
displaced at: 1 put: self first.<br>
answer := self copy.<br>
answer -= displaced. </blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">^answer
/ displaced</blockquote>
<div><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">derivative<br>
| displaced answer |<br>
displaced := self class new: self size.<br>
displaced replaceFrom: 2 to: self size with: self startingAt:
1.<br>
displaced at: 1 put: self first - self first. "Some reasonable
zero"<br>
answer := self copy.<br>
answer -= displaced.<br>
^answer </blockquote>
</div>
<div><br>
</div>
<div>I think I want something similar, except for the
subtraction: </div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">myThing<br>
<br>
| displaced answer |<br>
displaced := self class new: self size.<br>
displaced replaceFrom: 2 to: self size with: self startingAt:
1.<br>
displaced at: 1 put: self first.<br>
answer := self copy. </blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">^answer
/ displaced</blockquote>
<div><br>
I'll probably need both, since I'm doing exploratory analysis.
And while `myThing`, (which could be named `successiveRatios`
or something along those lines) can answer if there is a
constant or varying growth, `incrementFraction` measures the
rate at which the growth itself is scaling.<br>
</div>
</div>
</blockquote>
<p>This makes a lot of sense. I've just added your method with
selector #successiveRatios and your author initials. Thanks!</p>
<blockquote type="cite">
<div>
<div><br>
Neither `derivative` nor `incrementFraction` nor `Integral`
have senders. Juan, maybe you remember why or under which
circumstances you added them in 2024?</div>
</div>
</blockquote>
<p>I'd guess they are older than that. They are there because they
are ilustrative and could be of use. It is nice to have this kind
of stuff in the image. I believe it shows general Smalltalk-fu.</p>
<blockquote type="cite">
<div>
<div> Are there any efforts / packages for numeric or data
analysis?<br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>Not specifically for that, but a good place for it would be
<a href="https://github.com/Cuis-Smalltalk/Numerics" target="_blank">https://github.com/Cuis-Smalltalk/Numerics</a></p>
<p>Cheers,</p>
<blockquote type="cite">
<div>
<div><br>
-- <br>
Eze</div>
</div>
</blockquote>
<pre cols="72" style="font-family:monospace">--
Juan Vuletich
<a href="http://www.cuis.st" target="_blank" style="font-family:monospace">www.cuis.st</a>
<a href="http://github.com/jvuletich" target="_blank" style="font-family:monospace">github.com/jvuletich</a>
<a href="http://researchgate.net/profile/Juan-Vuletich" target="_blank" style="font-family:monospace">researchgate.net/profile/Juan-Vuletich</a>
<a href="http://independent.academia.edu/JuanVuletich" target="_blank" style="font-family:monospace">independent.academia.edu/JuanVuletich</a>
<a href="http://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank" style="font-family:monospace">patents.justia.com/inventor/juan-manuel-vuletich</a></pre>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div></div>