P.S. Bad grammar there because of search&replace. (I had a variable named 'number' which I had changed to 'answer' and I did not proofread adequately after changing it.)
Proofreading, and library skills, are perhaps essential skills for a programmer, possibly as important as differential equations, anthropology and creative writing. FYI, -- Raul On Sat, Feb 27, 2021 at 3:34 PM Raul Miller <[email protected]> wrote: > > Honestly, I think we need more games here. > > Games are useless enough that people can mess up freely while working > on them, but can be "deep" enough to engage whatever techniques we > feel comfortable bringing to bear. > > That said, doing anything which ties to real world equipment would > also be incredibly interesting. (But likely also gets into > compatibility issues.) > > That said, our way of doing things here has tended to result in poor > long-term compatibility, which means that printed examples of code > frequently do not work. I ran into this just now looking for how to > prompt the user to type something. These things can always be worked > around, if the coder is sufficiently experienced, but it can be tough. > > Anyways, to stay somewhat on topic for the forum (though not for the > titled subject of this thread -- I should probably have thought harder > to find a game context which uses folds), here's an update to the > rosettacode bulls and cows game implementation for j903: > > plural=: {{ (":m),' ',n,'s'#~1~:m }} > > bullcow=: {{ NB. usage: bullcow '' > answer=: 1+4?9 > 9!:19]0 > r=.,:'Guess my answer (type ''guess'' followed by' > r=.r,'a four digit answer where every digit is different).' > r=.r,'' > r=.r,'My response will be the answer of bulls (exact digit' > r=.r,'matches and the answer of cows (digit matches in the' > r=.r,'wrong position).' > }} > > guess=: {{ > if. 0~:{.0$,y do.'Guesses must be a single answer'return.end. > if. -.''-:$y do.'Guesses must be a single answer'return.end. > if. y~:<.|y do.'Guesses must be a positive integer'return.end. > if. 9999<y do.'Guesses must have four different digits'return.end. > if. 123>y do.'Guesses must have four different digits'return.end. > number=. 10 10 10 10#:y > if. 4~:#~.number do. > 'Guesses must have four different digits'return.end. > if. number-:answer do. > 'You win.' [ bullcow '' > else. > bulls=. +/number=answer > cows=. (+/number e.answer)-bulls > echo bulls plural 'bull',' and ',cows plural 'cow','.' > end. > }} > > Thanks, > > -- > Raul > > On Sat, Feb 27, 2021 at 6:41 AM R.E. Boss <[email protected]> wrote: > > > > I'm one of that silent minority (no longer so), since I'm unaware of the > > working of Fold, but I am convinced that "the best is the enemy of the > > good". > > But it is not the first time, and it will not be the last time, I see > > discussions in the forum from which I know it would be better if people > > would use J and share their experiences, without trying to immediately > > change the world we live in. > > In other words, there is a lack of 'programming' in this forum, IMHO. > > > > > > R.E. Boss > > > > > > -----Original Message----- > > From: Programming <[email protected]> On Behalf Of > > 'Sergey Kamenev' via Programming > > Sent: donderdag 25 februari 2021 18:13 > > To: [email protected] > > Subject: Re: [Jprogramming] Contrintuitive argument order in Fold right verb > > > > I think the invention of Fold verbs is incredibly powerful, so I use them. > > But, as you understand, > > I think that these verbs can be made even stronger by making a slight > > improvement. > > > > Sergey. > > > > 25.02.2021 19:51, Eric Iverson пишет: > > > I am a member of the silent majority on this issue. > > > > > > I have been pleased with the civility of the fold discussion > > > considering how emotional language issues can be. > > > > > > J is not designed by vote or committee. There are always going to be > > > strong disagreements. But we are a small community and are best served > > > by, at the appropriate time, burying those disagreements and moving > > > on. I think that time has come for fold. > > > > > > J is the better for having fold. Let's focus now on using it and > > > sharing how it can be used. Some labs or wiki pages would be nice! > > > > > > > > > > > > > > > On Thu, Feb 25, 2021 at 11:25 AM Hauke Rehr <[email protected]> > > > wrote: > > > > > >> Good point about the silent ones: you’re right, I guess. > > >> > > >> I still disagree regarding fold being used the way you tell us. > > >> What you want to do can be done with / and the likes. > > >> Again, the main advantage of the fold verbs from my pont of view is > > >> that there may be any kind of initial data processed by v in a way > > >> given by x’s items’ values. > > >> > > >> But let’s just settle on “we agree to disagree” – I don’t think > > >> further back and forth will lead us somewhere. > > >> > > >> (and maybe I need to get some rest ere I write more rubbish here) > > >> > > >> Hauke > > >> > > >> Am 25.02.21 um 17:19 schrieb 'Sergey Kamenev' via Programming: > > >>> I think Henry Rich is most likely a genius programmer. > > >>> > > >>> By the way, I am a supporter of meritocracy, when the weight of a > > >>> person's voice depends on his merits. > > >>> > > >>> But a programming language is written for the community. > > >>> And so the voice of the community when discussing new features > > >>> should carry a lot of weight. > > >>> > > >>> The definition of a fold itself implies that there is an array that > > >>> will fold. > > >>> However, the initial value does not have to be an array, but what is > > >>> collapsed arg must be an array. > > >>> > > >>> Right argument have more arrayness in comparing with left arg. > > >>> > > >>> The silent majority most likely does not use Fold verbs, therefore > > >>> they are silent, since this topic does not concern them. > > >>> > > >>> Sergey. > > >>> -------------------------------------------------------------------- > > >>> -- For information about J forums see > > >>> http://www.jsoftware.com/forums.htm > > >> > > >> -- > > >> ---------------------- > > >> mail written using NEO > > >> neo-layout.org > > >> > > >> --------------------------------------------------------------------- > > >> - For information about J forums see > > >> http://www.jsoftware.com/forums.htm > > >> > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
