* Library of Babel usage of other programming languages than elisp
@ 2021-08-09 12:52 Zelphir Kaltstahl
2021-08-09 13:34 ` Eric S Fraga
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Zelphir Kaltstahl @ 2021-08-09 12:52 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 3031 bytes --]
Hello Org-mode users!
I have repeatedly tried to use another programming language than elisp for
writing source blocks in org-mode, which I intended to use as functions inside
org-mode spreadsheets. So far without success.
Here is my latest attempt:
~~~~ START ~~~~
#+HEADER: :var dt1="uninitialized1" dt2="uninitialized2"
#+name: org-lob-timediff
#+begin_src scheme
(import
(ice-9 format)
(srfi srfi-19))
(define org-timestamp->time-utc
(λ (timestamp-string)
(let ([parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]")])
(date->time-utc parsed-date))))
(define duration->hours
(λ (duration)
;; 1h = 60min = 3600s
(/ (time-second duration) 3600)))
(define org-lob-timediff
(λ (org-dt1 org-dt2)
;; formatting float:
;; ~@width, decimals, scale, overflowchar, padchar
;; ~ placeholder is following
;; @ with sign if negative
;; width: minimum width
;; decimals: minimum number of digits after decimal point
;; scale: ???
;; overflowchar: ???
;; padchar: char to use for padding
(format #f
"~,2f"
(number->string
(exact->inexact
(duration->hours
(time-difference (org-timestamp->time-utc org-dt2)
(org-timestamp->time-utc org-dt1))))))))
#+end_src
#+CALL: org-lob-timediff(dt1="[2021-01-01 Fri 00:00]", dt2="[2021-01-01 Fri 01:45]")
#+RESULTS:
~~~~ END ~~~~
This code works just fine in geiser using GNU Guile:
~~~~ START ~~~~
scheme@(guile-user)> (org-lob-timediff "[2021-01-01 Fri 00:00]" "[2021-01-01 Fri 01:45]")
$4 = "1.75"
~~~~ END ~~~~
However, when I C-c C-c the `CALL` line to actually run the code using library
of babel, as a precursor to using `org-sbe` inside a spreadsheet, it fails! I
see the following in my *Messages* buffer:
~~~~ START ~~~~
executing Scheme code block...
(dt1 '"[2021-01-01 Fri 00:00]")
(dt2 '"[2021-01-01 Fri 01:45]")
Starting Geiser REPL ... [3 times]
Guile REPL up and running!
Debug REPL. Enter ,q to quit, ,h for help.
=> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong type to apply: #<syntax-transformer time-second>
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
Error during redisplay: (jit-lock-function 315) signaled (wrong-type-argument markerp nil)
Code block evaluation complete.
~~~~ END ~~~~
So something obviously is getting confused. `time-second` is not a
syntax-transformer. It is a procedure:
~~~~ START ~~~~
scheme@(guile-user)> time-second
$5 = #<procedure %time-second-procedure (s)>
~~~~ END ~~~~
Now I have many questions:
+ What am I doing wrong? How comes perfectly valid code does not work in LOB?
+ Can LOB even be used with other languages than Elisp?
+ Almost all examples I see online are elisp only. Perhaps I am trying to do
something, that is impossible with current Org-mode and Library of Babel?
Best regards,
Zelphir
--
repositories: https://notabug.org/ZelphirKaltstahl
[-- Attachment #2: Type: text/html, Size: 3611 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 12:52 Library of Babel usage of other programming languages than elisp Zelphir Kaltstahl
@ 2021-08-09 13:34 ` Eric S Fraga
2021-08-09 14:25 ` Zelphir Kaltstahl
2021-08-09 15:23 ` Greg Minshall
2021-08-10 5:49 ` Dr. Arne Babenhauserheide
2 siblings, 1 reply; 11+ messages in thread
From: Eric S Fraga @ 2021-08-09 13:34 UTC (permalink / raw)
To: Zelphir Kaltstahl; +Cc: emacs-orgmode
On Monday, 9 Aug 2021 at 12:52, Zelphir Kaltstahl wrote:
> I have repeatedly tried to use another programming language than elisp
> for writing source blocks in org-mode, which I intended to use as
> functions inside org-mode spreadsheets. So far without success.
I cannot help you directly with this but I can say that I use library of
babel with awk scripts successfully quite often. Is the call within the
same document? If it is, the issue won't be library of babel support in
any case, as far as I can tell.
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-617-g926dba
: Latest paper written in org: https://arxiv.org/abs/2106.05096
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 13:34 ` Eric S Fraga
@ 2021-08-09 14:25 ` Zelphir Kaltstahl
2021-08-09 15:11 ` Eric S Fraga
0 siblings, 1 reply; 11+ messages in thread
From: Zelphir Kaltstahl @ 2021-08-09 14:25 UTC (permalink / raw)
To: e.fraga; +Cc: Org Mode List
Hi Eric,
the call in this case can be in the same document. I could copy the code to each
document I intend to use it in, without much of a problem. Neater would of
course be to have it in a global file, collecting all sorts of snippets/functions.
Regards,
Zelphir
On 8/9/21 3:34 PM, Eric S Fraga wrote:
> On Monday, 9 Aug 2021 at 12:52, Zelphir Kaltstahl wrote:
>> I have repeatedly tried to use another programming language than elisp
>> for writing source blocks in org-mode, which I intended to use as
>> functions inside org-mode spreadsheets. So far without success.
> I cannot help you directly with this but I can say that I use library of
> babel with awk scripts successfully quite often. Is the call within the
> same document? If it is, the issue won't be library of babel support in
> any case, as far as I can tell.
>
--
repositories: https://notabug.org/ZelphirKaltstahl
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 14:25 ` Zelphir Kaltstahl
@ 2021-08-09 15:11 ` Eric S Fraga
2021-08-09 16:03 ` Zelphir Kaltstahl
0 siblings, 1 reply; 11+ messages in thread
From: Eric S Fraga @ 2021-08-09 15:11 UTC (permalink / raw)
To: Zelphir Kaltstahl; +Cc: Org Mode List
On Monday, 9 Aug 2021 at 14:25, Zelphir Kaltstahl wrote:
> the call in this case can be in the same document. I could copy the
> code to each document I intend to use it in, without much of a
> problem. Neater would of course be to have it in a global file,
> collecting all sorts of snippets/functions.
Indeed. I was asking for clarification: does the CALL work when in the
same document but not otherwise? For me, I can access awk scripts from
other documents using LOB with no problem.
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-617-g926dba
: Latest paper written in org: https://arxiv.org/abs/2106.05096
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 12:52 Library of Babel usage of other programming languages than elisp Zelphir Kaltstahl
2021-08-09 13:34 ` Eric S Fraga
@ 2021-08-09 15:23 ` Greg Minshall
2021-08-09 16:27 ` Zelphir Kaltstahl
2021-08-10 5:49 ` Dr. Arne Babenhauserheide
2 siblings, 1 reply; 11+ messages in thread
From: Greg Minshall @ 2021-08-09 15:23 UTC (permalink / raw)
To: Zelphir Kaltstahl; +Cc: emacs-orgmode
Zelphir,
actually...
Everybody,
i have an awkwardness about not being clear of the meaning of "Library
of Babel". my sense is it a collection of "subroutines".
in my typical use of Org mode for programming, all my code blocks are
defined in the same .org file, and executed in that file, or tangled to
external files (normally, scripts). i do use <<noweb>> to include bits
from one part of the same file to the code in another part. i don't
know if this means i am using the Library of Babel or not.
then, on to...
Zelphir,
i also don't know what is going on. but, installing geiser,
geiser-guile, and running your code from the source block, looking at
the output results, i get an error that might mean something to you?
see below. (notice i embedded your call to =org-lob-timediff= at the
end of your source code.)
in addition to with elisp, i use org src blocks with R, shell scripts,
awk, etc. but, never (till now!) with scheme.
hth. good luck. i'll be curious what your next steps are.
cheers, Greg
----
#+HEADER: :var dt1="uninitialized1" dt2="uninitialized2"
#+name: org-lob-timediff
#+begin_src scheme :results output
(import
(ice-9 format)
(srfi srfi-19))
(define org-timestamp->time-utc
(λ (timestamp-string)
(let ([parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]")])
(date->time-utc parsed-date))))
(define duration->hours
(λ (duration)
;; 1h = 60min = 3600s
(/ (time-second duration) 3600)))
(define org-lob-timediff
(λ (org-dt1 org-dt2)
;; formatting float:
;; ~@width, decimals, scale, overflowchar, padchar
;; ~ placeholder is following
;; @ with sign if negative
;; width: minimum width
;; decimals: minimum number of digits after decimal point
;; scale: ???
;; overflowchar: ???
;; padchar: char to use for padding
(format #f
"~,2f"
(number->string
(exact->inexact
(duration->hours
(time-difference (org-timestamp->time-utc org-dt2)
(org-timestamp->time-utc org-dt1))))))))
(org-lob-timediff "[2021-01-01 Fri 00:00]" "[2021-01-01 Fri 01:45]")
#+end_src
#+RESULTS: org-lob-timediff
: ice-9/boot-9.scm:222:17: In procedure map1:
: Syntax error:
: unknown file:12:0: definition in expression context, where definitions are not allowed, in form (define org-timestamp->time-utc (λ (timestamp-string) (let ((parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]"))) (date->time-utc parsed-date))))
:
: Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
: scheme@(guile-user) [1]>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 15:11 ` Eric S Fraga
@ 2021-08-09 16:03 ` Zelphir Kaltstahl
2021-08-10 13:18 ` Eric S Fraga
0 siblings, 1 reply; 11+ messages in thread
From: Zelphir Kaltstahl @ 2021-08-09 16:03 UTC (permalink / raw)
To: Org Mode List
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
The CALL does not work at all for me, not even in the same document, while the
code works just fine in geiser. It results in and empty "#+RESULTS:" being
output below the "#+CALL: ..." and the error in *Messages*.
I did not mention, that I did the lob ingest step as well. Sorry for incomplete
information.
My Emacs version is:
~~~~ START ~~~~
GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
~~~~ END ~~~~
And my version of org is:
~~~~ START ~~~~
Package org is built-in.
Status: Built-In.
Version: 9.4.4
Summary: Export Framework for Org Mode
Required by: ob-async-20200921.205
Other versions: 9.4.6 (gnu).
~~~~ END ~~~~
Thank you,
Zelphir
On 8/9/21 5:11 PM, Eric S Fraga wrote:
> On Monday, 9 Aug 2021 at 14:25, Zelphir Kaltstahl wrote:
>> the call in this case can be in the same document. I could copy the
>> code to each document I intend to use it in, without much of a
>> problem. Neater would of course be to have it in a global file,
>> collecting all sorts of snippets/functions.
> Indeed. I was asking for clarification: does the CALL work when in the
> same document but not otherwise? For me, I can access awk scripts from
> other documents using LOB with no problem.
>
--
repositories: https://notabug.org/ZelphirKaltstahl
[-- Attachment #2: Type: text/html, Size: 2204 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 15:23 ` Greg Minshall
@ 2021-08-09 16:27 ` Zelphir Kaltstahl
2021-08-09 18:36 ` Greg Minshall
0 siblings, 1 reply; 11+ messages in thread
From: Zelphir Kaltstahl @ 2021-08-09 16:27 UTC (permalink / raw)
To: Greg Minshall; +Cc: Org Mode List
[-- Attachment #1: Type: text/plain, Size: 6157 bytes --]
Hi Greg!
On 8/9/21 5:23 PM, Greg Minshall wrote:
> Zelphir,
>
> actually...
>
> Everybody,
>
> i have an awkwardness about not being clear of the meaning of "Library
> of Babel". my sense is it a collection of "subroutines".
>
> in my typical use of Org mode for programming, all my code blocks are
> defined in the same .org file, and executed in that file, or tangled to
> external files (normally, scripts). i do use <<noweb>> to include bits
> from one part of the same file to the code in another part. i don't
> know if this means i am using the Library of Babel or not.
I love noweb and literate programming facilities. Have done the same thing
multiple times, especially, when there was some code I want to learn about and
understand or simply explain to my future self. My best example is at:
https://notabug.org/ZelphirKaltstahl/the-little-schemer/src/master/chapter-09-y-combinator/code.org
<https://notabug.org/ZelphirKaltstahl/the-little-schemer/src/master/chapter-09-y-combinator/code.org>
Big fan of noweb : )
> then, on to...
>
> Zelphir,
>
> i also don't know what is going on. but, installing geiser,
> geiser-guile, and running your code from the source block, looking at
> the output results, i get an error that might mean something to you?
> see below. (notice i embedded your call to =org-lob-timediff= at the
> end of your source code.)
>
> in addition to with elisp, i use org src blocks with R, shell scripts,
> awk, etc. but, never (till now!) with scheme.
>
> hth. good luck. i'll be curious what your next steps are.
>
> cheers, Greg
> ----
>
> #+HEADER: :var dt1="uninitialized1" dt2="uninitialized2"
> #+name: org-lob-timediff
> #+begin_src scheme :results output
> (import
> (ice-9 format)
> (srfi srfi-19))
>
>
> (define org-timestamp->time-utc
> (λ (timestamp-string)
> (let ([parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]")])
> (date->time-utc parsed-date))))
>
>
> (define duration->hours
> (λ (duration)
> ;; 1h = 60min = 3600s
> (/ (time-second duration) 3600)))
>
>
> (define org-lob-timediff
> (λ (org-dt1 org-dt2)
> ;; formatting float:
>
> ;; ~@width, decimals, scale, overflowchar, padchar
>
> ;; ~ placeholder is following
> ;; @ with sign if negative
> ;; width: minimum width
> ;; decimals: minimum number of digits after decimal point
> ;; scale: ???
> ;; overflowchar: ???
> ;; padchar: char to use for padding
>
> (format #f
> "~,2f"
> (number->string
> (exact->inexact
> (duration->hours
> (time-difference (org-timestamp->time-utc org-dt2)
> (org-timestamp->time-utc org-dt1))))))))
> (org-lob-timediff "[2021-01-01 Fri 00:00]" "[2021-01-01 Fri 01:45]")
> #+end_src
>
> #+RESULTS: org-lob-timediff
> : ice-9/boot-9.scm:222:17: In procedure map1:
> : Syntax error:
> : unknown file:12:0: definition in expression context, where definitions are not allowed, in form (define org-timestamp->time-utc (λ (timestamp-string) (let ((parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]"))) (date->time-utc parsed-date))))
> :
> : Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
> : scheme@(guile-user) [1]>
Hmmm this might be a GNU Guile version difference. I remember something about
definition context changing in something like Guile 3.0.3 or so, allowing
definitions in more places than before. For me this error does not happen, as I
use GNU Guile 3.0.7 currently:
~~~~ START ~~~~
scheme@(guile-user)> (version)
$6 = "3.0.7"
~~~~ END ~~~~
Perhaps org-babel for Guile (I think ob-scheme? or ob-guile?) wraps everything
inside another (define ...) and that causes an error with the definition context.
What I did notice before is, that the set locale seems to matter for the short
names of weekdays and can lead to an error, but that was on another laptop and
not on this system:
~~~~ START ~~~~
executing Scheme code block (org-lob-timediff)...
(dt1 '"uninitialized1")
(dt2 '"uninitialized2")
Starting Geiser REPL ... [3 times]
Guile REPL up and running!
Debug REPL. Enter ,q to quit, ,h for help.
=> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string->date: TIME-ERROR type bad-date-format-string: "[~Y-~m-~d ~a ~H:~M]"
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
Error during redisplay: (jit-lock-function 315) signaled (wrong-type-argument markerp nil)
Code block evaluation complete.
~~~~ END ~~~~
But that is a Guile thing and nothing to do with LOB and easily fixed.
I began collecting small snippets and facts about whatever I learn about Emacs
in sone repository: https://notabug.org/ZelphirKaltstahl/emacs-usage-guide
<https://notabug.org/ZelphirKaltstahl/emacs-usage-guide>. Not much there yet,
but I will add a working example of LOB, if I can manage to get it working.
Perhaps I will also split that in a separate file.
I already got a small example working (not forgetting to run C-c C-v i or
`org-babel-lob-ingest` before C-c C-c on the CALL line):
~~~~ START ~~~~
#+HEADER: :var input-str="unspecified"
#+name: org-lob-upcase
#+begin_src scheme
(define upcase
(λ (str)
(string-upcase str)))
(upcase input-str)
#+end_src
#+CALL: org-lob-upcase(input-str="test")
#+RESULTS:
: TEST
~~~~ END ~~~~
So it does not seem to be completely impossible then. The whole
syntax-transformer instead of procedure error message thing makes me think, that
perhaps it is not using the correct version of Guile or something, so I did the
following experiment:
~~~~ START ~~~~
#+name: org-lob-guile-version
#+begin_src scheme
(version)
#+end_src
#+CALL: org-lob-guile-version()
#+RESULTS:
: 3.0.7
~~~~ END ~~~~
Seems to work fine.
So I still have not understood, what the actual issue is with the timediff
function. Perhaps it is something about the imports.
Thanks for taking the time to try and reproduce the behavior!
Best regards,
Zelphir
--
repositories: https://notabug.org/ZelphirKaltstahl
[-- Attachment #2: Type: text/html, Size: 7191 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 16:27 ` Zelphir Kaltstahl
@ 2021-08-09 18:36 ` Greg Minshall
0 siblings, 0 replies; 11+ messages in thread
From: Greg Minshall @ 2021-08-09 18:36 UTC (permalink / raw)
To: Zelphir Kaltstahl; +Cc: Org Mode List
Zelphir,
> So I still have not understood, what the actual issue is with the
> timediff function. Perhaps it is something about the imports.
>
> Thanks for taking the time to try and reproduce the behavior!
you're welcome. if there's something else i might try, i'll be happy to
try (to try).
good luck.
cheers, Greg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 12:52 Library of Babel usage of other programming languages than elisp Zelphir Kaltstahl
2021-08-09 13:34 ` Eric S Fraga
2021-08-09 15:23 ` Greg Minshall
@ 2021-08-10 5:49 ` Dr. Arne Babenhauserheide
2021-08-11 10:01 ` Zelphir Kaltstahl
2 siblings, 1 reply; 11+ messages in thread
From: Dr. Arne Babenhauserheide @ 2021-08-10 5:49 UTC (permalink / raw)
To: Zelphir Kaltstahl; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2362 bytes --]
Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:
> I have repeatedly tried to use another programming language than elisp for
> writing source blocks in org-mode, which I intended to use as functions inside
> org-mode spreadsheets. So far without success.
I’m using scheme in org-mode during export (though not it tables) and
that works.
call: https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=ccc9148e78a4#L27
begin_src: https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=ccc9148e78a4#L137
#+call: generate-char-jetzt()
#+name: generate-char-jetzt
#+begin_src scheme :exports none :results output raw :prologue "(import (srfi srfi-1)(ice-9 match)(ice-9 receive))(set! *random-state* (random-state-from-platform))\n" :tangle chargen.scm :noweb yes :var kernantriebe=tabelle-grundantriebe :var hautfarbe=tabelle-hautfarbe :var haarfarbe=tabelle-haarfarbe :var augenfarbe=tabelle-augenfarbe :var darstellung1=tabelle-darstellung1 :var darstellung2=tabelle-darstellung2 :var kleidung_oben_maenner=tabelle-kleidung-jetzt-oben-maenner :var kleidung_unten_maenner=tabelle-kleidung-jetzt-unten-maenner :var kleidung_oben_frauen=tabelle-kleidung-jetzt-oben-frauen :var kleidung_unten_frauen=tabelle-kleidung-jetzt-unten-frauen :var kleidung_oben_frauen=tabelle-kleidung-jetzt-oben-frauen :var kleidung_unten_frauen=tabelle-kleidung-jetzt-unten-frauen :var namen=tabelle-namen-fantasy-jetzt :var sex=tabelle-sexualitaet :var stichwort=tabelle-stichwort-jetztzeit
(let ()
{{{chargen-setup}}}
{{{chargen-generic}}}
{{{chargen-colors}}}
{{{chargen-specifics-jetzt}}}
{{{chargen-print-char}}}
(chargen-print-char)
)
#+end_src
#+begin_src scheme :noweb-ref chargen-specifics-jetzt
(define first-names
(map first
(map string-split-space
(map third
(remove (λ(x)(not (equal? geschlecht (fourth x)))) namen)))))
(define last-names (map (λ (x) (string-join (cdr x))) (map string-split-space (map third namen))))
(define names (apply append (map (λ (fi) (map (λ(la) (string-join (list fi la))) last-names)) first-names)))
;; (define worte (list->d6alist (second (apply zip zweiworte))))
#+end_src
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-09 16:03 ` Zelphir Kaltstahl
@ 2021-08-10 13:18 ` Eric S Fraga
0 siblings, 0 replies; 11+ messages in thread
From: Eric S Fraga @ 2021-08-10 13:18 UTC (permalink / raw)
To: Zelphir Kaltstahl; +Cc: Org Mode List
On Monday, 9 Aug 2021 at 16:03, Zelphir Kaltstahl wrote:
> The CALL does not work at all for me, not even in the same document, while the
> code works just fine in geiser. It results in and empty "#+RESULTS:" being
> output below the "#+CALL: ..." and the error in *Messages*.
Which indicates that the problem is not the library of babel but the
CALL itself.
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-617-g926dba
: Latest paper written in org: https://arxiv.org/abs/2106.05096
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Library of Babel usage of other programming languages than elisp
2021-08-10 5:49 ` Dr. Arne Babenhauserheide
@ 2021-08-11 10:01 ` Zelphir Kaltstahl
0 siblings, 0 replies; 11+ messages in thread
From: Zelphir Kaltstahl @ 2021-08-11 10:01 UTC (permalink / raw)
To: Dr. Arne Babenhauserheide; +Cc: emacs-orgmode
Hello Arne!
Thanks for that.
Do you happen to have an example, in which you are passing arguments to a procedure?
Regards,
Zelphir
On 8/10/21 7:49 AM, Dr. Arne Babenhauserheide wrote:
> Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:
>
>> I have repeatedly tried to use another programming language than elisp for
>> writing source blocks in org-mode, which I intended to use as functions inside
>> org-mode spreadsheets. So far without success.
> I’m using scheme in org-mode during export (though not it tables) and
> that works.
>
> call: https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=ccc9148e78a4#L27
>
> begin_src: https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=ccc9148e78a4#L137
>
> #+call: generate-char-jetzt()
>
> #+name: generate-char-jetzt
> #+begin_src scheme :exports none :results output raw :prologue "(import (srfi srfi-1)(ice-9 match)(ice-9 receive))(set! *random-state* (random-state-from-platform))\n" :tangle chargen.scm :noweb yes :var kernantriebe=tabelle-grundantriebe :var hautfarbe=tabelle-hautfarbe :var haarfarbe=tabelle-haarfarbe :var augenfarbe=tabelle-augenfarbe :var darstellung1=tabelle-darstellung1 :var darstellung2=tabelle-darstellung2 :var kleidung_oben_maenner=tabelle-kleidung-jetzt-oben-maenner :var kleidung_unten_maenner=tabelle-kleidung-jetzt-unten-maenner :var kleidung_oben_frauen=tabelle-kleidung-jetzt-oben-frauen :var kleidung_unten_frauen=tabelle-kleidung-jetzt-unten-frauen :var kleidung_oben_frauen=tabelle-kleidung-jetzt-oben-frauen :var kleidung_unten_frauen=tabelle-kleidung-jetzt-unten-frauen :var namen=tabelle-namen-fantasy-jetzt :var sex=tabelle-sexualitaet :var stichwort=tabelle-stichwort-jetztzeit
> (let ()
> {{{chargen-setup}}}
> {{{chargen-generic}}}
> {{{chargen-colors}}}
> {{{chargen-specifics-jetzt}}}
> {{{chargen-print-char}}}
> (chargen-print-char)
> )
> #+end_src
>
> #+begin_src scheme :noweb-ref chargen-specifics-jetzt
> (define first-names
> (map first
> (map string-split-space
> (map third
> (remove (λ(x)(not (equal? geschlecht (fourth x)))) namen)))))
> (define last-names (map (λ (x) (string-join (cdr x))) (map string-split-space (map third namen))))
> (define names (apply append (map (λ (fi) (map (λ(la) (string-join (list fi la))) last-names)) first-names)))
> ;; (define worte (list->d6alist (second (apply zip zweiworte))))
>
> #+end_src
>
> Best wishes,
> Arne
--
repositories: https://notabug.org/ZelphirKaltstahl
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-08-11 10:02 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-09 12:52 Library of Babel usage of other programming languages than elisp Zelphir Kaltstahl
2021-08-09 13:34 ` Eric S Fraga
2021-08-09 14:25 ` Zelphir Kaltstahl
2021-08-09 15:11 ` Eric S Fraga
2021-08-09 16:03 ` Zelphir Kaltstahl
2021-08-10 13:18 ` Eric S Fraga
2021-08-09 15:23 ` Greg Minshall
2021-08-09 16:27 ` Zelphir Kaltstahl
2021-08-09 18:36 ` Greg Minshall
2021-08-10 5:49 ` Dr. Arne Babenhauserheide
2021-08-11 10:01 ` Zelphir Kaltstahl
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).