[Newbies] remove allInstances?

2016-09-23 Thread Louis LaBrunda
Hi,

Tobias is right.  I'm use to the VA Smalltalk one way #become: and forgot about 
Squeaks two way
#become:, sorry about that.

Lou

On Fri, 23 Sep 2016 19:47:31 +0200, Tobias Pape <das.li...@gmx.de> wrote:

>Hi,
>
>On 23.09.2016, at 15:03, Louis LaBrunda <l...@keystone-software.com> wrote:
>
>> Hi Joseph,
>> 
>> Try:
>> 
>> Books allInstances do: [:b | b become: nil].
>
>I would advise against that. Become is a sledgehammer and you're about to 
>crush ants with it.
>
>What happens with 'a become: b' ? All occurrences of 'a' in the image are 
>replaced by 'b' and (this is important) vice versa.
>So, all 'b's are replaces by 'a'.
>
>With your example, all occurrences of nil are replaced with an instance of 
>Book, in the whole image. This is most probably _not_ what you want.
>
>These two versions work better:
>
>Books allInstances do: [:b | b becomeForward: nil].
>Books allInstances do: [:b | b become: Object new].
>
>The first avoids the 'vice versa' part of become: and is more safe, the second 
>one
>does the switcharoo with a new object every time, wich is also more safe.
>
>Anyhow, I presume that your intent is to track down instances of Book wich you 
>don't know where they are.
>
>Maybe they are actually unreferenced already, so
>   Smalltalk garbageCollect
>can get already rid of them. 
>
>If that does not help, you can try to track the references down by doing
>
>   Books allInstances do: [:b | b chasePointers]
>
>which will open a PointerFinder for each of the rouge object so you can 
>inspect where they get referenced.
>
>I hope this helps.
>
>Best regards
>   -Tobias
>
>
>> 
>> Lou
>> 
>> On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta <joseph.alo...@gmail.com> 
>> wrote:
>> 
>>> Greetings,
>>> 
>>> The main program I am working on now is called Books.
>>> 
>>> If I evaluate
>>> 
>>> Books allInstances => anOrderedCollection( aBook aBook aBook )
>>> 
>>> How do I set them all equal to nil like
>>> 
>>> Books removeAllInstances.
>>> 
>>> Books allInstances => anOrderedCollection().
>>> 
>>> 
>>> Sincerely,
>>> 
>>> Joseph.
>> -- 
>> Louis LaBrunda
>> Keystone Software Corp.
>> SkypeMe callto://PhotonDemon
>> 
>> ___
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] remove allInstances?

2016-09-23 Thread Louis LaBrunda
Hi Joseph,

Try:

Books allInstances do: [:b | b become: nil].

Lou

On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta <joseph.alo...@gmail.com> 
wrote:

>Greetings,
>
>The main program I am working on now is called Books.
>
>If I evaluate
>
>Books allInstances => anOrderedCollection( aBook aBook aBook )
>
>How do I set them all equal to nil like
>
>Books removeAllInstances.
>
>Books allInstances => anOrderedCollection().
>
>
>Sincerely,
>
>Joseph.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] indexing into a collection

2016-07-27 Thread Louis LaBrunda
Hi Joe & Ben,

Ben's example is a good one.  If there will be only one instance of DrivingDays 
in the
collection for a given date then you should look at Dictionary and LookupTable. 
 You could then
add items to the collection with:

collection at: aDrivingDays date put: aDrivingDays.

and then use:

item := collection at: aDate.

to fetch the instance you want.

Lou


On Wed, 27 Jul 2016 15:51:44 +0800, Ben Coman <b...@openinworld.com> wrote:

