Re: An open call to the community: Let's prepare for 1.3

2011-09-04 Thread Meikel Brandmeyer
Hi,

Am 03.09.2011 um 23:12 schrieb Alan Malloy:

 Huh, interesting. I assumed ^:foo meta syntax was new to 1.3, and
 wouldn't compile at all in 1.2. But now I see that in 1.2 it's
 equivalent to ^{:tag :foo} - not useful, but not damaging either. I
 guess I'll start using ^:dynamic myself.

#^something was equivalent to #^{:tag something}. Back when we did types not 
with defrecord but with (with-meta {:foo :bar} {:tag ::my-type}) it actually 
was useful. With the advent of defrecord this need for this diminished. So, it 
at least was useful.

Sincerely
Meikel

-- 
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


Re: An open call to the community: Let's prepare for 1.3

2011-09-04 Thread Alan Malloy
On Sep 4, 12:54 am, Meikel Brandmeyer m...@kotka.de wrote:
 Hi,

 Am 03.09.2011 um 23:12 schrieb Alan Malloy:

  Huh, interesting. I assumed ^:foo meta syntax was new to 1.3, and
  wouldn't compile at all in 1.2. But now I see that in 1.2 it's
  equivalent to ^{:tag :foo} - not useful, but not damaging either. I
  guess I'll start using ^:dynamic myself.

 #^something was equivalent to #^{:tag something}. Back when we did types not 
 with defrecord but with (with-meta {:foo :bar} {:tag ::my-type}) it actually 
 was useful. With the advent of defrecord this need for this diminished. So, 
 it at least was useful.

Well, ^something still is equivalent to ^{:tag something}, which as I
understand it is useful for compiler typehinting. I just was unaware
that this worked for keywords as well as symbols, though when you
point out that tags were used for custom types this makes more sense.

-- 
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


Re: Documentation For Lisp Programming in Clojure.

2011-09-04 Thread Andreas Kostler
Sicp, the little schemer, seasoned schemer,norvigs paradigms of AI
programming. Seibels practical common lisp. Let over lambda. More Cl
specific is Sonja Kleenex PO programming in Cl or the metaobject protocol.
And there's more
 On Sep 4, 2011 4:48 AM, octopusgrabbus octopusgrab...@gmail.com wrote:
 I have seen the three current books on Clojure. They are all good general
 books that describe the whole language. I have not had a chance to see
Chas
 Emerick's new Clojure O'Reilly book, so cannot comment on that.

 Are there any books available or upcoming that concentrate more on Lisp
 programming in Clojure's dialect? If not, what is the closest Lisp dialect

 to Clojure and is the best book on teaching traversing trees, recursion,
and
 so on?

 Thanks.
 cmn

 --
 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

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

i started with a tic tac toe implementation, but i'm stuck:

(def open 0)
(def p1 1)
(def p2 2)
(def emptyfield [open open open open open open open open open])

(defn updated [seq index replacement]
  (concat
(take index seq)
[replacement]
(drop (inc index) seq)))

(defn indexOf [x y] (+ x (* y 3)))

(defn withmove [x,y,player,field]
  (updated field (indexOf x y) player))

