various eval
functions for Clojure
(use '[evalive.core :only (evil destro wtfn)])
(evil '{message "Hello", place "Cleveland"}
'(println message place))
; Hello Cleveland
(destro [message place] ["Hello" "Cleveland"])
;=> {vec__2438 [Hello Cleveland], message Hello, place Cleveland}
(evil (destro [message place] ["Hello" "Cleveland"])
'(println message place))
; Hello Cleveland
(def callable-and (wtf clojure.core.and))
(callable-and true 1 2 3 {} true 42)
;=> 42
(def destruction (wtfn destro))
(map #(apply destruction %)
[['[h & t] [1 2 3 4 5]]
['[car cdr] [:first :rest]]
['[a b [c d & e] :as Z] [1 2 [3 4 5 6 7 8]]]])
;=> ({vec__2220 [1 2 3 4 5], h 1, t (2 3 4 5)}
{vec__2223 [:first :rest], car :first, cdr :rest}
{vec__2226 [1 2 [3 4 5 6 7 8]],
a 1,
b 2,
vec__2227 [3 4 5 6 7 8],
c 3,
d 4,
e (5 6 7 8),
Z [1 2 [3 4 5 6 7 8]]})
Modify your Leiningen dependencies to include evalive:
:dependencies [[evalive "1.1.0"] ...]
Add the following to your pom.xml
file:
<dependency>
<groupId>evalive</groupId>
<artifactId>evalive</artifactId>
<version>1.1.0</version>
</dependency>
Copyright (C) 2011-2013 Fogus
Distributed under the Eclipse Public License, the same as Clojure.