From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Bottorff Subject: Re: Library of Babel confusion Date: Wed, 4 Apr 2018 18:52:35 -0400 Message-ID: References: <87r2nwvx4f.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e5584b05690dad13" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3rGh-0004ut-D0 for emacs-orgmode@gnu.org; Wed, 04 Apr 2018 18:52:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3rGg-0007hb-62 for emacs-orgmode@gnu.org; Wed, 04 Apr 2018 18:52:39 -0400 Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:45001) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f3rGf-0007gq-U9 for emacs-orgmode@gnu.org; Wed, 04 Apr 2018 18:52:38 -0400 Received: by mail-oi0-x22a.google.com with SMTP id j143-v6so20768511oih.11 for ; Wed, 04 Apr 2018 15:52:37 -0700 (PDT) In-Reply-To: <87r2nwvx4f.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode Mailinglist --000000000000e5584b05690dad13 Content-Type: text/plain; charset="UTF-8" The docs have this example: #+name: square #+header: :var x=0 #+begin_src python return x*x #+end_src #+call: square(x=6) ...so yes, "return", but with (defun myelsquare (x) (* x x)) isn't the final thing evaluated what is "returned" with Elisp? AFAIK there is no explicit return with Elisp. #+call can't really call a function, only named blocks of REPL-style calculator snippets? Also, today I find that a new start of Emacs doesn't load my LOB file, i.e., (custom-set-variables ... '(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org"))) ... was being blown off, i.e., not populating the org-babel-library-of-babel variable. But today org-babel-lob-injest does seem to work, i.e., it did populate org-babel-library-of-babel. I wonder what's up. On Tue, Apr 3, 2018 at 4:44 PM, Nicolas Goaziou wrote: > Lawrence Bottorff writes: > > > I've been trying to grok LOB again. So I've cloned the worg git and > > library-of-babel.el is one of the files. org-babel-lob-injest didn't > > work, > > What doesn't work? You call `org-babel-lob-ingest', specify a file, and > it stores all source code blocks in the file for later use. > > > Now, in my org file I put this: > > > > #+lob: write(file="jsontest") > > This should be #+call: write(...) > > > > > and try C-c C-c on it. Nothing. My minibuffer says "local setup has been > > refreshed". How does one use, call a LOB function? Also, while I'm > > demonstrating my rank noobian-ness, I try this: > > > > #+name: myelsquare > > #+header: :var x=0 > > > > #+begin_src emacs-lisp > > (* x x) > > #+end_src > > > > #+call: myelsquare(x=6) > > > > #+RESULTS: : 36 > > > > but this results in > > > > #+name: myelsquare > > #+header: :var x=0 > > > > #+begin_src emacs-lisp > > (defun myelsquare (x) > > (* x x)) > > #+end_src > > > > #+call: myelsquare(x=6) > > > > #+RESULTS: > > : myelsquare2 > > > > After a #+call:... I use C-c C-c to evaluate it. What am I missing > > here? > > Your second block defines a function, but doesn't return its results. > "#+call: myelsquare(...)" expects to find a block named "myelsquare", > not an Elisp function named "myelsquare". > > Regards, > > -- > Nicolas Goaziou > --000000000000e5584b05690dad13 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The=C2=A0docs=C2=A0have this exa= mple:

#+name: square
#+header: :var x=3D0
#+begin_src python
return x*x
#+end_src

=
#+call: square(x=3D6)

...so yes, &q= uot;return", but with=C2=A0

(defun myels= quare (x)
=C2=A0 =C2=A0(* x x))

is= n't the final thing evaluated what is "returned" with Elisp? = AFAIK there is no explicit return with Elisp. #+call can't really call = a function, only named blocks of REPL-style calculator snippets?

Also, today I find that a new start of Emacs doesn't load my LOB= file, i.e.,

(custom-set-variables
...<= /div>
=C2=A0'(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org")))
...

was bein= g blown off, i.e., not populating the org-babel-library-of-babel variable. = But today org-babel-lob-injest does seem to work, i.e., it did populate org= -babel-library-of-babel. I wonder what's up.


=

On Tue,= Apr 3, 2018 at 4:44 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr&= gt; wrote:
Lawren= ce Bottorff <borgauf@gmail.com&= gt; writes:

> I've been trying to grok LOB again. So I've cloned the worg gi= t and
> library-of-babel.el is one of the files. org-babel-lob-injest didn'= ;t
> work,

What doesn't work? You call `org-babel-lob-ingest', specify = a file, and
it stores all source code blocks in the file for later use.

> Now, in my org file I put this:
>
> #+lob: write(file=3D"jsontest")

This should be #+call: write(...)

>
> and try C-c C-c on it. Nothing. My minibuffer says "local setup h= as been
> refreshed". How does one use, call a LOB function? Also, while I&= #39;m
> demonstrating my rank noobian-ness, I try this:
>
> #+name: myelsquare
> #+header: :var x=3D0
>
> #+begin_src emacs-lisp
>=C2=A0 =C2=A0(* x x)
> #+end_src
>
> #+call: myelsquare(x=3D6)
>
> #+RESULTS: : 36
>
> but this results in
>
> #+name: myelsquare
> #+header: :var x=3D0
>
> #+begin_src emacs-lisp
>=C2=A0 =C2=A0(defun myelsquare (x)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(* x x))
> #+end_src
>
> #+call: myelsquare(x=3D6)
>
> #+RESULTS:
> : myelsquare2
>
> After a #+call:... I use C-c C-c to evaluate it. What am I missing
> here?

Your second block defines a function, but doesn't return its res= ults.
"#+call: myelsquare(...)" expects to find a block named "mye= lsquare",
not an Elisp function named "myelsquare".

Regards,

--
Nicolas Goaziou

--000000000000e5584b05690dad13--