Cool

I will add it to my collection of solutions and I guess that this one is the fastest but I should check first :)


Le 11/11/16 à 00:23, Henrik Nergaard a écrit :
String>>isIsogram

        1 to: self size -1 do: [ :ix |
                (self
                        findString: (self at: ix) asString
                        startingAt: ix +1
                        caseSensitive: false
                ) ~~ 0 ifTrue: [ ^ false ]      
        ].

        ^ true

-----Original Message-----
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Sven Van Caekenberghe
Sent: Thursday, November 10, 2016 11:10 PM
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Subject: Re: [Pharo-users] Little challenges for a friday evening

[ :string | string size = string asSet size ] value: 'Pharo'.

true
[ :string | string size = string asSet size ] value: 'Pharoo'.

false
String>>#isIsogram
   ^ self size = self asSet size

?

On 10 Nov 2016, at 22:19, stepharo <steph...@free.fr> wrote:

Hi

I'm checking how I would implement an isogram checker

'Pharo' isogram

true
because it contains only single letter.

I got a stupid bag drivent implementation but I will do another better and 
faster.

Stef

PS: after I will do anagram and pangram to have the family of gram checks (this 
is for a book).







Reply via email to