emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel: feature-request: allow table-cells to be passed as strings
@ 2010-10-03 18:39 Marc-Oliver Ihm
  2010-10-04 13:30 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-Oliver Ihm @ 2010-10-03 18:39 UTC (permalink / raw)
  To: emacs-orgmode

Hello !

Currently org-babel, when passing a table as input to a
source-code-block, behaves like this:
If the cell looks like a number, it will be converted to an integer or a
float. Otherwise the cell-content is passed unconverted as a string.

Now, dealing with very large numbers (which I want to process with
calc), I found this behavior annoying, because babel converts my large
numbers to float, loosing precision in the process.

Now my request would be, to have a switch (maybe as a header argument)
which would tell babel to pass all cells as unconverted strings.

I have checked the documentation and the sources and have not been able
to find such a switch.


with kind regards, Marc-Oliver Ihm

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-babel: feature-request: allow table-cells to be passed as strings
  2010-10-03 18:39 org-babel: feature-request: allow table-cells to be passed as strings Marc-Oliver Ihm
@ 2010-10-04 13:30 ` Eric Schulte
  2010-10-04 19:05   ` Marc-Oliver Ihm
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2010-10-04 13:30 UTC (permalink / raw)
  To: Marc-Oliver Ihm; +Cc: emacs-orgmode

Hi,

Could you send an example of the contents of such a cell, and what it is
converted to?  Maybe it will be possible to improve the parsing of
numerals in Babel s.t. we don't lose precision in these cases.

Thanks -- Eric

Marc-Oliver Ihm <ihm@online.de> writes:

> Hello !
>
> Currently org-babel, when passing a table as input to a
> source-code-block, behaves like this:
> If the cell looks like a number, it will be converted to an integer or a
> float. Otherwise the cell-content is passed unconverted as a string.
>
> Now, dealing with very large numbers (which I want to process with
> calc), I found this behavior annoying, because babel converts my large
> numbers to float, loosing precision in the process.
>
> Now my request would be, to have a switch (maybe as a header argument)
> which would tell babel to pass all cells as unconverted strings.
>
> I have checked the documentation and the sources and have not been able
> to find such a switch.
>
>
> with kind regards, Marc-Oliver Ihm
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-babel: feature-request: allow table-cells to be passed as strings
  2010-10-04 13:30 ` Eric Schulte
@ 2010-10-04 19:05   ` Marc-Oliver Ihm
  2010-11-03 20:12     ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-Oliver Ihm @ 2010-10-04 19:05 UTC (permalink / raw)
  Cc: emacs-orgmode

Hello,

This would be such an example. The Input table contains some numbers,
the last of them larger than allowed for an integer.

As the result table show, the last one is converted to float thereby
using some precision.

I would like to see them all as strings.

with kind regards, Marc-Oliver Ihm


#+tblname: numbers

|                           1 |
|                           2 |
|                          12 |
|                          45 |
|                         166 |
|                    12567890 |
| 231231282371983279389999999 |


#+begin_src emacs-lisp :var numbers=numbers
(mapcar
 (lambda (line)
     (let ((number (car line)))
       (list number (type-of number))
       )
     )
   numbers)
#+end_src

#+results:
|                      1 | integer |
|                      2 | integer |
|                     12 | integer |
|                     45 | integer |
|                    166 | integer |
|               12567890 | integer |
| 2.3123128237198328e+26 | float   |




Am 04.10.2010 15:30, schrieb Eric Schulte:
> Hi,
> 
> Could you send an example of the contents of such a cell, and what it is
> converted to?  Maybe it will be possible to improve the parsing of
> numerals in Babel s.t. we don't lose precision in these cases.
> 
> Thanks -- Eric
> 
> Marc-Oliver Ihm <ihm@online.de> writes:
> 
>> Hello !
>>
>> Currently org-babel, when passing a table as input to a
>> source-code-block, behaves like this:
>> If the cell looks like a number, it will be converted to an integer or a
>> float. Otherwise the cell-content is passed unconverted as a string.
>>
>> Now, dealing with very large numbers (which I want to process with
>> calc), I found this behavior annoying, because babel converts my large
>> numbers to float, loosing precision in the process.
>>
>> Now my request would be, to have a switch (maybe as a header argument)
>> which would tell babel to pass all cells as unconverted strings.
>>
>> I have checked the documentation and the sources and have not been able
>> to find such a switch.
>>
>>
>> with kind regards, Marc-Oliver Ihm
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-babel: feature-request: allow table-cells to be passed as strings
  2010-10-04 19:05   ` Marc-Oliver Ihm
@ 2010-11-03 20:12     ` Eric Schulte
  2010-11-04  7:23       ` Antwort: " marc-oliver.ihm
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2010-11-03 20:12 UTC (permalink / raw)
  To: Marc-Oliver Ihm; +Cc: emacs-orgmode

Hi Marc,

Sorry to stall this thread for so long.

Now that I've worked some with Calc it seems that it provides a mature
library of working with large numbers.  My new hope is to convert Babel
to using Calc for all of its numerical string parsing and printing.
That should solve your dilemma in the most natural way.

Does anyone foresee any problems in this potential approach?

Thanks -- Eric

Marc-Oliver Ihm <ihm@online.de> writes:

> Hello,
>
> This would be such an example. The Input table contains some numbers,
> the last of them larger than allowed for an integer.
>
> As the result table show, the last one is converted to float thereby
> using some precision.
>
> I would like to see them all as strings.
>
> with kind regards, Marc-Oliver Ihm
>
>
> #+tblname: numbers
>
> |                           1 |
> |                           2 |
> |                          12 |
> |                          45 |
> |                         166 |
> |                    12567890 |
> | 231231282371983279389999999 |
>
>
> #+begin_src emacs-lisp :var numbers=numbers
> (mapcar
>  (lambda (line)
>      (let ((number (car line)))
>        (list number (type-of number))
>        )
>      )
>    numbers)
> #+end_src
>
> #+results:
> |                      1 | integer |
> |                      2 | integer |
> |                     12 | integer |
> |                     45 | integer |
> |                    166 | integer |
> |               12567890 | integer |
> | 2.3123128237198328e+26 | float   |
>
>
>
>
> Am 04.10.2010 15:30, schrieb Eric Schulte:
>> Hi,
>> 
>> Could you send an example of the contents of such a cell, and what it is
>> converted to?  Maybe it will be possible to improve the parsing of
>> numerals in Babel s.t. we don't lose precision in these cases.
>> 
>> Thanks -- Eric
>> 
>> Marc-Oliver Ihm <ihm@online.de> writes:
>> 
>>> Hello !
>>>
>>> Currently org-babel, when passing a table as input to a
>>> source-code-block, behaves like this:
>>> If the cell looks like a number, it will be converted to an integer or a
>>> float. Otherwise the cell-content is passed unconverted as a string.
>>>
>>> Now, dealing with very large numbers (which I want to process with
>>> calc), I found this behavior annoying, because babel converts my large
>>> numbers to float, loosing precision in the process.
>>>
>>> Now my request would be, to have a switch (maybe as a header argument)
>>> which would tell babel to pass all cells as unconverted strings.
>>>
>>> I have checked the documentation and the sources and have not been able
>>> to find such a switch.
>>>
>>>
>>> with kind regards, Marc-Oliver Ihm
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>> 
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Antwort: Re: org-babel: feature-request: allow table-cells to be passed as strings
  2010-11-03 20:12     ` Eric Schulte