(defn winner [field]
  (defn winPred [player]
(defn rowwin [row]
  (let [beginIndex (indexOf 0 row)
currow (subvec beginIndex (+ 3 beginIndex) field)]
(defn ownedByPlayer [value])
every? ownedByPlayer currow))
(defn colwin [col]
  (let [beginIndex (indexOf col 0)
curcol (take-nth 3 (drop beginIndex field))]
(defn ownedByPlayer [value])
every? ownedByPlayer curcol))
(loop [cnt 0]
  (if (= cnt 3) false (or (rowwin cnt) (colwin cnt) (recur (inc
cnt))

  (let [winnerIfExists (filter winPred [p1 p2])]
(if (empty? winnerIfExists) open (first winnerIfExists

(let [moves [[0 0 p1] [1 0 p1] [2 0 p1]]]
  (doall
(for [move moves]
  (let [x (nth move 0)
 y (nth move 1)
 player (nth move 2)]
 (print player )
 (print player)
 (print  makes move at )
 (print x)
 (print /)
 (println y)
 ))
)
  )

two questions:
* in the last loop where i am just printing out what i want to do, i
need something like foldLeft (from scala). how do i fold in clojure?

* is there no predefined updated function?



Am 03.09.2011 23:38, schrieb Luc Prefontaine:
 On Sat, 3 Sep 2011 13:43:42 -0700 (PDT) HamsterofDeath
 d.haup...@googlemail.com wrote:
 
 this might seem like a stupid question, but for me, not knowing
 the type of something is like being stuck in a dead end for
 anything non trivial.
 
 It's not stupid, it's normal :)
 
 In functional programming, most of the time you would like to write
 functions that do not need to know their arguments too intimately. 
 You would like to work on collections, maps, ...
 
 Of course at some point you will need to write functions that will
 look closer to their arguments.
 
 You can pass functions to generic ones and isolate that type 
 knowledge within them. No need to spread this everywhere.
 
 i've made a few little experiments with clojure (not much, just
 testing some features) and i see how powerful clojure can be - 
 for small to medium sized problems with simple input and output -
 a*- pathfinding, for example.
 
 but how would i port a complex object graph (let's say 15
 different classes with 3-7 fields each - person, contacts,
 orders, shipping details) to clojure? how would i handle it?
 
 defrecord might help you a bit here. It may feel a bit like
 home. defrecord fields can be referenced as map entries
 (:field-name ...).
 
 You can also define protocols that associated with defrecord and
 may ease your pain by implementing familiar functions to navigate
 in the hierarchy.
 
 Not sure if using a library written by someone else to handle these
 things is the proper thing to do right now. I feel you need to
 break your teeth a bit :) (It took me three months to get used to
 immutability :))
 
 the main problems i see are: * do i have to actually remember the
 complete structure and field names and the exact spelling? using
 statically types languages like java or scala, the ide
 autocomplete features really help here.
 
 If you use obvious names that match the problem domain this should
 be easy to overcome. Protocols could help you here by hiding some
 complex navigation but please refrain implementing getters for
 all individual fields :))
 
 * what about renaming a field or method?
 
 Yep of course you will not have this nice refactoring feature where
 you type in place the new name and get the IDE to fix this
 everywhere for you. But on the other hand you should have at least
 10 times less code compared to java and less side effects to
 debug. It should not be too hard to do this using a standard text
 search. I use Eclipse and the straight file search. I would never
 exchange Clojure for Java and the automated Refactoring
 commands.
 
 If you encapsulate frequently exposed fields in functions you
 should be able to reduce the footprint of the code where these
 things are exposed. Hence the name changes would be easy to
 implement. You would confine these functions in a specific name
 space which decrease the like hood of missing a change.
 
 * if a function needs an instance of the root class of the
 complex graph above as a parameter - how do i know this at all?
 am i lost without good documentation of this function? in java, i
 just know what a method needs because it has a signature.
 
 Use the doc string when defining a fn:
 
 (defn blbl Returns the meaningful blblblbl... string. It expects
 a single parameter, the length of the returned string [length] 
 ...)
 
 You 

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

solved my last problem, and now i'm stucker than before:

(def open 0)
(def p1 1)
(def p2 2)
(def emptyfield [open open open open open open open open open])

(defn updated [seq index replacement]
  (concat
(take index seq)
[replacement]
(drop (inc index) seq)))

(defn indexOf [x y] (+ x (* y 3)))

(defn withmove [x,y,player,field]
  (updated field (indexOf x y) player))

(defn winner [field]
  (defn winPred [player]
(defn rowwin [row]
  (let [beginIndex (indexOf 0 row)
currow (subvec (force field) beginIndex (+ 3 beginIndex))]
(defn ownedByPlayer [value])
every? ownedByPlayer currow))
(defn colwin [col]
  (let [beginIndex (indexOf col 0)
curcol (take-nth 3 (drop beginIndex field))]
(defn ownedByPlayer [value])
every? ownedByPlayer curcol))
(loop [cnt 0]
  (if (= cnt 3) false (or (rowwin cnt) (colwin cnt) (recur (inc
cnt))

  (let [winnerIfExists (filter winPred [p1 p2])]
(if (empty? winnerIfExists) open (first winnerIfExists

(let [moves [[0 0 p1] [1 0 p1] [2 0 p1]]]
  (defn fold [field nextmove]
(withmove (nth nextmove 0) (nth nextmove 1) (nth nextmove 2) field))
  (let [endstate (reduce fold emptyfield moves)]
(println endstate)
(println (winner endstate)))
)


how to convert a lazy seq into a persistent vector?


Am 03.09.2011 23:38, schrieb Luc Prefontaine:
 On Sat, 3 Sep 2011 13:43:42 -0700 (PDT) HamsterofDeath
 d.haup...@googlemail.com wrote:
 
 this might seem like a stupid question, but for me, not knowing
 the type of something is like being stuck in a dead end for
 anything non trivial.
 
 It's not stupid, it's normal :)
 
 In functional programming, most of the time you would like to write
 functions that do not need to know their arguments too intimately. 
 You would like to work on collections, maps, ...
 
 Of course at some point you will need to write functions that will
 look closer to their arguments.
 
 You can pass functions to generic ones and isolate that type 
 knowledge within them. No need to spread this everywhere.
 
 i've made a few little experiments with clojure (not much, just
 testing some features) and i see how powerful clojure can be - 
 for small to medium sized problems with simple input and output -
 a*- pathfinding, for example.
 
 but how would i port a complex object graph (let's say 15
 different classes with 3-7 fields each - person, contacts,
 orders, shipping details) to clojure? how would i handle it?
 
 defrecord might help you a bit here. It may feel a bit like
 home. defrecord fields can be referenced as map entries
 (:field-name ...).
 
 You can also define protocols that associated with defrecord and
 may ease your pain by implementing familiar functions to navigate
 in the hierarchy.
 
 Not sure if using a library written by someone else to handle these
 things is the proper thing to do right now. I feel you need to
 break your teeth a bit :) (It took me three months to get used to
 immutability :))
 
 the main problems i see are: * do i have to actually remember the
 complete structure and field names and the exact spelling? using
 statically types languages like java or scala, the ide
 autocomplete features really help here.
 
 If you use obvious names that match the problem domain this should
 be easy to overcome. Protocols could help you here by hiding some
 complex navigation but please refrain implementing getters for
 all individual fields :))
 
 * what about renaming a field or method?
 
 Yep of course you will not have this nice refactoring feature where
 you type in place the new name and get the IDE to fix this
 everywhere for you. But on the other hand you should have at least
 10 times less code compared to java and less side effects to
 debug. It should not be too hard to do this using a standard text
 search. I use Eclipse and the straight file search. I would never
 exchange Clojure for Java and the automated Refactoring
 commands.
 
 If you encapsulate frequently exposed fields in functions you
 should be able to reduce the footprint of the code where these
 things are exposed. Hence the name changes would be easy to
 implement. You would confine these functions in a specific name
 space which decrease the like hood of missing a change.
 
 * if a function needs an instance of the root class of the
 complex graph above as a parameter - how do i know this at all?
 am i lost without good documentation of this function? in java, i
 just know what a method needs because it has a signature.
 
 Use the doc string when defining a fn:
 
 (defn blbl Returns the meaningful blblblbl... string. It expects
 a single parameter, the length of the returned string [length] 
 ...)
 
 You can describe the expected inputs and the result,  ... Do the
 same thing with your name space definitions, protocols. ...
 
 It's easy, fits with your programming flow and is non-obtrusive.
 
 


- -- 

-BEGIN 

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Luc Prefontaine
Have a look at reduce:

(reduce conj []  (take 9 (cycle [0])))

take returns a lazy seq. but reduce will return you a vector.

Looks like you try to translate as if you were using a language that allows
mutations but you use functions to hold values that you redefine since mutation 
is restricted
to refs and atoms.

I suggest you look at atoms to hold values if they can mutate globally or at 
recur
if you need to implement some recursion and rebind new values within a 
function's body.

Luc P.

On Sun, 04 Sep 2011 18:55:12 +0200
Dennis Haupt d.haup...@googlemail.com wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 solved my last problem, and now i'm stucker than before:
 
 (def open 0)
 (def p1 1)
 (def p2 2)
 (def emptyfield [open open open open open open open open open])
 
 (defn updated [seq index replacement]
   (concat
 (take index seq)
 [replacement]
 (drop (inc index) seq)))
 
 (defn indexOf [x y] (+ x (* y 3)))
 
 (defn withmove [x,y,player,field]
   (updated field (indexOf x y) player))
 
 (defn winner [field]
   (defn winPred [player]
 (defn rowwin [row]
   (let [beginIndex (indexOf 0 row)
 currow (subvec (force field) beginIndex (+ 3 beginIndex))]
 (defn ownedByPlayer [value])
 every? ownedByPlayer currow))
 (defn colwin [col]
   (let [beginIndex (indexOf col 0)
 curcol (take-nth 3 (drop beginIndex field))]
 (defn ownedByPlayer [value])
 every? ownedByPlayer curcol))
 (loop [cnt 0]
   (if (= cnt 3) false (or (rowwin cnt) (colwin cnt) (recur (inc
 cnt))
 
   (let [winnerIfExists (filter winPred [p1 p2])]
 (if (empty? winnerIfExists) open (first winnerIfExists
 
 (let [moves [[0 0 p1] [1 0 p1] [2 0 p1]]]
   (defn fold [field nextmove]
 (withmove (nth nextmove 0) (nth nextmove 1) (nth nextmove 2)
 field)) (let [endstate (reduce fold emptyfield moves)]
 (println endstate)
 (println (winner endstate)))
 )
 
 
 how to convert a lazy seq into a persistent vector?
 
 
 Am 03.09.2011 23:38, schrieb Luc Prefontaine:
  On Sat, 3 Sep 2011 13:43:42 -0700 (PDT) HamsterofDeath
  d.haup...@googlemail.com wrote:
  
  this might seem like a stupid question, but for me, not knowing
  the type of something is like being stuck in a dead end for
  anything non trivial.
  
  It's not stupid, it's normal :)
  
  In functional programming, most of the time you would like to write
  functions that do not need to know their arguments too intimately. 
  You would like to work on collections, maps, ...
  
  Of course at some point you will need to write functions that will
  look closer to their arguments.
  
  You can pass functions to generic ones and isolate that type 
  knowledge within them. No need to spread this everywhere.
  
  i've made a few little experiments with clojure (not much, just
  testing some features) and i see how powerful clojure can be - 
  for small to medium sized problems with simple input and output -
  a*- pathfinding, for example.
  
  but how would i port a complex object graph (let's say 15
  different classes with 3-7 fields each - person, contacts,
  orders, shipping details) to clojure? how would i handle it?
  
  defrecord might help you a bit here. It may feel a bit like
  home. defrecord fields can be referenced as map entries
  (:field-name ...).
  
  You can also define protocols that associated with defrecord and
  may ease your pain by implementing familiar functions to navigate
  in the hierarchy.
  
  Not sure if using a library written by someone else to handle these
  things is the proper thing to do right now. I feel you need to
  break your teeth a bit :) (It took me three months to get used to
  immutability :))
  
  the main problems i see are: * do i have to actually remember the
  complete structure and field names and the exact spelling? using
  statically types languages like java or scala, the ide
  autocomplete features really help here.
  
  If you use obvious names that match the problem domain this should
  be easy to overcome. Protocols could help you here by hiding some
  complex navigation but please refrain implementing getters for
  all individual fields :))
  
  * what about renaming a field or method?
  
  Yep of course you will not have this nice refactoring feature where
  you type in place the new name and get the IDE to fix this
  everywhere for you. But on the other hand you should have at least
  10 times less code compared to java and less side effects to
  debug. It should not be too hard to do this using a standard text
  search. I use Eclipse and the straight file search. I would never
  exchange Clojure for Java and the automated Refactoring
  commands.
  
  If you encapsulate frequently exposed fields in functions you
  should be able to reduce the footprint of the code where these
  things are exposed. Hence the name changes would be easy to
  implement. You would confine these functions in a specific name
  space which 

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Sergey Didenko
Dennis, may I suggest you to read this great article on Clojure:
http://java.ociweb.com/mark/clojure/article.html

-- 
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

Re: clojure and emacs

2011-09-04 Thread Li Zhixiong
Basically, the problem I get is due to version conflict between
swank-clojure and slime, I download the same version as swank-clojure, that
is, 20100404, then it works.

On Sun, Sep 4, 2011 at 8:19 AM, myriam abramson labwor...@gmail.com wrote:


 Thanks. I am getting some slime errors unfortunately. I'll have to track
 that down.

 On Thu, Sep 1, 2011 at 1:36 PM, Paul Nakata paulnak...@gmail.com wrote:

 On Thursday, September 1, 2011 10:03:13 AM UTC-7, melipone wrote:

 I do like lein repl on the command line. How can I have that in emacs?
 Basically, if I have a project in Lein, how can I do a (require
 'projectname) and have all the libraries loaded in emacs?
 I'm just using M-x inferior-lisp at this point. I find swank-clojure too
 complex for right now. Maybe later.

 TIA
 melipone


 I use clojure-jack-in as described here: http://technomancy.us/149 ,
 although if you find swank-clojure too complex for you it may not be a great
 fit. I have personally found clojure-jack-in to be very simple and easy to
 use; I would advocate at least trying it out.

 --
 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




-- 
Best regard!
Yours sincerely, Li Zhixiong

-- 
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

Re: Clojure 1.3 Beta 3

2011-09-04 Thread cri
Is there a list of everything new in 1.3? Thanks


On Sep 2, 9:46 pm, Christopher Redinger redin...@gmail.com wrote:
 Clojure 1.3 Beta 3 is now available at

 http://clojure.org/downloads

 The list of changes:
 * Load resources when baseLoader() is null (CLJ-673)
 * Equiv overload added for primitive booleans
 * Documentation updates for juxt and defrecord (CLJ-815, CLJ-736
 respectively)

 We think this is ready to be tagged as the 1.3 release. Any showstopper bugs
 that cause you to disagree? Let us know!

 Thanks!

 --
 Chris Redinger
 Clojure/corehttp://clojure.com

-- 
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


No such var while calling a (:require) 'd function

2011-09-04 Thread Timothy Washington
Hi all,

I have an annoying namespacing issue. I have a sort of command-wrapper that
require's in all other commands fine: add, get, etc. But when I call
(:require commands.remove), I get the error:

$ lein test my-test
...
clojure.lang.Var.applyTo (Var.java:518)
clojure.main.main (main.java:37)
*Caused by: java.lang.RuntimeException: No such var: commands/remove*
...
clojure.core$eval.invoke (core.clj:2745)
*bkell$remove.doInvoke (bkell.clj:61)*
clojure.lang.RestFn.invoke (RestFn.java:410)
bkell_test/fn (bkell_test.clj:421)




Now, this is my require and invocation call. These calls works fine for 4
other require / invocations. So I'm confused as to why it would fail now.

(ns bkell

  (:import java.io.FileReader)
  (:require commands.add)
  (:require commands.update)
  (:require commands.get)
  *(:require commands.remove)*
  (:require commands.authenticate)
  (:require domain)
  (:require util)
)
...

(defn remove [akey  etal]
  (let [  logged-in-user (commands/logged-in-user)]
(if (- logged-in-user nil?)  ;; we want to see a logged-in-user
  (util/generate-error-response User is not authenticated)
  (eval *`(commands/remove ~akey ~@etal)*) *;; this is line 61 *
)
  )
)


Thanks for any insight

Tim Washington
twash...@gmail.com
416.843.9060

-- 
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

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 04.09.2011 19:04, schrieb Luc Prefontaine:
 Have a look at reduce:
 
 (reduce conj []  (take 9 (cycle [0])))
 
 take returns a lazy seq. but reduce will return you a vector.
 
 Looks like you try to translate as if you were using a language
 that allows mutations

no. i am trying to use the function subvec to get what would be a
sublist in java. but subvec doesn't work on sequences, and what i need
to quickly solve the problem would be a function that takes a sequence
and returns a vector.

or i could use a vector the whole time and not use a sequence at all.

but you use functions to hold values that you redefine since mutation
is restricted
 to refs and atoms.
 
 I suggest you look at atoms to hold values if they can mutate
 globally or at recur if you need to implement some recursion and
 rebind new values within a function's body.
 
 Luc P.
 
 On Sun, 04 Sep 2011 18:55:12 +0200 Dennis Haupt
 d.haup...@googlemail.com wrote:
 
 solved my last problem, and now i'm stucker than before:
 
 (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open
 open open open open open open])
 
 (defn updated [seq index replacement] (concat (take index seq) 
 [replacement] (drop (inc index) seq)))
 
 (defn indexOf [x y] (+ x (* y 3)))
 
 (defn withmove [x,y,player,field] (updated field (indexOf x y)
 player))
 
 (defn winner [field] (defn winPred [player] (defn rowwin [row] (let
 [beginIndex (indexOf 0 row) currow (subvec (force field) beginIndex
 (+ 3 beginIndex))] (defn ownedByPlayer [value]) every?
 ownedByPlayer currow)) (defn colwin [col] (let [beginIndex (indexOf
 col 0) curcol (take-nth 3 (drop beginIndex field))] (defn
 ownedByPlayer [value]) every? ownedByPlayer curcol)) (loop [cnt 0] 
 (if (= cnt 3) false (or (rowwin cnt) (colwin cnt) (recur (inc 
 cnt))
 
 (let [winnerIfExists (filter winPred [p1 p2])] (if (empty?
 winnerIfExists) open (first winnerIfExists
 
 (let [moves [[0 0 p1] [1 0 p1] [2 0 p1]]] (defn fold [field
 nextmove] (withmove (nth nextmove 0) (nth nextmove 1) (nth nextmove
 2) field)) (let [endstate (reduce fold emptyfield moves)] (println
 endstate) (println (winner endstate))) )
 
 
 how to convert a lazy seq into a persistent vector?
 
 
 Am 03.09.2011 23:38, schrieb Luc Prefontaine:
 On Sat, 3 Sep 2011 13:43:42 -0700 (PDT) HamsterofDeath 
 d.haup...@googlemail.com wrote:
 
 this might seem like a stupid question, but for me, not
 knowing the type of something is like being stuck in a dead
 end for anything non trivial.
 
 It's not stupid, it's normal :)
 
 In functional programming, most of the time you would like to
 write functions that do not need to know their arguments too
 intimately. You would like to work on collections, maps, ...
 
 Of course at some point you will need to write functions that
 will look closer to their arguments.
 
 You can pass functions to generic ones and isolate that type
  knowledge within them. No need to spread this everywhere.
 
 i've made a few little experiments with clojure (not much,
 just testing some features) and i see how powerful clojure
 can be - for small to medium sized problems with simple
 input and output - a*- pathfinding, for example.
 
 but how would i port a complex object graph (let's say 15 
 different classes with 3-7 fields each - person, contacts, 
 orders, shipping details) to clojure? how would i handle
 it?
 
 defrecord might help you a bit here. It may feel a bit like 
 home. defrecord fields can be referenced as map entries 
 (:field-name ...).
 
 You can also define protocols that associated with defrecord
 and may ease your pain by implementing familiar functions to
 navigate in the hierarchy.
 
 Not sure if using a library written by someone else to handle
 these things is the proper thing to do right now. I feel you
 need to break your teeth a bit :) (It took me three months to
 get used to immutability :))
 
 the main problems i see are: * do i have to actually
 remember the complete structure and field names and the
 exact spelling? using statically types languages like java
 or scala, the ide autocomplete features really help here.
 
 If you use obvious names that match the problem domain this
 should be easy to overcome. Protocols could help you here by
 hiding some complex navigation but please refrain
 implementing getters for all individual fields :))
 
 * what about renaming a field or method?
 
 Yep of course you will not have this nice refactoring feature
 where you type in place the new name and get the IDE to fix
 this everywhere for you. But on the other hand you should
 have at least 10 times less code compared to java and less
 side effects to debug. It should not be too hard to do this
 using a standard text search. I use Eclipse and the straight
 file search. I would never exchange Clojure for Java and
 the automated Refactoring commands.
 
 If you encapsulate frequently exposed fields in functions
 you should be able to reduce the footprint 

ANN: j18n 1.0.0 – taming ResourceBundles

2011-09-04 Thread Meikel Brandmeyer
Dear international Clojurians,

I'd like to announce j18n. A small wrapper around ResourceBundles to provide 
easy internationalization of Clojure applications. j18n will power the i18n 
features of the upcoming seesaw release.

The interface consits (at the moment) of a single function: resource. (resource 
::my-message) will look up the key my-message in the ResourceBundle of the 
current namespace.

Further enhancements like MessageFormat or specifying resources in clojure 
syntax are planned for the next releases.

Code: http://bitbucket.org/kotarak/j18n
Library on clojars: [j18n 1.0.0]

Sincerely
Meikel

-- 
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


Re: ANN: j18n 1.0.0 – taming ResourceBundles

2011-09-04 Thread Laurent PETIT
Interesting!

I don't see the link between the README page and the currrent state of the
API, though. Is the README ahead of time, or is the design it is describing
an intermediate state which should be removed ?

Cheers,

-- 
Laurent

2011/9/4 Meikel Brandmeyer m...@kotka.de

 Dear international Clojurians,

 I'd like to announce j18n. A small wrapper around ResourceBundles to
 provide easy internationalization of Clojure applications. j18n will power
 the i18n features of the upcoming seesaw release.

 The interface consits (at the moment) of a single function: resource.
 (resource ::my-message) will look up the key my-message in the
 ResourceBundle of the current namespace.

 Further enhancements like MessageFormat or specifying resources in clojure
 syntax are planned for the next releases.

 Code: http://bitbucket.org/kotarak/j18n
 Library on clojars: [j18n 1.0.0]

 Sincerely
 Meikel

 --
 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

Re: Clojure 1.3 Beta 3

2011-09-04 Thread Sean Corfield
On Sun, Sep 4, 2011 at 7:15 AM, cri chuck.irvine...@gmail.com wrote:
 Is there a list of everything new in 1.3? Thanks

Looks like four commits since beta2:

https://github.com/clojure/clojure/commits/master

load resources when baseLoader() is null, refs #673
CLJ-815 de-alpha docstring for juxt
CLJ-736 docfix
add equiv overload for primitive booleans

The overall change list is here:

https://github.com/clojure/clojure/blob/master/changes.txt

but that doesn't quite list *everything* - it's a very good summary tho'...

Bear in mind the biggest changes for 1.3 (c.f. 1.2) are in the contrib
libraries:

http://dev.clojure.org/display/design/Contrib+Library+Names
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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


Re: No such var while calling a (:require) 'd function

2011-09-04 Thread Sean Corfield
On Sun, Sep 4, 2011 at 11:37 AM, Timothy Washington twash...@gmail.com wrote:
 (ns bkell
   (:import java.io.FileReader)
   (:require commands.add)
   (:require commands.update)
   (:require commands.get)
   (:require commands.remove)
   (:require commands.authenticate)
   (:require domain)
   (:require util)
 )

These are requiring namespaces so I would expect you'd have a
namespace commands.remove and it would contain functions...?

 (defn remove [akey  etal]
   (let [  logged-in-user (commands/logged-in-user)]
     (if (- logged-in-user nil?)  ;; we want to see a logged-in-user
       (util/generate-error-response User is not authenticated)
       (eval `(commands/remove ~akey ~@etal))     ;; this is line 61
     )
   )
 )

I would expect to see (commands.remove/some-func ..) here... so I'm a
little puzzled when you say it works for invoking functions in other
require'd commands.* namespaces. Can you share a bit more of your
code?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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


Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Sean Corfield
On Sun, Sep 4, 2011 at 11:40 AM, Dennis Haupt d.haup...@googlemail.com wrote:
 - Nested defns are not good.
 why? imo, nested function/method definitions are a tool to fine-tune
 accessibility. just like public/private, but much more powerful. why

Right, but defn binds function names at the top-level (which is why
it's considered poor form to nest them - it doesn't create nested
functions). So those functions are actually all public in that
namespace:

user= (defn foo[a] (defn bar[b] (* a b)))
#'user/foo
user= (foo 2)
#'user/bar
user= (bar 3)
6
user= (meta #'user/bar)
{:ns #Namespace user, :name bar, :file NO_SOURCE_PATH, :line 1,
:arglists ([b])}

See how bar is defined when foo is called but it is callable directly
in the user namespace?

Using let or letfn creates locally scoped functions, which is what you want.

 again, why? the functions belong there, and nowhere else. they do not
 make sense outside the winner-function. they use parameters which are
 in scope there. factoring them out would actually make them more
 complex since i would have to add more parameters to their signatures.

You can define functions private to your namespace with defn- and you
can define them locally to other forms with let/letfn.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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


Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Eric Lavigne
 i started with a tic tac toe implementation, but i'm stuck:

I used the same example problem last year to teach Clojure to two
people that were new to programming. Hopefully you'll find their code
helpful.

 https://github.com/algarete13/tic-tac-toe

-- 
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


Re: No such var while calling a (:require) 'd function

2011-09-04 Thread Timothy Washington
Hey, thanks for getting back to me.

I was hacking away at this at the meantime. I defined 'remove' functions in
2 other places - bkell , commands. I ended up renaming *commands/remove* to
*commands/removek*, and now all invocations are working. But I'm pretty sure
I'm using namespace and require erroneously. Currently, I have a source file
structure like below:

src/
   bkell.clj
src/commands/
   add.clj
   remove.clj
   etc...


But each of the 'src/commands/' clojure files, uses the '*(ns command ...)*'
namespace, not '*(ns command.remove ...)*', etc. I wanted to do it this way,
so that client code could just call *command/remove*, not *
command.remove/remove*. But I'm realising that I should instead define (ns
commands) once, and use (in-ns) in other locations. You can see the source
here https://github.com/twashing/bkell/tree/jasmine-bdd/src. Looks like
'get' can be redefined in two other namespaces: bkell , commands. But when I
try to do that for 'remove', the repl seizes up, and I'm curious to know
why.

Thanks for the feedback
Tim



On Sun, Sep 4, 2011 at 3:56 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Sun, Sep 4, 2011 at 11:37 AM, Timothy Washington twash...@gmail.com
 wrote:
  (ns bkell
(:import java.io.FileReader)
(:require commands.add)
(:require commands.update)
(:require commands.get)
(:require commands.remove)
(:require commands.authenticate)
(:require domain)
(:require util)
  )

 These are requiring namespaces so I would expect you'd have a
 namespace commands.remove and it would contain functions...?

  (defn remove [akey  etal]
(let [  logged-in-user (commands/logged-in-user)]
  (if (- logged-in-user nil?)  ;; we want to see a logged-in-user
(util/generate-error-response User is not authenticated)
(eval `(commands/remove ~akey ~@etal)) ;; this is line 61
  )
)
  )

 I would expect to see (commands.remove/some-func ..) here... so I'm a
 little puzzled when you say it works for invoking functions in other
 require'd commands.* namespaces. Can you share a bit more of your
 code?
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 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

Re: ANN: j18n 1.0.0 – taming ResourceBundles

2011-09-04 Thread Dave Ray
The README represents an early draft before simplicity ensued :)

FWIW, here's how it's used in Seesaw:
https://github.com/daveray/seesaw/wiki/Resource-bundles-and-i18n

Dave

On Sun, Sep 4, 2011 at 3:51 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
 Interesting!
 I don't see the link between the README page and the currrent state of the
 API, though. Is the README ahead of time, or is the design it is describing
 an intermediate state which should be removed ?
 Cheers,
 --
 Laurent
 2011/9/4 Meikel Brandmeyer m...@kotka.de

 Dear international Clojurians,

 I'd like to announce j18n. A small wrapper around ResourceBundles to
 provide easy internationalization of Clojure applications. j18n will power
 the i18n features of the upcoming seesaw release.

 The interface consits (at the moment) of a single function: resource.
 (resource ::my-message) will look up the key my-message in the
 ResourceBundle of the current namespace.

 Further enhancements like MessageFormat or specifying resources in clojure
 syntax are planned for the next releases.

 Code: http://bitbucket.org/kotarak/j18n
 Library on clojars: [j18n 1.0.0]

 Sincerely
 Meikel

 --
 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


Re: An open call to the community: Let's prepare for 1.3

2011-09-04 Thread Sean Corfield
On Sun, Sep 4, 2011 at 12:59 AM, Alan Malloy a...@malloys.org wrote:
 Well, ^something still is equivalent to ^{:tag something}, which as I
 understand it is useful for compiler typehinting.

It's probably also worth noting that metadata combines in 1.3.0:

(defn ^:foo ^:bar fubar [] )

In 1.2.1, this gives:

user= (meta #'user/fubar)
{:ns #Namespace user, :name fubar, :file NO_SOURCE_PATH, :line 7,
:arglists ([]), :tag :foo}

In 1.3.0, this gives:

user= (meta #'user/fubar)
{:arglists ([]), :foo true, :bar true, :ns #Namespace user, :name
fubar, :line 1, :file NO_SOURCE_PATH}
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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


Re: No such var while calling a (:require) 'd function

2011-09-04 Thread Sean Corfield
On Sun, Sep 4, 2011 at 1:20 PM, Timothy Washington twash...@gmail.com wrote:
 I was hacking away at this at the meantime. I defined 'remove' functions in
 2 other places - bkell , commands. I ended up renaming commands/remove to
 commands/removek, and now all invocations are working. But I'm pretty sure
 I'm using namespace and require erroneously. Currently, I have a source file
 structure like below:
 src/
    bkell.clj
 src/commands/
    add.clj
    remove.clj
    etc...

 But each of the 'src/commands/' clojure files, uses the '(ns command ...)'
 namespace, not '(ns command.remove ...)', etc. I wanted to do it this way,
 so that client code could just call command/remove, not
 command.remove/remove. But I'm realising that I should instead define (ns
 commands) once, and use (in-ns) in other locations. You can see the source
 here. Looks like 'get' can be redefined in two other namespaces: bkell ,
 commands. But when I try to do that for 'remove', the repl seizes up, and
 I'm curious to know why.

The require should be:

(ns bkell
  (:require commands))

and then you'll reference the functions as (commands/add ...)
(commands/remove ...) etc.

I'm not sure why (:require commands.remove) doesn't give you an
error... perhaps it was pulling in commands/remove.clj anyway?

Is there any reason why you have the commands split across multiple
files? (I'm not saying it's bad, just curious)

I suspect you're somehow calling remove recursively (but it's hard to
tell without seeing more of your code).

Sounds like you're gradually getting a handle on namespaces...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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


Re: Clojurescript: unreachable values in associative arrays.

2011-09-04 Thread Chris Granger
Try (aget (.attributes myelement) data-url)

Cheers,
Chris.

On Sep 4, 8:52 am, rdunklau rdunk...@gmail.com wrote:
 Hello.

 I'm trying to use clojuresript in the browser, and I'm having trouble
 accessing object attributes with dashes in it.
 For example, I'd like to access the data-url attribute of a DOM
 element, but the compiler compiles (.data-url (.attributes myelement))
 to myelement.attributes.data_url.

 Is there a syntax translating to myelement.attributes['data-url'] ?

 Thanks !

-- 
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


Re: No such var while calling a (:require) 'd function

2011-09-04 Thread Timothy Washington
That's interesting. When I try that require A), I get the error in B). Seems
that it's trying to find the commands.clj file.

A)
ns bkell
  (:import java.io.FileReader)
  (:require domain)
  (:require util)
*  (:require commands)*
)

B)
Exception in thread main java.lang.RuntimeException:
*java.io.FileNotFoundException:
Could not locate commands__init.class or commands.clj* on classpath:


You can indeed look at the bkell.clj and commands/ source here:

   - https://github.com/twashing/bkell/tree/jasmine-bdd/src


Thanks Sean
Tim


On Sun, Sep 4, 2011 at 4:50 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Sun, Sep 4, 2011 at 1:20 PM, Timothy Washington twash...@gmail.com
 wrote:
  I was hacking away at this at the meantime. I defined 'remove' functions
 in
  2 other places - bkell , commands. I ended up renaming commands/remove to
  commands/removek, and now all invocations are working. But I'm pretty
 sure
  I'm using namespace and require erroneously. Currently, I have a source
 file
  structure like below:
  src/
 bkell.clj
  src/commands/
 add.clj
 remove.clj
 etc...
 
  But each of the 'src/commands/' clojure files, uses the '(ns command
 ...)'
  namespace, not '(ns command.remove ...)', etc. I wanted to do it this
 way,
  so that client code could just call command/remove, not
  command.remove/remove. But I'm realising that I should instead define (ns
  commands) once, and use (in-ns) in other locations. You can see the
 source
  here. Looks like 'get' can be redefined in two other namespaces: bkell ,
  commands. But when I try to do that for 'remove', the repl seizes up, and
  I'm curious to know why.

 The require should be:

 (ns bkell
  (:require commands))

 and then you'll reference the functions as (commands/add ...)
 (commands/remove ...) etc.

 I'm not sure why (:require commands.remove) doesn't give you an
 error... perhaps it was pulling in commands/remove.clj anyway?

 Is there any reason why you have the commands split across multiple
 files? (I'm not saying it's bad, just curious)

 I suspect you're somehow calling remove recursively (but it's hard to
 tell without seeing more of your code).

 Sounds like you're gradually getting a handle on namespaces...
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 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

Re: An open call to the community: Let's prepare for 1.3

2011-09-04 Thread Stuart Sierra
FYI, I spoke with Luc and told him I'm happy to have c.c.trace continue its 
life if he or someone else will volunteer to maintain it. It will need some 
changes to work with 1.3 because of how it uses `binding`, but that should 
be possible using `with-redefs`.

-S

-- 
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

Figuring out how to integrate clojurescript with other libs

2011-09-04 Thread Jason Hickner
Hello,

I really enjoy clojure for back-end work and have been exploring using
clojurescript for the front end of an upcoming project.

Quickly you run into the issue of integrating external libs. From
reading the list and from Rich's cljs rationale, I gather that the
best practice is to use google closure whenever applicable. That
largely eliminates the need for libraries like jQuery, which is very
cool.

But(!) there are some libraries I use regularly that are not so easy
to replace with closure, like three.js (webgl). My ideal outcome when
using these libs would be that I:

A.) Retain the ability to compile the cljs portion of my code
with :advanced, saving ~200kb (pretty important for production code).
B.) Yet somehow maintain integration with these internal libs.

In my initial tests this doesn't work out of the box, since :advanced
mode mangles any function calls to the external libs. After some
research it looks like the answer is externs[1]. However, js projects
that maintain an extern file seem to be few and far between, and
generating one correctly for a library as large as three.js is
daunting.

So what are other people doing? Is there another solution to this out
there?

If not, maybe an extern autogenerator written in clojure would be a
good solution.

- Jason


[1]: http://code.google.com/closure/compiler/docs/api-tutorial3.html


-- 
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


Re: No such var while calling a (:require) 'd function

2011-09-04 Thread Sean Corfield
On Sun, Sep 4, 2011 at 2:06 PM, Timothy Washington twash...@gmail.com wrote:
 That's interesting. When I try that require A), I get the error in B). Seems
 that it's trying to find the commands.clj file.

Yes. If you look at how various projects work with multiple files in a
single namespace, I think they have a file for the namespace that then
loads the others (which are part of that namespace). See this SO QA
for an example:

http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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


Re: No such var while calling a (:require) 'd function

2011-09-04 Thread Timothy Washington
Oh nice one. I'm going to finish this sprint, then do a second pass over
this code base and refactor this and a few other issues.

Cheers
Tim


On Sun, Sep 4, 2011 at 6:46 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Sun, Sep 4, 2011 at 2:06 PM, Timothy Washington twash...@gmail.com
 wrote:
  That's interesting. When I try that require A), I get the error in B).
 Seems
  that it's trying to find the commands.clj file.

 Yes. If you look at how various projects work with multiple files in a
 single namespace, I think they have a file for the namespace that then
 loads the others (which are part of that namespace). See this SO QA
 for an example:


 http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 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

Re: not= counterintuitive?

2011-09-04 Thread Ken Wesson
On Sat, Sep 3, 2011 at 1:30 PM, Despite desp...@gmail.com wrote:
 So, you want to make sure each value in the vector is unique?  My
 first thought was to put them into a set, then see if the set was
 equal to the vector, but clojure's equality doesn't allow for that.
 And if you put the set back into a vector, you've changed the order.

Just see if the set is the same *size* as the vector. If there were
duplicates, it will be smaller instead.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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


Re: new Getting Started page

2011-09-04 Thread Ken Wesson
On Sat, Sep 3, 2011 at 2:11 AM, Kevin Downey redc...@gmail.com wrote:
 The idea that the way to get started is with a fancy editor and a
 fancy ide is just crazy. The way to get started with Clojure is: write
 functions, and run them, and be happy. None of that requires any of
 the mandated complications that come from sophisticated editing
 environments.

Nope; not if you don't mind losing such minor frills as being able to
save your code to disk and come back to it later. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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


Re: new Getting Started page

2011-09-04 Thread Alan Malloy
On Sep 4, 6:00 pm, Ken Wesson kwess...@gmail.com wrote:
 On Sat, Sep 3, 2011 at 2:11 AM, Kevin Downey redc...@gmail.com wrote:
  The idea that the way to get started is with a fancy editor and a
  fancy ide is just crazy. The way to get started with Clojure is: write
  functions, and run them, and be happy. None of that requires any of
  the mandated complications that come from sophisticated editing
  environments.

 Nope; not if you don't mind losing such minor frills as being able to
 save your code to disk and come back to it later. :)

Are we catering to the crowd who (1) wants to try Clojure, and (2)
doesn't have a text editor with copy/paste on their system? I'm a big
fan of emacs, but you don't need anything more advanced than notepad
to be able to writesave code.

-- 
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


Re: new Getting Started page

2011-09-04 Thread Ken Wesson
On Sun, Sep 4, 2011 at 9:50 PM, Alan Malloy a...@malloys.org wrote:
 Are we catering to the crowd who (1) wants to try Clojure, and (2)
 doesn't have a text editor with copy/paste on their system?

Well, in the original context a Unix commandline environment was being
suggested as well, which means no global clipboard. Even if you opened
an editor and copied something, if you then closed it, ran lein repl
or whatever, and tried to paste -- nada.

Same thing in reverse.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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


Re: Clojurescript: unreachable values in associative arrays.

2011-09-04 Thread rdunklau
Thank you, it seems obvious now that you say it.

On Sep 4, 11:02 pm, Chris Granger ibdk...@gmail.com wrote:
 Try (aget (.attributes myelement) data-url)

 Cheers,
 Chris.

 On Sep 4, 8:52 am, rdunklau rdunk...@gmail.com wrote:







  Hello.

  I'm trying to use clojuresript in the browser, and I'm having trouble
  accessing object attributes with dashes in it.
  For example, I'd like to access the data-url attribute of a DOM
  element, but the compiler compiles (.data-url (.attributes myelement))
  to myelement.attributes.data_url.

  Is there a syntax translating to myelement.attributes['data-url'] ?

  Thanks !

-- 
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