MethodFinder.st
changeset 4506 832c195c3dc4
parent 4505 525d1fd161ed
child 4507 8e9331873563
--- a/MethodFinder.st	Tue Oct 01 08:49:33 2019 +0200
+++ b/MethodFinder.st	Tue Oct 01 10:53:35 2019 +0200
@@ -260,7 +260,7 @@
     "Return true if all answers and all data are numbers."
 
     (answers conform:#isNumber) ifFalse: [^ false].
-    thisData do: [:vec |
+    thisData do:[:vec |
          (vec conform:#isNumber) ifFalse: [^ false].
     ].
     ^ true
@@ -451,6 +451,22 @@
     ^ ddd
 !
 
+copy:aMethodFinder
+    data := aMethodFinder data copy.
+    answers := aMethodFinder answers copy.
+    argMap := aMethodFinder argMap copy.
+    thisData := aMethodFinder thisData copy.
+    expressions := aMethodFinder expressions copy.
+    selector := aMethodFinder selectors copy.
+
+    "
+     |m1 m2|
+
+     m1 := MethodFinder new.
+     m2 := MethodFinder new copy:m1  
+    "
+!
+
 initialize
     "The methods we are allowed to use.  (MethodFinder new initialize) "
         Approved := Set new.
@@ -1588,6 +1604,10 @@
          (data1 >= C) 
          (data1 mod C)"
 
+     "/ cg: does not work, because copy:/addArg: is not implemented correctly;
+     "/ needs a fix.
+     ^ self.
+
         thisData size >= 2 ifFalse: [^ self].           "need 2 examples"
         (thisData at: 1) size == 1 ifFalse: [^ self].   "must have only one arg, data1"
 
@@ -1607,6 +1627,7 @@
 
 search: multi
     "if Multi is true, collect all selectors that work."
+
     | old |
 
     selector := OrderedCollection new.       "list of them"