Re: Is there an approved way for testing if something is a zipper?

2013-06-12 Thread Stefan Kamphausen
Thanks for all your suggestions.  Seems like a useful addition to 
clojure.zip to me.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: alter a map in a vector (reference)

2013-06-12 Thread Kelker Ryan
Here's the refactored version.user (def example
 (ref 
  [{:id 1 :email {"a...@mail.com" 1}}
   {:id 2 :email {"d...@mail.com" 1}}
   {:id 3 :email {"g...@mail.com" 2}}
   {:id 4 :email {"f...@mail.com" 2}}]))
#'user/example
user 
(defn update-counter [id xs]
  (dosync
   (let [_ @xs
 at-after (drop-while #(not= id (:id %)) _)
 mod-key (- at-after first :email keys first)
 location (- (count _) (count at-after))]
 (alter xs update-in [location :email mod-key] inc
#'user/update-counter
user (dotimes [_ 3]
	 (update-counter 3 example))
nil
user (clojure.pprint/pprint @example)
[{:email {"a...@mail.com" 1}, :id 1}
 {:email {"d...@mail.com" 1}, :id 2}
 {:email {"g...@mail.com" 5}, :id 3}
 {:email {"f...@mail.com" 2}, :id 4}]
nil
   12.06.2013, 14:47, "Meikel Brandmeyer (kotarak)" m...@kotka.de:Hi,Am Mittwoch, 12. Juni 2013 06:39:59 UTC+2 schrieb Kelker Ryan:user (defn update-counter [id xs](let [at-after (drop-while #(not= id (:id %)) @xs)
  to-modify (- at-after first :email)
  mod-key (- to-modify keys first)
  location (let [_ (- (count @xs) (count at-after))]
 (if-not (pos? _) 0 _))]
  (dosync
   (alter xs update-in [location :email mod-key] inc
 You have to wrap all accesses to xs in the same dosync. Kind regardsMeikel 



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




problem using gen-class and using the class name in the same file

2013-06-12 Thread Armel Esnault
Hi

I try to compile a file that generate a class with gen-class that include 
class name
 at different places in the file here is a simplified version of the 
problem:

lein init test-gen

then edit the core.clj with
--
(ns test-gen.core
  (:gen-class
   :name test-gen.Tata
   :init pre-init
   :constructors {
 [Integer] [Integer]
[test-gen.Tata] [Integer]
}
   )
)

(defn -pre-init
  [x]
  (test-gen.Tata. 9)
  9)
--
add :aot [test-gen.core] in project.clj

then compile with lein compile:

Compiling test-gen.core
Exception in thread main java.lang.ClassNotFoundException: test-gen.Tata, 
compiling:(test_gen/core.clj:1)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyze(Compiler.java:6223)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618)
at clojure.lang.Compiler$TryExpr$Parser.parse(Compiler.java:2136)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyze(Compiler.java:6223)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5054)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3674)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyze(Compiler.java:6223)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3497)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6457)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.analyze(Compiler.java:6223)
at clojure.lang.Compiler.compile1(Compiler.java:7030)
at clojure.lang.Compiler.compile1(Compiler.java:7025)
at clojure.lang.Compiler.compile(Compiler.java:7097)
at clojure.lang.RT.compile(RT.java:387)
at clojure.lang.RT.load(RT.java:427)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$compile$fn__4895.invoke(core.clj:5426)
at clojure.core$compile.invoke(core.clj:5425)
at user$eval7.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.ClassNotFoundException: test-gen.Tata
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at clojure.lang.RT.classForName(RT.java:2039)
at clojure.core$the_class.invoke(genclass.clj:99)
at clojure.core$map$fn__4087.invoke(core.clj:2432)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:473)
at clojure.lang.RT.countFrom(RT.java:526)
at clojure.lang.RT.count(RT.java:519)
at clojure.core$generate_class$to_types__5402.invoke(genclass.clj:131)
at clojure.core$generate_class.invoke(genclass.clj:293)
at clojure.core$gen_class.doInvoke(genclass.clj:622)
at clojure.lang.RestFn.invoke(RestFn.java:1557)
at clojure.lang.Var.invoke(Var.java:477)
at clojure.lang.AFn.applyToHelper(AFn.java:277)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.lang.Compiler.macroexpand1(Compiler.java:6366)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6441)
... 45 more
Compilation failed: Subprocess failed

The problem seems to be that i am using  a class that doesn't exist yet.
If i comment all lines referring to test-gen.Tata; compile; uncommment 
those lines; compile; again then it works. 
Is there a way a better to 

Re: Clojure in production

2013-06-12 Thread Mikera
Hi Plínio,

At Nuroko, we're using Clojure to develop our machine learning toolkit 
(using neural networks). The code is a mix of Clojure and Java.

Some of our tools have public source code here: https://github.com/nuroko

  Mike.



On Monday, 10 June 2013 22:47:25 UTC+1, Plinio Balduino wrote:

 Hi there 

 I'm writing a talk about Clojure in the real world and I would like to 
 know, if possible, which companies are using Clojure for production or 
 to make internal tools. 

 Thank you 

 Plínio Balduino 


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: expectations documentation

2013-06-12 Thread Phillip Lord

It's all working fine now!

Phil

Jay Fields j...@jayfields.com writes:

 Thanks for the report Phillip, I've pushed an update that I hope addresses 
 your issue. Let me know if things aren't fixed.

 Cheers, Jay

 On Tuesday, June 11, 2013 4:51:08 PM UTC-4, Phillip Lord wrote:

 I can't get the nav bar on the left to scroll -- so I can't get to all the 
 documentation. The bottom two 
 also overlap the isn't github fun links. 

 Haven't seen expectations before. Looks really nice. 

 Phil 
  
 From: clo...@googlegroups.com javascript: 
 [clo...@googlegroups.comjavascript:] 
 on behalf of Jay Fields [j...@jayfields.com javascript:] 
 Sent: 11 June 2013 19:39 
 To: clo...@googlegroups.com javascript: 
 Subject: expectations documentation 

 expectations* has always had a decent amount of documentation; however, 
 it's traditionally been in the form of blog entries. 

 I spent a bit of time and converted those entries into the following site: 
 http://jayfields.com/expectations/index.html 

 If you've never looked at expectations and you'd like an alternative to 
 clojure.test, you might want to look at the 10 second example. If the 10 
 second example looks interesting, take 2 minutes to read the introduction - 
 that should give you an idea of whether or not you should invest more in 
 expectations. 

 Cheers, Jay 

 -- 
 -- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group. 
 To post to this group, send email to clo...@googlegroups.com javascript: 
 Note that posts from new members are moderated - please be patient with 
 your first post. 
 To unsubscribe from this group, send email to 
 clojure+u...@googlegroups.com javascript: 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:. 
 For more options, visit https://groups.google.com/groups/opt_out. 




 -- 

-- 
Phillip Lord,   Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk
School of Computing Science,
http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower,   skype: russet_apples
Newcastle University,   twitter: phillord
NE1 7RU 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: alter a map in a vector (reference)

2013-06-12 Thread Laurent PETIT
Hello,

A note about the code organization : I think you should strive to
separate the code that does side effects from the code that works on
the datastructures.

This means you could refactor your refactored version as such:

= (def example
 (ref
   [{:id 1 :email {a...@mail.com 1}}
{:id 2 :email {d...@mail.com 1}}
{:id 3 :email {g...@mail.com 2}}
{:id 4 :email {f...@mail.com 2}}]))

   (defn update-counter-val [v id]
 (let [at-after (drop-while #(not= id (:id %)) v)
   mod-key (- at-after first :email keys first)
   location (- (count v) (count at-after))]
   (update-in v [location :email mod-key] inc)))

   (defn update-counter [id xs]
 (dosync (alter xs update-counter-val id)))

   (dotimes [_ 3]
 (update-counter 3 example))

   @example
#'user/example
#'user/update-counter-val
#'user/update-counter
nil
[{:email {a...@mail.com 1}, :id 1} {:email {d...@mail.com 1}, :id
2} {:email {g...@mail.com 5}, :id 3} {:email {f...@mail.com 2},
:id 4}]


Finally, you could save you some pain if you had a representation of
the data that is more amenable to manipulation.
Depending on your requirements:
- do you really need a vector, or can you go with a set ?

e.g. change example to

(def example
  (ref
#{{:id 1 :email {a...@mail.com 1}}
  {:id 2 :email {d...@mail.com 1}}
  {:id 3 :email {g...@mail.com 2}}
  {:id 4 :email {f...@mail.com 2}}}))

This way, you can simplify the manipulation by using clojure.set :

= (require '[clojure.set :as s])

   (def example
 (ref
   #{{:id 1 :email {a...@mail.com 1}}
 {:id 2 :email {d...@mail.com 1}}
 {:id 3 :email {g...@mail.com 2}}
 {:id 4 :email {f...@mail.com 2}}}))

   (defn update-counter-val [v id]
 (let [r (first (s/select #(= id (:id %)) v))
   mod-key (- r :email keys first)]
   (- v (disj r) (conj (update-in r [:email mod-key] inc)

   (defn update-counter [id xs]
 (dosync (alter xs update-counter-val id)))

   (dotimes [_ 3]
 (update-counter 3 example))

   @example
nil
#'user/example
#'user/update-counter-val
#'user/update-counter
nil
#{{:email {a...@mail.com 1}, :id 1} {:email {f...@mail.com 2}, :id
4} {:email {g...@mail.com 5}, :id 3} {:email {d...@mail.com 1},
:id 2}}


Or alternatively, you can have the records indexed in a hashmap:

= (require '[clojure.set :as s])

   (def example
 (ref
   {1 {:id 1 :email {a...@mail.com 1}}
2 {:id 2 :email {d...@mail.com 1}}
3 {:id 3 :email {g...@mail.com 2}}
4 {:id 4 :email {f...@mail.com 2}}}))

   (defn update-counter-val [v id]
 (let [mod-key (- id v :email keys first)]
   (update-in v [id :email mod-key] inc)))

   (defn update-counter [id xs]
 (dosync (alter xs update-counter-val id)))

   (dotimes [_ 3]
 (update-counter 3 example))

   @example
nil
#'user/example
#'user/update-counter-val
#'user/update-counter
nil
{1 {:email {a...@mail.com 1}, :id 1}, 2 {:email {d...@mail.com 1},
:id 2}, 3 {:email {g...@mail.com 5}, :id 3}, 4 {:email
{f...@mail.com 2}, :id 4}}


Also, restructuring the record a little bit could help, but I don't
understand what it's about, so I don't know what to suggest.
Anyway, you could get rid of computing mod-key by leveraging some more
core clojure functions:

(require '[clojure.set :as s])

(def example
  (ref
{1 {:id 1 :email {a...@mail.com 1}}
 2 {:id 2 :email {d...@mail.com 1}}
 3 {:id 3 :email {g...@mail.com 2}}
 4 {:id 4 :email {f...@mail.com 2}}}))

(defn update-counter-val [v id]
  (letfn [(inc-email [m k v] (assoc m k (inc v)))]
(update-in v [id :email] #(reduce-kv inc-email {} %

(defn update-counter [id xs]
  (dosync (alter xs update-counter-val id)))

(dotimes [_ 3]
  (update-counter 3 example))

@example

(note : this example is a little bit more general: it increments each
value of each email found in the map under the :email key)

finally, if there is only one email per record, then maybe the
structure of the record should be simplified (and the resulting code)
as such:

= (require '[clojure.set :as s])

   (def example
 (ref
   {1 {:id 1 :email a...@mail.com :email-occurences 1}
2 {:id 2 :email d...@mail.com :email-occurences 1}
3 {:id 3 :email g...@mail.com :email-occurences 2}
4 {:id 4 :email f...@mail.com :email-occurences 2}}))

   (defn update-counter-val [v id]
 (update-in v [id :email-occurences] inc))

   (defn update-counter [id xs]
 (dosync (alter xs update-counter-val id)))

   (dotimes [_ 3]
 (update-counter 3 example))

   @example
nil
#'user/example
#'user/update-counter-val
#'user/update-counter
nil
{1 {:email-occurences 1, :email a...@mail.com, :id 1}, 2
{:email-occurences 1, :email d...@mail.com, :id 2}, 3
{:email-occurences 5, :email g...@mail.com, :id 3}, 4
{:email-occurences 2, :email f...@mail.com, :id 4}}

At this point, it becomes arguable, again, if update-counter-val
should exist on its own. Inlining it 

Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread Kelker Ryan
There are two things that I've notice about your code that could probably be the cause. In the :constructors section of :gen-class, you're refering to test-gen.Tata although it doesn't exist yet. The -pre-init function also tries to call a class that doesn't exist yet. 12.06.2013, 16:39, "Armel Esnault" armel.esna...@gmail.com:HiI try to compile a file that generate a class with gen-class that include class name at different places in the file here is a simplified version of the problem:lein init test-genthen edit the core.clj with--(ns test-gen.core  (:gen-class   :name test-gen.Tata   :init pre-init   :constructors { [Integer] [Integer]    [test-gen.Tata] [Integer]    }   ))(defn -pre-init  [x]  (test-gen.Tata. 9)  9)--add ":aot [test-gen.core]" in project.cljthen compile with lein compile:Compiling test-gen.coreException in thread "main" java.lang.ClassNotFoundException: test-gen.Tata, compiling:(test_gen/core.clj:1)    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)    at clojure.lang.Compiler.analyze(Compiler.java:6262)    at clojure.lang.Compiler.analyze(Compiler.java:6223)    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618)    at clojure.lang.Compiler$TryExpr$Parser.parse(Compiler.java:2136)    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455)    at clojure.lang.Compiler.analyze(Compiler.java:6262)    at clojure.lang.Compiler.analyze(Compiler.java:6223)    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618)    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5054)    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3674)    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453)    at clojure.lang.Compiler.analyze(Compiler.java:6262)    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443)    at clojure.lang.Compiler.analyze(Compiler.java:6262)    at clojure.lang.Compiler.analyze(Compiler.java:6223)    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3497)    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6457)    at clojure.lang.Compiler.analyze(Compiler.java:6262)    at clojure.lang.Compiler.analyze(Compiler.java:6223)    at clojure.lang.Compiler.compile1(Compiler.java:7030)    at clojure.lang.Compiler.compile1(Compiler.java:7025)    at clojure.lang.Compiler.compile(Compiler.java:7097)    at clojure.lang.RT.compile(RT.java:387)    at clojure.lang.RT.load(RT.java:427)    at clojure.lang.RT.load(RT.java:400)    at clojure.core$load$fn__4890.invoke(core.clj:5415)    at clojure.core$load.doInvoke(core.clj:5414)    at clojure.lang.RestFn.invoke(RestFn.java:408)    at clojure.core$load_one.invoke(core.clj:5227)    at clojure.core$compile$fn__4895.invoke(core.clj:5426)    at clojure.core$compile.invoke(core.clj:5425)    at user$eval7.invoke(NO_SOURCE_FILE:1)    at clojure.lang.Compiler.eval(Compiler.java:6511)    at clojure.lang.Compiler.eval(Compiler.java:6501)    at clojure.lang.Compiler.eval(Compiler.java:6477)    at clojure.core$eval.invoke(core.clj:2797)    at clojure.main$eval_opt.invoke(main.clj:297)    at clojure.main$initialize.invoke(main.clj:316)    at clojure.main$null_opt.invoke(main.clj:349)    at clojure.main$main.doInvoke(main.clj:427)    at clojure.lang.RestFn.invoke(RestFn.java:421)    at clojure.lang.Var.invoke(Var.java:419)    at clojure.lang.AFn.applyToHelper(AFn.java:163)    at clojure.lang.Var.applyTo(Var.java:532)    at clojure.main.main(main.java:37)Caused by: java.lang.ClassNotFoundException: test-gen.Tata    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)    at java.security.AccessController.doPrivileged(Native Method)    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)    at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)    at java.lang.Class.forName0(Native Method)    at java.lang.Class.forName(Class.java:266)    at clojure.lang.RT.classForName(RT.java:2039)    at clojure.core$the_class.invoke(genclass.clj:99)    at clojure.core$map$fn__4087.invoke(core.clj:2432)    at clojure.lang.LazySeq.sval(LazySeq.java:42)    at clojure.lang.LazySeq.seq(LazySeq.java:60)    at clojure.lang.RT.seq(RT.java:473)    at clojure.lang.RT.countFrom(RT.java:526)    at clojure.lang.RT.count(RT.java:519)    at clojure.core$generate_class$to_types__5402.invoke(genclass.clj:131)    at clojure.core$generate_class.invoke(genclass.clj:293)    at clojure.core$gen_class.doInvoke(genclass.clj:622)    at clojure.lang.RestFn.invoke(RestFn.java:1557)    at clojure.lang.Var.invoke(Var.java:477)    at clojure.lang.AFn.applyToHelper(AFn.java:277)    at clojure.lang.Var.applyTo(Var.java:532)    at clojure.lang.Compiler.macroexpand1(Compiler.java:6366)    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6441)    ... 45 moreCompilation failed: Subprocess 

