Org-mode mailing list
 help / color / mirror / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Axel Kielhorn <org-mode@axelkielhorn.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Two tables with same data but different sorting
Date: Fri, 02 Oct 2020 17:04:07 -0400
Message-ID: <m2wo08wda0.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <58A08721-0871-49F3-B190-F0B1F533C6B7@axelkielhorn.de>

I don't know of something built in, but dash provides a few things sort
of like that:

#+BEGIN_SRC emacs-lisp :results raw
(-last-item '(a b c))
#+END_SRC

#+RESULTS:
c



#+BEGIN_SRC emacs-lisp :results raw
(-slice '(a b c) -1)
#+END_SRC

#+RESULTS:
(c)

#+BEGIN_SRC emacs-lisp :results raw
(-take-last 1 '(a b c))
#+END_SRC

#+RESULTS:
(c)

surprisingly, it does not seem to support negative indices, but I guess
it would not be hard to make a wrapper that does that.

Axel Kielhorn <org-mode@axelkielhorn.de> writes:

>> Am 01.10.2020 um 17:47 schrieb John Kitchin <jkitchin@andrew.cmu.edu>:
>>
>> Glad it was helpful. You might also try (seventh row1) or (nth 6 row1). I think it is the same thing, but more obvious to read!
>
> I agree that „first second …“ would be easier for an english speaker.
> Having the ordinal number 1 based but the nth number 0 based is irritating (and sadly there is no „last“ or „penultimate“).
>
> Actually I was looking for something like last element or the element before the last element.
>
> (nth -1 row1) for the last row would be fine, but I guess that is the Python whispering in my ear.
>
> Combined with the right :exports I now get what I want.
>
> Thanks again for this additional information.
>
> Greetings Axel


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


      parent reply	other threads:[~2020-10-02 21:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  8:55 Axel Kielhorn
2020-10-01 12:21 ` John Kitchin
2020-10-01 14:36   ` Axel Kielhorn
2020-10-01 15:47     ` John Kitchin
2020-10-02  6:25       ` Axel Kielhorn
2020-10-02  9:36         ` Robert Pluim
2020-10-05  8:08           ` Axel Kielhorn
2020-10-05  8:32             ` Robert Pluim
2020-10-05  9:21               ` Axel Kielhorn
2020-10-05  9:45                 ` Robert Pluim
2020-10-02 21:04         ` John Kitchin [this message]

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://orgmode.org

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

  git send-email \
    --in-reply-to=m2wo08wda0.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=org-mode@axelkielhorn.de \
    /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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git