Merge org tablesTOC of tables for org-mode long tablesCreate table for existing data using org-modeCan org tables cooperate with my customized dates?Is there a python tool for parsing org-mode tables?Auto-update org tables before each exportHow to export org tables with cells on multiple lines?Controling what an org-link points to with variablesConditional evaluation of org mode tables?Number-separators in org-mode tablesOrg-Mode How to position tables correctly when exporting to Latex?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Codimension of non-flat locus

Was any UN Security Council vote triple-vetoed?

Why does Kotter return in Welcome Back Kotter?

RSA: Danger of using p to create q

Is it unprofessional to ask if a job posting on GlassDoor is real?

Does detail obscure or enhance action?

Horror movie about a virus at the prom; beginning and end are stylized as a cartoon

Could an aircraft fly or hover using only jets of compressed air?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Can a vampire attack twice with their claws using Multiattack?

How does one intimidate enemies without having the capacity for violence?

What does "Puller Prush Person" mean?

dbcc cleantable batch size explanation

Important Resources for Dark Age Civilizations?

Can I make popcorn with any corn?

Replacing matching entries in one column of a file by another column from a different file

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

What typically incentivizes a professor to change jobs to a lower ranking university?

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

Why can't we play rap on piano?

Can a monk's single staff be considered dual wielded, as per the Dual Wielder feat?

Do I have a twin with permutated remainders?

Modeling an IP Address



Merge org tables


TOC of tables for org-mode long tablesCreate table for existing data using org-modeCan org tables cooperate with my customized dates?Is there a python tool for parsing org-mode tables?Auto-update org tables before each exportHow to export org tables with cells on multiple lines?Controling what an org-link points to with variablesConditional evaluation of org mode tables?Number-separators in org-mode tablesOrg-Mode How to position tables correctly when exporting to Latex?













2















Let's say I have the following org-tables:



| col1 | col2 |
| 1 | 2 |


| col3 |
| 3 |


What's the easiest programmatic way to get the following output:



| col1 | col2 | col3 |
| 1 | 2 | 3 |









share|improve this question
























  • Manually or programmatically?

    – choroba
    Mar 21 at 15:36











  • Programmatically.

    – андрэ
    Mar 21 at 15:47















2















Let's say I have the following org-tables:



| col1 | col2 |
| 1 | 2 |


| col3 |
| 3 |


What's the easiest programmatic way to get the following output:



| col1 | col2 | col3 |
| 1 | 2 | 3 |









share|improve this question
























  • Manually or programmatically?

    – choroba
    Mar 21 at 15:36











  • Programmatically.

    – андрэ
    Mar 21 at 15:47













2












2








2


1






Let's say I have the following org-tables:



| col1 | col2 |
| 1 | 2 |


| col3 |
| 3 |


What's the easiest programmatic way to get the following output:



| col1 | col2 | col3 |
| 1 | 2 | 3 |









share|improve this question
















Let's say I have the following org-tables:



| col1 | col2 |
| 1 | 2 |


| col3 |
| 3 |


What's the easiest programmatic way to get the following output:



| col1 | col2 | col3 |
| 1 | 2 | 3 |






org-mode






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 16:25







андрэ

















asked Mar 21 at 15:32









андрэандрэ

1275




1275












  • Manually or programmatically?

    – choroba
    Mar 21 at 15:36











  • Programmatically.

    – андрэ
    Mar 21 at 15:47

















  • Manually or programmatically?

    – choroba
    Mar 21 at 15:36











  • Programmatically.

    – андрэ
    Mar 21 at 15:47
















Manually or programmatically?

– choroba
Mar 21 at 15:36





Manually or programmatically?

– choroba
Mar 21 at 15:36













Programmatically.

– андрэ
Mar 21 at 15:47





Programmatically.

– андрэ
Mar 21 at 15:47










1 Answer
1






active

oldest

votes


















7