license of Javascript files generated by Clojurescript?

2013-06-12 Thread PTCMHB
Hi all,
Sorry if this question is too silly:
in EPL's FAQ[1], number 26:
*Some free software communities say that linking to their code 
automatically means that your program is a derivative work. Is this the 
position of the Eclipse Foundation?*
** No, the Eclipse Foundation interprets the term derivative work in a 
way that is consistent with the definition in the U.S. Copyright Act, as 
applicable to computer software. Therefore, linking to Eclipse code might 
or might not create a derivative work, depending on all of the other facts 
and circumstances.
can somebody tell me at a very basic level: when the javascript files 
generated by Clojurescript considered a derivative work? If so, is having a 
webapp on the Internet considered distribution in compiled form?

[1]: http://www.eclipse.org/legal/eplfaq.php

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread Armel Esnault
Yes exactly, i need a constructor which require an instance of the same 
class as parameter and i need to create new instances of this class in some 
methods (i implement an abstract class that require this).


Le mercredi 12 juin 2013 10:54:15 UTC+2, Kelker Ryan a écrit :

 There are two things that I've notice about your code that could probably 
 be the cause. In the :constructors section of :gen-class, you're refering 
 to test-gen.Tata although it doesn't exist yet. The -pre-init function also 
 tries to call a class that doesn't exist yet.
  
 12.06.2013, 16:39, Armel Esnault armel@gmail.com javascript::

 Hi

 I try to compile a file that generate a class with gen-class that include 
 class name
  at different places in the file here is a simplified version of the 
 problem:

 lein init test-gen

 then edit the core.clj with
 --
 (ns test-gen.core
   (:gen-class
:name test-gen.Tata
:init pre-init
:constructors {
  [Integer] [Integer]
 [test-gen.Tata] [Integer]
 }
)
 )

 (defn -pre-init
   [x]
   (test-gen.Tata. 9)
   9)
 --
 add :aot [test-gen.core] in project.clj

 then compile with lein compile:

 Compiling test-gen.core
 Exception in thread main java.lang.ClassNotFoundException: 
 test-gen.Tata, compiling:(test_gen/core.clj:1)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)
 at clojure.lang.Compiler.analyze(Compiler.java:6262)
 at clojure.lang.Compiler.analyze(Compiler.java:6223)
 at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618)
 at clojure.lang.Compiler$TryExpr$Parser.parse(Compiler.java:2136)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455)
 at clojure.lang.Compiler.analyze(Compiler.java:6262)
 at clojure.lang.Compiler.analyze(Compiler.java:6223)
 at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618)
 at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5054)
 at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3674)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453)
 at clojure.lang.Compiler.analyze(Compiler.java:6262)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443)
 at clojure.lang.Compiler.analyze(Compiler.java:6262)
 at clojure.lang.Compiler.analyze(Compiler.java:6223)
 at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3497)
 at clojure.lang.Compiler.analyzeSeq(Compiler.java:6457)
 at clojure.lang.Compiler.analyze(Compiler.java:6262)
 at clojure.lang.Compiler.analyze(Compiler.java:6223)
 at clojure.lang.Compiler.compile1(Compiler.java:7030)
 at clojure.lang.Compiler.compile1(Compiler.java:7025)
 at clojure.lang.Compiler.compile(Compiler.java:7097)
 at clojure.lang.RT.compile(RT.java:387)
 at clojure.lang.RT.load(RT.java:427)
 at clojure.lang.RT.load(RT.java:400)
 at clojure.core$load$fn__4890.invoke(core.clj:5415)
 at clojure.core$load.doInvoke(core.clj:5414)
 at clojure.lang.RestFn.invoke(RestFn.java:408)
 at clojure.core$load_one.invoke(core.clj:5227)
 at clojure.core$compile$fn__4895.invoke(core.clj:5426)
 at clojure.core$compile.invoke(core.clj:5425)
 at user$eval7.invoke(NO_SOURCE_FILE:1)
 at clojure.lang.Compiler.eval(Compiler.java:6511)
 at clojure.lang.Compiler.eval(Compiler.java:6501)
 at clojure.lang.Compiler.eval(Compiler.java:6477)
 at clojure.core$eval.invoke(core.clj:2797)
 at clojure.main$eval_opt.invoke(main.clj:297)
 at clojure.main$initialize.invoke(main.clj:316)
 at clojure.main$null_opt.invoke(main.clj:349)
 at clojure.main$main.doInvoke(main.clj:427)
 at clojure.lang.RestFn.invoke(RestFn.java:421)
 at clojure.lang.Var.invoke(Var.java:419)
 at clojure.lang.AFn.applyToHelper(AFn.java:163)
 at clojure.lang.Var.applyTo(Var.java:532)
 at clojure.main.main(main.java:37)
 Caused by: java.lang.ClassNotFoundException: test-gen.Tata
 at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
 at 
 clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:266)
 at clojure.lang.RT.classForName(RT.java:2039)
 at clojure.core$the_class.invoke(genclass.clj:99)
 at clojure.core$map$fn__4087.invoke(core.clj:2432)
 at clojure.lang.LazySeq.sval(LazySeq.java:42)
 at clojure.lang.LazySeq.seq(LazySeq.java:60)
 at clojure.lang.RT.seq(RT.java:473)
 at clojure.lang.RT.countFrom(RT.java:526)
 at clojure.lang.RT.count(RT.java:519)
 at 

Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread Meikel Brandmeyer (kotarak)
Hi,

