From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Huchler Subject: Re: how to force org-mode to interpret number as string Date: Fri, 07 Mar 2014 15:10:16 +0100 Message-ID: <87iorqksl3.fsf@mars.lan> References: <87siqx9um0.fsf@mars.lan> <871tygptqa.fsf@bzg.ath.cx> <87ha7c9xdn.fsf@mars.lan> <87lhwnug5t.fsf@gmail.com> <87r46elk95.fsf@mars.lan> <87k3c6vaff.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLvTx-0008TF-6b for emacs-orgmode@gnu.org; Fri, 07 Mar 2014 09:10:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLvTq-0006wI-E5 for emacs-orgmode@gnu.org; Fri, 07 Mar 2014 09:10:37 -0500 Received: from plane.gmane.org ([80.91.229.3]:34358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLvTq-0006wC-6Z for emacs-orgmode@gnu.org; Fri, 07 Mar 2014 09:10:30 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WLvTo-0005ev-IB for emacs-orgmode@gnu.org; Fri, 07 Mar 2014 15:10:28 +0100 Received: from hsi-kbw-109-193-108-156.hsi7.kabel-badenwuerttemberg.de ([109.193.108.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Mar 2014 15:10:28 +0100 Received: from stefan.huchler by hsi-kbw-109-193-108-156.hsi7.kabel-badenwuerttemberg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Mar 2014 15:10:28 +0100 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: emacs-orgmode@gnu.org Eric Schulte writes: > I suggested that you remove "." from your numbers. You could also wrap > your numbers in "s. > #+name: example > | "100.00000000" | > #+begin_src emacs-lisp :var example=example > (caar example) > #+end_src > > #+RESULTS: > : 100.00000000 > thank you and sorry for my inpatiance. That is a very helpful and constructive post. And basicly that was one thing I searched that you can mark somehow numbers as strings. To rename the numbers that would work of course I just want a option that works in any case, its not supposed to be a one-thing solution for one problem, I want it to be usable for every data. As a general serial mail tool, so renaming the numbers is no real good solution, and the point on the thausends is pretty common here in germany. I dont need to use calc functionality in any way on this table, so I don´t need proper number recognition besided if I need string its stupid to first convert it to a number from string to convert it then back. Especialy with all the "if (is number...)" block, and your mapping would then also not work, because I have to check then every entry by 2 loops like I did. So to complete your solution, is there a way to wrap "" around of all values in a table (or only on numbers)? something like: #tblfm: $3 = "$3" (or for all columns?) Then I think I am satisfied ;) > > I would argue that the list of lists representation is indeed more > commonly useful than converting a table to a list of dictionaries keyed > by the header row. Maybe you will find the following helpful. > > #+TBLNAME: jobs > | jobname | city | salary | email | > | Taxi-driver | New York City | 500.000 | mayor@gotham-city.com | > | Butcher | Peking | 5.000 | Jinping@china.cn | > > #+name: table-w-headers-to-list-of-key-value > #+begin_src emacs-lisp :var data='() > (let ((keys (car data)) > (vals (cdr data))) > (mapcar (lambda (row) (map 'list #'cons keys row)) vals)) > #+end_src > > Example usage, pull the email from each value. > #+begin_src emacs-lisp :var data=table-w-headers-to-list-of-key-value(jobs) > (mapcar (lambda (row) (cdr (assoc "email" row))) data) > #+end_src > > #+RESULTS: > | mayor@gotham-city.com | Jinping@china.cn | thanx yes the problem is that I am not so used to the lambda construct, and I did not want to learn that and a new language at the same time, but yes I should get used to map methods and lambda. It´s a bit shorter yes. thanks!