Levente Uzonyi uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-ul.112.mcz
==================== Summary ====================
Name: Files-ul.112
Author: ul
Time: 3 August 2011, 1:44:29.679 am
UUID: 5409c0c6-6b2b-bc4f-9a69-edc3b16dfbbc
Ancestors: Files-ul.111
Removed unnecessary blocks.
=============== Diff against Files-ul.111 ===============
Item was changed:
----- Method: FileDirectory>>entryAt:ifAbsent: (in category 'file status') -----
entryAt: fileName ifAbsent: aBlock
"Find the entry with local name fileName and answer it.
If not found, answer the result of evaluating aBlock."
| comparisonBlock |
self isCaseSensitive
ifTrue: [comparisonBlock := [:entry | entry name = fileName]]
ifFalse: [comparisonBlock := [:entry | entry name sameAs: fileName]].
+ ^ self entries detect: comparisonBlock ifNone: aBlock!
- ^ self entries detect: comparisonBlock ifNone: [aBlock value]!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.452.mcz
==================== Summary ====================
Name: Collections-ul.452
Author: ul
Time: 3 August 2011, 1:43:28.439 am
UUID: 41117943-c9ee-8142-ae4f-908517bf8352
Ancestors: Collections-ul.451
Removed unnecessary blocks.
=============== Diff against Collections-ul.451 ===============
Item was changed:
----- Method: RunArray>>mapValues: (in category 'private') -----
mapValues: mapBlock
"NOTE: only meaningful to an entire set of runs"
+
+ values := values collect: mapBlock!
- values := values collect: [:val | mapBlock value: val]!
Levente (and all),
what do you think about implementing SequenceableCollection>>polynomialEval:
as follows:
SequenceableCollection>>polynomialEval: thisX
self reverse inject: 0 into: [:sum :each | thisX * sum + each]
The above version uses Horner's rule [1] and reads simpler IMHO.
Of course reverse is needed only because the convention is to have
the constant term as first in the list, should it be the other way around
we could save a copy of the collection.
(In my image (little more than trunk) there are only 2 senders of
polynomialEval:
so maybe a change of semantics could be proposed to get rid of reverse...)
Hope it helps
Bye
Enrico
[1] Horner's rule/scheme http://en.wikipedia.org/wiki/Horner_scheme
On Mon, Jul 25, 2011 at 11:21, <commits(a)source.squeak.org> wrote:
> Levente Uzonyi uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-ul.450.mcz
>
> ==================== Summary ====================
>
> Name: Collections-ul.450
> Author: ul
> Time: 25 July 2011, 1:37:20.234 am
> UUID: 2d09bd44-bfdf-1840-87cb-81ced69f9948
> Ancestors: Collections-nice.449
>
> Avoid a multiplication, use low level methods in
> SequenceableCollection >> #polynomialEval: for better performance.
>
> =============== Diff against Collections-nice.449 ===============
>
> Item was changed:
> ----- Method: SequenceableCollection>>polynomialEval: (in category 'enumerating') -----
> polynomialEval: thisX
> - | sum valToPower |
> "Treat myself as the coeficients of a polynomial in X. Evaluate it with thisX. First element is the constant and last is the coeficient for the highest power."
> " #(1 2 3) polynomialEval: 2 " "is 3*X^2 + 2*X + 1 with X = 2"
>
> + | size sum valToPower |
> + sum := self at: 1.
> + (size := self size) = 1 ifTrue: [ ^sum ].
> - sum := self first.
> valToPower := thisX.
> + 2 to: size - 1 do: [ :ind |
> - 2 to: self size do: [:ind |
> sum := sum + ((self at: ind) * valToPower).
> + valToPower := valToPower * thisX ].
> + ^sum + ((self at: size) * valToPower)!
> - valToPower := valToPower * thisX].
> - ^ sum!
>
>
>
--
Enrico Spinielli
"Do Androids dream of electric sheep?"— Philip K. Dick
"Hear and forget; see and remember;do and understand."—Mitchel Resnick
I have released a first version of my first Chalk Dust book, "How to Make a
Chalk Dust Morphic Book." This book makes a reference to my next book, which
describes using the Squeak mouse. That should be done soon. The intended
audience for this book is a teacher or college student who is at least a
beginner at using Squeak -- this book does not teach someone how to use
Squeak, but it does focus on fundamentals relavent to using a book morph.
The intended audience for Chalk Dust books are students at the middle and
high school level, say 14 - 18 years old. An older demographic than OLPC.
One of the goals for this effort is to use Squeak "out of the box." I
realize that to you folks, a little code here and there is easy. Picture an
alternative to PowerPoint and you will be close to what I have in mind. As
an author gains experience with Squeak they should be able to create
increasingly fancy books.
If anyone has some time (ha ha) I would appreciate any and all comments,
starting with spelling and grammer and going up from there as far as you
like. After I have had time to incorporate your suggestions I will make a
formal announcement on the Open Slate web site and mailing list.
Read about the new book on the wiki:
http://wiki.openslate.net/mediawiki/index.php?title=Chalk_Dust_Applications…
Link to the project file:
http://www.aloha.com/~knowtree/openslate/projects/ChalkDust_MakingAMorphicB…
In closing let me say thanks to all of you who have responded to my
queations here.
--
Gary Dunn
Open Slate Project
Honolulu
Wow, great improvements.
On Wed, 3 Aug 2011, commits(a)source.squeak.org wrote:
> Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-nice.560.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-nice.560
> Author: nice
> Time: 4 August 2011, 12:13:33.583 am
> UUID: f816651e-2c1a-402f-b4be-d7fc194061a0
> Ancestors: Morphic-nice.559
>
> Correct forwardDelete: that I just broke.
> Note that (cmd+z) fail to undo this action. I think it was previously the case before I changed anything.
I think it would be better to leech the undo framework from Pharo. Having
"infinite" undo/redo is better than just a single (and sometimes broken)
undo/redo which is (guess what) global...
Levente
>
> =============== Diff against Morphic-nice.559 ===============
>
> Item was changed:
> ----- Method: TextEditor>>forwardDelete: (in category 'typing/selecting keys') -----
> forwardDelete: aKeyboardEvent
> "Delete forward over the next character.
> Make Undo work on the whole type-in, not just the one char.
> wod 11/3/1998: If there was a selection use #zapSelectionWith: rather than #backspace: which was 'one off' in deleting the selection. Handling of things like undo or typeIn area were not fully considered."
> | startIndex usel upara uinterval ind stopIndex |
> startIndex := self markIndex.
> startIndex > self text size ifTrue: [
> ^ false].
> self hasSelection ifTrue: [
> "there was a selection"
> self zapSelectionWith: self nullText.
> ^ false].
> "Null selection - do the delete forward"
> beginTypeInIndex ifNil: [ "no previous typing. openTypeIn"
> self openTypeIn. UndoSelection := self nullText].
> uinterval := UndoInterval copy.
> upara := UndoParagraph copy.
> stopIndex := startIndex.
> (aKeyboardEvent keyValue = 127 and: [ aKeyboardEvent shiftPressed ])
> + ifTrue: [stopIndex := (self nextWord: stopIndex) - 1].
> - ifTrue: [stopIndex := (self nextWordStart: stopIndex) - 1].
> self selectFrom: startIndex to: stopIndex.
> self replaceSelectionWith: self nullText.
> self selectFrom: startIndex to: startIndex-1.
> UndoParagraph := upara. UndoInterval := uinterval.
> UndoMessage selector == #noUndoer ifTrue: [
> (UndoSelection isText) ifTrue: [
> usel := UndoSelection.
> ind := startIndex. "UndoInterval startIndex"
> usel replaceFrom: usel size + 1 to: usel size with:
> (UndoParagraph text copyFrom: ind to: ind).
> UndoParagraph text replaceFrom: ind to: ind with: self nullText]].
> ^false!
>
>
>
Changes to Trunk (http://source.squeak.org/trunk.html) in the last 24 hours:
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004885.html
Name: Tools-fbs.372
Ancestors: Tools-bf.371
When you rename a system category, you should have the newly-named system category selected after the rename.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004886.html
Name: ST80-nice.131
Ancestors: ST80-cmm.130
cosmetic: use self normalCharacter: rather than self perform: #normalCharacter:
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004887.html
Name: Morphic-nice.558
Ancestors: Morphic-ul.557
ParagraphEditor is an old st-80 class implemented for a polling UI via the use of sensor inst. var..
TextMorphEditor is a glue that enable using a ParagraphEditor in an event driven morphic world.
There was a hack for feeding a sensor fake with morphic events.
This hack was located in TextMorph.
When 100% morphic Cuis-designed TextEditor was introduced in Squeak-trunk, it was made sensor-dependent instead of sensor-less and purely event driven. This should not be so.
This version moves the hack where in belongs to, in TextMorphEditor>>fakeSensorWithEvent:
It also temporarily duplicates it in TextEditor, in the interim before we remove it's sensor inst. var..
NOTE 1: the hack did also previously apply to #mouseUp: #mouseDown: #mouseUp: events.
It does not anymore because I saw no use to it.
If I'm wrong, correct it by sending (self fakeSensorWithEvent: anEvent) in the TextMorphEditor implementation of these messages.
NOTE2: the change does not change the behaviour of MVC projects. Keyboard typing still "works" (cough...)
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004888.html
Name: ST80-nice.132
Ancestors: ST80-nice.131
Let old Paragraph respond to #string like NewParagraph.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004889.html
Name: Morphic-nice.559
Ancestors: Morphic-nice.558
Let TextEditor be event driven and let us ban sensor usage from it.
Details:
I tried to apply Cuis 3.3 methods where possible and kept Squeakism where necessary.
There are unused methods that crept into the Editor classes, but we'll see later about further convergence with Cuis or not...
Like Cuis, I renamed ivar beginTypeInBlock -> beginTypeInIndex because this is an Integer index, not a CharacterBlock.
Code is already long enough to avoid such traps.
I also removed sensor and the structure of the TextEditor did change a lot. So it's hard to say if code is reloadable... The inbox will be a test place.
Like Cuis I removed the typeAheadStream which was useless already since we recompose after each key stroke.
Instead of such stream, the keyboard event is passed as argument to editing methods.
Some small divergences:
I did not define TextEditor>>#processKeyboardEvent: but TextEditor>>#keyStroke:
My rationale was that mouseUp: mouseDown: and mouseMove: were not renamed, so why renaming keyStroke: ?
On the other hand, it would be easier to follow code with different selectors, and maybe also good for a VM to reduce unecessary polymorphism.
I did not define TextEditor>>#dispathOn: but TextEditor>>#dispatchOnKeyboardEvent:
I felt this was more clear... less unecessary polymorphism. My mood was changing ;)
These above two behaviours have not been unified (Cuis only deal with 256 characters and can offer a dispatch table for all characters, we can't).
Unlike Cuis I did not implement multi selection (?).
I also kept the oldInterval and otherInterval ivars because I don't know if I can touch them.
I also kept selectionShowing because I'm totally unaware of these details.
I did not yet imported the SimpleEditor.
Thanks to Juan for leading the process, and cross the fingers to see if update is possible or require intermediate stages.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004890.html
Name: Morphic-nice.560
Ancestors: Morphic-nice.559
Correct forwardDelete: that I just broke.
Note that (cmd+z) fail to undo this action. I think it was previously the case before I changed anything.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004891.html
Name: Morphic-nice.561
Ancestors: Morphic-nice.560
Always try to logDebuggerStackToFile first if Preferences is enabled, and discard Errors occuring in this phase.
That can help debugging the emergency situations when the debugger fail to open itself.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004892.html
Name: ST80-nice.133
Ancestors: ST80-nice.132
Always try to logDebuggerStackToFile first if Preferences is enabled, and discard Errors occuring in this phase.
That can help debugging the emergency situations when the debugger fail to open itself. ESPECIALLY IN MVC CASE...
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004893.html
Name: Morphic-nice.562
Ancestors: Morphic-nice.561
Restore correct behaviour of selecting between delimiters when clicking twice.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-August/004894.html
Name: Morphic-nice.563
Ancestors: Morphic-nice.562
Also select between vertical bars when clicking twice.
=============================================