>On Wed, Jul 27, 2016 at 8:13 AM, Joseph Alotta <joseph.alo...@gmail.com> wrote:
>> Ben, Ron, I made a small example, and it works as you said it would:
>>
>> a := #( #(1 2)  #(3 4)).
>> b := a asOrderedCollection.
>> b  => an OrderedCollection(#(1 2) #(3 4))
>> c := b select: [ :i | (i first) = 3 ].
>
>Ahh. Code examples help. Maybe what you need is #detect:
>which returns an element rather than a collection of elements.
>
>> c => an OrderedCollection(#(3 4))
>> d := c first
>> d =>  #(3 4)
>> d at: 2 put: 5
>> d =>  #(3 5)
>> b  => an OrderedCollection(#(1 2) #(3 5))
>>
>> Okay, I will check my other code.
>>
>> Sincerely,
>>
>> Joe.
>
>Here's a domain specific example...
>
>Object subclass: #DrivingDays
>instanceVariables: 'date store mileage"?" '
>...etc...
>
>oc := OrderedCollection new.
>oc add: (DrivingDays new date: '2016-01-02' ; store: 'quigley' ; mileage: 18).
>oc add: (DrivingDays new date: '2016-01-03' ; store: 'marianos' ; mileage: 5).
>
>oc printString.
>>> > an OrderedCollection(2016-01-02| quigley | 18,
>>> >  2016-01-03| marianos | 5)
>
>drivingDayToUpdate := oc detect: [ :dd | dd store = 'marianos' ].
>drivingDayToUpdate mileage: 7.
>
>oc printString.
>>> > an OrderedCollection(2016-01-02| quigley | 18,
>>> >  2016-01-03| marianos | 7)
>
>(disclaimer, I am not somewhere I can run this. Its just off the top
>of my head.)
>cheers -ben
>
>>
>>
>>
>>
>>> On Jul 26, 2016, at 6:25 PM, Ben Coman [via Smalltalk] <[hidden email]>
>>> wrote:
>>>
>>> Hi Joe,
>>>
>>> As Ron said, you should not be getting a copy.  If you still have a
>>> problem, perhaps best if you post code for a complete example:
>>> * class definition (with just two instance variables)
>>> * instance variable accessor methods
>>> * instance creation & adding to collection
>>> * select statement
>>> * updating object
>>>
>>> cheers -ben
>>>
>>> On Wed, Jul 27, 2016 at 5:53 AM, Ron Teitelbaum <[hidden email]> wrote:
>>>
>>> > Hi Joe,
>>> >
>>> > If the orderedCollection contains your object DrivingDays then select
>>> > should give you the object and not a copy.
>>> >
>>> > You don't need to add it back to the collection just update the object.
>>> >
>>> > Check your code for anything that might be making a copy.
>>> >
>>> > All the best,
>>> >
>>> > Ron Teitelbaum
>>> >
>>> >
>>> > -Original Message-
>>> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Joseph Alotta
>>> > Sent: Tuesday, July 26, 2016 3:04 PM
>>> > To: [hidden email]
>>> > Subject: [Newbies] indexing into a collection
>>> >
>>> > Greetings,
>>> >
>>> > I have a OrderedCollection of DrivingDays.
>>> >
>>> >
>>> > an OrderedCollection(2016-01-02| quigley s| nil|18§
>>> >  2016-01-03| marianos fresh| nil|5§
>>> >  2016-01-04| fresh thyme| nil|5§
>>> >  2016-01-05| panda express| nil|3§
>>> >  2016-01-06| peets| nil|7§
>>> >  2016-01-07| starbucks| nil|3§)
>>> >
>>> > I want to select aDrivingDay object from the list by date, update it by
>>> > adding mileage and places visited and put it back into the list.
>>> >
>>> > If I #select the OrderedCollection, I get a copy of the item, not the
>>> > same one in the OrderedCollection.
>>> >
>>> > How do I select an item in the list for update?
>>> >
>>> > Sincerely,
>>> >
>>> > Joe.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] next or break in a loop

2016-05-10 Thread Louis LaBrunda
Joe,

At each test for the type of data you can also test to see if you found type, 
something like
this:

stream := ReadStream on: myCollection.
[stream atEnd] whileFalse: [:item | | notFound |
item := stream next.
notFound := true.
(notFound and: [your column test1]) ifTrue: [notFound := false. 
stream upToEnd].
(notFound and: [your column test2]) ifTrue: [notFound := false. 
stream upToEnd].
(notFound and: [your column test3]) ifTrue: [notFound := false. 
stream upToEnd].
].

Not pretty but it should work.  You should also look into the #caseOf: method 
Bert suggested. I
have my own Case class in VA Smalltalk that I expect is similar but I'm not 
familiar with
#caseOf:, so you should look it up.  I expect it will make the code a little 
cleaner.

Lou

On Tue, 10 May 2016 08:57:03 -0700 (PDT), Joseph Alotta 
<joseph.alo...@gmail.com> wrote:

>Lou,
>
>I was trying to use the ReadStream, but the issue is to get execution to go 
>back to the top.  If I send the upToEnd message, it still executes from the 
>same line and goes through the rest of the tests.
>
>
>Sincerely,
>
>Joe.
>
>
>
>> On May 9, 2016, at 3:56 PM, Louis LaBrunda [via Smalltalk] 
>> <ml-node+s1294792n4894128...@n4.nabble.com> wrote:
>> 
>> Hi Joe, 
>> 
>> You can map your collection to a stream and then use the stream methods to 
>> traverse the 
>> collection. 
>> 
>> stream := ReadStream on: myCollection. 
>> [stream atEnd] whileFalse: [:item | 
>> item := stream next. 
>> "I'm not sure upToEnd is the right method here but it is close.  Look 
>> around, I'm sure you will 
>> find what you need." 
>> item doSomeWork. 
>> (when you think you are done with item) ifTrue: [stream 
>> upToEnd]. 
>> ]. 
>> 
>> Lou 
>> 
>> On Mon, 9 May 2016 16:00:58 -0500, Joseph Alotta <[hidden email]> wrote: 
>> 
>> >I don?t think any of the solutions work for my case. 
>> > 
>> >I want to evaluate several different variable for each step, make 
>> >calculations and if all of the conditions are met, then skip to the next 
>> >item, otherwise, do the next step of calculations. 
>> > 
>> >The project is reading comma deliminated bank or credit card files, taking 
>> >a column of data, counting various characters, and trying to determine what 
>> >kind of data it is.  For example, a column of data with two slash 
>> >characters and eight digits per line is likely to be a date field.  A 
>> >column of data with more than 3 letter characters and a percentage of 
>> >digits and a percentage of hash signs is likely to be a payee field.  A 
>> >column of data with no spaces, no digits, no special characters is likely 
>> >to be a type of transaction field.  A column of data with one period per 
>> >item, and only digits or a minus sign is  likely to be a amount field, and 
>> >a column of data with a high percentage of zero length items and the rest 
>> >having C or K and a pound sign and four or more digits is likely to be a 
>> >check number field. 
>> > 
>> >I am doing a lot of tests for each field and I don?t think the switch is a 
>> >good fit. 
>> > 
>> >Sincerely, 
>> > 
>> >Joe.
>> -- 
>> Louis LaBrunda 
>> Keystone Software Corp. 
>> SkypeMe callto://PhotonDemon 
>> 
>> _______ 
>> Beginners mailing list 
>> [hidden email] 
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>> 
>> 
>> If you reply to this email, your message will be added to the discussion 
>> below:
>> http://forum.world.st/next-or-break-in-a-loop-tp4894095p4894128.html
>> To start a new topic under Squeak - Beginners, email 
>> ml-node+s1294792n107673...@n4.nabble.com 
>> To unsubscribe from Squeak - Beginners, click here.
>> NAML
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] next or break in a loop

2016-05-09 Thread Louis LaBrunda
Hi Joe,

You can map your collection to a stream and then use the stream methods to 
traverse the
collection.

stream := ReadStream on: myCollection.
[stream atEnd] whileFalse: [:item |
item := stream next.
"I'm not sure upToEnd is the right method here but it is close.  Look around, 
I'm sure you will
find what you need."
item doSomeWork.
(when you think you are done with item) ifTrue: [stream 
upToEnd].
].

Lou

On Mon, 9 May 2016 16:00:58 -0500, Joseph Alotta <joseph.alo...@gmail.com> 
wrote:

>I don’t think any of the solutions work for my case.
>
>I want to evaluate several different variable for each step, make calculations 
>and if all of the conditions are met, then skip to the next item, otherwise, 
>do the next step of calculations.
>
>The project is reading comma deliminated bank or credit card files, taking a 
>column of data, counting various characters, and trying to determine what kind 
>of data it is.  For example, a column of data with two slash characters and 
>eight digits per line is likely to be a date field.  A column of data with 
>more than 3 letter characters and a percentage of digits and a percentage of 
>hash signs is likely to be a payee field.  A column of data with no spaces, no 
>digits, no special characters is likely to be a type of transaction field.  A 
>column of data with one period per item, and only digits or a minus sign is  
>likely to be a amount field, and a column of data with a high percentage of 
>zero length items and the rest having C or K and a pound sign and four or more 
>digits is likely to be a check number field.
>
>I am doing a lot of tests for each field and I don’t think the switch is a 
>good fit. 
>
>Sincerely,
>
>Joe.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] conceptual design help

