Re: [Pharo-users] mentor question 2.

2020-04-28 Thread Richard O'Keefe
String>> isValidBinary ^self allSatisfy: [:each | each = $0 or: [each = $1]] binaryToDecimal "The caller should ensure that self isValidBinary before calling this." ^self inject: 0 into: [:acc :each | acc*2 + (each codePoint - $0 codePoint)] On Mon, 27 Apr 2020 at 06:05, Roe

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread Richard Sargent
On Sun, Apr 26, 2020 at 10:11 AM Roelof Wobben via Pharo-users < pharo-users@lists.pharo.org> wrote: > Hello, > > I have to make some code that convert a binary to a decimal and im not > allowed to use the convert methods that Pharo has. > > So I have written this : > > > decimalFromBinary: aStrin

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread Roelof Wobben via Pharo-users
  From: Pharo-users On Behalf Of Roelof Wobben via Pharo-users Sent: 27 April 2020 12:23 To: pharo-users@lists.pharo.org Cc: Roelof Wobben Subject: Re: [Pharo-users] mentor question 2

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread PBKResearch
On Behalf Of Roelof Wobben via Pharo-users Sent: 27 April 2020 12:23 To: pharo-users@lists.pharo.org Cc: Roelof Wobben Subject: Re: [Pharo-users] mentor question 2. Op 27-4-2020 om 13:16 schreef PBKResearch: Roelof You maybe have enough mentors already, but there are some important featur

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread Roelof Wobben via Pharo-users
.   Peter Kenny   From: Pharo-users On Behalf Of Roelof Wobben via Pharo-users Sent: 26 April 2020 19:52 To: pharo-users@lists.pharo.org Cc: Roelof Wobben Subject: Re: [Pharo-users

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread PBKResearch
this is helpful. Peter Kenny From: Pharo-users On Behalf Of Roelof Wobben via Pharo-users Sent: 26 April 2020 19:52 To: pharo-users@lists.pharo.org Cc: Roelof Wobben Subject: Re: [Pharo-users] mentor question 2. Op 26-4-2020 om 20:17 schreef Sven Van Caekenberghe: > >>

Re: [Pharo-users] mentor question 2.

2020-04-26 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Op 26-4-2020 om 20:17 schreef Sven Van Caekenberghe: On 26 Apr 2020, at 20:10, Gabriel Cotelli wrote: In the first method you aren't doing an assignment, are sending the message = to the temp isValid, if you change the method to: decimalFromBinary: aString | resul

Re: [Pharo-users] mentor question 2.

2020-04-26 Thread Sven Van Caekenberghe
> On 26 Apr 2020, at 20:10, Gabriel Cotelli wrote: > > In the first method you aren't doing an assignment, are sending the message = > to the temp isValid, if you change the method to: > decimalFromBinary: aString > | result isValid | > isValid := self isValidBinary: aString. >

Re: [Pharo-users] mentor question 2.

2020-04-26 Thread Gabriel Cotelli
In the first method you aren't doing an assignment, are sending the message = to the temp isValid, if you change the method to: decimalFromBinary: aString | result isValid | * isValid := self isValidBinary: aString.* isValid ifTrue: [ result := 0. aString revers