Re: [Jprogramming] Stop command when testing

2020-11-26 Thread HH PackRat
Hi, Don!

On 11/27/20, Don Kelly  wrote:
> That is fine- it is something from "TEurbo Basic" and implemented in APL
> , in a way.and is very useful, but it only works if you detect, during
> coding, when to deal with a problem due, often, to coding errors. What
> is needed is an interrupt outside of J (as an interrupt optio may not be
> available-except through a command to windows to stop.(alt crtrl del).

I used it because it was in NuVoc as well as in the old Vocabulary's
Control Structures.  (I know very little about using APL and its ins
and outs.)  I think of myself as an advanced beginner and pretty much
stick to about half of the possible primitives, mostly because I have
no need of a lot of the higher math primitives.  What I continue to
learn about the primitives that I know are further applications and
nuances of those primitives.  After 14 years of programming in J, I
don't ever recall encountering a J "meltdown"/crash or a "runaway"
program--"knock on wood".  (A runaway program, of course, would
require an external interrupt of some kind.)

Thanks for your comments!

Harvey
--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Merging (amending?) two different data files

2020-11-26 Thread HH PackRat
Hello again!  Another stock market related question:

I need to merge the data of two different data files on the basis of
common dates.

QUESTION 1  --  I know that I can use a "for." loop, but I was
wondering if there was perhaps a better (perhaps faster?), more J-like
approach.  The basic idea is matching dates in a smaller file against
a fuller set of dates in a larger file and, if the dates match, to
append/merge/amend the value in the smaller file in with the data of
the larger file for that date (see data examples below).

QUESTION 2  --  I don't know how Excel handles J files, but is it
better to add a column of empty values to Data set A to amend into
(with alphabetic letters) or to have a column of spaces into which to
amend alphabetic letters?

Here are sample data to illustrate what I'm trying to do:

Data set A consists of sequential calendar dates, daily lows, and daily highs.
Data set B consists of dates on which either a top (T) or bottom (B) occurred.
Data set C is the merged/amended result: dates, lows, highs, and T/B's (if any)

Data set A:
2015-01-14,153.74,156.49
2015-01-15,154.16,156.97
2015-01-16,153.82,157.63
2015-01-17,,
2015-01-18,,
2015-01-19,,
2015-01-20,154.03,157.33
2015-01-21,151.07,154.50
2015-01-22,151.76,155.72
2015-01-23,154.89,157.60
2015-01-24,,
2015-01-25,,
2015-01-26,155.77,159.46
2015-01-27,152.59,155.09
2015-01-28,151.55,154.53
2015-01-29,149.52,155.58
2015-01-30,153.04,155.24

Data set B:  [merged/amended with A to form C]
2015-01-16,T
2015-01-21,B
2015-01-26,T
2015-01-29,B

Data set C:  [final result]
2015-01-14,153.74,156.49,
2015-01-15,154.16,156.97,
2015-01-16,153.82,157.63,T
2015-01-17,,,
2015-01-18,,,
2015-01-19,,,
2015-01-20,154.03,157.33,
2015-01-21,151.07,154.50,B
2015-01-22,151.76,155.72,
2015-01-23,154.89,157.60,
2015-01-24,,,
2015-01-25,,,
2015-01-26,155.77,159.46,T
2015-01-27,152.59,155.09,
2015-01-28,151.55,154.53,
2015-01-29,149.52,155.58,B
2015-01-30,153.04,155.24,

The reason I mentioned a possible speed difference between a "for."
loop and something else is that it's quite possible for Data set B
above to have large distances between matches which could result in a
lot of wasted time checking for matches when there were none.  (I
chose this example because it showed several matches within a small
number of dates.  Other data sets could be significantly different.)

Even if a "for." loop is perhaps the best approach, I do still need to
know an answer to the second question--which is more typical for a
blank, empty column: empty values (such as a:) or single spaces?  In
this case, the other possible values in this column would be scattered
values of "T" (top) and "B" (bottom).

I appreciate any help with this!

Harvey
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Stop command when testing

2020-11-26 Thread Don Kelly
That is fine- it is something from "TEurbo Basic" and implemented in APL 
, in a way.and is very useful, but it only works if you detect, during 
coding, when to deal with a problem due, often, to coding errors. What  
is needed is an interrupt outside of J (as an interrupt optio may not be 
available-except through a command to windows to stop.(alt crtrl del).


I would like to know

Don


On 2020-11-26 8:54 p.m., HH PackRat wrote:

I figured out how to do what I wanted:
 . . .
 . . .
goto_stop.
 . . .
 . . .
label_stop.
)

The name "stop", of course, can be any label name you wish.  In
effect, this pattern can be used to "rem out" (remark out) any portion
of code that you don't want executed at a particular moment of
testing.  I presume, as well, that you could conceivably have more
than one of these pairs as long as the labels ("stop" in this case)
are different.  (However, I am by no means an expert in J concerning
the latter point.)

Harvey
--
For information about J forums see http://www.jsoftware.com/forums.htm

--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Stop command when testing

2020-11-26 Thread HH PackRat
I figured out how to do what I wanted:
. . .
. . .
goto_stop.
. . .
. . .
label_stop.
)

