> 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

Reply via email to