Re: [Jprogramming] Agenda on different versions ...

2023-12-26 Thread Devon McCormick
I don't know about the history but in 9.5.5 (under Windows 10):
   (0:`1: @. (2&|)) i.4
0 1 0 1

On Tue, Dec 26, 2023 at 7:44 AM Martin Kreuzer  wrote:

> Dear all -
>
> This left me puzzled today; have I missed some developments ?
> (all in Console on Windows10)
>
> -  v8.07 -
>
> (0:`1: @. (2&|)) i.1
> |rank error
> |   (0:`1:@.(2&|))i.1
>
> -  v9.0.1 -
>
> (0:`1: @. (2&|)) i.1
> |rank error
> |   (0:`1:@.(2&|))i.1
>
> -  v9.0.2 -
>
> (0:`1: @. (2&|)) i.4
> 0 1 0 1
> (0:`1: @. (2&|)) i.5
> |rank error
> |   (0:`1:@.(2&|))i.5
>
> -  v9.5.1 -
>
> (0:`1: @. (2&|)) i.4
> 0 1 0 1
> (0:`1: @. (2&|)) i.5
> |rank error, executing monad (0:`1:)@.(2&|)
> |each gerund must return a result whose shape agrees with its inputs
> |   (0:`1:@.(2&|))i.5
>
> What did happen between v9.0.1 andv 9.0.2 ?
>
> -Martin
>
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Roger's Essay 'Continued Fractions' ...

2023-12-22 Thread Devon McCormick
I tested the revised code and it works properly for the examples, returning *_4
1 11;3 12* for *qcf 10 _1 _3 2* whereas the older version gives the same
result (*0;12 3*) for both *qcf 10 _1 _3 2* and *qcf 10 1 _3 2*.
I edited the body of *qcf* to remove the commented out line that Martin
revised since his change looks correct.

On Fri, Dec 22, 2023 at 2:42 PM Martin Kreuzer  wrote:

> Hi all -
>
> (This wasn't an easy one for me, as I still very much miss him.)
>
> I have been into CF for some time and re-read the essay this morning.
>
> It looks as there was a small glitch (maybe typo) in the body of function
> *qcf.
>
> May I ask you (having much more experience than me) to have a look at
> my edits as I do by no means want to spoil something.
>
> Many thanks.
>
> -Martin
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] J9.5.1 release available

2023-12-20 Thread Devon McCormick
I followed the Windows installation instructions and I think it worked but
I can't tell and I have to guess where it was installed since there is no
helpful message at the end saying something like "Successfully installed at
location XYZ" or whatever.

On Wed, Dec 20, 2023 at 2:20 PM Eric Iverson 
wrote:

> J9.5.1 release available
>
> If you were running the 9.5 beta, do a full install to get everything and
> have a clean slate. Do not just do an engine upgrade.
>
> https://code.jsoftware.com/wiki/System/Installation/J9.5
>
>  https://code.jsoftware.com/wiki/System/ReleaseNotes/J9.5
>
> The 9.6 beta starts in early 2024.
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] A Dot-Graph Rotator

2023-11-16 Thread Devon McCormick
This sounds like you would want to convert the points to polar
representation:
https://code.jsoftware.com/wiki/User:Devon_McCormick/PolarCartesianConversion
.

On Thu, Nov 16, 2023 at 9:47 AM 'PMA' via Programming <
programm...@jsoftware.com> wrote:

> Hi Henry,
>
> Chris Burke advised me to re-send my original question to this Forum.
>
> Sorry for the duplication.
>
> PA
>
>
> On 11/16/23 09:39, PMA wrote:
> > Thank you for these!  Will pursue...
> >
> > PA
> >
> > On 11/16/23 09:26, Henry Rich wrote:
> >> This is my reply to a question someone posed yesterday.  This
> >> afternoon I will post a complete solution.  It's like the puzzle
> >> problems I posed you, but just a little longer and comes from a real
> >> user need.  If you want to solve it yourself you will need the
> >> primitives
> >>
> >> j. dyad, / monad, / dyad, ~, -. dyad, ^ monad, | dyad, -, /: dyad, *.
> >> monad
> >>
> >> hhr
> >>
> >> On 11/15/2023 6:49 PM, Henry Rich wrote:
> >>> I would find the angles from each point to each other point, take
> >>> modulus(pi/2), concatenate the list with its negative, and sort.
> >>> Rotation by each angle produces a new alignment.  Only J primitives
> >>> are needed.
> >>>
> >>> Use complex numbers to represent the (x,y) values, and *. to convert
> >>> to angles.
> >>>
> >>> Henry Rich
> >>>
> >>> On 11/15/2023 5:52 PM, 'PMA' via Wiki wrote:
> >>>>
> >>>> Dear J-Wiki,
> >>>>
> >>>> I want to make a script that, given the X/Y values of a 2D
> >>>> dot-graph, will rotate the graph around its designated origin,
> >>>> looking for instances of 2 or more points coming into new
> >>>> horizontal &/or vertical alignment, and at each such instance
> >>>> output the full set of current X/Y values (integer-rounded).
> >>>>
> >>>> Could you point me to the main needed ingredients?
> >>>>
> >>>> Thanks in advance,
> >>>>
> >>>> Peter Armstrong
> >>>>
> >>>
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Alternating sequences

2023-10-03 Thread Devon McCormick
There are a lot of convergent sequences given here
https://mathworld.wolfram.com/eContinuedFraction.html, e.g. for *e*:

   2 1,;(<1 1),~&.>2*1+i.x:5   NB. A sequence of
integers
2 1 2 1 1 4 1 1 6 1 1 8 1 1 10 1 1
   0j18":(+%)/2 1,;(<1 1),~&.>2*1+i.x:5
2.718281828458563411


On Tue, Oct 3, 2023 at 1:20 PM Devon McCormick  wrote:

> You can see how Raul's 2nd example, where he does not add 2, has fewer
> correct digits than the one where he does not add it because adding 2 gives
> you two more useful terms, as he mentions.
>
> On Tue, Oct 3, 2023 at 7:35 AM Raul Miller  wrote:
>
>> A couple notes here:
>>
>> One is that 0j18":Y will give you 18 places after the decimal point
>> regardless of the magnitude of Y
>>
>> Another is that we can inspect intermediate results in the expression
>> %-/%!2+x:i.x
>>
>> Let's try that here with smaller values for x (and leaving out the x:
>> so that we're using floating point approximations for more comfortable
>> display):
>>
>>i.4
>> 0 1 2 3
>>!i.4
>> 1 1 2 6
>>!2+i.4
>> 2 6 24 120
>>%!2+i.4
>> 0.5 0.17 0.0416667 0.0083
>>%~/%!2+i.4
>> 2.4
>>
>> Inspecting these results (and perhaps playing with a few other
>> examples), I am reminded that !0 and !1 both have the value 1. And, of
>> course, the reciprocal of 1 is 1. And, %~ will finish up by dividing
>> the accumulated result by these values. So, this skips a couple
>> unnecessary "divide by 1" steps.
>>
>> But, also, adding 2 means that we've added another two significant
>> terms to the initial (right hand side) part of the series, giving us a
>> more accurate result.
>>
>> These correspond to relatively small values in the result, but they do
>> increase its precision.
>>
>> And, I do see a change there, on the right hand side, in the case of
>> the example you suggested:
>>
>>0j18":%-/%!2+i.x:10
>> 2.718281842777827338
>>0j18":%-/%!i.x:10
>> 2.718283693893449991
>>
>> I hope this helps,
>>
>> --
>> Raul
>>
>> On Tue, Oct 3, 2023 at 3:26 AM Richard Donovan 
>> wrote:
>> >
>> > After watching a math video on YouTube I started to investigate the
>> implementation of alternating sequences in J.
>> >
>> > Using the site search function, (alternating sequences site:
>> jsoftware.com)  I discovered an entry in the NYCJUG of 2022-11-08 which
>> contains an excellent example:
>> >
>> >
>> >calce=: 13 : '%-/%!2+i.x: y'
>> >calce 10
>> > 3991680r1468457
>> >20j18":calce 10  NB. Format rational to 20-digit decimal with 18
>> places past the decimal
>> > 2.718281842777827338
>> >
>> > Using this as a startpoint, I followed the logic thru but couldn't
>> understand why 2 is added to i. x: y
>> >
>> > Removing the 2+ doesn't seem to affect the result in any of the cases I
>> tried.
>> >
>> >
>> > Thanks in advance,
>> >
>> > Richard
>> > --
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> --
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
>
>

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Alternating sequences

2023-10-03 Thread Devon McCormick
You can see how Raul's 2nd example, where he does not add 2, has fewer
correct digits than the one where he does not add it because adding 2 gives
you two more useful terms, as he mentions.

On Tue, Oct 3, 2023 at 7:35 AM Raul Miller  wrote:

> A couple notes here:
>
> One is that 0j18":Y will give you 18 places after the decimal point
> regardless of the magnitude of Y
>
> Another is that we can inspect intermediate results in the expression
> %-/%!2+x:i.x
>
> Let's try that here with smaller values for x (and leaving out the x:
> so that we're using floating point approximations for more comfortable
> display):
>
>i.4
> 0 1 2 3
>!i.4
> 1 1 2 6
>!2+i.4
> 2 6 24 120
>%!2+i.4
> 0.5 0.17 0.0416667 0.0083
>%~/%!2+i.4
> 2.4
>
> Inspecting these results (and perhaps playing with a few other
> examples), I am reminded that !0 and !1 both have the value 1. And, of
> course, the reciprocal of 1 is 1. And, %~ will finish up by dividing
> the accumulated result by these values. So, this skips a couple
> unnecessary "divide by 1" steps.
>
> But, also, adding 2 means that we've added another two significant
> terms to the initial (right hand side) part of the series, giving us a
> more accurate result.
>
> These correspond to relatively small values in the result, but they do
> increase its precision.
>
> And, I do see a change there, on the right hand side, in the case of
> the example you suggested:
>
>0j18":%-/%!2+i.x:10
> 2.718281842777827338
>0j18":%-/%!i.x:10
> 2.718283693893449991
>
> I hope this helps,
>
> --
> Raul
>
> On Tue, Oct 3, 2023 at 3:26 AM Richard Donovan 
> wrote:
> >
> > After watching a math video on YouTube I started to investigate the
> implementation of alternating sequences in J.
> >
> > Using the site search function, (alternating sequences site:
> jsoftware.com)  I discovered an entry in the NYCJUG of 2022-11-08 which
> contains an excellent example:
> >
> >
> >calce=: 13 : '%-/%!2+i.x: y'
> >calce 10
> > 3991680r1468457
> >20j18":calce 10  NB. Format rational to 20-digit decimal with 18
> places past the decimal
> > 2.718281842777827338
> >
> > Using this as a startpoint, I followed the logic thru but couldn't
> understand why 2 is added to i. x: y
> >
> > Removing the 2+ doesn't seem to affect the result in any of the cases I
> tried.
> >
> >
> > Thanks in advance,
> >
> > Richard
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Is there a way to distinguish input 1 from 01 ?

2023-09-15 Thread Devon McCormick
If you build a GUI input window, you could probably distinguish between the
different cases but the key is to get input as character.

On Fri, Sep 15, 2023 at 3:43 PM Elijah Stone  wrote:

> No.  No more than you can distinguish 2+2 from 2 + 2.
>
> On Sat, 16 Sep 2023, Piet de Jong wrote:
>
> > But there is a typographical difference.
> > And I guess this is the difference I would like to pick up.
> > Are typographical differences only distinguishable using character input?
> >
> >> On 16 Sep 2023, at 05:24, Elijah Stone  wrote:
> >>
> >> There is no difference between 011 and 11, nor between 008 and 8.
> >>
> >> On Sat, 16 Sep 2023, Piet de Jong wrote:
> >>
> >>> I meant a general verb u such that
> >>> 011 -: 11
> >>> 008 -: 8
> >>> etc are all false.
> >>>
> >>>> On 16 Sep 2023, at 04:50, Elijah Stone  wrote:
> >>>> u=: 1 -: 3!:0
> >>>
> >>> --
> >>> 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
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Multiple guests at the NYCJUG meeting today at 18:30 EST today

2023-09-12 Thread Devon McCormick
We have a couple of guest presenters at today's NYCJUG meeting - don't miss
them!  Sign up at https://www.meetup.com/J-Dynamic-Functional-Programming/
and we'll see you soon!

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Rank difficulties

2023-09-08 Thread Devon McCormick
> >> But the average Joe just wants to solve problems as quickly as possible
> >> and get on with life, not waste time on challenging intricate puzzles.
> >>
> >> So perhaps J is too much “puzzle solving” rather than “problem solving”
> >>
> >> Notwithstanding the above — I’ll always stick with J.
> >>
> >>
> >>> On 8 Sep 2023, at 04:22, Jose Mario Quintana <
> >> jose.mario.quint...@gmail.com> wrote:
> >>> Oops, I forgot o=. @:
> >>>
> >>> On Thu, Sep 7, 2023 at 1:27 PM Jose Mario Quintana <
> >>> jose.mario.quint...@gmail.com> wrote:
> >>>
> >>>>> The order of the last two appear "unnatural".  (To my way of thinking
> >> at
> >>>> least)
> >>>>> This seems to beg the question what is the natural order when
> slicing.
> >>>> The answer might depend on the intended usage of the verb that you
> have
> >> in
> >>>> mind. If, for example,
> >>>> you want to preserve the order of the remaining axes, then Henry's
> >>>> suggestion modified by Raul would work,
> >>>>
> >>>>$ Y=. i.2 3 4 5
> >>>> 2 3 4 5
> >>>>
> >>>>slicep=. ~.@(, i.@#@$) |: ]
> >>>>
> >>>>(0 1 2 3) ($ o slicep"0 _) Y
> >>>> 2 3 4 5
> >>>> 3 2 4 5
> >>>> 4 2 3 5
> >>>> 5 2 3 4
> >>>>
> >>>> Another possibility is to rotate the axes,
> >>>>
> >>>>slicer=. (|. i.@:#@:$@:]) |: ]
> >>>>
> >>>>(0 1 2 3) ($ o slicer"0 _) Y
> >>>> 2 3 4 5
> >>>> 3 4 5 2
> >>>> 4 5 2 3
> >>>> 5 2 3 4
> >>>>
> >>>> I hope this helps
> >>>>
> >>>>
> >>>> On Wed, Sep 6, 2023 at 7:58 PM Piet de Jong 
> wrote:
> >>>>> This works!
> >>>>> Except the ordering of the axes is slightly unusual to my way of
> >>>> thinking.
> >>>>> For example suppose m=.i.3 3 3 is the “cube" be sliced and v is your
> >>>> verb.
> >>>>> Then the items of (0 v m) has successive items  “going back” into the
> >>>> cube.
> >>>>> The items (1 v m) are the horizontal slices.
> >>>>> The items of (2 v m) are the vertical slices.
> >>>>>
> >>>>> The order of the last two appear "unnatural".  (To my way of thinking
> >> at
> >>>> least)
> >>>>> This seems to beg the question what is the natural order when
> slicing.
> >>>>>
> >>>>>> On 7 Sep 2023, at 08:32, Henry Rich  wrote:
> >>>>>>
> >>>>>> Since you want all the slices, what you are looking for is a
> >> transpose.
> >>>>>> Maybe
> >>>>>>
> >>>>>> ~.@(, i.@#) |: ]
> >>>>>>
> >>>>>> Untested.
> >>>>>>
> >>>>>> Henry Rich
> >>>>>>
> >>>>>> On Wed, Sep 6, 2023, 6:10 PM Piet de Jong 
> wrote:
> >>>>>>
> >>>>>>> Here is my “wish"
> >>>>>>>
> >>>>>>> A dyadic (tacit) verb such that x v y gives all the slices of y
> along
> >>>>>>> dimension x, where x is integer.   That is to say
> >>>>>>>
> >>>>>>> i{ x v y
> >>>>>>>
> >>>>>>> is slice i of the array y along dimension x.
> >>>>>>>
> >>>>>>> Thanks for all your help!
> >>>>>>>
> >>>>>>>> On 7 Sep 2023, at 08:04, 'robert therriault' via Programming <
> >>>>>>> programm...@jsoftware.com> wrote:
> >>>>>>>> Or something like this?
> >>>>>>>>
> >>>>>>>>   [n =. i. 2 2 2
> >>>>>>>> 0 1
> >>>>>>>> 2 3
> >>>>>>>>
> >>>>>>>> 4 5
> >>>>>>>> 6 7
> >>>>>>>> ,./ n
> >>>>>>>> 0 1 4 5
> >>>>>>>> 2 3 6 7
> >>>>>>>> ($ $ (,@,./)) n
> >>>>>>>> 0 1
> >>>>>>>> 4 5
> >>>>>>>>
> >>>>>>>> 2 3
> >>>>>>>> 6 7
> >>>>>>>>
> >>>>>>>> Cheers, bob
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> On Sep 6, 2023, at 14:49, 'robert therriault' via Programming <
> >>>>>>> programm...@jsoftware.com> wrote:
> >>>>>>>>> Hi Piet,
> >>>>>>>>>
> >>>>>>>>> Maybe show us what you would want to do with higher dimensions?
> Or
> >> a
> >>>>>>> less symmetric 2 dimensional shape?
> >>>>>>>>> For shape 2 2, I would use the even simpler
> >>>>>>>>>
> >>>>>>>>> |: m
> >>>>>>>>> 0 2
> >>>>>>>>> 1 3
> >>>>>>>>>
> >>>>>>>>> Hope this helps.
> >>>>>>>>>
> >>>>>>>>> Cheers, bob
> >>>>>>>>>
> >>>>>>>>>> On Sep 6, 2023, at 14:26, Brian Schott 
> >>>> wrote:
> >>>>>>>>>> ,./0 1 {"1  m
> >>>>>>>>>
> >>>> --
> >>>>>>>>> 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
> >>> --
> >>> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Google Bard question.

2023-08-29 Thread Devon McCormick
Try asking Bard about APL and matrix computations, then point out the
deficiency in its previous answer and see what it says.


On Tue, Aug 29, 2023 at 6:09 PM 'Skip Cave' via Programming <
programm...@jsoftware.com> wrote:

> What are the best computer languages to deal with matrix operations?
>
> There are many programming languages that are well-suited for matrix
> operations. Here are some of the most popular ones:
>
>- MATLAB: MATLAB is a proprietary programming language developed by
>MathWorks. It is specifically designed for mathematical computing and
> has a
>wide range of built-in functions for matrix operations. MATLAB is a
>powerful language, but it can be expensive to license.
>[image: MATLAB programming language logo]Opens in a new window
><https://en.wikipedia.org/wiki/MATLAB>en.wikipedia.org
><https://en.wikipedia.org/wiki/MATLAB>
>MATLAB programming language logo
>- Python: Python is a general-purpose programming language that is
>becoming increasingly popular for scientific computing. It has a large
> and
>active community of developers, and there are many libraries available
> for
>matrix operations. Python is also free and open-source.
>[image: Python programming language logo]Opens in a new window
><https://en.wikipedia.org/wiki/Python_(programming_language)>
>en.wikipedia.org
><https://en.wikipedia.org/wiki/Python_(programming_language)>
>Python programming language logo
>- Julia: Julia is a relatively new programming language that is designed
>to be fast and efficient for numerical computing. It is still under
>development, but it has a growing community of users.
>[image: Julia programming language logo]Opens in a new window
><https://en.wikipedia.org/wiki/Julia_(programming_language)>
>en.wikipedia.org
><https://en.wikipedia.org/wiki/Julia_(programming_language)>
>Julia programming language logo
>- R: R is a statistical programming language that is widely used for
>data analysis. It has a number of built-in functions for matrix
> operations,
>and there are many additional libraries available.
>[image: R programming language logo]Opens in a new window
><https://commons.wikimedia.org/wiki/File:R_logo.svg>
> commons.wikimedia.org
><https://commons.wikimedia.org/wiki/File:R_logo.svg>
>R programming language logo
>- C/C++: C/C++ are compiled languages that are known for their speed and
>efficiency. They are not as well-suited for matrix operations as some of
>the other languages on this list, but they can be used for very large
> and
>complex calculations.
>[image: C programming language logo]Opens in a new window
><https://commons.wikimedia.org/wiki/File:C_Programming_Language.svg>
>commons.wikimedia.org
><https://commons.wikimedia.org/wiki/File:C_Programming_Language.svg>
>chevron_right
>C programming language logo
>
> The best language for you will depend on your specific needs and
> requirements. If you are looking for a powerful and versatile language with
> a wide range of built-in functions, then MATLAB is a good choice. If you
> are looking for a free and open-source language with a large community of
> users, then Python is a good option. If you need a language that is fast
> and efficient for numerical computing, then Julia is a good choice. If you
> are primarily interested in statistical analysis, then R is a good choice.
> And if you need a language that is very fast and efficient, then C/C++ are
> good choices.
>
> Ultimately, the best way to decide which language is right for you is to
> try them out and see which one you prefer. There are many resources
> available online and in libraries that can help you get started.
> Skip Cave
> Cave Consulting LLC
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] No NYCJUG meeting for August

2023-08-06 Thread Devon McCormick
We will resume meetings of the New York City J Users Group on the second
Tuesday in September.

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Simulations

2023-07-16 Thread Devon McCormick
Say you start with 2 sets of 3D numbers: position & velocity.  You can
guess that one of your most common tasks might be calculating the next
position based on these, something like adding the current position to the
current velocity.  This might lead us to set it up this way for this use
case:
   pv=. <:+:2 10 3?@$0   NB. 2 quantities (position & velocity), for 10
points in 3-space.
   $+/pv NB. Add p to v -> 10 new 3D positions
10 3
   newposn=. +/pvNB. We could assign this but
   pv=. newposn 0}pv NB.   we only use the name once to update the
position plane
   pv=. (+/pv) 0}pv  NB. Update positions (avoiding the unnecessary
name)
It sounds like you want to model collisions so of course it would be more
complex than this but if you start this way and find it's no good for going
forward, it's easy to throw it away and try something else.  You probably
want to make the most commonly done things the easiest to do as I've tried
to demonstrate above for this simple problem; by ordering the array the way
we did, we made this operation simple.







On Sat, Jul 15, 2023 at 11:03 PM Ak O  wrote:

> Hi Marcin,
>
> Have you considered using the Fold Family Operators (F.)?
>
>
> Ak
>
>
> On Sat., Jul. 15, 2023, 07:53 Marcin Żołek, <
> marcin.zo...@students.mimuw.edu.pl> wrote:
>
> > Thanks, your approach is the most convincing.
> >
> > Martin
> >
> > > On Jul 15, 2023, at 3:15 PM, Raul Miller 
> wrote:
> > >
> > > I think the approaches you described are fine.
> > >
> > > That said, another approach would be to think of your dataset as a
> > > table -- one row for each atom, with each column having different
> > > significance. coordinate x,y, z; velocity x,y,z; force x,y,z,  So, if
> > > you had 42 atoms, your data would be a 42 by 9 matrix.
> > >
> > > Or, perhaps it would be better to distinguish x,y,z from
> > > coordinate/velocity/force (the 42 atom example being represented with
> > > a 42 by 3 by 3 array or perhaps more conveniently a 3 by 42 by 3
> > > array).
> > >
> > > This last approach might have an implementation something like:
> > >
> > > do_step=: positions_update, velocities_update,: forces_update
> > >
> > > where each of the update verbs obtains the requisite information from
> > > its y argument.
> > >
> > > I hope this makes sense,
> > >
> > > --
> > > Raul
> > >
> > >
> > > On Sat, Jul 15, 2023 at 8:18 AM Marcin Żołek
> > >  wrote:
> > >>
> > >> I am learning J and writing a program in this language to simulate a
> > physical phenomenon of interactions between atoms (each atom is described
> > by coordinates, velocities, forces, etc.). I am wondering how to store
> data
> > in such a simulation.
> > >>
> > >> The simulation involves applying a function that performs a single
> > simulation step several times:
> > >>
> > >> do_step^:42 initial_data
> > >>
> > >> Simulation step consists of several substeps. Which storage option is
> > better or is there other way than the ones listed below?
> > >>
> > >> 1) Data stored in public nouns (one noun is a matrix of coordinates of
> > atoms, another noun is a matrix of velocities of atoms, etc.). Then
> do_step
> > calls substep functions that overwrites these public nouns:
> > >>
> > >> do_step =: monad define
> > >>velocities =: forces update_velocities velocities
> > >>positions =: velocities update_positions positions
> > >>...
> > >> )
> > >>
> > >> 2) Data stored in an array of boxes (in the first box an array of
> > coordinates of atoms, in the second box an array of velocities of atoms,
> > etc.). Then do_step is the composition of all substep functions and each
> > substep function is a monad that creates modified array of boxes using
> m} :
> > >>
> > >> do_step =: monad : 'do_substep_k ... do_substep_2 do_substep_1 y'
> > >>
> > >> Martin
> > >> --
> > >> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Cannot save plot to format other than PDF

2023-04-25 Thread Devon McCormick
Yes, I do and I think this used to work but I can run my plots from Qt if I
have to.

On Sun, Apr 23, 2023 at 8:26 PM bill lam  wrote:

> I suspect Devon uses jconsole instead of jqt frontend.
>
> On Mon, Apr 24, 2023, 6:41 AM chris burke  wrote:
>
> > Please send bug reports to general, and respond there, thanks.
> >
> > This worked for me as below. What is your environment and what
> > commands were used?
> >
> >load'plot'
> >plot 2 3 7 5
> >pd 'save png tiles.png'
> >
> >JVERSION
> > Engine: j9.4.1/j64avx2/linux
> > Build: commercial/2023-02-27T15:24:41/clang-11-0-0/SLEEF=1
> > Library: 9.5.1
> > Qt IDE: 2.0.3/6.2.2(6.2.2)
> > Platform: Linux 64
> >
> > On Sun, Apr 23, 2023 at 2:38 PM Devon McCormick 
> > wrote:
> > >
> > > It seems like I have this same problem over and over again: I cannot
> send
> > > the result of "plot" to any format other than the default PDF.  Is
> anyone
> > > able to save a plot to e.g. a .PNG file?
> > > When I try the command "pd 'save png tiles2.png'", I get a message
> > telling
> > > me to first display an isigraph plot which I think was available back
> in
> > J6
> > > but is not now.
> > >
> > > --
> > >
> > > Devon McCormick, CFA
> > >
> > > Quantitative Consultant
> > > --
> > > 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
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Cannot save plot to format other than PDF

2023-04-23 Thread Devon McCormick
It seems like I have this same problem over and over again: I cannot send
the result of "plot" to any format other than the default PDF.  Is anyone
able to save a plot to e.g. a .PNG file?
When I try the command "pd 'save png tiles2.png'", I get a message telling
me to first display an isigraph plot which I think was available back in J6
but is not now.

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] distance makes the heart grow fonder