@ 2010-11-04  7:23       ` marc-oliver.ihm
  0 siblings, 0 replies; 5+ messages in thread
From: marc-oliver.ihm @ 2010-11-04  7:23 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode, Marc-Oliver Ihm

Hello Eric,


Thanx for coming back on me !

In fact I have found this problem when trying to use calc with babel.
And yes, I agree, using calc for parsing will probably solve this problem.

In fact I am quite excited about the plans for adding calc as a new 
language to babel. It will be a great tool and toy !


with kind regards, Marc-Oliver Ihm





"Eric Schulte" <schulte.eric@gmail.com> 
03.11.2010 21:12

An
Marc-Oliver Ihm <ihm@online.de>
Kopie
emacs-orgmode@gnu.org
Thema
Re: org-babel: feature-request: allow table-cells to be passed as strings





Hi Marc,

Sorry to stall this thread for so long.

Now that I've worked some with Calc it seems that it provides a mature
library of working with large numbers.  My new hope is to convert Babel
to using Calc for all of its numerical string parsing and printing.
That should solve your dilemma in the most natural way.

Does anyone foresee any problems in this potential approach?

Thanks -- Eric

Marc-Oliver Ihm <ihm@online.de> writes:

> Hello,
>
> This would be such an example. The Input table contains some numbers,
> the last of them larger than allowed for an integer.
>
> As the result table show, the last one is converted to float thereby
> using some precision.
>
> I would like to see them all as strings.
>
> with kind regards, Marc-Oliver Ihm
>
>
> #+tblname: numbers
>
> |                           1 |
> |                           2 |
> |                          12 |
> |                          45 |
> |                         166 |
> |                    12567890 |
> | 231231282371983279389999999 |
>
>
> #+begin_src emacs-lisp :var numbers=numbers
> (mapcar
>  (lambda (line)
>      (let ((number (car line)))
>        (list number (type-of number))
>        )
>      )
>    numbers)
> #+end_src
>
> #+results:
> |                      1 | integer |
> |                      2 | integer |
> |                     12 | integer |
> |                     45 | integer |
> |                    166 | integer |
> |               12567890 | integer |
> | 2.3123128237198328e+26 | float   |
>
>
>
>
> Am 04.10.2010 15:30, schrieb Eric Schulte:
>> Hi,
>>
>> Could you send an example of the contents of such a cell, and what it 
is
>> converted to?  Maybe it will be possible to improve the parsing of
>> numerals in Babel s.t. we don't lose precision in these cases.
>>
>> Thanks -- Eric
>>
>> Marc-Oliver Ihm <ihm@online.de> writes:
>>
>>> Hello !
>>>
>>> Currently org-babel, when passing a table as input to a
>>> source-code-block, behaves like this:
>>> If the cell looks like a number, it will be converted to an integer or 
a
>>> float. Otherwise the cell-content is passed unconverted as a string.
>>>
>>> Now, dealing with very large numbers (which I want to process with
>>> calc), I found this behavior annoying, because babel converts my large
>>> numbers to float, loosing precision in the process.
>>>
>>> Now my request would be, to have a switch (maybe as a header argument)
>>> which would tell babel to pass all cells as unconverted strings.
>>>
>>> I have checked the documentation and the sources and have not been 
able
>>> to find such a switch.
>>>
>>>
>>> with kind regards, Marc-Oliver Ihm
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>



Namensgeber des neuen Mainzer Fussballstadions 
Aktuelle Infos zur Coface Arena: www.coface-arena.de


Naming right sponsor of the new Mainzer football stadium 
Latest news on the Coface Arena: www.coface-arena.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-04  7:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-03 18:39 org-babel: feature-request: allow table-cells to be passed as strings Marc-Oliver Ihm
2010-10-04 13:30 ` Eric Schulte
2010-10-04 19:05   ` Marc-Oliver Ihm
2010-11-03 20:12     ` Eric Schulte
2010-11-04  7:23       ` Antwort: " marc-oliver.ihm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).