How do you copy in the Squeak browser? I'll post it when I learn how.
Offline
SeptimusHeap wrote:
Is there any way to make a repeat command in Smalltalk?
I found out how to do repeats!
10 timesRepeat: [Transcript show: 'hi']
NOTE: You will nead to open the transcript to see the result.
Offline
SeptimusHeap wrote:
Math, do you know of a smalltalk repeat command?
either do: or whileTrue: are the most useful
do syntax:
| someTemp |
someTemp _ Dictionary new.
someTemp at: 'a' put: 1.
someTemp at: 'b' put: 2.
someTemp do: [:tempItem |
someCodeOrSomething].
whileTrue syntax:
| someTemp |
someTemp _ 10.
(someTemp >= 0) whileTrue: [someCodeOrSomething].
Sperry wrote:
I thought of something while looking at the source code:
I found an old hat block and for some things I thought it might be useful. The block is:
('When' #W #-) OR ('When W -)<-(for source code users). It displays "When <> is true"
I am adding this in my 'Roar' and I thought you might like to know about it to. I don't think anybodys ever mentioned anything about this block before!
Yea, I found that buried in the source, too. Did you notice the commented block spec in the Stage's blockSpecs with x's next to it? It has a VERY strange function.... try it out.
I'm not sure I like that hat block, because you can accomplish it with a forever if, and it's also supposedly obsolete.
sparks wrote:
Sperry wrote:
Are you going to use it though?
Dunno, it would be useful, I'm sure, and even if it wasn't used, I've never EVER used the "forever if" block, so it might as well be there. nXIII's putting the blocks in, so I'll try and grab his attention and see what NXIII thinks.
I was .... asleep. I can't read stuff while sleeping.
SeptimusHeap wrote:
How do you copy in the Squeak browser? I'll post it when I learn how.
Alt + normalKey (as in Alt+S = save, Alt+C = copy, Alt+V = paste, etc.)
Sorry about missed suggestions... I was working on this:
And trying to solve the presentation mode problem....
The main problem is that the ScratchFrameMorph deletes itself in presentation mode and nothing ScratchFrame-related works (basically, everything)
Last edited by nXIII (2010-04-11 10:34:16)
Offline
nXIII wrote:
Sperry wrote:
I thought of something while looking at the source code:
I found an old hat block and for some things I thought it might be useful. The block is:
('When' #W #-) OR ('When W -)<-(for source code users). It displays "When <> is true"
I am adding this in my 'Roar' and I thought you might like to know about it to. I don't think anybodys ever mentioned anything about this block before!Yea, I found that buried in the source, too. Did you notice the commented block spec in the Stage's blockSpecs with x's next to it? It has a VERY strange function.... try it out.
I'm not sure I like that hat block, because you can accomplish it with a forever if, and it's also supposedly obsolete.
I see your point, and I did find that in the source but havent tried it. Will do soon though! Thanks for that!
Old question: Wheres ScratchSkin located?
Offline
sparks wrote:
guys, the panther zip file is updated! (new password I handed out) quick link to save you gonig back:Panther
Could I have a copy please? I have helped a lot - im stuck with a abeta copy - the very first one."
Thanks
Offline
I get this error from whiletrue.
(t2 >= 0) whileTrue: [^t2 _ t2 - 1 <- receiver of whileTrue: must be a block or variable ->].
Offline
SeptimusHeap wrote:
I get this error from whiletrue.
Code:
(t2 >= 0) whileTrue: [^t2 _ t2 - 1 <- receiver of whileTrue: must be a block or variable ->].
Sorry, my mistake; it should be:
[t2 >= 0] whileTrue: []
but you do realize that the ^ returns a value and ends the code, right? You can't loop with it >.>
Offline
SeptimusHeap wrote:
I get this error from whiletrue.
Code:
(t2 >= 0) whileTrue: [^t2 _ t2 - 1 <- receiver of whileTrue: must be a block or variable ->].
I think it's trying to tell you that the -1 needs to be a variable e.g: ^t2 _ t2 - t3.
Try declaring a temp variable and then putting that in. Set the variable to 1.
Hope this helps!
Offline
Ok... whats changed?
Offline
Help with this:
listaverage: t1 | t2 t3 t4 | t2 _ t1 lineCount. t3 _ 0. t4 _ 1. [t2 >= 0] whileTrue: [t2 _ t2 - 1. t3 _ t3 + lineAt: (self lineNum: t4 forList: t3). t4 _ t4 + 1.]
Offline
NXIIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXII er, you know that's not password protected, right?NXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXIINXII
Offline
SeptimusHeap wrote:
Help with this:
Code:
listaverage: t1 | t2 t3 t4 | t2 _ t1 lineCount. t3 _ 0. t4 _ 1. [t2 >= 0] whileTrue: [t2 _ t2 - 1. t3 _ t3 + lineAt: (self lineNum: t4 forList: t3). t4 _ t4 + 1.]
Is it something to do with the blocks I suggested earlier?
Offline
Two things: Found an error/glitch
1. When you try to open more than 1 panther you get this error:
And
2. Whats the point of all those colour blocks? (P.s. you spelt colour wrong on the tabs. )
Offline
Sperry wrote:
SeptimusHeap wrote:
Help with this:
Code:
listaverage: t1 | t2 t3 t4 | t2 _ t1 lineCount. t3 _ 0. t4 _ 1. [t2 >= 0] whileTrue: [t2 _ t2 - 1. t3 _ t3 + lineAt: (self lineNum: t4 forList: t3). t4 _ t4 + 1.]Is it something to do with the blocks I suggested earlier?
Yes. It SHOULD add all numbers in a list.
Then I'm going to divide it by the list length. DUHDUH! Average!
Offline
SeptimusHeap wrote:
nXIII: Did you get my new blocks?
R
E
A
D
T
H
I
S
!
Bee U Em. Pea?
Offline
SeptimusHeap wrote:
Sperry wrote:
SeptimusHeap wrote:
Help with this:
Code:
listaverage: t1 | t2 t3 t4 | t2 _ t1 lineCount. t3 _ 0. t4 _ 1. [t2 >= 0] whileTrue: [t2 _ t2 - 1. t3 _ t3 + lineAt: (self lineNum: t4 forList: t3). t4 _ t4 + 1.]Is it something to do with the blocks I suggested earlier?
Yes. It SHOULD add all numbers in a list.
Then I'm going to divide it by the list length. DUHDUH! Average!
And it'll be an error is there is a letter in that list. Plus, i thought it was a
average of _ to _ in [list↓] was it not? So it has to work out the average of the amount of items i.e. the difference between start and finish.
Offline
SeptimusHeap wrote:
Sperry wrote:
SeptimusHeap wrote:
Help with this:
Code:
listaverage: t1 | t2 t3 t4 | t2 _ t1 lineCount. t3 _ 0. t4 _ 1. [t2 >= 0] whileTrue: [t2 _ t2 - 1. t3 _ t3 + lineAt: (self lineNum: t4 forList: t3). t4 _ t4 + 1.]Is it something to do with the blocks I suggested earlier?
Yes. It SHOULD add all numbers in a list.
Then I'm going to divide it by the list length. DUHDUH! Average!
Can you run me through what it does? Then I'll understand it better and be able to help you.
@markyparky:
Yes, but there was also "average of items in list [list]"
Offline
markyparky56 wrote:
SeptimusHeap wrote:
Sperry wrote:
Is it something to do with the blocks I suggested earlier?Yes. It SHOULD add all numbers in a list.
Then I'm going to divide it by the list length. DUHDUH! Average!And it'll be an error is there is a letter in that list. Plus, i thought it was a
average of _ to _ in [list↓] was it not? So it has to work out the average of the amount of items i.e. the difference between start and finish.
Well, this will let you find the mean of any size data set.
Offline
Sperry wrote:
@markyparky:
Yes, but there was also "average of items in list [list]"
So there is going to be both...
Offline