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

Re: [Jprogramming] Applying a cyclic gerund

2023-02-26 Thread Gilles Kirouac

Ah! ah!

 (,: datatype each) ]`(".each)"0  list
┌───┬───┬───┬┬───┬┐
│foo│1  │bar│2.17│baz│3.14│
├───┼───┼───┼┼───┼┤
│literal│boolean│literal│floating│literal│floating│
└───┴───┴───┴┴───┴┘

  That is what I was looking for.

  It is useful to process columns of a .csv file read with readcsv 
(tables/csv) when there is a cycle in the "type" (char/num) of columns:


 'col1 col2 col3 col4'=.|:  ]`(".each) "0  readcsv filename

for a four-column table where the field "type" is char,num,char,num.


  Thanks to Martin and Henry.

  Devon's flexible expression is very valuable, but above the basic 
need here.


P.S. Martin, your paper on Rank in the early times of J (ACM APL91? 
Proceedings) is where I understood the Rank conjunction. It was new to 
those who had not used SharpAPL. Is it too late to express thanks for 
such a good description?


~ Gilles

Le 2023-02-25 à 16:39, Henry Rich a écrit :
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

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


[Jprogramming] Report of the J Wiki Meeting of February 23, 2023

2023-02-26 Thread 'robert therriault' via Programming

== Report of Meeting 2023-02-23 ==
Present: Art Anger, Bryce LeCates, Devon McCormick, Raul Miller, and Bob 
Therriault

1) We were joined by Bryce Lecates, a newcomer to J who is interested in the 
development of the wiki. Bryce was invited to join the wiki as a user. He 
indicated that there was a lot of information on the wiki, but some of the 
information is difficult to find and not always where you would expect. Bob 
shared the tip that when he finds useful pages he bookmarks them for future 
reference because there are times where he has found a page once and not been 
able to find that page again. 

2) Bob showed the main page with its category tree 
https://code.jsoftware.com/wiki/Category:Home and explained that pages are 
attached to the category tree and there are also opportunities to create 
content on the category pages. Bob has taken a first pass at categorizing the 
2400 wiki pages, https://code.jsoftware.com/wiki/Special:AllPages all pages but 
then found out that this did not include  the User pages 
https://code.jsoftware.com/wiki/Special:ListUsers, so that there may be several 
hundred more pages to categorize. These may take a little more time because 
user pages are not already grouped by topic. Nuvoc 
https://code.jsoftware.com/wiki/Category:NuVoc_R.1 was given as an example 
where the category page had a link to NuVoc in the content because without that 
content link, the link to NuVoc would be lost in the multitude of pages that 
are connected to it. 

3) Bryce asked if the Category tree would be available on all the pages, as it 
takes up quite a bit of space. Bob said that the Category tree will only show 
up on the Page Map and the Home page, although access would be given through 
the J Code Search navigation bar 
https://code.jsoftware.com/wiki/J_Code_Search_Bar. Bryce asked if the sidebar 
will remain the same. Bob said that the sidebar would be losing the link to the 
prototype wiki, but would retain a link to NuVoc and the Page Map 

4)Bryce said in exploring the Category tree he has found things that he had 
neve seen before, such as Scott Locklin's blog on the community links page 
https://code.jsoftware.com/wiki/Category:Blogs_C.2 . Bob said that he has 
discovered a lot in the categorization process. Bob also noted that some of the 
information is out of date, although could be brought to date by someone who 
had an interest in the topic and the skills to adapt to the current versions of 
J. 

5) Bryce talked about how when he was exposed to jQt, it took a while to learn 
that there were edit pages in addition to the terminal pages. Bryce has found 
jQt very useful, but there may be an opportunity to do a better job of 
onboarding users in the IDE. Bryce also asked about the forums and the 
information that is contained in the archives. There may be an opportunity to 
linking parts of the wiki to specific forum threads. This seems to have 
happened more often in the past, although there have been some recent examples 
with the implementation of the thread primitives.  

6) Bryce wondered if there was a way to have Category trees retain some 
information when you are backing out of a search. At this time the page is set 
to two levels of subcategories opening, which means that you can lose your 
thread if you were down a few subcategories  which close back up after you 
return, but Bob will look into that. 

7) Bob mentioned that he had sent an email to Chris and that Chris had 
suggested that we were ready to merge our prototype wiki to the current wiki. 
Bob mentioned that it was more a matter of building structure on the current 
wiki through categorization and not changing the pages on the current wiki at 
this stage. Bob had brought across the code for the J code Search Bar and Art's 
Essay Index are already on the current wiki 
https://code.jsoftware.com/wiki/Main_Page and just need to be updated with the 
different essay categories. https://code.jsoftware.com/wiki/Anger/Essays_Index. 

8) Help Offline https://code.jsoftware.com/wiki/Help/Offline is a place that 
you can get the wiki content in zip format, but does not include images - only 
pages that link to the image files.

For access to previous meeting reports 
https://code.jsoftware.com/wiki/Wiki_Development
If you would like to participate in the development of the J wiki please 
contact us on the general forum and we will get you an invitation to the next J 
wiki meeting held on Thursdays at 24:00 (UTC) Next meeting is March 2nd, 2023.

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


Re: [Jprogramming] Applying a cyclic gerund

2023-02-26 Thread 'Michael Day' via Programming

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





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


Re: [Jprogramming] Math/calculus simplify trig pull request

2023-02-26 Thread Raul Miller
If I remember correctly, the "0 limitation there was because d. was
explicitly rank 0 --
https://www.jsoftware.com/help/dictionary/dddot.htm

Meanwhile, of course, D. dealt with verbs at rank --
https://www.jsoftware.com/help/dictionary/ddcapdot.htm -- but getting
that right would have been a bit more work, and I didn't have a good
set of tests in mind to verify that I was approaching things correctly
there.

I hope this helps,

-- 
Raul

On Fri, Feb 24, 2023 at 10:58 AM Jan-Pieter Jacobs
 wrote:
>
> I was looking at Raul's pull request for math/calculus here:
> https://github.com/jsoftware/math_calculus/pull/5 . This would simplify a
> lot of derivatives, especially ones involving sines and cosines, which
> cause higher order derivatives to explode in the current version.
>
> I've been granted push rights on the repo, but I'm not 100% sure I
> understand the code proposed, and I'm also not sure how to use Github's
> code review tools (in fact, not being a programming professional, I never
> did a code review at all). How is this supposed to work? Are the Github
> tools used in general for collaboration on jsoftware's addons?
>
> I'm doubting about the lines 164-166 (
> https://github.com/rdm/math_calculus/blob/796ddac9de3863bf6746861624bb6aad8b70b9a2/calculus.ijs#L164),
> where it seems to me that in x atops y, when y happens to be -@verb, just
> discards x and -@, keeping only "verb". I think this should only happen if
> x is -, i.e. I think a check is missing.
>
> Secondly, for now, constants, zeros, ones and negative ones are considered
> only if they are rank 0 (see lines 173, 178-180, at
> https://github.com/rdm/math_calculus/blob/796ddac9de3863bf6746861624bb6aad8b70b9a2/calculus.ijs#L173).
> Would it hurt to also accept them at other ranks (e.g. 0: , 0"_), e.g.
> would it have unexpected effects on pderiv? deriv_jcalculus already accepts
> 0: and related primitives for deriv and intg (and could likely be extended
> to accept 0"_, 1"_, etc as well).
>
> Thanks for your observations.
> Jan-Pieter
>
> PS: if you're all too busy preparing the j9.4 release, no rush, it can wait.
> --
> For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jprogramming] 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 'Mike Day' via Programming
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


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