0

can anybody give some hints on squeaksource or things like that, they can provide mcz sample code focuse on simple add, reduce, multiplication, division calculation?

Frank Shearar
  • 17,012
  • 8
  • 67
  • 94
parsifal
  • 879
  • 4
  • 12
  • 21

3 Answers3

3

http://www.world.st/ is an awesome access point for all things Smalltalk. It has links to many free books, including Stephan's excellent suggestion. There are also links to many Smalltalk mailing lists, like the Squeak beginners list, where you can get many basic (and not so basic) questions answered.

It's hard to answer very general questions (like yours). If you are more specific, you'll get better answers. Especially if you try something on your own first and then explain what you did and where you got stuck.

UPDATE:

It seems you're asking if you can see what's going on behind the scenes when code is executed. In the Browser, you can choose to see the bytecodes that it's compiled into.

In your (1+2) * 3 example, if you save this in a method, and click the "source" button in the Browser ("view" in OmniBrowser), and choose "byteCodes", you will see:

17 <76> pushConstant: 1
18 <77> pushConstant: 2
19 <B0> send: +
20 <20> pushConstant: 3
21 <B8> send: *
22 <87> pop
23 <78> returnSelf
Sean DeNigris
  • 6,306
  • 1
  • 31
  • 37
  • thanks friend :) Suggesting I am using Squeak4.1, I open Transcript, and enter " (1+2) * 3" the result is 9 immediately after enter Ctrl+ p. Now the question is: Can I get the code for doing this simple calculation? I guess the calculating code also be implemented in small talk, right? so I can simulate the calculate code, – parsifal Feb 12 '11 at 08:55
  • Is there exsiting binary tree analysis for simple equation's Reverse Polish Notation? – parsifal Feb 12 '11 at 09:05
  • when refered to simple calculation, Kernel-Numbers category's Integer Class, protocol is arithmetic which I wanner to find, there exits method * +- / etc.like this – parsifal Feb 14 '11 at 06:03
  • @parsifal, from your first comment in here, I think you want to Debug the code instead of just running it. Try debugging it (it's in the context menu, and I think CTRL+D may be the shortcut), it will show you every method that gets executed for each message you send. – mgarciaisaia Apr 21 '13 at 23:22
2

Did you already read Squeak by Example?

Stephan Eggermont
  • 15,847
  • 1
  • 38
  • 65
1

While its not really sample code, my video tutorial series, Squeak from the very start, may give you insights: http://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=viewall

Saijanai
  • 133
  • 2