test-gen.Tata should probably be test_gen.Tata everywhere. The reference in 
the pre-init function should be fine, because the defn is compiled after 
the generated class is in place.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread Armel Esnault
It seems that only the constructor is the problem. it there is workaround 
to solve this ? 
I have several gen-class calls each need a constructor with an instance of 
the same class as parameter.

Le mercredi 12 juin 2013 11:14:56 UTC+2, Meikel Brandmeyer (kotarak) a 
écrit :

 Hi,

 test-gen.Tata should probably be test_gen.Tata everywhere. The reference 
 in the pre-init function should be fine, because the defn is compiled after 
 the generated class is in place.

 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread Meikel Brandmeyer
Did you check the spelling? - is not valid in a package name. AFAIR using
the classname there should work.

Meikel



2013/6/12 Armel Esnault armel.esna...@gmail.com

 It seems that only the constructor is the problem. it there is workaround
 to solve this ?
 I have several gen-class calls each need a constructor with an instance of
 the same class as parameter.

 Le mercredi 12 juin 2013 11:14:56 UTC+2, Meikel Brandmeyer (kotarak) a
 écrit :

 Hi,

 test-gen.Tata should probably be test_gen.Tata everywhere. The reference
 in the pre-init function should be fine, because the defn is compiled after
 the generated class is in place.

 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 a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/ww7hBtwdhoE/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-12 Thread Mikera
