Implementation of a For loop inside other for loop

Viewed 51

Here is my code. I have a collection that contains my instance variables

var:= Person instVarNames.
 
 anorderedCollection -> (#name #lastname #birthday)

Person is a class

And I also recover the methods that are in the Procol accessing

``` mySetter:= Person selectorsInProtocol: #'accessing'.```
an Array [6 items] (#birthdate #birthdate: #LastName #LastName: #Name #Name :)```

Now, I would like to divide the elements in mysetter for two tables of the genre:

    getter -> #( #name #lastname #birthday) and setter -> #( #name: #LastName: #birthday :)

My loops:

(var collect: [:i | t add: i]).
   (t) do: [: i |
        (mySetter) collect: [: j |
            i == j ifTrue: [getter add:j] ifFalse: [setter add:j] 
        ]
    ]. 

But getter gives this:

(#name #lastName #birthDate)

that's what I want.

The problem is at the level of setter: (#birthdate #birthdate: #LastName #LastName: #Name: #Birthdate #Birthdate: #LastName: #Name #Name: #Birthdate: #LastName #LastName: #Name #Name: )

0 Answers
Related