emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Modules, libraries, eggs, etc.
@ 2016-09-06 19:17 Lawrence Bottorff
  2016-09-06 19:55 ` John Kitchin
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Bottorff @ 2016-09-06 19:17 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

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

Racket has a nice module system whereby a module is kept in a plain text
.rkt file. For example,

#lang racket
(provide print-cake)
; draws a cake with n candles
(define (print-cake n)
  (show "   ~a   " n #\.)
  (show " .-~a-. " n #\|)
  (show " | ~a | " n #\space)
  (show "---~a---" n #\-))

(define (show fmt n ch)
  (printf fmt (make-string n ch))
  (newline))

is in cake.rkt so that

#+begin_src scheme :session ch2
(require "cake.rkt")
(print-cake (random 30))
#+end_src

produces the actual ascii -- albeit in the *Geiser dbg* buffer (or run from
the associated REPL ch2):

; -*- geiser-scheme-implementation: racket -*-
(require "cake.rkt")
(print-cake (random 30))


=> #<void>

   .......................
 .-|||||||||||||||||||||||-.
 |                         |
-----------------------------

So, this means I can do some Racket in org-mode, but the module side has to
be outside. This seems not so elegant. Is there a babel language where the
entire ecosystem is inside Emacs/org-mode? I'd like to have the module
paradigm and have it all inside Emacs/org-mode.

LB

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

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

* Re: Modules, libraries, eggs, etc.
  2016-09-06 19:17 Modules, libraries, eggs, etc Lawrence Bottorff
@ 2016-09-06 19:55 ` John Kitchin
  0 siblings, 0 replies; 2+ messages in thread
From: John Kitchin @ 2016-09-06 19:55 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

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

It sounds like you should incorporate some tangling prior to running some
blocks so that the external files would exist when required.

The only other approach is something like a :session. I don't know if that
is setup for scheme/racket though.

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Tue, Sep 6, 2016 at 3:17 PM, Lawrence Bottorff <borgauf@gmail.com> wrote:

> Racket has a nice module system whereby a module is kept in a plain text
> .rkt file. For example,
>
> #lang racket
> (provide print-cake)
> ; draws a cake with n candles
> (define (print-cake n)
>   (show "   ~a   " n #\.)
>   (show " .-~a-. " n #\|)
>   (show " | ~a | " n #\space)
>   (show "---~a---" n #\-))
>
> (define (show fmt n ch)
>   (printf fmt (make-string n ch))
>   (newline))
>
> is in cake.rkt so that
>
> #+begin_src scheme :session ch2
> (require "cake.rkt")
> (print-cake (random 30))
> #+end_src
>
> produces the actual ascii -- albeit in the *Geiser dbg* buffer (or run
> from the associated REPL ch2):
>
> ; -*- geiser-scheme-implementation: racket -*-
> (require "cake.rkt")
> (print-cake (random 30))
>
>
> => #<void>
>
>    .......................
>  .-|||||||||||||||||||||||-.
>  |                         |
> -----------------------------
>
> So, this means I can do some Racket in org-mode, but the module side has
> to be outside. This seems not so elegant. Is there a babel language where
> the entire ecosystem is inside Emacs/org-mode? I'd like to have the module
> paradigm and have it all inside Emacs/org-mode.
>
> LB
>

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

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

end of thread, other threads:[~2016-09-06 21:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 19:17 Modules, libraries, eggs, etc Lawrence Bottorff
2016-09-06 19:55 ` John Kitchin

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).