2016-04-28 Thread Louis LaBrunda
Hi Joe,

I agree with Kirt's suggestions in general.  See more below.

On Thu, 28 Apr 2016 17:15:05 -0500, Joseph Alotta <joseph.alo...@gmail.com> 
wrote:

>Greetings,
>I am writing a program to consolidate all my personal finances for tax time 
>next year.  (This is not a school project.)
>There are transaction files from several banks and credit card companies.  
>Each has a similar format, CSV, but they vary in many ways, order of items, 
>extra notes, pipe delimited or tabs, etc.  I want to read them and load them 
>into a collection of transaction objects.

>1.  Should I have a FileReader object?
>2.  Should it have subclasses like FileReaderAmericanExpress, 
>FileReaderJPMorgan ?

No.  I would with the object you want to hold the information and work out from 
there.  An
object or your main program object should read the files and instantiate the 
objects (same
class) that gets the data.

>3.  Or should it have different methods like loadAmericanExpresFile, 
>loadJPMorganFile ?

Yes.  Use different methods to read and parse the files and instantiate the 
objects.  Depending
upon how close (similar) the files are you could have a method with a few 
parameters (three or
four at most) that handles more than one file.

>4.  Is a Collection of Transaction objects, the structure that you would load 
>the files into?

Yes.  An ordered or sorted collection would be good so you could sort by 
date/time if that is
helpful.

>The rest of the project would be to do data checking on the files, to make 
>sure there are no duplicates or missing dates.  Then write reports that I can 
>give to my accountant.

Sounds good.

>I would appreciate some design help?
>Sincerely,
>Joe.

Lou
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] go to the end of a loop

2016-04-25 Thread Louis LaBrunda
Hi Joe,

Better than checking for #nextLine answering nil, I think you can send the file 
stream #atEnd
to see if there is any more data.  You would then use a #whileFalse: and move 
the #nextLine
call into the second block of the whileFalse:.  Then test for empty lines with 
something like:
(line size < 2) ifFalse: [...putting all the code that does the work on a line 
with data in
here...].

Lou

PS.   If this is not a school project, we can be of more help, we just don't 
like doing
students projects for them as they learn more with just a few hints and not 
real code.

On Mon, 25 Apr 2016 10:16:33 -0500, Joseph Alotta <joseph.alo...@gmail.com> 
wrote:

>Greetings,
>
>I have this code:
>
>**
>
>read
>   "read the category file into the dictionary
>   the first item is the category, the rest of the line are payees
>   
>   office expense|home depot|staples|costco
>   groceries|natures best|jewel|trader joes|fresh thyme
>   "
>
>| f line |
>f := FileStream oldFileNamed: myfile.
>
>[(line := f nextLine) notNil] whileTrue: [| array cat payees |
>   
>  array := line  findTokens: $| escapedBy:  Character 
> tab .
>
>   cat := array first.
>   payees := array reject: [ :i | i = cat 
> ].   "rest of the line"
>   
>   payees do:  [ :p |   mydict at: (p 
> withBlanksCondensed) put: (cat withBlanksCondensed)].
>  ].
>
>
>f close.
>
>*
>
>I am getting some blank lines in the data file.  Lines with just a Character 
>cr.  I was wondering how to handle that.  In other languages, there is a break 
>for the loop, to go to the end.  I can do:
>
>(line size < 2) ifTrue: [ f nextLine.].
>
>But that would interfere with the notNil idiom at the end of the file.  So 
>where do I put this.  Is there a common way to jump to the end?
>
>
>Sincerely,
>
>
>Joe.
-- 
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to round a float?

2015-02-18 Thread Louis LaBrunda
Hi Bert,

 That's why I thought there was a problem with #roundTo: but maybe #roundTo:
 has some other intent that I'm not aware of?

It's used for snapping values to a grid. E.g. in ScrollBarsetValue:.
- Bert -

Ahh, Thanks Bert.  So it isn't exactly the same as displaying the numbers
but close.  And in that case I guess a value like 162.890001 is
good enough and there wouldn't be any growing error as each snap brings the
value back where you want it.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to round a float?

2015-02-16 Thread Louis LaBrunda
Hi Nicolas,

Lou, I'm very suspicious about what VA does.
IMO you should not trust too much what you see (what it prints!)

I think I agree with everything you say.  I assumed (I know that might get
me in trouble) that Chuck was rounding to print or display the value.
Personally I don't see any reason to round floats (or almost anything else)
except to display them in a simpler form.  Given that, 162.89 looks better
than 162.890001 and is probably what Chuck was looking for.

That's why I thought there was a problem with #roundTo: but maybe #roundTo:
has some other intent that I'm not aware of?

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection

2015-02-04 Thread Louis LaBrunda
Hi Raymond,

Try:

^notes sorted:[:a :b | (a date   b date) | ((a date = b date)  (a date
temps  b date temps))].

Lou

On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin jgr.asse...@me.com
wrote:

I have this kind of sorting on anOrderedCollection

BlocNotes sortedNotes
   ^notes sorted:[:a :b | a date   b date]

This sort my notes on date but I want them sort by date AND inside a date by 
hours and I don't khow how to do this.

Some insights?

aNote = 'med com date temps' instancesVariables what I call hours = temps 
witch is a number like 2123 for 21h23

Some insights?
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection - DynamicSortBlock.st (0/1)

2015-02-04 Thread Louis LaBrunda
On Wed, 4 Feb 2015 09:00:13 -0800 (PST), Paul DeBruicker
pdebr...@gmail.com wrote:

Does using the | or  notation have any advantages over and: or or:  or
ifTrue:ifFalse ?

and: and or: are needed when you don't want to execute the code inside the
block unless it is needed.  They are also used to protect from executing
code that shouldn't be run for example:

x notNil and: [x foo  y foo]

I always write expressions like the one you've written like:

a date = b date 
   ifTrue:[a temps  b temps] 
   ifFalse:[a date  b date]

I like this but it may be a little tricky for a beginner.  But both or
replay help one to learn.

I have also attached a file out (from VA Smalltalk) of a class that acts
like a sort block but is much easier to use for complex sorts.

Lou

Louis LaBrunda wrote
 Hi Raymond,
 
 Try:
 
 ^notes sorted:[:a :b | (a date   b date) | ((a date = b date)  (a date
 temps  b date temps))].
 
 Lou
 
 On Wed, 04 Feb 2015 10:34:48 -0500, Raymond Asselin lt;

 jgr.asselin@

 gt;
 wrote:
 
I have this kind of sorting on anOrderedCollection

BlocNotes sortedNotes
 ^notes sorted:[:a :b | a date   b date]

This sort my notes on date but I want them sort by date AND inside a date
by hours and I don't khow how to do this.

Some insights?

aNote = 'med com date temps' instancesVariables what I call hours = temps
witch is a number like 2123 for 21h23

Some insights?
 ---
 Louis LaBrunda
 Keystone Software Corp.
 SkypeMe callto://PhotonDemon
 mailto:

 Lou@

  http://www.Keystone-Software.com
 
 ___
 Beginners mailing list

 Beginners@.squeakfoundation

 http://lists.squeakfoundation.org/mailman/listinfo/beginners
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] How to doubble sort a collection - DynamicSortBlock.st (1/1)

2015-02-04 Thread Louis LaBrunda

