He, press ALT-v to get versions of #combinations:atATimeDo: and thanks tk!
:)
I like bit sift solution too for it's simplicity.
me too even if we could argue this is not self explaining...
That's what Andres Valoud said here (thanks Marcin):
really interesting.
but it reveals slower but it was because of Set operations. To be consistent
with other method, I used an array.
subsets6
| subsetsSize subsets workArray |
workArray := self asArray.
subsetsSize := 2 raisedTo: self size.
subsets := Array new: subsetsSize.
1 to:
or withNicolas suggestion:
SetasPowerset
| subset |
subset := (OrderedCollection new: (2 raisedTo: self size))
add: Set new;
yourself.
1 to: self size do: [:subSize | don't copy anymore as there is the
Set conversion
self asArray
Didn't check #combinations:* implementation, does it avoid #includes: ?
I think so. It calls #combinationsAt:in: after: do: wich is recursive.
I'd still prefer #combinationsSize:do: instead of
#combinations:atATimeDo:
+1 but it looks alt-w friendly already (like #detectSum: looks ;)
I couldn't find such a function. I tryed in the method finder but find
nothing: MethodFinder methodFor: #(#(1.2288 3) 1.228).
Do somebody know if such a method exist ?
Meanwhile I did that:
FloattrimAfter: aNumberOfDecimal roundAfter:
| number |
number := 10 raisedTo: aNumberOfDecimal.
afaik method finder doesn't find *every* method but tries a a fixed
set of messages. Methods that would do the job but are not in the list
will not be found.
MethodFinderinitialize and friends suggest this.
stupid me :)
but.. I think I'll read these methods another day...
Thanks Herbert
Float has a truncate and round off protocal with metods that truncate
and round to integer.
So it looks you have to do something like
(aFloat * (10^desiredDecimals) + 0.5) truncated / (10^desiredDecimals)
or without the + 0.5 for truncation.
close to what I proposed earlier ;-) Just
Why is it important to you to have a float? Once you've truncated it, you
have a rational number, by definition.
Are you sure you want to truncate the number, rather than performing the
truncation in the presentation layer?
In my case, this is only for presentation. The real float doesn't
ar thanks all ;)
1.23456 printShowingDecimalPlaces: 3
I knew that had to exist...Since I know the method finder I became
lazy to search far ;)
See you
Cédrick
2008/7/23 Herbert König [EMAIL PROTECTED]:
Hello Cédrick,
search the truncating and rounding and printing protocols of Number
1.2288 roundTo: 1 1
1.2288 roundTo: 0.1 1.2
1.2288 roundTo: 0.01 1.23
1.2288 roundTo: 0.001 1.229
1.2288 roundTo: 0.0001 1.2288
1.2288 roundTo: 0.05 1.25
1.2288 roundTo: 0.002 1.228
Stupid me again ;)
I only tried #roundTo: with Integer.
But #printShowingDecimalPlaces: is alright
When we don't find method, we reinvent the wheel. Ok, so this is what
happened with my quest on rounding float. So here is another example.
I needed a method subsets ... to have all subsets of a Set...
#(1 2 ) asSet subsets - a Set(a Set(1 2) a Set(1) a Set(2) a Set())
Is there already
Googling smalltalk powerset turns this up:
http://www.foldr.org/~michaelw/log/2005/09/
Thanks Marcin, interesting read :) This time, I had the wrong keyword :(
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
Zulq Alam-2 wrote:
Using #inject:into and Point objects to store the totals:
testMaleMeiosis4
| totals |
totals := Forecaster testMale meiose inject: [EMAIL PROTECTED] into:
[:subtotals :strand |
subtotals + (strand maternalCount @ strand maternalCount)].
self should:
Hi Stan,
2008/7/21 stan shepherd [EMAIL PROTECTED]:
Hi, I have the following method, that code critics flags as long:
testMaleMeiosis2
| testSet mCount pCount mTotal pTotal |
pTotal := 0.
mTotal := 0.
Forecaster testMale meiose
do: [:strand |
here its just a list of
filenames).
filenames ?
Hehe, Strings I should say...
Can you give one or two examples. Strings are not usual. I mean, it's
better not to store objects as string ;) Unless you need to read your
persistence backups, it's better to store with stuff like
An idea: learning from source code could be documented too by small how-to.
For instance to understand how sandstonedb works (which is already
well documented thanks to Ramon) we could imagine that:
HOW-TO-LEARNING SDActiveRecord file oodb persistency inspired by
ruby activerecord framework
otherwise, more UI oriented... there's a choose default browser in the
menu of the browser...
see here: http://www.squeakside.com/seaside/pier/OB/
Cédrick
2008/6/17 Milan Zimmermann [EMAIL PROTECTED]:
On 2008 June 16, Dave Raymer wrote:
Another alternative is to keep a workspace with some
Hi,
What is the best way to use Prolog in squeak today ?
- Prolog in squeak map seems broken in since 3.7. I tried loading, but
I could solve the different problems (seems related to the parser used
that is not based on SmallCC)
- SOUL is said to be based on Prolog for squeak. So I loaded the
oups,
- Prolog in squeak map seems broken in since 3.7. I tried loading, but
I could solve the different problems (seems related to the parser used
that is not based on SmallCC)
of course, one should read I *couldn't* solve...
___
Beginners mailing
2008/6/4 Rob Rothwell [EMAIL PROTECTED]:
On Wed, Jun 4, 2008 at 3:55 AM, Norbert Hartl [EMAIL PROTECTED] wrote:
Hi
The objects are still referenced in the collection you get
from self selected. The line with each := nil is useless
as each is only a temporary variable. I assume that you
Hi ---,
For such problems there is another nice tool called Method Finder. There
you can insert all your objects, parameters and the result and Smalltalk try
to find a proper method for your needs.
I have found the swap method with the following message: #(a b). 1. 2. #(b
a).
From my
Hi Rob
There is one method in SequenceableCollection (and in Set) that does
what you want (same implementation as yours)...
SequenceableCollection swap: oneIndex with: anotherIndex
I found it by using ctrl+alt+w when swap selected (one of my favorite
shortcut - for selectors containing it)
I can't seem to make your ctrl+alt+w trick
work, though! Maybe I don't have something installed?
oups sorry this is alt + shift + wor alt + W
go in the world menu help command-key help to see the plethora
of available shortcuts
hth
Cédrick
2008/5/21 Herbert König [EMAIL PROTECTED]:
Hello Bert,
BF Keep in mind we are on the beginners list. I do know where this is
BF used, and why. But if someone asks this on the beginners list it is
BF bad advice to give.
thanks for your clear words. I'll refrain from further giving that
So my question is: what is the best way to follow and reference multiple
classes in multiple packages? I know I could open more than one class
browsers but that seems cumbersome.
The best way to me right now is to use OB-Enhancement and the work David did...
It should be in any dev image.
Hi Peter
Hi. I'm new to smalltalk and squeak. I'd like to know how experienced users
manage the windows when programming with squeak. I often have a lot of
windows open and struggle to find the right one. Are there keyboard
shortcuts for switching between windows?
There are some if you load
Hi,
2008/4/14, David H. Shanabrook [EMAIL PROTECTED]:
I am using squeak in a school on Windows XP systems. One week all the
students squeak screens showed up with a separate window beneath the squeak
window. I can't figure out how to remove it, full screen does nothing to
help. I think
Hi
For those interested, while looking for the blue book (out of print),
I found that there is an online copy on ACM (of course, you need an
account). I didn't know before, so here is the link for people like
me:
P.S. Any Squeakers in Australia?
Where about are you ?
I'm french but I spent one year in SA in 2000 :)
Really nice country ...
See you
Cédrick
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
uhmm I wonder why Ramon hasn't mentionned his work on MagritteGlorp...
it looks like what you're looking for. There are other posts on Glorp
in his Blog.
http://onsmalltalk.com/programming/smalltalk/a-smalltalk-activerecord-using-magritte-seaside-and-glorp/
Personnaly, for simple data, I prefer
Welcome Nathan,
What you experienced is (very) common...
To program in smalltalk (except gnu smalltalk maybe) you need:
- to learn the syntax (this is quick)
- then learn to navigate in the code (this was long for me)
---use browser(s)
---find code examples (sender, implementors), find some
As far as dynamically typed languages, probably JavaScript and VisualBasic
Script are the two most dynamic I can think of, and I am well versed in
JavaScript, and fairly well versed in VisualBasic script.
I think this is not really comparable.
from reading about SmallTalk previous to
2008/3/30, Rob Rothwell [EMAIL PROTECTED]:
On Sat, Mar 29, 2008 at 8:02 PM, cdrick [EMAIL PROTECTED] wrote:
Zen is a good word :) always have to think...before thinking object ;)
Very nice. I have always imagined Smalltalk to be like the place before
thought...just another path
depends, where exactly ?
I'm sure this is something that should be added somewhere.
What others think ?
One more thing...
What I do for such information (as lots of people out there I guess)
is having a Personnal Utility class where I put such methods ( often
class side like for instance
MCWorkingCopy allManagers collect: [:each | each ancestry
ancestorString]
Thank you. I wish I could follow the thought process you used to figure
that out! It would have taken me a long time to get to MCWorkingCopy
allManagers.
That seems to have NOTHING to do with List the current
Hi
I was wondering if there is any squeak project/tool targeted at AI
students, anything that could help illustrate/express basic concepts
on knowledge representation, expert systems, etc.
Not really at the moment as far as I know...
They were an expert system callad Neopus but it was on
I just found that, though don't know if cat's name is Tom ;-) ...
funny but gore...
http://www.amazon.fr/exec/obidos/ASIN/2226059237/bdgest-21
http://www.bedetheque.com/serie-1485-BD-Squeak-The-Mouse.html
Cédrick
___
Beginners mailing list
Hi
In a recent post, Matthew Fulmer explained how categories work... and
I don't really see why they exist this way... Can someone explain me
(historical reason, etc...)?
In Squeak, Classes are objects, methods are objects, but
categories are not. Categories are implemented interestingly.
See
Huh? when you say New Category..., you get a list with several
categories you might logically want:
- The most popular categories globally
- The most popular categories in the superclass
- Your most common category creation requests
Actually I don't except for the class category...
2008/2/25, Michael van der Gulik [EMAIL PROTECTED]:
On 2/26/08, cdrick [EMAIL PROTECTED] wrote:
Hi
In a recent post, Matthew Fulmer explained how categories work... and
I don't really see why they exist this way... Can someone explain me
(historical reason, etc...)?
The only reason
Hi
I often find the need to display packages versions that are loaded ...
I decided to try but it's late and all I have is package names... I
just do that:
packInf:=(PackageInfo allPackages
select: [:aPackInfo | (aPackInfo packageName startsWith: 'OB')
or: [
Computers generally do what you tell them, not what you mean. 0.1
does have a different meaning than 1/10 in computing land. If you
mean a fraction, write a fraction. If you mean a float, write a
dotted decimal. Smalltalk even has means to write fractions as
decimals (0.1s1). So simply
To achieve that,
... write it as 0.1s1
ok, so 0.1 asFraction (3602879701896397/36028797018963968) is no problem ;-)
The problem I have is the intention... I think everybody who
writes/enters 0.1 means 1/10... and not a flotting point value...
Float to me is more a computer number more than
Hi I'm looking to hook up my own dlls (and some of the standard windows
ones too in due course) to Squeak. I've been through the named-primitive
tutorial and it appears that it is for earlier versions of Squeak than
the present version. Can anyone point me in the right direction to
calling a
depends on your image... Maybe it's not loaded as in 3.9 and later...
Go and see in Universe Browser (open menu) under the category system
then select the different FFI-categories and install them. Maybe
you'll have to make an update list from network in the Universe
Browser first.
HTH
Cédrick
What you desire is admirable but no longer practical as it would break a great
many existing programs.
Yep, that's a BIG problem :-)
[snip]
between different manufactures computers. After a while, computers supported
integers, floating point numbers and IBM mainframes had packed decimal
I don't know what you are working on but if you use fractions for what you are
doing it would be interesting to hear about how you use them and your results.
Because fractions are kept as an integer numerator and an integer denominator,
they probably take up more memory than floats but less
Waaah, belief and plausibility as sum over numbers; shudder;
political-systems-failure through machine calculations; market-meltdown
through machine calculations; poverty-for-everyone through machine
calculations :( Anyways, have you compared to Pei Wang's NARS (or perhaps
his The limitation
Or maybe, if aCollection == self, a warning could be raised ?
What do you think ?
Thumbs down, I do not want anybody copy a collection behind my back
(however small or large it is) just because remove* has nothing to do
with copy.
Ok, I can understand.
What about the
Isn't Cedrick's aida solution going to be significantly faster?
this is not mine :)
butI'd interested to see if it's a good use of #become:... Does it
keep references ? is it safe ?
Thanks
___
Beginners mailing list
Hi,
I noticed in my image (damien last beta so 3.10 - windows XP and
Vista) that I have a strange bug when soustracting floats
successively. Here is how I reproduce it in a workspace:
1 - 0.2 -0.05 -0.3 = 0.45 true
1 - 0.2 -0.05 -0.3 -0.1= 0.35 true
1 - 0.2 -0.05 -0.3 -0.1 -
Thank you John,
Your interesting answer make me think that's true there are no stupid
question :)... I was bitten because, I finally decided to test-model
my code and was surprised by the failure I got, so I had a closer look
to what's happening in my model. I'm basically modeling a weight on
For whatever reasons, I want sometimes to experiment some smalltalk
code by avoiding a primitive call, like in Float=, which start by
primitive:47. Only commenting doesn't work. So, is it possible ? and
if the primitive fail, is the smalltalk code evaluated ?
Out of curiosity, where can we find
I'm aware that this post is far more information than you asked for, but
is enough for you to get a real handle on this stuff if you want more
detail than Never ever test floats for equality because it will bite you
on the arse big time, cost you your job, kill innocent people and cause
the
As long as the numbers remain close to 1, it may be easier to
deal with that than forcing the calculations into rational arithmetic.
yep, I think we expect that 0.1 asFraction evaluate as 1/10, but this
seems quite tricky to achieve and probably not worth it...
Cédrick
In Float, there is an class var named Epsilon (1.0e-12 in my image).
Method initialize in the class side of Float is interesting by the way...
So Epsilon := 0.0001. Defines precision of mathematical
functions is set when the class is inittialized.
Just for information, is it
If you comment out the primitive like this is should definitely work:
If I comment out the primitive, in Float= ... and put a self halt
after, the halt point has no effect.
Load the VMMaker package to see the source code. Look at
Interpreter classinitializePrimitiveTable to find the method
2007/7/15, Blake [EMAIL PROTECTED]:
If you open up a Workspace and enter some text, then close it, you get the
message:
Changes have not been saved.
Is it OK to cancel those changes?
If you answer yes, the window closes and all text is gone If you answer
no, and then save, and then close, you
Anyway, you certainly have discovered some sort of bug. The log
suggest this has something to do with the sources or changes file -
does that ring a bell with you?
this reminds me (a little) the bug I had because of my anti-virus
(NOD32) which was scanning the changes files each time it was
Does anyone know why evaluating the following:
|aString|
aString := 'hello world'.
self halt.
in a workspace will hang the Squeak UI?
this is not blocking the UI in my image...
but still you should put self halt before the affectation... or
better, you just remove self halt, select the
2007/5/20, subbukk [EMAIL PROTECTED]:
HI cdrick thanks for your reply
i will tell you in detail.
This is the actual DAML sentence (input) given to the XMLParser
daml:Class rdf:ID = Person
rdfs:subClassOf rdf:resource = #Animal /
rdfs:subClassOf
daml:Restriction
daml:onProperty rdf:resource
I just parsed the DAML sentence using XMLParser. Next step i have to do is
that i have to collect all the parsed elements and store it in a temporary
variable. So please anyone tell me the syntax for this one.
--
What the DAML sentence ? a DAML sentence ?...
I think you just have to select
Hi all...
I just formated my PC and now with squeak, I have problem when l load packages.
The step snapshotting methods is very long ! (long minutes), whereas
before this was quick.
there are screen captures and the debug stack at the folowing adress:
http://cdrick.seasidehosting.st
Do you
Yes, I added the Cryptography repository and can see all the
Cryptography categories but I'm not sure what I need to load and do in
order to get SSL up and running. I don't see anything called
Cryptography-Configuration.mcm, just .mcz files.
Where do you see a configuration directory? In
I've been trying to load the Cryptography group's SSL implementation
into my image but can't seem to figure it out how. The posts I have
found about this (from Ron) talk about loading
Cryptography-Configuration.mcm and then Crypt-Xtra-Config.mcm from
www.squeaksource.com/Cryptography (I think)
2006/12/12, Mathieu [EMAIL PROTECTED]:
Look at ClassaddInstVarName:
Point addInstVarName: 'x'.
It's possible but not recommended (I think)
What you could try is to use a container as instVar (or classInstVar)
in which you can add several elements that will act as instVar.
It's a model
I'm new to Squeak, so please bear with me. I'm doing the Magritte
Tutorial and have accidently created a class method that I misnamed.
How can I delete a class method?
cmd x
is the usual shortcut too.
depending on your system, cmd is alt, ctrl ou the mac button :)
Cédrick
I forgot **no**
if there is no $^ in a method
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Hi
I'm a total newbie at all ;-)
I don't know about squeak, I'm not a programmer...
so am I
First of all, squeak overload my CPU. 80-90% all the
time, even if I do nothing. Except if I move the mouse
(then I get 100%).
Maybe you can use an older version of squeak
http://ftp.squeak.org/
but
it' not pretty but you can do a fileOut of any elements (class,
package, methods ...) from the browser (right clic). It's in chunk
fomat, lots of !! but it's ok to read
Cédrick...
ps: does anybody know a code colorizer to read .st in a text editor ?
with fileOut, you sould have a .st file in the directory of your image
printOut produces an html file...
Cédrick
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
2006/8/23, stéphane ducasse [EMAIL PROTECTED]:
but is a not the fastest one?
because you nearly only call primitives?
I did not check.
Cedric did you benchmark a and c.
even if large dictionaries degenerate in Squeak.
not yet but I will when some spare time ;)
Though it probably depends on
HiAs some of us, I'm following the two lists (dev and beginner..) and there is a long interesting discusion about pragma, FFI, primitive... but I don't really know them ;) exept what I found on wikipedia lol
Can anyone indicate me pointers or maybe simple examples to understant that better ?in
really thanks Bert ;)clear explanation... I had dome vague ideas but thats far clearer now
A module is written in C (though often the C code is generated fromSqueak code) and needs to be compiled with a C compiler. Some modulesare linked into the VM, some are external. You can list all
look at @the point creation method is sped up using an optional primitive call.
@ yPrimitive. Answer a Point whose x value is the receiver and whose yvalue is the argument. Optional. No Lookup. See Object documentationwhatIsAPrimitive.primitive: 18
^Point x: self y: y(a) Time
2006/8/7, stéphane ducasse [EMAIL PROTECTED]:
Hi florentRead K. Beck idiom on redefining = normally you MUST also redefine hashthe pattern Kent suggested wasBook= anBook(self author = anBook author ) and: [self name = anBook name] (a)
Bookhashself author hash bitXor: selfname hash (b)I'm aware of
Uhmm. To me, there are several kinds of newbie and my newbiness is more
on computer science in general as I start to know squeak a bit. That's
why I find more approriate to post general questions (like XML
processing) here instead of the dev list where subjects are very sharp
and where people will
Hi allI've got xml files that I receive from Meteo France (weather forecast) that I have to query and map to some objectsI've tried several stuff like parsing the file, selecting only some elements, displaying it with a WATree but I'm a bit stuck as none results I got are good enough.
The
cool and thanks all ;)
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
what I do is dragging an image on the squeak icon or shortcut... and it is fast ;)Cédrick
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
For these I create separate classes. For one, it means that your codestays inside your development environment: from time to time, when I
do senders of a method, it turns out I already used the method I'dlike to find information on.
very cool :) I'll use that too (for senders :) )...
so for
Hi ;)
Just to tell you that it was a problem on the server side...
the pga_conf file was causing problem beacause of a DynDns or something like that...
sorry then but I hope the discussion was interesting for people wanting to connect a postgres db...
it works perfectlyt now...
again
Thanks
I tend not to use self halt for this, butinstead self error: 'write me' because sometimes I don't find the
spot for a few days and it is nice to have the error message to remindme what I was supposed to do.nice trick ;)
___
Beginners mailing list
Hi again...For my project, I need to have an application in french and spanish.Do you have advice for simple translation mechanism (only strings).I wanted to intercept the rendering of strings in seaside and then choose the proper one according to the session language. If missing I was thinking of
84 matches
Mail list logo