<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Francisco,</p>
<p>I just pushed to GitHub a slight variation of your Sliding Window
iteration (keeping your author initials).</p>
<p>I didn't include the change to existing behavior, as it changes
semantics and would require further discussion.</p>
<p>I also did not include the changes to FloatArray. I also believe
they would require further discussion, and in any case, it would
delay them until an actual use case shows the preferred behavior.</p>
<p>I also added you as a known code author.</p>
<p>WRT how to submit contributions to the base image, email to the
list (as you did) is the preferred way.</p>
<p>Thanks!</p>
<div class="moz-cite-prefix">On 2026-05-13 7:28 PM, Francisco Garau
via Cuis-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKAN0Gc+YmVqPfVG-7CERXMEJp0e21z3g64bct1jE81McNiSHw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">I've
specialized the implementation of the #collectSlidingWindow:
so that it uses the bulk primitives. As with the previous
version there is a slight difference in behaviour as the
resulting array is shorter than the original one.
Performance wise, it should be the same as the current
implementation. I've created a changeset but couldn't find
how to make a PR out of it. <br>
<br>
This change makes it easier to add new sliding window
operations of any size ... (all current examples are pairs
but it could be triples or n-tuples). <br>
<br>
<b>SequenceableCollection >> collectSlidingWindow:
aBlock</b></div>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace"> |
numArgs newSize result slidingWindow |</div>
<div class="gmail_default" style="font-family:monospace">
numArgs := aBlock numArgs. </div>
<div class="gmail_default" style="font-family:monospace">
self size < numArgs ifTrue: [self
errorCollectionTooSmall]. </div>
<div class="gmail_default" style="font-family:monospace">
newSize := self size - numArgs + 1. </div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">
slidingWindow := Array new: numArgs.</div>
<div class="gmail_default" style="font-family:monospace">
result := self species new: newSize.</div>
<div class="gmail_default" style="font-family:monospace"> 1
to: newSize do: [ :index |</div>
</blockquote>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace">
1 to: numArgs do: [:nArg | slidingWindow at: nArg put:
(self at: index - 1 + nArg)]. </div>
</blockquote>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace">
result at: index put: (aBlock valueWithArguments:
slidingWindow).].</div>
</blockquote>
</blockquote>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace">
^result</div>
</blockquote>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace"><b>FloatArray>>collectSlidingWindow:
aBlock</b><br>
</div>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace">|
numArgs newSize slidedArrays |</div>
<div class="gmail_default" style="font-family:monospace">
numArgs := aBlock numArgs. </div>
<div class="gmail_default" style="font-family:monospace">
self size < numArgs ifTrue: [self
errorCollectionTooSmall]. </div>
<div class="gmail_default" style="font-family:monospace">
newSize := self size - numArgs + 1. </div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">
slidedArrays := (1 to: numArgs) collect: [:index | |
slided | </div>
</blockquote>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace">
slided := self species new: newSize.</div>
</blockquote>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace">
slided replaceFrom: 1 to: newSize with: self startingAt:
index].</div>
</blockquote>
</blockquote>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">
^aBlock valueWithArguments: slidedArrays</div>
</blockquote>
<div class="gmail_default" style="font-family:monospace"><br>
<b>FloatArray >> slidingAdditions</b><br>
</div>
<blockquote
style="margin:0px 0px 0px 40px;border-width:medium;border-style:none;border-color:currentcolor;padding:0px">
<div class="gmail_default" style="font-family:monospace"> "</div>
<div class="gmail_default" style="font-family:monospace">
#(1 3 8 13) asFloat32Array slidingAdditions printString =
'a Float32Array:3(4.0 11.0 21.0)'.</div>
<div class="gmail_default" style="font-family:monospace"> "</div>
<div class="gmail_default" style="font-family:monospace">
^self collectSlidingWindow: [:a :b | a += b ]</div>
</blockquote>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
</div>
</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">On Wed, 13 May 2026 at 14:31,
Luciano Notarfrancesco via Cuis-dev <<a
href="mailto:cuis-dev@lists.cuis.st" moz-do-not-send="true"
class="moz-txt-link-freetext">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="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">
<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" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">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-width:medium;border-style:none;border-color:currentcolor;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-width:medium;border-style:none;border-color:currentcolor;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" moz-do-not-send="true"
class="moz-txt-link-freetext">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>
<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"
moz-do-not-send="true"
class="moz-txt-link-freetext">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" style="font-family:monospace"
target="_blank" moz-do-not-send="true">www.cuis.st</a>
<a href="http://github.com/jvuletich" style="font-family:monospace"
target="_blank" moz-do-not-send="true">github.com/jvuletich</a>
<a href="http://researchgate.net/profile/Juan-Vuletich"
style="font-family:monospace" target="_blank"
moz-do-not-send="true">researchgate.net/profile/Juan-Vuletich</a>
<a href="http://independent.academia.edu/JuanVuletich"
style="font-family:monospace" target="_blank"
moz-do-not-send="true">independent.academia.edu/JuanVuletich</a>
<a href="http://patents.justia.com/inventor/juan-manuel-vuletich"
style="font-family:monospace" target="_blank"
moz-do-not-send="true">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" moz-do-not-send="true"
class="moz-txt-link-freetext">Cuis-dev@lists.cuis.st</a><br>
<a
href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">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"
moz-do-not-send="true" class="moz-txt-link-freetext">Cuis-dev@lists.cuis.st</a><br>
<a
href="https://lists.cuis.st/mailman/listinfo/cuis-dev"
rel="noreferrer" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote>
</div>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis.st">www.cuis.st</a>
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich</pre>
</body>
</html>