begin 644 DynamicSortBlock.st
M#0I/8FIE8W0@W5B8VQAW,Z(-$6YA;6EC4V]R=$)L;V-K#0H@(`@8VQA
MW-);G-T86YC959AFEA8FQE3F%M97,Z(G#0H@(`@:6YS=%N8V5687)I
M86)L94YA;65S.B`G86-C97-S;W)S(1IF5C=EO;G,@)PT*(`@(-L87-S
M5F%R:6%B;5.86UESH@)R-B`@(!P;V]L1EC=EO;F%R:65S.B`G)R$-
M@T*(41Y;F%M:6-3;W)T0FQO8VL@8VQAW,@'5B;EC365T:]DR`A#0H-
MF%C8V5SV]RSH@86Y/F1EF5D0V]L;5C=EO;@T*2)#F5A=4@82!N
M97@:6YS=%N8V4@86YD('-E=!A8V-EW-OG,N(@T*#0H)7BAS96QF(YE
M=RD@86-C97-S;W)S.B!A;D]R95R961#;VQL96-T:6]N.R!Y;W5RV5L9BX-
MB$-@T*86-C97-S;W)S.B!A;D]R95R961#;VQL96-T:6]N(1IF5C=EO
M;G,Z(%N3W)D97)E9$-O;QE8W1I;VXR#0H)(D-R96%T92!A(YE=R!I;G-T
M86YC92!A;F0@V5T(%C8V5SV]RR!A;F0@9ER96-T:6]NRXB#0H-@E
M*'-E;8@;F5W*2!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T+@T*(0T*
M#0ID:7)E8W1I;VYS#0H)(D%NW=EB!D:7)E8W1I;VYS+B`@06X@;W)D97)E
M9!C;VQL96-T:6]N(]F()O;VQE86YS('5S960@9F]R('-OG1I;F@8V]M
MQE!C;%SV5S+B(-@DB3VYE(9OB!E86-H('-Y;6)O;!I;B!A8V-E
MW-OG,L('1R=64@;65A;G,@87-C96YD:6YG+!F86QS92!M96%NR!D97-C
M96YD:6YG+B(-@DB4V5E(-V86QU93IV86QU93HB#0H-@ED:7)E8W1I;VYS
M(ES3FEL(EF5')U93H@6V1IF5C=EO;G,@.CT@3W)D97)E9$-O;QE8W1I
M;VX@;F5W72X-@E9ER96-T:6]NRX-B$-@T*9ER96-T:6]NSH@86Y/
MF1EF5D0V]L;5C=EO;@T*2)3970@9ER96-T:6]NRX@($%N(]R95R
M960@8V]L;5C=EO;B!O9B!B;V]L96%NR!UV5D(9OB!S;W)T:6YG(-O
M;7!L97@@8VQAW-ERXB#0H)(D]N92!F;W(@96%C:!S6UB;VP@:6X@86-C
M97-S;W)S+!TG5E(UE86YS(%S8V5N9EN9RP@9F%LV4@;65A;G,@95S
M8V5N9EN9RXB#0H)(E-E92`C=F%L=64Z=F%L=64Z(@T*#0H)(D%L;]W(9O
MB`C*'1R=64@9F%LV4@(V%S8V5N9EN9R`C95S8V5N9EN9R`G87-C96YD
M:6YG)R`G95S8V5N9EN9R@(V=AF)A9V4I('1H870@=VEL;!R97-U;'0@
M:6XZ#0H)86X@3W)D97)E9$-O;QE8W1I;VXH=')U92!F86QS92!TG5E(9A
M;'-E('1R=64@9F%LV4@=')U92DN(!$:7)E8W1I;VX@95F875L=',@=\@
M87-C96YD:6YG+!S;R!I9B!V86QU97,@87)E(%N71H:6YG#0H);W1H97(@
M=AA;B!TG5E+!F86QS92!OB!A('-TFEN9R!S=%R=EN9R!W:71H($@

[Newbies] How to round a float?

2015-02-04 Thread Louis LaBrunda
Hi Guys,

On Wed, 4 Feb 2015 08:22:02 -0500, Johann Hibschman joha...@gmail.com
wrote:

That just looks like floating-point representation. It's as rounded as it
can get!
-Johann

At first I thought some more parans ( were needed but that didn't change
anything.  No this sounds like a bug to me (ar at least something that can
be improved) as VA Smalltalk prints 162.89, so somehow they are able to
make the floats do the right thing.

Lou



On Wed, Feb 4, 2015 at 6:22 AM, Chuck Hipschman ckhipsch...@gmail.com
wrote:

 7 / 8.0 roundTo 0.01 = 0.88  Aha! Thanks!

 But:

 100 * (1.05 raisedTo: 10) roundTo: 0.01 162.890001

 162.88946267774418 unrounded
 100 * (1.05 raisedTo: 15) roundTo: 0.01 207.890001

  207.8928179411367  unrounded
  Bug, or me again :-)

 MacBook Pro (Retina, 15-inch, Early 2013)  System Version: OS X 10.10.2
 (14C109)

 Image
 -

 /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image
 Squeak4.5
 latest update: #13680
 Current Change Set: Unnamed1
 Image format 6505 (32 bit)

 Virtual Machine
 ---

 /Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/MacOS/Squeak
 Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331] 4.5
 Mac OS X built on Aug 22 2013 10:08:05 Compiler: 4.2.1 (Apple Inc. build
 5666) (dot 3)
 platform sources revision VM: r2776
 http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545
 http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
 CoInterpreter VMMaker.oscog-eem.331 uuid:
 37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013
 StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid:
 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013

 On Wed, Feb 4, 2015 at 2:59 AM, Ben Coman b...@openinworld.com wrote:

 In the interest of teaching how to fish, look at the senders of #roundTo:
 to find its usage.

 I'll post a full answer tomorrow if you don't beat me to it.

 cheers -ben

 On Wed, Feb 4, 2015 at 4:34 PM, Chuck Hipschman ckhipsch...@gmail.com
 wrote:

 7 / 8.0 roundTo: 2 I expect 0.88, I get 0

 What am I doing wrong, or this a bug?

 TIA

 Chuck

 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners



 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners



 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners


---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Modify block (closure) parameters

2013-08-06 Thread Louis LaBrunda
Hi Guys,

FWIW, VA Smalltalk doesn't allow changing block arguments.

Lou

On Tue, 6 Aug 2013 13:42:33 -0700, Casey Ransberger
casey.obrie...@gmail.com wrote:

I didn't read your post clearly enough. Yep, that would seem odd. You may
have a bug there. I'm not sure why that happens. It looks like the outer
context isn't taking the assignment, but hanging onto the initial value it
receives from #value:.

I'm not totally sure we should expect to be able to do what you're trying
to do in modern Squeak. I haven't assigned to a block arg in a long time (I
keep allow block assignments off unless I'm loading old code.) I don't know
what the status is there. I run a relatively recent Cog VM on a 10.7.5 Mac
and I'm seeing the same behavior in Squeak 4.4.

When I switch to an old VM (3.8.18Beta3U) and run Squeak 3.0, your snippet
works as expected. I'm not sure if this is in the image or the VM yet, or
whether it's expected behavior or not with allowBlockArgumentAssignment
(Again, I usually turn it off.)

The main take away here is, don't do that:) as it's a back-compat feature
and it really ought to have a big sign on it that says DEPRECATED. If
you're trying to load some older code and running into this, it might be
better to actually rewrite it not to assign to block arguments in my
opinion (and maybe I'm nuts.)

Can you tell me what VM you're using?

Smalltalk vmVersion this will tell us

And also which version of Squeak?

SmalltalkImage current systemInformationString ditto

Also, what's the OS of the host system?



On Mon, Aug 5, 2013 at 1:44 AM, psea denis.lukic...@gmail.com wrote:

 Hi Smalltalkers!

 Here is a question I can't find answer with google.
 In short: Does block parameters and block local variables are the same
 thing
 (semantically) inside closure? It looks like it's not. Below the
 explanation.

 ===
 Here is the accumulator function (first attempt):

 makeAcc := [ :acc |
 [:n | acc:=acc+n. acc]]

 It turns out it doesn't work as intended:

 a1 := makeAcc value: 10
 a1 value: 1 = 11
 a1 value: 1 = 11
 a1 value: 2 = 12

 
 Here is the second attempt:

 makeAcc := [ :acc |
 | total |
 total:=acc.
 [:n | total:=total+n. total]]

 And it does work as intended:

 a1 := makeAcc value: 10
 a1 value: 1 = 11
 a1 value: 1 = 12
 a1 value: 2 = 14

 So if we use the local variable to store accumulator it works as it should
 and remembers the value between function (block) calls. But if we use block
 parameter to store the value of accumulator it does not remembers the value
 between calls.
 Why is it so?

 P.S. Sorry for my English. I do all my best.



 --
 View this message in context:
 http://forum.world.st/Modify-block-closure-parameters-tp4702118.html
 Sent from the Squeak - Beginners mailing list archive at Nabble.com.
 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners

---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Pool Variables

2013-07-02 Thread Louis LaBrunda
Hi Joseph,

On Tuesday 02 July 2013 08:46 AM, Joseph J Alotta wrote:
 Just curious, can someone give me an real life example of when you would 
 need to use pool variables and no other variable would work?

Generally information from external world are made available through 
pool variables since they are broadly consumed by many classes. Examples 
are
  * Physical or Math constants like pi, e, ...
  * Conventional names for weeks, months, colors, directions, playing 
cards, chess pieces.
  * Elements of binary file headers
  * Character and Font tables
  * Sensor events coming from hardware devices (like button codes)

Explore

SharedPool subclasses

to see real-life usage in method source codes.
HTH .. Subbu

I agree with Subbu.  If you take a look at my contribution:
http://ss3.gemstone.com/ss/minecraft.html/Overview?_s=pxWnk5AQYKMk4B4B_k=EP_TzpOiAQnnFmJw

to Bert's Minecraft bindings you will see how I use them to make the calls
to Minecraft read better and make it so you don't have to remember what
number (value) goes with what Minecraft color or texture.

I have also recently used one in some of my VA Smalltalk GUI programs to
hold an object with some help information, like where the user was in
various layers of windows and panes within windows.  I could have passed
this object into each window but it is a lot of work just to avoid using
what amounts to a global variable.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] I need an idea. I know you have some. Give.

2013-03-08 Thread Louis LaBrunda
Hi Casey,

Here are a couple RasPi ideas, maybe we can make some money off of building
them/selling the hardware/selling pre configured memory cards.

Make a RasPi based file server with an external USB hard drive.

Make a RasPi jukebox.  Music can be saved on a large memory card or an
external USB hard drive.  I'm not sure how good the sound capabilities are
on the RasPi so that could be a problem.

Build a home security system based upon the RasPi.

Build a small all-in-one computer (maybe for the kitchen) by attaching the
RasPi to a small display.  Would have to come up with how to have/not have
a keyboard.

Lou

Hello Squeakers!

My job search is turning up dead ends, hurry up and wait, and unfathomably 
boring prospects. 

Screw all that! I want to do something cool. 

I'm thinking about doing a KickStarter, but almost all of my ideas are either 
a) stuff no one else wants which only I could possibly think would be cool, or 
b) overly ambitious. The words Andreas used to describe my last idea: a bit 
grandiose. Gift for understatement at times. 

So I'm looking for something which could be completed by one or two geeks in 
six months to a year, which people actually want, to be implemented (at least 
in part) using Squeak, and to be released at the end under the MIT license. 

I've floored my expenses, so I can make my own labor (relatively, for a guy 
living in Seattle) very cheap. By floored, I mean the room I sleep in isn't 
even tall enough to stand up in -- I do not presently meet the definition of a 
free-range chicken -- and I've disconnected my cellular service. I want to be 
an efficient engine for getting things that matter to me and other people 
done, rather than go on being some tool used to ship lucrative enterprise 
crapware. 

So here's the $x question: what do you want me to do? I have a Raspberry Pi on 
order, so bonus points if you can work that in somehow.

The person with the best (realistic) idea will be credited for it. 

Inspire me! And thanks for reading all the way down to the bottom of this 
message. 

Casey
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Re: perform withArguments

2012-04-24 Thread Louis LaBrunda
Hi Bert,

Ah that's curious - your reply did not have a Re: and was not threaded with 
the original message. Would have saved me to write a message very similar to 
yours ;)
- Bert -

Sorry about that.  I don't like seeing all the Re: Re: filling up the
subject line often to the point where you can't see the real subject any
more, so I often remove it.

I use Forte Agent for email and news groups because it (by and large)
treats them the same and I can keep them all in one place.  I read the post
at and posted my reply to gmane.comp.lang.smalltalk.squeak.beginners.  With
Forte Agent, all the posts, including mine were in the same thread.  What
is also curious is that I also received a copy of your post (the one I am
replying to here) as an email but none of the other posts including your
other one.

I seem to get all the posts via the news group but only some of the emails.
I would rather I just get the news group posts but don't know how to turn
off the email copies.

Anyway, I will try to remember to leave one Re: in the future.  Although
I'm not sure why it is required to keep the thread together.  If anything,
having exactly the same subject line should keep post together better than
having to ignore a lot of Re:'s to fine the real subject.

Lou


On 23.04.2012, at 10:44, Louis LaBrunda wrote:

 Hi,
 
 For your example:
 
  cellObject cellLock: aBoolean
 
 where cellObject is to look like: cell1, cell2, cell3 ..., or cell9
 
 I don't think you want or need to use #perform:.  You use #perform: when
 you want to construct the message name and sent the constructed message
 name to an object.
 
 In your case you know the message you want to send, it is #cellLock:.  What
 you don't know (or have easily available) is the object you want to send
 the message to.
 
 What I think you need to do is save your cell objects in an array or
 collection (I will let you look up collections, but ask again if you need
 help).  With something like:
 
 cellObjects := OrderedCollection new.
 cellObjects add: YourCellClass new.
 
 Once you have a collection of your cells, you can access one or more of
 them and sent the #cellLock: message to it like so:
 
 (cellObjects at: cellNumber) cellLock: aBoolean
 
 Good luck and keep posting if you need help.
 
 Lou
 
 On Mon, 23 Apr 2012 07:58:47 -0700 (PDT), OrgmiGeek
 cool.origam...@gmail.com wrote:
 
 Hi,
 I've read the sparse documentation on 'dynamic message' calls and I've
 experimented a lot and still cannot figure out how to do something that
 should be simple:
 
 I want to build a message like this:
 
  cellObject cellLock: aBoolean
 
 where cellObject is to look like: cell1, cell2, cell3 ..., or cell9
 
 I can build up cellObject like this:
 
   self perform: ('cell', cellNumber asString) asSymbol
 
 but I can't figure out how to build the full message with the key selector
 cellLock:, and the value 'aBoolean'.
 I've tried everything I can think of based on the terse documentation, and
 anything I can find on the internet, which isn't much (including this
 forum).
 
 Any help would be appreciated.
 
 Thanks
 
 -
 ---
 Under the age of 15 so don't want to post my name :D
 ---
 Louis LaBrunda
 Keystone Software Corp.
 SkypeMe callto://PhotonDemon
 mailto:l...@keystone-software.com http://www.Keystone-Software.com
 
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Re: perform withArguments

