Getting Squeak to write Squeak -- LISPY-- a progress report

mwgrant2001 mwgrant2001 at yahoo.com
Sat Nov 22 02:21:53 UTC 2003


This is just a quick update on getting Squeak to write  (execute 
Squeak.) First, I really appreciate all of the suggestions. Most lead 
to some interesting side journeys with the code and I learned some 
this week and made one of those 'jumps up' we have where on a 
learning curve. I still want to pursue some the suggested approaches 
(that I didn't get to work). 

The air cleared when I had two thoughts as a result of 
the 'collective' responses. First, I had the realization I should not 
try to do things in a workspace, but should do them from the safe 
confines of an object--an object or agent at the defined in the 
workspace--that has all the relevant information I need in its 
instance variables. And with one of those variables being a 
dictionary holding my node names. The second thought was to use the 
dictionary as an instance variable of the top-level agent. All 
commands or interations are communication to the agent which the does 
what ever it needs to. Yet I can use descriptive references, i.e., 
meaningful in the specific problem context. 

Still far to go but below is an interaction sequence. I will include 
a fileOut and documentation with rationale later. This is still in 
its nascent stages. The stuff below just shows how it looks. 
Eventually of course I will want to make the interaction graphical. 

You got me going...thanks.

Snippet (annotated)
myAnalysis  _  Analysis new.

myAnalysis initialize.
myAnalysis baseNodes. a Dictionary()  ...Empty here

myAnalysis addNode.   ...adding 'gwVelocity' by FillInTheBlankMorph   
myAnalysis addNode.   ...adding 'releaseRate' ...              
myAnalysis addNode.   ...adding 'sorption' ...     
           
myAnalysis baseNodes.   a Dictionary('gwVelocity'->a 
DANode 'releaseRate'->a DANode 'sorption'->a DANode )  

gwVelocity. nil    ...'gwVelocity' doesn't exist outside of myAnalysis

myAnalysis getNode: 'gwVelocity'.  a DANode   
     
(myAnalysis getNode: 'gwVelocity') getBranches.  nil  ...not yet 
defined...

(myAnalysis getNode: 'gwVelocity') setBranches: #
('low'  'moderate'  'high').  ...set nodes branches at node level...

(myAnalysis getNode: 'gwVelocity') getBranches. #
('low' 'moderate' 'high')   ... or at Analysis level...

"Or set branches at Analysis level  (using a little sugaring)"
myAnalysis setBranchesFor: 'releaseRate' to: #
('slow'  'moderate'  'fast').

(myAnalysis getNode: 'releaseRate') getBranches. #
('slow' 'moderate' 'fast')


"Or use a FillInTheBlankMorph..."
myAnalysis setBranchesFor: 'sorption' to: (((FillInTheBlankMorph 
request: 'Enter branch names') findTokens: ' ') asArray).

(myAnalysis getNode: 'sorption') getBranches.   #
('noSorption' 'lowKd' 'mediumKd' 'highKd')


myAnalysis selectBranchOf:  'gwVelocity'. 'moderate'
  here a menu of branch names is popped, etc.  'moderate' was selected

That particular method looks like:
 
selectBranchOf: nodeName 
"The receiver (anAnalysis) pops a menu of branch names for 
node 'nodeName' and
 returns the selected branch name as a string - mwg "
       |aMenu|
       aMenu := SelectionMenu 
		labelList: ((self getNode:nodeName) getBranches)
                selections:  ((self getNode: nodeName) getBranches).
        ^ aMenu startUpWithCaption: 'Choose a branch for 
editing'       
   


Regards,
Mike




More information about the Squeak-dev mailing list