This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello, This is a test gist...! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello everybody, | |
I am trying to get a simple java code (about 10 lines in clojure ) | |
which uses jReality ported to clojure. This is my attempt has been | |
kind of half way successfull. The corresponding github-repo link is | |
git://github.com/sunilnandihalli/jRealityTutorial.git | |
The project is nicely set up to work with leiningen .. so simple | |
"lein deps && lein native-deps" should get it started. after that I | |
just execute the sexp in the emacs editor. When the code runs, it | |
opens the ui and shows what is intended in a rather unpleasing way | |
with the flickers and all. when I look at the terminal output it tells |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns giws-clj.core | |
(:require [clojure.contrib.lazy-xml :as xml]) | |
(:use [clojure.contrib.trace :as trace])) | |
(defn emit-giws-xml [c] | |
(let [package (.getPackage c) | |
methods (map #(hash-map :name (.getName %) | |
:returnType (str (.getName (.getReturnType %))) | |
:params (map (fn [p] {:name (.getName %)}) | |
(.getParameterTypes %))) | |
(.getMethods c))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sunil@eagle ~/work/clojure/expcake#cake deps | |
/var/lib/gems/1.9.1/gems/cake-0.4.18/bin/cake:399: warning: Insecure world writable dir /home/sunil in PATH, mode 040777 | |
[pom] creating pom.xml | |
[deps] Fetching dependencies... | |
[deps] Copying 1 file to /home/sunil/work/clojure/expcake/build/lib | |
[deps] Deleting directory /home/sunil/work/clojure/expcake/lib | |
[deps] Attempting to rename dir: build/lib to lib | |
[deps] Restarting project jvm. | |
[deps] /bin/cake:9:in `require': no such file to load -- rubygems (LoadError) | |
[deps] from /bin/cake:9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mathematica-eval "D[x*x+y*x,x]") returns => (+ (* 2 x) y) | |
(math (Variables (+ (* 2 x) y))) returns => [x y] | |
(math (Variables (mathematica-eval "D[x*x+y*x,x]"))) | |
it is a combination of first and second sexps... | |
-> gives an error ... | |
I guess I need to do so me macro and symbolic thing .. bu I am unable to figure it out.. can anybody help? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro hello [x] | |
`(sayhello ~x)) | |
(macroexpand-1 (apply-macro hello [10])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns letd | |
(:require [clojure.contrib.macro-utils :as m])) | |
(defmacro with-seperator [& body] | |
(let [line '(println (apply str (repeat 61 "-")))] | |
`(m/symbol-macrolet [sep ~line] | |
(m/with-symbol-macros | |
(do sep (let [x# (do ~@body)] sep x#)))))) | |
(defmacro display-local-bindings [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns symbol-macro-problem | |
(:require [clojure.contrib.macro-utils :as m])) | |
(defmacro sym-macro [& body] | |
`(m/symbol-macrolet [begin :begin | |
end :end] | |
(println begin) | |
~@body | |
(println end))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro print-and-return | |
([x] | |
`(let [x# ~x] | |
(println x#) x#)) | |
([flag x] | |
`(let [flag# '~flag | |
x# ~x] | |
(println flag#) | |
(println x#) | |
x#))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [mp (atom {}) | |
d [#{#{1 2} | |
#{3 4}} ;node1 | |
#{#{5 6} | |
#{7 8}}]] ;node2 | |
(dorun (for [nd d | |
nd-pair nd | |
face nd-pair] | |
(swap! mp update-in [face] #(conj % nd)))) | |
@mp) |
OlderNewer