2012-04-24 Thread Louis LaBrunda
Hi Dawson and Dawson's 15 year old son,

From your code below, I assume that somewhere in your program you have
created (instantiated) nine cells in instance variables named cell1-cell9.
This is fine but you should realize that they (cell1-cell9) are variables
that hold pointers to the objects and not really the objects themselves. It
is okay to think of them as the objects because for the most part it is
easier than thinking of them as pointers to objects.  The real point is to
realize that more than one variable can point to the same instance of an
object.  For example, if I were to write:

cell10 := cell1.

There would not be two copies of cell1, there would just be two pointers to
it.  Any messages sent to cell10 would effect cell1.  This can be
confusing, so I'm not recommending doing it exactly.  But putting the nine
cells in a collection is a good idea because it gives you another way to
get to the cells without using the original variables they were created in.

You ask about everything being an object is Smalltalk.  Yes everything is
an object.  You also ask if there is a way to construct the message with
the original variable names.  I don't know how to do it and don't think you
can with many Smalltalks.  Bert may know how to do it with Squeak.  Even if
Bert knows how, I wouldn't recommend it and I hope I'm not speaking out of
turn but I doubt Bert would recommend it either.  If it is doable, it's use
would be unusual and therefor confusing.  Even #perform: is seldom used by
most programmers and even less so by beginners.

