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 1000000
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 1000000 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 1000000 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&paste?

Cheers,

Mike

Sent from my iPad

> On 26 Feb 2023, at 09:48, Devon McCormick <devon...@gmail.com> 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 1000000
>> : ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6'
> 4 34 10 100 13 14 2 3 11 12 1000001
> 
>> On Sat, Feb 25, 2023 at 4:39 PM Henry Rich <henryhr...@gmail.com> 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

Reply via email to