+1 to that! 

It would be great if there was some kind of common infrastructure from a 
tooling perspective, regardless of how the tests actually get written / 
expressed.

If I may add one more thing into the mix, it would be great if we could 
have some good way to integrate with Java testing frameworks such as JUnit. 
I maintain a small library cljunit ( https://github.com/mikera/cljunit ) 
which enables me to run clojure.test tests via JUnit in Eclipse, which is 
extremely convenient. It would be great if this kind of functionality could 
be included in future Clojure testing frameworks.

On Tuesday, 11 June 2013 13:56:44 UTC+1, Laurent PETIT wrote:

 You know, if some day all the test libs / frameworks can be run, test 
 results exploited, etc. through the same abstraction, this will 
 greatly ease the pain of tools developers ! 

 I would better write once the integration between Eclipse way of 
 running and displaying tests, than once per library ! 

 So ... looking forward to see this globally adopted :-) 

 2013/6/11 Steven Degutis sbde...@gmail.com javascript:: 
  Timothy, Brandon, Cedric, et al.: 
  
  Separating out the Discoverer from the Runner in the SPEC is a bad idea. 
  
  The main benefit mentioned so far for such a separation is so we can 
 have 
  different definitions of what constitutes a test. For example, 
  test.generative can generate multiple tests from just one block of code. 
  
  But this creates the same incompatibility problem that we already have 
  between existing test suites. Instead, if we have a single definition of 
 a 
  test, every definer is compatible with another. 
  
  And the current definition is already flexible enough to let you 
 generate 
  multiple tests based on one block of code, like test.generative does. 
  
  
  On Tue, Jun 11, 2013 at 1:57 AM, Cedric Greevey 
  cgre...@gmail.comjavascript: 
 wrote: 
  
  You pass not the Discoverer's results to the Runner, but the Discoverer 
  itself, which the Runner then invokes at need, possibly more than once. 
  
  
  On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis 
  sbde...@gmail.comjavascript: 

  wrote: 
  
  Originally we had Runner split into Discoverer and Runner, but I had 
 to 
  combine them both in Runner again so that we can have an autorunner. 
  
  Imagine that you've started your autorunner at the command line, and 
 you 
  create a new test in your existing file and save it. The discoverer 
 has 
  already done his role and found all existing tests and passed them to 
 the 
  runner, so the runner can't see your new test, he only re-runs the 
 tests 
  that existed when he first started. 
  
  That's why I combined them again. So that he could re-discover all the 
  tests matching some criteria and run them. 
  
  So how do you solve this problem while separating Discoverer from 
 Runner? 
  
  
  On Mon, Jun 10, 2013 at 6:53 PM, Brandon Bloom 
  brandon...@gmail.com javascript: wrote: 
  
  There are currently 4 roles defined: Definer, Asserter, Runner, and 
  Reporter. 
  
  It looks like the Runner does finding, filtering, and execution. I 
  think you could further break the Runner down into Discoverer and 
 Executor. 
  I might want to just ask What tests do I have? without actually 
 running 
  anyway. I may also want a different Executor, like a 
 distributed/parallel 
  executor, while preserving the discovery logic. 
  
  On Saturday, June 8, 2013 11:14:42 AM UTC-4, Steven Degutis wrote: 
  
  Test2 is a new testing lib for Clojure, where the power is its 
  simplicity, extensibility, and a SPEC much like Ring's. 
  
  Github: https://github.com/evanescence/test2 
  
  Some background: It came out of discussions with the smart folks in 
  #clojure, who were frustrated with the inflexibility of existing 
 libs, and 
  intended this to be the spiritual successor to clojure.test. We 
 wanted 
  something that was still simple like clojure.test, but could be 
 extended 
  externally much more easily in case you wanted features found in 
  clojure.test, Midje, Speclj, or Expectations, or whatever else. 
  
  This is a pre-ANN because it's more of a call for extensions. I've 
  written one last night, test2-autorunner, which took about an hour. 
 This 
  should give some idea of how easy it is and how well-designed the 
 SPEC was 
  by the smart folks of #clojure. There are some ideas at the bottom 
 of the 
  wiki, but of course any extensions are encouraged. 
  
  -Steven 
  
  -- 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to 
  clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient 
 with 
  your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 
  --- 
  You received this message because you are 

Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread Armel Esnault
i made the same test without any - or _ the problem is still there

Le mercredi 12 juin 2013 11:30:33 UTC+2, Meikel Brandmeyer (kotarak) a 
écrit :

 Did you check the spelling? - is not valid in a package name. AFAIR using 
 the classname there should work.

 Meikel



 2013/6/12 Armel Esnault armel@gmail.com javascript:

 It seems that only the constructor is the problem. it there is workaround 
 to solve this ? 
 I have several gen-class calls each need a constructor with an instance 
 of the same class as parameter.

 Le mercredi 12 juin 2013 11:14:56 UTC+2, Meikel Brandmeyer (kotarak) a 
 écrit :

 Hi,

 test-gen.Tata should probably be test_gen.Tata everywhere. The reference 
 in the pre-init function should be fine, because the defn is compiled after 
 the generated class is in place.

 Meikel

  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups Clojure group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/clojure/ww7hBtwdhoE/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to 
 clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: license of Javascript files generated by Clojurescript?

2013-06-12 Thread David Pollak
The license of the JavaScript generated by the ClojureScript compiler is
the license of the source code that was compiled. And that license may be
my company owns it and it's proprietary and we're not licensing it to
anyone else.

Even the FSF does not assert a GPL over code compiled by GCC even though
GCC is GPL.

Compiling code is not linking as per the GPL.

Linking to a library is linking and that's why there's the LGPL... allowing
non-free software to link to the library.

With all this being said, the only thing you have to worry about is if you
make a change to the ClojureScript compiler itself or another
Clojure-related library. Those are licensed under the EPL which requires
that you make open the changes you make to EPL code.

Does that help?



