README
Motivation
fn
is ok, but we prefer 位
or lambda
; for instance:
(def identity
"Returns its argument."
(位 [x] x))
or even def位
:
(def位 identity
"Returns its argument."
[x] x)
Usage
See Clojars; in Leiningen, add the following to your dependencies in
project.clj
:
[lambda "1.0.1-SNAPSHOT"]
or in Maven, to your pom.xml
:
<dependency>
<groupId>lambda</groupId>
<artifactId>lambda</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
Typing 位
Enable 位 as the result of typing Compose-l-l
(or Multikey-l-l
)
by adding the following to ~/.Xcompose
:
<Multi_key> <l> <l> : "位" U03BB # GREEK SMALL LETTER LAMBDA
Emacs
Add the following to ~/.emacs
to make lambda
, 位
and def位
behave like e.g. fn
and defn
with respect to highlighting and
indentation:
(add-hook
'clojure-mode-hook
(lambda ()
(font-lock-add-keywords
nil
`((,(concat "(\\(?:lambda.core/\\)?\\(def位\\)\\>"
;; Any whitespace
"[ \r\n\t]*"
;; Possibly type or metadata
"\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*"
"\\(\\sw+\\)?")
(1 font-lock-keyword-face)
(2 font-lock-function-name-face nil t))
(,(concat "(\\(?:lambda.core/\\)?"
(regexp-opt '("def位"
"位"
"lambda") t)
"\\>"
)
1 font-lock-builtin-face)))))
(put 'def位 'clojure-doc-string-elt 2)
(put 'def位 'clojure-indent-function 'defun)
(put '位 'clojure-indent-function 'defun)
(put 'lambda 'clojure-indent-function 'defun)