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


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


Re: [Jprogramming] Applying a cyclic gerund

2023-02-25 Thread Henry Rich
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-25 Thread neitzel
> 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


Re: [Jprogramming] Applying a cyclic gerund

2023-02-23 Thread Gilles Kirouac
Thanks for many different solutions. There is indeed more than one way 
to skin a cat!


  Raul's monadic hook with Insert appears as a natural tool for this 
problem. Why didn't I think of it?!


  Henry's use of L: is surely an invitation to have a closer look at 
conjunction Level At.



~ Gilles

Le 2023-02-22 à 05:08, Raul Miller a écrit :

I'd probably go with
(;".)&>/'abc';'13.2'
or,
(;".)&;/'abc';'13.2'


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


Re: [Jprogramming] Applying a cyclic gerund

2023-02-22 Thread Raul Miller
I'd probably go with
   (;".)&>/'abc';'13.2'
or,
   (;".)&;/'abc';'13.2'

-- 
Raul

On Tue, Feb 21, 2023 at 11:08 PM Gilles Kirouac  wrote:
>
> I have two character strings :
>
> datatype each 'abc';'13.2'
> ┌───┬───┐
> │literal│literal│
> └───┴───┘
>
> I want to convert the second one into numerical data
>
>datatype each (<@:])`(<@:".)"1 >'abc';'13.2'
> ┌───┬┐
> │literal│floating│
> └───┴┘
>
> Can you simplify the above expression?
>
>
> ~ Gilles
> --
> 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-21 Thread 'Pascal Jasmin' via Programming
there is

G1 =: 1 {:: ]
G0 =: 0 {:: ]


(G0 ; ".@G1) 'abc';'13.2'




On Tuesday, February 21, 2023 at 11:18:21 p.m. EST, Elijah Stone 
 wrote: 





Your routine most likely doesn't do what you want it to:

    'abc ' -: 0{:: (<@:])`(<@:".)"1 >'abc';'13.2'
1

The 'abc' got padded when you opened.

You could go for ]`(".&.>)"1.  Or {{y 1}~ ".&.> 1{y}}.  I don't expect you're 
likely to find anything much nicer.

(Had j structural under, you might say ".&.(1&{::), but it does not.)

On Tue, 21 Feb 2023, Gilles Kirouac wrote:

> I have two character strings :
>
>    datatype each 'abc';'13.2'
> ┌───┬───┐
> │literal│literal│
> └───┴───┘
>
> I want to convert the second one into numerical data
>
>  datatype each (<@:])`(<@:".)"1 >'abc';'13.2'
> ┌───┬┐
> │literal│floating│
> └───┴┘
>
> Can you simplify the above expression?
>
>
> ~ Gilles
> --
> 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] Applying a cyclic gerund

2023-02-21 Thread Henry Rich

    ci =. 'abc';'13.2'
   (datatype L:0) 0 1 (0&".@])^:[ L:0"0  ci
---++
literal|floating|
---++

Henry Rich

On 2/21/2023 11:08 PM, Gilles Kirouac wrote:

I have two character strings :

   datatype each 'abc';'13.2'
┌───┬───┐
│literal│literal│
└───┴───┘

I want to convert the second one into numerical data

  datatype each (<@:])`(<@:".)"1 >'abc';'13.2'
┌───┬┐
│literal│floating│
└───┴┘

Can you simplify the above expression?


~ Gilles
--
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-21 Thread Elijah Stone

Your routine most likely doesn't do what you want it to:

   'abc ' -: 0{:: (<@:])`(<@:".)"1 >'abc';'13.2'
1

The 'abc' got padded when you opened.

You could go for ]`(".&.>)"1.  Or {{y 1}~ ".&.> 1{y}}.  I don't expect you're 
likely to find anything much nicer.


(Had j structural under, you might say ".&.(1&{::), but it does not.)

On Tue, 21 Feb 2023, Gilles Kirouac wrote:


I have two character strings :

   datatype each 'abc';'13.2'
┌───┬───┐
│literal│literal│
└───┴───┘

I want to convert the second one into numerical data

  datatype each (<@:])`(<@:".)"1 >'abc';'13.2'
┌───┬┐
│literal│floating│
└───┴┘

Can you simplify the above expression?


~ Gilles
--
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] Applying a cyclic gerund

2023-02-21 Thread Gilles Kirouac

I have two character strings :

   datatype each 'abc';'13.2'
┌───┬───┐
│literal│literal│
└───┴───┘

I want to convert the second one into numerical data

  datatype each (<@:])`(<@:".)"1 >'abc';'13.2'
┌───┬┐
│literal│floating│
└───┴┘

Can you simplify the above expression?


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