Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-18 Thread Richard O'Keefe
An old draft has been available for yonks through
http://www.cs.otago.ac.nz/staffpriv/ok/software.htm

There are two *major* changes not included in that release
and not quite finished yet.

On Tue, 19 Mar 2019 at 07:09, Esteban Maringolo 
wrote:

> El dom., 17 mar. 2019 a las 6:33, Sven Van Caekenberghe
> () escribió:
> >
> >
> >
> > > On 17 Mar 2019, at 07:56, Richard O'Keefe  wrote:
> > >
> > > (1) As it happens, my Smalltalk library *does* have
> >
> > "my mystery Smalltalk" ;-)
>
> Codename "Unicorn". :)
>
> Jokes aside, I'd love to see such implementation because all software
> products developed by only a few minds, if not one at all, have a
> level of coherence and parsimony that can't be achieved with a larger
> team. I only saw it with Dolphin Smalltalk, and would love to see your
> Unicorn Smalltalk as well.
>
> Regards,
>
> Esteban A. Maringolo
>
>


Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-18 Thread Dale Henrichs
Isn't this an "ultimate" goal for Pharo  ... once you've got a stable 
(truly) minimum image, custom class libraries are possible if not 
desirable ...


Dale

On 3/18/19 11:08 AM, Esteban Maringolo wrote:

El dom., 17 mar. 2019 a las 6:33, Sven Van Caekenberghe
() escribió:




On 17 Mar 2019, at 07:56, Richard O'Keefe  wrote:

(1) As it happens, my Smalltalk library *does* have

"my mystery Smalltalk" ;-)

Codename "Unicorn". :)

Jokes aside, I'd love to see such implementation because all software
products developed by only a few minds, if not one at all, have a
level of coherence and parsimony that can't be achieved with a larger
team. I only saw it with Dolphin Smalltalk, and would love to see your
Unicorn Smalltalk as well.

Regards,

Esteban A. Maringolo





Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-18 Thread Esteban Maringolo
El dom., 17 mar. 2019 a las 6:33, Sven Van Caekenberghe
() escribió:
>
>
>
> > On 17 Mar 2019, at 07:56, Richard O'Keefe  wrote:
> >
> > (1) As it happens, my Smalltalk library *does* have
>
> "my mystery Smalltalk" ;-)

Codename "Unicorn". :)

Jokes aside, I'd love to see such implementation because all software
products developed by only a few minds, if not one at all, have a
level of coherence and parsimony that can't be achieved with a larger
team. I only saw it with Dolphin Smalltalk, and would love to see your
Unicorn Smalltalk as well.

Regards,

Esteban A. Maringolo



Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-18 Thread Tim Mackinnon
And looking at this in the code - there are quite a few variations of 
#includes… that I don’t think it makes sense to write the mirror of all of 
them. Not  it is...

> On 18 Mar 2019, at 16:48, Tim Mackinnon  wrote:
> 
> Thanks guys - I always learn something new from these threads.
> 
>> On 17 Mar 2019, at 06:56, Richard O'Keefe > > wrote:
>> 
>> (1) As it happens, my Smalltalk library *does* have
>> #excludes: and #identityExcludes:
>> (2) The definitions are trivial.
>> excludes: item
>>   ^(self includes: item) not
>> identityExcludes: item
>>   ^(self identityIncludes: item) not
>> 
>> If you want to execute aBlock when aString is not all zeros
>> and ones, just do
>>(aString allSatisfy: [:each | each = $0 or: [each = $1]])
>>  ifFalse: [aBlock value].
>> or
>>(aString anySatisfy: [:each | each ~= $0 and: [each ~= $1]])
>>  ifTrue: [aBlock value].
>> or
>>('01' includesAll: aString) ifFalse: [aBlock value].
>> 
>> 
>> On Sat, 16 Mar 2019 at 11:33, Tim Mackinnon > > wrote:
>> Hi - in my quest to understand the edgier details of Pharo (and Smalltalk) - 
>> and driven by fresh thoughts of completing exercism exercises - I was 
>> surprised to find that there is no #excludes: operation on collection to 
>> mirror the #includes: operation?
>> 
>> I was curious about this - its seems a strange omission?
>> 
>> Of course I can inverse it with not, or do things a different way - but we 
>> have ifTrue: mirrored with ifFalse, empty/notEmpty so am I missing something?
>> 
>> I wanted to write something like
>> 
>> 
>> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate a 
>> block if the string isn’t all 0 and 1’s)
>> 
>> 
>> Of course I can write this as:
>> 
>> (aString reject: [:c | c = $0 | c = $1)) ifNotEmpty: aBlock
>> 
>> But as recent messages in this vein have shown me (and taught me lots - 
>> thanks to those answering), the answer is often not what I thought.
>> 
>> Tim
>> 
>> 
> 



Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-18 Thread Tim Mackinnon
Thanks guys - I always learn something new from these threads.

