ob-hy
enables Org-Babel support for evaluating Hy code.
It was created based on the usage of ob-template.
(print "hello world")
#+BEGIN_SRC hy :var a=3 b=5 (+ a b) #+END_SRC
#+RESULTS: : 8
#+NAME: tel-note | name | tel | |-------+--------| | brant | 170... | | ou | 138... |
#+BEGIN_SRC hy :var tb=tel-note :results output table (print tb) #+END_SRC
#+RESULTS: : ((u'brant' u'170...') (u'ou' u'138...'))
#+BEGIN_SRC hy :var lst='("1" "2" "3") :results output (print lst) #+END_SRC
#+RESULTS: : (u'1' u'2' u'3')
#+NAME: square #+BEGIN_SRC hy (defn square [x] (* x x)) #+END_SRC
#+NAME: calc-square #+BEGIN_SRC hy :var x=0 :noweb strip-export :results output <<square>> (print (square x)) #+END_SRC
#+RESULTS: calc-square : 0
#+CALL: calc-square(x=5)
#+RESULTS: : 25
#+BEGIN_SRC hy :session hylang :results output (print "hello world") (defn square [x] (* x x)) (print (square 5)) #+END_SRC
#+RESULTS: : hello world : ... 25
Tests can be executed by make test or invoking emacs directly with the command-line below:
emacs -Q --batch -q \
-L . \
-l ob-hy.el \
-l test-ob-hy.el \
--eval "(progn \
(setq org-confirm-babel-evaluate nil) \
(org-babel-do-load-languages \
'org-babel-load-languages '((emacs-lisp . t) \
(sh . t) \
(org . t) \
(hy . t))))" \
-f ob-hy-test-runall