This file contains 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
;; Note 1: in a real project, would have had 3 files: one for the code, one for the tests, one for the test data | |
;; Note 2: you can test online at http://tryclj.com/ : copy/paste the (do ...) encapsulating the 3 defs (lines 7 to 21). | |
;; Then hit Enter to evaluate. Then type (main), then hit Enter to evaluate. | |
(ns foobarqiz) | |
(do ;; trick to ease the use of copying/pasting into http://tryclj.com | |
(def data (sorted-map 7 "Qix", 5 "Bar", 3 "Foo")) | |
(defn serialize |
This file contains 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
;; Note 1: in a real project, would have had 3 files: one for the code, one for the tests, one for the test data | |
;; Note 2: you can test online at http://tryclj.com/ : copy/paste the (do ...) encapsulating the 3 defs (lines 8 to 55). | |
;; Then hit Enter to evaluate. Then type (main), then hit Enter to evaluate. | |
(ns foobarqix | |
(:require [clojure.string :as str])) | |
(do ;; trick to ease the use of copying/pasting into http://tryclj.com | |
(def FBQ |
This file contains 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 ^{:doc "Eclipse interop utilities"} | |
ccw.util.eclipse | |
(:require [clojure.java.io :as io]) | |
(:import [org.eclipse.core.resources IResource | |
ResourcesPlugin] | |
[org.eclipse.core.runtime IPath | |
Path] | |
[org.eclipse.jdt.core IJavaProject])) | |
(extend-protocol io/Coercions |
This file contains 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 ^{:doc "Eclipse interop utilities"} | |
ccw.util.eclipse | |
(:require [clojure.java.io :as io]) | |
(:import [org.eclipse.core.resources IResource | |
ResourcesPlugin | |
IWorkspaceRunnable | |
IWorkspace] | |
[org.eclipse.core.runtime IPath | |
Path] | |
[org.eclipse.jdt.core IJavaProject] |
This file contains 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
Caused by: java.lang.reflect.InvocationTargetException | |
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421) | |
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507) | |
at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275) | |
at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:960) | |
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) | |
at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:995) | |
at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:970) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) |
This file contains 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
<h1>1. Installer et télécharger Eclipse For Java Developers:</h1> | |
http://eclipse.org/downloads/packages/eclipse-ide-java-developers/indigosr2 |
This file contains 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
;; Pour ajouter un visualiseur Swing | |
;; | |
;; 1. coller ce texte à la fin de votre namespace mixit.life | |
;; 2. evaluer | |
;; 3. demarrer un visualiseur swing : | |
;; (swing-board board 7 5) | |
;; 4. attention, la fenetre swing est peut etre cachee derriere votre fenetre Eclipse | |
;; 5. lancer l'animation en calculant 10 générations à partir de l'état init : | |
;; (play init 20) |
This file contains 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 mixit.life | |
(:use [clojure.pprint :only [pprint]])) | |
;; cell representation | |
(pprint [2 2]) | |
;; game state representation | |
#{[2 2] [3 2]} | |
;; game initial state ("blinker") |
This file contains 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
(defn lein-env | |
"Create a new classlojure based leiningen environment by fetching all jars | |
and classes directories found inside the ccw.leiningen-core plugin." | |
[] | |
(let [leiningen-core (bundle-dir "ccw.leiningen-core") | |
jar (fn [f] (and (.isFile f) (.endsWith (.getName f) ".jar"))) | |
classes-dir (fn [d] (let [manifest (io/file d "META-INF" "MANIFEST.MF")] | |
(and (.exists manifest) | |
(.isFile manifest)))) | |
libs (->> leiningen-core file-seq (filter #(or (jar %) (classes-dir %))))] |
This file contains 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
(defn classloader-handler | |
"Call cl-provider with the session each time a msg is sent. | |
The resulting classloader will then be used as context for executing msg." | |
[h cl-provider] | |
(fn [msg] | |
(let [classloader (cl-provider (:session msg)) | |
dynamic-loader (and classloader (clojure.lang.DynamicClassLoader. classloader))] | |
(when dynamic-loader | |
(swap! (:session msg) assoc clojure.lang.Compiler/LOADER dynamic-loader)) | |
(h msg)))) |