> On 17 Mar 2019, at 06:56, Richard O'Keefe  wrote:
> 
> (1) As it happens, my Smalltalk library *does* have
> #excludes: and #identityExcludes:
> (2) The definitions are trivial.
> excludes: item
>   ^(self includes: item) not
> identityExcludes: item
>   ^(self identityIncludes: item) not
> 
> If you want to execute aBlock when aString is not all zeros
> and ones, just do
>(aString allSatisfy: [:each | each = $0 or: [each = $1]])
>  ifFalse: [aBlock value].
> or
>(aString anySatisfy: [:each | each ~= $0 and: [each ~= $1]])
>  ifTrue: [aBlock value].
> or
>('01' includesAll: aString) ifFalse: [aBlock value].
> 
> 
> On Sat, 16 Mar 2019 at 11:33, Tim Mackinnon  wrote:
> Hi - in my quest to understand the edgier details of Pharo (and Smalltalk) - 
> and driven by fresh thoughts of completing exercism exercises - I was 
> surprised to find that there is no #excludes: operation on collection to 
> mirror the #includes: operation?
> 
> I was curious about this - its seems a strange omission?
> 
> Of course I can inverse it with not, or do things a different way - but we 
> have ifTrue: mirrored with ifFalse, empty/notEmpty so am I missing something?
> 
> I wanted to write something like
> 
> 
> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate a 
> block if the string isn’t all 0 and 1’s)
> 
> 
> Of course I can write this as:
> 
> (aString reject: [:c | c = $0 | c = $1)) ifNotEmpty: aBlock
> 
> But as recent messages in this vein have shown me (and taught me lots - 
> thanks to those answering), the answer is often not what I thought.
> 
> Tim
> 
> 



Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-17 Thread Sven Van Caekenberghe



> On 17 Mar 2019, at 07:56, Richard O'Keefe  wrote:
> 
> (1) As it happens, my Smalltalk library *does* have

"my mystery Smalltalk" ;-)

> #excludes: and #identityExcludes:
> (2) The definitions are trivial.
> excludes: item
>   ^(self includes: item) not
> identityExcludes: item
>   ^(self identityIncludes: item) not
> 
> If you want to execute aBlock when aString is not all zeros
> and ones, just do
>(aString allSatisfy: [:each | each = $0 or: [each = $1]])
>  ifFalse: [aBlock value].
> or
>(aString anySatisfy: [:each | each ~= $0 and: [each ~= $1]])
>  ifTrue: [aBlock value].
> or
>('01' includesAll: aString) ifFalse: [aBlock value].

That last expression wins hands down !

Thank you for bringing that up, I learned something new.

> On Sat, 16 Mar 2019 at 11:33, Tim Mackinnon  wrote:
> Hi - in my quest to understand the edgier details of Pharo (and Smalltalk) - 
> and driven by fresh thoughts of completing exercism exercises - I was 
> surprised to find that there is no #excludes: operation on collection to 
> mirror the #includes: operation?
> 
> I was curious about this - its seems a strange omission?
> 
> Of course I can inverse it with not, or do things a different way - but we 
> have ifTrue: mirrored with ifFalse, empty/notEmpty so am I missing something?
> 
> I wanted to write something like
> 
> 
> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate a 
> block if the string isn’t all 0 and 1’s)
> 
> 
> Of course I can write this as:
> 
> (aString reject: [:c | c = $0 | c = $1)) ifNotEmpty: aBlock
> 
> But as recent messages in this vein have shown me (and taught me lots - 
> thanks to those answering), the answer is often not what I thought.
> 
> Tim
> 
> 




Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-17 Thread Richard O'Keefe
(1) As it happens, my Smalltalk library *does* have
#excludes: and #identityExcludes:
(2) The definitions are trivial.
excludes: item
  ^(self includes: item) not
identityExcludes: item
  ^(self identityIncludes: item) not

If you want to execute aBlock when aString is not all zeros
and ones, just do
   (aString allSatisfy: [:each | each = $0 or: [each = $1]])
 ifFalse: [aBlock value].
or
   (aString anySatisfy: [:each | each ~= $0 and: [each ~= $1]])
 ifTrue: [aBlock value].
or
   ('01' includesAll: aString) ifFalse: [aBlock value].


On Sat, 16 Mar 2019 at 11:33, Tim Mackinnon  wrote:

