<div dir="ltr"><div class="gmail_default" style=""><font face="arial, sans-serif">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" style=""><font face="arial, sans-serif"><br></font>#( 3 5 8 ) successiveRatios = { 1. 5/3 . 8/5} ." -- currently the first element is always 1 -- " <font face="arial, sans-serif"><br></font>#( 3 5 8 ) successiveRatios = { 5/3 . 8/5} . " -- the ratios will be calculated in between pairs --" </div><div class="gmail_default" style=""><br></div><div class="gmail_default" style=""><b>ArrayedCollection >> successiveRatios</b><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style=""> "</div><div class="gmail_default" style=""> #( 3 5 8 ) successiveRatios = {5/3 . 8/5}.</div><div class="gmail_default" style=""> ([#(3) successiveRatios] on: Error do: [:ex | ex description ] ) = 'Error: this collection is too small'.</div><div class="gmail_default" style=""> " </div><div class="gmail_default" style=""> ^self collectSlidingWindow: [:a :b | b / a ]</div></blockquote><div class="gmail_default" style=""><br><br><b>SequenceableCollection >> collectSlidingWindow: aBlock</b><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style=""> "</div><div class="gmail_default" style=""> (#( 3 5 8 13 ) collectSlidingWindow: [:a :b | a@b]) = {3@5 . 5@8 . 8@13}.</div><div class="gmail_default" style=""> (#( 3 5 8 13 ) collectSlidingWindow: [:a :b :c | {a. b. c}]) = {{3. 5. 8}. {5. 8. 13.}}.</div><div class="gmail_default" style=""> ('hello_word' collectSlidingWindow: [:a | Character codePoint: a codePoint - 32]) = 'HELLO?WORD'.</div><div class="gmail_default" style=""><br></div><div class="gmail_default" style=""> ([#(3) collectWithSlidingWindow: [:a :b | a + b]] on: Error do: [:ex | ex description]) = 'Error: this collection is too small'.</div><div class="gmail_default" style=""> "</div><div class="gmail_default" style=""> | tupleSize newSize answer blockArgs |</div><div class="gmail_default" style=""> tupleSize := aBlock numArgs. </div><div class="gmail_default" style=""> self size < tupleSize ifTrue: [self errorCollectionTooSmall]. </div><div class="gmail_default" style=""> newSize := self size - tupleSize + 1. </div><div class="gmail_default" style=""> answer := self species new: newSize.</div><div class="gmail_default" style=""> blockArgs := Array new: tupleSize.</div><div class="gmail_default" style=""> 1 to: newSize do: [ :i |</div><div class="gmail_default" style=""> 1 to: tupleSize do: [:m | blockArgs at: m put: (self at: i + m -1 )]. </div><div class="gmail_default" style=""> answer at: i put: (aBlock valueWithArguments: blockArgs).].</div><div class="gmail_default" style=""> ^ answer</div><div class="gmail_default" style=""><br></div><div class="gmail_default" style=""><br></div></blockquote></div><br><div class="gmail_quote gmail_quote_container"><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">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">--
Juan Vuletich
<a href="http://www.cuis.st" target="_blank">www.cuis.st</a>
<a href="http://github.com/jvuletich" target="_blank">github.com/jvuletich</a>
<a href="http://researchgate.net/profile/Juan-Vuletich" target="_blank">researchgate.net/profile/Juan-Vuletich</a>
<a href="http://independent.academia.edu/JuanVuletich" target="_blank">independent.academia.edu/JuanVuletich</a>
<a href="http://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">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>