Re: [Pharo-users] Is there a way to stop arrays sorting automatically?

2018-01-06 Thread Richard O'Keefe
I would check this in Pharo, but have so far failed to get it running under Ubuntu 17.10. Squeak _is_ running there, sort of, and the definition of #permutationsDo: in Interval is this code: permutationsDo: aBlock "Repeatly value aBlock with a single copy of the receiver. Reorder the copy so that

Re: [Pharo-users] How to declare a do:[] loop for a matrix to read and acces its elements?

2018-01-15 Thread Richard O'Keefe
I'm reading this in gmail. After "this method work:" I see a gap with nothing visible. After "wich looks like this" there is again a gap with nothing visible. Recalling that the Life universe is an *infinite* two-dimensional space, you want a data structure that naturally grows to be as big as it

Re: [Pharo-users] How to declare a do:[] loop for a matrix to read and acces its elements?

2018-01-15 Thread Richard O'Keefe
using a rectangular matrix for Life. I might possibly use a quad tree, but I'd probably stick with a set of points. On 16 January 2018 at 19:41, Richard O'Keefe wrote: > I'm reading this in gmail. After "this method work:" I see a gap with > nothing visible

Re: [Pharo-users] how to convert this with a stream

2019-03-27 Thread Richard O'Keefe
"I have a SortedCollection of Teams. Now I need to convert *it* to a line like ...". Well, no. You need to convert *each team* separately to such a line. So something like aStream nextPutAll: '...header line...'; cr. mySortedTeams do: [:eachTeam | -write a formatted line describing eac

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Richard O'Keefe
As you noted, wrapping going forward: seq at: index \\ seq size + 1 Wrapping going backward is nearly as easy: seq at: (index - 2) \\ seq size + 1 This would not work with #rem: On Fri, 29 Mar 2019 at 04:13, Tim Mackinnon wrote: > Hey guys - I’m wondering if someone might have a nice way of se

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Richard O'Keefe
This loop is a special case. size := 10. prevIndex := size. prevValue := seq at: prevIndex. thisIndex := 1.thisValue := seq at: thisIndex. nextIndex := 2.nextIndex := seq at: nextIndex. [thisIndex <= size] whileTrue: [ ... prevIndex := thisIndex. prevValue := thisValue. thisIndex := n

Re: [Pharo-users] Easiest way to wrap around the indexed value in a list (mod doesn't quite work)

2019-03-30 Thread Richard O'Keefe
If a Smalltalk system did have a "cyclic" indexing method that did "self at: (index - 1) \\ self size + 1", where would it be? Since it makes sense for all and only sequences, we'd expect it to be in SequenceableCollection. Since it is like #at:, and #at: is an 'accessing' method, we'd expect to fi

Re: [Pharo-users] why is asDictonary a class method

2019-03-30 Thread Richard O'Keefe
Question 1. Should that be #asDictionary? Question 2. If not, what's a Dictonary? Question 3. I see you are using self-encapsulation, with a getter 'self robot' and a setter 'self robot: something'. Of course that means that outside code can fr

Re: [Pharo-users] why is asDictonary a class method

2019-03-31 Thread Richard O'Keefe
t. I don't think I've ever written a program where that was a good idea. On Sun, 31 Mar 2019 at 19:55, Roelof Wobben wrote: > Op 31-3-2019 om 03:47 schreef Richard O'Keefe: > > Question 1. Should that be #asDictionary? > > > > yes, it does. >

Re: [Pharo-users] What's wrong with latest Pharo?

2019-04-02 Thread Richard O'Keefe
I have Pharo 6.1 and Pharo 7.0 working in Ubuntu 18.04 with no trouble so far. I just downloaded the launcher from pharo.org and pulled the images down that way. One thing I do find annoying in Ubuntu 18.04 is the number of programs (like okular) that spew warning messages out the terminal. Phar

Re: [Pharo-users] What's wrong with latest Pharo?

2019-04-02 Thread Richard O'Keefe
I tested with minidebian and > it also failed. > > Richard, was you able to use Iceberg? It should only work if either Ubuntu > fix this dependency problem with libcurl or Pharo started to use libcrl4. > > > > On Tue, Apr 2, 2019 at 5:50 AM Richard O'Keefe wrote: >

Re: [Pharo-users] is this valid smalltalk

2019-04-04 Thread Richard O'Keefe
For a change this is an exercism problem I know something about. I did look at the exercism web site, and did all the SML exercises, but could not find any for Smalltalk or Pharo. The exercise is in fact about using a stack. stack <- empty for each character of the string if it is one

Re: [Pharo-users] What's wrong with latest Pharo?

2019-04-04 Thread Richard O'Keefe
installed without conflict. On Thu, 4 Apr 2019 at 01:34, Ben Coman wrote: > > On Wed, 3 Apr 2019 at 05:09, Richard O'Keefe wrote: > >> I just did a complete reinstall of Ubuntu 18.4 on this >> laptop yesterday, >> > > > >> and it did not come with any

Re: [Pharo-users] How to catch and handle multiple exceptions

2019-04-07 Thread Richard O'Keefe
VisualAge Smalltalk has, in addition to the standard #on:do:, #when:do:, ..., #when:do:#when:do:#when:do:#when:do:#when:do:, with the last four mapping to #whenOneOf:doMatching:, taking two arrays. It's easy enough to add your own methods like on: exn1 do: act1 on: exn2 do: act2 "An imperfect

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-07 Thread Richard O'Keefe
It would really REALLY **REALLY** help if we knew what the heck you were trying to do. There is an excellent chance that it is MUCH simpler than you think. If you cannot show us the Smalltalk version of the problem, can you show us the version for some other language? On Sun, 7 Apr 2019 at 20:1

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Richard O'Keefe
dispath first the direction North, East, South, West > and then use double dispatch to find the right move. > > Roelof > > > > > > Op 8-4-2019 om 06:50 schreef Richard O'Keefe: > > It would really REALLY **REALLY** help if we knew what > the heck you were

Re: [Pharo-users] can I do something like this with Double Dispatch

2019-04-08 Thread Richard O'Keefe
Remember, we cannot see the Smalltalk exercises in exercism. We cannot help you without knowing what problem you are trying to solve. Is this problem basically the same as https://www.reddit.com/r/dailyprogrammer/comments/3ntsni/20151007_challenge_235_intermediate_scoring_a/?ref=share&ref_source=l

Re: [Pharo-users] How to catch and handle multiple exceptions

2019-04-08 Thread Richard O'Keefe
ruct might be used to obtain the same as the > #when:do:when:do: but using a chained approach instead. > > Regards, > > [1] AFAIR when I used VAST (+a decade ago) it didn't have "ANSI" > exceptions. > > Esteban A. Maringolo > > El lun., 8 abr. 2019 a las 0:49, Richard O

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Richard O'Keefe
a Robot which can turn left, turn right or moveForward. >> >> now I have a string like 'LAR' >> >> that means the robot needs to turn left (l) , move forward one place (A) >> and turn left. >> and I have to keep track to which direction the robot i

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Richard O'Keefe
x27; -> 0; > yourself); > yourself) > > > but I cannot come to the same outcome with this code : > > > pointToName: aPoint > ^aPoint x isZero > ifTrue: [aPoint y > 0 ifTrue: [#north] ifFalse: [#south]] >

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-09 Thread Richard O'Keefe
le problems like this. > > Out of coriousy what dialect do you use? > > > Op 8-4-2019 om 17:11 schreef Richard O'Keefe: > > You are expected to use my code fragments for *ideas*, > not to incorporate them *literally* in your code. As > I explained, *without seeing t

Re: [Pharo-users] is this a valid Smalltalk way

2019-04-13 Thread Richard O'Keefe
You wrote: "a frame is always two times a throw" but the specification says "A frame is composed of one or two ball throws" and later we learn that the 10th frame may have three throws. There is an issue with your Smalltalk. aCollection withIndexDo: [:index :item | "You have the arguments in th

Re: [Pharo-users] how to model this a better way

2019-04-22 Thread Richard O'Keefe
gt;>>> and I think I need then to use if then , which I try to avoid as much >>>> as possible. >>>> >>>> Roelof >>>> >>>> >>>> >>>> Op 18-4-2019 om 18:33 schreef Richard Sargent: >>>> >>

Re: [Pharo-users] how to model this a better way

2019-04-24 Thread Richard O'Keefe
Let me tell you a story. The story is about someone I knew back when I was doing my MSc. He was really bright, but he had to repeat a year in the papers part of his MSc. Why? Because he didn't get statistics. Differential equations? No problem. Topology? No problem. Operations research (which wa

Re: [Pharo-users] how to model this a better way

2019-04-24 Thread Richard O'Keefe
Ben Coman wrote: > On Mon, 22 Apr 2019 at 23:15, Richard O'Keefe wrote: > > > > I already discoursed on this at some length. > > (1) In my own answer, I used code to map direction names to vectors. > > But the Dictionary answers are absolutely fine. > > (2)

Re: [Pharo-users] how to model this a better way

2019-04-24 Thread Richard O'Keefe
be later I come back when I have a beter understanding what Object > Oriented is and how I can use it to solve more difficult problems. > > Roelof > > > Op 24-4-2019 om 18:07 schreef Ben Coman: > > On Wed, 24 Apr 2019 at 16:52, Richard O'Keefe wrote: > >> The o

Re: [Pharo-users] how to model this a better way

2019-04-24 Thread Richard O'Keefe
PS: in this thread nobody has disagreed about what OO programming is. The disagreement was about *how to apply it*. There actually seems to be quite a lot of agreement that the answer depends on what your underlying goal is: - is this throw-away code for a specific problem? - is this code to be i

Re: [Pharo-users] how to model this a better way

2019-04-29 Thread Richard O'Keefe
he > problems. Because smalltalk is OO I sometimes look at ruby code to see > how they solve things. > > Roelof > > > > > > Op 25-4-2019 om 06:23 schreef Richard O'Keefe: > > PS: in this thread nobody has disagreed about what OO programming is. > The disag

Re: [Pharo-users] GSoC 2019 Introduction

2019-05-10 Thread Richard O'Keefe
Branching as such is not a sign of bad design in OOP. The actual dogma is that *testing the class of an argument instead of dispatching* is a sign of bad design. Just consider the case of binary search. That is not the kind of branching that lends itself to dynamic dispatch. Nor is the kind of br

Re: [Pharo-users] Bloc of code in tiers programming language

2019-05-15 Thread Richard O'Keefe
One point worth making is that Python lambdas are artificially restricted: the body of a Python lambda may only be a single expression, not a sequence of statements. This restriction is for ideological reasons (the BDFL does not *want* you to do that) not for technical reasons. Lisp and Algol 68

Re: [Pharo-users] Bloc of code in tiers programming language

2019-05-15 Thread Richard O'Keefe
Suppose you want a pair of mutually recursive functions. They have to be able to name each other. In languages like Python and Ruby, you can have methods AND you can have named functions. In fact Python had named functions before it had objects. But in Smalltalk, you have methods, which cannot be

Re: [Pharo-users] Bloc of code in tiers programming language

2019-05-15 Thread Richard O'Keefe
I do wish people wouldn't say "beg the question" https://grammarist.com/rhetoric/begging-the-question-fallacy/ when they mean "invites" or "raises" the question. Sigh. Yes, Smalltalk is just like Lua here. |f g| "declare f and g as local variables" f := [... g value ...]. "f uses g's current

Re: [Pharo-users] can I do this with a stream or a format

2019-05-16 Thread Richard O'Keefe
stream := WriteStream on: (String new: gifts size * "estimated size per gift" 10). "The number after #new: is the *initial* allocation; the stream will reallocate it as needed." gifts allButLastDo: [:each | stream nextPutAll: each; nextPutAll: ', ']. stream nextPutAll: 'and '; nextPutAll: gifts

Re: [Pharo-users] Bloc of code in tiers programming language

2019-05-16 Thread Richard O'Keefe
Blocks in current Smalltalk system are just like lambdas in Scheme. Pharo even has continuations (see the Continuation class). On Fri, 17 May 2019 at 05:21, Brainstorms wrote: > I beg your pardon.. and thank you for being the first to draw my attention > to > the fact that the phrase (a common

Re: [Pharo-users] Bloc of code in tiers programming language

2019-05-16 Thread Richard O'Keefe
I did not mean "course of instruction on the topic of continuations", I meant "that class whose name is Continuation in the Smalltalk image." In a Playground, type Continuation and then Control-B. On Fri, 17 May 2019 at 14:03, Brainstorms wrote: > Richard O'Keefe

Re: [Pharo-users] The baseline complexity of tiny big projects...

2019-05-19 Thread Richard O'Keefe
This is not an answer to your question, but it is an observation by someone who was trying all the exercises. As a user, it was just working. Then suddenly, there was a change. Instead of a new exercise popping up underneath Exercism, it would appear as Exercise@Foobar. No big deal. What *is*

Re: [Pharo-users] Find after in strings?

2019-06-01 Thread Richard O'Keefe
If you want to move around in strings, you might want to use a ReadStream. In some Smalltalk systems there is a method called #skipToAll:. Here's how mine starts out: skipToAll: aSequence "If the remaining elements can be parsed as , return true leaving the position where? Otherw

Re: [Pharo-users] Find after in strings?

2019-06-01 Thread Richard O'Keefe
I forgot to mention that in order to be able to translate XPath to Smalltalk I added these methods to my Smalltalk: AbstractSequence>> afterSubCollection: aSequence [ifAbsent: exceptionBlock] "based on substring-after" beforeSubCollection: aSequence [ifAbsent: exceptionBlock] "based on

Re: [Pharo-users] Find after in strings?

2019-06-01 Thread Richard O'Keefe
t to take some lines from the end > of a class comment and use them in an exercism exercise - but its not > different than many applications - find some tag and use the text after it. > I”m kind of surprised its not in Pharo. > > Tim > > > On 1 Jun 2019, at 12:25, Richard

Re: [Pharo-users] Find after in strings?

2019-06-01 Thread Richard O'Keefe
uot; ^self match: aCollection Sorry about the incomplete message. #match: is such a bad name for this operation that the method comment has to go to some trouble to explain that it is nothing like #match: for Strings. On Sun, 2 Jun 2019 at 14:29, Richard O'Keefe wrote: > To get #s

Re: [Pharo-users] Find after in strings?

2019-06-02 Thread Richard O'Keefe
already. > > Note that most current implementations of #upToAll: already use words like > match, so #match: is not that crazy. > > Yes it should be possible to talk about naming, but just adding aliases, > no. > > My opinion, of course. > > > On 2 Jun 2019, at 04:33,

Re: [Pharo-users] Can I code a web browser in a Pharo GUI window (Morphic or other)?

2019-06-14 Thread Richard O'Keefe
There was a thread about this two years ago. http://forum.world.st/Smalltalk-Internet-Browser-td4944879.html There is Scamper for Squeak, https://github.com/HPI-SWA-Teaching/Scamper It used to come standard in Squeak. When I knew it, it couldn't quite handle HTML 3.2. I imagine it was removed f

Re: [Pharo-users] [ANN] MessageFlowBrowser for Pharo 7 and 8

2019-07-12 Thread Richard O'Keefe
Great tool. Helpful video. One thing would improve the video: remove the sound track, or replace it with spoken commentary. On Fri, 12 Jul 2019 at 04:15, Torsten Bergmann wrote: > Hi, > > I updated my MessageFlowBrowser today to work on Pharo 7 and 8, see > attached screenshot > or youtube vid

Re: [Pharo-users] [GSoC blog post] Binary Search Trees

2019-07-12 Thread Richard O'Keefe
Search trees (which come in many varieties) are good for collections in which adding, deleting, and lookup are interleaved, where there is an order on the elements (if used as a set) or the keys (if used as a dictionary). So are hash tables. But (balanced) search trees have guaranteed O(lg n) wor

Re: [Pharo-users] Tree API blog post

2019-07-18 Thread Richard O'Keefe
I've been pondering this reply for a while. There are so *many* kinds of tree. There are rooted trees (very popular in computing) and unrooted trees (what you get from some phylogenetic reconstructions and of course the spanning tree of a graph). There are trees with and without parent links. There

Re: [Pharo-users] [OrderedCollection] add a reference or a copy?

2019-07-24 Thread Richard O'Keefe
To a very good approximation, Smalltalk doesn't copy anything unless you ask it to. In this respect it's just like Java, Python, Ruby, ECMAScript, and most OO languages. C++ *does* like to copy things, but it is unusual. On Thu, 25 Jul 2019 at 00:46, sergio ruiz wrote: > I think my understandin

Re: [Pharo-users] OrderedCollection as an instance variable

2019-07-24 Thread Richard O'Keefe
Comment 1. You probably meant to write tracks: aCollection ^tracks := aCollection Comment 2. This is a poor design. As it is, any object can replace the tracks of an artist with *anything*. And even without doing that, any object can add and remove items to an artist's tracks,

Re: [Pharo-users] Personal Programming

2019-07-27 Thread Richard O'Keefe
There are some spelling issues in the PDF one finds at the Newton-Raphson link. "bellow" and "below" mean different things and sound quite different (BELL-owe vs b'-LOW). In "In the sketch bellow" the one you want is "below". "bloc" and "block" sound the same but also mean different things, and th

Re: [Pharo-users] A Canticle for Smalltalk

2019-08-08 Thread Richard O'Keefe
Nice enough, but where is the canticle? On Tue, 6 Aug 2019 at 03:20, Richard Kenneth Eng wrote: > A big fan of my work created this rogue video: > https://drive.google.com/file/d/1opveHaukFK8WbQ8wg8b14wuKJsjoOZfO/view > > I appreciate the homage, but I can't take credit for it. > > It's really q

Re: [Pharo-users] Destructive copy in #replaceFrom:to:with:startingAt:

2019-08-09 Thread Richard O'Keefe
The ANSI Smalltalk standard is characteristically vague here. Both the memmove and memcpy readings are consistent with it. The standard is characteristically buggy here too: the two lines I've flagged with ** disagree. I take the second one to be correct. 5.7.12.5 Message: replaceFrom: start t

Re: [Pharo-users] Why do I not see the transactions when opening a customer

2019-08-16 Thread Richard O'Keefe
What did you expect transaction = Transactions new. to do, besides computing the answer 'false' and throwing it away? On Fri, 16 Aug 2019 at 22:38, Roelof Wobben wrote: > Hello, > > I try now to make this challege work on Pharo which is orginal a c# > problem to practice OOP. > > The challe

Re: [Pharo-users] Why do I not see the transactions when opening a customer

2019-08-16 Thread Richard O'Keefe
What is the source of the challenge? Is there a version in English? I am having very serious trouble trying to make sense of "your bank accounts can have multiple accounts for money". I note that in your C# code a customer has an ID, a first name, and a last name. There is nothing about this in t

Re: [Pharo-users] Why do I not see the transactions when opening a customer

2019-08-17 Thread Richard O'Keefe
https://github.com/rwobben/bankaccount points to a repository with C# code, so I cannot comment on the Smalltalk. There is, however, a striking thing about the C# code, qua C#, that is worth mentioning. It is not encapsulated. Let's start with the most obvious one. A bank account has a password,

Re: [Pharo-users] Why do I not see the transactions when opening a customer

2019-08-17 Thread Richard O'Keefe
gned thereafter. > Delete that setter. Customer >> AddBankAccountToCustomer: bankaccount [ bankaccounts add: bankaccounts. ] On Sat, 17 Aug 2019 at 21:59, Roelof Wobben wrote: > Sorry, then a pointed to a wrong repo > this is the repo with smalltalk code : > > https://

Re: [Pharo-users] Why do I not see the transactions when opening a customer

2019-08-20 Thread Richard O'Keefe
I think some people are taking this a bit too seriously. This particular example cannot be taken seriously as an approximation of a real bank, and the "credentials" need not be anything other than a simple clear-text string. There is, for example, *NO* interface of any kind (UI or API) anywhere in

Re: [Pharo-users] Spec Book

2019-08-22 Thread Richard O'Keefe
The second ofthose links ends with "These topics will be covered in the next episode." Anyone know where the next episode is? On Thu, 22 Aug 2019 at 23:32, Vitor Medina Cruz wrote: > Thanks! It seems there are mostly nomenclature changes, I will try to > continue with the book and with those two

Re: [Pharo-users] [ANN] Iterators

2019-08-24 Thread Richard O'Keefe
Distinguishing between "pull-based" and "push-based" streams in Smalltalk makes no sense, because do: aBlock [self atEnd] whileFalse: [aBlock value: self next]. is in the same protocol in the ANSI standard as #atEnd and #next, and in most Smalltalk systems it is in Stream. There should n

Re: [Pharo-users] SequenceableCollection>>#allButFirst: inconsistence across subclasses

2019-09-02 Thread Richard O'Keefe
Here's what I think. copyFrom: start to: stop " ANSI Smalltalk section 5.7.8.7, reorganised a bit. Answer a new collection containing all of the elements of the receiver between the indices start and stop inclusive in their original order. The element at index start in the receiver

Re: [Pharo-users] SequenceableCollection>>#allButFirst: inconsistence across subclasses

2019-09-02 Thread Richard O'Keefe
s not respect the ANSI semantics of #copyFrom:to:. Example: 'abc' copyFrom: 6 to: 0 should, according to the common specification, answer ''. The result is instead a primitive failure in #basicNew:, of all things. On Mon, 2 Sep 2019 at 20:37, Richard O'Keefe wrot

Re: [Pharo-users] SequenceableCollection>>#allButFirst: inconsistence across subclasses

2019-09-03 Thread Richard O'Keefe
Ad 1. To cut a long story short, the ANSI Smalltalk standard is the nearest thing we have to a clear specification of the nearest thing we have to a consensus. One of the reasons that Smalltalk gets less use than many of us would like is that it can be extremely unpleasant trying to

Re: [Pharo-users] Ssilence does not mean agreement

2019-09-04 Thread Richard O'Keefe
I refrain from expressing an opinion about any kind of weapon here. I would hope that in a civilised society anyone could casually mention any legal activity they engage in without being subjected to harassment. For what it's worth, I have created a GitHub site for my Smalltalk system, but there's

Re: [Pharo-users] Set >> collect:thenDo:

2019-09-08 Thread Richard O'Keefe
The difference in behaviour is exactly what I would expect. I can't think of any way to make aSet collect: collectBlock thenDo: doBlock act identically to (aSet collect: collectBlock) do: doBlock without creating an intermediate set. Here, for example, is the definition in Smalltalk/X, with commen

Re: [Pharo-users] Set >> collect:thenDo:

2019-09-08 Thread Richard O'Keefe
(1) If you want (aSet collect: collectBlock) do: doBlock you can write exactly that. Nothing stops you, and it will be as clear and reliable as any use of Set>>collect:, which is to say NOT VERY CLEAR OR RELIABLE AT ALL. (2) #collect:then{Do:Select:Reject:} had no other purpose than

Re: [Pharo-users] Set >> collect:thenDo:

2019-09-09 Thread Richard O'Keefe
with most collection classes. * does nothing to improve performance but just adds overhead. Are we done yet? On Tue, 10 Sep 2019 at 01:27, David T. Lewis wrote: > On Mon, Sep 09, 2019 at 05:46:48PM +1200, Richard O'Keefe wrote: > > > > (3) Oddly enough, the reason that #coll

Re: [Pharo-users] Set >> collect:thenDo:

2019-09-09 Thread Richard O'Keefe
utomatic refactoring rule that > consolidates chained #collect: and #do: sends into a faster > #collect:thenDo: send without breaking existing code. > > Am .09.2019, 07:46 Uhr, schrieb Richard O'Keefe : > > > (1) If you want (aSet collect: collectBlock) do: doBlock > >

Re: [Pharo-users] Stream >> <

2019-09-10 Thread Richard O'Keefe
I think it's fair to say that #<< *is* a bug. There does not seem to be any coherent description of what it means. It's overloaded to mean *either* #nextPut: *or* #nextPutAll: *or* something else, in some confusing ways. CommandLineHandler #nextPutAll: (sent somewhere else) Integer

Re: [Pharo-users] Stream >> <

2019-09-10 Thread Richard O'Keefe
It is good that you have a coherent idea of how << can work. The question I was addressing is how << *DOES* work in Pharo. Having simple things working, if they are kept consistent, is indeed good. The problem is that in Pharo 7 they are NOT consistent, and << does NOT work consistently, because t

Re: [Pharo-users] Stream >> <

2019-09-12 Thread Richard O'Keefe
to something they already know is a Symbol. For what it's worth, I've attached my implementation. On Wed, 11 Sep 2019 at 21:46, Herby Vojčík wrote: > On 11. 9. 2019 3:23, Richard O'Keefe wrote: > > It is good that you have a coherent idea of how << can work. > &

Re: [Pharo-users] Code of Conduct

2019-09-12 Thread Richard O'Keefe
There are some aspects of the "Covenant" that rub me up the wrong way. I note that the only part of it where anyone actually promises to do (or not do) anything is the "Pledge", which rather pointedly refrains from treating people with different political viewpoints (like gun ownership, or like TER

Re: [Pharo-users] Code of Conduct

2019-09-16 Thread Richard O'Keefe
There was a point raised in the Ruby discussion (where my thoughts about Matz changed from "inventor of a language that filled a much-needed gap" to "really thoughtful so maybe I was wrong about Ruby") which I think is sufficient reason for a major revision to the Coraline Code. (For the record, I

Re: [Pharo-users] Code of Conduct

2019-09-17 Thread Richard O'Keefe
Correspondents should be warned that the phrase "safe spaces" needs a trigger warning. I am not joking here. People who are genuinely sensitive to the perceptions and concerns of others really should avoid that concept because there are many people in whom it arouses strong negative feelings. Who

Re: [Pharo-users] Code of Conduct

2019-09-17 Thread Richard O'Keefe
You just wrote what I didn't quite dare to say. Thank you. On Wed, 18 Sep 2019 at 11:29, Ramon Leon wrote: > On 2019-09-17 2:34 p.m., Offray Vladimir Luna Cárdenas wrote: > > as I say the important issue is to provide safe > > spaces via explicit or implicit rules > > I understand, I just disagr

Re: [Pharo-users] Code of Conduct

2019-09-19 Thread Richard O'Keefe
On the whole, the new code is pretty good. There was one thing that troubled me, though: "even outside of Pharo's public communication channels." What business is it of the Pharo Board what anyone says in any other community? I've heard too many cases where A says something to B and C complains a

Re: [Pharo-users] pharo for ios and android

2019-09-22 Thread Richard O'Keefe
Thank you Craig Latta. I see there is a caffeine.js.org/pharo "This page is an early demo of running Pharo 6 with the SqueakJS virtual machine. It gets far enough now that I think several people in the Pharo community could fix the rest of the bugs (mostly missing primitives). " I'm trying it but

Re: [Pharo-users] pharo for ios and android

2019-09-22 Thread Richard O'Keefe
PS: After several minutes, the progress bar for "Loading app Pharo..." stopped moving. So I don't think I'll bother trying Pharo on a tablet yet... On Sun, 22 Sep 2019 at 22:15, Richard O'Keefe wrote: > > Thank you Craig Latta. I see there is a caffeine.js.org

[Pharo-users] FFI beginner question

2019-09-22 Thread Richard O'Keefe
I am developing a Smalltalk interface to an existing C library which I intend to make generally available. Naturally I am doing this in my own Smalltalk system first, where it's unsurprisingly easy for me. But when I have it working, I'd like to make a Pharo port available. I have never used the

Re: [Pharo-users] Code of Conduct

2019-09-22 Thread Richard O'Keefe
This is not a question of left vs right. It's a question of authoritarian vs libertarian. And this is very relevant to the community. It's also not a question of democracy vs central authority. It's a question of vs παρρησία vs goodspeak. And this is very relevant to the community also. Pharo is

Re: [Pharo-users] Defensive programming or not

2019-09-23 Thread Richard O'Keefe
This is perhaps the biggest question I've faced working on my own Smalltalk, and it is connected to an annoyance. My answer is that when I am *using* library code, I want my mistakes to be detected at "interface" level. If, for example, I do ((1 to: 5) asOrderedCollection) at: 2.5 put: #fred; you

Re: [Pharo-users] FFI beginner question

2019-09-23 Thread Richard O'Keefe
Thank you for that. I note that some sections have nothing in them. Now that I have read that, what is the next thing to read? In particular, how do I connect C numeric types introduced by the library to FFI? On Mon, 23 Sep 2019 at 16:45, Tomaž Turk wrote: > > Hi, > > The book draft is here: >

Re: [Pharo-users] Pharo-users Digest, Vol 77, Issue 67

2019-09-23 Thread Richard O'Keefe
On Mon, 23 Sep 2019 at 16:49, Vince Refiti wrote: > The SQLite3 API is very well documented, and the UDBC-SQLite3 project > (https://github.com/astares/Pharo-UDBC) is a nice and clean binding to it. > Look in UDBCSQLite3Library class. Thanks. It's nearly midnight here; I've downloaded it and

Re: [Pharo-users] FFI beginner question

2019-09-23 Thread Richard O'Keefe
What I want to do is to create a binding for the SoftPosit library. A typical function has an interface like quire16_t q16_fdp_add(quire16_t, posit16_t, posit16_t); where typedef struct { uint16_t v; } posit16_t; typedef struct { uint64_t v[2]; } quire16_t; A "quire" is a do

Re: [Pharo-users] Code of Conduct

2019-09-23 Thread Richard O'Keefe
Let's look at some official numbers. Looking at https://www.hesa.ac.uk/news/11-01-2018/sfr247-higher-education-student-statistics/qualifications we see that overall, female graduates outnumbered male graduates about 4 to 3 in each of the three years recorded. The imbalance in science graduates w

Re: [Pharo-users] How to zip a WideString

2019-10-03 Thread Richard O'Keefe
The interface should surely be SomeClass methods for: 'compression' zipped "return a byte array" class methods for: 'decompression' unzip: aByteArray "return an instance of SomeClass"

Re: [Pharo-users] How to zip a WideString

2019-10-03 Thread Richard O'Keefe
ss in your examples, I think you will see why the chosen interface was > used. > > Peter Kenny > > > -Original Message- > From: Pharo-users On Behalf Of Richard > O'Keefe > Sent: 03 October 2019 23:08 > To: Any question about pharo is welcome > Subjec

Re: [Pharo-users] Number to VT_DECIMAL

2019-10-09 Thread Richard O'Keefe
VT_DECIMAL sounds like a very close match to ScaledDecimal. Or it would if ScaledDecimal were consistently implemented between Smalltalks. The intent behind ScaledDecimal in the ANSI Smalltalk standard appears to have been an (m,p) representation where m and p are Integers standing for m * 10^p, fo

Re: [Pharo-users] Number to VT_DECIMAL

2019-10-09 Thread Richard O'Keefe
Whoops, Visual Age uses 17 BYTES, not 17 BITS. Slaps own wrist. On Wed, 9 Oct 2019 at 22:03, Richard O'Keefe wrote: > > VT_DECIMAL sounds like a very close match to ScaledDecimal. > Or it would if ScaledDecimal were consistently implemented between Smalltalks. > The intent beh

Re: [Pharo-users] How to zip a WideString

2019-10-10 Thread Richard O'Keefe
ctating > a single way to do so, if I understand it correctly. > > The composition with several messages allows for end users to choose their > own encoding format, depending on their own needs, which I think is more > flexible. > > Sven > > > On 4 Oct 2019, at 06:3

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Richard O'Keefe
days keysAndValuesDo: [:key :value | Transcript print: key; nextPutAll: ' has '; print: value; nextPutAll: ' days'; cr]. Transcript endEntry. works too and in some Smalltalks is easily the most efficient approach, as it does not construct any strings you have no other use for. In Pharo, howeve

Re: [Pharo-users] Transcript: printString or asString

2019-10-15 Thread Richard O'Keefe
It may be worth noting that the 1998 ANSI Smalltalk standard defines #asString for Character, , String, and Symbol and for those classes only. VisualWorks extends #asString to things like Filename and URIs and Text and several other things for which "convert to String" makes sense and are not local

Re: [Pharo-users] Concurrency Best Practices + Tests

2019-10-15 Thread Richard O'Keefe
(1) Be very clear in your design about which objects are shared and which are not. (2) Immutable objects can be shared safely. Mutable ones are much much harder to work with. (3) Lazy initialisation does not work well in concurrent programming, *except* when you are constructing an immutable

Re: [Pharo-users] help with understanding the visitor pattern

2019-10-17 Thread Richard O'Keefe
First, this is presumably the "Die" exercise from the Pharo track of exercism.io. Second, this is a case where - there is nothing to a Die other than the number of faces, so from a practical point of view there should not be a Die class; - there is nothing to a DieHandle other than a sequence

Re: [Pharo-users] String concatenation vs. Stream

2019-10-17 Thread Richard O'Keefe
When is it pointless to introduce a WriteStream and just use #, ? When #, would not be in a loop or recursion. Constructing error messages, class initialisation code, that sort of thing. If you find yourself doing a lot of concatenations, you are probably missing an abstraction. For example, buil

Re: [Pharo-users] BlockClosure

2019-10-23 Thread Richard O'Keefe
No kind of object does what you want. You cannot do 3 3 or #x #y As for [:x | x + 1] 3, what would be the *point* of doing this? What is the block suppose to *do* with the 3? Do you want to extend this to [:x :y | x + y] 3 4 ? If not, why not? What about [3+4] "what to put

Re: [Pharo-users] help bij one of the last challenges of the chapterof network simulation of the oop book.

2019-10-29 Thread Richard O'Keefe
The first question you should ask is "What do I expect #ball asUppercase to be?" The ANSI Smalltalk standard says 5.7.10.9 Message: asUppercase Synopsis Answer a new string which contains all of the elements of the receiver converted to their upper case equivalents. Definition: Answer a new s

Re: [Pharo-users] help bij one of the last challenges of the chapterof network simulation of the oop book.

2019-10-31 Thread Richard O'Keefe
l times but I do not see the reason. > > Roelof > > > > Op 30-10-2019 om 01:38 schreef Richard O'Keefe: > > The first question you should ask is "What do I expect #ball asUppercase to > > be?" > > The ANSI Smalltalk standard says > > 5.7.10.9

Re: [Pharo-users] can I write this without the three if then;s

2019-12-27 Thread Richard O'Keefe
Myself, I see only one issue in your code, and that is the pointless use of sqrt. scoreX: anInteger y: anInteger2 | radiusSquared | radiusSquared := anInteger squared + anInteger2 squared. radiusSquared > 100 ifTrue: [ ^ 0 ]. radiusSquared > 25 ifTrue: [ ^ 1 ]. r

Re: [Pharo-users] uses or instead of a searching literal

2019-12-27 Thread Richard O'Keefe
You know, this is an area where style opinions differ a lot. What the message is suggesting you try is aString splitOn: [:each | ' -_' includes: each] That's all. No need for anything more complicated. But there is a trade-off. Clarity vs efficiency. You should make your code clear and correct

Re: [Pharo-users] can I make this so the vm would not be not responsibe when running the tests

2020-01-05 Thread Richard O'Keefe
Time microsecondsToRun: [ |n| n := (2 raisedToInteger: 8 * 8) - 1. Transcript nextPutAll: 'The number of grains on an 8x8 chessboard is '; print: n; cr; endEntry]. On my laptop, this reports 194 microseconds. Why would you use recursion, anyway? Time microsecondsToRun: [

Re: [Pharo-users] can I make this so the vm would not be not responsibe when running the tests

2020-01-05 Thread Richard O'Keefe
ld check for > that and for the total I do not need that part. > > Roelof > > > > Op 5-1-2020 om 13:58 schreef Richard O'Keefe: > > Time microsecondsToRun: [ > > |n| > > n := (2 raisedToInteger: 8 * 8) - 1. > > Transcript > >

Re: [Pharo-users] can I make this so the vm would not be not responsibe when running the tests

2020-01-06 Thread Richard O'Keefe
ay. > > That said, any solution will do. Your advice on alternative considerations > is insightful and always good to read. > > cheers -ben > > On Mon, 6 Jan 2020 at 00:25, Richard O'Keefe wrote: >> >> I did not ask why you were validating input.

  1   2   3   4   >