I've been playing with Go a lot recently, and I have found the documentation / new user experience very good:
http://golang.org/ On Mon, Sep 3, 2012 at 2:19 PM, Denis Labaye <denis.lab...@gmail.com> wrote: > > > On Mon, Sep 3, 2012 at 5:40 PM, Softaddicts <lprefonta...@softaddicts.ca> > wrote: >> >> Btwy, using leiningen's repl hides all these issues... > > > yes, and Emacs is one of the best for hacking Clojure code ... > But not necessarily for new users, who don't know Emacs or Java. > > And even better than lein: You can't beat an online REPL for a quick Clojure > experience, like http://tryclj.com/ > It would be cool if an online REPL was available just on the front page of > clojure.org > >> >> >> Luc >> >> >> > This will work only if >> > >> > A) there is a manifest in the jar specifying which class contains the >> > main method >> > >> > B) if you do not need to add libraries explicitly, -cp is ignored when >> > you use >> > -jar >> > >> > Clojure.org is correct, especially regarding b). If you happen to need >> > to add >> > libs to your REPL, -jar is a dead end. >> > >> > If you happen to create a specific main for your own app, using -jar is >> > much more complex to setup. >> > >> > Luc P >> > >> > >> > > On http://clojure.org/getting_started: >> > > >> > > >> > > Download <http://clojure.org/downloads> and unzip Clojure. In the >> > > directory >> > > in which you expanded clojure.zip, run: >> > > >> > > java -cp clojure-1.4.0.jar clojure.main >> > > >> > > Should be just: >> > > >> > > >> > > java -jar clojure-1.4.0.jar >> > > >> > > >> > > It's a detail, but an important one, as it's the first contact for >> > > most of >> > > the new Clojure users. >> > > >> > > Denis >> > > >> > > On Mon, Sep 3, 2012 at 9:00 AM, Denis Labaye <denis.lab...@gmail.com> >> > > wrote: >> > > >> > > > >> > > > 1. java -cp ./org/clojure/clojure/1.4.0/clojure-1.4.0.jar >> > > > clojure.main >> > > > 2. cut & paste your code in the REPL >> > > > 3. type (start) [enter] >> > > > >> > > > >> > > > >> > > > >> > > > On Fri, Aug 31, 2012 at 3:36 AM, gearss <gearss8...@gmail.com> >> > > > wrote: >> > > > >> > > >> I have a file named pong.clj, it isunder following, I want to know >> > > >> how >> > > >> can I run it? >> > > >> Thank you. >> > > >> >> > > >> -------- >> > > >> (ns example.game.pong >> > > >> (:use [penumbra opengl] >> > > >> [clojure.contrib.def]) >> > > >> (:require [penumbra [app :as app] [text :as text]])) >> > > >> (def ball-width 0.03) >> > > >> (def ball-height 0.03) >> > > >> (def paddle-width 0.02) >> > > >> (def paddle-height 0.15) >> > > >> ;;; >> > > >> (defn abs [x] (Math/abs x)) >> > > >> (defn intersect-1d [[a b] [x y]] >> > > >> (and (<= a y) (>= b x))) >> > > >> (defn intersect-2d [[a b c d] [x y z w]] >> > > >> (and (intersect-1d [a c] [x z]) >> > > >> (intersect-1d [b d] [y w]))) >> > > >> (defn reflector [[x y w h] f] >> > > >> (let [r [x y (+ x w) (+ y h)]] >> > > >> (fn [region velocity] >> > > >> (if (intersect-2d region r) >> > > >> (f velocity) >> > > >> velocity)))) >> > > >> (defvar boundaries >> > > >> [(reflector [0 -1 1 1] (fn [[x y]] [x (abs y)])) >> > > >> (reflector [0 1 1 1] (fn [[x y]] [x (- (abs y))])) >> > > >> (reflector [-1 0 1 1] (fn [[x y]] [(abs x) y])) >> > > >> (reflector [1 0 1 1] (fn [[x y]] [(- (abs x)) y]))]) >> > > >> (defn update-ball [state dt] >> > > >> (let [ball (concat (:p state) (map + (:p state) [ball-width >> > > >> ball-height])) >> > > >> v (reduce >> > > >> #(%2 ball %1) (:v state) >> > > >> (conj >> > > >> boundaries >> > > >> (reflector [0.01 (:left state) paddle-width >> > > >> paddle-height] >> > > >> (fn [[x y]] [(abs x) y])) >> > > >> (reflector [(- 0.99 paddle-width) (:right state) >> > > >> paddle-width >> > > >> paddle-height] >> > > >> (fn [[x y]] [(- (abs x)) y]))))] >> > > >> (assoc state >> > > >> :v v >> > > >> :p (map + (:p state) (map (partial * dt) v))))) >> > > >> (defn draw-ball [pos] >> > > >> (push-matrix >> > > >> (apply translate pos) >> > > >> (draw-quads >> > > >> (vertex 0 0) >> > > >> (vertex ball-width 0) >> > > >> (vertex ball-width ball-height) >> > > >> (vertex 0 ball-height)))) >> > > >> ;;; >> > > >> (defn update-opponent-paddle [state] >> > > >> (let [[x y] (:p state) >> > > >> [vx vy] (:v state) >> > > >> dt (/ (- 1 x) vx) >> > > >> dy (- (+ y (* vy dt)) (:right state))] >> > > >> (assoc state >> > > >> :v-right (if (neg? vx) 0 (/ dy dt))))) >> > > >> (defn update-player-paddle [state] >> > > >> (assoc state >> > > >> :v-left >> > > >> (cond >> > > >> (app/key-pressed? :up) -1 >> > > >> (app/key-pressed? :down) 1 >> > > >> :else 0))) >> > > >> (defn update-paddle [dt v pos] >> > > >> (min (- 1 paddle-height) (max 0 (+ pos (* dt v))))) >> > > >> (defn draw-paddle [x y] >> > > >> (push-matrix >> > > >> (translate x y) >> > > >> (draw-quads >> > > >> (vertex 0 0) >> > > >> (vertex paddle-width 0) >> > > >> (vertex paddle-width paddle-height) >> > > >> (vertex 0 paddle-height)))) >> > > >> ;;; >> > > >> (defn reset-game [state] >> > > >> (assoc state >> > > >> :v [0.4 0.8] >> > > >> :p [0.5 0.5] >> > > >> :left 0.5, :v-left 0.0 >> > > >> :right 0.5, :v-right 0.0)) >> > > >> (defn init [state] >> > > >> (app/vsync! true) >> > > >> (app/title! "Pong") >> > > >> (app/periodic-update! 2 update-opponent-paddle) >> > > >> (reset-game state)) >> > > >> (defn reshape [[x y w h] state] >> > > >> (ortho-view 0 1 1 0 -1 1) >> > > >> state) >> > > >> (defn update [[delta _] state] >> > > >> (-> state >> > > >> (update-player-paddle) >> > > >> (assoc :left (update-paddle delta (:v-left state) (:left >> > > >> state))) >> > > >> (assoc :right (update-paddle delta (:v-right state) (:right >> > > >> state))) >> > > >> (update-ball delta))) >> > > >> (defn display [[delta _] state] >> > > >> (draw-ball (:p state)) >> > > >> (draw-paddle 0.01 (:left state)) >> > > >> (draw-paddle (- 0.99 paddle-width) (:right state)) >> > > >> (app/repaint!)) >> > > >> (defn start [] >> > > >> (app/start >> > > >> {:display display, :reshape reshape, :update update, :init init} >> > > >> {})) >> > > >> >> > > >> >> > > >> -- >> > > >> You received this message because you are subscribed to the Google >> > > >> Groups "Clojure" group. >> > > >> To post to this group, send email to clojure@googlegroups.com >> > > >> Note that posts from new members are moderated - please be patient >> > > >> with >> > > >> your first post. >> > > >> To unsubscribe from this group, send email to >> > > >> clojure+unsubscr...@googlegroups.com >> > > >> For more options, visit this group at >> > > >> http://groups.google.com/group/clojure?hl=en >> > > > >> > > > >> > > > >> > > >> > > -- >> > > You received this message because you are subscribed to the Google >> > > Groups "Clojure" group. >> > > To post to this group, send email to clojure@googlegroups.com >> > > Note that posts from new members are moderated - please be patient >> > > with your first post. >> > > To unsubscribe from this group, send email to >> > > clojure+unsubscr...@googlegroups.com >> > > For more options, visit this group at >> > > http://groups.google.com/group/clojure?hl=en >> > -- >> > Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad! >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Clojure" group. >> > To post to this group, send email to clojure@googlegroups.com >> > Note that posts from new members are moderated - please be patient with >> > your first post. >> > To unsubscribe from this group, send email to >> > clojure+unsubscr...@googlegroups.com >> > For more options, visit this group at >> > http://groups.google.com/group/clojure?hl=en >> > >> -- >> Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad! >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en