all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* About babel and header arguments
@ 2022-04-10  9:53 Henrik Frisk
  2022-04-10 10:11 ` tomas
  2022-04-10 15:00 ` Neil Jerram
  0 siblings, 2 replies; 8+ messages in thread
From: Henrik Frisk @ 2022-04-10  9:53 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Hi,

I'm not a skilled (scheme) programmer so maybe there is something obvious
I'm missing here. In the first example the header argument y is interpreted
as I would expect it, but in the second it isn't:

#+begin_src scheme :var y=10 :results value
  (+ 10 y)
#+end_src

#+RESULTS:
: 10

but not this:

#+begin_src scheme :var y=10 :results output
  ((lambda (x) (display x)) '(12 y))
#+end_src

#+RESULTS:
: (12 y)

Thanks in advance.

[-- Attachment #2: Type: text/html, Size: 678 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: About babel and header arguments
  2022-04-10  9:53 About babel and header arguments Henrik Frisk
@ 2022-04-10 10:11 ` tomas
  2022-04-10 10:39   ` Henrik Frisk
  2022-04-10 11:18   ` Byung-Hee HWANG
  2022-04-10 15:00 ` Neil Jerram
  1 sibling, 2 replies; 8+ messages in thread
From: tomas @ 2022-04-10 10:11 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

On Sun, Apr 10, 2022 at 11:53:51AM +0200, Henrik Frisk wrote:
> Hi,
> 
> I'm not a skilled (scheme) programmer so maybe there is something obvious
> I'm missing here. In the first example the header argument y is interpreted
> as I would expect it, but in the second it isn't:

Hm. You are expecting (12 10)?

> #+begin_src scheme :var y=10 :results value
>   (+ 10 y)
> #+end_src
> 
> #+RESULTS:
> : 10
> 
> but not this:
> 
> #+begin_src scheme :var y=10 :results output
>   ((lambda (x) (display x)) '(12 y))
> #+end_src

The quote extends to the whole (parenthesized) expression, i.e.
the y is quoted too, in there, so it's the symbol y, so that
output is correct:

> #+RESULTS:
> : (12 y)

(That's Scheme, not Babel doing it). I don't know where you
want to go to, but perhaps try:

  (list 12 y)

instead: this would make a list of whatever 12 evaluates to (this
would be 12) and y evaluates to (this would be 10).

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: About babel and header arguments
  2022-04-10 10:11 ` tomas
@ 2022-04-10 10:39   ` Henrik Frisk
  2022-04-10 11:18   ` Byung-Hee HWANG
  1 sibling, 0 replies; 8+ messages in thread
From: Henrik Frisk @ 2022-04-10 10:39 UTC (permalink / raw)
  To: tomas; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 678 bytes --]

> Hm. You are expecting (12 10)?
>
> Yes, sorry for not being clear.


>
> > #+begin_src scheme :var y=10 :results output
> >   ((lambda (x) (display x)) '(12 y))
> > #+end_src
>
> The quote extends to the whole (parenthesized) expression, i.e.
> the y is quoted too, in there, so it's the symbol y, so that
> output is correct:
>
> > #+RESULTS:
> > : (12 y)

Yes, that makes sense now that I see it.


>
> (That's Scheme, not Babel doing it). I don't know where you
> want to go to, but perhaps try:
>
>   (list 12 y)
>
> instead: this would make a list of whatever 12 evaluates to (this
> would be 12) and y evaluates to (this would be 10).
>

Yes, that  works, thank you!
/h

[-- Attachment #2: Type: text/html, Size: 1361 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: About babel and header arguments
  2022-04-10 10:11 ` tomas
  2022-04-10 10:39   ` Henrik Frisk
@ 2022-04-10 11:18   ` Byung-Hee HWANG
  1 sibling, 0 replies; 8+ messages in thread
From: Byung-Hee HWANG @ 2022-04-10 11:18 UTC (permalink / raw)
  To: emacs-orgmode

<tomas@tuxteam.de> writes:

> On Sun, Apr 10, 2022 at 11:53:51AM +0200, Henrik Frisk wrote:
>> Hi,
>> 
>> I'm not a skilled (scheme) programmer so maybe there is something obvious
>> I'm missing here. In the first example the header argument y is interpreted
>> as I would expect it, but in the second it isn't:
>
> Hm. You are expecting (12 10)?
>
>> #+begin_src scheme :var y=10 :results value
>>   (+ 10 y)
>> #+end_src
>> 
>> #+RESULTS:
>> : 10
>> 
>> but not this:
>> 
>> #+begin_src scheme :var y=10 :results output
>>   ((lambda (x) (display x)) '(12 y))
>> #+end_src
>
> The quote extends to the whole (parenthesized) expression, i.e.
> the y is quoted too, in there, so it's the symbol y, so that
> output is correct:
>
>> #+RESULTS:
>> : (12 y)
>
> (That's Scheme, not Babel doing it). I don't know where you
> want to go to, but perhaps try:
>
>   (list 12 y)
>
> instead: this would make a list of whatever 12 evaluates to (this
> would be 12) and y evaluates to (this would be 10).
>
> Cheers

Hellow tomas!
Always i learn from you, very good lecture!

Thanks again ^^^

Sincerely, Gnus and Org-mode fan Byung-Hee

-- 
^고맙습니다 _救濟蒼生_ 감사합니다_^))//


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: About babel and header arguments
  2022-04-10  9:53 About babel and header arguments Henrik Frisk
  2022-04-10 10:11 ` tomas
@ 2022-04-10 15:00 ` Neil Jerram
  2022-04-10 15:37   ` tomas
  2022-04-11 11:36   ` Henrik Frisk
  1 sibling, 2 replies; 8+ messages in thread
From: Neil Jerram @ 2022-04-10 15:00 UTC (permalink / raw)
  To: Henrik Frisk; +Cc: org-mode-email

Hi Henrik,

On Sun, 10 Apr 2022 at 10:56, Henrik Frisk <frisk.h@gmail.com> wrote:
>
> Hi,
>
> I'm not a skilled (scheme) programmer so maybe there is something obvious I'm missing here. In the first example the header argument y is interpreted as I would expect it, but in the second it isn't:
>
> #+begin_src scheme :var y=10 :results value
>   (+ 10 y)
> #+end_src
>
> #+RESULTS:
> : 10

I'm surprised by this one - shouldn't we expect the result 20 ?

Best wishes,
    Neil


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: About babel and header arguments
  2022-04-10 15:00 ` Neil Jerram
@ 2022-04-10 15:37   ` tomas
  2022-04-10 15:46     ` Neil Jerram
  2022-04-11 11:36   ` Henrik Frisk
  1 sibling, 1 reply; 8+ messages in thread
From: tomas @ 2022-04-10 15:37 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 839 bytes --]

On Sun, Apr 10, 2022 at 04:00:31PM +0100, Neil Jerram wrote:
> Hi Henrik,
> 
> On Sun, 10 Apr 2022 at 10:56, Henrik Frisk <frisk.h@gmail.com> wrote:
> >
> > Hi,
> >
> > I'm not a skilled (scheme) programmer so maybe there is something obvious I'm missing here. In the first example the header argument y is interpreted as I would expect it, but in the second it isn't:
> >
> > #+begin_src scheme :var y=10 :results value
> >   (+ 10 y)
> > #+end_src
> >
> > #+RESULTS:
> > : 10
> 
> I'm surprised by this one - shouldn't we expect the result 20 ?

Wait a second... where is this `+' coming from?

*Oh* you mean the first one, I see now. I just skimmed over it and didn't
notice. Unfortunately, "my" geiser seems broken at the moment and I can't
double-check it. But you are right, it should be 20.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: About babel and header arguments
  2022-04-10 15:37   ` tomas
@ 2022-04-10 15:46     ` Neil Jerram
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Jerram @ 2022-04-10 15:46 UTC (permalink / raw)
  To: tomas; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

On Sun, 10 Apr 2022, 16:39 ,<tomas@tuxteam.de> wrote:

> On Sun, Apr 10, 2022 at 04:00:31PM +0100, Neil Jerram wrote:
> > Hi Henrik,
> >
> > On Sun, 10 Apr 2022 at 10:56, Henrik Frisk <frisk.h@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > I'm not a skilled (scheme) programmer so maybe there is something
> obvious I'm missing here. In the first example the header argument y is
> interpreted as I would expect it, but in the second it isn't:
> > >
> > > #+begin_src scheme :var y=10 :results value
> > >   (+ 10 y)
> > > #+end_src
> > >
> > > #+RESULTS:
> > > : 10
> >
> > I'm surprised by this one - shouldn't we expect the result 20 ?
>
> Wait a second... where is this `+' coming from?
>
> *Oh* you mean the first one, I see now. I just skimmed over it and didn't
> notice. Unfortunately, "my" geiser seems broken at the moment and I can't
> double-check it. But you are right, it should be 20.
>

Thanks tomas!

[-- Attachment #2: Type: text/html, Size: 1523 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: About babel and header arguments
  2022-04-10 15:00 ` Neil Jerram
  2022-04-10 15:37   ` tomas
@ 2022-04-11 11:36   ` Henrik Frisk
  1 sibling, 0 replies; 8+ messages in thread
From: Henrik Frisk @ 2022-04-11 11:36 UTC (permalink / raw)
  To: Neil Jerram; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

> > #+begin_src scheme :var y=10 :results value
> >   (+ 10 y)
> > #+end_src
> >
> > #+RESULTS:
> > : 10
>
> I'm surprised by this one - shouldn't we expect the result 20 ?
>

Hi Neil, yes, that was a typo, I pasted in the wrong result. Sorry for the
confusion!

/h

[-- Attachment #2: Type: text/html, Size: 569 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-11 11:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-10  9:53 About babel and header arguments Henrik Frisk
2022-04-10 10:11 ` tomas
2022-04-10 10:39   ` Henrik Frisk
2022-04-10 11:18   ` Byung-Hee HWANG
2022-04-10 15:00 ` Neil Jerram
2022-04-10 15:37   ` tomas
2022-04-10 15:46     ` Neil Jerram
2022-04-11 11:36   ` Henrik Frisk

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.