emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thierry Banel <tbanelwebmin@free.fr>
To: emacs-orgmode@gnu.org
Subject: Re: very long table calc expressions ?
Date: Fri, 22 Jun 2018 19:22:33 +0200	[thread overview]
Message-ID: <8ea720dd-5e20-cd5b-a2d6-8f69c174202a@free.fr> (raw)
In-Reply-To: <87602aydhb.fsf@alphaville.usersys.redhat.com>

On 22/06/2018 18:48, Nick Dokos wrote:
> Uwe Brauer <oub@mat.ucm.es> writes:
>
>> Hi Jonathan
>>
>>    > Hi Uwe,
>>    > On Fri, Jun 22, 2018 at 10:16 AM, Uwe Brauer <oub@mat.ucm.es> wrote:
>>
>>    > (::)
>>    > not just a single.  Brent's example has it with double while yours only
>>    > shows
>>    > it with a single one.
>>
>> Right, thanks for clarifying that. My original example had various :: and
>> indeed there Bernt's advice helped. 
>>
>> Meanwhile Thierry posted a more sophisticated example containing only
>> simple :
>> (which   does not work with ::) and that example cannot be dealt with via 
>> C-c '.
>>
>> @Thierry: that is correct?
>>
> The double colons separate different formulas. The single colons in Thierry's
> formula are  part of the syntax of a conditional expression, i.e. they are part
> of a *single* (long) formula. So yes, that cannot be dealt with via C-c '.
>
A utility lisp function can enhance readability:

#+begin_src elisp
  (defun test-to-interval (x)
    (let ((n (string-to-number x)))
      (cond
       ((equal x "")              "NP")
       ((and (<= 0 n) (<= n 4.9)) "SS")
       ((and (<= 5 n) (<= n 6.9)) "AP")
       ((and (<= 7 n) (<= n 8.9)) "NT")
       ((and (<= 9 n) (<= n 10 )) "SB")
       (t                         "other"))))
#+end_src

#+TBLNAME: raw-data
| Test | Interval |
|------+----------|
|    0 | SS       |
|    1 | SS       |
|    2 | SS       |
|    3 | SS       |
|    4 | SS       |
|    5 | AP       |
|    6 | AP       |
|    7 | NT       |
|    8 | NT       |
|    9 | SB       |
|      | NP       |
|      | NP       |
|      | NP       |
#+TBLFM: $2='(test-to-interval $1)

  reply	other threads:[~2018-06-22 17:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 17:21 very long table calc expressions ? Uwe Brauer
2018-06-20  6:13 ` Thierry Banel
2018-06-20  9:09   ` Uwe Brauer
2018-06-20 18:28     ` Thierry Banel
2018-06-21 13:35       ` Uwe Brauer
2018-06-21 19:06 ` Bernt Hansen
2018-06-22 10:28   ` Uwe Brauer
2018-06-22 13:16     ` Bernt Hansen
2018-06-22 14:16       ` Uwe Brauer
2018-06-22 15:03         ` Jonathan Leech-Pepin
2018-06-22 15:25           ` Uwe Brauer
2018-06-22 16:48             ` Nick Dokos
2018-06-22 17:22               ` Thierry Banel [this message]
2018-06-22 17:54                 ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ea720dd-5e20-cd5b-a2d6-8f69c174202a@free.fr \
    --to=tbanelwebmin@free.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).