You can use cl-mapcar.



#+NAME: T1
| col1 | col2 |
| 1 | 2 |

#+NAME: T2
| col3 |
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 1 | 2 | 3 |


A nice side-effect of that solution is that it does not hurt if one table stops early. The resulting table is just as long as the shortest input table.



#+NAME: T1
| col1 | col2 |
| 11 | 12 |
| 21 | 22 |
| 31 | 32 |

#+NAME: T2
| col3 |
| 13 |
| 12 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 11 | 12 | 13 |
| 21 | 22 | 12 |


If you have actually headers you can use:



#+NAME: T1
| col1 | col2 |
|------+------|
| 1 | 2 |

#+NAME: T2
| col3 |
|------|
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(insert-at 1 (cl-mapcar #'append t1 t2) 'hline)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
|------+------+------|
| 1 | 2 | 3 |


Thereby, insert-at is defined by:



(defun insert-at (n list element)
"Insert ELEMENT into LIST at position N.
I.e., (eq ELEMENT (nth N (insert-at N LIST ELEMENT)))."
(if (eq n 0)
(cons element list)
(let ((link (nthcdr (1- n) list)))
(setcdr link (cons element (cdr link))))
list))





share|improve this answer

























  • That's... lovely!

    – андрэ
    Mar 21 at 16:39






  • 1





    Uups the definition of insert-at is from my own lisp library. I'll replace it with something standard in a moment...

    – Tobias
    Mar 21 at 16:53











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "583"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f48508%2fmerge-org-tables%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














You can use cl-mapcar.



#+NAME: T1
| col1 | col2 |
| 1 | 2 |

#+NAME: T2
| col3 |
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 1 | 2 | 3 |


A nice side-effect of that solution is that it does not hurt if one table stops early. The resulting table is just as long as the shortest input table.



#+NAME: T1
| col1 | col2 |
| 11 | 12 |
| 21 | 22 |
| 31 | 32 |

#+NAME: T2
| col3 |
| 13 |
| 12 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 11 | 12 | 13 |
| 21 | 22 | 12 |


If you have actually headers you can use:



#+NAME: T1
| col1 | col2 |
|------+------|
| 1 | 2 |

#+NAME: T2
| col3 |
|------|
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(insert-at 1 (cl-mapcar #'append t1 t2) 'hline)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
|------+------+------|
| 1 | 2 | 3 |


Thereby, insert-at is defined by:



(defun insert-at (n list element)
"Insert ELEMENT into LIST at position N.
I.e., (eq ELEMENT (nth N (insert-at N LIST ELEMENT)))."
(if (eq n 0)
(cons element list)
(let ((link (nthcdr (1- n) list)))
(setcdr link (cons element (cdr link))))
list))





share|improve this answer

























  • That's... lovely!

    – андрэ
    Mar 21 at 16:39






  • 1





    Uups the definition of insert-at is from my own lisp library. I'll replace it with something standard in a moment...

    – Tobias
    Mar 21 at 16:53















7














You can use cl-mapcar.



#+NAME: T1
| col1 | col2 |
| 1 | 2 |

#+NAME: T2
| col3 |
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 1 | 2 | 3 |


A nice side-effect of that solution is that it does not hurt if one table stops early. The resulting table is just as long as the shortest input table.



#+NAME: T1
| col1 | col2 |
| 11 | 12 |
| 21 | 22 |
| 31 | 32 |

#+NAME: T2
| col3 |
| 13 |
| 12 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 11 | 12 | 13 |
| 21 | 22 | 12 |


If you have actually headers you can use:



#+NAME: T1
| col1 | col2 |
|------+------|
| 1 | 2 |

#+NAME: T2
| col3 |
|------|
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(insert-at 1 (cl-mapcar #'append t1 t2) 'hline)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
|------+------+------|
| 1 | 2 | 3 |


Thereby, insert-at is defined by:



(defun insert-at (n list element)
"Insert ELEMENT into LIST at position N.
I.e., (eq ELEMENT (nth N (insert-at N LIST ELEMENT)))."
(if (eq n 0)
(cons element list)
(let ((link (nthcdr (1- n) list)))
(setcdr link (cons element (cdr link))))
list))





share|improve this answer

























  • That's... lovely!

    – андрэ
    Mar 21 at 16:39






  • 1





    Uups the definition of insert-at is from my own lisp library. I'll replace it with something standard in a moment...

    – Tobias
    Mar 21 at 16:53













7












7








7







You can use cl-mapcar.



#+NAME: T1
| col1 | col2 |
| 1 | 2 |

#+NAME: T2
| col3 |
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 1 | 2 | 3 |


A nice side-effect of that solution is that it does not hurt if one table stops early. The resulting table is just as long as the shortest input table.



#+NAME: T1
| col1 | col2 |
| 11 | 12 |
| 21 | 22 |
| 31 | 32 |

#+NAME: T2
| col3 |
| 13 |
| 12 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 11 | 12 | 13 |
| 21 | 22 | 12 |


If you have actually headers you can use:



#+NAME: T1
| col1 | col2 |
|------+------|
| 1 | 2 |

#+NAME: T2
| col3 |
|------|
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(insert-at 1 (cl-mapcar #'append t1 t2) 'hline)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
|------+------+------|
| 1 | 2 | 3 |


Thereby, insert-at is defined by:



(defun insert-at (n list element)
"Insert ELEMENT into LIST at position N.
I.e., (eq ELEMENT (nth N (insert-at N LIST ELEMENT)))."
(if (eq n 0)
(cons element list)
(let ((link (nthcdr (1- n) list)))
(setcdr link (cons element (cdr link))))
list))





share|improve this answer















You can use cl-mapcar.



#+NAME: T1
| col1 | col2 |
| 1 | 2 |

#+NAME: T2
| col3 |
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 1 | 2 | 3 |


A nice side-effect of that solution is that it does not hurt if one table stops early. The resulting table is just as long as the shortest input table.



#+NAME: T1
| col1 | col2 |
| 11 | 12 |
| 21 | 22 |
| 31 | 32 |

#+NAME: T2
| col3 |
| 13 |
| 12 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(cl-mapcar #'append t1 t2)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
| 11 | 12 | 13 |
| 21 | 22 | 12 |


If you have actually headers you can use:



#+NAME: T1
| col1 | col2 |
|------+------|
| 1 | 2 |

#+NAME: T2
| col3 |
|------|
| 3 |

#+BEGIN_SRC emacs-lisp :var t1=T1 t2=T2 :colnames no
(insert-at 1 (cl-mapcar #'append t1 t2) 'hline)
#+END_SRC

#+RESULTS:
| col1 | col2 | col3 |
|------+------+------|
| 1 | 2 | 3 |


Thereby, insert-at is defined by:



(defun insert-at (n list element)
"Insert ELEMENT into LIST at position N.
I.e., (eq ELEMENT (nth N (insert-at N LIST ELEMENT)))."
(if (eq n 0)
(cons element list)
(let ((link (nthcdr (1- n) list)))
(setcdr link (cons element (cdr link))))
list))






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 21 at 18:35

























answered Mar 21 at 16:37









TobiasTobias

14.6k1934




14.6k1934












  • That's... lovely!

    – андрэ
    Mar 21 at 16:39






  • 1





    Uups the definition of insert-at is from my own lisp library. I'll replace it with something standard in a moment...

    – Tobias
    Mar 21 at 16:53

















  • That's... lovely!

    – андрэ
    Mar 21 at 16:39






  • 1





    Uups the definition of insert-at is from my own lisp library. I'll replace it with something standard in a moment...

    – Tobias
    Mar 21 at 16:53
















That's... lovely!

– андрэ
Mar 21 at 16:39





That's... lovely!

– андрэ
Mar 21 at 16:39




1




1





Uups the definition of insert-at is from my own lisp library. I'll replace it with something standard in a moment...

– Tobias
Mar 21 at 16:53





Uups the definition of insert-at is from my own lisp library. I'll replace it with something standard in a moment...

– Tobias
Mar 21 at 16:53

















draft saved

draft discarded
















































Thanks for contributing an answer to Emacs Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f48508%2fmerge-org-tables%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Solar Wings Breeze Design and development Specifications (Breeze) References Navigation menu1368-485X"Hang glider: Breeze (Solar Wings)"e

Kathakali Contents Etymology and nomenclature History Repertoire Songs and musical instruments Traditional plays Styles: Sampradayam Training centers and awards Relationship to other dance forms See also Notes References External links Navigation menueThe Illustrated Encyclopedia of Hinduism: A-MSouth Asian Folklore: An EncyclopediaRoutledge International Encyclopedia of Women: Global Women's Issues and KnowledgeKathakali Dance-drama: Where Gods and Demons Come to PlayKathakali Dance-drama: Where Gods and Demons Come to PlayKathakali Dance-drama: Where Gods and Demons Come to Play10.1353/atj.2005.0004The Illustrated Encyclopedia of Hinduism: A-MEncyclopedia of HinduismKathakali Dance-drama: Where Gods and Demons Come to PlaySonic Liturgy: Ritual and Music in Hindu Tradition"The Mirror of Gesture"Kathakali Dance-drama: Where Gods and Demons Come to Play"Kathakali"Indian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceMedieval Indian Literature: An AnthologyThe Oxford Companion to Indian TheatreSouth Asian Folklore: An Encyclopedia : Afghanistan, Bangladesh, India, Nepal, Pakistan, Sri LankaThe Rise of Performance Studies: Rethinking Richard Schechner's Broad SpectrumIndian Theatre: Traditions of PerformanceModern Asian Theatre and Performance 1900-2000Critical Theory and PerformanceBetween Theater and AnthropologyKathakali603847011Indian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceBetween Theater and AnthropologyBetween Theater and AnthropologyNambeesan Smaraka AwardsArchivedThe Cambridge Guide to TheatreRoutledge International Encyclopedia of Women: Global Women's Issues and KnowledgeThe Garland Encyclopedia of World Music: South Asia : the Indian subcontinentThe Ethos of Noh: Actors and Their Art10.2307/1145740By Means of Performance: Intercultural Studies of Theatre and Ritual10.1017/s204912550000100xReconceiving the Renaissance: A Critical ReaderPerformance TheoryListening to Theatre: The Aural Dimension of Beijing Opera10.2307/1146013Kathakali: The Art of the Non-WorldlyOn KathakaliKathakali, the dance theatreThe Kathakali Complex: Performance & StructureKathakali Dance-Drama: Where Gods and Demons Come to Play10.1093/obo/9780195399318-0071Drama and Ritual of Early Hinduism"In the Shadow of Hollywood Orientalism: Authentic East Indian Dancing"10.1080/08949460490274013Sanskrit Play Production in Ancient IndiaIndian Music: History and StructureBharata, the Nāṭyaśāstra233639306Table of Contents2238067286469807Dance In Indian Painting10.2307/32047833204783Kathakali Dance-Theatre: A Visual Narrative of Sacred Indian MimeIndian Classical Dance: The Renaissance and BeyondKathakali: an indigenous art-form of Keralaeee

Urgehal History Discography Band members References External links Navigation menu"Mediateket: Urgehal""Interview with Enzifer of Urgehal, 2007""Urgehal - Interview"Urgehal"Urgehal Frontman Trondr Nefas Dies at 35"Urgehal9042691cb161873230(data)0000 0001 0669 4224no2016126817ee6ccef6-e558-44b6-b059-dbbb5b913b24145036459145036459