On Wed, Jun 12, 2013 at 5:06 AM, PTCMHB phuthuycuoimayhut...@gmail.comwrote:

 Hi all,
 Sorry if this question is too silly:
 in EPL's FAQ[1], number 26:
 *Some free software communities say that linking to their code
 automatically means that your program is a derivative work. Is this the
 position of the Eclipse Foundation?*
 ** No, the Eclipse Foundation interprets the term derivative work in a
 way that is consistent with the definition in the U.S. Copyright Act, as
 applicable to computer software. Therefore, linking to Eclipse code might
 or might not create a derivative work, depending on all of the other facts
 and circumstances.
 can somebody tell me at a very basic level: when the javascript files
 generated by Clojurescript considered a derivative work? If so, is having a
 webapp on the Internet considered distribution in compiled form?

 [1]: http://www.eclipse.org/legal/eplfaq.php

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-12 Thread Marshall Bockrath-Vandegrift
Plínio Balduino pbaldu...@gmail.com writes:

 I'm writing a talk about Clojure in the real world and I would like to
 know, if possible, which companies are using Clojure for production or
 to make internal tools.

At Damballa we’re using Clojure and Cascalog to do all of our
Hadoop-based backend data processing.  As we’ve moved more of our
infrastructure to Hadoop- and JVM-based technologies (such as HBase),
our use of Clojure has expanded to encompass most new server-side
development.

We have a small amount of Clojure code released as open source, with
more to come in the future:

https://github.com/damballa

And obligatory company Web site:

https://www.damballa.com/

-Marshall

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-12 Thread Stuart Sierra
 I don't fully understand how clojure.test's fixtures plays
 into its ability to call test functions from within other
 test functions.

They don't. Being able to call test functions within other
test functions is probably the least-designed and least-used
feature of clojure.test.

-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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Instaparse 1.1.0

2013-06-12 Thread JeremyS
Hi puzzler,

I have a project https://github.com/JeremS/cljss-core/tree/v0.4.0 that I 
have been meaning to be useable from Clojure and ClojureScript. To do so I 
am using lein-dalap http://birdseyesoftware.github.io/lein-dalap.docs/.

I totally agree with you about the issues you have foreseen. The protocols 
aren't exactly the same, the java specific parts would need to be rewritten 
in cljs, I don't know how much work it would need to have the incremental 
vector working in cljs since hashing isn't 
'embedded' in JavaScript (cljs uses the google closure libraries for that). 
lein-dalap http://birdseyesoftware.github.io/lein-dalap.docs/ helps 
resolve some of these issues but not all of them. 
(cljxhttps://github.com/lynaghk/cljx might 
also be an alternative)

I will totally add a request on github. I know it's a big wish to see 
instaparse in cljs and I'd love to contribute as best I can.

I'd also like to give a little rationale for the cljs adaptation. I am a 
big fan of LightTable, which I use most of the time now. LT is written
in ClojureScript and I can't wait to see the plugin system released in 
future versions. Using instaparse to extend it would be really neet since 
it supports ABNF grammar and, as your wiki taught me, ABNF makes for 
standard grammars that we can find on the internet. It  would be nice to 
exploit directly these grammar in LT using instaparse. 

Another useful use case is in browser editors for syntaxes like markdown. I 
have read a blog post considering markdown potentially armful and arguing 
in favour of the wiki creole syntax. There is an EBNF grammar for creole...

Last but very not the least, there are some very inspiring talks from Alan 
Kay that advocate lisp philosophy of programming, 
molding the language to your problem and coding in a language that suits 
the domain of the problem. Instaparse is a great 
tool to generate our own languages and I am coding some ClojureScript code 
at the moment so call me biased... :)

Cheers,

Jeremys



On Wednesday, June 12, 2013 12:09:56 AM UTC+2, puzzler wrote:

 Honestly I hadn't yet given it any thought.  Thanks for the interest in 
 having it on Clojurescript.  Here are a few issues that come to mind:

 1.  To achieve performance, I've spent time coding custom data structures 
 that implement various Clojure and Java interfaces.  I haven't done much 
 with Clojurescript, but my impression is that the ecosystem of protocols is 
 completely different, so I imagine that could be a pain to transfer over.

 2.  I don't know much about the performance of Javascript/Clojurescript's 
 underlying data structures.  For example, in Java, the substring operation 
 used to be O(1), but recently, much to my dismay, they changed it to O(n).  
 That change was annoying, and it means I'm going to have to rework some 
 code to deal with that, but at least I heard about it and can take it into 
 account.  But in Javascript I don't even *know* the performance 
 characteristics of its strings and substring operation.  What other 
 Javascript performance gotchas don't I know about?

 3. I'm assuming that due to the above, it won't be as simple as just 
 recompiling the code for Clojurescript.  I have no idea what's involved 
 with maintaining a code base for the two target languages simultaneously.  
 Sounds non-trivial, although maybe it won't seem so intimidating once 
 things have settled down and I'm not making quite so many performance 
 tweaks and feature enhancements to the code.

 In any case, please add your request as a github issue, so I don't forget 
 about it.

 On Tue, Jun 11, 2013 at 8:06 AM, JeremyS jschof...@gmail.comjavascript:
  wrote:

 Hi Puzzler,

 I was wondering if you planned to port Instaparse to ClojureScript. I 
 know it's asking a lot, but I am one of those who would love
 to be able to run it in a browser or in node.js...

 Cheers,

 Jeremys.



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




clojure proxy does not re-define methods then a Java constructor is called

2013-06-12 Thread Vladimir Tsichevski
Hi,

In a Clojure proxy I need to re-define a method which is called by a Java 
constructor. I noticed that the function dispatch table in the proxy object 
is not initialized at that moment still, so the original method is always 
called.

Any suggestions?

Thanks in advance,
Vladimir

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: expectations documentation

2013-06-12 Thread Jay Fields
On Tuesday, June 11, 2013 2:39:33 PM UTC-4, Jay Fields wrote:

 expectations* has always had a decent amount of documentation; however, 
 it's traditionally been in the form of blog entries. 

 I spent a bit of time and converted those entries into the following site: 
 http://jayfields.com/expectations/index.html


More documentation added for (a) reducing failure noise and (b) tweaking 
emacs to indent correctly and take up less horizontal space

http://jayfields.com/expectations/env-tweaks.html
http://jayfields.com/expectations/emacs-tweaks.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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread joshrotenb...@gmail.com
I was messing around recently with creating a Builder class using gen-class 
and ran into the same issue since each set* method returns this. I'm pretty 
sure it's a chicken and egg issue: the class doesn't exist yet but you need 
to specify it in the gen-class ...

I reworked your example a little bit, see if this fixes the 
problem: https://www.refheap.com/15708 and https://www.refheap.com/15709

I used Object in gen-class, and then check the type in the init.

Josh

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread Armel Esnault
It works for me!!
Thanks josh, meikel and kelker for your answers.

Le mercredi 12 juin 2013 18:10:37 UTC+2, joshro...@gmail.com a écrit :

 I was messing around recently with creating a Builder class using 
 gen-class and ran into the same issue since each set* method returns this. 
 I'm pretty sure it's a chicken and egg issue: the class doesn't exist yet 
 but you need to specify it in the gen-class ...

 I reworked your example a little bit, see if this fixes the problem: 
 https://www.refheap.com/15708 and https://www.refheap.com/15709

 I used Object in gen-class, and then check the type in the init.

 Josh


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: problem using gen-class and using the class name in the same file

2013-06-12 Thread joshrotenb...@gmail.com
On Wednesday, June 12, 2013 9:31:55 AM UTC-7, Armel Esnault wrote:

 It works for me!!
 Thanks josh, meikel and kelker for your answers.


Glad that works. Also note that my :constructors has a redundant entry: it 
can just be :constructors {[Object] []} since the type check is in -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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Best IDE

