[Top][All Lists]

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

Re: [O] [Babel] Lisp error: (wrong-type-argument listp hline)

From: Eric Schulte
Subject: Re: [O] [Babel] Lisp error: (wrong-type-argument listp hline)
Date: Mon, 23 Sep 2013 17:26:39 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi Seb,

I think you're confused by headers which are re-added by the colnames
machinery.  See the following which returns scalar output avoiding any
colnames post-processing.

#+Property: results scalar

#+name: table
| Key | Value |
| ABJ |     1 |
| DEK |     2 |

#+begin_src emacs-lisp :var data=table :hlines no

: (("Key" "Value") ("ABJ" 1) ("DEK" 2))

#+begin_src emacs-lisp :var data=table :hlines yes

: (("Key" "Value") hline ("ABJ" 1) ("DEK" 2))
> * Set :hlines to "yes"
> `:hlines yes' should leave the horizontal line, but generates an error.
>   #+begin_src emacs-lisp :var data=table :results output :hlines yes
>   (mapc (lambda (item) (princ (format "UPDATE dim SET val=%s WHERE 
> code='%s'\n"
>                                       (nth 1 item) (nth 0 item))))
>    data)
>   #+end_src

This is not a babel error, this is an error in your code block body,
which assumes that every element of `data' will be a list.  The symbol
`hline' is not a list.

> Finally, how am I then supposed to *ignore the header line*?  By adding
>   #+begin_src emacs-lisp
>   (setq table (cdr table))
>   #+end_src
> ?
> Do I have to do that explicitly in my code block, or is there an option for
> telling that to Babel?

Use the :colnames processing to strip the headings.

    #+begin_src emacs-lisp :var data=table :colnames yes

    : (("ABJ" 1) ("DEK" 2))


> Best regards,
>   Seb

Eric Schulte
PGP: 0x614CA05D

reply via email to

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