From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table Date: Mon, 29 Aug 2011 14:50:53 +0200 Message-ID: <87mxesjs9e.fsf@gmail.com> References: <20110829080003.GA12790@discus> <87hb50li4b.fsf@gmail.com> <878vqclf64.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy1JP-0006kN-7j for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 08:51:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qy1JN-00006w-El for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 08:51:35 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:65419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy1JN-00006s-1n for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 08:51:33 -0400 Received: by wyi11 with SMTP id 11so4485579wyi.0 for ; Mon, 29 Aug 2011 05:51:32 -0700 (PDT) In-Reply-To: (=?utf-8?Q?=22Andr?= =?utf-8?Q?=C3=A1s?= Major"'s message of "Mon, 29 Aug 2011 10:42:45 +0000 (UTC)") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?Andr=C3=A1s?= Major Cc: emacs-orgmode@gnu.org Andr=C3=A1s Major writes: >> Why? You can always write an intermediary step to "stringify" every >> cell. Choose your language. Nick Dokos showed you one way. > > Apparently, only if you set a global/per-user option in .emacs or suchlik= e, > which I think is a bad way of doing it. ----- #+tblname: mixed-types |1|x|5| |3|y|4| #+source: stringify(table=3Dmixed-types) #+begin_src emacs-lisp (concat "string[][] myvar=3D{{" (mapconcat (lambda (row) (when (listp row) (concat (mapconcat (lambda (el) (format "\"%s\"" el)) row ",")= "}"))) table ",{") "};") #+end_src #+source: myplot #+begin_src asymptote :noweb yes :file myplot.png <> unitsize(3cm); draw((0,0)--(1,1)); #+end_src #+results: myplot [[file:myplot.png]] ---- It may be ugly, but it works. > I don't think this is misuse in any way. Consider a table which is a > result of your research: the columns are the maker (e.g., "Mazda"), the > type (e.g., "MX-5"), engine displacement (a number), the mileage/fuel > consumption (a number), etc., and I want to create some asymptote plot > from this data. How would you would you specify it to Asymptote? You can't. You would probably use: string[][] cars=3D{{"Mazda","MX-5","1.5"}}; And that's exactly my point: engine displacement may be a number, but you would have to enter it as a string. Though, you insist on being able to enter it as a number anyway, hoping ob-asymptote will do the magic behind. How could it, since the language can't itself? Perhaps there should be a way in Babel (not specifically in Asymptote) to output a table with raw strings. Because want you really want to use is: |"1"|"x"|"5"| |"3"|"y"|"4"| Regards, --=20 Nicolas Goaziou