On 2017-02-27 10:17, "Charles C. Berry" <ccbe...@ucsd.edu> writes:

> IMHO, it is often best to handle formatting of output in the language of 
> the src block.  There are some tools for doing this in R: the `ascii' 
> package is one. `xtable' is another.

I've had the same problem when working with tables and ocaml, as the
latter requires everything in the table to have the same type, so I need
to make sure everything is a string. To work around this, I did the
following:

#+name: convert-table
#+BEGIN_SRC emacs-lisp :var data=tps
  (mapcar (lambda (row)
            (mapcar (lambda (cell)
                      (if
                          (numberp cell)
                          (number-to-string cell)
                        cell))
                    row))
          data)
#+END_SRC

#+BEGIN_SRC ocaml :var data=convert-table :results output raw
  (* ocaml code *)
#+END_SRC

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-01: 406.13, 2016-01: 402.52

Attachment: signature.asc
Description: PGP signature

Reply via email to