emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Babel support for Stan


From: Nicolas Goaziou
Subject: Re: [O] Babel support for Stan
Date: Mon, 24 Aug 2015 16:51:26 +0200

Hello,

Kyle Meyer <address@hidden> writes:

> I'd like to put ob-stan.el (attached) in the contrib directory.  It adds
> support for the Stan [1] programming language.  I wrote it a while back,
> but a recent post on the Stan ML [2] made me think that others may find
> it useful (although I'd guess that the intersection of Stan and Org
> users is quite small).  It's short because the only output that really
> makes sense is to dump the contents to a file (and maybe compile it),
> which is then used by a downstream interface [3].

Thank you.

> Please let me know if you have any comments about the implementation or
> if you don't think contrib directory is a good place for it.

I think core is fine for new languages, but you need to update file
headers accordingly.

A few comments follow.
> (defun org-babel-execute:stan (body params)
>   "Execute a block of Stan code with org-babel.
> A :file header argument must be given.  If
> `org-babel-stan-cmdstan-directory' is non-nil and the file name
> does not have a \".stan\" extension, compile the block to file.
> Otherwise, write the Stan code to the file."

BODY and PARAMS references are missing from docstring.

>   (let ((file (expand-file-name
>              (or (cdr (assoc :file params))

Nitpick: `assoc' -> `:assq'.

>                  (user-error "Set :file argument to execute Stan blocks")))))
>     (if (or (not org-babel-stan-cmdstan-directory)
>           (org-string-match-p "\\.stan\\'" file))
>       (with-temp-file file (insert body))
>       (with-temp-file (concat file ".stan") (insert body))
>       (let ((default-directory org-babel-stan-cmdstan-directory))
>       (call-process-shell-command (concat "make " file))))

You don't use `org-babel-stan-cmdstan-directory' to store FILE, i.e.,
FILE is saved in current directory, or any directory provided in its
path, which doesn't necessarily match
`org-babel-stan-cmdstan-directory'. Yet, make is called on
`org-babel-stan-cmdstan-directory'.

Is it intentional?

>     nil)) ;; Signal that output has been written to file.

Nitpick: one semi-colon only for end of line comments.

Regards,

-- 
Nicolas Goaziou



reply via email to

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