Back to your program.  I assume that you have a good reason for putting the
cells in variables named (cell1-cell9) and again that is fine but there is
no reason why you can't have the same objects addressable or accessible
from a collection.

Smalltalk's collection classes are one of its many unknown treasures.  They
are a big part of why Smalltalk code is shorter and more understandable
than code of other languages.  Check them out.  And please keep asking
questions.

Lou

Hi,
actually, that is not quite what we want to do (we meaning my son and I
in our first squeak project).

Since we were unable to assemble the message, we ended up doing a
brute force method to get it to work:

lockCell: aBoolean row: aRow column: aColumn

   self addressToCellNumber: aRow and: aColumn
   this converts the big grid aRow, aCoulumn into a cellNumber
   
   (aBoolean isKindof: Boolean)
 ifTrue: [
  (cellNumber =1) ifTrue: [cell1 cellLock:aBoolean].
  (cellNumber =2) ifTrue: [cell2 cellLock:aBoolean].
  (cellNumber =3) ifTrue: [cell3 cellLock:aBoolean].
  (cellNumber =4) ifTrue: [cell4 cellLock:aBoolean].
  (cellNumber =5) ifTrue: [cell5 cellLock:aBoolean].
  (cellNumber =6) ifTrue: [cell6 cellLock:aBoolean].
  (cellNumber =7) ifTrue: [cell7 cellLock:aBoolean].
  (cellNumber =8) ifTrue: [cell8 cellLock:aBoolean].
  (cellNumber =9) ifTrue: [cell9 cellLock:aBoolean].
   ].

As you can see that is really repetitive. So, it seemed to us that one
should be able to dynamically build the message in one line,

that is why we tried to do something like:

 self perform: ('cell', cellNumber asString) asSymbol ... to build up
the cell1 ... cell9 object. But we couldn't figure out how to build up
the rest of the message.

(One solution which is possible was presented by Louis Labranda which
involves using an ordered collection ... that should work fine ... but
is there no way of building up the message similar to our attempt, but
expanding on it?  We thought that everything's an object in Squeak ...
what happened to that?)

Thanks,

Dawson (I'm the under 15 year old's father, and I don't mind my name
being published)






On 24/04/12 7:59 AM, Bert Freudenberg wrote:
 So if I understand correctly you want to do something equivalent to this:
 
  cell1 cellLock: true.
  cell2 cellLock: true.
  cell3 cellLock: true.
  ... etc ...
 
 Yes? If so, then perform is not what you are looking for. Perform lets you 
 assemble the message selector, but not the receiver of the message. The 
 Right Way to do this would be to have an Array of cells. Arrays are a 
 collection of objects, and individual objects can be accessed by index. So 
 if cells was an array of your cell objects, you could write
 
  (cells at: 1) cellLock: true.
  (cells at: 2) cellLock: true.
  (cells at: 3) cellLock: true.
  ... etc ...
  
 but also iterate over all of them:
 
  1 to: 10 do: [:i | (cells at: i) cellLock: true]
 
 Does that make sense?
 
 - Bert -
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners

[Newbies] Re: perform withArguments

2012-04-24 Thread Louis LaBrunda
Hi Dawson,

Snip...
Yes, I was using inexact language here (back to everything is an object
... are pointers in Squeak considered objects then? or is this a case of
something that isn't an object in Squeak?)

Well everything is an object in Smalltalk.  If you really had to you could
probably get to the pointer that is in the instance variable.  We should
stop talking about it as a pointer.  The only thing that cares it is a
pointer is the Smalltalk/Squeak VM (virtual machine - usually a C program).
The VM uses the pointer in the variable to find the data that is the
object.  It is much better to just think of the instance variables as the
objects as long as we remember that more than one instance variable can
address/access/point to the same object.

Spoiler alert:

I have written a Sudoku program and used many arrays to map the same cells
to make it easier to check the values of the cells.  One set of arrays
would map the nine columns of cells.  Another set of arrays maps the nine
rows of cells.  And another set to map the cells in a 3x3 block.  Each cell
is in more than one of the arrays.  And the might themselves be in arrays.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] perform withArguments

2012-04-23 Thread Louis LaBrunda
Hi,

For your example:

cellObject cellLock: aBoolean

where cellObject is to look like: cell1, cell2, cell3 ..., or cell9

I don't think you want or need to use #perform:.  You use #perform: when
you want to construct the message name and sent the constructed message
name to an object.

In your case you know the message you want to send, it is #cellLock:.  What
you don't know (or have easily available) is the object you want to send
the message to.

What I think you need to do is save your cell objects in an array or
collection (I will let you look up collections, but ask again if you need
help).  With something like:

cellObjects := OrderedCollection new.
cellObjects add: YourCellClass new.

Once you have a collection of your cells, you can access one or more of
them and sent the #cellLock: message to it like so:

(cellObjects at: cellNumber) cellLock: aBoolean

Good luck and keep posting if you need help.

Lou

On Mon, 23 Apr 2012 07:58:47 -0700 (PDT), OrgmiGeek
cool.origam...@gmail.com wrote:

Hi,
I've read the sparse documentation on 'dynamic message' calls and I've
experimented a lot and still cannot figure out how to do something that
should be simple:

I want to build a message like this:

   cellObject cellLock: aBoolean

where cellObject is to look like: cell1, cell2, cell3 ..., or cell9

I can build up cellObject like this:

self perform: ('cell', cellNumber asString) asSymbol

but I can't figure out how to build the full message with the key selector
cellLock:, and the value 'aBoolean'.
I've tried everything I can think of based on the terse documentation, and
anything I can find on the internet, which isn't much (including this
forum).

Any help would be appreciated.

Thanks

-
---
Under the age of 15 so don't want to post my name :D
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] ifTrue ifFalse help

2011-04-28 Thread Louis LaBrunda
Hi Rick,

6 // 2 results in an integer value of 3.  3 asCharacter results in a
character with a value of 3 but that is not the printable character of $3
which has an integer value of 51.  Try sending #inspect (like: 3
asCharacter inspect) to objects, it should help you see what/how things are
stored.

Lou