2023-04-01 Thread Devon McCormick
It seems the effect of this proposed line-break character would make code
longer vertically, down the page, but most pages I work on have much more
horizontal than vertical space so this seems like it's heading in the wrong
direction.

On Sat, Apr 1, 2023 at 1:35 PM Raul Miller  wrote:

> It's not really linebreak vs [ -- it's linebreak vs [. or [ depending
> on context, possibly with parenthesis in certain cases.
>
> That said, motivating examples are critical for any language changes,
> and I don't have any for this.
>
> --
> Raul
>
> On Sat, Apr 1, 2023 at 11:35 AM Henry Rich  wrote:
> >
> > When is linebreak used?  That is, when is it superior to [?
> >
> > Henry Rich
> >
> > On 4/1/2023 11:29 AM, Eric Iverson wrote:
> > > I am in favor of linebreak as well as a linejoin. I'd very much like to
> > > have an easier to type NB.
> > >
> > > .. NB.
> > > ... linejoin (followed by comment)
> > >  linebreak
> > >
> > > I used to think internal and nested comments were important, but not
> > > anymore. Not enough bang for the required mechanism.
> > >
> > >
> > >
> > > On Sat, Apr 1, 2023 at 10:48 AM Jan-Pieter Jacobs <
> > > janpieter.jac...@gmail.com> wrote:
> > >
> > >> I'd be in favour of both .. and ... .
> > >> Regarding ... , I'd like to note that Matlab uses the same as line
> joiner
> > >> (see
> > >>
> > >>
> https://www.mathworks.com/help/matlab/matlab_prog/continue-long-statements-on-multiple-lines.html
> > >> ),
> > >> and also turns everything after that into a comment (which is very
> handy).
> > >> This would let one also comment longer tacit verbs well, without any
> > >> extraneous NB.'s . Trivial example would be:
> > >> avg =: ...
> > >> +/ ... sum
> > >> % ... divided by
> > >> # ... count
> > >>
> > >> Your first comment would be incompatible with the easy commenting
> (without
> > >> using NB.).
> > >>
> > >> I don't like the .:. proposal, since it is more difficult to type
> different
> > >> characters instead of the same; I'd rather have ::: (could imagine
> them
> > >> looking like the holes for shoelaces, that can be used to tie together
> > >> lines)...
> > >>
> > >> Jan-Pieter
> > >>
> > >>
> > >>
> > >> On Sat, 1 Apr 2023, 11:26 Elijah Stone,  wrote:
> > >>
> > >>> Some time ago, Michal proposed that a line separator be added.  I
> want to
> > >>> rekindle that discussion.  The proposal was that .. behave like a
> line
> > >>> break
> > >>> when placed on a single line, such that e.g. {{ a=. y+y .. a }} 2
> would
> > >> do
> > >>> the
> > >>> obvious thing.  Short, distinctive, and to the point.
> > >>>
> > >>> I also want to propose a line _joiner_, analogous to \ in shell or c:
> > >> ...,
> > >>> placed at the beginning or end of a line should join it with the
> previous
> > >>> or
> > >>> next.  Joining lines happens _after_ stripping comments, unlike the
> other
> > >>> languages I cited; the goal is to enable large, multi-line
> definitions
> > >>> with
> > >>> commentary for intermediate terms, without the need for pointless
> > >>> intermediate
> > >>> definitions.
> > >>>
> > >>> It might be objectionable to use such similar symbols for separators
> and
> > >>> joiners.  But maybe it's not such a big deal.  Two more ideas:
> > >>>
> > >>> 1. Could use the _same_ symbol for both, with its sense depending on
> > >> where
> > >>> it's placed in a line.
> > >>>
> > >>> 2. Separator could be .:.; metaphor: a hill stops the interpreter in
> its
> > >>> tracks.
> > >>>
> > >>> I don't like 2 because the larger the separator is, the more
> annoying it
> > >>> is to
> > >>> use.  Joiner can afford to be large, since it only comes into play
> if the
> > >>> rest
> > >>> of the line is sufficiently large.
> > >>>
> > >>> Anyway--thoughts?  Comments?  Suggestions?
> > >>>
> > >>>-E
> > >>>
> --
> > >>> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Strange error

2023-03-30 Thread Devon McCormick
It looks like this gives the same result as the expression Bob proposed:
   "."0@": each 40 5 9008 90


On Thu, Mar 30, 2023 at 3:12 PM 'robert therriault' via Programming <
programm...@jsoftware.com> wrote:

> Looking at the issue a bit deeper I don't think that the second ".@": is
> required.
>
> "."0@": each 40 5 9008 90
> ┌───┬─┬───┬───┐
> │4 0│5│9 0 0 8│9 0│
> └───┴─┴───┴───┘
>
> Cheers, bob
>
> > On Mar 30, 2023, at 12:08, 'robert therriault' via Programming <
> programm...@jsoftware.com> wrote:
> >
> > I think it is missing the @ that ties the whole process together with
> the each. Without that @ the boxed result of each is formatted with ": and
> that does not make sense to ". creating a 'spelling error'
> >
> >".@": "."0@": each 40 5 9008 90
> > |spelling error
> > |
> > |   ^
> > |   ".@":"."0@":each 40 5 9008 90
> >   ".@":@ "."0@": each 40 5 9008 90
> > ┌───┬─┬───┬───┐
> > │4 0│5│9 0 0 8│9 0│
> > └───┴─┴───┴───┘
> >
> > Cheers, bob
> >
> >> On Mar 30, 2023, at 12:04, Devon McCormick  wrote:
> >>
> >> This is what I see on J 9.41:
> >>
> >>  ".@": "."0@": each 40 5 9008 90
> >> |length error, executing dyad |
> >> |shapes 4 and 2 do not conform
> >> |   |4 0|5|9 0 0 8|9 0|
> >>
> >> It oddly seems to be trying to execute the separators.
> >>
> >>
> >> On Thu, Mar 30, 2023 at 1:06 PM Henry Rich 
> wrote:
> >>
> >>> My guess is you pasted in a nonbreaking space.  The caret points to the
> >>> error.
> >>>
> >>> Wouldn't you like release 9.4, which would give more error information?
> >>>
> >>> Henry Rich
> >>>
> >>> On 3/30/2023 12:54 PM, Richard Donovan wrote:
> >>>> JVERSION
> >>>> Engine: j902/j64avx2/windows
> >>>> Release-a: commercial/2020-12-05T13:36:01
> >>>> Library: 9.02.08
> >>>> Qt IDE: 1.9.2s/5.12.10(5.12.10)
> >>>> Platform: Win 64
> >>>> Installer: J902 install
> >>>> InstallPath: c:/program files/j902
> >>>>
> >>>>   ".@": "."0@": each 40 5 9008 90
> >>>> |spelling error
> >>>> |
> >>>> | ^
> >>>> | ".@":"."0@":each 40 5 9008 90
> >>>>
> >>>>
> >>>> (NB. required output 4 0 5 9 0 0 8 9 0)
> >>>>
> >>>> The boxed question marks actually appear as an assortment of left, up,
> >>> and down arrows.
> >>>>
> >>>> This is reproducible.
> >>>>
> >>>> I need a list of all the digits in y, concatenated as shown, with
> zeros
> >>> retained
> >>>>
> >>>> Thanks for any help
> >>>>
> >>>> Richard
> >>>>
> >>>> --
> >>>> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>>
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>>
> >>
> >>
> >> --
> >>
> >> Devon McCormick, CFA
> >>
> >> Quantitative Consultant
> >> --
> >> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Strange error

2023-03-30 Thread Devon McCormick
This is what I see on J 9.41:

   ".@": "."0@": each 40 5 9008 90
|length error, executing dyad |
|shapes 4 and 2 do not conform
|   |4 0|5|9 0 0 8|9 0|

It oddly seems to be trying to execute the separators.


On Thu, Mar 30, 2023 at 1:06 PM Henry Rich  wrote:

> My guess is you pasted in a nonbreaking space.  The caret points to the
> error.
>
> Wouldn't you like release 9.4, which would give more error information?
>
> Henry Rich
>
> On 3/30/2023 12:54 PM, Richard Donovan wrote:
> > JVERSION
> > Engine: j902/j64avx2/windows
> > Release-a: commercial/2020-12-05T13:36:01
> > Library: 9.02.08
> > Qt IDE: 1.9.2s/5.12.10(5.12.10)
> > Platform: Win 64
> > Installer: J902 install
> > InstallPath: c:/program files/j902
> >
> > ".@": "."0@": each 40 5 9008 90
> > |spelling error
> > |
> > | ^
> > | ".@":"."0@":each 40 5 9008 90
> >
> >
> > (NB. required output 4 0 5 9 0 0 8 9 0)
> >
> > The boxed question marks actually appear as an assortment of left, up,
> and down arrows.
> >
> > This is reproducible.
> >
> > I need a list of all the digits in y, concatenated as shown, with zeros
> retained
> >
> > Thanks for any help
> >
> > Richard
> >
> > ------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Error in jd

2023-03-18 Thread Devon McCormick
Yes - that fixes it!  I set up the conditions as a string so my selection
and update would be on the same records.  I didn't notice the absence of
"where" in the update.

My JVERSION is:
Engine: j9.4.1/j64/windows
Build: commercial/2023-02-27T15:32:45/clang-15-0-7/SLEEF=1
Library: 9.4.20
Platform: Win 64
Installer: j9.4 install
InstallPath: c:/pgm/j9.41
Contact: www.jsoftware.com


On Sat, Mar 18, 2023 at 11:30 AM Eric Iverson 
wrote:

> Looking a bit closer I think I see the problem.
>
> The update where clause should not include the word where.
>
> Example from the jdrt'update' tutorial:
>
>jd'update f';'boolean=1';'byte';'x' NB. update where.
>
> The error message had an obscure hint: |Not found: table where: throw
>
> i think it will work if you remove the word where from the update.
>
> There is still the issue of the crash. What is you JVERSION?
>
>
>
> On Sat, Mar 18, 2023 at 11:13 AM Eric Iverson 
> wrote:
>
> > I don't see anything obvious. The crash on 13!:1'' is concerning.
> >
> > Please send (directly) what I need to reproduce the error. Perhaps best
> > would be a csv text file (or simple script to create the table). And a
> > script that shows the error.
> >
> > On Sat, Mar 18, 2023 at 1:31 AM Devon McCormick 
> > wrote:
> >
> >> Hi,  I'm getting the following error, for these arguments:
> >>
> >>('update ',tblnm);(}.cond);'handtype'
> >> +---+---++
> >> |update sim2|where simnum>=0 and simnum<1000|handtype|
> >> +---+---++
> >>
> >>jd ('update ',tblnm);(}.cond);'handtype';<,"2 ht1
> >> |Not found: table where: throw
> >> |throw[0]
> >>   tblnm
> >> |value error: tblnm
> >>
> >>   13!:4''
> >> |Not found: table where: throw
> >> |throw[0]
> >>   dbr 1 [ dbr 0
> >>
> >>13!:1''
> >>$ht1
> >> 876 2 3
> >> $,"2 ht1
> >> 876 6
> >>jd 'info schema sim2'
> >> +-+++-+
> >> |table|column  |type|shape|
> >> +-+++-+
> >> |sim2 |simnum  |int | _   |
> >> |sim2 |holecard|byte| 8   |
> >> |sim2 |highhand|byte|10   |
> >> |sim2 |handtype|byte| 6   |
> >> |sim2 |fhrank  |byte| 2   |
> >> +-+++-+
> >>
> >> If I do 13!:1'' immediately after the error, jconsole exits with this
> >> message: Process shell<1> exited abnormally with code 5.
> >>
> >> Since I can't look at the stack immediately without crashing, I have to
> >> cut
> >> it back to see it (here with another table):
> >>
> >>   jd 'update sim6';'where simnum>=0 and simnum<100';'fhrank'; >> |Not found: table where: throw
> >> |throw[0]
> >>   13!:19''
> >> |stop: getloc
> >> |   throw'Not found: ',(2}.>CHILD),' ',,":y
> >> |getloc[7]
> >>   13!:1''
> >> |stop
> >> *   throw'Not found: ',(2}.>CHILD),' ',,":y
> >> |getloc[7]
> >> |   tnms=:, >> |addtablepathnoind[8]
> >> |   addtablepathnoind f
> >> |From[3]
> >> |   From from
> >> |Read__dbl[1]
> >> |   r=.Read__dbl y
> >> |jd_reads[26]
> >> |   jd_reads'/lr ',y
> >> |jd_read[0]
> >> |   jd_read y
> >> |jdi_read[0]
> >> |   w=.;{:,old=.jdi_read'jdindex from ',tab,' where ',w
> >> |jd_update[20]
> >> |   r=.('jd_',opx)~a
> >> |jdx[:54]
> >> |   DBX jdx y
> >> |jdx[1]
> >> |   jdlast_z_=:jdx y
> >> |jd_jd_[1]
> >> |jd[0]
> >> |   jd'update sim6';'where simnum>=0 and simnum<100';'fhrank'; >>
> >> I have a small copy of this database I can make available.
> >>
> >> --
> >>
> >> Devon McCormick, CFA
> >>
> >> Quantitative Consultant
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Error in jd

2023-03-17 Thread Devon McCormick
Hi,  I'm getting the following error, for these arguments:

   ('update ',tblnm);(}.cond);'handtype'
+---+---++
|update sim2|where simnum>=0 and simnum<1000|handtype|
+---+---++

   jd ('update ',tblnm);(}.cond);'handtype';<,"2 ht1
|Not found: table where: throw
|throw[0]
  tblnm
|value error: tblnm

  13!:4''
|Not found: table where: throw
|throw[0]
  dbr 1 [ dbr 0

   13!:1''
   $ht1
876 2 3
$,"2 ht1
876 6
   jd 'info schema sim2'
+-+++-+
|table|column  |type|shape|
+-+++-+
|sim2 |simnum  |int | _   |
|sim2 |holecard|byte| 8   |
|sim2 |highhand|byte|10   |
|sim2 |handtype|byte| 6   |
|sim2 |fhrank  |byte| 2   |
+-+++-+

If I do 13!:1'' immediately after the error, jconsole exits with this
message: Process shell<1> exited abnormally with code 5.

Since I can't look at the stack immediately without crashing, I have to cut
it back to see it (here with another table):

  jd 'update sim6';'where simnum>=0 and simnum<100';'fhrank';CHILD),' ',,":y
|getloc[7]
  13!:1''
|stop
*   throw'Not found: ',(2}.>CHILD),' ',,":y
|getloc[7]
|   tnms=:,=0 and simnum<100';'fhrank';http://www.jsoftware.com/forums.htm


Re: [Jprogramming] Rank numbering with duplicates

2023-03-16 Thread Devon McCormick
This is good to know - thanks!

On Wed, Mar 15, 2023 at 8:40 PM Ric Sherlock  wrote:

> As an adverb we can get the ascending and descending by applying either /:
> or \:
>
> open 'stats/base/univariate' NB. in JQt will open the script
>
> rankCompete=: 1 :'u~ i. ]'
>
> On Thu, Mar 16, 2023 at 1:30 PM Ric Sherlock  wrote:
>
> > There are number of adverbs in the stats/base script for getting
> different
> > types of rankings
> >
> > NB.*rankOrdinal a ordinal ranking ("0 1 2 3") of array y
> >
> > NB.*rankCompete a standard competition ranking ("0 0 2 3") of array y
> >
> > NB.*rankDense a dense ranking ("0 0 1 2") of array y
> >
> > NB.*rankFractional a fractional ranking ("0 1.5 1.5 3") of array y
> >
> >
> > \: rankCompete vec
> >
> > 6 0 3 0 4 2 5 6
> >
> > On Thu, Mar 16, 2023 at 11:24 AM Devon McCormick 
> > wrote:
> >
> >> These are both way better than what I came up with.  Thanks!
> >>
> >> On Wed, Mar 15, 2023 at 5:07 PM 'robert therriault' via Programming <
> >> programm...@jsoftware.com> wrote:
> >>
> >> > Nicely done Elijah!
> >> >
> >> > It has a pretty solution in tacit as well
> >> >
> >> > vec=. 49 275 93 275 92 99 91 49
> >> >t=. i.~ \:~
> >> >t vec
> >> > 6 0 3 0 4 2 5 6
> >> >
> >> > Cheers, bob
> >> >
> >> > > On Mar 15, 2023, at 13:59, Elijah Stone 
> wrote:
> >> > >
> >> > > One thing that comes to mind is (\:~vec) i.vec.
> >> > >
> >> > > On Wed, 15 Mar 2023, Devon McCormick wrote:
> >> > >
> >> > >> Hi, has anyone looked into how to generate a rank numbering where
> >> > duplicate
> >> > >> values get duplicate order numbers?
> >> > >>
> >> > >> For example, when we rank this vector descending,
> >> > >>  \:vec=. 49 275 93 275 92 99 91 49
> >> > >> 1 3 5 2 4 6 0 7
> >> > >> we see that 1 3{vec and 0 7{vec are the same so I would like to end
> >> up
> >> > with
> >> > >> a rank numbering like this 6 0 3 0 4 2 5 6  so the ties for first
> and
> >> > last
> >> > >> place get the same value in the proper order where zero designates
> >> the
> >> > >> highest.
> >> > >>
> >> > >> I know I've done this before and I have a very clumsy way to
> achieve
> >> > this
> >> > >> but I'm wondering if there's a better one.
> >> > >>
> >> > >> Thanks,
> >> > >>
> >> > >> Devon
> >> > >>
> >> > >> --
> >> > >>
> >> > >> Devon McCormick, CFA
> >> > >>
> >> > >> Quantitative Consultant
> >> > >>
> >> --
> >> > >> 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
> >> >
> >>
> >>
> >> --
> >>
> >> Devon McCormick, CFA
> >>
> >> Quantitative Consultant
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Rank numbering with duplicates

2023-03-15 Thread Devon McCormick
These are both way better than what I came up with.  Thanks!

On Wed, Mar 15, 2023 at 5:07 PM 'robert therriault' via Programming <
programm...@jsoftware.com> wrote:

> Nicely done Elijah!
>
> It has a pretty solution in tacit as well
>
> vec=. 49 275 93 275 92 99 91 49
>t=. i.~ \:~
>t vec
> 6 0 3 0 4 2 5 6
>
> Cheers, bob
>
> > On Mar 15, 2023, at 13:59, Elijah Stone  wrote:
> >
> > One thing that comes to mind is (\:~vec) i.vec.
> >
> > On Wed, 15 Mar 2023, Devon McCormick wrote:
> >
> >> Hi, has anyone looked into how to generate a rank numbering where
> duplicate
> >> values get duplicate order numbers?
> >>
> >> For example, when we rank this vector descending,
> >>  \:vec=. 49 275 93 275 92 99 91 49
> >> 1 3 5 2 4 6 0 7
> >> we see that 1 3{vec and 0 7{vec are the same so I would like to end up
> with
> >> a rank numbering like this 6 0 3 0 4 2 5 6  so the ties for first and
> last
> >> place get the same value in the proper order where zero designates the
> >> highest.
> >>
> >> I know I've done this before and I have a very clumsy way to achieve
> this
> >> but I'm wondering if there's a better one.
> >>
> >> Thanks,
> >>
> >> Devon
> >>
> >> --
> >>
> >> Devon McCormick, CFA
> >>
> >> Quantitative Consultant
> >> --
> >> 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
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Rank numbering with duplicates

2023-03-15 Thread Devon McCormick
Hi, has anyone looked into how to generate a rank numbering where duplicate
values get duplicate order numbers?

For example, when we rank this vector descending,
   \:vec=. 49 275 93 275 92 99 91 49
1 3 5 2 4 6 0 7
we see that 1 3{vec and 0 7{vec are the same so I would like to end up with
a rank numbering like this 6 0 3 0 4 2 5 6  so the ties for first and last
place get the same value in the proper order where zero designates the
highest.

I know I've done this before and I have a very clumsy way to achieve this
but I'm wondering if there's a better one.

Thanks,

Devon

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Jd version 4.43 available

2023-03-03 Thread Devon McCormick
I'm seeing this version as about 10% faster for the one task I've been
running a lot lately.

On Thu, Mar 2, 2023 at 12:47 PM Eric Iverson 
wrote:

> Jd version 4.43 available
>
> Be careful switching to this version as tables used in this
> version will be marked damaged if used with a previous version!!!
>
> Read 4.43 notes carefully: https://code.jsoftware.com/wiki/Jd/Release
>
> Read 'Run Production': https://code.jsoftware.com/wiki/Jd/General
>
> The code simplification and performance improvement justified the extra
> caution
> required in moving to this release.
>
> If you don't use multiple systems at different maintenance levels accessing
> the
> same tables, this update should not be a problem.
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Applying a cyclic gerund

2023-02-26 Thread Devon McCormick
Looking at what I sent, below your message, it looks fine to me albeit a
little hard to read with all the indenting, especially since the indent
character is ">":
>>> 3 33 9 99 12 13 1 2 10 11 100
>>>> : ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
>>> 4 34 10 100 13 14 2 3 11 12 101
I wonder if my formatting the code as fixed-width in Gmail messes up the
display for some people?  The above is formatted "Sans Serif", below as
fixed width.
>>> 3 33 9 99 12 13 1 2 10 11 100
>>>> : ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
>>> 4 34 10 100 13 14 2 3 11 12 101
To me, the latter appears to highlight some spurious spaces that have crept
in to the expression but looks the same as the former.  The incremented
version of the expression will not run if cut pasted into a J session the
way it appears in the attachment, so caveat coder.




On Sun, Feb 26, 2023 at 2:38 PM 'Michael Day' via Programming <
programm...@jsoftware.com> wrote:

> Oh, sorry.
>
> However, if you look at the copy of your message below my
> reply,   both still appearing hereunder,  you'll see something rather like
>
> |
> |: ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
> |
>
> (I've typed in the 3 vertical bars at the left-hand side!)
> In any case,  it looked a bit odd!  As I recall,  what the iPad showed
> at the
> lhs resembled monadic transpose, |: !It definitely wasn't >:   .
>
> The iPad doesn't have the message any more,  so I can't easily check
> directly.
>
> No matter - sorry I commented on that,   but the essential points were
> made,
> that there are pleasing ways of dealing with these mixed types which can
> avoid using gerunds.
>
> Cheers,
>
> Mike
>
> On 26/02/2023 19:19, Devon McCormick wrote:
> > The second result was simply an increment to demonstrate that the result
> is
> > numeric.
> >
> > On Sun, Feb 26, 2023 at 6:28 AM 'Mike Day' via Programming <
> > programm...@jsoftware.com> wrote:
> >
> >> This is quite nice,  though nothing to do with gerunds as such!
> >>
> >> ; ]&.":each '3';33;'9 99';12 13;1;2;'10 11 1e6'
> >> 3 33 9 99 12 13 1 2 10 11 100
> >> I have been known to use ".@":  - but using under only just occurred to
> me!
> >>
> >> This also works:
> >>abc =. 2345
> >> ;   ]&.":  each '3';33;'9 99';12 13;1;2;'10 11 1e6';'abc'
> >> 3 33 9 99 12 13 1 2 10 11 100 2345
> >>
> >> though using names could prove difficult without building in some
> checks:
> >> ;   ]&.":  each '3';33;'9 99';12 13;1;2;'10 11 1e6';'def';'abc'
>  NB.
> >> def is undefined
> >> 3 33 9 99 12 13 1 2 10 11 100 2345
> >> Checking the boxed form for empty elements might suffice.
> >>
> >> BTW, I'm puzzled by Devon's second "result": 4 34 10 etc.  Perhaps a
> slip
> >> with
> >> copy?
> >>
> >> Cheers,
> >>
> >> Mike
> >>
> >> Sent from my iPad
> >>
> >>> On 26 Feb 2023, at 09:48, Devon McCormick  wrote:
> >>>
> >>> If you don't want to be at the mercy of your data's ordering, you
> could
> >>> selectively convert to numeric or not:
> >>>isChar=: ' ' -: [: ({.) 0 $ ]
> >>>; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
> >>> 3 33 9 99 12 13 1 2 10 11 100
> >>>> : ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
> >>> 4 34 10 100 13 14 2 3 11 12 101
> >>>
> >>>> On Sat, Feb 25, 2023 at 4:39 PM Henry Rich 
> >> wrote:
> >>>> Now that gerund"n applies gerund cyclically, the need for the oblique
> >>>> trick is reduced.
> >>>>
> >>>> Henry Rich
> >>>>
> >>>> On 2/25/2023 3:26 PM, neit...@gaertner.de wrote:
> >>>>>> I want to convert the second one into numerical data
> >>>>>> Can you simplify the above expression?
> >>>>> Applying a gerund cyclically, as asked for in the subject:
> >>>>>
> >>>>>] list =. ;: 'foo 1 bar 2.17 baz 3.14'
> >>>>> +---+-+---++---++
> >>>>> |foo|1|bar|2.17|baz|3.14|
> >>>>> +---+-+---++---++
> >>>>>
> >>>>> , ]`(".each)/.  list
> >>>>> +---

Re: [Jprogramming] Applying a cyclic gerund

2023-02-26 Thread Devon McCormick
The second result was simply an increment to demonstrate that the result is
numeric.

On Sun, Feb 26, 2023 at 6:28 AM 'Mike Day' via Programming <
programm...@jsoftware.com> wrote:

> This is quite nice,  though nothing to do with gerunds as such!
>
>; ]&.":each '3';33;'9 99';12 13;1;2;'10 11 1e6'
> 3 33 9 99 12 13 1 2 10 11 100
> I have been known to use ".@":  - but using under only just occurred to me!
>
> This also works:
>   abc =. 2345
>;   ]&.":  each '3';33;'9 99';12 13;1;2;'10 11 1e6';'abc'
> 3 33 9 99 12 13 1 2 10 11 100 2345
>
> though using names could prove difficult without building in some checks:
>;   ]&.":  each '3';33;'9 99';12 13;1;2;'10 11 1e6';'def';'abc'   NB.
> def is undefined
> 3 33 9 99 12 13 1 2 10 11 100 2345
> Checking the boxed form for empty elements might suffice.
>
> BTW, I'm puzzled by Devon's second "result": 4 34 10 etc.  Perhaps a slip
> with
> copy?
>
> Cheers,
>
> Mike
>
> Sent from my iPad
>
> > On 26 Feb 2023, at 09:48, Devon McCormick  wrote:
> >
> > If you don't want to be at the mercy of your data's ordering, you could
> > selectively convert to numeric or not:
> >   isChar=: ' ' -: [: ({.) 0 $ ]
> >   ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
> > 3 33 9 99 12 13 1 2 10 11 100
> >> : ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
> > 4 34 10 100 13 14 2 3 11 12 101
> >
> >> On Sat, Feb 25, 2023 at 4:39 PM Henry Rich 
> wrote:
> >>
> >> Now that gerund"n applies gerund cyclically, the need for the oblique
> >> trick is reduced.
> >>
> >> Henry Rich
> >>
> >> On 2/25/2023 3:26 PM, neit...@gaertner.de wrote:
> >>>> I want to convert the second one into numerical data
> >>>> Can you simplify the above expression?
> >>> Applying a gerund cyclically, as asked for in the subject:
> >>>
> >>>   ] list =. ;: 'foo 1 bar 2.17 baz 3.14'
> >>> +---+-+---++---++
> >>> |foo|1|bar|2.17|baz|3.14|
> >>> +---+-+---++---++
> >>>
> >>>, ]`(".each)/.  list
> >>> +---+-+---++---++
> >>> |foo|1|bar|2.17|baz|3.14|
> >>> +---+-+---++---++
> >>>
> >>>(,: datatype each)  , ]`(".each)/.  list
> >>> +---+---+---++---++
> >>> |foo|1  |bar|2.17|baz|3.14|
> >>> +---+---+---++---++
> >>> |literal|boolean|literal|floating|literal|floating|
> >>> +---+---+---++---++
> >>>
> >>>
> >>> Obliquing over a vector is often overlooked.  It picks up every item
> >>> as a singleton "diagonal".  The final "," is required to compensate
> >>> for that.
> >>>
> >>>  Martin Neitzel
> >>> ------
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Applying a cyclic gerund

2023-02-26 Thread Devon McCormick
If you don't want to be at the mercy of your data's ordering, you could
selectively convert to numeric or not:
   isChar=: ' ' -: [: ({.) 0 $ ]
   ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
3 33 9 99 12 13 1 2 10 11 100
   >: ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
4 34 10 100 13 14 2 3 11 12 101

On Sat, Feb 25, 2023 at 4:39 PM Henry Rich  wrote:

> Now that gerund"n applies gerund cyclically, the need for the oblique
> trick is reduced.
>
> Henry Rich
>
> On 2/25/2023 3:26 PM, neit...@gaertner.de wrote:
> >> I want to convert the second one into numerical data
> >> Can you simplify the above expression?
> > Applying a gerund cyclically, as asked for in the subject:
> >
> >] list =. ;: 'foo 1 bar 2.17 baz 3.14'
> > +---+-+---++---++
> > |foo|1|bar|2.17|baz|3.14|
> > +---+-+---++---++
> >
> > , ]`(".each)/.  list
> > +---+-+---++---++
> > |foo|1|bar|2.17|baz|3.14|
> > +---+-+---++---++
> >
> > (,: datatype each)  , ]`(".each)/.  list
> > +---+---+---++---++
> > |foo|1  |bar|2.17|baz|3.14|
> > +---+---+---++---++
> > |literal|boolean|literal|floating|literal|floating|
> > +---+---+---++---++
> >
> >
> > Obliquing over a vector is often overlooked.  It picks up every item
> > as a singleton "diagonal".  The final "," is required to compensate
> > for that.
> >
> >   Martin Neitzel
> > ------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Odd

2023-02-16 Thread Devon McCormick
If it's the GMP that tripped me up by giving a nonce error on "x:" last
month, you need to
   load 'pacman'
   install'gmp'


On Fri, Feb 17, 2023 at 12:26 AM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:

>
>
> There is also a numeric library install required (forget which one) that
> while it shouldn't crash without it, will not produce extended results.
>
>
>
>
> On Thursday, February 16, 2023 at 10:31:45 p.m. EST, bill lam <
> bbill@gmail.com> wrote:
>
>
>
>
>
> We have received reports on the crash but can't reproduce by ourselves.
> Would you give detail of the 2 computers such
> linux distro name and version, and
> version of glibc (  ldd --version)
>
> On Fri, Feb 17, 2023 at 11:22 AM Omar Antolín Camarena <
> omar.anto...@gmail.com> wrote:
>
> > >  And it no longer crashes.
> >
> > There's a little bit of luck involved in that. I use J on two computers,
> on
> > one j904 works just fine but on the other doing anything at all using
> > extended integers makes it crash.
> >
> >
> > On Thu, Feb 16, 2023 at 9:19 PM Mike Duvos  wrote:
> >
> > > Thanks.  I got j904 installed from the zips.  Surprisingly, it is up to
> > 58
> > > times faster doing modular exponentiation on large extended precision
> > > integers.  And it no longer crashes.
> > >
> > > On Thu, Feb 16, 2023 at 6:24 PM Devon McCormick 
> > > wrote:
> > >
> > > > It's probably blank because there is no all-in-one installer for
> 9.04.
> > > > Raul is correct that you have to install it from zips.
> > > >
> > > > On Thu, Feb 16, 2023 at 8:24 PM Raul Miller 
> > > wrote:
> > > >
> > > > > I don't know why there's a link to a non-existent all in one page.
> > > > >
> > > > > For now, I think you have to install it from a zip archive:
> > > > > https://code.jsoftware.com/wiki/System/Installation/J904/Zips
> > > > >
> > > > > I hope this helps,
> > > > >
> > > > > --
> > > > > Raul
> > > > >
> > > > > On Thu, Feb 16, 2023 at 7:50 PM Mike Duvos 
> wrote:
> > > > > >
> > > > > > I went to the Wiki page for j904 and clicked on the all-in-one
> > > > installer
> > > > > > for Windows, and it took me to a Wiki page with nothing on it.
> Do
> > I
> > > > have
> > > > > > to install it some other way?
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Thu, Feb 16, 2023 at 3:32 PM Raul Miller <
> rauldmil...@gmail.com
> > >
> > > > > wrote:
> > > > > >
> > > > > > > When I run (genkey 32) under j903, I get a crash.
> > > > > > >
> > > > > > > When I run (genkey 32) under j904, it works fine.
> > > > > > >
> > > > > > > A number of issues have been addressed in j904 (and it's almost
> > > ready
> > > > > > > for release). It might be worth upgrading.
> > > > > > >
> > > > > > > --
> > > > > > > Raul
> > > > > > >
> > > > > > > On Thu, Feb 16, 2023 at 6:21 PM Mike Duvos 
> > > wrote:
> > > > > > > >
> > > > > > > > I installed it a few weeks ago from the link in the wiki to
> the
> > > > most
> > > > > > > recent
> > > > > > > > stable version.  If I click on “about” in jqt , it says…
> > > > > > > >
> > > > > > > > Engine: j903/j64avx2/windows
> > > > > > > >
> > > > > > > > It said the beta was for “adventurous users.”
> > > > > > > >
> > > > > > > > Should I be running a different one?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Thu, Feb 16, 2023 at 3:01 PM Elijah Stone <
> > > elro...@elronnd.net>
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > What version of je are you running?  I get innocuous
> results:
> > > > > > > > >
> > > > > > > > >genkey 32
> > > &g

Re: [Jprogramming] Odd

2023-02-16 Thread Devon McCormick
e same thing
> as
> > > > > genkey,
> > > > > > but phrased slightly differently, it works perfectly.
> > > > > >
> > > > > > keygen =: 3 : 0"0
> > > > > >
> > > > > > z =. ''
> > > > > >
> > > > > > while. 2 > #z
> > > > > >
> > > > > > do.
> > > > > >
> > > > > > z =. ~. z , randprime y
> > > > > >
> > > > > > end.
> > > > > >
> > > > > > (*/z),\:~z
> > > > > >
> > > > > > )
> > > > > >
> > > > > > keygen 5#32
> > > > > >
> > > > > > 13636890702424146503 3697445573 3688192411
> > > > > >
> > > > > > 14042631972443509627 3975272443 3532495489
> > > > > >
> > > > > > 15856784938324374101 4290006247 3696214883
> > > > > >
> > > > > > 12482175669738327193 3743048207 3334762199
> > > > > >
> > > > > > 1401272150241067 4146478969 3379426643
> > > > > >
> > > > > >
> > > > > > I’m new to J programming, so I’m sure I’ve just done something
> > > dumb.  Any
> > > > > > insights would be appreciated.
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > --
> > > > > > 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
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Jd release 4.41 available

2023-02-16 Thread Devon McCormick
I was in the middle of doing Jd timings when I saw this message so I
upgraded it and am seeing almost 30% improvement in performance.

On Thu, Feb 16, 2023 at 3:53 PM Eric Iverson 
wrote:

> Jd release 4.41 available:
> https://code.jsoftware.com/wiki/Jd/Release
>
> All ops had some unnecessary overhead that has been trimmed out. Everything
> runs just a little bit faster.
>
> There will be more work along this line throughout this year. In particular
> there is a project for insert/upsert.
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] jd 'info schema' no longer works

2023-02-14 Thread Devon McCormick
Never mind.  I had over-written "jd" with a utility function of my own.
It's fine now.

On Tue, Feb 14, 2023 at 8:27 PM Devon McCormick  wrote:

> Hi,
> I was looking at some Jd code I have not touched in several months but am
> running into a problem at the very start.  I can connect to a database but
> the command which is supposed to show me my database layout - jd 'info
> schema' - returns nothing.
>
> From this, it looks like Jd knows the database exists but I can't see what
> the schema looks like:
>jdadmin 'D:/amisc/work/Poker/OmahaFlat'
>jdadmin ''
> +-+-+
> |OmahaFlat|D:/amisc/work/Poker/OmahaFlat|
> +-+-+
> |OmahaFlat|u/p  |
> +-+-+
> |OmahaFlat|*|
> +-+-+
> |[w]  |D:/amisc/work/Poker/OmahaFlat|
> +-+-+
>jd 'info schema'
>
> NB. Empty result
>
> Does anyone have an idea how I might go about debugging this?  Has there
> been any change to the Jd addon?
>
> Thanks,
>
> Devon
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
>
>

-- 

Devon McCormick, CFA

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


[Jprogramming] jd 'info schema' no longer works

2023-02-14 Thread Devon McCormick
Hi,
I was looking at some Jd code I have not touched in several months but am
running into a problem at the very start.  I can connect to a database but
the command which is supposed to show me my database layout - jd 'info
schema' - returns nothing.

From this, it looks like Jd knows the database exists but I can't see what
the schema looks like:
   jdadmin 'D:/amisc/work/Poker/OmahaFlat'
   jdadmin ''
+-+-+
|OmahaFlat|D:/amisc/work/Poker/OmahaFlat|
+-+-+
|OmahaFlat|u/p  |
+-+-+
|OmahaFlat|*|
+-+-+
|[w]  |D:/amisc/work/Poker/OmahaFlat|
+-+-+
   jd 'info schema'

NB. Empty result

Does anyone have an idea how I might go about debugging this?  Has there
been any change to the Jd addon?

Thanks,

Devon

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Ctrl-c closes JHS - was Re: JHS addon update available

2023-02-13 Thread Devon McCormick
I don't have this problem either.  I'm runningJVERSION
Engine: j904/j64avx2/windows
Beta-k: commercial/2023-01-24T04:48:26
Library: 9.04.11
Platform: Win 64
Installer: J904 install
InstallPath: c:/pgm/j904
Contact: www.jsoftware.com

under Windows 10.


On Mon, Feb 13, 2023 at 8:07 AM Raul Miller  wrote:

> I  haven't had this problem.
>
> But that doesn't mean much of anything, so I was not inclined to bring it
> up.
>
> --
> Raul
>
> On Mon, Feb 13, 2023 at 7:04 AM 'Mike Day' via Programming
>  wrote:
> >
> > No comment?  Isn't this a problem for anyone else?
> >
> > In a nutshell:
> > ctrl-c closes the console session running in background to the JHS
> session,  and consequently closes the jijx session - at least it does in my
> Windows 11 setup.
> >
> > Thanks,
> >
> > Mike
> >
> >
> >
> > Sent from my iPad
> >
> > > On 12 Feb 2023, at 18:19, 'Michael Day' via Programming <
> programm...@jsoftware.com> wrote:
> > >
> > > Not surprising!
> > >
> > > Possibly more important - though it's probably something mysterious in
> my configuration:
> > > I got to the bit about 20 second delay and double use of ctrl-c.
> > > First time I tried,  I forgot to do the break in the console window.
> > > Second time,  double break in the console closed the console, with
> this resulting message
> > > in a dialogue box in the jijx session:
> > >
> > >   127.0.0.1:65001 says
> > >   ev_advance_click failed: NetworkError: Failed to execute 'send' on
> > >   'XMLHttpRequest': Failed to load 'http://127.0.0.1:65001/jijx'.
> > >[OK]
> > >
> > > So then, a mini-experiment:
> > > After restarting JHS,  with the jijx tab waiting for input,  I tried a
> single ctrl-c in
> > > the console.   That session closes after a slight delay (1/2 - 1
> second?) , and the
> > > jijx session fails to respond to input,  though the error box doesn't
> appear.
> > > This suggests a problem in the console set-up/configuration rather
> than JHS
> > > itself(?)
> > >
> > > I'm running Windows 11.  Here's the installation info:
> > >
> > >JVERSION
> > > Engine: j904/j64avx2/windows
> > > Beta-k: commercial/2023-01-24T04:48:26
> > > Library: 9.04.11
> > > Qt IDE: 2.0.3/6.2.4(6.2.4)
> > > Platform: Win 64
> > > Installer: J904 install
> > > InstallPath: c:/d/j904-beta
> > > Contact: www.jsoftware.com
> > >
> > > Apologies if I've misunderstood something!
> > >
> > > Cheers,
> > >
> > > Mike
> > >
> > >> On 12/02/2023 14:30, Eric Iverson wrote:
> > >> It has been there for years! Fixed in the next release.
> > >>
> > >> On Sun, Feb 12, 2023 at 8:01 AM 'Michael Day' via Programming <
> > >> programm...@jsoftware.com> wrote:
> > >>
> > >>> Thanks.
> > >>>
> > >>> NB.  In the comment,  very early in menu>tour>overview :
> > >>> " NB. sum over - (Note Bene) starts comment "
> > >>> please note that the "N" in "NB" stands for "Nota", not "Note" .
> > >>>
> > >>> Sorry for pedantry,  but it might put off a potential fan!
> Apologies, too,
> > >>> if it's been there for years,
> > >>>
> > >>> Cheers,
> > >>>
> > >>> Mike
> > >>>
> > >>> On 11/02/2023 21:13, Eric Iverson wrote:
> > >>>> JHS major new release now available. I think it is worth a look.
> > >>>>
> > >>>> See menu>help>welcome
> > >>>>
> > >>>> Try out the new plot facility menu>tool>plot-chart
> > >>>>   (chartjs is very nice and easy to use)
> > >>>>
> > >>>> Take menu>tour>overview tutorial
> > >>>>
> --
> > >>>> For information about J forums seehttp://
> www.jsoftware.com/forums.htm
> > >>>
> --
> > >>> For information about J forums seehttp://
> www.jsoftware.com/forums.htm
> > >>>
> > >> --
> > >> For information about J forums seehttp://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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] File Operations -> JMF Alternative

2023-02-03 Thread Devon McCormick
 > > > >  fn =:  jpath
> > > > > > > 'C:\Users\skip\J904-user\temp\foo\testfile_name.jmf'
> > > > > > > > > >  map_jmf_ 'testfile1';fn
> > > > > > > > > > NB. Map file
> > > > > > > > > >  ] testfile1_jmf_
> > > > > > > > > > NB. File loaded as noun 'testfile1_jmf_'
> > > > > > > > > >
> > > > > > > > > > Some potential benefits of the .jmf datatype:
> > > > > > > > > > -Preserves header and shape information.
> > > > > > > > > > -If you want to map you file as read only, use the
> > following
> > > > > syntax
> > > > > > > > > > map_jmf_ 'testfile1';fn;'';1
> > > > > > > > > > -If you would like it to be copy-on-write use the
> following
> > > > > syntax
> > > > > > > > > > map_jmf_ 'testfile1';fn;'';2
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Ak
> > > > > > > > > >
> > > > > > > > > > On Wed., Feb. 1, 2023, 21:48 'Skip Cave' via
> Programming, <
> > > > > > > > > > programm...@jsoftware.com> wrote:
> > > > > > > > > >
> > > > > > > > > > > I have a boxed noun:
> > > > > > > > > > >
> > > > > > > > > > > ] testfile =: {2,\?15#50
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> >
> ┌┬─┬─┬─┬─┬─┬┬┬┬┬─┬┬───┬┐
> > > > > > > > > > >
> > > > > > > > > > > │9 21│21 47│47 37│37 13│13 33│33 20│20 4│4 49│49 6│6
> > 25│25
> > > > > 33│33
> > > > > > > 9│9
> > > > > > > > > 6│6
> > > > > > > > > > > 43│
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> >
> └┴─┴─┴─┴─┴─┴┴┴┴┴─┴┴───┴┘
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > I want to store it in the following location on my
> > machine:
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > ]fn =. < 'C:\Users\skip\J904-user\temp'
> > > > > > > > > > >
> > > > > > > > > > > ┌┐
> > > > > > > > > > >
> > > > > > > > > > > │C:\Users\skip\J904-user\temp│
> > > > > > > > > > >
> > > > > > > > > > > └┘
> > > > > > > > > > >
> > > > > > > > > > > Then I will close that J session.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Later, I will start a new J session, and I want to read
> > that
> > > > > saved
> > > > > > > > file
> > > > > > > > > > > into a noun called 'test1'
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > What is the J code for writing the noun into a file in
> > the
> > > > > first
> > > > > > > > > session?
> > > > > > > > > > >
> > > > > > > > > > > What is the J code to read the file into a noun in the
> > second
> > > > > > > > session?
> > > > > > > > > > >
> > > > > > > > > > > Should I use 1!2 & 1!:1, or fwrite & fread, or
> something
> > > > else?
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Where in the J doc are these file operations and their
> > > > > tradeoffs
> > > > > > > > > > described?
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Skip
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Skip Cave
> > > > > > > > > > > Cave Consulting LLC
> > > > > > > > > > >
> > > > > > > >
> > > > >
> > --
> > > > > > > > > > > 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
> > > > > > >
> > > > > >
> > --
> > > > > > 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
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] "Nonce error" on monadic "x:"?

2023-01-30 Thread Devon McCormick
Thanks everybody - installing gmp fixes it!

On Mon, Jan 30, 2023 at 4:46 PM Raul Miller  wrote:

> Nonce error should mean that you have not run install'gmp'
>
> Maybe we should get some eformat support for the error message
> reminding people that that's needed.
>
> That said, if you have run install'gmp' and you still get the nonce
> error, that's a severe problem and I guess we'll need to spend some
> time collecting information on your setup.
>
> --
> Raul
>
> On Mon, Jan 30, 2023 at 3:02 PM Devon McCormick 
> wrote:
> >
> > Hi,
> >
> > Does anyone know why I'm suddenly getting this?
> >   x: 99
> > |nonce error, executing monad x:
> > |   x:99
> >
> > Thanks,
> >
> > Devon
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] "Nonce error" on monadic "x:"?

2023-01-30 Thread Devon McCormick
I'm just lucky, I guess.  Still does not work after upgrading to the
slightly more recent version:
   JVERSION
Engine: j904/j64avx2/windows
Beta-k: commercial/2023-01-24T04:48:26
Library: 9.04.11
Platform: Win 64
Installer: J904 install
InstallPath: c:/pgm/j904
Contact: www.jsoftware.com

   x:99
|nonce error, executing monad x:
|   x:99

It seems to work fine in 9.03:
   JVERSION
Engine: j903/j64avx2/windows
Beta-u: commercial/2021-10-01T12:08:24
Library: 9.03.08
Platform: Win 64
Installer: J903 install
InstallPath: c:/pgm/j903
Contact: www.jsoftware.com
   x:99
99



On Mon, Jan 30, 2023 at 3:14 PM Thomas Arneson  wrote:

> It works for me:
>
>JVERSION
> Engine: j904/j64avx/windows
> Beta-k: commercial/2023-01-24T04:51:42
> Library: 9.04.11
> Qt IDE: 2.0.3s/6.2.4(6.2.4)
> Platform: Win 64
> Installer: J904 install
> InstallPath: c:/users/tom arneson/j904
> Contact: www.jsoftware.com
>
>x:99
> 99
> > On 01/30/2023 2:01 PM CST Devon McCormick  wrote:
> >
> >
> > Hi,
> >
> > Does anyone know why I'm suddenly getting this?
> >   x: 99
> > |nonce error, executing monad x:
> > |   x:99
> >
> > Thanks,
> >
> > Devon
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] "Nonce error" on monadic "x:"?

2023-01-30 Thread Devon McCormick
Hi,

Does anyone know why I'm suddenly getting this?
  x: 99
|nonce error, executing monad x:
|   x:99

Thanks,

Devon

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] NYCJUG this evening!

2023-01-10 Thread Devon McCormick
Hi - it looks like I had an attendee limit on the event.  Of course, when I
try to change it, it tells me this does not apply to an online event, so I
had to make it offline and make the change; somehow it magically put it
back as an online event with the correct URL and a higher limit.

Please give it a try and let me know if there's still an issue.

Thanks,

Devon


On Tue, Jan 10, 2023 at 5:29 PM Devon McCormick  wrote:

> Hard to believe but I will check.  Thanks!
>
>
> On Tue, Jan 10, 2023 at 1:32 PM 'robert therriault' via Programming <
> programm...@jsoftware.com> wrote:
>
>> Hey Devon,
>>
>> I'll try to hop on, but when I go to the link it says there is a
>> waitlist, so you may already be oversubscribed?
>>
>> Cheers, bob
>>
>> > On Jan 10, 2023, at 10:23, Devon McCormick  wrote:
>> >
>> > We are having our first NYCJUG meeting of the new year this evening at
>> > 18:30 EST.  Take a look at our Meetup page
>> > https://www.meetup.com/J-Dynamic-Functional-Programming/ for more
>> > information.
>> >
>> > Hope to see you there!
>> >
>> > --
>> >
>> > Devon McCormick, CFA
>> >
>> > Quantitative Consultant
>> > --
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
>
>

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] NYCJUG this evening!

2023-01-10 Thread Devon McCormick
Hard to believe but I will check.  Thanks!


On Tue, Jan 10, 2023 at 1:32 PM 'robert therriault' via Programming <
programm...@jsoftware.com> wrote:

> Hey Devon,
>
> I'll try to hop on, but when I go to the link it says there is a waitlist,
> so you may already be oversubscribed?
>
> Cheers, bob
>
> > On Jan 10, 2023, at 10:23, Devon McCormick  wrote:
> >
> > We are having our first NYCJUG meeting of the new year this evening at
> > 18:30 EST.  Take a look at our Meetup page
> > https://www.meetup.com/J-Dynamic-Functional-Programming/ for more
> > information.
> >
> > Hope to see you there!
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] NYCJUG this evening!

2023-01-10 Thread Devon McCormick
We are having our first NYCJUG meeting of the new year this evening at
18:30 EST.  Take a look at our Meetup page
https://www.meetup.com/J-Dynamic-Functional-Programming/ for more
information.

Hope to see you there!

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] substring search

2023-01-10 Thread Devon McCormick
I doubt performance is very important for the sizes of arguments I
typically use but David's expression is more elegant.

On Tue, Jan 10, 2023 at 9:29 AM David Lambert  wrote:

> (<'ab')  (1 e. E.)&>  'ac';'cab';'bca';'bab'  NB. quicker?
> 0 1 0 1
>
> (<'ab')  ([: +./ E.)&> 'ac';'cab';'bca';'bab'
> 0 1 0 1
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Examples of u . v where u is not a w/

2023-01-09 Thread Devon McCormick
Looking at about 300 examples of using dot in my own code, it looks like
every one has a reduction on the left.

On Mon, Jan 9, 2023 at 10:51 PM Omar Antolín Camarena 
wrote:

> > I sometimes use "( y" to look up any occurrences of string x
> > in vector of strings y
>
> Sorry, my complaint was a silly typo mistake, your expression is fine:
>
>(<'ab') +./ .E.&> 'ac';'cab';'bca';'bab'
> 0 1 0 1
>
> (I had written +./. E.&> with the dot and space swapped.)
>
> --
> Omar
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Examples of u . v where u is not a w/

2023-01-09 Thread Devon McCormick
I sometimes use "( y" to look up any occurrences of string x
in vector of strings y; it avoids a little cruft compared to, say
"+./&>(y".

On Mon, Jan 9, 2023 at 4:33 PM Raul Miller  wrote:

>  < .* is handy for visualizing what the operation does.
>
> It's been a while since I've worked in a realm which uses dot products
> though, so I don't have any other examples at my fingertips.
>
> Thanks,
>
> --
> Raul
>
> On Mon, Jan 9, 2023 at 1:21 PM Omar Antolín Camarena 
> wrote:
> >
> > Are the some good examples of using matrix product u . v but where the
> verb u is not of the form w/ for some w?
> >
> > --
> > Omar
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] wsfiles

2023-01-06 Thread Devon McCormick
My own simple version of this is here:
https://code.jsoftware.com/wiki/User:Devon_McCormick/WS.ijs.

On Fri, Jan 6, 2023 at 3:25 PM Raul Miller  wrote:

> Locale z is inherited by all other locales.
>
> When you put the definitions in locale evbwsfiles, and
> wssave_evbwsfiles_ uses nl'', it finds names in the evbwsfiles locale
> instead of your locale (which is probably the base locale).
>
> FYI,
>
> --
> Raul
>
> On Fri, Jan 6, 2023 at 1:40 PM David Lambert  wrote:
> >
> > Thank you for providing the wonderful
> > https://code.jsoftware.com/wiki/Scripts/WS_Files  and for making it
> > easily found.  I tried to modify it to install into its own locale,
> > changing the coclass target and inserting the public functionality into
> > z .  The tests no longer pass.  Please explain.  Thank you!  The
> > alterations and use follow:
> >
> > coclass'evbwsfiles'  NB. changed from coclass'z'
> >
> > NB. Inserted lines at end of script
> >
> > wssave_z_=: wssave_evbwsfiles_
> > wsload_z_=: wsload_evbwsfiles_
> > wsnl_z_=: wsnl_evbwsfiles_
> >
> >
> > dwl$ j
> >JVERSION
> > Engine: j904/j64avx2/linux
> > Beta-i: commercial/2022-12-13T15:14:45
> > Library: 9.04.06
> > Platform: Linux 64
> > Installer: J904 install
> > InstallPath: /home/lambertdw/downloads/installs/j904
> > Contact: www.jsoftware.com
> >
> > load'../../evbwsfiles.ijs'
> > ferase jpath '~temp/test.jws'
> > _1
> > erase nl''
> > abctst=. 1 2 3
> > abetsz=. 1;2;3
> > abdtst=. +
> > cd1tst=. /
> > cd2tsz=. "
> > assert 3-:#   'a'wssave '~temp/test'
> > |assertion failure: assert
> > |   assert 3-:#'a'wssave'~temp/test'
> > l
> >
> > ------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] [Jbeta] New error Polynomial Representation (padding regime)

2023-01-06 Thread Devon McCormick
They are the same under tolerance:
https://code.jsoftware.com/wiki/Help/Primer/Tolerance.

On Sat, Jan 7, 2023 at 12:48 AM Ak O  wrote:

> This is strictly based on the tolerance properties of the Operator not the
> Type of the Operands (Iyiabo's Prime Theorem).
>
>
> (Integer) ,(Integer) NB. The question we are asking is, are these
> Terms the same?
>  (17) -: (17)
> 1
>
> (Floating) ,(Integer)  NB. So also we are asking, are these Terms the
> same?
>  (17.0)-:(17)
> 1
>
>
> Ak
>
>
>
>
>
>
>
> On Fri., Jan. 6, 2023, 20:29 Don Kelly,  wrote:
>
> > J has it right.
> >
> > (17+45+65+71+5) -: (17+45+65+71+5) is the match between two integer
> > sums-each of which gives the integer result as they have the same boolean
> > representation and are equal-giving a "1" result
> >
> > (17.36+45.24+65.87+71.20+5.00) -: (17+45+65+71+5) is an attempt to
> compare
> > a floating point number with an integer-the result is floating point and
> a
> > "0" result
> >
> >   +/ 17.36  45.24  65.87 71.20 5.00
> >
> > 204.67
> >
> > (+/17+45+65+71+5)
> >
> > 203
> >
> >
> >   Don Kelly
> >
> >
> >
> > On 2023-01-05 4:06 a.m., Ak O wrote:
> > > These are both certainly Terms of Degree 2.
> > > They are not equalities. They are not the same Term.
> > >
> > > The point I mean to highlight is the represention (for the purpose of
> > > calculation).
> > >
> > >
> > > 16/32 is not 15/30 is not 8/16. An equivalence is 1/2. It should never
> be
> > > mistaken for Expression Linear /Logarithmic.
> > >
> > > The problem is in cases where you apply an equivalence simplification
> > > improperly sequence wise.
> > > You loss coherence of the expression, (which often leads to settling on
> > on
> > > approximation  where resolution can be achieved).
> > >
> > > This is what we think we are saying.
> > >   (17+45+65+71+5) -: (17+45+65+71+5)
> > > 1
> > > This is what we are actually saying.
> > >   (17.36+45.24+65.87+71.20+5.00) -: (17+45+65+71+5)
> > > 0
> > > Or worse
> > >   (17.99+45.99+65.99+71.99+5.99 ) -: (17+45+65+71+5)
> > > 0
> > >
> > > In part, this is why the full representation should be favoured.
> > >
> > > Particularly for unknown cases where it is common to reach for
> > Infinities.
> > >
> > > I am rambling now. Let me know if this is not clear.
> > >
> > >
> > > Ak
> > >
> > >
> > > On Wed., Jan. 4, 2023, 22:18 Raul Miller,
> wrote:
> > >
> > >> On Wed, Jan 4, 2023 at 10:24 PM Ak O  wrote:
> > >>>   File -> Wed Jan 4 03:40:07UTC 2023
> > >>> The statement:
> > >>>   So, there's no difference in Degree 1 2 1 0 0 0 and 1 2 1...
> > >>>
> > >>> This is not correct. These should not be seen as equalities.
> > >> That's an interesting perspective.
> > >>
> > >> It seems to me that both of these are polynomials of degree 2.  If
> > >> they should have different degrees, what degrees should they have? And
> > >> how would this be consistent with the opening sentence at
> > >> https://en.wikipedia.org/wiki/Degree_of_a_polynomial#:
> > >>
> > >> "In mathematics, the degree of a polynomial is the highest of the
> > >> degrees of the polynomial's monomials (individual terms) with non-zero
> > >> coefficients."
> > >>
> > >> Thanks,
> > >>
> > >> --
> > >> Raul
> > >> --
> > >> For information about J forums seehttp://www.jsoftware.com/forums.htm
> > >>
> > > --
> > > For information about J forums seehttp://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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Beginner: Where to start?

2022-12-29 Thread Devon McCormick
Lawrence,
As you make progress in learning J, we in the community would be interested
in knowing what you found useful and what you found confusing.
Cheers,
Devon

On Thu, Dec 29, 2022 at 6:53 PM HH PackRat  wrote:

> Hi, Lawrence!
>
> On 12/28/22, Galaxy Being  wrote:
> > I would like to learn J programming paradigm. I have a standard
> programming
> > background (C/C++, Java) along with some basic math, as well as some
> > functional programming exposure.
>
> Since you have a C background, be sure to check the published book "J
> for C Programmers" by Henry Rich (who currently maintains the J source
> code since both inventor Iverson and Roger Hui have passed on).  It is
> available at lulu.com (supposedly free Ebook, PDF, 327 pages).  Rather
> than the newer PDF, I have the original softcover version (J 6.02),
> and to me it's worth its weight in gold.  Just be aware that it does
> not deal with the latest changes and improvements to J.  But for
> learning J, you should find it VERY helpful!
>
> Harvey
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Interesting Question on Quora

2022-12-29 Thread Devon McCormick
I added my own short answer.

On Thu, Dec 29, 2022 at 10:52 AM Devon McCormick  wrote:

> The answer looks like it's from someone who knows almost nothing about J.
>
> On Thu, Dec 29, 2022 at 2:23 AM 'Skip Cave' via Programming <
> programm...@jsoftware.com> wrote:
>
>> Is J programming language suitable for machine learning, especially with
>> reinforcement learning?
>>
>>
>> https://www.quora.com/Is-J-programming-language-suitable-for-machine-learning-especially-with-reinforcement-learing?q=J%20programming
>> <
>> https://www.quora.com/Is-J-programming-language-suitable-for-machine-learning-especially-with-reinforcement-learing?q=J%20programming
>> >
>>
>> Skip Cave
>> Cave Consulting LLC
>> ------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
>
>

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Interesting Question on Quora

2022-12-29 Thread Devon McCormick
The answer looks like it's from someone who knows almost nothing about J.

On Thu, Dec 29, 2022 at 2:23 AM 'Skip Cave' via Programming <
programm...@jsoftware.com> wrote:

> Is J programming language suitable for machine learning, especially with
> reinforcement learning?
>
>
> https://www.quora.com/Is-J-programming-language-suitable-for-machine-learning-especially-with-reinforcement-learing?q=J%20programming
> <
> https://www.quora.com/Is-J-programming-language-suitable-for-machine-learning-especially-with-reinforcement-learing?q=J%20programming
> >
>
> Skip Cave
> Cave Consulting LLC
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Beginner: Where to start?

2022-12-28 Thread Devon McCormick
I usually recommend searching for "Beginner's Regatta" on the Jsoftware
site.  Also, this -
https://code.jsoftware.com/wiki/Guides/GettingStartedSerious - looks
promising.
For more theoretical underpinnings of the language, you might look at "A
Dictionary of APL" -
https://www.softwarepreservation.org/projects/apl/Books/ADICTIONARYOFAPL .
According to Roger Hui, the ideas presented here form much of the basis of
J.

On Wed, Dec 28, 2022 at 1:13 PM Galaxy Being  wrote:

> Hello,
>
> I would like to learn J programming paradigm. I have a standard programming
> background (C/C++, Java) along with some basic math, as well as some
> functional programming exposure. I understand, however, that J is an "array
> programming language," which is what exactly? I've heard it is based on SKI
> combinator math. Is this true? So my question is, What background
> materials, texts, etc. should I study to get a theoretical understanding of
> the J world? I watched this <https://youtu.be/z8MVKianh54> and a few Tracy
> Harms videos, so yes, where does a beginner get started -- especially with
> the theory behind it all?
>
> Thank you.
> ⨽
> Lawrence Bottorff
> Grand Marais, MN, USA
> borg...@gmail.com
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-23 Thread Devon McCormick
Yes - it takes about the same time as the older method where I
pre-allocated the files and created a separate process for each
allocation.  However, the current run-time is much less variable than the
older one and slightly faster.  I run it a few times a week and it's been
fine for months now.  The only recent change was, because I got an
i-phone, I had to add 'jpeg' as a known suffix.

So far this month, I've processed 9,235 files totalling 10.92e9 bytes.  The
folder sizes range from 200 million to 3.5 billion bytes with the number of
files per folder ranging from 53 to 2815.
I'm always running on new data.


On Fri, Dec 23, 2022 at 3:42 PM Ak O  wrote:

> Hi Devon,
>
> I hope you are well.
>
> About your photo flipping exercise.
> Is it now running stably? (at one point you mentioned that it begab
> failing)
>
> How are files distributed among folders?
> Approximately how many files and folders are you running your test across?
> Are you always using the same data?
>
> Ak.
>
>
> On Tue., Dec. 20, 2022, 10:34 Devon McCormick,  wrote:
>
> > Hi Ak,
> >
> > That's a lot of questions.  I, too, would like to better understand pyxs.
> >
> > In the meantime, here are some things I've written up on multithreading:
> > https://code.jsoftware.com/wiki/NYCJUG/2022-05-10#Trying_to_Multithread,
> >
> >
> https://code.jsoftware.com/wiki/NYCJUG/2022-07-12#Multi-threaded_Photo_Flipping
> > ,
> > and
> >
> >
> https://code.jsoftware.com/wiki/NYCJUG/2022-08-09#A_New_Multi-threading_Project
> > .
> >
> > It looks like I'm using the "Manager Model" in these exercises.
> >
> > Good luck!
> >
> > Devon
> >
> > On Tue, Dec 20, 2022 at 12:13 PM Ak O  wrote:
> >
> > > I hope you are all well. Thank you for your hard work on this subject.
> > >
> > > I am having difficulty understanding how to correctly apply the T. and
> t.
> > > (tcapdot/tdot) Primitives based on the vocabulary documentation pages.
> > >
> > >
> > > The concept of threading is new to me. The documentation pages (T./t.)
> > use
> > > many terms that I am unclear on.
> > >
> > > I appreciate your efforts to explain them. Thank you for your help.
> > >
> > >
> > > Ak.
> > >
> > >
> > >
> > > Vocabulary_tdot Page
> > >
> > >
> > > Reading from the Vocabulary documentation page tdot (at indentation).
> > >
> > >
> > >i. t. ''"0 i. 5
> > >  ++-+---+-+---+
> > >
> > >  ||0|0 1|0 1 2|0 1 2 3|
> > >  ++-+---+-+---+
> > >
> > > In the context of threading, what is this statement meant to
> > characterize?
> > > Is there a sentence of the form ,'execute some operation in some
> distinct
> > > thread (having thread attribute(s)..).'?
> > >
> > >  [x] u t. n y runs ([x] <@:u y) in an idle thread and returns its
> > > result, which is a pyx. A pyx is a special box. It looks like an atomic
> > box
> > > and can be used like any other box. When the pyx is opened, the opening
> > > thread will block until the value is available. If the creation of the
> > pyx
> > > ended in error, that error will be signaled when the pyx is opened.
> > >
> > >
> > > What is:
> > >  ->the purpose of a 'pyx'?
> > > Where does a 'pyx' fit into the threading concept?
> > > What is:
> > >  ->thread?
> > >  ->idle thread?
> > > How is a thread identified?
> > >
> > >
> > >  The n argument to t. controls execution of the task. The format is
> > >
> > >  [[<]important parameters][,< keyword[;value]]...
> > >  The important parameters are: [threadpool#]
> > >
> > > What is:
> > >  -> a task?
> > >  -> important parameters?
> > >  -> [threadpool#]
> > >  -> threadpool
> > >  -> i. t.(0;('worker'))"_1 i.5
> > >
> > >
> > >  threadpool# indicates which threadpool the task should be assigned
> > to.
> > >
> > > How is a threadpool assigned?
> > > How is a threadpool identified?
> > >
> > >
> > >  Threads are assigned to threadpools when they are created.
> > >
> > > How are assigned threadpools identified for created threads?
> > >
> > >
> > >  By default, threadpool 0 is used.
> > >
> > > What i

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-20 Thread Devon McCormick
Hi Ak,

That's a lot of questions.  I, too, would like to better understand pyxs.

In the meantime, here are some things I've written up on multithreading:
https://code.jsoftware.com/wiki/NYCJUG/2022-05-10#Trying_to_Multithread,
https://code.jsoftware.com/wiki/NYCJUG/2022-07-12#Multi-threaded_Photo_Flipping,
and
https://code.jsoftware.com/wiki/NYCJUG/2022-08-09#A_New_Multi-threading_Project
.

It looks like I'm using the "Manager Model" in these exercises.

Good luck!

Devon

On Tue, Dec 20, 2022 at 12:13 PM Ak O  wrote:

> I hope you are all well. Thank you for your hard work on this subject.
>
> I am having difficulty understanding how to correctly apply the T. and t.
> (tcapdot/tdot) Primitives based on the vocabulary documentation pages.
>
>
> The concept of threading is new to me. The documentation pages (T./t.) use
> many terms that I am unclear on.
>
> I appreciate your efforts to explain them. Thank you for your help.
>
>
> Ak.
>
>
>
> Vocabulary_tdot Page
>
>
> Reading from the Vocabulary documentation page tdot (at indentation).
>
>
>i. t. ''"0 i. 5
>  ++-+---+-+---+
>
>  ||0|0 1|0 1 2|0 1 2 3|
>  ++-+---+-+---+
>
> In the context of threading, what is this statement meant to characterize?
> Is there a sentence of the form ,'execute some operation in some distinct
> thread (having thread attribute(s)..).'?
>
>  [x] u t. n y runs ([x] <@:u y) in an idle thread and returns its
> result, which is a pyx. A pyx is a special box. It looks like an atomic box
> and can be used like any other box. When the pyx is opened, the opening
> thread will block until the value is available. If the creation of the pyx
> ended in error, that error will be signaled when the pyx is opened.
>
>
> What is:
>  ->the purpose of a 'pyx'?
> Where does a 'pyx' fit into the threading concept?
> What is:
>  ->thread?
>  ->idle thread?
> How is a thread identified?
>
>
>  The n argument to t. controls execution of the task. The format is
>
>  [[<]important parameters][,< keyword[;value]]...
>  The important parameters are: [threadpool#]
>
> What is:
>  -> a task?
>  -> important parameters?
>  -> [threadpool#]
>  -> threadpool
>  -> i. t.(0;('worker'))"_1 i.5
>
>
>  threadpool# indicates which threadpool the task should be assigned to.
>
> How is a threadpool assigned?
> How is a threadpool identified?
>
>
>  Threads are assigned to threadpools when they are created.
>
> How are assigned threadpools identified for created threads?
>
>
>  By default, threadpool 0 is used.
>
> What is the equivalent representation for this statement (i.e [x] u t. n y
> runs ([x] <@:u y))?
>
>
>  One keyword has been defined.
>
> What is a 'keyword' (conceptually and type)?
> Is it predefined?
>
>  The worker keyword controls whether the task should be executed in the
> originating thread if there is no waiting thread for it to run in.
>
> How does the keyword control the task executing thread?
>
>
>  u t. 'worker'
>  u t. (<'worker')
>  u t. ('worker';1)
>
> What differentiates these forms?
> Is it always 'worker' a standin?
> A few words on cases where one form might be chosen instead of another.
>
>
>
> --->
> Reference questions
>
> In trying to understand how to build threading structures (threaded
> program), three basic models are given:
>  (https://hpc-tutorials.llnl.gov/posix/designing_threaded_programs)
>  Quote:
>  Several common models for threaded programs exist:
>
>  Manager/worker: a single thread, the manager assigns work to other
> threads, the workers.
> Typically, the manager handles all input and parcels out work to the
> other
> tasks. At least two forms of the manager/worker model are common:
> static
> worker pool and dynamic worker pool.
>
>  Pipeline: a task is broken into a series of suboperations, each of
> which is handled
> in series, but concurrently, by a different thread. An automobile
> assembly
> line best describes this model.
>
>  Peer: similar to the manager/worker model, but after the main
> thread creates other
> threads, it participates in the work.
>
> Can you please show or diagram the J primitives used to compose the three
> models?
>
>
> --->
>
>
> - - - Please give a Primitives translation from C to J under the Creating
> Pthreads heading, Reference Source (https://randu.org/tutorials/threads/).
> - - -
>
> - - - Please give a Primitives translation from C to J under the Pthreads
> Attributes heading, Reference Source (https://randu.org/tutorials/threads/
> ).
> - -
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Nano-seconds?

2022-11-09 Thread Devon McCormick
Thanks - this is very helpful.

On Wed, Nov 9, 2022 at 7:58 PM chris burke  wrote:

> A few examples:
>
>[T=: 6!:14 [ 20220314102540
> 7005687400
>6!:15 T
> 2022 3 14 10 25 40 0
>
>6!:16 T
> 2022-03-14T10:25:40
>'  d' 6!:16 T
> 2022-03-14
>'  0' 6!:16 T
> 2022-03-14T10:25:40
>'  3' 6!:16 T
> 2022-03-14T10:25:40 000
>
>T -: 6!:17 [ 6!:16 T
> 1
>
> On Wed, Nov 9, 2022 at 4:21 PM Devon McCormick  wrote:
> >
> > Does anyone have examples of using the new nanosecond foreigners?
> > I cannot figure out how to use them from the "m=6 (Time)" section here:
> > https://code.jsoftware.com/wiki/Vocabulary/Foreigns .
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Nano-seconds?

2022-11-09 Thread Devon McCormick
Does anyone have examples of using the new nanosecond foreigners?
I cannot figure out how to use them from the "m=6 (Time)" section here:
https://code.jsoftware.com/wiki/Vocabulary/Foreigns .

-- 

Devon McCormick, CFA

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


[Jprogramming] NYCJUG meeting Wednesday, October 19th, 18:330 EST

2022-10-10 Thread Devon McCormick
Thanks to Dan Hirschi for pointing out that October 19th is a Wednesday.

-- 

Devon McCormick, CFA

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


[Jprogramming] No NYCJUG on 9/13

2022-09-12 Thread Devon McCormick
Hi, due to a family emergency, we will not have a NYCJUG meetup this month.
The planned October meeting may also be cancelled or moved as I will be
attending the APL conference in Portugal.  I will decide on this later.

Cheers,

Devon
-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Change in multi-threading?

2022-08-31 Thread Devon McCormick
Now it seems to run fine, under the same circumstances (on the SD card),
with the code unchanged.

On Tue, Aug 30, 2022 at 10:20 PM Devon McCormick  wrote:

> Unfortunately it looks like it was the same release when it worked as when
> it didn't:
> Engine: j904/j64avx2/windows
> Beta-e: commercial/2022-07-16T19:21:14
> Library: 9.04.03
> Platform: Win 64
>
> My problem may have to do with peculiarities of running on an SD card as
> though it were a regular hard-drive, so we can say this problem is not
> reproducible until I come up with a cleaner example or it goes away as
> mysteriously as it arrived.
>
> I have another multithreading project I will explore to see if the same
> problem occurs there.  If it does, it should be simple to reproduce.
>
> Until then, thanks for listening.
>
>
> On Sat, Aug 27, 2022 at 1:49 PM Henry Rich  wrote:
>
>> What release version did it work on?
>>
>> Henry Rich
>>
>> On 8/27/2022 1:46 PM, Devon McCormick wrote:
>> > My older, non-multithreaded, version works by dividing files into
>> batches
>> > in advance but this means that there may be a 10-20% difference in task
>> > times because we do not know in advance how long it takes to process
>> each
>> > file.  The advantage of the multithreaded version is that the variance
>> > between threads is minimal since all threads are pulling from the same
>> > stack.
>> > I should probably re-iterate that the code worked a few weeks ago and
>> has
>> > only started failing lately.
>> >
>> > On Sat, Aug 27, 2022 at 8:47 AM bill lam  wrote:
>> >
>> >> I am not sure why you used mutex. If you collect all file names in a
>> >> subdirectory and divide it into 15 batches (apparently you want 15
>> tasks)
>> >> and feed each batch to a different tasks then there won't be any
>> >> collisions.
>> >>
>> >>
>> >> On Sat, 27 Aug 2022 at 11:50 AM Devon McCormick 
>> >> wrote:
>> >>
>> >>> Hi,
>> >>> So, here's some code I put together over the past few months to use
>> >>> multi-threading to parallelize a time-consuming process.
>> >>>
>> >>> We start with the top-level function:
>> >>>
>> >>> NB.* startFlipping: wrapper to set up for "flipN" by creating threads,
>> >>> setting up MUTEX,
>> >>> NB. moving to chip photo dir and flipping them on the chip.
>> >>> startFlipping=: 3 : 0
>> >>> 12 startFlipping y
>> >>> :
>> >>> root=. y,':/DCIM/' NB. y is drive letter of photo chip.
>> >>> subds=. 0{"1 dir root,'*.'  NB. Process all subdirs' photos
>> >>> svdir=. 1!:43'' [ createThreads 15 [ MUTEX=: 10 T. 0NB. Fast
>> mutex
>> >>> for_sd. subds do. sd=. ;sd  NB. Process each sub-dir
>> >>> 1!:44 ] root,sd
>> >>> if. 0~:#FLS=: 0{"1 dir '*.jpg' do. tm=. 6!:1''
>> >>> tms=. flipN x<.15   NB. Show time, run x threads, no
>> more
>> >>> than 15.
>> >>> tm=. tm,~6!:1''
>> >>>  end.
>> >>>  end.
>> >>>  1!:44 svdir
>> >>>  tm;tms
>> >>> NB.EG tms=. 12 startFlipping 'F'  NB. Run 12 threads for all .JPGs
>> on F:
>> >>> )
>> >>>
>> >>> The thread-creation utility:
>> >>> createThreads=: 3 : '{{ 0 T.  }} ^:y]'
>> >>>
>> >>> Now we look at the cover for the core routine where we spin off the
>> >> threads
>> >>> in a for loop:
>> >>>
>> >>> flipN=: 3 : 0
>> >>> tms=. i.0
>> >>> while. y<#FLS do. pyx=. i.0
>> >>> for_ix. i. y<.#FLS do. pyx=. pyx,flip1Photo t. '']ix end.
>> >>> tms=. tms,-/&>_2{.&.>pyx
>> >>> end.
>> >>> NB.EG tms=. flipN 10   NB. Run on 10 threads
>> >>> )
>> >>>
>> >>> This uses a "for" rather than "each" because, in testing, "for" seemed
>> >> less
>> >>> likely to crash.
>> >>>
>> >>> Finally, the deepest function that concerns multi-threaders:
>> >>>
>> >>> NB.* flip1Photo: flip a single photo.
>> >>> flip1Photo=: 3 : 0
>> >&g

Re: [Jprogramming] Change in multi-threading?

2022-08-30 Thread Devon McCormick
Unfortunately it looks like it was the same release when it worked as when
it didn't:
Engine: j904/j64avx2/windows
Beta-e: commercial/2022-07-16T19:21:14
Library: 9.04.03
Platform: Win 64

My problem may have to do with peculiarities of running on an SD card as
though it were a regular hard-drive, so we can say this problem is not
reproducible until I come up with a cleaner example or it goes away as
mysteriously as it arrived.

I have another multithreading project I will explore to see if the same
problem occurs there.  If it does, it should be simple to reproduce.

Until then, thanks for listening.


On Sat, Aug 27, 2022 at 1:49 PM Henry Rich  wrote:

> What release version did it work on?
>
> Henry Rich
>
> On 8/27/2022 1:46 PM, Devon McCormick wrote:
> > My older, non-multithreaded, version works by dividing files into batches
> > in advance but this means that there may be a 10-20% difference in task
> > times because we do not know in advance how long it takes to process each
> > file.  The advantage of the multithreaded version is that the variance
> > between threads is minimal since all threads are pulling from the same
> > stack.
> > I should probably re-iterate that the code worked a few weeks ago and has
> > only started failing lately.
> >
> > On Sat, Aug 27, 2022 at 8:47 AM bill lam  wrote:
> >
> >> I am not sure why you used mutex. If you collect all file names in a
> >> subdirectory and divide it into 15 batches (apparently you want 15
> tasks)
> >> and feed each batch to a different tasks then there won't be any
> >> collisions.
> >>
> >>
> >> On Sat, 27 Aug 2022 at 11:50 AM Devon McCormick 
> >> wrote:
> >>
> >>> Hi,
> >>> So, here's some code I put together over the past few months to use
> >>> multi-threading to parallelize a time-consuming process.
> >>>
> >>> We start with the top-level function:
> >>>
> >>> NB.* startFlipping: wrapper to set up for "flipN" by creating threads,
> >>> setting up MUTEX,
> >>> NB. moving to chip photo dir and flipping them on the chip.
> >>> startFlipping=: 3 : 0
> >>> 12 startFlipping y
> >>> :
> >>> root=. y,':/DCIM/' NB. y is drive letter of photo chip.
> >>> subds=. 0{"1 dir root,'*.'  NB. Process all subdirs' photos
> >>> svdir=. 1!:43'' [ createThreads 15 [ MUTEX=: 10 T. 0NB. Fast
> mutex
> >>> for_sd. subds do. sd=. ;sd  NB. Process each sub-dir
> >>> 1!:44 ] root,sd
> >>> if. 0~:#FLS=: 0{"1 dir '*.jpg' do. tm=. 6!:1''
> >>> tms=. flipN x<.15   NB. Show time, run x threads, no
> more
> >>> than 15.
> >>> tm=. tm,~6!:1''
> >>>  end.
> >>>  end.
> >>>  1!:44 svdir
> >>>  tm;tms
> >>> NB.EG tms=. 12 startFlipping 'F'  NB. Run 12 threads for all .JPGs on
> F:
> >>> )
> >>>
> >>> The thread-creation utility:
> >>> createThreads=: 3 : '{{ 0 T.  }} ^:y]'
> >>>
> >>> Now we look at the cover for the core routine where we spin off the
> >> threads
> >>> in a for loop:
> >>>
> >>> flipN=: 3 : 0
> >>> tms=. i.0
> >>> while. y<#FLS do. pyx=. i.0
> >>> for_ix. i. y<.#FLS do. pyx=. pyx,flip1Photo t. '']ix end.
> >>> tms=. tms,-/&>_2{.&.>pyx
> >>> end.
> >>> NB.EG tms=. flipN 10   NB. Run on 10 threads
> >>> )
> >>>
> >>> This uses a "for" rather than "each" because, in testing, "for" seemed
> >> less
> >>> likely to crash.
> >>>
> >>> Finally, the deepest function that concerns multi-threaders:
> >>>
> >>> NB.* flip1Photo: flip a single photo.
> >>> flip1Photo=: 3 : 0
> >>> assert. *./nameExists &> 'MUTEX';'FLS'NB. Need these 2 globals:
> >>> FLS=: 0{"1 dir '*.jpg' [ MUTEX=: 10 T. 0NB. Fast mutex
> >>> tntxt=. ' '-.~":tn=. 3 T. '' [ tm=. 6!:1''  NB. Current thread
> >>> number is "tn". "tm" is session start time.
> >>> if. 0<#FLS do.
> >>> myFl=. 'ThisFL',tntxt [ 11 T. MUTEX  NB. Lock mutex
> >>> (nms)=: split FLS [ nms=. myFl,' FLS' NB. Take 1 filename
> from
> >>> list
> >

Re: [Jprogramming] Change in multi-threading?

2022-08-27 Thread Devon McCormick
My older, non-multithreaded, version works by dividing files into batches
in advance but this means that there may be a 10-20% difference in task
times because we do not know in advance how long it takes to process each
file.  The advantage of the multithreaded version is that the variance
between threads is minimal since all threads are pulling from the same
stack.
I should probably re-iterate that the code worked a few weeks ago and has
only started failing lately.

On Sat, Aug 27, 2022 at 8:47 AM bill lam  wrote:

> I am not sure why you used mutex. If you collect all file names in a
> subdirectory and divide it into 15 batches (apparently you want 15 tasks)
> and feed each batch to a different tasks then there won't be any
> collisions.
>
>
> On Sat, 27 Aug 2022 at 11:50 AM Devon McCormick 
> wrote:
>
> > Hi,
> > So, here's some code I put together over the past few months to use
> > multi-threading to parallelize a time-consuming process.
> >
> > We start with the top-level function:
> >
> > NB.* startFlipping: wrapper to set up for "flipN" by creating threads,
> > setting up MUTEX,
> > NB. moving to chip photo dir and flipping them on the chip.
> > startFlipping=: 3 : 0
> >12 startFlipping y
> > :
> >root=. y,':/DCIM/' NB. y is drive letter of photo chip.
> >subds=. 0{"1 dir root,'*.'  NB. Process all subdirs' photos
> >svdir=. 1!:43'' [ createThreads 15 [ MUTEX=: 10 T. 0NB. Fast mutex
> >for_sd. subds do. sd=. ;sd  NB. Process each sub-dir
> >1!:44 ] root,sd
> >if. 0~:#FLS=: 0{"1 dir '*.jpg' do. tm=. 6!:1''
> >tms=. flipN x<.15   NB. Show time, run x threads, no more
> > than 15.
> >tm=. tm,~6!:1''
> > end.
> > end.
> > 1!:44 svdir
> > tm;tms
> > NB.EG tms=. 12 startFlipping 'F'  NB. Run 12 threads for all .JPGs on F:
> > )
> >
> > The thread-creation utility:
> > createThreads=: 3 : '{{ 0 T.  }} ^:y]'
> >
> > Now we look at the cover for the core routine where we spin off the
> threads
> > in a for loop:
> >
> > flipN=: 3 : 0
> >tms=. i.0
> >while. y<#FLS do. pyx=. i.0
> >for_ix. i. y<.#FLS do. pyx=. pyx,flip1Photo t. '']ix end.
> >tms=. tms,-/&>_2{.&.>pyx
> >end.
> > NB.EG tms=. flipN 10   NB. Run on 10 threads
> > )
> >
> > This uses a "for" rather than "each" because, in testing, "for" seemed
> less
> > likely to crash.
> >
> > Finally, the deepest function that concerns multi-threaders:
> >
> > NB.* flip1Photo: flip a single photo.
> > flip1Photo=: 3 : 0
> >assert. *./nameExists &> 'MUTEX';'FLS'NB. Need these 2 globals:
> > FLS=: 0{"1 dir '*.jpg' [ MUTEX=: 10 T. 0NB. Fast mutex
> >tntxt=. ' '-.~":tn=. 3 T. '' [ tm=. 6!:1''  NB. Current thread
> > number is "tn". "tm" is session start time.
> >if. 0<#FLS do.
> >myFl=. 'ThisFL',tntxt [ 11 T. MUTEX  NB. Lock mutex
> >(nms)=: split FLS [ nms=. myFl,' FLS' NB. Take 1 filename from
> > list
> >13 T. MUTEX   NB. Unlock mutex
> >if. 0~:#>".myFl do. *flipPhotoByOrientation* >".myFl end.
> >end.
> >tn,(6!:1''),tm   NB. Thread #, end, start session time.
> > NB.EG flip1Photo t. '']0 [ flip1Photo t. '']1 NB. 2 threads
> > )
> >
> > This concentrates all mutex-handling into one place and uses the thread
> > number to try to avoid collisions.  If you wanted to try the code above,
> > you could replace "flipPhotoByOrientation" with anything of your choice.
> >
> > Anyway, about a week or so ago, this code seemed to (mostly) work but
> now I
> > get this with only a second or so delay:
> >6!:2 'tms=. 12 startFlipping ''F'''  NB. Run 12 threads for all .JPGs
> on
> > F:
> >
> > Process shell<1> exited abnormally with code 5
> >
> > I'm afraid I may be on the bleeding edge here but does anyone have any
> > ideas?  I've done a lot of testing and gotten a few things to work a
> little
> > but not for very long.  I used to be able to process hundreds of photos
> > with this code.
> >
> > Any help would be appreciated.  The above code should be enough to
> > re-produce the issue once "flipPhotoByOrientation" has been replaced by
> > some target function, preferably one that takes a few seconds to run.
> >
> > Thanks,
> >
> > Devon
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Change in multi-threading?

2022-08-26 Thread Devon McCormick
Hi,
So, here's some code I put together over the past few months to use
multi-threading to parallelize a time-consuming process.

We start with the top-level function:

NB.* startFlipping: wrapper to set up for "flipN" by creating threads,
setting up MUTEX,
NB. moving to chip photo dir and flipping them on the chip.
startFlipping=: 3 : 0
   12 startFlipping y
:
   root=. y,':/DCIM/' NB. y is drive letter of photo chip.
   subds=. 0{"1 dir root,'*.'  NB. Process all subdirs' photos
   svdir=. 1!:43'' [ createThreads 15 [ MUTEX=: 10 T. 0NB. Fast mutex
   for_sd. subds do. sd=. ;sd  NB. Process each sub-dir
   1!:44 ] root,sd
   if. 0~:#FLS=: 0{"1 dir '*.jpg' do. tm=. 6!:1''
   tms=. flipN x<.15   NB. Show time, run x threads, no more
than 15.
   tm=. tm,~6!:1''
end.
end.
1!:44 svdir
tm;tms
NB.EG tms=. 12 startFlipping 'F'  NB. Run 12 threads for all .JPGs on F:
)

The thread-creation utility:
createThreads=: 3 : '{{ 0 T.  }} ^:y]'

Now we look at the cover for the core routine where we spin off the threads
in a for loop:

flipN=: 3 : 0
   tms=. i.0
   while. y<#FLS do. pyx=. i.0
   for_ix. i. y<.#FLS do. pyx=. pyx,flip1Photo t. '']ix end.
   tms=. tms,-/&>_2{.&.>pyx
   end.
NB.EG tms=. flipN 10   NB. Run on 10 threads
)

This uses a "for" rather than "each" because, in testing, "for" seemed less
likely to crash.

Finally, the deepest function that concerns multi-threaders:

NB.* flip1Photo: flip a single photo.
flip1Photo=: 3 : 0
   assert. *./nameExists &> 'MUTEX';'FLS'NB. Need these 2 globals:
FLS=: 0{"1 dir '*.jpg' [ MUTEX=: 10 T. 0NB. Fast mutex
   tntxt=. ' '-.~":tn=. 3 T. '' [ tm=. 6!:1''  NB. Current thread
number is "tn". "tm" is session start time.
   if. 0<#FLS do.
   myFl=. 'ThisFL',tntxt [ 11 T. MUTEX  NB. Lock mutex
   (nms)=: split FLS [ nms=. myFl,' FLS' NB. Take 1 filename from
list
   13 T. MUTEX   NB. Unlock mutex
   if. 0~:#>".myFl do. *flipPhotoByOrientation* >".myFl end.
   end.
   tn,(6!:1''),tm   NB. Thread #, end, start session time.
NB.EG flip1Photo t. '']0 [ flip1Photo t. '']1 NB. 2 threads
)

This concentrates all mutex-handling into one place and uses the thread
number to try to avoid collisions.  If you wanted to try the code above,
you could replace "flipPhotoByOrientation" with anything of your choice.

Anyway, about a week or so ago, this code seemed to (mostly) work but now I
get this with only a second or so delay:
   6!:2 'tms=. 12 startFlipping ''F'''  NB. Run 12 threads for all .JPGs on
F:

Process shell<1> exited abnormally with code 5

I'm afraid I may be on the bleeding edge here but does anyone have any
ideas?  I've done a lot of testing and gotten a few things to work a little
but not for very long.  I used to be able to process hundreds of photos
with this code.

Any help would be appreciated.  The above code should be enough to
re-produce the issue once "flipPhotoByOrientation" has been replaced by
some target function, preferably one that takes a few seconds to run.

Thanks,

Devon
-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Poll questions: new refcard

2022-08-04 Thread Devon McCormick
1. c. footnotes below each table
2. b. about right
3. b. about right
4. c. like it
5. d. yes, and I would like to see names added for the adverb
6. b. both

Have a wide landscape version as though one would print it on a foldable
card.


On Thu, Aug 4, 2022 at 4:27 PM Jan-Pieter Jacobs 
wrote:

> Good job!
>
> I answered the poll in-line below:
>
> Op do 4 aug. 2022 om 17:02 schreef Henry Rich :
>
> > 1. In each document, look at a couple of tables with a footnote, and
> > refer to the footnotes.  Which layout did you find easiest to use?
> > c. footnotes below each table (easier for on-screen viewing, where I'd
> use
> > it most).
> >
> > 2. What do you think of the size of the main text?
> > b. about right
> >
> > 3. What do you think of the size of the footnote text?
> > b. about right
> >
> > 4. What do you think of the coloration (indicating part of speech)?
> > c. like it (but I'd double check with a colour-blind person whether it's
> > recognisable / legible)
> >
> > 5. Consider the two tables 'Adverbs' and 'Conjunctions'.  The adverb
> > table has a column of menmonic names, the conjunction table does not.
> > Are the names helpful?
> > d. yes, and I would like to see names added for the conjunctions
> >
> > 6. In the Foreigns table, would you prefer to see the system-defined
> > name in addition to/instead of the m!:n value?
> > a. m!:n only
> >
> > 7. Do you have suggestions for formatting?  Write them in.
> >
> >
> 0) +1 for landscape mode!
>
> 1) I find it slightly confusing that the footnotes are not in order of
> appearance (the first one on the page is 17), and there are some footnotes
> that appear to be out of sync, but I bet this will be ironed out in the
> final version :).
>
> 2) The arguments table could benefit from a L/R column, there seems to be
> space available for this.
>
> 3) I'm still missing some verbs, but I don't know whether you're (in the
> long run) going for completeness.
>
> 4) The modifier train table takes up a lot of space... I recently
> summarised it for myself as follows by bunching together like cases (I hope
> it comes through, best read in fixed-width font):
>
> Train  | Type | Result
> --
> [N] V N| noun  | apply verb monad [dyad]
> [NV]V V| verb  | hook [fork]
> ACV V CV   | adv/conj  | fork after applying AC. note: *no A V C*
> A  A  V| conj  |  (u A)  (*v* A) V   ; fork if verbs produced
> AC A  [A]  | adv/conj  | ((u AC [v]) A) [A]; apply advs/conjs in order
> NV C  NV   | any   | apply C to produce any part of speech
> NV C  AC   | adv/conj  | NV C (u AC [v])
> AC C  NV   | adv/conj  | (u AC [v]) C NV
> AC C  A| conj  | (u AC [v]) C (*v* A)
> AC C  C| conj  | (u AC [v]) C (u C v)
> NV A   | any   | apply A to NV
> NV C / C NV| adv   | bind to C, partial application
> A V| adv   | (u A) V
> A C| adv   | (u A) C *u* adverbial hook (e.g. ]: C)
> C0 C1  | conj  | (u C0 v) (u C1 v)
> (foot)Notes:
> - AVCN always remain in the result in the order they were in the train
> - A and C can take N or V-> any, so e.g. CC can be verb application instead
> of a hook: 2 (&[.) + is 4
> - AC is adv hook, opposite order of verb hook (and only 'monad')
> - monad to adverb: (]. [.) e.g. (].[.)> is an adverb opening its left arg
>
> I highlighted in the above with ** what I consider to be less intuitive
> combinations. Maybe it's of use if you'd like to reduce the size of the
> modifier train table.
>
> 5) In the adverb table, the dyadic case of x m y -> m^:x y is missing,
> and could easily be added as an optional part (as for e.g. ^:). Also, I
> think that u@n should be rendered as u@(n"_); u n would seem to imply that
> the verb is already executed.
>
> 6) Links to NuVoC for each primitive would also be nice for a final
> version, so one can click through for a longer description if needed (when
> used on a computer).
>
> All that said, great job, it looks very pretty.
>
> Keep up the good work,
> Jan-Pieter
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] strange request

2022-07-26 Thread Devon McCormick
I don't know if this is what you want but here's something using agenda to
convert between the WxHx3 (3D) representation of an image and the flattened
(2D) WxH version, depending on which of the two you provide.
rgb=: 4 : 

Re: [Jprogramming] NYCJUG: Thinking in an Array Language

2022-07-19 Thread Devon McCormick
I missed that.  I think this is an elegant way that avoids explicit rank.

On Tue, Jul 19, 2022 at 2:13 PM Hauke Rehr  wrote:

> Tom did, in the very post starting this thread:
>
> (1+i. 4 3) +/ . * 1+i. 3 4
>   38  44  50  56
>   83  98 113 128
> 128 152 176 200
> 173 206 239 272
>
> Am 19.07.22 um 20:10 schrieb Devon McCormick:
> > I'm puzzled why no one has used the basic matrix multiplication
> expression
> > in J.
> >
> > matmul3
> > ([: +/ *)"1 _
> > mat1=. <.0.5+10*<:+:1000 1000?@$0
> > mat0=. <.0.5+10*<:+:1000 1000?@$0
> > (10) 6!:2 'mat0 matmul3 mat1'
> > 0.737084
> > (10) 6!:2 'mat0 +/ . * mat1'
> > 0.0499271
> > (mat0 matmul3 mat1) -: mat0 +/ . * mat1
> > 1
> >
> >
> >
> > On Tue, Jul 19, 2022 at 12:49 PM Thomas McGuire 
> > wrote:
> >
> >> My late night laziness and I got bitten by the 13 : definition doesn’t
> >> always work
> >> correctly with both x and y variables. Which I just assumed was working
> >> correctly.
> >>
> >> Now when I fix the definition of matmul3 so it works correctly (as
> Elijah
> >> pointed out) the variable
> >> representation does not incur a worrisome time penalty:
> >>
> >> (1+i. 4 3) ([: +/ *)"1 _ (1+i. 3 4)
> >>   38  44  50  56
> >>   83  98 113 128
> >> 128 152 176 200
> >> 173 206 239 272
> >> matmul3 =: ([: +/ *)"1 _
> >> (1+i. 4 3) matmul3 (1+i. 3 4)
> >>   38  44  50  56
> >>   83  98 113 128
> >> 128 152 176 200
> >> 173 206 239 272
> >>
> >> 10 timex 'bmat1 ([: +/ *)"1 _ bmat2’
> >> 0.0464441
> >> 10 timex 'bmat1 matmul3 bmat2’
> >> 0.0471224
> >>
> >> (bmat1 matmul3 bmat2) -: bmat1 ([: +/ *)"1 _ bmat2
> >> 1
> >>
> >>
> >> Thanks for showing me the error
> >>
> >>> On Jul 19, 2022, at 5:15 AM, Elijah Stone  wrote:
> >>>
> >>> You are measuring two completely different things.
> >>>
> >>>10 timex'bmat1 ([: +/ *)"1 _ bmat2'
> >>> 0.0482293
> >>>10 timex'bmat1 ([: +/ *"1 _) bmat2'
> >>> 0.115583
> >>>(bmat1 ([: +/ *)"1 _ bmat2) -: (bmat1 ([: +/ *"1 _) bmat2)
> >>> 0
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >> --
> >> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] NYCJUG: Thinking in an Array Language

2022-07-19 Thread Devon McCormick
I'm puzzled why no one has used the basic matrix multiplication expression
in J.

   matmul3
([: +/ *)"1 _
   mat1=. <.0.5+10*<:+:1000 1000?@$0
   mat0=. <.0.5+10*<:+:1000 1000?@$0
   (10) 6!:2 'mat0 matmul3 mat1'
0.737084
   (10) 6!:2 'mat0 +/ . * mat1'
0.0499271
   (mat0 matmul3 mat1) -: mat0 +/ . * mat1
1



On Tue, Jul 19, 2022 at 12:49 PM Thomas McGuire 
wrote:

> My late night laziness and I got bitten by the 13 : definition doesn’t
> always work
> correctly with both x and y variables. Which I just assumed was working
> correctly.
>
> Now when I fix the definition of matmul3 so it works correctly (as Elijah
> pointed out) the variable
> representation does not incur a worrisome time penalty:
>
>(1+i. 4 3) ([: +/ *)"1 _ (1+i. 3 4)
>  38  44  50  56
>  83  98 113 128
> 128 152 176 200
> 173 206 239 272
>matmul3 =: ([: +/ *)"1 _
>(1+i. 4 3) matmul3 (1+i. 3 4)
>  38  44  50  56
>  83  98 113 128
> 128 152 176 200
> 173 206 239 272
>
>10 timex 'bmat1 ([: +/ *)"1 _ bmat2’
> 0.0464441
>10 timex 'bmat1 matmul3 bmat2’
> 0.0471224
>
>(bmat1 matmul3 bmat2) -: bmat1 ([: +/ *)"1 _ bmat2
> 1
>
>
> Thanks for showing me the error
>
> > On Jul 19, 2022, at 5:15 AM, Elijah Stone  wrote:
> >
> > You are measuring two completely different things.
> >
> >   10 timex'bmat1 ([: +/ *)"1 _ bmat2'
> > 0.0482293
> >   10 timex'bmat1 ([: +/ *"1 _) bmat2'
> > 0.115583
> >   (bmat1 ([: +/ *)"1 _ bmat2) -: (bmat1 ([: +/ *"1 _) bmat2)
> > 0
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Got stuck...

2022-07-07 Thread Devon McCormick
I approached it this way:
   3 ([|]) 2 5 6 7 9 11 12 NB. x modulus of y
2 2 0 1 0 2 0
   3 (0=[|]) 2 5 6 7 9 11 12   NB. Which moduli are zero?
0 0 1 0 1 0 1
   3 (]#~0=[|]) 2 5 6 7 9 11 12NB. Reduce y by above result.
6 9 12


On Thu, Jul 7, 2022 at 8:45 AM  wrote:

> Hi xash,
>
> WHOW! Thanks a lot! I will "dissamble" this with trace and
> dissect. I never heard of a "trident" before and will feed
> this into the J wiki search engine.
>
> Cheers!
> Meino
>
>
>
> On 07/07 01:32, xash wrote:
> > In a tacit definition you can access x and y with [ and ].  So in your
> > example, y (0=|) x gets your current output, and y (] #~ 0=|) x gets
> > your wanted output, as it will be parsed as (] #~ (0 = |)), so two forks.
> >
> > On Thu Jul 7, 2022 at 1:24 PM CEST,  wrote:
> > > Hi,
> > >
> > > as a first step into the "land of J" I tried to build a fork(?)
> > > to get a list of those numbers from a list, which can be devided
> > > by one given number .
> > >
> > > x is the one given number
> > > y is the list of numbers to check/test
> > >
> > > The whole thing should work like this
> > >
> > > x  y
> > >
> > > What I have so far is
> > > 0 = 3 #: 2 5 6 7 9 11 12
> > > xy--
> > >
> > > for all number, which can be divided by 3 it prints
> > > 0 0 1 0 1 0 1
> > >
> > > which is correct - but not the answer I wanted.
> > >
> > > I want to try this without using variables...this kind of solution
> > > is called "tacit" ... if I recall it correctly.
> > >
> > > My problem is, that the input list needs to be used twice and
> > > the result need to be refed into the whole thing again.
> > >
> > > The first time, y is used to calculate for each number y modulo x.
> > > The the result is checked for being "0" or not.
> > > And now I got stuck: How can I reapply y to the result to
> > > filter all numbers, which are not divisable by x?
> > >
> > > If there is already a verb which does all that for me - I don't
> > > want to use it (for now), since I want to learn "how to J" :)
> > >
> > > Any help is very appreciated.
> > >
> > > And: Is a gordian knot in my head curable? ;)
> > >
> > > Cheers!
> > > Meino
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Problem with @ (Atop)

2022-06-28 Thread Devon McCormick
 > > >
> > > > And, that said, note that I am focusing here on utility rather than
> > > > appearance -- someone with more of an eye towards appearance may be
> > > > able to take this general approach and come up with something more
> > > > appealing which:
> > > >
> > > > (*) Explicitly states, in the definition, the type of word being
> > > defined, and
> > > > (*) Links that type statement to the corresponding page which spells
> > > > out what this means in the context of the language definition.
> > > >
> > > > And... that said... the omission of this kind of detail could be
> > > > considered a bug (though there's probably a better way of describing
> > > > this kind of problem).
> > > >
> > > > Thanks,
> > > >
> > > > --
> > > > Raul
> > > >
> --
> > > > 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] calculus horibilis

2022-06-07 Thread Devon McCormick
> The 'b' notation is useful when importing numbers which were
> originally supplied in non-base-10 format. (Hexadecimal, octal and
> binary are relatively common in some contexts.)

Even in this case, unless the numbers are already written in J notation, I
don't see how putting a "16b" or "8b" in front of each number is any
simpler than simply doing base conversion.


On Tue, Jun 7, 2022 at 10:57 AM Raul Miller  wrote:

> On Tue, Jun 7, 2022 at 10:49 AM Devon McCormick 
> wrote:
> > In any case, I don't think I have ever found the "b" notation to be
> > particularly useful.
>
> The 'b' notation is useful when importing numbers which were
> originally supplied in non-base-10 format. (Hexadecimal, octal and
> binary are relatively common in some contexts.)
>
> That said, I imagine that it would have been nice if the letters used
> for digits had been ALL CAPS, which would have allowed 'b' notation to
> be intermixed with the rest of J's constant language.
>
> Thanks,
>
> --
> Raul
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] calculus horibilis

2022-06-07 Thread Devon McCormick
 Hi Yves,

I'm not sure how you're interpreting J's base number notation but it is
certainly correct in the examples you mention.

For instance, 5 in base 4 is indeed 11 because 5=+/1 1*4^1 0 or "1" in the
1s column plus 1 in the 4s column equals 5.  In fact this is exactly the
same as substituting "4" for "3" in your example
>   11 in base 3 is
>   (1*3^1)+(1*3^0)
>   4

It looks like you may be interpreting the results backwards in some sense.
In the example of 3b102, this gives you the decimal value of the base 3
number "102", or +/1 0 2*3^2 1 0 which is 1 in the 9s (3^2) column plus 0
in the 3s (3^1) column plus 2 in the 1s (3^0) column.

In any case, I don't think I have ever found the "b" notation to be
particularly useful.

Cheers,

Devon


On Tue, Jun 7, 2022 at 10:35 AM Raul Miller  wrote:

> On Tue, Jun 7, 2022 at 10:25 AM yt  wrote:
> >   J has other number notations that use letters:
> >   )
> >   3b102 NB. base (102 in base 3)
> >   11
> >
> >   my eyes are horrified by the result
> >
> >   11 in base 3 is
> >   (1*3^1)+(1*3^0)
> >   4
>
> The displayed result you got when you entered 3b102 was *not* 3b11 it
> was 11 (so it was represented in base 10).
>
> I hope this helps,
>
> --
> Raul
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] locale error in Vocabulary/Locales

2022-05-20 Thread Devon McCormick
I wonder what use one would have for these doubly-linked locales.  To me,
it has kind of a bad code smell but that may be because I'm unfamiliar with
the sort of thing for which it's intended.

On Fri, May 20, 2022 at 2:54 PM Don Guinn  wrote:

> Yes, I find the numbered locales quite useful, but building the
> double-linked list of locales might mean he might intended to have very
> many locales created and could be a performance problem to delete the
> locales.
>
> On Fri, May 20, 2022 at 11:46 AM Raul Miller 
> wrote:
>
> > On Fri, May 20, 2022 at 1:29 PM Don Guinn  wrote:
> > > Just a thought. The management of numbered locales is not very
> > efficient. A
> > > while back I created several thousand locales as an object test. I went
> > to
> > > delete all of them and it took forever.
> >
> > Right.
> >
> > My understanding was that J's locales were designed to roughly
> > correspond with intel's "Structure of Arrays" abstraction.
> >
> > As I understand it, Ken Iverson did not see much use for the popular
> > but inefficient abstractions which would roughly correspond with
> > intel's "Array of Structures" abstraction (with "objects being similar
> > to structures, but heavier).
> >
> > In other words, for code where execution time is a bottleneck, the
> > purpose of J's locales should be thought of as being more analogous
> > (for example) to the purpose of Java's namespaces than the purpose of
> > Java's object system.
> >
> > --
> > Raul
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] locale error in Vocabulary/Locales

2022-05-20 Thread Devon McCormick
 Hi Robert,
if you have update permission on the wiki, you don't need to request
anyone's permission to change a page.  If you change or add something
substantial, you may want to let people know after the fact but that's up
to you.

Cheers,

Devon

On Fri, May 20, 2022 at 10:12 AM Robert Cyr  wrote:

> I should add 2 small points here:
>
> 1.The one line correction.
> My intent was to keep things simple, also retaining the focus on the ease
> of using numbered licales.  And it worked for me on my windows pc and my
> Ipad.  That is why I did not add more code or warnings about its
> limitations
> But I like the little bit of J magic dust in the line creating the array of
> numeric locales with the use of @.   And I would add that anyone
> contemplating the use of numeric locales should not have problems with that
> bit of code.
>
> 2. Correcting the wiki.
> Following the instructions found in the wiki I did request permission to
> make the change. I indicated the page I intended to correct and  that my
> change had been suggested by Henry Rich. After a week, having received no
> reply, I posted the simple correction.
>
> Le jeu. 19 mai 2022, à 12 h 15, Raul Miller  a
> écrit :
>
> >
> >
> https://code.jsoftware.com/wiki/Vocabulary/Locales#An_example_using_explicit_and_object_locatives
> >
> > I made some further changes.
> >
> > First, to use cocreate for the name of each numbered locale, and
> >
> > Second I indented the code slightly, and replaced smoutput with echo,
> > for (in my opinion) improved readability.
> >
> > (Using cocreate and discarding its result did not actually work.)
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Thu, May 19, 2022 at 12:01 PM Devon McCormick 
> > wrote:
> > >
> > > Which is here - https://code.jsoftware.com/wiki/Vocabulary/Locales -
> > and I
> > > made the change without checking the code.
> > >
> > >
> > > On Thu, May 19, 2022 at 11:55 AM Devon McCormick 
> > wrote:
> > >
> > > > You can get the required authorization by asking for it.
> > > > If you do want someone else to do it, it would be nice to know where
> > this
> > > > example is.
> > > >
> > > > On Thu, May 19, 2022 at 10:21 AM Robert Cyr 
> > wrote:
> > > >
> > > >> I do not have the required  authorization to correct a wiki.  All
> > that is
> > > >> required is an extra line creating a numbered locale, and the sample
> > > >> script
> > > >> would simply become:
> > > >>
> > > >> make=: verb define
> > > >> NB. make doubly-linked queue of (y) numbered locales
> > > >> for_i. i.y do.
> > > >>
> > > >> cocreate ''
> > > >>
> > > >>   loc=. < ": i
> > > >>   name__loc=: 'This is locale ' , ": i
> > > >>   prev__loc=: < ": y| i-1
> > > >>   next__loc=: < ": y| i+1
> > > >> end.
> > > >> empty''
> > > >> )
> > > >>
> > > >> Numbered locales are different from named locales in that they must
> be
> > > >> explicitly created before using.  This verb conew'' in the context
> of
> > a
> > > >> class script will create a numbered locale, and so will the verb
> > > >> cocreate''.
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> Le ven. 6 mai 2022, à 22 h 43, Henry Rich  a
> > écrit
> > > >> :
> > > >>
> > > >> > I think you're right; please fix the Wiki.
> > > >> >
> > > >> > Henry Rich
> > > >> >
> > > >> > On 5/6/2022 8:34 PM, Robert Cyr wrote:
> > > >> > > In
> > > >> > > An example using explicit and object locatives
> > > >> > >
> > > >> > > The sampe script:
> > > >> > >
> > > >> > > make=: verb define
> > > >> > > NB. make doubly-linked queue of (y) numbered locales
> > > >> > > for_i. i.y do.
> > > >> > >loc=. < ": i
> > > >> > >name__loc=: 'This is locale ' , ": i
> > > >> > >prev__loc=: < ": y| i-1
> > > >> > >next__loc=: < ": y| i+1
> > > >>

Re: [Jprogramming] locale error in Vocabulary/Locales

2022-05-19 Thread Devon McCormick
Which is here - https://code.jsoftware.com/wiki/Vocabulary/Locales - and I
made the change without checking the code.


On Thu, May 19, 2022 at 11:55 AM Devon McCormick  wrote:

> You can get the required authorization by asking for it.
> If you do want someone else to do it, it would be nice to know where this
> example is.
>
> On Thu, May 19, 2022 at 10:21 AM Robert Cyr  wrote:
>
>> I do not have the required  authorization to correct a wiki.  All that is
>> required is an extra line creating a numbered locale, and the sample
>> script
>> would simply become:
>>
>> make=: verb define
>> NB. make doubly-linked queue of (y) numbered locales
>> for_i. i.y do.
>>
>> cocreate ''
>>
>>   loc=. < ": i
>>   name__loc=: 'This is locale ' , ": i
>>   prev__loc=: < ": y| i-1
>>   next__loc=: < ": y| i+1
>> end.
>> empty''
>> )
>>
>> Numbered locales are different from named locales in that they must be
>> explicitly created before using.  This verb conew'' in the context of a
>> class script will create a numbered locale, and so will the verb
>> cocreate''.
>>
>>
>>
>>
>>
>>
>> Le ven. 6 mai 2022, à 22 h 43, Henry Rich  a écrit
>> :
>>
>> > I think you're right; please fix the Wiki.
>> >
>> > Henry Rich
>> >
>> > On 5/6/2022 8:34 PM, Robert Cyr wrote:
>> > > In
>> > > An example using explicit and object locatives
>> > >
>> > > The sampe script:
>> > >
>> > > make=: verb define
>> > > NB. make doubly-linked queue of (y) numbered locales
>> > > for_i. i.y do.
>> > >loc=. < ": i
>> > >name__loc=: 'This is locale ' , ": i
>> > >prev__loc=: < ": y| i-1
>> > >next__loc=: < ": y| i+1
>> > > end.
>> > > empty''
>> > > )
>> > >
>> > > generates a locale error.
>> > >
>> > > Numbered locales can only be used in the context of Class scripts and
>> > > are instances of the defined class. These numbered classes names are
>> > > created using
>> > >
>> > > conew 'ClassName'.
>> > >
>> > > The sample code should therefore be modified to use legal locale names
>> > like
>> > >
>> > > loc =. <'loc',":i
>> > > --
>> > > For information about J forums see
>> http://www.jsoftware.com/forums.htm
>> >
>> >
>> > --
>> > This email has been checked for viruses by AVG.
>> > https://www.avg.com
>> >
>> > --
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>> --
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
>
>

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] locale error in Vocabulary/Locales

2022-05-19 Thread Devon McCormick
You can get the required authorization by asking for it.
If you do want someone else to do it, it would be nice to know where this
example is.

On Thu, May 19, 2022 at 10:21 AM Robert Cyr  wrote:

> I do not have the required  authorization to correct a wiki.  All that is
> required is an extra line creating a numbered locale, and the sample script
> would simply become:
>
> make=: verb define
> NB. make doubly-linked queue of (y) numbered locales
> for_i. i.y do.
>
> cocreate ''
>
>   loc=. < ": i
>   name__loc=: 'This is locale ' , ": i
>   prev__loc=: < ": y| i-1
>   next__loc=: < ": y| i+1
> end.
> empty''
> )
>
> Numbered locales are different from named locales in that they must be
> explicitly created before using.  This verb conew'' in the context of a
> class script will create a numbered locale, and so will the verb
> cocreate''.
>
>
>
>
>
>
> Le ven. 6 mai 2022, à 22 h 43, Henry Rich  a écrit :
>
> > I think you're right; please fix the Wiki.
> >
> > Henry Rich
> >
> > On 5/6/2022 8:34 PM, Robert Cyr wrote:
> > > In
> > > An example using explicit and object locatives
> > >
> > > The sampe script:
> > >
> > > make=: verb define
> > > NB. make doubly-linked queue of (y) numbered locales
> > > for_i. i.y do.
> > >loc=. < ": i
> > >name__loc=: 'This is locale ' , ": i
> > >prev__loc=: < ": y| i-1
> > >next__loc=: < ": y| i+1
> > > end.
> > > empty''
> > > )
> > >
> > > generates a locale error.
> > >
> > > Numbered locales can only be used in the context of Class scripts and
> > > are instances of the defined class. These numbered classes names are
> > > created using
> > >
> > > conew 'ClassName'.
> > >
> > > The sample code should therefore be modified to use legal locale names
> > like
> > >
> > > loc =. <'loc',":i
> > > --
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
> > --
> > This email has been checked for viruses by AVG.
> > https://www.avg.com
> >
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Mutex with multi-threading primitive

2022-05-10 Thread Devon McCormick
Thanks, Bill and Henry.  Using a non-JQt image reader seems to have done
the trick.
I will add this to my multi-threading notes.

On Tue, May 10, 2022 at 9:42 PM Henry Rich  wrote:

> read_image is not defined for me, nor is readimg_jqtide_.
>
> Henry Rich
>
>
>
> On 5/10/2022 8:13 PM, Devon McCormick wrote:
> > It's the "read_image_" line that seems to be where it hangs up for me, on
> > the fourth line from the end with the comment "¡Fails here!".
> > The invocation (for 5 threads) is:
> > mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX
> [
> > mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX
> >
> > On Tue, May 10, 2022 at 6:22 PM Henry Rich  wrote:
> >
> >> What do I run to make it fail?
> >>
> >> Henry Rich
> >>
> >> On 5/10/2022 6:01 PM, Devon McCormick wrote:
> >>> Henry,
> >>> Here is the MVF - minimum viable failure.  It looks like the culprit is
> >>> "read_image" which is just a cover for "readimg_jqtide_".  I'm running
> >>> under jconsole.
> >>>
> >>> Set up in a directory with some .JPG files:
> >>>  FLS=: 0{"1 dir '*.jpg'
> >>>  createThreads 5
> >>>  MUTEX=: 10 T. 1NB. Recursive mutex; either fails.
> >>>
> >>> mtFileWork=: 3 : 0
> >>>  tm=. 6!:1''
> >>>  while. 0<#FLS do.
> >>>  tn=. ":3 T. ''   NB. Thread number as char
> >>>  varnm=. ' '-.~'threadVar',tn
> >>>  smoutput 'Thread ',tn,' locking at ',":qts''
> >>>  11 T. y
> >>>  smoutput 'Thread ',tn,' locked at ',":qts''
> >>>  (varnm,' FLS')=: split FLS
> >>>  smoutput 'Thread ',tn,' unlocking at ',(":qts''),' for file
> >> ',flnm=.
> >>>> ".varnm
> >>>  13 T. y
> >>>  smoutput 'Thread ',tn,' unlocked at ',":qts''
> >>>  #read_image flnm   NB. ¡Fails here!
> >>>   end.
> >>>   tm=. tm,~6!:1''
> >>> NB.EG mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t.
> ''
> >>> MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX
> >>> )
> >>>
> >>> Any help is appreciated!
> >>>
> >>> Thanks,
> >>>
> >>> Devon
> >>>
> >>> On Tue, May 10, 2022 at 4:46 PM Henry Rich 
> wrote:
> >>>
> >>>> If you can get me a version that fails on Windows I'll look at it.
> >>>>
> >>>> Henry Rich
> >>>>
> >>>> On 5/10/2022 4:20 PM, Devon McCormick wrote:
> >>>>> Hi,
> >>>>>
> >>>>> Has anyone had success using the multi-threading mutex primitives?
> >> I've
> >>>>> had limited success - I'll be presenting some basic routines at
> NYCJUG
> >>>> this
> >>>>> evening (18:00 EDT -
> >>>>> https://www.meetup.com/J-Dynamic-Functional-Programming/) - but have
> >>>> been
> >>>>> unable to run multiple threads on a real-life process without
> crashing
> >> J.
> >>>>> The following simplified demo seems to work OK but the version of
> this
> >>>>> where I do actual work crashes - with "Process shell<1> exited
> >> abnormally
> >>>>> with code 5" -  after two to thirty repetitions.
> >>>>>
> >>>>>   MUTEX=: 10 T. 0NB. Fast mutex
> >>>>>   createThreads=: 3 : '{{ 0 T.  }} ^:y]'
> >>>>>   qts=: 6!:0
> >>>>>   createThreads 5
> >>>>>   GVAR=: 100?@$1e6NB. Initialize global
> threads
> >>>> will
> >>>>> consume
> >>>>>
> >>>>> multiLockMsgUnlock=: 3 : 0
> >>>>>   while. 0<#GVAR do.
> >>>>>   tn=. ":3 T. ''   NB. Thread number as char
> >>>>>   varnm=: ' '-.~'threadVar',tn
> >>>>>   smoutput 'Thread ',tn,' locking at ',":qts''
> >>>>>   11 T. y
> >>>>>   smoutput 'Thread ',tn,' locked at ',":qts''
> >>>>>   (varnm,' GVAR')

Re: [Jprogramming] Mutex with multi-threading primitive

2022-05-10 Thread Devon McCormick
It's the "read_image_" line that seems to be where it hangs up for me, on
the fourth line from the end with the comment "¡Fails here!".
The invocation (for 5 threads) is:
mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [
mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX

On Tue, May 10, 2022 at 6:22 PM Henry Rich  wrote:

> What do I run to make it fail?
>
> Henry Rich
>
> On 5/10/2022 6:01 PM, Devon McCormick wrote:
> > Henry,
> > Here is the MVF - minimum viable failure.  It looks like the culprit is
> > "read_image" which is just a cover for "readimg_jqtide_".  I'm running
> > under jconsole.
> >
> > Set up in a directory with some .JPG files:
> > FLS=: 0{"1 dir '*.jpg'
> > createThreads 5
> > MUTEX=: 10 T. 1NB. Recursive mutex; either fails.
> >
> > mtFileWork=: 3 : 0
> > tm=. 6!:1''
> > while. 0<#FLS do.
> > tn=. ":3 T. ''   NB. Thread number as char
> > varnm=. ' '-.~'threadVar',tn
> > smoutput 'Thread ',tn,' locking at ',":qts''
> > 11 T. y
> > smoutput 'Thread ',tn,' locked at ',":qts''
> > (varnm,' FLS')=: split FLS
> > smoutput 'Thread ',tn,' unlocking at ',(":qts''),' for file
> ',flnm=.
> >> ".varnm
> > 13 T. y
> > smoutput 'Thread ',tn,' unlocked at ',":qts''
> > #read_image flnm   NB. ¡Fails here!
> >  end.
> >  tm=. tm,~6!:1''
> > NB.EG mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. ''
> > MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX
> > )
> >
> > Any help is appreciated!
> >
> > Thanks,
> >
> > Devon
> >
> > On Tue, May 10, 2022 at 4:46 PM Henry Rich  wrote:
> >
> >> If you can get me a version that fails on Windows I'll look at it.
> >>
> >> Henry Rich
> >>
> >> On 5/10/2022 4:20 PM, Devon McCormick wrote:
> >>> Hi,
> >>>
> >>> Has anyone had success using the multi-threading mutex primitives?
> I've
> >>> had limited success - I'll be presenting some basic routines at NYCJUG
> >> this
> >>> evening (18:00 EDT -
> >>> https://www.meetup.com/J-Dynamic-Functional-Programming/) - but have
> >> been
> >>> unable to run multiple threads on a real-life process without crashing
> J.
> >>>
> >>> The following simplified demo seems to work OK but the version of this
> >>> where I do actual work crashes - with "Process shell<1> exited
> abnormally
> >>> with code 5" -  after two to thirty repetitions.
> >>>
> >>>  MUTEX=: 10 T. 0NB. Fast mutex
> >>>  createThreads=: 3 : '{{ 0 T.  }} ^:y]'
> >>>  qts=: 6!:0
> >>>  createThreads 5
> >>>  GVAR=: 100?@$1e6NB. Initialize global threads
> >> will
> >>> consume
> >>>
> >>> multiLockMsgUnlock=: 3 : 0
> >>>  while. 0<#GVAR do.
> >>>  tn=. ":3 T. ''   NB. Thread number as char
> >>>  varnm=: ' '-.~'threadVar',tn
> >>>  smoutput 'Thread ',tn,' locking at ',":qts''
> >>>  11 T. y
> >>>  smoutput 'Thread ',tn,' locked at ',":qts''
> >>>  (varnm,' GVAR')=: split GVAR
> >>>  smoutput 'Thread ',tn,' unlocking at ',(":qts''),' with
> >>> ',tn,'=',":".varnm
> >>>  13 T. y
> >>>  smoutput 'Thread ',tn,' unlocked at ',(":qts''),';
> >> #GVAR=',":#GVAR
> >>>   end.
> >>> )
> >>> NB. Start five processes (one line):
> >>> multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
> >>> multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
> >>> multiLockMsgUnlock t. '' MUTEX
> >>>
> >>> The actual work I'm doing is on files, a list of whose names
> corresponds
> >> to
> >>> the GVAR vector above.
> >>>
> >>> Any suggestions are welcome.
> >>>
> >>> Cheers,
> >>>
> >>> Devon
> >>>
> >>
> >> --
> >> This email has been checked for viruses by AVG.
> >> https://www.avg.com
> >>
> >> --
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Mutex with multi-threading primitive

2022-05-10 Thread Devon McCormick
Henry,
Here is the MVF - minimum viable failure.  It looks like the culprit is
"read_image" which is just a cover for "readimg_jqtide_".  I'm running
under jconsole.

Set up in a directory with some .JPG files:
   FLS=: 0{"1 dir '*.jpg'
   createThreads 5
   MUTEX=: 10 T. 1NB. Recursive mutex; either fails.

mtFileWork=: 3 : 0
   tm=. 6!:1''
   while. 0<#FLS do.
   tn=. ":3 T. ''   NB. Thread number as char
   varnm=. ' '-.~'threadVar',tn
   smoutput 'Thread ',tn,' locking at ',":qts''
   11 T. y
   smoutput 'Thread ',tn,' locked at ',":qts''
   (varnm,' FLS')=: split FLS
   smoutput 'Thread ',tn,' unlocking at ',(":qts''),' for file ',flnm=.
>".varnm
   13 T. y
   smoutput 'Thread ',tn,' unlocked at ',":qts''
   #read_image flnm   NB. ¡Fails here!
end.
tm=. tm,~6!:1''
NB.EG mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. ''
MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX
)

Any help is appreciated!

Thanks,

Devon

On Tue, May 10, 2022 at 4:46 PM Henry Rich  wrote:

> If you can get me a version that fails on Windows I'll look at it.
>
> Henry Rich
>
> On 5/10/2022 4:20 PM, Devon McCormick wrote:
> > Hi,
> >
> > Has anyone had success using the multi-threading mutex primitives?  I've
> > had limited success - I'll be presenting some basic routines at NYCJUG
> this
> > evening (18:00 EDT -
> > https://www.meetup.com/J-Dynamic-Functional-Programming/) - but have
> been
> > unable to run multiple threads on a real-life process without crashing J.
> >
> > The following simplified demo seems to work OK but the version of this
> > where I do actual work crashes - with "Process shell<1> exited abnormally
> > with code 5" -  after two to thirty repetitions.
> >
> > MUTEX=: 10 T. 0NB. Fast mutex
> > createThreads=: 3 : '{{ 0 T.  }} ^:y]'
> > qts=: 6!:0
> > createThreads 5
> > GVAR=: 100?@$1e6NB. Initialize global threads
> will
> > consume
> >
> > multiLockMsgUnlock=: 3 : 0
> > while. 0<#GVAR do.
> > tn=. ":3 T. ''   NB. Thread number as char
> > varnm=: ' '-.~'threadVar',tn
> > smoutput 'Thread ',tn,' locking at ',":qts''
> > 11 T. y
> > smoutput 'Thread ',tn,' locked at ',":qts''
> > (varnm,' GVAR')=: split GVAR
> > smoutput 'Thread ',tn,' unlocking at ',(":qts''),' with
> > ',tn,'=',":".varnm
> > 13 T. y
> > smoutput 'Thread ',tn,' unlocked at ',(":qts''),';
> #GVAR=',":#GVAR
> >  end.
> > )
> > NB. Start five processes (one line):
> > multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
> > multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
> > multiLockMsgUnlock t. '' MUTEX
> >
> > The actual work I'm doing is on files, a list of whose names corresponds
> to
> > the GVAR vector above.
> >
> > Any suggestions are welcome.
> >
> > Cheers,
> >
> > Devon
> >
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Mutex with multi-threading primitive

2022-05-10 Thread Devon McCormick
Hi,

Has anyone had success using the multi-threading mutex primitives?  I've
had limited success - I'll be presenting some basic routines at NYCJUG this
evening (18:00 EDT -
https://www.meetup.com/J-Dynamic-Functional-Programming/) - but have been
unable to run multiple threads on a real-life process without crashing J.

The following simplified demo seems to work OK but the version of this
where I do actual work crashes - with "Process shell<1> exited abnormally
with code 5" -  after two to thirty repetitions.

   MUTEX=: 10 T. 0NB. Fast mutex
   createThreads=: 3 : '{{ 0 T.  }} ^:y]'
   qts=: 6!:0
   createThreads 5
   GVAR=: 100?@$1e6NB. Initialize global threads will
consume

multiLockMsgUnlock=: 3 : 0
   while. 0<#GVAR do.
   tn=. ":3 T. ''   NB. Thread number as char
   varnm=: ' '-.~'threadVar',tn
   smoutput 'Thread ',tn,' locking at ',":qts''
   11 T. y
   smoutput 'Thread ',tn,' locked at ',":qts''
   (varnm,' GVAR')=: split GVAR
   smoutput 'Thread ',tn,' unlocking at ',(":qts''),' with
',tn,'=',":".varnm
   13 T. y
   smoutput 'Thread ',tn,' unlocked at ',(":qts''),'; #GVAR=',":#GVAR
end.
)
NB. Start five processes (one line):
multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
multiLockMsgUnlock t. '' MUTEX

The actual work I'm doing is on files, a list of whose names corresponds to
the GVAR vector above.

Any suggestions are welcome.

Cheers,

Devon

-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Extended precision question

2022-04-21 Thread Devon McCormick
Hi Ed,
I was thinking of explaining Roger's sqrt code as part of next month's
NYCJUG.
You should take a look:
https://www.meetup.com/J-Dynamic-Functional-Programming/ .
Cheers,
Devon

On Fri, Apr 22, 2022 at 12:49 AM Ed Gottsman 
wrote:

> Thanks to everyone who responded and in particular for the link to Roger
> Hui’s essay.  The wiki discussion was also very good.
>
> (In an earlier life I disparaged “cargo cult” programming, in which you
> take a few lines of source you don’t understand and integrate them into
> your program.  [That you effectively do the same thing when you adopt
> someone else’s compiled library cut no ice with me.]  J has forced me to
> relax a bit in that regard and I will probably adopt some of Roger’s code
> without entirely understanding it. :-) )
>
> Thanks again.
>
> Ed
>
> Sent from my iPad
>
> > On Apr 21, 2022, at 8:18 PM, Gilles Kirouac  wrote:
> >
> > Ed If you expand the Extended Integers section (below by bob), you will
> see a link to an essay by Roger on 'Extended Precision Functions'. There is
> a Square Root verb.
> >
> >   NB. long rational result may exceed line length
> >   sqrt 1x + *:  9x
> >
> 1249987500062500625004687515624765624999453r125000
> >   sqrt  *:  9x
> > 9
> >
> >
> > ~ Gilles
> >
> >> Le 2022-04-21 à 14:50, 'robert therriault' via Programming a écrit :
> >> Gilles,
> >> In Nuvoc the extended constant notation can be found here
> https://code.jsoftware.com/wiki/Vocabulary/Constants#Extended_Integers
> >> Having said that, it is hidden pretty well and most of its references
> are previous documentation on the jsoftware site. There is certainly work
> to be done on the wiki!
> >> Cheers, bob
> >>>> On Apr 21, 2022, at 11:44, Gilles Kirouac  wrote:
> >>>
> >>> Ed
> >>>
> >>> You seem unaware of the extended precision constant notation:
> >>>
> >>> "digits with a trailing x denote an extended precision integer"
> >>>
> >>> https://www.jsoftware.com/help/dictionary/dcons.htm
> >>> [Where is the equivalent in NuVoc?]
> >>>
> >>> I would rather write
> >>>
> >>>   1x + *:  9x
> >>> 82
> >>>
> >>> ~ Gilles
> >>>
> >>> Le 2022-04-21 à 12:51, Henry Rich a écrit :
> >>>>3!:0 %: x: 1 + x: *: x: 9
> >>>> 8
> >>>> The square root cannot be represented exactly.
> >>>> Henry Rich
> >>>> On 4/21/2022 12:43 PM, Ed Gottsman wrote:
> >>>>> Hello.
> >>>>> I’m working on the Project Euler “Diophantine equation” problem
> (#66) and using J’s extended precision facilities.  I’ve run into behavior
> that confuses me.  Boiled down (and overusing x: just to be sure):
> >>>>> x: %: x: 1 + x: *: x: 9
> >>>>> 9
> >>>>> That is (if my syntax is right), the square root of (one plus the
> square of a really large n) is n.  I’m apparently misunderstanding
> something about extended precision.  I’ve tried it with a variety of uses
> of x: but to no avail, and as I read the x: documentation…this is an odd
> result.
> >>>>>
> >>>>> Any help would be much appreciated.
> >>>>> (J901 on iPadOS, for which sincere kudos to Ian Clark.)
> >>>>> Many thanks.
> >>>>> Ed
> >>>>>
> ------
> >>>>> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Extended precision question

2022-04-21 Thread Devon McCormick
Showing the result in decimal:
   23j13": sqrt 1x + *:  9x
9.05000


On Thu, Apr 21, 2022 at 3:18 PM Gilles Kirouac  wrote:

> Ed If you expand the Extended Integers section (below by bob), you will
> see a link to an essay by Roger on 'Extended Precision Functions'. There
> is a Square Root verb.
>
> NB. long rational result may exceed line length
> sqrt 1x + *:  9x
>
> 1249987500062500625004687515624765624999453r125000
> sqrt  *:  9x
> 9
>
>
> ~ Gilles
>
> Le 2022-04-21 à 14:50, 'robert therriault' via Programming a écrit :
> > Gilles,
> >
> > In Nuvoc the extended constant notation can be found here
> https://code.jsoftware.com/wiki/Vocabulary/Constants#Extended_Integers
> >
> > Having said that, it is hidden pretty well and most of its references
> are previous documentation on the jsoftware site. There is certainly work
> to be done on the wiki!
> >
> > Cheers, bob
> >
> >> On Apr 21, 2022, at 11:44, Gilles Kirouac  wrote:
> >>
> >> Ed
> >>
> >> You seem unaware of the extended precision constant notation:
> >>
> >> "digits with a trailing x denote an extended precision integer"
> >>
> >> https://www.jsoftware.com/help/dictionary/dcons.htm
> >> [Where is the equivalent in NuVoc?]
> >>
> >> I would rather write
> >>
> >>1x + *:  9x
> >> 82
> >>
> >> ~ Gilles
> >>
> >> Le 2022-04-21 à 12:51, Henry Rich a écrit :
> >>> 3!:0 %: x: 1 + x: *: x: 9
> >>> 8
> >>> The square root cannot be represented exactly.
> >>> Henry Rich
> >>> On 4/21/2022 12:43 PM, Ed Gottsman wrote:
> >>>> Hello.
> >>>> I’m working on the Project Euler “Diophantine equation” problem (#66)
> and using J’s extended precision facilities.  I’ve run into behavior that
> confuses me.  Boiled down (and overusing x: just to be sure):
> >>>>  x: %: x: 1 + x: *: x: 9
> >>>> 9
> >>>> That is (if my syntax is right), the square root of (one plus the
> square of a really large n) is n.  I’m apparently misunderstanding
> something about extended precision.  I’ve tried it with a variety of uses
> of x: but to no avail, and as I read the x: documentation…this is an odd
> result.
> >>>>
> >>>> Any help would be much appreciated.
> >>>> (J901 on iPadOS, for which sincere kudos to Ian Clark.)
> >>>> Many thanks.
> >>>> Ed
> >>>> --
> >>>> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Users of 13!:19 (dbcut), please speak up

2022-04-06 Thread Devon McCormick
Just did this:

foo0=: 3 : 0
   y=. >:y
   foo1 y
)

foo1=: 3 : 0
   y=. y,XX
   y=. y*10
)

   4!:55 <'XX'
1
   foo0 10
|value error: XX
|   y=.y*10
|foo1[1]
  y   NB. Currently undefined because XX is undefined
11 , XX
  13!:19''
|stop: foo0
|   foo1 y
|foo0[1]
  y  NB. Value at this level as expected
11
  XX=: 99NB. Define variable to avoid value error
  13!:4''NB. Resume execution in "foo0"
110 990

This works the same as I've seen it in the past.

On Wed, Apr 6, 2022 at 7:44 PM Henry Rich  wrote:

> Quite right, but I don't want to go there yet.  I want to see if I'm
> misunderstanding 13!:19.
>
> Henry Rich
>
> On 4/6/2022 7:41 PM, Elijah Stone wrote:
> >> Suppose you want to look around in the caller's frame.  You try
> >> 13!:19'', but it restarts immediately, calls problem again, and fails.
> >
> > That seems like a valid use case.  More generally, it seems like it
> > would be useful to poke around in _any_ stack frame, without
> > destroying the ones beneath (or on top of, depending on which way your
> > stacks grow) it.  But that leads to forking stacks and continuations.
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Users of 13!:19 (dbcut), please speak up

2022-04-06 Thread Devon McCormick
I use 13!:19 often and have not seen the behavior you described.

On Wed, Apr 6, 2022 at 7:33 PM Elijah Stone  wrote:

> Haven't used the debugger extensively and haven't used dbcut.  That said:
>
> 1. If you change some global state first, perhaps the code will start
> working
>
> 2. The dictionary says (emphasis mine):
>
> > Cut back one stack level, _stopping_ at the line at the next stack level
>
>   -E
>
> On Wed, 6 Apr 2022, Henry Rich wrote:
>
> > dbcut (13!:19) seems to go up one stack level and immediately reexecute
> > the line that failed.  Huh?
> >
> > Unless you have a stop on that line, you will rerun it and it will fail
> > again.  If you do have a stop on the line, the reexecution is nugatory.
> >
> > Can anyone suggest a reason why 'cut back' should not just cut the stack
> > back and remain in suspension?
> >
> > [It is possible that I have read the code wrong.]
> >
> > Henry Rich
> >
> >
> >
> >
> > --
> > This email has been checked for viruses by AVG.
> > https://www.avg.com
> >
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] NuVoc page for debug

2022-04-03 Thread Devon McCormick
I use command-line debugging a lot and find it very useful.  I will take a
look at the page.

On Sat, Apr 2, 2022 at 11:55 PM Henry Rich  wrote:

> That's pretty good.  It needs to be referred to from the NuVoc ancillary
> pages.
>
> It seems to be about the graphical debugger.  Some users, as I
> understand, use debug commands from the keyboard.  Some documentation
> for them would be wolcome.
>
> Henry Rich
>
> On 4/2/2022 10:24 PM, Raul Miller wrote:
> > What about https://code.jsoftware.com/wiki/Debug?
> >
> > Thanks,
> >
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Verb concatenation

2022-04-02 Thread Devon McCormick
Hi,
I have a group of monadic verbs for which I want the concatenated result,
e.g.
  foo0=: 3 : '0'
   foo1=: 3 : '1'
   foo2=: 3 : '2'
   foo3=: 3 : '3'
   allfoo=: foo0,foo1,foo2,foo3
   allfoo ''
0 1 2 3

So *allfoo* does what I want.  However, my actual set of verbs is longer
than this so I broke the assignment of *allfoo* into two pieces for
readability:
   allfoo=: foo0,foo1
   allfoo=: allfoo,foo2,foo3
   allfoo
allfoo , foo2 , foo3
   allfoo ''
|stack error: foo3
|allfoo[0]

I have inadvertently introduced infinite recursion.  Clearly I'm missing
something thinking I can concatenate verbs like I can concatenate nouns.

This gives me a result that performs as expected but looks bad:
   allfoo=: foo0,foo1
   allfoo=: (allfoo f.),foo2,foo3
   allfoo''
0 1 2 3
   allfoo
(3 : (,'0') , 3 : (,'1')) , foo2 , foo3

Any suggestions on how to break the assignment into multiple lines?

Thanks,

Devon



-- 

Devon McCormick, CFA

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


Re: [Jprogramming] plot: units ratio

2022-03-22 Thread Devon McCormick
I think you will find very similar behavior in other plotting packages like
Excel and R.  Scaling by the points plotted is the easy, simple thing to do.
Maybe I could partially implement my own wish for a fixed-frame that could
be applied to separate plots by plotting a fixed set of white points in a
square?

On Tue, Mar 22, 2022 at 12:10 PM Raul Miller  wrote:

> On Tue, Mar 22, 2022 at 5:50 AM Martin Kreuzer 
> wrote:
> > Thanks ... And I did some tests this morning:
> >
> > Plotted the *bisector (3rd, 1st quadrant) and *sin using
> >
> > pd 'xrange _1 1'
> > pd 'yrange _1.1 1.1'
> > and
> > pd 'aspect xx'   with these values:  xx= 0.866 | 1.0 | 1.155
> >
> > Results:
> >
> > aspect: 0.866 | 1.0  | 1.155'xrange
> _1 1'
> > -
> > vertical/horizontal unit length:0.81  | 0.92 | 1.05
> > height/width of grid frame: 0.87  | 1.0  | 1.15
> >
> > 'aspect 1.0' does not produce an angle of 45 deg of tangent versus
> > horizontal at the root as expected.
>
> Why would you expect this?
>
> My understanding is that aspect ratio was designed to compensate for
> pixels which were not square. If you are working on a machine with
> square pixels, the default aspect ratio (1) should be sufficient.
>
> In the general case (for example, xrange 0 1, yrange 0 1e6) plotting 0
> 0j1 1j1 1j0 0 is not going to give you something that looks like a
> square.
>
> > Try it with a different xrange and have a look how distorted it becomes:
> >
> > aspect: 0.866 | 1.0  | 1.155'xrange
> _2 2'
> > -
> > vertical/horizontal unit length:1.57  | 1.83 | 2.13
> > height/width of grid frame: 0.87  | 1.0  | 1.15
> >
> > This clearly shows (at least to me) that the aspect value is
> > definitely governing the rectangular grid frame, and somehow (on the
> > way) influencing the units ratio.
>
> That makes sense. But I am not sure that I agree with your implication
> that we should view this as a problem.
>
> > I think that's a bug (as it should at least be the other way around).
> > Therefore I still plead for a separate pf option of e.g. 'compression
> > ratio' or 'units ratio' if possible.
>
> I am not sure if it's possible to implement such a thing -- it seems
> like the resulting system would be overdetermined. But I am also not
> clear on the purpose you had in mind for this mechanism. I think it
> has something to do with the shape over the drawing window?
>
> Thanks,
>
> --
> Raul
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] plot: units ratio

2022-03-21 Thread Devon McCormick
I think a lot of plot programs take the dimensions of the plot from the
values being plotted.  I've sometimes wished for some kind of "frame"
option to allow us to force the dimensions to avoid this variability.  It's
especially annoying when you compare separate plots of similar but
different things like different currencies.  Some currencies move within
much tighter bands than others for various reasons (like being tied to the
US dollar) but the different frame sizes make this non-obvious visually
until you pay close attention to the values on the Y axis and see that the
variability of one currency completely swamps that of another.

On Mon, Mar 21, 2022 at 5:48 PM Elijah Stone  wrote:

> (A side note: does anyone know why when I post REPL session
> transcriptions, they become misaligned?)
>
> On Mon, 21 Mar 2022, Elijah Stone wrote:
>
> > On Mon, 21 Mar 2022, Martin Kreuzer wrote:
> >
> >> [I'm writing under the influence of a (so long) mild attack of big C,
> so
> >> beg your pardon if reads a bit incoherently in places.]
> >
> > Sad to hear that.  Hope you get better soon.
> >
> >
> >> When plotting a unit circle (using pd commands and options) I got
> >> disappointed again as it looked like a ballon from last weeks birthday
> >> party.
> >
> > When I run the following:
> >
> > plot r.2p1 * 128 %~ i.128
> >
> > I get something that looks stretched out and disappointing.  But the
> > aspect ratio follows the window size.  If, instead, I run this:
> >
> > 'aspect 1' plot r.2p1 * 128 %~ i.129
> >
> > The aspect ratio remains fixed regardless of the window size, and I get
> > something that looks like a circle.
> >
> > On to the issue of the hexagon:
> >
> >pd'reset'
> >pd'aspect 1'
> >pd r.2p1*6%~i.7
> >pd'show'
> >
> > If I do this, I get a slightly distorted hexagon.  However, if I
> inscribe
> > it in a circle, it looks correct:
> >
> >pd r.2p1*128%~i.129
> >pd'show'
> >
> > So I think it is a bug in plot.  The aspect ratio is being computed
> > relative to the max/min bounds of the function being plotted, not in
> > absolute terms.
> >
> > So where does 0.866 come from?  We can find the max/min bounds of the
> > points in our hexagon, and thereby find the (incorrect) aspect ratio
> used
> > by plot:
> >
> >+. p=. r.2p1*6%~i.6
> >1   0
> >  0.50.866025
> > _0.50.866025
> >   _1 1.22465e_16
> > _0.5   _0.866025
> >  0.5   _0.866025
> >(>./ - <./)+.p
> > 2 1.73205
> >%/(>./ - <./)+.p
> > 1.1547
> >
> > plot is using ~1.1547 as its aspect ratio, so we need the reciprocal,
> > which is ~0.866.  0.866 is also visible in p, as it really comes from
> > 1 o. o. %3.  And yes, it really is -:%:3.
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] plot: units ratio

2022-03-21 Thread Devon McCormick
I did some experiments with drawing hexagons and decided a ratio of 0.9
worked best: https://code.jsoftware.com/wiki/NYCJUG/HexagonAspects .

On Mon, Mar 21, 2022 at 10:48 AM Raul Miller  wrote:

> On Mon, Mar 21, 2022 at 7:18 AM Martin Kreuzer 
> wrote:
> > The option 'aspect' which was suggested as a remedy (using a value of
> > 0.866, which -for reasons unknown to me- is suspiciously close to
> > -:%:3) has probably more to do with the aspect of the plotted grid
> > (and if so, in a weird way, at least one I do not fully understand).
>
>1 2 o./ 2p1 * 0 1 2 % 6
> 0 0.866025 0.866025
> 1  0.5 _0.5
>
> Or, another approach: https://en.wikipedia.org/wiki/Eisenstein_integer
>
> Basically, if you are working with hexagons aligned on a square grid,
> you are working with multiples of the square root of 0.75 along one
> axis and multiples of 1 along the other axis.
>
> Anyways, personally, I think using an aspect of 1 and putting that
> %:0.75 ratio into the data would be the right approach. My reading of
> https://code.jsoftware.com/wiki/Plot/Options (and
> https://code.jsoftware.com/wiki/Plot/Function) suggests to me that
> using an aspect of %:0.75 should mean that the y axis is slightly
> shorter than the x axis. This would let me use 1 in the y direction to
> visually represent a %:0.75 distance in the y direction, which would
> work, but is a bit confusing to talk about.  Still,
>
>'aspect 0.866' plot 1 0.5j1 _0.5j1 _1 _0.5j_1 0.5j_1 1
>
> does give me something that looks like
>
>plot j./2 1 o./2p1*(i.7)%6
>
> I hope this helps,
>
> --
> Raul
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Dictionaries WAS: Report on the J wiki meeting of January 27, 2022

2022-03-08 Thread Devon McCormick
The APL system I work on has implemented dictionaries using enclosed arrays
and user-defined functions for accessing them.
There's no reason we couldn't do this in J.

On Tue, Mar 8, 2022 at 5:50 AM Elijah Stone  wrote:

> On Mon, 31 Jan 2022, Elijah Stone wrote:
>
> > keys should not be ordered
>
> Agh!  I missed the obvious complication.  I still do not think ordered
> keys are a good idea, but this does not work with tolerant comparison.
>
>   -E
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Jd error: Unrecognized aggregate function

2022-02-10 Thread Devon McCormick
pare has not been previously run.
> This
> > > > > > behavior is undocumented, except by example in the tutorials.
> Also, I
> > > > > > need to run the tutorial in a different J session from my testing
> > > work
> > > > > > to prevent the tutorials from breaking my tests.)
> > > > > >
> > > > > > Anyways, I'm currently getting an Unrecognized aggregate function
> > > > > > error, when trying to use the 'max' aggregate function. This
> should
> > > > > > demonstrate where I'm at:
> > > > > >
> > > > > > require'jd pacman'
> > > > > > load JDP,'tools/csv_load.ijs'
> > > > > > F=: jpath '~temp/rosettacode/example/CSV'
> > > > > > jdcreatefolder_jd_ CSVFOLDER=: F
> > > > > >
> > > > > > assert 0<{{)n
> > > > > > PATIENTID,LASTNAME
> > > > > > 1001,Hopper
> > > > > > 4004,Wirth
> > > > > > 3003,Kemeny
> > > > > > 2002,Gosling
> > > > > > 5005,Kurtz
> > > > > > }} fwrite F,'patients.csv'
> > > > > >
> > > > > > assert 0<{{)n
> > > > > > PATIENTID,VISIT_DATE,SCORE
> > > > > > 2002,2020-09-10,6.8
> > > > > > 1001,2020-09-17,5.5
> > > > > > 4004,2020-09-24,8.4
> > > > > > 2002,2020-10-08,
> > > > > > 1001,,6.6
> > > > > > 3003,2020-11-12,
> > > > > > 4004,2020-11-05,7.0
> > > > > > 1001,2020-11-19,5.3
> > > > > > }} fwrite F,'visits.csv'
> > > > > >
> > > > > > csvprepare 'patients';F,'patients.csv'
> > > > > > csvprepare 'visits';F,'visits.csv'
> > > > > >
> > > > > > csvload 'patients';1
> > > > > > csvload 'visits';1
> > > > > >
> > > > > > jd'ref patients PATIENTID  visits PATIENTID'
> > > > > >
> > > > > > echo jd ([echo) deb {{)n
> > > > > >   reads
> > > > > >  p.PATIENTID,
> > > > > >  LASTNAME:p.LASTNAME,
> > > > > >  first v.VISIT_DATE
> > > > > > by
> > > > > >  p.PATIENTID
> > > > > > from
> > > > > >   p:patients,
> > > > > >   v:p.visits
> > > > > > }} -.LF
> > > > > >
> > > > > > Now, ... one of my thoughts was that maybe this is a type error,
> > > > > > indicating that 'max' does not have a definition for the type of
> data
> > > > > > in this column. However, replacing 'max' with 'first' (which
> should
> > > be
> > > > > > defined for any type of column) also gives an "Unrecognized
> aggregate
> > > > > > function' error.
> > > > > >
> > > > > > So...
> > > > > >
> > > > > > (1) What am I doing wrong here, and
> > > > > >
> > > > > > (2) What should I have looked at to discover this information?
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > --
> > > > > > Raul
> > > > >
> --
> > > > > 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
>


-- 

Devon McCormick, CFA

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


[Jprogramming] Center option for legend no longer works?

2022-02-07 Thread Devon McCormick
Hi,
I was trying to plot something with the legend centered but this no longer
seems to work.  Other options do, so
   'key "Series 1" "Series 2";keypos *rti*' plot \:~"1 ] 2 100?@$1000
puts the legend on the right, top, and inside as it's supposed to, but
   'key "Series 1" "Series 2";keypos *cti*' plot \:~"1 ] 2 100?@$1000
is supposed to center the legend but it gives the same result as
   'key "Series 1" "Series 2";keypos *lti*' plot \:~"1 ] 2 100?@$1000
with the legend on the left in both cases.

Does anyone know about this change or is it a bug?

Thanks,

Devon
-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Report on the J wiki meeting of January 27, 2022

2022-02-01 Thread Devon McCormick
You might search for "Beginner's Regatta" on the J wiki to see if the
beginner-oriented sections of our NYCJUG meetings are helpful.

On Mon, Jan 31, 2022 at 7:44 PM Raul Miller  wrote:

> I would not worry too much about "the J way of thinking" -- J is a
> tools, but it's not the only tool.
>
> Setting aside a bit of time -- maybe half an hour a day, several days
> a week -- is good for picking up the skills involved with using a
> tool. In the context of J that would be time spent working through
> some of the J labs, and maybe tackling some small interesting and/or
> fun seeming projects.
>
> But once you understand the concepts, they'll seem simple and
> ordinary. So it's not worth waiting for some "magic moment".
>
> Instead, focus on your interests, see if you can make J useful there,
> and talk about your issues if that seems fruitful.
>
> Good luck,
>
> --
> Raul
>
> On Mon, Jan 31, 2022 at 4:22 PM Steven Harris 
> wrote:
> >
> > Well Brian that is my motivation for J too, but so far I have not been
> able
> > to make any significant progress into the J way of thinking.
> >
> > I'm nearly on the point of admission defeat here.
> >
> > Cheers
> >
> > Steven.
> >
> > On Tue, 1 Feb 2022 at 06:52, Brian Schott 
> wrote:
> >
> > > One of the main reasons I have continued to use J has been because of
> all
> > > the powerful primitives and because of the mental challenge of using
> the
> > > primitives effectively. For me I imagine J is almost like a video game
> for
> > > the younger generation: it is a challenge with great rewards and
> unmatched
> > > community support.
> > >
> > > So I wonder if this is a  suitably distinct  feature set or if others
> > > believe they get a similar result and satisfaction from other
> programming
> > > languages?
> > > --
> > > (B=) <-my sig
> > > Brian Schott
> > > --
> > > 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] prime testing on large numbers

2022-01-25 Thread Devon McCormick
I really like what I can do with extended arithmetic in J, continued
fractions and such.  I'd like to help, if I can.

I attempted to extend a Fibonacci verb using the "power of phi" method (
https://code.jsoftware.com/wiki/Essays/Fibonacci_Sequence#Power_of_phi),
which is so simple compared to many of them, but suffers from its
dependence on phi.  So, we could rewrite it to use a pre-calculated
extended phi - maybe using this
https://code.jsoftware.com/wiki/Wiki/Report_of_Meeting_2022-01-13 - by
replacing the in-line limited precision version of it in the code.
However, when I tried to do this, the verb quickly ran out of gas.  I don't
know how long some of the tasks took because I had to cancel them because
they were so slow compared to other versions of the algorithm.

Anyway, I have at least one idea for a benchmark.  Anything I can do to
help would be fine as it seems like a worthwhile project.




On Tue, Jan 25, 2022 at 8:38 PM Julian Fondren 
wrote:

> I'll get it done.
>
> ‐‐‐ Original Message ‐‐‐
>
> On Tuesday, January 25th, 2022 at 7:23 PM, Henry Rich <
> henryhr...@gmail.com> wrote:
>
> > Please, somebody, step up to replacing J's antiquated
> >
> > extended-arithmetic support with GMP.
> >
> > Henry Rich
> >
> > On 1/25/2022 8:21 PM, Marshall Lochbaum wrote:
> >
> > > All of these solutions except F# and Raku end up calling GMP for this
> > >
> > > (which uses Miller-Rabin; so does J). I think F# uses the following
> .NET
> > >
> > > library, while Raku appears to eventually call an npm package
> > >
> > > jsbi-is-prime?
> > >
> > >
> https://github.com/Open-NET-Libraries/Open.Numeric.Primes/blob/master/source/MillerRabin.cs
> > >
> > > Even so, it's not particularly fast: I timed the Julia version at 15s
> to
> > >
> > > solve the base task. Clearly the limits are chosen to be moderately
> > >
> > > taxing for the fastest libraries out there; anything without years of
> > >
> > > optimization effort is left behind.
> > >
> > > Adding x: to your version runs out of memory for some reason, but it
> > >
> > > looks like the following would probably finish in half an hour or so.
> > >
> > > {{1+I. 1 p:y#.x:|.+./\.=i.1000}}&.> 2+i.15
> > >
> > > Marshall
> > >
> > > On Tue, Jan 25, 2022 at 05:52:40AM -0500, Raul Miller wrote:
> > >
> > > > http://www.rosettacode.org/wiki/Repunit_primes
> > > >
> > > > Conceptually, this task might be tackled using an expression like
> > > >
> > > > ":@I. 1 p:(2+i.15) #."0 1/|.+./\\.=i.1000
> > > >
> > > >
> > > > However, some of the numbers being tested for primality here are
> > > >
> > > > rather large. Even the base 2 numbers reach 300 digits, and the base
> > > >
> > > > 16 numbers reach 1200 digits:
> > > >
> > > > #":2x#.1000#1
> > > >
> > > >
> > > > 302
> > > >
> > > > #":16x#.1000#1
> > > >
> > > > 1203
> > > >
> > > > So... how would we approach this in J?
> > > >
> > > > Thanks,
> > > >
> > > > --
> > > >
> > > > Raul
> > > > 
> > > >
> > > > For information about J forums see
> http://www.jsoftware.com/forums.htm
> > >
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > --
> >
> > This email has been checked for viruses by AVG.
> >
> > https://www.avg.com
> >
> > -
> >
> > For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] Rank of an arbitrary matrix

2022-01-13 Thread Devon McCormick
#$m

On Thu, Jan 13, 2022 at 2:51 PM Pawel Jakubas 
wrote:

> Dear J enthusiasts,
>
> I am wondering what is the preferable way to determine the rank of a matrix
> in J.
> I would expect here below
>
>]m=: 3 3 $ 1 2 3 5 4 6 9 7 8
> 1 2 3
> 5 4 6
> 9 7 8
>   rank m
> 3
>
>]m=: 3 3 $ 1 2 3 2 4 6 9 7 8
> 1 2 3
> 2 4 6
> 9 7 8
>   rank m
> 2
>
> Thanks and cheers
> Pawel Jakubas
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] How to add standard deviation to multiple timings?

2022-01-11 Thread Devon McCormick
Thanks for the tip - it's a cleaner way to accomplish what I want.

I'm not sure about your standard deviation supposition or maybe I don't
understand what you're saying.
I think you can get arbitrarily large standard deviations by supplying
arguments with large standard deviations, e.g.

   usus #&>vv=. (>:1000?1e4)?@$&.>0  NB.* usus: usual stats: min, max,
mean, SD
90 9991 5089.42 2783.04
   tms0=. (100$1) 6!:2 '+/&>vv'
   usus tms0
0.0016856 0.0034295 0.00185034 0.000233769
   usus #&>vv=. (>:1000?1e6)?@$&.>0  NB. This input has similar mean%SD as
previous
2694 998076 507344 288719
   tms1=. (100$1) 6!:2 '+/&>vv'
   usus tms1
0.172931 0.21973 0.177071 0.0052448  NB. But mean%SD differs a lot between
the two sets of timings
   %/_2{.usus tms0NB. mean/SD
7.91526
   %/_2{.usus tms1
33.7613


On Tue, Jan 11, 2022 at 2:56 PM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:

> Your approach seems good.  You can also do:
>
>  (i.10) timex '+/i.1'
>
> Regarding the domain of timing code,
>
> I'd be surprised, and so curious, if the standard deviation wasn't a
> "fixed percentage" of average time, with a bias for quickest functions
> having the highest standard dev as a percentage.  And also the timing on
> first iteration may be likely to be higher than remaining iterations.
> Situations that deviate from these rules, might be a sign of something
> "wrong".
>
>
>
>
>
>
> On Tuesday, January 11, 2022, 02:20:24 p.m. EST, Devon McCormick <
> devon...@gmail.com> wrote:
>
>
>
>
>
> Hi,
>
> I sometimes time expressions with a left argument of something like 10 or
> 100, e.g. "(100) 6!:2 'singlePair testSP0'".  This gives me an average time
> for the multiple iterations.  It would be nice to be able to get the
> standard deviation of the multiple invocations as well.
>
> I can do this myself with something like
>   tms=. 6!:2 &>100$<'singlePair testSP0'
> then doing statistics on "tms" but I'm wondering if there's a way to do
> this more simply.
>   tms=. 6!:2 &>100$<'singlePair testSP0'
>   (mean,stddev) tms
> 0.260937 0.00313815
>
> Thanks,
>
> Devon
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> ------
> For information about J forums see http://www.jsoftware.com/forums.htm
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] How to add standard deviation to multiple timings?

2022-01-11 Thread Devon McCormick
Hi,

I sometimes time expressions with a left argument of something like 10 or
100, e.g. "(100) 6!:2 'singlePair testSP0'".  This gives me an average time
for the multiple iterations.  It would be nice to be able to get the
standard deviation of the multiple invocations as well.

I can do this myself with something like
   tms=. 6!:2 &>100$<'singlePair testSP0'
then doing statistics on "tms" but I'm wondering if there's a way to do
this more simply.
   tms=. 6!:2 &>100$<'singlePair testSP0'
   (mean,stddev) tms
0.260937 0.00313815

Thanks,

Devon
-- 

Devon McCormick, CFA

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


Re: [Jprogramming] NYCJUG: Counting pairs in a 3 card poker hand

2022-01-10 Thread Devon McCormick
I finally got around to working on this again.   This problem features
prominently in today's NYCJUG (spoiler alert):
https://code.jsoftware.com/wiki/NYCJUG/2022-01-11 .

On Fri, Oct 15, 2021 at 11:48 AM Skip Cave  wrote:

> Brute Force probability of a pair in 5 cards:
>
> (+/%#)4=;#&.>~.&.>{(5 comb 52){4#1 to 13
>
> 0.422569
>
>
> Skip Cave
> Cave Consulting LLC
>
>
> On Fri, Oct 15, 2021 at 9:43 AM Devon McCormick 
> wrote:
>
> > I have not had a chance to look over Thomas's calculations in detail.  To
> > check them, I would extend the logic to some other similar problems to
> see
> > how they do.  Come to think of it, I believe I have calculated the chance
> > of a pair in five cards and that's something you could look up as well.
> >
> > The brute force calculations are a good sanity check but fall down for
> > larger problems.  As I said in the meeting, I tend to trust my
> simulations
> > more than my calculations.
> >
> > On Fri, Oct 15, 2021 at 4:52 AM Skip Cave 
> wrote:
> >
> > > Brute Force probability of a pair in a flop:
> > >
> > > (+/%#)2=;#&.>~.&.>{(3 comb 52){4#1 to 13
> > >
> > > 0.169412
> > >
> > > Skip Cave
> > > Cave Consulting LLC
> > >
> > >
> > > On Thu, Oct 14, 2021 at 12:10 AM Thomas McGuire 
> > > wrote:
> > >
> > > > Devon presented more of his Poker simulations now using Jd (the J
> > > > database) at the most recent NYCJUG meeting (
> > > > https://code.jsoftware.com/wiki/NYCJUG/2021-10-12 <
> > > > https://code.jsoftware.com/wiki/NYCJUG/2021-10-12>)
> > > >
> > > > He came up with an interesting problem of calculating the expected
> > number
> > > > of pairs in the initial flop in a game of Omaha.
> > > >
> > > > 3 cards dealt into the flop. Consider those with only pairs in them,
> > > there
> > > > would be 3 ways that the pairs could be dealt out.
> > > >
> > > > X X Y, X Y X, Y X X
> > > >
> > > > Taking the first configuration the number of different hands you
> could
> > > > make would be:
> > > >
> > > >*/52 3 48  NB. this matches part of Devon’s calculation
> > > > 7488
> > > >
> > > > NB. anyone of 52 cards can be dealt, once the card is dealt then
> only 1
> > > of
> > > > 3 can be dealt to make the pair
> > > > NB. then we have to exclude the remaining 2 cards that match and
> > > therefore
> > > > the third card will be anyone of 48
> > > >
> > > > NB. since there are 3 configurations the cards can be dealt in, the
> > other
> > > > 2 would be calculated:
> > > >   */52 48 3
> > > > 7488
> > > >   */48 52 3
> > > > 7488
> > > >
> > > > NB. this makes
> > > >3*7488.NB. Different 3 card hands with only pairs in them
> > > > 22464
> > > >
> > > > To calculate the percentage of the total number of hands Devon made
> the
> > > > calculation using only one of the pairs hand configurations. Then
> used
> > > 3!52
> > > > for combinations of 52 things taken 3 at a time.
> > > >
> > > > This was off by a factor of 2 from his simulation, where he
> enumerated
> > > all
> > > > the possibilities.
> > > >
> > > > I finally realized (it took me 2 days of intermittent thought) that
> the
> > > > order in which the cards are dealt matter. Not so much in the scoring
> > of
> > > a
> > > > hand but it does matter for the number of ways the same hand can be
> > dealt
> > > > out.
> > > >
> > > > NB. So the total number of 3 card hands from 52 cards is:
> > > > */52 51 50
> > > > 132600
> > > >
> > > > NB. which is permutations of 52 things taken 3 at a time
> > > > NB. which like the Combinations function in J has a representation
> > called
> > > > the Stope function:
> > > > 52 ^!._1 (3)
> > > > 132600
> > > >
> > > > NB. Devon’s original calculation was:
> > > >(*/52 3 48)%3!52
> > > > 0.338824
> > > >
> > > > NB. However based on the analysis above it should be:
> > > > 

Re: [Jprogramming] JHS - password gen app

2021-11-29 Thread Devon McCormick
Hi Eric,

I just tried this in both Edge and Chrome but get this error in both places:
HBS error:4 jhhn 3;'pswd app - no javascript' NB. header 2

I checked that Javascript is enabled for both browsers, so I don't think
that is the issue.  Please let me know what I should do to fix or debug
this.

Thanks,

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


Re: [Jprogramming] saving an image as jpg fails

2021-11-23 Thread Devon McCormick
I get the error "First display an isigraph Plot." when I run this from
jconsole but it works fine from a JQt session.  This is under J 9.03.07.

On Tue, Nov 23, 2021 at 12:44 PM Raul Miller  wrote:

> They are stored in jpath '~install'
>
> But, for example, this creates both image files, also:
>
> load'plot'
> pd 'reset'
> pd  p:i.10
> pd 'show'
> pd 'save png "/tmp/example.png"'
> pd 'save jpg "/tmp/example.jpg"'
>
> And, this also gives me both files:
>
> pd 'save png "',(jpath '~user'),'/example.png"'
> pd 'save jpg "',(jpath '~user'),'/example.jpg"'
>
> FYI,
>
> --
> Raul
>
> On Tue, Nov 23, 2021 at 11:52 AM R.E. Boss  wrote:
> >
> > If I copy your example, I have no clue where the files are stored,
> definitely not in my user directory.
> > If I let the name precede by the folder indication, then example.png
> works, but the .jpg not, while nothing happens.
> > (In the first attempts today, with beta-u, an empty .jpg file with the
> correct name was created.)
> > I am not succeeding in creating any file(name) with fwrite, but that is
> probably my inexperience.
> >
> >
> > R.E. Boss
> >
> >
> > -Original Message-
> > From: Programming  On Behalf
> Of Raul Miller
> > Sent: dinsdag 23 november 2021 17:04
> > To: Programming forum 
> > Subject: Re: [Jprogramming] saving an image as jpg fails
> >
> > It seems to work for me.
> >
> > I ran:
> >
> > load'plot'
> > pd 'reset'
> > pd  p:i.10
> > pd 'show'
> > pd 'save png "example.png"'
> > pd 'save jpg "example.jpg"'
> >
> > And this created an example.png and an example.jpg file in my j903
> directory.
> >
> >JVERSION
> > Engine: j903/j64avx2/darwin
> > Beta-v: commercial/2021-11-16T22:02:28
> > Library: 9.03.07
> > Qt IDE: 1.9.3/5.15.2(5.15.2)
> > Platform: Darwin 64
> > Installer: J903 install
> > InstallPath: /users/rauldmiller/applications/j903
> > Contact: www.jsoftware.com
> >
> > What happens for you? (Any error messages? Can you create a file with
> that name using fwrite?)
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Tue, Nov 23, 2021 at 10:49 AM R.E. Boss  wrote:
> > >
> > > Any reason why
> > >   pd 'save jpg "filename.jpg"'
> > > does not work anymore, whereas
> > >   pd 'save png "filename.png"'
> > > still works?
> > >
> > > Engine: j903/j64avx2/windows
> > > Beta-v: commercial/2021-11-16T21:47:12
> > > Library: 9.03.06
> > > Qt IDE: 1.9.2/5.12.10(5.12.10)
> > > Platform: Win 64
> > > Installer: J903 install
> > > InstallPath: c:/program files/j903
> > > Contact: www.jsoftware.com
> > >
> > >
> > > R.E. Boss
> > >
> > > --
> > > 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] JHS - password gen app

2021-11-12 Thread Devon McCormick
Thanks!  I will take a look.

On Fri, Nov 12, 2021 at 1:09 PM Eric Iverson 
wrote:

> Devon,
> Your recent interest in Andrew Nikitin's literate wiki page about a J602
> app caught my eye.
>
> It seemed an excellent challenge to make use of some new JHS changes I was
> working on.
>
> Start JHS and run:
>rundemo_jhs_ 16
>
> JHS makes use of pop ups so you will have to enable pop ups for localhost
> in your browser for this to work.
>
> Feedback welcome!
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] J Wiki Coordinator

2021-11-12 Thread Devon McCormick
t; > > an
> > > > updated wiki will be a real benefit to the whole community. If you
> are
> > > > interested in being part of this process let me know, either through
> the
> > > > general forum (gene...@jsoftware.com) or emailing me directly at
> > > > bobtherria...@mac.com. My plan over the next week is to gauge the
> > > > interest and start to organize the approach we will take. If you are
> > > > interested in being a part of that vision then please get in touch
> with
> > > me.
> > > > Wiki's are not a one person adventure. If planning the project is
> not for
> > > > you right now, get involved when you can. There will also be
> > > opportunities
> > > > down the road for curators who may be interested in a specific area
> of
> > > the
> > > > J wiki and, as always, contributions from the community are
> encouraged.
> > > We
> > > > will be providing weekly updates here on the programming forum to
> keep
> > > > everyone up to date.
> > > >
> > > > Stay tuned as we move forward together and please share any thoughts
> that
> > > > you have either by direct email to me or through the general forum
> for
> > > that
> > > > is the place where the wiki will be discussed.
> > > >
> > > > Cheers, bob
> > > >
> > > > > On Nov 10, 2021, at 11:38, Eric Iverson 
> > > > wrote:
> > > > >
> > > > > Bob Therriault has stepped up and volunteered to be the J Wiki
> > > > Coordinator.
> > > > >
> > > > > There is a lot that can be done to make the wiki more effective for
> > > both
> > > > > seasoned and new J programmers. More importantly it could be
> better at
> > > > > catching and keeping the interest of those who drop by for a peek.
> > > > >
> > > > > Bob has already made his mark on J with videos, Jig, stackoverflow,
> > > Array
> > > > > Cast podcast, and forum presence. Fantastic that there is more to
> come!
> > > > >
> > > > > This is a community effort, so we all need to chip in. But having
> an
> > > > active
> > > > > coordinator is a big plus.
> > > > >
> --
> > > > > 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] JQt terminal development environment

2021-11-03 Thread Devon McCormick
Working with the GUI under emacs is something I have long wanted to do and,
as Raul suggests, there is no reason we should not be able to.  Looking
back, I see some early work I did on this some time ago but which I have
not continued:
https://code.jsoftware.com/wiki/NYCJUG/2005-04-12#Part_1:_the_Event-Loop_Horizon
.

Please take a look and let me know what you think.


On Wed, Nov 3, 2021 at 11:46 AM Raul Miller  wrote:

> Conceptually, yes.
>
> After all, the entire system is packaged as binary libraries, and J
> provides simple facilities for calling into other libraries (and for
> being called from other libraries...).
>
> That said, you would be breaking new ground here, parts of it would
> not be easy, and likely you would encounter occasional on-going
> version drift issues. You might also need to dip into C and/or emacs
> lisp for some issues.
>
> Also, getting it working for yourself would be just the first step.
> Once you had it functioning well, there would be the realm of getting
> it to deploy efficiently for other people (assuming you wanted to go
> there).
>
> Good luck,
>
> --
> Raul
>
> On Wed, Nov 3, 2021 at 11:37 AM Samir  wrote:
> >
> > Excuse me for bringing a question in mind to this thread. I'm using
> emacs, is there anyway I can develop GUI app in emacs instead of Qt editor?
> Like can I use wd in script written and ran with emacs and j-mode?
> >
> >
> >
> >
> >
> >
> >   Original Message
> >
> >
> > From: devon...@gmail.com
> > Sent: November 3, 2021 5:17 PM
> > To: programm...@jsoftware.com
> > Reply-to: programm...@jsoftware.com
> > Subject: Re: [Jprogramming] JQt terminal development environment
> >
> >
> > Mike, yes, that was what I meant.  I did not think of that combo though I
> > did use Sharp for a number of years.
> > Thanks!
> >
> > On Wed, Nov 3, 2021 at 10:51 AM 'Mike Day' via Programming <
> > programm...@jsoftware.com> wrote:
> >
> > > Devon,  in your initial msg,  you mentioned
> > > “Anyway, for really simple things I do in emacs, like recalling the
> > > previous command...”
> > >
> > > You probably mean something else entirely,  but just in case it helps,
> > > the hot key combination ctrl-shift-up arrow goes back up previous
> commands;
> > > ctrl-shift-down moves back to the present.  Iirc, this feature was
> > > available in J from the very beginning,  inherited from Sharp APL, or
> the
> > > like,  I believe.
> > >
> > > Sorry if I’ve misunderstood the question!
> > >
> > > Mike
> > >
> > > Sent from my iPad
> > >
> > > > On 3 Nov 2021, at 12:02, joseph turco 
> wrote:
> > > >
> > > > I personally just use the console from terminal. The jQt is nice
> though.
> > > >
> > > >> On Mon, Nov 1, 2021, 10:35 AM Devon McCormick 
> > > wrote:
> > > >>
> > > >> Thanks, Bill.  It's
> > > >> wd 'set strength text ..'
> > > >> The ID has to come first but this solved almost all the problems I
> was
> > > >> having with this bit of code.
> > > >> I have something basically workable but with a number of flaws:
> > > >> https://code.jsoftware.com/wiki/NYCJUG/2021-11-09#Show-and-tell .
> > > >>
> > > >>>> On Sun, Oct 31, 2021 at 9:11 PM bill lam 
> wrote:
> > > >>>
> > > >>> The wiki page that you followed was written J602 wd commands. Jqt
> wd
> > > >>> commands adopted a similar but different syntax. J602 set command
> > > always
> > > >>> sets the 'text' property and is implied, but Jqt needs the explicit
> > > >> 'text'
> > > >>> because it can also set other properties, see wiki wd commands
> > > reference.
> > > >>> J602:
> > > >>>
> > > >>> wd 'set strength *entropy ',(":<.(".size)*2^.#alph),' bits'
> > > >>>
> > > >>> Jqt
> > > >>> wd 'set text strength *entropy ',(":<.(".size)*2^.#alph),' bits'
> > > >>>
> > > >>> (untested)
> > > >>>
> > > >>>
> > > >>>> On Mon, Nov 1, 2021 at 3:06 AM Devon McCormick <
> devon...@gmail.com>
> > > >>> wrote:
> > > >>>
> > > >>>> Hi,
> > > >>>>
> > > >>>> Does anyone use the JQt

Re: [Jprogramming] JQt terminal development environment

2021-11-03 Thread Devon McCormick
Mike, yes, that was what I meant.  I did not think of that combo though I
did use Sharp for a number of years.
Thanks!

On Wed, Nov 3, 2021 at 10:51 AM 'Mike Day' via Programming <
programm...@jsoftware.com> wrote:

> Devon,  in your initial msg,  you mentioned
> “Anyway, for really simple things I do in emacs, like recalling the
> previous command...”
>
> You probably mean something else entirely,  but just in case it helps,
> the hot key combination ctrl-shift-up arrow goes back up previous commands;
> ctrl-shift-down moves back to the present.  Iirc, this feature was
> available in J from the very beginning,  inherited from Sharp APL, or the
> like,  I believe.
>
> Sorry if I’ve misunderstood the question!
>
> Mike
>
> Sent from my iPad
>
> > On 3 Nov 2021, at 12:02, joseph turco  wrote:
> >
> > I personally just use the console from terminal. The jQt is nice though.
> >
> >> On Mon, Nov 1, 2021, 10:35 AM Devon McCormick 
> wrote:
> >>
> >> Thanks, Bill.  It's
> >> wd 'set strength text ..'
> >> The ID has to come first but this solved almost all the problems I was
> >> having with this bit of code.
> >> I have something basically workable but with a number of flaws:
> >> https://code.jsoftware.com/wiki/NYCJUG/2021-11-09#Show-and-tell .
> >>
> >>>> On Sun, Oct 31, 2021 at 9:11 PM bill lam  wrote:
> >>>
> >>> The wiki page that you followed was written J602 wd commands. Jqt wd
> >>> commands adopted a similar but different syntax. J602 set command
> always
> >>> sets the 'text' property and is implied, but Jqt needs the explicit
> >> 'text'
> >>> because it can also set other properties, see wiki wd commands
> reference.
> >>> J602:
> >>>
> >>> wd 'set strength *entropy ',(":<.(".size)*2^.#alph),' bits'
> >>>
> >>> Jqt
> >>> wd 'set text strength *entropy ',(":<.(".size)*2^.#alph),' bits'
> >>>
> >>> (untested)
> >>>
> >>>
> >>>> On Mon, Nov 1, 2021 at 3:06 AM Devon McCormick 
> >>> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> Does anyone use the JQt environment for J much?  I'm taking a stab at
> >>>> updating and extending the code here:
> >>>> https://code.jsoftware.com/wiki/User:Andrew_Nikitin/Literate .
> >>>>
> >>>> I want to see how suitable I find J for developing a GUI app.  Now
> that
> >>>> I've started, I'm starting to wonder if I should have started with a
> >>>> web-based front-end instead but I thought it might be easier to start
> >>> from
> >>>> something which presumably worked at some point.
> >>>>
> >>>> That aside, I'm finding it painful to use the JQt interface compared
> to
> >>> my
> >>>> normal custom of running J under emacs.  I feel I have to use JQt
> >> because
> >>>> of the GUI component.  I think I once got some GUI-based code working
> >>> under
> >>>> emacs but that was years ago and would be too much of a distraction
> >> from
> >>> my
> >>>> immediate project.
> >>>>
> >>>> You can see what I've done so far here:
> >>>> https://code.jsoftware.com/wiki/NYCJUG/2021-11-09#What_I_Have_So_Far
> .
> >>>> This just brings up the initial window; none of the buttons work
> except
> >>> the
> >>>> one to cancel the dialog.
> >>>>
> >>>> Anyway, for really simple things I do in emacs, like recalling the
> >>> previous
> >>>> command, it is not obvious how I would do this in JQt.  At the moment,
> >>> I'm
> >>>> working mostly in emacs and loading my code into JQt, so this may have
> >> to
> >>>> be how I deal with it but I'm interested in other people's experience
> >>>> working with JQt.
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Devon
> >>>>
> >>>> --
> >>>>
> >>>> Devon McCormick, CFA
> >>>>
> >>>> Quantitative Consultant
> >>>> --
> >>>> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>> --
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >>
> >> --
> >>
> >> Devon McCormick, CFA
> >>
> >> Quantitative Consultant
> >> --
> >> 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
>


-- 

Devon McCormick, CFA

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


Re: [Jprogramming] JQt terminal development environment

2021-11-01 Thread Devon McCormick
Thanks, Bill.  It's
wd 'set strength text ..'
The ID has to come first but this solved almost all the problems I was
having with this bit of code.
I have something basically workable but with a number of flaws:
https://code.jsoftware.com/wiki/NYCJUG/2021-11-09#Show-and-tell .

On Sun, Oct 31, 2021 at 9:11 PM bill lam  wrote:

> The wiki page that you followed was written J602 wd commands. Jqt wd
> commands adopted a similar but different syntax. J602 set command always
> sets the 'text' property and is implied, but Jqt needs the explicit 'text'
> because it can also set other properties, see wiki wd commands reference.
> J602:
>
> wd 'set strength *entropy ',(":<.(".size)*2^.#alph),' bits'
>
> Jqt
> wd 'set text strength *entropy ',(":<.(".size)*2^.#alph),' bits'
>
> (untested)
>
>
> On Mon, Nov 1, 2021 at 3:06 AM Devon McCormick  wrote:
>
> > Hi,
> >
> > Does anyone use the JQt environment for J much?  I'm taking a stab at
> > updating and extending the code here:
> > https://code.jsoftware.com/wiki/User:Andrew_Nikitin/Literate .
> >
> > I want to see how suitable I find J for developing a GUI app.  Now that
> > I've started, I'm starting to wonder if I should have started with a
> > web-based front-end instead but I thought it might be easier to start
> from
> > something which presumably worked at some point.
> >
> > That aside, I'm finding it painful to use the JQt interface compared to
> my
> > normal custom of running J under emacs.  I feel I have to use JQt because
> > of the GUI component.  I think I once got some GUI-based code working
> under
> > emacs but that was years ago and would be too much of a distraction from
> my
> > immediate project.
> >
> > You can see what I've done so far here:
> > https://code.jsoftware.com/wiki/NYCJUG/2021-11-09#What_I_Have_So_Far .
> > This just brings up the initial window; none of the buttons work except
> the
> > one to cancel the dialog.
> >
> > Anyway, for really simple things I do in emacs, like recalling the
> previous
> > command, it is not obvious how I would do this in JQt.  At the moment,
> I'm
> > working mostly in emacs and loading my code into JQt, so this may have to
> > be how I deal with it but I'm interested in other people's experience
> > working with JQt.
> >
> > Thanks,
> >
> > Devon
> >
> > --
> >
> > Devon McCormick, CFA
> >
> > Quantitative Consultant
> > --
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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


[Jprogramming] JQt terminal development environment

2021-10-31 Thread Devon McCormick
Hi,

Does anyone use the JQt environment for J much?  I'm taking a stab at
updating and extending the code here:
https://code.jsoftware.com/wiki/User:Andrew_Nikitin/Literate .

I want to see how suitable I find J for developing a GUI app.  Now that
I've started, I'm starting to wonder if I should have started with a
web-based front-end instead but I thought it might be easier to start from
something which presumably worked at some point.

That aside, I'm finding it painful to use the JQt interface compared to my
normal custom of running J under emacs.  I feel I have to use JQt because
of the GUI component.  I think I once got some GUI-based code working under
emacs but that was years ago and would be too much of a distraction from my
immediate project.

You can see what I've done so far here:
https://code.jsoftware.com/wiki/NYCJUG/2021-11-09#What_I_Have_So_Far .
This just brings up the initial window; none of the buttons work except the
one to cancel the dialog.

Anyway, for really simple things I do in emacs, like recalling the previous
command, it is not obvious how I would do this in JQt.  At the moment, I'm
working mostly in emacs and loading my code into JQt, so this may have to
be how I deal with it but I'm interested in other people's experience
working with JQt.

Thanks,

Devon

-- 

Devon McCormick, CFA

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


  1   2   3   4   5   6   7   8   9   >