The name "stop", of course, can be any label name you wish.  In
effect, this pattern can be used to "rem out" (remark out) any portion
of code that you don't want executed at a particular moment of
testing.  I presume, as well, that you could conceivably have more
than one of these pairs as long as the labels ("stop" in this case)
are different.  (However, I am by no means an expert in J concerning
the latter point.)

Harvey
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Stop command when testing

2020-11-26 Thread 'Pascal Jasmin' via Programming


on windows it is in bin subfolder to J installation.




On Thursday, November 26, 2020, 10:05:08 p.m. EST, Don Kelly  
wrote: 





that is fine-but when  a J  program is running  wild- how do I bring up 
"break.bat"?  I would like to know how to do this, other than ctrl 
alt-del  and then shut down J.

Don Kelly

On 2020-11-26 4:30 p.m., 'Pascal Jasmin' via Programming wrote:
> there is also a "break" utility (break.bat in windows) which will stop a 
> "runaway" program/function when executed..
>
>
>
>
>
>
> On Thursday, November 26, 2020, 06:10:10 p.m. EST, chris burke 
>  wrote:
>
>
>
>
>
> Use dbstopme to stop at a specific line, see the example below. A
> non-empty argument is a test, so stop if true.
>
> Caution: if using 902 beta, get the latest beta and qt addon, as there
> have been recent updates to debug.
>
> foo=: 4 : 0
> a=. 2 + y
> dbstopme''
> b=. a * 5
> x + b
> )
>
> dbg 1
> 2 foo 3
>
> On Thu, Nov 26, 2020 at 2:20 PM HH PackRat  wrote:
>> I could have sworn that, a couple of months ago, someone posted some
>> code that included a "stop" command of some sort in explicit coding,
>> but I can't remember how it was done.  I cannot find such a command
>> anywhere in NuVoc.  Searching the wiki brought back the
>> "Vocabulary/JBreak" ancillary page, which referred only to the desktop
>> icon for basically stopping a "runaway" program.
>>
>> What I'm looking for is a J command of some type (something like
>> "stop." or some synonym).  As I'm testing a program, I often want to
>> stop ever so often without executing the entire program.  "break." and
>> "end." obviously don't work, since J won't even load a program that
>> doesn't use those words correctly as part of a larger construction.
>>
>> All I want to do is stop the program in the middle without using a
>> deliberate error (such as "13!:8 2") and without continuing to the end
>> of the program.  I would appreciate any help with this!
>>
>> Harvey
>> --
>> 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


Re: [Jprogramming] Stop command when testing

2020-11-26 Thread Don Kelly
that is fine-but when  a J  program is running  wild- how do I bring up 
"break.bat"?  I would like to know how to do this, other than ctrl 
alt-del  and then shut down J.


Don Kelly

On 2020-11-26 4:30 p.m., 'Pascal Jasmin' via Programming wrote:

there is also a "break" utility (break.bat in windows) which will stop a 
"runaway" program/function when executed..






On Thursday, November 26, 2020, 06:10:10 p.m. EST, chris burke 
 wrote:





Use dbstopme to stop at a specific line, see the example below. A
non-empty argument is a test, so stop if true.

Caution: if using 902 beta, get the latest beta and qt addon, as there
have been recent updates to debug.

foo=: 4 : 0
a=. 2 + y
dbstopme''
b=. a * 5
x + b
)

dbg 1
2 foo 3

On Thu, Nov 26, 2020 at 2:20 PM HH PackRat  wrote:

I could have sworn that, a couple of months ago, someone posted some
code that included a "stop" command of some sort in explicit coding,
but I can't remember how it was done.  I cannot find such a command
anywhere in NuVoc.  Searching the wiki brought back the
"Vocabulary/JBreak" ancillary page, which referred only to the desktop
icon for basically stopping a "runaway" program.

What I'm looking for is a J command of some type (something like
"stop." or some synonym).  As I'm testing a program, I often want to
stop ever so often without executing the entire program.  "break." and
"end." obviously don't work, since J won't even load a program that
doesn't use those words correctly as part of a larger construction.

All I want to do is stop the program in the middle without using a
deliberate error (such as "13!:8 2") and without continuing to the end
of the program.  I would appreciate any help with this!

Harvey
--
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


Re: [Jprogramming] Stop command when testing

2020-11-26 Thread 'Pascal Jasmin' via Programming
there is also a "break" utility (break.bat in windows) which will stop a 
"runaway" program/function when executed..






On Thursday, November 26, 2020, 06:10:10 p.m. EST, chris burke 
 wrote: 





Use dbstopme to stop at a specific line, see the example below. A
non-empty argument is a test, so stop if true.

Caution: if using 902 beta, get the latest beta and qt addon, as there
have been recent updates to debug.

foo=: 4 : 0
a=. 2 + y
dbstopme''
b=. a * 5
x + b
)

dbg 1
2 foo 3

On Thu, Nov 26, 2020 at 2:20 PM HH PackRat  wrote:
>
> I could have sworn that, a couple of months ago, someone posted some
> code that included a "stop" command of some sort in explicit coding,
> but I can't remember how it was done.  I cannot find such a command
> anywhere in NuVoc.  Searching the wiki brought back the
> "Vocabulary/JBreak" ancillary page, which referred only to the desktop
> icon for basically stopping a "runaway" program.
>
> What I'm looking for is a J command of some type (something like
> "stop." or some synonym).  As I'm testing a program, I often want to
> stop ever so often without executing the entire program.  "break." and
> "end." obviously don't work, since J won't even load a program that
> doesn't use those words correctly as part of a larger construction.
>
> All I want to do is stop the program in the middle without using a
> deliberate error (such as "13!:8 2") and without continuing to the end
> of the program.  I would appreciate any help with this!
>
> Harvey
> --
> 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


Re: [Jprogramming] Stop command when testing

2020-11-26 Thread chris burke
Use dbstopme to stop at a specific line, see the example below. A
non-empty argument is a test, so stop if true.

Caution: if using 902 beta, get the latest beta and qt addon, as there
have been recent updates to debug.

foo=: 4 : 0
a=. 2 + y
dbstopme''
b=. a * 5
x + b
)

dbg 1
2 foo 3

On Thu, Nov 26, 2020 at 2:20 PM HH PackRat  wrote:
>
> I could have sworn that, a couple of months ago, someone posted some
> code that included a "stop" command of some sort in explicit coding,
> but I can't remember how it was done.  I cannot find such a command
> anywhere in NuVoc.  Searching the wiki brought back the
> "Vocabulary/JBreak" ancillary page, which referred only to the desktop
> icon for basically stopping a "runaway" program.
>
> What I'm looking for is a J command of some type (something like
> "stop." or some synonym).  As I'm testing a program, I often want to
> stop ever so often without executing the entire program.  "break." and
> "end." obviously don't work, since J won't even load a program that
> doesn't use those words correctly as part of a larger construction.
>
> All I want to do is stop the program in the middle without using a
> deliberate error (such as "13!:8 2") and without continuing to the end
> of the program.  I would appreciate any help with this!
>
> Harvey
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


[Jprogramming] Stop command when testing

2020-11-26 Thread HH PackRat
I could have sworn that, a couple of months ago, someone posted some
code that included a "stop" command of some sort in explicit coding,
but I can't remember how it was done.  I cannot find such a command
anywhere in NuVoc.  Searching the wiki brought back the
"Vocabulary/JBreak" ancillary page, which referred only to the desktop
icon for basically stopping a "runaway" program.

What I'm looking for is a J command of some type (something like
"stop." or some synonym).  As I'm testing a program, I often want to
stop ever so often without executing the entire program.  "break." and
"end." obviously don't work, since J won't even load a program that
doesn't use those words correctly as part of a larger construction.

All I want to do is stop the program in the middle without using a
deliberate error (such as "13!:8 2") and without continuing to the end
of the program.  I would appreciate any help with this!

Harvey
--
For information about J forums see http://www.jsoftware.com/forums.htm