On Thu, 28 Apr 2011 09:26:34 -0400, Richard Wallace
rick.m.wall...@gmail.com wrote:

Thanks for all the feedback and analogies to Java.  In addition to the
original question...

Given:
| a b c |
a := 6 // 2.
b := a asCharacter.
c := b isMemberOf: Character.
Transcript show: 'Member of Char: ', c, '   b = ', b; cr.

Result:
Member of Char: true   b =

I was wondering why b is not getting displayed.

Thanks in advance!
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] ifTrue ifFalse help

2011-04-27 Thread Louis LaBrunda
On Wed, 27 Apr 2011 18:06:29 +0200, Mateusz Grotek

is a character a string?
in Smalltalk the answer is NO.

But of course in Smalltalk you can have a string with only one character in
it.  But:

$a is not equal to 'a'
$a is equal to 'a' first or 'a' at: 1.

Having a Character class in Smalltalk is valuable because there are
messages one might want to send to a character that wouldn't make sense
sending to a string, even one of length 1.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Teaching Smalltalk

2010-05-03 Thread Louis LaBrunda
Hi Samuel,

That link doesn't seem to work (whysmalltalk). Is there some problem on my 
end? I tried Google, but it also didn't show anything with that name..?

I think the link is actually http://whysmalltalk.com.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Teaching Smalltalk

2010-05-03 Thread Louis LaBrunda
Isn't that just some junk spam website?
Thanks
Samuel

It does look very different than what I remember but the links to Cincom
Smalltalk and VA Smalltalk are real and appear to be paid for, so it seems
real.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Defining a binary message selector

2009-11-16 Thread Louis LaBrunda
Hi Andy,

I may be way off in my understanding of what you are trying to do, if so I
apologize ahead of time.

It looks to me like you want to create a method that will answer the
Fibonacci value for a given number.  Hence your first attempt
Integerfibonacci: aNumber.  Where I expect you returned the Fibonacci
value of aNumber.  I think you then moved on to wanting to just a message
and not having to pass aNumber.

This lead to the next attempt with '+'.  This is where I think you went a
little wrong, '+' actually has a parameter.  It normally looks like
someNumber + aNumber or 2 + 3.  Others have suggested using something like
#fib, but didn't explain much more.  This is the way to go, unless you
really want to use some single character, which you could.

If you extend Integer with the #fib method (without the # and no parameter)
you should have what you want.  All you need to do is use the code you had
for Integerfibonacci: aNumber and everywhere you had aNumber, replace it
with self, you will be able to send the #fib message to any integer (like
5 fib) and get the Fibonacci value of the integer the #fib message was sent
to.

I will leave it to others to tell you how to use some special character to
replace #fib, if that is really what you want to do.

Have fun!

Lou

As an experiment, I tried to create a Fibonacci method for Integer.
Initially, I defined it as Integerfibonacci: aNumber. However, having
thought about it a bit more I realised that it should probably be a binary
message like '+'. I tried to create it as such, but Squeak wouldn't let me -
even when I copied the code from the '+' method.

After a bit of head scratching, I decided that '+' was probably a symbol,
and that binary messages are probably limited to using symbols as selectors.
However, I once arrived late to a baseball game (never having seen it played
before), got confused about which team was which, and invented an entirely
new scoring system that pretty much explained the results on the
scoreboard.  So, I may be completely wrong about binary selectors!

If I am right about them requiring to be symbols.  Would it be a good idea
for meto make 'fibonacci' a symbol as well? Or would that lead to unintended
problems down the road?

Cheers
Andy
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Help me on Squeak

2009-03-11 Thread Louis LaBrunda
Hi Pedro Pereira

Greetings,
It must be me... I started in squeak today, and have been the last 5 hours
(maybe a little more) trying to understand it. I am just tired and going
nowere :-(
Who can help me, please,  in a very small and simple project in squeak?

This sounds like it may be a request for help with a school project, if so,
we try not to do projects for students, if it isn't, my apologies.  At any
rate, if you can formulate a more specific question, I'm sure someone will
try to answer it.

Lou

I can send what I have made and maybe someone can please help on the rest?
Thanks... all the way from Portugal
 
 
·´¨¨)) -:¦:-
¸.·´ .·´¨¨)) 
((¸¸.·´ ..·´ Pedro Amorim Pereira -:¦:-
-:¦:- ((¸¸.·´-:¦:- virtuald...@hotmail.com

 




_
Windows Live Messenger. O melhor em multitarefa.
http://www.microsoft.com/windows/windowslive/products/messenger.aspx
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:l...@keystone-software.com http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Windows

2008-08-18 Thread Louis LaBrunda
Also if you start here:

http://www.instantiations.com/VAST/index.html

I think you can find a download that is free to develop with and pay for when
you sell your program.  I am not sure about making programs for your personal
use or a company making programs for their internal use.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[EMAIL PROTECTED] http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: is 0.1 a Float or a ScaledDecimal ?

2008-02-20 Thread Louis LaBrunda
I have another interrogation. Please take it as a student/newbie
whatever question.

I think 0.1 should be considered as a ScaledDecimal so that we could
write 0.1 asFraction and have 1/10...


What you desire is admirable but no longer practical as it would break a great
many existing programs.  In the begriming data types were closely tied to what
the hardware supported.  Most early computers supported integers (small
integers, not the long kind that we have in Smalltalk) and maybe some form of
floating point numbers and some form of decimals.  Things weren't very standard
between different manufactures computers.  After a while, computers supported
integers, floating point numbers and IBM mainframes had packed decimal numbers
(in the hardware) that are a lot like ScaledDecimal numbers, they were used a
lot in COBOL.

So, most languages took 0.1 to be a floating point number.  When Smalltalk came
along, it followed in that tradition.  Smalltalk added 0.1s1as a ScaledDecimal
number and 1/10 as a fraction.  They are both implemented as a mix of software
and hardware and not mapped directly to hardware.

Lastly, I would point out that in Smalltalk when you say 1/10 you get an
instance of a fraction and not an instruction to divide 1 by 10.  Therefore, you
don't need to say 0.1 asFraction or 0.1s1 asFraction to get 1/10 as an instance
of Fraction.

Lou
---
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[EMAIL PROTECTED] http://www.Keystone-Software.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners