Ahhh... "since the indent character is ">": " I see the light, if not the >
This iPad's indent character is that vertical stroke graphic, perhaps the one used for J's box representation. Same on my lap-top, I think! So we were at cross-purposes, not too cross, I hope. Ironic that Ken & Roger took all the trouble to avoid APL's idiosyncratic symbol set! Cheers, Mike Sent from my iPad Begin forwarded message: > From: Devon McCormick <[email protected]> > Date: 27 February 2023 at 06:51:34 GMT > To: [email protected] > Subject: Re: [Jprogramming] Applying a cyclic gerund > Reply-To: [email protected] > > 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 1000000 >>>>> : ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6' >>>> 4 34 10 100 13 14 2 3 11 12 1000001 > 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 1000000 >>>>> : ; ((]`".) @. isChar) &.> '3';33;'9 99';12 13;1;2;'10 11 1e6' >>>> 4 34 10 100 13 14 2 3 11 12 1000001 > 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 < >> [email protected]> 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 < >>> [email protected]> 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 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 <[email protected]> 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 <[email protected]> >>>> 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, [email protected] 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 >> > > > -- > > 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
