(newbie) String / Array / ArrayedCollection

David T. Lewis lewis at mail.msen.com
Sun Feb 5 13:55:57 UTC 2006


On Sun, Feb 05, 2006 at 04:57:04AM +0100, nicolas cellier wrote:
> 
> If and only if you have optimized primitives, you'd better operate on 
> collections and have no loop at all in Smallatlk (at the expense of a memory 
> allocation and two loops in C code however), this is exactly how matlab 
> works:
> 
>  (aCollection*aCollection) sum
> 
> In my opinion, messages without a block argument are necessary for 
> optimization purposes in a matlab like environment.
> Messages with block arguments, though not strictly necessary knowing fold: and 
> inject:into:, would ease implementation and code understanding of matrices 
> and polynomials for example. To me they seem obvious extensions.
> 
> I already proposed all that to VisualWorks NumericalCollections package.
> (Cincom Public Store).
> 
> I also proposed the #count: extension.
>  aCollection count: [:each | each > 1]
> does answer the number of elements satisfying a condition (I feel 
> countSatisfy: is a little heavy). That is usefull more than rarely i think.
> 
> What is your opinion ?

It goes without saying that you should measure before you go too
far with this. In Squeak, you can use:
  "TimeProfileBrowser onBlock: [somethingToProfile]"

If you decide that primitives would help, you can implement them
as pluggable primitives in Squeak. Load VMMaker from SqueakMap to
get started.

Give it a try. If your primitives turn out to be useful, you can
post your plugin on SqueakMap so others can make use of them. If
they are useful to lots of folks, the various VM builders may
want to start distributing them.

If you do write primitives for numerical methods, you need to give
some thought to making them work on both 64 bit and 32 bit Squeak
platforms.  Almost all Squeakers are using 32 bit Squeak right
now, but a numerical plugin that did not handle 64 bits gracefully
would not be appreciated by the VM builders. The page is a bit
out of date, but you can see what's involved by reading this:
 <http://squeakvm.org/squeak64/>

Dave
 



More information about the Squeak-dev mailing list