#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Thu, 03 Nov 2016 22:37:24 +0100
changeset 5945 de97bfa91a3a
parent 5944 185bccebb1ce
child 5946 109da6018257
#REFACTORING by cg class: Workspace added: #rememberResultAsWorkspaceVariable:
Workspace.st
--- a/Workspace.st	Thu Nov 03 15:40:29 2016 +0100
+++ b/Workspace.st	Thu Nov 03 22:37:24 2016 +0100
@@ -484,6 +484,24 @@
     "Created: / 20-04-2005 / 11:57:53 / cg"
 !
 
+rememberResultAsWorkspaceVariable:lastResult
+    "remember some last result as _0,
+     and shift the previous results (i.e. _0 -> _1 -> .. _9)"
+
+    |workspaceVariables|
+
+    workspaceVariables := self workspaceVariables.
+    
+    9 to:1 by:-1 do:[:h|
+        (workspaceVariables includesKey:('_%1' bindWith:h-1)) ifTrue:[
+            workspaceVariables 
+                    at:('_%1' bindWith:h)
+                    put:(workspaceVariables at:('_%1' bindWith:h-1)).
+        ].
+    ].
+    workspaceVariables at:'_0' put:(ValueHolder with:lastResult).
+!
+
 removeAllWorkspaceVariables
     "delete all workspace variables"