2013-06-12 Thread Stathis Sideris
Ok, in my opinion (and I develop Clojure full-time with Emacs), it's way 
harder to learn Emacs than for Emacs to learn you (In Soviet Russia, 
editor learns you etc).

What I mean: Emacs is very-very-very customizable. If you're learning 
Clojure, to some extend you are becoming familiar with elisp (the embedded 
Emacs Lisp) at the same time because they're both Lisps. It's really worth 
learning how to customize Emacs very early on. For example, people complain 
all the time about the cryptic, hard to remember key combinations. You know 
what? Just re-assign the ones that you use frequently to something that you 
remember. My F7 toggles line wrapping. Not sure why that key made sense to 
me, but it did, and I have never forgotten it. There are good mechanisms 
for discovering what function is called when you press a key combination 
(and it's always the case that a function is called), so when you know the 
name of the function you can trivially create your own key combination for 
calling it.

Another approach is to discover the name and then call the function by 
typing it's name (Alt-X, function name, ENTER). I do that a lot, and when I 
get bored of doing it, I just assign it to a key combination.

This is an approach that pays huge dividends, because you end up with an 
editor that feels very close to your needs - and very close to your usage 
patterns. The main disadvantage is that once you customize it to such an 
extent, no other Emacs user can sit at your keyboard and use it :-)

Also, Emacs' paredit (the structural editing plugin for Lisps) is extremely 
useful when editing Clojure, I can't even imagine doing without it.

Stathis

On Friday, 7 June 2013 23:27:26 UTC+1, Denis Labaye wrote:

 *Learning Emacs is more important than learning Clojure.*

   -- A Clojure fanboy and former Vim user



 On Fri, Jun 7, 2013 at 10:46 PM, futile sbde...@gmail.com 
 javascript:wrote:

 Before, I used vim for several years. But when I learned Clojure I 
 switched to emacs, and it's really not hard or awkward like I was afraid 
 of. Honestly now I like it much better than vim. And I've found paredit and 
 nrepl.el to be extremely handy, even used together.


 On Tuesday, January 17, 2012 3:38:05 PM UTC-6, Josef Frydl wrote:

 Can you please recommend the Best IDE for Clojure? I have Eclipse 
 NetBeans and JetBrain already installed. 

  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-12 Thread Steven Degutis
There's been some discussion about how nesting should work. It should
probably be part of the spec, in a flexible and non-intrusive way. Then we
would consider a flat suite of tests to be just nested suite that's only a
1-level deep.

The two things we want nesting for are defining fixture-like behavior
(around-each or around-all, etc), and reporting groups of tests together.

The fixture part should almost definitely *not* be part of the spec. That's
way too limiting for innovation. But the reporting aspect probably needs a
chance to the spec.

For fixture stuff, in speclj (rspec) parlance, you could imagine the
describe macro, which transforms a list of it-blocks into a flat list of
test-fns that are each wrapped inside any before/after/around functions
given at the same level, and recursively does this with nested describe
blocks. All this work could be done in the Definer, and no matter how deep
the describe-nesting is, the result is always still a flat list of
test-fns. This is a simple way to conform to the current spec while having
fixture-like behavior. This was my plan for the speclj port.

But for reporting, it's trickier. The reporter needs to see the structure
somehow. This isn't easily faked with a flat list of test-results, so the
test-results would have to become potentially nested. But this raises the
question of how a flat list of test-fns produces a nested list of
test-results.

This is the part I'm totally confused about.


On Sat, Jun 8, 2013 at 10:14 AM, Steven Degutis sbdegu...@gmail.com wrote:

 Test2 is a new testing lib for Clojure, where the power is its simplicity,
 extensibility, and a 
 SPEChttps://github.com/evanescence/test2/blob/master/SPEC.md much
 like Ring's.

 Github: https://github.com/evanescence/test2

 Some background: It came out of 
 discussionshttps://github.com/evanescence/test2/wiki/Communal-Brainstorming 
 with
 the smart folks in #clojure, who were frustrated with the inflexibility of
 existing libs, and intended this to be the spiritual successor to
 clojure.test. We wanted something that was still simple like clojure.test,
 but could be extended externally much more easily in case you wanted
 features found in clojure.test, Midje, Speclj, or Expectations, or whatever
 else.

 This is a pre-ANN because it's more of a call for extensions. I've written
 one last night, 
 test2-autorunnerhttps://github.com/evanescence/test2-autorunner,
 which took about an hour. This should give some idea of how easy it is and
 how well-designed the SPEC was by the smart folks of #clojure. There are
 some ideas at the bottom of the wiki, but of course any extensions are
 encouraged.

 -Steven

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Data vs API

2013-06-12 Thread Chris Ford
Antonio, I think he means that the onus is on the consumer of an API to 
make a sensible decision about what they depend on. Consumers could choose 
to depend on implementation details rather than provided abstractions. When 
they do so, they need to accept the burden of adapting should those 
implementation details change.

Language constructs e.g. data hiding, can sometimes forcibly prevent 
consumers from depending on implementation details. But Rich's philosophy 
is that we should trust programmers to judge the trade-offs of depending on 
particular implementation details.

The argument is that anyone who can't adequately weigh up those tradeoffs 
and chooses to depend on inappropriate parts of an API lacks the judgement 
of a good programmer. The Clojure community would generally rather to 
optimise for the case of the skilled and rational programmer than introduce 
complexity designed to save people with poor judgement from themselves.

If someone wants to build code around details of your data structures, let 
them.

Cheers,

Chris

On Sunday, May 6, 2012 8:11:13 PM UTC+3, Antonio Shastun wrote:

 can any one explain to me please

 If people don't have the sensibilities to desire to program to 
 abstractions and to be wary of marrying implementation details, then 
 they are never going to be good programmers. 



 четверг, 3 мая 2012 г., 3:35:04 UTC+3 пользователь Takahiro Hozumi написал:

  I've read in some recent posts that Clorujians prefer data to APIs.  
 I'm not 
  sure I understand what this means, in practice.  When I'm in the early 
  stages of developing an application, the data structures undergo a 
 great 
  deal of change.  One of the ways, I isolate parts of the code from 
 these 
  sorts of changes is by writing accessor functions.  Maybe this is OO 
  thinking but it seems to me a wise application of DRY. 
  
  Would these accessor functions be considered an API?  If so, why should 
 I 
  prefer accessing the raw data structure?  If not, what is constitutes 
 an 
  API? 

 I think Rich's comments in an interview with Fogus is helpful. 
 http://www.codequarterly.com/2011/rich-hickey/ 

 Fogus: Following that idea--some people are surprised by the fact that 
 Clojure does not engage in data-hiding encapsulation on its types. Why 
 did you decide to forgo data-hiding? 
 Hickey: Let's be clear that Clojure strongly emphasizes programming to 
 abstractions. At some point though, someone is going to need to have 
 access to the data. And if you have a notion of private, you need 
 corresponding notions of privilege and trust. And that adds a whole 
 ton of complexity and little value, creates rigidity in a system, and 
 often forces things to live in places they shouldn't. This is in 
 addition to the other losing that occurs when simple information is 
 put into classes. To the extent the data is immutable, there is little 
 harm that can come of providing access, other than that someone could 
 come to depend upon something that might change. Well, okay, people do 
 that all the time in real life, and when things change, they adapt. 
 And if they are rational, they know when they make a decision based 
 upon something that can change that they might in the future need to 
 adapt. So, it's a risk management decision, one I think programmers 
 should be free to make. 
 If people don't have the sensibilities to desire to program to 
 abstractions and to be wary of marrying implementation details, then 
 they are never going to be good programmers. 

 2012/5/2 Mark markad...@gmail.com javascript:: 
  I've read in some recent posts that Clorujians prefer data to APIs.  
 I'm not 
  sure I understand what this means, in practice.  When I'm in the early 
  stages of developing an application, the data structures undergo a 
 great 
  deal of change.  One of the ways, I isolate parts of the code from 
 these 
  sorts of changes is by writing accessor functions.  Maybe this is OO 
  thinking but it seems to me a wise application of DRY. 
  
  Would these accessor functions be considered an API?  If so, why should 
 I 
  prefer accessing the raw data structure?  If not, what is constitutes 
 an 
  API? 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient with 
 your 
  first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  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 

