https://github.com/brantou/ob-hy
Org-Babel support for evaluating hylang code.
https://github.com/brantou/ob-hy
emacs-lisp hylang org-babel
Last synced: 8 months ago
JSON representation
Org-Babel support for evaluating hylang code.
- Host: GitHub
- URL: https://github.com/brantou/ob-hy
- Owner: brantou
- Created: 2017-09-02T13:39:20.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-01-18T13:29:38.000Z (over 4 years ago)
- Last Synced: 2025-01-13T06:08:38.383Z (9 months ago)
- Topics: emacs-lisp, hylang, org-babel
- Language: Emacs Lisp
- Homepage:
- Size: 39.1 KB
- Stars: 24
- Watchers: 6
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+TITLE: ob-hy
[[https://travis-ci.org/brantou/ob-hy][file:https://travis-ci.org/brantou/ob-hy.svg?branch=master]]
[[https://melpa.org/#/ob-hy][file:https://melpa.org/packages/ob-hy-badge.svg]][[https://stable.melpa.org/#/ob-hy][file:https://stable.melpa.org/packages/ob-hy-badge.svg]]
* Introduction
:PROPERTIES:
:ID: 614a110c-77b2-41f8-9714-ce311ff1acb0
:END:=ob-hy= enables [[http://orgmode.org/worg/org-contrib/babel/intro.html][Org-Babel]] support for evaluating [[http://hylang.org/][Hy]] code.
It was created based on the usage of [[./ob-template.el][ob-template]].#+BEGIN_SRC hy :results output
(print "hello world")
#+END_SRC#+RESULTS:
: hello world* Examples
:PROPERTIES:
:ID: 98dc532f-d354-4d5e-a4ba-2489ad02730b
:END:
** variables
:PROPERTIES:
:ID: e4f5eca1-cbd3-4a46-a8f3-ba92a2b869f6
:END:
: #+BEGIN_SRC hy :var a=3 b=5
: (+ a b)
: #+END_SRC: #+RESULTS:
: : 8
** table and list
:PROPERTIES:
:ID: 7beff92a-3dc6-47ad-9898-0dbbad5b090f
:END:
: #+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')** literate programming
:PROPERTIES:
:ID: 92a873f1-0fd5-46de-8e3c-104bc2c91c01
:END:
: #+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
: <>
: (print (square x))
: #+END_SRC: #+RESULTS: calc-square
: : 0: #+CALL: calc-square(x=5)
: #+RESULTS:
: : 25** session
:PROPERTIES:
:ID: ea79d97b-4b6c-48f6-8154-6de10ee5e40c
:END:
: #+BEGIN_SRC hy :session hylang :results output
: (print "hello world")
: (defn square [x]
: (* x x))
: (print (square 5))
: #+END_SRC: #+RESULTS:
: : hello world
: : ... 25* Running tests
:PROPERTIES:
:ID: 82cd12e6-b401-439a-9da5-03f0cf6e8e89
:END:
Tests can be executed by /make test/ or invoking emacs directly with
the command-line below:#+BEGIN_SRC shell
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
#+END_SRC