emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two tables with same data but different sorting


From: John Kitchin
Subject: Re: Two tables with same data but different sorting
Date: Fri, 02 Oct 2020 17:04:07 -0400
User-agent: mu4e 1.4.13; emacs 27.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]