Login  Register

Re: how can I improve this

Posted by Pharo Smalltalk Users mailing list on Sep 15, 2020; 4:59am
URL: https://forum.world.st/how-can-I-improve-this-tp5121828p5121867.html

Op 14-9-2020 om 22:19 schreef Hernán Morales Durand:
^ (1 to: self size) count: [ : i | (self at: i) ~= (aString at: i) ]


With that code I get a few problems but this is working

distanceStrand1: aString strand2: aString2
    aString size == aString2 size
        ifFalse: [ DomainError signal: (self messageFor: aString strand2: aString2) ].
    ^ (1 to: aString size)
        count: [ :i | (aString2 at: i) ~= (aString at: i) ]

Roelof