Re: license of Javascript files generated by Clojurescript?

2013-06-12 Thread PTCMHB
Thanks David,
I was confused because when using clojurescript we can't avoid using 
functions from core libraries and after compiled down to javascript, (parts 
of) those functions will appear on the final javascript file.
So those clojurescript-origin compiled forms are considered unmodified 
libraries which are allowed to re-distributed by EPL.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: what directs the program in my-website progream to execute the various files, welcome, users?

2013-06-12 Thread Rob Day
 On Tuesday, June 11, 2013 5:32:46 AM UTC-7, jayvandal wrote:

 what statements makes the program execute.
 The main statement tells the program to execute server file
 what statements in the server file tell the program to run the welcome
 file ? the user file

Is welcome.clj in src/my_website/views/? If so, it looks like the line
'(server/load-views src/my_website/views/)' will execute
welcome.clj, including the 'defpage /welcome' (see
http://www.webnoir.org/autodoc/1.2.0/noir.server-api.html#noir.server/load-views).
That defpage tells the server what to do when /welcome is accessed
over the web - and it calls the layout function in common.clj, which
calls login-form, which creates the login screen.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure in production

2013-06-12 Thread Lynn Grogan
Plínio,
The newest episode of the Relevance podcast is all about Clojure (and 
Datomic) in production at Roomkey.com. 
You can find the episode  show notes here: http://is.gd/RAvhqG 

Cheers! Lynn

On Wednesday, June 12, 2013 8:46:41 AM UTC-4, Marshall Bockrath-Vandegrift 
wrote:

 Plínio Balduino pbal...@gmail.com javascript: writes: 

  I'm writing a talk about Clojure in the real world and I would like to 
  know, if possible, which companies are using Clojure for production or 
  to make internal tools. 

 At Damballa we’re using Clojure and Cascalog to do all of our 
 Hadoop-based backend data processing.  As we’ve moved more of our 
 infrastructure to Hadoop- and JVM-based technologies (such as HBase), 
 our use of Clojure has expanded to encompass most new server-side 
 development. 

 We have a small amount of Clojure code released as open source, with 
 more to come in the future: 

 https://github.com/damballa 

 And obligatory company Web site: 

 https://www.damballa.com/ 

 -Marshall 



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: license of Javascript files generated by Clojurescript?

2013-06-12 Thread David Pollak
Unless one of the folks working on ClojureScript says otherwise, I would
find it a real difficult interpretation of the EPL as applied to
ClojureScript to be more restrictive than the GPL.


On Wed, Jun 12, 2013 at 2:29 PM, PTCMHB phuthuycuoimayhut...@gmail.comwrote:

 Thanks David,
 I was confused because when using clojurescript we can't avoid using
 functions from core libraries and after compiled down to javascript, (parts
 of) those functions will appear on the final javascript file.
 So those clojurescript-origin compiled forms are considered unmodified
 libraries which are allowed to re-distributed by EPL.

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A blocking lazy sequence populated by multiple worker threads

2013-06-12 Thread Jeff Palmucci
If you are looking for a more idiomatic solution, 
https://github.com/jpalmucci/clj-yield wraps a lazy sequence around a blocking 
queue. 

On May 30, 2013, at 11:58 AM, Artem Boytsov aboyt...@gmail.com wrote:

 Hello, Colin,
 
 I suspected I should turn to existing Java concurrency constructs. Thank you 
 very much for your response, and this is what I'm going to do. I was just 
 hoping there's some Clojure idiomatic way to solve this, using agents, 
 futures, promises, refs, and other Clojure stuff. For example, if there were 
 a function taking a list of agents and return any one of them which is ready 
 (vs. all of them), I would be able to implement my example relatively simply. 
 Just wanted to make sure I'm not missing anything.
 
 Artem.
 
 On Thursday, May 30, 2013 2:12:02 AM UTC-7, Colin Yates wrote:
 Can you not use 
 http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/LinkedBlockingQueue.html?
   That will provide the blocking element.  
 
 To execute N (i.e. 10 in your example) use a 
 http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html.
   The 'glue' would be an infinite loop which .takes from the incoming 
 sequence (which could also be a LBQ) and then puts it on the thread pool.
 
 That gets stuff happening in parallel.  
 
 To consume the results of that stuff in a sequence have a(nother) LBQ which 
 the consumers consume (using the blocking .take) and have the glue code wrap 
 the function it received from the LBQ in a function which takes the result of 
 that function and puts it on the sequence.  
 
 This looks like (clojure forgiveness is required):
 
 [code]
 (def incoming-queue (javaLinkedBlockingQueue.))
 (def outgoing-queue (javaLinkedBlockingQueue.))
 (def workers (java... some thread pool/executor.))
 
 ; the following would need to reify itself to be a Runnable, not got that far 
 yet :)
 (defn execute [job result-queue] (let [result (job)] (.put result-queue 
 result)))
 
 (def stop-loop (atom false))
 (while (not @stop-loop)
   (def next (.take incoming-queue))
   (execute next outgoing-queue))
 [/code]
 
 A few caveats/notes:
  - this uses a lot of Java constructs - that is fine.  It is perfectly 
 idiomatic to use the right Clojure or Java constructs.  LBQs rock.
  - the above won't compile and the 'execute' needs to return a Runnable - not 
 sure how.
  - it ties up a worker thread until the result can be put onto the outgoing 
 LBQ.  If the outgoing LBQ is bounded and you don't have enough consumers then 
 eventually all the worker threads will be effectively idle until the results 
 can be consumed.  
  - if you didn't want to use a ThreadPool then you could update 'executor' to 
 maintain an (atom) number of currently executing jobs.  The glue code is 
 single threaded so no chance of multiple jobs starting in parallel.  The 
 single threaded 'cost' is fine as it is doing nothing other than moving 
 things around.
 
 I am a (Clojure) newbie so be warned!  I fully look forward to somebody 
 providing a much nicer and more idiomatic Clojure implementation :).
 
 Hope this helps.
 
 Col
 
 On Thursday, 30 May 2013 06:19:29 UTC+1, Artem Boytsov wrote:
 Hello, folks!
 
 I'm a relative noob in Clojure especially when it comes to concurrency, so 
 please forgive my ignorance. I have a processing stage (producer) that feeds 
 to another one (consumer). The producer has a bunch of items to process and 
 it's I/O blocking which takes random time, but the order of the items is 
 insignificant, so ideally they would materialize on the consumer side on the 
 first come first serve basis.
 
 I would like to create a blocking lazy sequence I could just give to the 
 consumer. I know how to create a lazy sequence (lazy-seq), or how to make it 
 run in background and block on results (seque), but what I can't wrap my head 
 around is how parallelize the processing the Clojure way. I was considering 
 kicking off multiple agents, but how can I wait for any one of them to 
 finish, not all of them (as await does)? I'm not sure but I think the same 
 goes for futures/promises. I could have multiple agents putting the results 
 into some shared sequence, but then how do I block on the sequence itself?
 
 What I'm trying to do can be described in the following way in a silly 
 imperative pseudo-code:
 
 workers = new Worker[10]   ; initially w.got_data == nil 
 for each x in source_data:
w = wait_for_any_worker_ready(workers)  ; initially all of them are 
 ready
if (w.got_data) 
  output.enqueue(w.data); the consumer will read 
 output in a blocking way
  w.process(x)  ; non-blocking, kicks off in 
 the background
 
 Or, another way to describe it, given a seq of integers:
 
 [ 1, 2, 3, 4 ... ]
 
 and a simple function with a variable delay:
 
 (defn process [x]
(Thread/sleep (* 1 (rand)))
(* 2 x))
 
 How can I write a function which would 

Re: Clojure in production

2013-06-12 Thread Jose A. Ortega Ruiz

Hi Plinio,

On Mon, Jun 10 2013, Plínio Balduino wrote:

 Hi there

 I'm writing a talk about Clojure in the real world and I would like to
 know, if possible, which companies are using Clojure for production or
 to make internal tools.

At BigML, our backend is written almost fully (99%) in Clojure.  We've
released a couple of libraries it uses as open source:

https://github.com/bigmlcom/histogram
https://github.com/bigmlcom/sampling
https://github.com/bigmlcom/io

Cheers,
jao
-- 
Where is the Life we have lost in living? Where is the wisdom we have
lost in knowledge? Where is the knowledge we have lost in information?
  -T.S. Eliot, poet (1888-1965)

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: license of Javascript files generated by Clojurescript?

2013-06-12 Thread Stefan Kamphausen
Hi,

On Wednesday, June 12, 2013 2:29:42 PM UTC+2, David Pollak wrote:

 The license of the JavaScript generated by the ClojureScript compiler is 
 the license of the source code that was compiled. And that license may be 
 my company owns it and it's proprietary and we're not licensing it to 
 anyone else.

 Even the FSF does not assert a GPL over code compiled by GCC even though 
 GCC is GPL.



Note, that e.g. code generated by the program wsdl2h which is part of gSOAP 
*is* placed under the GPL and that the FSF wants to allow creation of 
proprietary programs with GCC (see e.g. 
http://www.gnu.org/licenses/gcc-exception-3.1.en.html).

Thus, a word of clarification regarding the intent of the creators of 
ClojureScript might help with the adoption, particularly in larger 
companies.


Kind regards,
Stefan

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-12 Thread Shannon Severance
Thank you all, I've learned something from each entry. My latest version, 
incorporating some of the changes suggested:

(defn make-crypto []
  (let [lower (map char (range (int \a) (inc (int \z
upper (map char (range (int \A) (inc (int \Z
digit (map char (range (int \0) (inc (int \9

[sl su sd] (map shuffle [lower upper digit])

encrypt (zipmap (concat lower upper digit) 
(concat sl su sd))]
(fn [s]
  (apply str (map #(encrypt % %) s)

I specified the range the way I did because I wanted meaningful start and 
end points, I don't have the code points for many characters memorized.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: license of Javascript files generated by Clojurescript?

2013-06-12 Thread Evan Mezeske
On Wednesday, June 12, 2013 5:29:42 AM UTC-7, David Pollak wrote:

 With all this being said, the only thing you have to worry about is if you 
 make a change to the ClojureScript compiler itself or another 
 Clojure-related library. Those are licensed under the EPL which requires 
 that you make open the changes you make to EPL code.


Just a minor nit: you can make all the changes you want to the 
ClojureScript compiler without releasing the modified source code as long 
as you do not distribute a modified version of the compiler.  If you 
distribute e.g. a JAR containing your custom ClojureScript compiler, then 
you need to release the source code.

It's a somewhat common perception that the popular OSS licenses force you 
to release any in-house modifications you make, but this is generally 
untrue.  The EPL FAQ linked above says this very clearly:

*If I modify a Program licensed under the EPL, but never distribute it to 
anyone else, do I have to make my modifications available to others?*
No. If you do not distribute the modified Program, you do not have to make 
your modifications available to others.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-12 Thread Kelker Ryan
No problem. I re-wrote your latest version, so let me know what you think. tdsl.core (defn make-crypto []
 (let [char-range #(map char
(range (int %1)
   (- %2 int inc)))
   [l u d] (map char-range [\a \A \0] [\z \Z \9])
   [sl su sd] (map shuffle [l u d])
   encrypt (zipmap (concat l u d) (concat sl su sd))]
   (fn [s] (apply str (map #(encrypt % %) s)
#'tdsl.core/make-crypto
tdsl.core ((make-crypto) "1 potato 2 potato")
"6 hxnvnx 0 hxnvnx"
tdsl.core ((make-crypto) "1 potato 2 potato")
"3 dszmzs 1 dszmzs"
 13.06.2013, 09:30, "Shannon Severance" s...@s53.me:Thank you all, I've learned something from each entry. My latest version, incorporating some of the changes suggested:(defn make-crypto []  (let [lower (map char (range (int \a) (inc (int \z        upper (map char (range (int \A) (inc (int \Z        digit (map char (range (int \0) (inc (int \9                [sl su sd] (map shuffle [lower upper digit])                encrypt (zipmap (concat lower upper digit)                         (concat sl su sd))]    (fn [s]      (apply str (map #(encrypt % %) s) I specified the range the way I did because I wanted meaningful start and end points, I don't have the code points for many characters memorized. --  --  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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Local database recommendation?

2013-06-12 Thread Cedric Greevey
I have some additional questions about Titanium, as the documentation did
not make these particular matters sufficiently clear:

1. Can query results take the form of a lazy sequence, one which will not
result in an OOME if it's too large so long as the head is not held onto
while it is consumed? E.g. (take 3 (run-query-with-ten-zillion-results))
should not blow up.

2. In particular, can indexed-key searches do so?

3. Given a backing DB that supports global queries of the whole graph, and
supposing the graph was ginormous and a query returned all or most of the
nodes, could *those* be lazily consumed in an OOME-avoiding manner?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Local database recommendation?

2013-06-12 Thread Zack Maril
No. We have done nothing with laziness. If your graph doesn't change much, 
you could probably roll your own. If it is changing often, I'm not sure 
laziness would be such a good thing. One way of rolling your own could be 
going through and getting all the ids of the elements you want and then 
mapping across those lazily while doing any work you want with the objects 
they represent. That shouldn't be too difficult to do and all your id's 
might easily fit into memory without any problems. 
-Zack

On Wednesday, June 12, 2013 10:30:02 PM UTC-4, Cedric Greevey wrote:

 I have some additional questions about Titanium, as the documentation did 
 not make these particular matters sufficiently clear:

 1. Can query results take the form of a lazy sequence, one which will not 
 result in an OOME if it's too large so long as the head is not held onto 
 while it is consumed? E.g. (take 3 (run-query-with-ten-zillion-results)) 
 should not blow up.

 2. In particular, can indexed-key searches do so?

 3. Given a backing DB that supports global queries of the whole graph, and 
 supposing the graph was ginormous and a query returned all or most of the 
 nodes, could *those* be lazily consumed in an OOME-avoiding manner?
  

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




请教一个问题

2013-06-12 Thread stream
Hi all
我在看 lein-ring插件源码时,发现很多 语法引用符号 ` 都用在defn里。
   `(do ~(start-nrepl-expr project) ~(start-server-expr project))

(defn load-namespaces
  [ syms]
  `(require
~@(for [s syms :when s]
`'~(if-let [ns (namespace s)]
 (symbol ns)
 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.