Re: [Jprogramming] Empty lists?

2017-06-08 Thread Michael Rice
works fine for me. > > Henry Rich > > > > > On 6/8/2017 10:07 AM, Michael Rice wrote: > >> @ Raul Miller >> >> Back in Win 10 jqt now. Here's what I get for inputting the first four >> functions: >> >> move_table=:

Re: [Jprogramming] Empty lists?

2017-06-08 Thread Michael Rice
ndow, then > go back to the yellow window to try it out). > > Meanwhile: > >solitaire 0 10 14 > No solution >timespacex 'solitaire 0 10 14' > 6.53433 41600 > > Thanks, > > -- > Raul > > > On Thu, Jun 8, 2017 at 8:37 AM, Michael Rice

Re: [Jprogramming] Empty lists?

2017-06-08 Thread Michael Rice
ing wrong with this approach, let me know > and I'll see if I can wrap my head around those issues. > > Thanks, > > -- > Raul > > > On Wed, Jun 7, 2017 at 11:21 PM, Michael Rice wrote: > > @ Raul Miller > > > > "I guess I disagree with the mode

Re: [Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
; so f empty is a verb (a hook) > > > > > > f=: 1&, > > > (f empty) 3 > > > > > > > > > > > > $(f empty) 3 > > > 3 0 > > > $(f empty) 5 > > > 5 0 > > > > > > The reasons for

Re: [Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
(f empty) 3 > > > > > > > > $(f empty) 3 > > 3 0 > > $(f empty) 5 > > 5 0 > > > > The reasons for this are documented at > > http://www.jsoftware.com/help/dictionary/dictf.htm (hooks) and > > http://www.jsoftware.com/h

Re: [Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
sive parameters. > > And for the peg problem, I only see three significant arrays: the > board, the moves to reach that board and the list of legal moves. > Recursive contexts give you a stack, allowing you to backtrack with > these arrays. I'm not seeing why you need more than

Re: [Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
giving up on. Usually, though, "academic exercises" - which > typically focus more on how the goal is reached than on reaching the > goal - tend to feel forced in J.) > > Thanks, > > -- > Raul > > > On Wed, Jun 7, 2017 at 1:03 PM, Michael Rice wrote: > > @rober

Re: [Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
onary/dictf.htm (hooks) and > > http://www.jsoftware.com/help/dictionary/d630n.htm (x m&v y). > > > > That said, verbs take arguments and empty is a verb - it always > > produces an empty result, but only when it gets an argument. > > > > I hope this helps, &

Re: [Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
1:39 AM, Michael Rice wrote: > Oops! Guess I creamed empty. Will close and regen Jqt before proceeding. > > Done! > >f =: (1&,) >f 2 > 1 2 >f empty > f empty > > Shouldn't it have returned > > 1 > > ? > > On Wed, Jun 7,

Re: [Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
; > I may be wrong in doing this, but I usually write > > empty=: '' > > to signify an empty list, array, matrix etc. > > > > > > On Jun 7, 2017, 23:59, at 23:59, Michael Rice > wrote: > >> Is there a special "noun" for an empty

[Jprogramming] Empty lists?

2017-06-07 Thread Michael Rice
Is there a special "noun" for an empty list? Creating one seems enigmatic. empty =: 1 2 empty 1 2 empty =: }. empty empty 2 empty =: }. empty empty empty1 =: |syntax error | empty1=: -- For information abo

Re: [Jprogramming] Factorial function, same style as this recursion example?

2017-06-06 Thread Michael Rice
For a 0,1,2,3 4,...n representation of the board, I take it? Thanks. Michael On Tue, Jun 6, 2017 at 10:18 AM, Henry Rich wrote: > I use > > setintersect =: e. # [ > > Henry Rich > > > On 6/6/2017 6:11 AM, 'Mike Day' via Programming wrote: > >> My poi

Re: [Jprogramming] Factorial function, same style as this recursion example?

2017-06-06 Thread Michael Rice
> If you're not getting this, it might be worth looking at where your > intermediate results start conflicting with the ones I've shown here? > > Thanks, > > -- > Raul > > > On Tue, Jun 6, 2017 at 8:53 AM, Michael Rice wrote: > > For a starting state of posit

Re: [Jprogramming] Factorial function, same style as this recursion example?

2017-06-06 Thread Michael Rice
;Mike Day' via Programming < programm...@jsoftware.com> wrote: > My point being, if Michael Rice is exploring how to solve peg solitaire, > it's often useful to work on small(er) problems, before perhaps getting > stuck in a long loop, or seeing the memory climb and o

Re: [Jprogramming] Factorial function, same style as this recursion example?

2017-06-05 Thread Michael Rice
actorial=: ! > > factorial=: (* $:@<:)`1:@.(1>])"0 > > Or, if you prefer: > > factorial=: (* factorial@<:)`1:@.(1>])"0 > > Note that (* $:@<:)`1:@.(1>])"0 is far less efficient than ! but at > least it's less genera

[Jprogramming] Factorial function, same style as this recursion example?

2017-06-05 Thread Michael Rice
Keep it simple, please. --- From "Learning J": *To compute the sum of a list of numbers, we have seen the verb +/ but let us look at another way of defining a summing verb.* *The sum of an empty list of numbers is zero, and otherwise the sum is the first item plus the su

Re: [Jprogramming] Writing dyadic function with left/right parameters swapped

2017-06-05 Thread Michael Rice
1 > 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 >0 2 5 f 5 f 15$1 > 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 >3 1 0 f 0 2 5 f 5 f 15$1 > 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 > > Пн, 05 июн 2017, Michael Rice написал(а): > > The gap between J and most computer languages is pretty wide. > >

Re: [Jprogramming] Writing dyadic function with left/right parameters swapped

2017-06-05 Thread Michael Rice
ves for the current > board) and 3 (a path list for the solution, initially empty) in this > description? > > Thanks, > > -- > Raul > > > On Mon, Jun 5, 2017 at 12:39 AM, Michael Rice wrote: > > The gap between J and most computer languages is pretty wide. &g

Re: [Jprogramming] Writing dyadic function with left/right parameters swapped

2017-06-04 Thread Michael Rice
> > This sort of rephrasing might get a more involved if we started to get > into variable width values for z, but it's not yet clear to me if that > becomes necessary, nor what the patterns would be like if we went > there. > > Hopefully that makes sense? > > Thanks, >

Re: [Jprogramming] Writing dyadic function with left/right parameters swapped

2017-06-04 Thread Michael Rice
ill lam wrote: > I have difficulty in reading your code, perhaps you want to > make everything looks functional. To that end, you may > replace the if/then with @. (agenda) > (+./ @: ({ & id))`({ & id)@.((< & 2) @: #) > > (untested and not sure if this is a simplicat

Re: [Jprogramming] Writing dyadic function with left/right parameters swapped

2017-06-04 Thread Michael Rice
0 move_table legal_moves board On Sun, Jun 4, 2017 at 10:03 AM, Raul Miller wrote: > Like this? > >(#~ 5=2#.@:|])z > 3 4 5 > > -- > Raul > > > On Sun, Jun 4, 2017 at 9:43 AM, Michael Rice wrote: > > How about > >1 0 1 0 1 0 (#~ ((-: &

Re: [Jprogramming] Writing dyadic function with left/right parameters swapped

2017-06-04 Thread Michael Rice
Because 1=#$0 1 0: > ] #~ (0 1 0 -:"1 ])@:(z { [) > Trains: > ] #~ (0 1 0 -:"1 ]@:(z { [)) > ] #~ 0 1 0 -:"1 ]@:(z { ]) > ] #~ 0 1 0 -:"1 z { [ > > Can't get it any simpler. > > Cheers, > Louis > >

[Jprogramming] Writing dyadic function with left/right parameters swapped

2017-06-03 Thread Michael Rice
z =: 2 3 $ i.6 z 0 1 2 3 4 5 z { 1 0 1 0 1 0 1 0 1 0 1 0 (-: & 0 1 0) z { 1 0 1 0 1 0 0 (-: & 0 1 0)"1 z { 1 0 1 0 1 0 0 1 ((-: & 0 1 0)"1 z { 1 0 1 0 1 0) # z 3 4 5 z #~ ((-: & 0 1 0)"1 z { 1 0 1 0 1 0) 3 4 5 z #~ ((-: & 0 1 0)"1 (1 0 1 0 1 0 {~ z)) 3 4 5 z #~ ((-: & 0 1

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-30 Thread Michael Rice
nding webkit for Qt. I had googled, some > said they used command > rpm -qa | grep qt5 > to list all qt5 packages. > > In any case, linux jqt binaries is consist of only 2 files: > jqt and libjqt.so and it will never mess up distro' Qt binaries. > > Вт, 30 май 2017, Mich

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-30 Thread Michael Rice
like windows and Mac, jqt does not > bundle Qt libs under linux. Users are expected to get them from their linux > distro. > > > > > On 30 May, 2017 9:55 am, "Michael Rice" wrote: > > My memory tells me I've done this before, got this result, and moved on to

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
code.jsoftware.com/wiki/System/Installation > <http://code.jsoftware.com/wiki/System/Installation/Linux> > > > On 30 May, 2017 8:37 am, "Michael Rice" wrote: > > Only three .deb versions are listed here for Linux download: > http://code.jsoftware.com/wiki/Syst

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
Only three .deb versions are listed here for Linux download: http://code.jsoftware.com/wiki/System/Installation/Linux On Mon, May 29, 2017 at 8:25 PM, bill lam wrote: > If you can't install the deb, try the tgz version. > > On 30 May, 2017 7:54 am, "Michael Rice" wrote

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
: >id&{~ k >k id&{ k > > ... but you probably do not want to go there right now... > > -- > > Finally, for installation problems (getting J to run on fedora), if > you have time, maybe post the errors you were getting (along with what > you did to get them) to

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
ting J to run on fedora), if > you have time, maybe post the errors you were getting (along with what > you did to get them) to the general@jsoftware list? > > Thanks, > > -- > Raul > > > On Mon, May 29, 2017 at 11:15 AM, Michael Rice > wrote: > > (id {~ ])? >

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
gt; (except for arguments outside the domain). > > I hope this helps, > > -- > Raul > > > On Mon, May 29, 2017 at 9:22 AM, Michael Rice wrote: > > Thanks. > > > > I found that after I couldn't find it and wrote my own, but it seemed to > be >

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
0 0 0 0 0 0 0 0 0 > > This might obviate the need for id in the first place and simplify your > overall solution. > > HTH, Regards Rob > > > > On 29 May 2017, at 9:22 am, Michael Rice wrote: > > > > Thanks. > > > > I found that after I couldn't fin

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
> > or bitwise 2b10110 b. > > > > On 05/28/2017 08:00 AM, programming-requ...@forums.jsoftware.com wrote: > >> Message: 5 >> Date: Sat, 27 May 2017 23:51:29 -0400 >> From: Michael Rice >> To: programming >> Subject: Re: [Jprogram

Re: [Jprogramming] Function creation, without creating subfunctions

2017-05-27 Thread Michael Rice
definition. > > I hope this helps, > > -- > Raul > > > On Sat, May 27, 2017 at 10:28 PM, Michael Rice > wrote: > > NB. 15 position peg solitaire > > NB. The board (position 5 initially vacant) > > > > NB. 0 > > NB. 1 2 > &

[Jprogramming] Function creation, without creating subfunctions

2017-05-27 Thread Michael Rice
NB. 15 position peg solitaire NB. The board (position 5 initially vacant) NB. 0 NB. 1 2 NB. 3 4 5 NB.6 7 8 9 NB. 10 11 12 13 14 xor =: ((+.)*.(-.@:*.)) board =: 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 NB. 0s for vacant, 1s occupied board 1 1 1 1 1 0 1 1 1 1 1 1

Re: [Jprogramming] Is right shift working properly?

2017-05-25 Thread Michael Rice
r > > On May 25, 2017 10:41 PM, "Michael Rice" wrote: > > > From the documentation: > > > >|.!._ i.6 NB. Monad: |.!._ y (shift right 1) is same as Dyad: x > > |.!._ y with x=_1 > > _ 0 1 2 3 4 > > > > When I try it=== > &

[Jprogramming] Is right shift working properly?

2017-05-25 Thread Michael Rice
From the documentation: |.!._ i.6 NB. Monad: |.!._ y (shift right 1) is same as Dyad: x |.!._ y with x=_1 _ 0 1 2 3 4 When I try it=== |.!._ i.6 _ 0 1 2 3 4 |.!.0 i.6 0 0 1 2 3 4 _1 |.!._ i.6 _ 0 1 2 3 4 _1 |.!.0 i.6 0 0 1 2 3 4 _2 |.!.0 i.6 0 0 0 1 2 3 So far, so good.