> Hi - in my quest to understand the edgier details of Pharo (and Smalltalk)
> - and driven by fresh thoughts of completing exercism exercises - I was
> surprised to find that there is no #excludes: operation on collection to
> mirror the #includes: operation?
>
> I was curious about this - its seems a strange omission?
>
> Of course I can inverse it with not, or do things a different way - but we
> have ifTrue: mirrored with ifFalse, empty/notEmpty so am I missing
> something?
>
> I wanted to write something like
>
>
> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate
> a block if the string isn’t all 0 and 1’s)
>
>
> Of course I can write this as:
>
> (aString reject: [:c | c = $0 | c = $1)) ifNotEmpty: aBlock
>
> But as recent messages in this vein have shown me (and taught me lots -
> thanks to those answering), the answer is often not what I thought.
>
> Tim
>
>
>


Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-16 Thread Ben Coman
On Sat, 16 Mar 2019 at 17:05, Tim Mackinnon  wrote:

> These are all good suggestions guys - but don’t you find it odd that there
> isn’t the mirror function #excludes: which would make all of them read more
> naturally?
>
> I know we can’t have all combinations- but this one really struck me as
> odd by its absence (particularly when I was comparing the elegance of my
> little coding solution to other languages).
>
> Should I propose it’s inclusion in Collection?
>

I'm mostly ambivalent, except simplifying transition from other languages
is useful.
What are some examples for other languages?

cheers -ben


> Tim
>
> Sent from my iPhone
>
> > On 16 Mar 2019, at 08:43, Sven Van Caekenberghe  wrote:
> >
> >
> >
> >> On 15 Mar 2019, at 23:06, Tim Mackinnon  wrote:
> >>
> >> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock.
> (Evaluate a block if the string isn’t all 0 and 1’s)
> >
> > (aString allSatisfy: [ :each | '01' includes: each ]) not.
> >
> >
>
>
>


Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-16 Thread Tim Mackinnon
These are all good suggestions guys - but don’t you find it odd that there 
isn’t the mirror function #excludes: which would make all of them read more 
naturally?

I know we can’t have all combinations- but this one really struck me as odd by 
its absence (particularly when I was comparing the elegance of my little coding 
solution to other languages).

Should I propose it’s inclusion in Collection?

Tim 

Sent from my iPhone

> On 16 Mar 2019, at 08:43, Sven Van Caekenberghe  wrote:
> 
> 
> 
>> On 15 Mar 2019, at 23:06, Tim Mackinnon  wrote:
>> 
>> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate a 
>> block if the string isn’t all 0 and 1’s)
> 
> (aString allSatisfy: [ :each | '01' includes: each ]) not.
> 
> 




Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-16 Thread Sven Van Caekenberghe



> On 15 Mar 2019, at 23:06, Tim Mackinnon  wrote:
> 
> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate a 
> block if the string isn’t all 0 and 1’s)

(aString allSatisfy: [ :each | '01' includes: each ]) not.




Re: [Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-15 Thread Ben Coman
On Sat, 16 Mar 2019 at 06:33, Tim Mackinnon  wrote:

> Hi - in my quest to understand the edgier details of Pharo (and Smalltalk)
> - and driven by fresh thoughts of completing exercism exercises - I was
> surprised to find that there is no #excludes: operation on collection to
> mirror the #includes: operation?
>
> I was curious about this - its seems a strange omission?
>
> Of course I can inverse it with not, or do things a different way - but we
> have ifTrue: mirrored with ifFalse, empty/notEmpty so am I missing
> something?
>
> I wanted to write something like
>
>
> aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate
> a block if the string isn’t all 0 and 1’s)
>

purely off the cuff, if you want the opposite logic what about...
 aString detect: [:c | (($0 to: $1) includes: c) not ] ifFound:
aBlock.


Of course I can write this as:
>
> (aString reject: [:c | c = $0 | c = $1)) ifNotEmpty: aBlock
>

cheers -ben


[Pharo-users] Why doesn't collection have #excludes (the mirror of includes)?

2019-03-15 Thread Tim Mackinnon
Hi - in my quest to understand the edgier details of Pharo (and Smalltalk) - 
and driven by fresh thoughts of completing exercism exercises - I was surprised 
to find that there is no #excludes: operation on collection to mirror the 
#includes: operation?

I was curious about this - its seems a strange omission?

Of course I can inverse it with not, or do things a different way - but we have 
ifTrue: mirrored with ifFalse, empty/notEmpty so am I missing something?

I wanted to write something like


aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate a 
block if the string isn’t all 0 and 1’s)


Of course I can write this as:

(aString reject: [:c | c = $0 | c = $1)) ifNotEmpty: aBlock

But as recent messages in this vein have shown me (and taught me lots - thanks 
to those answering), the answer is often not what I thought.

Tim