Hello,

Suppose I generate the following data:

> (map (lambda (x)
         (list x (sin x)))
       (iota 11 -0.5 0.1))
((-0.5 -0.479425538604203) (-0.4 -0.3894183423086505)
  (-0.3 -0.29552020666133955)
  (-0.19999999999999998 -0.1986693307950612)
  (-0.09999999999999998 -0.09983341664682813)
  (2.7755575615628914e-17 2.7755575615628914e-17)
  (0.10000000000000003 0.09983341664682818)
  (0.20000000000000004 0.19866933079506124)
  (0.30000000000000004 0.2955202066613396)
  (0.4 0.3894183423086505) (0.5 0.479425538604203))
>

Anybody have an 'fmt' recipie that'll print it out like this:

-0.5                    -0.479425538604203
-0.4                    -0.3894183423086505
-0.3                    -0.29552020666133955
-0.19999999999999998    -0.19866933079506122
-0.09999999999999998    -0.09983341664682813
 2.7755575615628914e-17  2.7755575615628914e-17
 0.10000000000000003     0.09983341664682818
 0.20000000000000004     0.19866933079506124
 0.30000000000000004     0.2955202066613396
 0.4                     0.3894183423086505
 0.5                     0.479425538604203

I see the 'columnar' combinator. I guess I could transpose the data to have it in columnar format, but I thought I'd check to see if there's a better way. Also, it would be nice to vertically align the decimal points.

As an aside, the J programming language has built-in operators for formatting numerical data in tables, which is nice.

Ed

Reply via email to