Re: Do you know which language the clojure is written by?

2013-04-22 Thread dennis zhuang
Java.

But there is some clojure version written in ruby,python,c# and javascript.


2013/4/22 

> Hi,
> Do you know which language the clojure is written by?
>
> --
> --
> 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.
>
>
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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: Laziness in filter

2013-03-17 Thread dennis zhuang
Yep,it's chunked sequence,just like batch processing.
You can use the seq1 function in fogus blog.

2013/3/17 Evan Mezeske 

> I'd guess that what you're seeing is related to chunked sequences:
> http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ .
>
>
> On Sunday, March 17, 2013 1:12:17 AM UTC-7, bruce li wrote:
>>
>> Hello, everyone. I'm writing some code that utilizes the lazy sequence.
>> But I found something strange. Here is how:
>>
>> The code is like:
>>
>> (first (filter some-expensive-io urls))
>>
>> The code is aimed to find the first result of the operations on the urls
>> that is not nil. However, it seems that the io operations are executed once
>> more than needed. As the operations are slow, one more round increases the
>> overhead dramatically.
>>
>> Then I tested other pieces of code, such as:
>>
>> (first (filter #(when (> % 1) (println %) %) (range)))
>>
>> It prints out:
>> 2
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>> 10
>> 11
>> 12
>> 13
>> 14
>> 15
>> 16
>> 17
>> 18
>> 19
>> 20
>> 21
>> 22
>> 23
>> 24
>> 25
>> 26
>> 27
>> 28
>> 29
>> 30
>> 31
>>
>> and returns: 2
>>
>> So why the lazy sequence is realized more than it is needed? Could I
>> enforce the laziness and save unnecessary operation?
>>
>>
>> Thanks,
>> Bruce Li
>>
>  --
> --
> 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.
>
>
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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: Imported Java lib can't find classes compiled on the fly

2013-03-17 Thread dennis zhuang
You can make the clojure class loader by yourself:

(import '(clojure.lang RT))
(def class-loader (RT/makeClassLoader))

user=> (.loadClass class-loader "user.Foo")
user.Foo



2013/3/17 vemv 

> Most definitely :) But that something is hard/confusing should'nt be
> enough reason to give up.
>
>
> On Sunday, March 17, 2013 4:11:34 AM UTC+1, James Xu wrote:
>
>> Then things will get complicated and ugly.
>>
>>   原始邮件
>> *发件人:* Víctor M. Valenzuela
>> *收件人:* clojure
>> *发送时间:* 2013年3月17日(周日) 11:05
>> *主题:* Re: Imported Java lib can't find classes compiled on the fly
>>
>> My guess is it was set via Thread.currentThread().**
>> setContextClassLoader()...?
>>
>> On Sun, Mar 17, 2013 at 3:07 AM, Víctor M. Valenzuela wrote:
>>
>>> Yeah I was working in that direction now!
>>>
>>> Anyway, how come (Class/forName) can work if used from the repl? My
>>> understanding is that the classloader provided by Class is different from
>>> DynamicClassLoader.
>>>
>>>
>>> On Sun, Mar 17, 2013 at 3:01 AM, Michael Klishin 
>>> wrote:
>>>

 2013/3/17 vemv 

 I guess that somehow the Java library uses a different classloader or
> something like that? Any possible solution?


 Clojure itself uses a separate classloader: a 
 clojure.lang.**DynamicClassLoader
 instance.

 If you can use an instance of that classloader, you should be fine.
 --
 MK

 http://github.com/**michaelklishin 
 http://twitter.com/**michaelklishin 

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

 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

 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/-n3jul1IeZ8/**unsubscribe?hl=en
 .
  To unsubscribe from this group and all its topics, send an email to
 clojure+u...@**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 clo...@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+u...@**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+u...@**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.
>
>
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

Re: Why is this code so slow?

2013-02-03 Thread Dennis Haupt
without looking at the code:
ranges in scala have been optimized in i think 2.10 to be able to be
inlineable completely when you iterate over them. at runtime, it
*should* be equal to a simple while loop and a counter variable

Am 03.02.2013 14:28, schrieb Jules:
> The Scala version is probably faster because it uses a range (1 to top)
> which is represented as a pair of integers (the start and endpoint).
> Perhaps the JVM can even eliminate that completely with escape analysis.
> The Java version is repeatedly filling an ArrayList with the numbers in
> that range.
> 
> On Sunday, February 3, 2013 12:19:51 PM UTC+1, Casper Clausen wrote:
> 
> Given that I don't know much about how scala does optimizations, I
> find the question of why the scala version is faster than the Java
> version even more interesting.
> 
> It seems to me that in Scala, the list (don't know the actual data
> type which is created) of 1 to 20 is created each
> time isDivisibleByAll is called which (probably?) creates some
> overhead. 
> 
> The Java version doesn't create the list for each check, but it uses
> an ArrayList where it could use an array and Integer where it could
> use int - shenedu makes that optimization in the buttom, but it only
> improves about half a second according to him.
> 
> So what's going on the Scala version?
> 
> On Sunday, February 3, 2013 3:28:09 AM UTC+1, Alexandros Bantis wrote:
> 
> Hello all. I'm working through the Project Euler problems in Java,
> Scala, & Clojure (trying to learn all three?!?). I notice that
> for one
> particular problem, I use--more or less--a similar algorithm for
> all
> three, but the clojure code runs about 20-30 times slower than the
> java/scala versions. Does anyone have any idea why this might
> be? It
> strikes me that it might have something to do with every? but I
> don't
> know because I'm a newbie with Clojure.
> 
> 
> http://stackoverflow.com/questions/14668272/what-can-i-do-to-speed-up-this-code
> 
> 
> 
> 
> thanks,
> 
> alex
> 
> -- 
> -- 
> 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: is intellij idea a good ide for clojure development?

2013-01-29 Thread Dennis Haupt
Am 29.01.2013 23:05, schrieb Phil Hagelberg:
> 
> Jay Fields writes:
> 
>> On Tue, Jan 29, 2013 at 11:45 AM, Laurent PETIT  
>> wrote:
>>> Hello Jay,
>>>
>>> I'd like to learn a little bit more from what makes you prefer emacs
>>> over IntelliJ.
>>> As the main developer of Counterclockwise, I'm I could learn some
>>> ideas, if not lessons, from your experience.
>>
>> Sure, responses inline-
> 
> While it's great to list features, the specific features really aren't
> the point--the point is that new features can be added with very little
> friction. If you had to restart the program and lose all the state
> you've built up just to try out a new command you're going to be less
> likely to bother with it, but if you can just open up your dotfiles,
> bash out a new defn and try it incrementally, you're going to be more
> likely to experiment with the little things.
> 
> I blogged (ranted?) a bit about this a while ago: http://technomancy.us/115
> 
> But perhaps it's redundant to praise at length the benefits of a
> repl-driven workflow to this audience. =)
> 
> -Phil
> 

you can do repl driven development with intellij as well i think.

-- 

-- 
-- 
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: is intellij idea a good ide for clojure development?

2013-01-29 Thread Dennis Haupt
i don't know emacs, so i would like to know as well what the killer
features are that make you more productive with emacs


2013/1/29 Laurent PETIT 

> Hello Jay,
>
> I'd like to learn a little bit more from what makes you prefer emacs
> over IntelliJ.
> As the main developer of Counterclockwise, I'm I could learn some
> ideas, if not lessons, from your experience.
>
> Some questions and remarks inline:
>
> 2013/1/28 Jay Fields :
> > I used IntelliJ for clojure dev for almost 3 years. About six months ago
> I
> > finally took the time to learn emacs, and I strongly regret not doing it
> > much earlier. There are too many reasons to list, but it all comes down
> to a
> > simple question for me: do you want the ability to easily automate tasks
> > that you often repeat?
>
> Is this really the core of your concerns? Are you talking about the
> ability for you to write new elisp scripts, or to benefit from a bunch
> of existing elisp scripts from the emacs community? Is this mostly
> related to the fact that Clojure support in IntelliJ is lacking in key
> areas? Or is it really the liberty that comes with emacs lisp that you
> value overall? (And is it overrated, or not ?)
>
>
> > IntelliJ is great at automating some things (e.g. Import namespace), but
> if
> > you want to extend its functionality it's a significant task.
> Conversely, I
> > now open my projects with a keystroke,
>
> Can you describe this "open my projects with a keystroke" feature to me?
>
> > start my app with a keystroke
>
> same question. Is it mostly (only?) leiningen apps with a repl ?
>
> > and have the ability to eval any snippet of clojure in the context of my
> app.
>
> > I also automated running tests, creating tests that do not exist, and
> > navigating to tests.
>
> Can you point me to the emacs lisp which does this ? I would be
> interested in studying a little bit what kind of API it provides to
> you, the user (without digging into tons of reference material: a
> concrete example like you automating running tests would be great to
> look at)
>
> Thanks,
>
> --
> Laurent
>
> --
> --
> 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.




is intellij idea a good ide for clojure development?

2013-01-28 Thread Dennis Haupt
the only ides i have used so far for clojure are intellij idea and
netbeans. is there one that is a lot better? if yes, why?
i am not interested in details or single features, i just want to know if
there is some magic editor out there that i should look into because it is
*obviously a lot* better - like in "you should use an ide for java
development instead of notepad"

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




max doesn't return max?

2012-12-12 Thread Dennis Haupt
maybe i am blind, but why does max return the complete lazy seq here
instead of the maximum number? if i just print as-products, i get a list
of numbers. (count solution) tells me there are 1000+
and yet max gives me the complete list?

(ns euler.Problem8)

(def digits
  "73167176531330624919225119674426574742355349194934
  96983520312774506326239578318016984801869478851843
  85861560789112949495459501737958331952853208805511
  12540698747158523863050715693290963295227443043557
  66896648950445244523161731856403098711121722383113
  6222989342338030813533627661428280686645238749
  30358907296290491560440772390713810515859307960866
  70172427121883998797908792274921901699720888093776
  65727333001053367881220235421809751254540594752243
  52584907711670556013604839586446706324415722155397
  53697817977846174064955149290862569321978468622482
  83972241375657056057490261407972968652414535100474
  82166370484403199890008895243450658541227588666881
  16427171479924442928230863465674813919123162824586
  17866458359124566529476545682848912883142607690042
  2421902267105562632109370544217506941658960408
  07198403850962455444362981230987879927244284909188
  84580156166097919133875499200524063689912560717606
  05886116467109405077541002256983155200055935729725
  71636269561882670428252483600823257530420752963450")

(def solution
  (let [as-ints (map int (seq digits))
partitions (partition 5 1 as-ints)
as-products (map #(reduce * %) partitions)]
 (max as-products)))
(println solution)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: why is nth called here?

2012-12-12 Thread Dennis Haupt
if anyone is interested, i used reduces instead of reductions.


2012/12/11 Dennis Haupt 

> i just saw my error :/
>
>
> Am 11.12.2012 22:22, schrieb Ben Wolfson:
> > nth is called in doing the destructuring for the argument lists in
> > your fns defined in try-find-sequence.
> >
> > On Tue, Dec 11, 2012 at 1:20 PM, Dennis Haupt 
> wrote:
> >> i am trying to solve euler problem 125. when i tested this code:
> >>
> >> (ns euler.Problem125)
> >>
> >> (defn is-palindrome [n]
> >>   (let [s (str n)]
> >> (= (seq s) (reverse s
> >>
> >> (defn to-check []
> >>   (filter is-palindrome (range 1 1000)))
> >>
> >> (defn square-root [n]
> >>   (Math/sqrt n))
> >>
> >> (defn squared [n]
> >>   (* n n))
> >>
> >> (defn try-find-sequence [n]
> >>   (loop [start-at (int (square-root n))]
> >> (let [combinator (fn [[sum smallest] element] [(+ sum element) (dec
> >> element)])
> >>   reduced (reduce combinator [0 start-at] (range start-at 0 -1))
> >>   pred (fn [[sum smallest]] (> sum n))
> >>   until-match-or-overflow (take-while pred reduced)
> >>   solution-or-not (last until-match-or-overflow)]
> >>   (cond
> >> (= (first solution-or-not) n) nil
> >> (= (first solution-or-not) n) (second solution-or-not)
> >> :else (recur (dec start-at))
> >> (println (try-find-sequence 595))
> >>
> >> i get:
> >> Exception in thread "main" java.lang.UnsupportedOperationException: nth
> >> not supported on this type: Long
> >> at clojure.lang.RT.nthFrom(RT.java:846)
> >> at clojure.lang.RT.nth(RT.java:796)
> >> at
> euler.Problem125$try_find_sequence$pred__16.invoke(Problem125.clj:20)
> >> at clojure.core$take_while$fn__4116.invoke(core.clj:2512)
> >>
> >> but why? i don't call nth on anything!
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Clojure" group.
> >> To post to this group, send email to clojure@googlegroups.com
> >> Note that posts from new members are moderated - please be patient with
> your first post.
> >> To unsubscribe from this group, send email to
> >> clojure+unsubscr...@googlegroups.com
> >> For more options, visit this group at
> >> http://groups.google.com/group/clojure?hl=en
> >
> >
> >
>
>
> --
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: why is nth called here?

2012-12-11 Thread Dennis Haupt
i just saw my error :/


Am 11.12.2012 22:22, schrieb Ben Wolfson:
> nth is called in doing the destructuring for the argument lists in
> your fns defined in try-find-sequence.
> 
> On Tue, Dec 11, 2012 at 1:20 PM, Dennis Haupt  wrote:
>> i am trying to solve euler problem 125. when i tested this code:
>>
>> (ns euler.Problem125)
>>
>> (defn is-palindrome [n]
>>   (let [s (str n)]
>> (= (seq s) (reverse s
>>
>> (defn to-check []
>>   (filter is-palindrome (range 1 1000)))
>>
>> (defn square-root [n]
>>   (Math/sqrt n))
>>
>> (defn squared [n]
>>   (* n n))
>>
>> (defn try-find-sequence [n]
>>   (loop [start-at (int (square-root n))]
>> (let [combinator (fn [[sum smallest] element] [(+ sum element) (dec
>> element)])
>>   reduced (reduce combinator [0 start-at] (range start-at 0 -1))
>>   pred (fn [[sum smallest]] (> sum n))
>>   until-match-or-overflow (take-while pred reduced)
>>   solution-or-not (last until-match-or-overflow)]
>>   (cond
>> (= (first solution-or-not) n) nil
>> (= (first solution-or-not) n) (second solution-or-not)
>> :else (recur (dec start-at))
>> (println (try-find-sequence 595))
>>
>> i get:
>> Exception in thread "main" java.lang.UnsupportedOperationException: nth
>> not supported on this type: Long
>> at clojure.lang.RT.nthFrom(RT.java:846)
>> at clojure.lang.RT.nth(RT.java:796)
>> at 
>> euler.Problem125$try_find_sequence$pred__16.invoke(Problem125.clj:20)
>> at clojure.core$take_while$fn__4116.invoke(core.clj:2512)
>>
>> but why? i don't call nth on anything!
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
> 
> 
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


why is nth called here?

2012-12-11 Thread Dennis Haupt
i am trying to solve euler problem 125. when i tested this code:

(ns euler.Problem125)

(defn is-palindrome [n]
  (let [s (str n)]
(= (seq s) (reverse s

(defn to-check []
  (filter is-palindrome (range 1 1000)))

(defn square-root [n]
  (Math/sqrt n))

(defn squared [n]
  (* n n))

(defn try-find-sequence [n]
  (loop [start-at (int (square-root n))]
(let [combinator (fn [[sum smallest] element] [(+ sum element) (dec
element)])
  reduced (reduce combinator [0 start-at] (range start-at 0 -1))
  pred (fn [[sum smallest]] (> sum n))
  until-match-or-overflow (take-while pred reduced)
  solution-or-not (last until-match-or-overflow)]
  (cond
(= (first solution-or-not) n) nil
(= (first solution-or-not) n) (second solution-or-not)
:else (recur (dec start-at))
(println (try-find-sequence 595))

i get:
Exception in thread "main" java.lang.UnsupportedOperationException: nth
not supported on this type: Long
at clojure.lang.RT.nthFrom(RT.java:846)
at clojure.lang.RT.nth(RT.java:796)
at euler.Problem125$try_find_sequence$pred__16.invoke(Problem125.clj:20)
at clojure.core$take_while$fn__4116.invoke(core.clj:2512)

but why? i don't call nth on anything!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: help choosing dev environment for clojure

2012-11-25 Thread Dennis Haupt
can you give a few examples that should convince a lot of people on the
spot?

Am 25.11.2012 17:57, schrieb Jay Fields:
> I spent 3 years doing Clojure (for prod apps) in IntelliJ. 3 months ago
> I switched to emacs - and would never go back. 
> 
> If the idea of customizing your dev environment to automate repetitive
> tasks is appealing to you, start learning emacs immediately. I deeply
> regret not learning emacs earlier. If you just want to get things done
> and don't care too much about your development env, stick with eclipse
> or IntelliJ. 
> 
> Sent from my iPad
> 
> On Nov 25, 2012, at 8:39 AM, Sol Tourne  > wrote:
> 
>>
>> hello -- 
>>
>> There are a few resources out there to help one getting started with
>> emacs+clojure, eclipse+ccw, etc. but I haven't found so far a resource
>> helping me decide which learning curve to climb: the pros and cons of
>> sweating to learn eclipse/ccw versus sweating learning the emacs
>> ecosystem, etc.
>>
>> In making that choice, my priority is an environment that complements
>> the REPL with a debugger that allows me to step through the execution,
>> peek at values at intermediate stages of the computation, evaluate
>> expressions within that intermediate stage, etc. Given that, does
>> anybody have advice for a newcomer? 
>>
>> thanks in advance -- hoping this doesn't initiate a holy-war-of-IDEs...
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> 
>> Note that posts from new members are moderated - please be patient
>> with your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Efficiency of Dijkstra's algorithm

2012-11-21 Thread Dennis Haupt
i used a java priorityqueue for this. it's mutable (but local), and since
you're not going to access he queue with more than in thread you can hide
this fact and still pretend to be functional.
i did it. in reality, cheats are always allowed.


2012/11/21 Sergey Didenko 

> I have used mutable code working on Java structures when I was
> implementing the kind of Dijkstra algorithm. As long as it is
> encapsulated in a function it seems quite a good approach to me.
>
> And also quite readable given the amount of mutable Dijkstra examples
> in the Internet.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure to Haskell Compiler

2012-11-17 Thread Dennis Haupt
why not just use haskell instead? i doubt you can just convert the code

Am 17.11.2012 19:31, schrieb Ahmed Shafeeq Bin Mohd Shariff:
> Hi guys,
> 
> I've been frustrated with Clojure's slow speed on the JVM. I've been
> thinking of how it can be compiled to native and I feel that compiling
> Clojure to Haskell and then using ghc to convert this to native would be
> a good idea since Haskell has a large set of good libraries. What do you
> guys think? Would this be a fruitful endeavor for me to embark on?
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Question about doseq

2012-10-30 Thread dennis zhuang
Please use prn insteadof println. By default, pr and prn print in a way
that objects can be read by the reader,but print and println produce output
for human consumption.

2012/10/31 arekanderu 

> Hello all,
>
> I have the following code:
>
> (def my-hash {"1" {:a-key {:value "a value"} :another-key "another value"
>>> :a-third-key []}
>>
>>  "2" {:a-key {:value "a value"} :another-key "another
>>> value" :a-third-key []}}
>>
>>
> In the following example i get the following result:
>
> user=> (doseq [[id item] my-hash] (println item))
>
> {:a-key {:value a value}, :another-key another value, :a-third-key []}
>
> {:a-key {:value a value}, :another-key another value, :a-third-key []}
>
> nil
>
>
> On the above example, it looks *almost* normal to me. For instance, why 
> *{:value
> a value}* is not returned as *{:value "a value"} *? Same goes for *:another
> key*
> It still looks like a hashmap though. Isn't it?
>
> The behavior however which confused me even more is the following:
>
> user=> (doseq [[id item] my-hash
>>   key (:a-key item)]
>> (println key))
>> [:value a value]
>> [:value a value]
>> nil
>
>
> I was expecting the above to return:
>
> {:value "a value"}
>> {:value "a value"}
>> nil
>
>
> Can someone explain to me why vector is being returned and how can I
> achieve the result I was expecting? What am I missing here? Am i misusing
> the doseq bindings?
>
> Thank you for your time
>
> --
> 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




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure : a good start for non-programmers?

2012-09-25 Thread Dennis Haupt
basically anything except brainfuck is a good idea :)

Am 26.09.2012 06:45, schrieb Leonardo Borges:
> Hi Gregorius!
> 
> I think Clojure is a great way to start to learn to program! Clojure
> is a flavour of lisp and so is Scheme - which has been used for
> decades to teach programming to MIT undergrads.
> 
> In terms of resources on learning functional programming I think The
> Little Lisper is a terrific book:
> http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992
> 
> And if yearn for more advanced things later on, SICP - the actual text
> book used at MIT - can be found for free online here:
> http://mitpress.mit.edu/sicp/
> 
> Both books use scheme but I believe you should be able translate the
> examples to Clojure without too much effort.
> 
> just my 2c.
> 
> Best of luck!
> 
> Leonardo Borges
> www.leonardoborges.com
> 
> 
> On Mon, Sep 24, 2012 at 4:11 PM, Gregorius R.  wrote:
>> Hello Clojurists!
>>
>> I'm a person in middle age (you know, too old to rock'n'roll, to young to
>> die) and would like to programm but starting with functional programming.
>> Regarding this i have some questions:
>>
>> is clojure a good start to learn programming?
>> which (prerfer free online) is a good tut to start?
>> am i to old for this stuff?
>>
>> thnx in advance for all responses
>> Greg
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: language shootout / the phonecode study

2012-09-23 Thread Dennis Haupt
i did not need the hint to develop a correct solution. the hint just
clarifies what could have been misunderstood.

Am 23.09.2012 21:03, schrieb Mark Engelberg:
> I agree that Odersky's version doesn't match the spec.  Hint or no hint,
> it doesn't look like he even attempts to address the issue of inserting
> single digits into the encoding.  He's solving a different, somewhat
> simpler problem.
> 
> I don't agree that the hint changes the problem statement.  The original
> spec is relatively clear about the conditions under which you are
> allowed to insert a plain digit in the encoding.  I can see how someone
> might interpret it differently, but it stresses that it's meant to be
> treated as a local decision -- you can only insert a digit if no word
> from the dictionary is a leftmost substring of the remaining letters. 
> The hint simply clarifies what is already in the spec.
> 
> Has anyone tried running Nolen's core.logic version yet to see if it
> works?  At first glance, it looks like it only finds combinations of
> exactly two words that combine to encode the number, which isn't even
> the version that Odersky did.
> 
> --Mark
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: language shootout / the phonecode study

2012-09-22 Thread Dennis Haupt
nice... he approximately does with for loops what i do without the
sugar, hence all the chained calls. i noticed i do a bit more than
necessary (the reverse thing is a remainder of an early
misinterpretation of the spec), but who cares, it works :)

however, odersky's short version doesn't solve the problem ;)
it doesn't:
* handle the - / and " chars
* handle the fallback-case (print a number if no word fits)
* format the output correctly

removing all this from my code, just 2/3 of the current implementation
remain.

i updated my solution, it's a bit more elegant now.

Am 22.09.2012 18:22, schrieb David Nolen:
> On Sat, Sep 22, 2012 at 11:27 AM, Dennis Haupt  <mailto:d.haup...@gmail.com>> wrote:
> 
> here's my solution:
> https://gist.github.com/3766508
> 
> the original (done in 2 hours) solution is commented out. i made some
> improvements and solved the whole thing in 39 lines (counting only the
> content of "main"). doing it in the minimal amount of lines was not my
> goal. i was trying to minimize the logic. shorter code was just a side
> effect.
> 
> try to beat it :). let's see how that looks in clojure.
> 
> 
> Looks pretty convoluted ;)
> 
> Here's Odersky's Scala version and mine that uses
> core.logic http://gist.github.com/1107653.
> 
> I'm headed to StrangeLoop so I don't have time to verify that the Scala
> or my version fully satisfies the original problem description. But my
> guess is that Odersky did really solve the original problem.
> 
> David 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: language shootout / the phonecode study

2012-09-22 Thread Dennis Haupt
here's my solution:
https://gist.github.com/3766508

the original (done in 2 hours) solution is commented out. i made some
improvements and solved the whole thing in 39 lines (counting only the
content of "main"). doing it in the minimal amount of lines was not my
goal. i was trying to minimize the logic. shorter code was just a side
effect.

try to beat it :). let's see how that looks in clojure.

Am 20.09.2012 19:30, schrieb David Nolen:
> On Thu, Sep 20, 2012 at 1:19 PM, Jules  > wrote:
> 
> This problem would be ideally suited for core.logic except because
> of the "hint"
> (http://page.mi.fu-berlin.de/prechelt/phonecode/hint2.html) you'd
> need to do something far more ugly.
> 
> 
> The solution I came up with doesn't attempt to encode the entire
> solution in core.logic. Also I admit the solution I came up with was a
> response to Odersky's neat version for the Scala Days 2011 Keynote and
> not the original problem.
> 
> David 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
i came to a correct solution without that hint :)
just like in reality, i started coding without reading the spec. a few
surprises came along the way ("what? they want it like this? they just
added this to mock me!")

i spent about 50% of the time writing code and 50% thinking about it.
i'll tell my times anyone who solves it as well.
and i'm definately not going to rewrite this in java this is crazy


Am 20.09.2012 19:30, schrieb David Nolen:
> On Thu, Sep 20, 2012 at 1:19 PM, Jules  > wrote:
> 
> This problem would be ideally suited for core.logic except because
> of the "hint"
> (http://page.mi.fu-berlin.de/prechelt/phonecode/hint2.html) you'd
> need to do something far more ugly.
> 
> 
> The solution I came up with doesn't attempt to encode the entire
> solution in core.logic. Also I admit the solution I came up with was a
> response to Odersky's neat version for the Scala Days 2011 Keynote and
> not the original problem.
> 
> David 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
gaaah you almost made me read it

Am 20.09.2012 19:19, schrieb Jules:
> This problem would be ideally suited for core.logic except because of
> the "hint" (http://page.mi.fu-berlin.de/prechelt/phonecode/hint2.html)
> you'd need to do something far more ugly.
> 
> On Thursday, September 20, 2012 5:07:52 PM UTC+2, David Nolen wrote:
> 
>     On Thu, Sep 20, 2012 at 10:52 AM, Dennis Haupt
> > wrote:
> 
> i stumbled upon this:
> http://page.mi.fu-berlin.de/prechelt/phonecode/
> <http://page.mi.fu-berlin.de/prechelt/phonecode/>
> 
> the results:
> http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprt_computer2000.pdf
> <http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprt_computer2000.pdf>
> 
> 
> summary: concise languages bashed c, c++ and java if you look at
> the time needed to complete the program. however, in 1999, there
> were no good ides, and there was no lisp implementation. and no
> scala one, obviously. i intend to see for myself how long i need
> to solve this using currently available tools and am asking
> around if anyone would like to participate in my little study.
> the more, the merrier.
> 
> if enough people volunteer i'll set something up
> 
> 
> Let me know if you want to see a ridiculously concise solution using
> core.logic ;)
> 
> David 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
what i am really interested in is the time necessary to finish the task.
i'll probably need to modify the requiremet so the participants cannot
cheat - or i'll allow cheating deliberately and say "this is the result
under optimal conditions" (meaning the raw coding time is measured, no
debugging, fixing and so on)
i'll have to think about that

2012/9/20 David Nolen 

> On Thu, Sep 20, 2012 at 10:52 AM, Dennis Haupt 
> wrote:
>
>> i stumbled upon this:
>> http://page.mi.fu-berlin.de/prechelt/phonecode/
>>
>> the results:
>> http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprt_computer2000.pdf
>>
>> summary: concise languages bashed c, c++ and java if you look at the time
>> needed to complete the program. however, in 1999, there were no good ides,
>> and there was no lisp implementation. and no scala one, obviously. i intend
>> to see for myself how long i need to solve this using currently available
>> tools and am asking around if anyone would like to participate in my little
>> study. the more, the merrier.
>>
>> if enough people volunteer i'll set something up
>>
>
> Let me know if you want to see a ridiculously concise solution using
> core.logic ;)
>
> David
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
i stumbled upon this:
http://page.mi.fu-berlin.de/prechelt/phonecode/

the results:
http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprt_computer2000.pdf

summary: concise languages bashed c, c++ and java if you look at the time
needed to complete the program. however, in 1999, there were no good ides,
and there was no lisp implementation. and no scala one, obviously. i intend
to see for myself how long i need to solve this using currently available
tools and am asking around if anyone would like to participate in my little
study. the more, the merrier.

if enough people volunteer i'll set something up

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: 'functional' performance VS 'imperative' complexity

2012-08-25 Thread Dennis Haupt
+1

i stay functional if possible and fall back to mutable on isolated,
performance critical spots if i can't get it done fast enough in a
purely functional way.

i solved the move-mess-up-everything problem by forcing a move to
implement both apply and unapply on a game board. (it was a java
project). this way, i could still safely try a move and undo it in
secret - and i could still  use multithreading by making one copy of a
board per thread.

however, depending on the game, the single thread version was up to 10x
faster because of being able to cut off large portions of the tree while
the multithread version had less information per branch and could not
simply share it while travering the tree of possibilities.


Am 25.08.2012 22:01, schrieb Jim - FooBar();:
> Hello everyone,
> 
> in this post I'm not asking for something specific, but rather I'd like
> to spark a  discussion regarding the issue of performance within the
> functional paradigm...most of the things i will mention will probably
> not be news for most of you...Hopefully, however the issues I plan to
> raise will eventualy help someone else faced with the same dilemmas as me...
> 
> First of all, let me clarify upfront that I strongly believe that
> 'functional' and 'immutable' should be the default (as Rich often says).
> This thread is certainly not about praising the 'imperative' style. It
> is about having all the facts  before you start coding (probably before
> even designing)...Most of you presumably already do...
> 
> Ok so, it is evident from my other posts that I'm building a library for
> writing board games. In a nutshell, when it's finished, I'd like someone
> else to be able to write up his own board game, show it up on screen and
> genetically train a neural-net for an opponent, in literally less than
> 5-6 hours (~ 100 LOC).
> Now, for those of you that have done any board games you can immediately
> identify the hot-spots of such a program. These are 2: actually
> exploring the game-tree and training the neural-net. Notice how both
> these tasks can be run in parallel...(exploring the game tree is not
> immediately apparent how to do in parallel but we have reducers)...
> 
> Generally there are 3 major ways going about writing a program -
> functionally all the way, imperatively all the way, a mixture. I sort of
> implemented all 3 categories for my chess game and I've got some
> interesting results:
> 
>  1. Firstly and more importantly (I mean that), the purely functional
> and immutable road is simply  such a pleasure to travel...There are
> no words to describe the beauty, clarity and elegance of the
> functional version. Mutation is non-existent or only through
> reference types and operations like 'update-position' and 'move'
> return brand new piece and board respectively. Also, it is the only
> one that is extremely stable and always brings back the correct
> answer. It is *gorgeous*... On the flip-side, it performs horrible!
> It is very very slow for realistic depths like 4 or 6 even
> regardless of utilising reducers to the maximum and countless
> optimisations. The best time I can report is 9 min for level 4.
>  2. after watching Daniel Solano Gomez's presentation on infoq ("11 tips
> to boost performance"), I realised that If I wanted raw speed (as he
> puts it), I 'd have to resort to arrays. Well, I made my heart a
> stone and went to implement an array-based version that favours
> mutation. Having such modular code in the first place, that did not
> take too long...I just wrote up different version of 'move' and
> 'collides?' (amove, acollides?) that know how to deal with arrays
> and created a ChessPiece2 record which holds a java.awt.Point object
> which is mutated by update-position (instead of returning a brand
> new piece). Basically,  (I thought) i was done in 30 min... However
> it turned out I was being sooo ignorant!!! Making such a u-turn in
> programming paradigms while working on the same project is never
> that simple. The functional style protected me from so many bad
> things...of course, I already knew that but I was surprised to see
> how many these are! For instance, making a move in the functional
> version caused absolutely no damage...there is an 'execute!' fn that
> does damage if we want it to (via atom only) but this is to be used
> only when we decide what move we want. Now, trying out a move messes
> up everything!!! Now, I need means of undoing and not only that...My
> entire searching algorithm can no longer function properly...Off the
> top of my head, I need some sort of serial loop/recur that tries
> moves when recursion rolls in and takes them back (by undoing) when
> recursion rolls out . In other words I need to keep track of the
> changes carefully! On the filp-side, even though this version has
> bugs and does not return the correct answer

Re: real-world usage of reducers?

2012-08-21 Thread Dennis Haupt
i assume you are coming from a java background?
if so, every time you wrote this:

Result result = null;
for (Stuff s:stuffList) {
if (result ==null) result = ...
result.cuddleWith(s);
}
return result

a reducer would have been a functional alternative to this


Am 21.08.2012 13:04, schrieb Jim - FooBar();:
> Dear all,
> 
> Can anyone redirect me to some 'real code' using reducers? I say
> 'real-code' cos I don't consider (r/fold + [1 2 3 4 5]) to be a
> realistic example of usage...also, apart from Rich's blogs, I'm having a
> hard time finding resources explaining the role of the
> combining/reducing  fns. THe way I understand it, the entire reducers
> lib is only applicable (with benefits) to tree-like structures and so,
> the reducing fn is the one applied on the leaves to make them fewer
> (reduce them) and the combining fn is the one that essentially
> propagates the reductions back up the tree (combines them)... Can anyone
> confirm this understanding of mine?
> 
> 
> Assuming I'm thinking about it the right way, I 'd like to build a
> map-tree (nested maps) where the leaves will be reduced using 'max-key'
> and combined back up using 'r/cat' , which apparently is a: 
> "high-performance combining fn that yields the catenation of the 
> reduced values.". Does that make any sense whatsoever? I'm really
> struggling to replace (apply max-key #(...) (:children tree)) with some
> form of (r/fold r/cat #(max-key (fn [e] )) (:children tree))...
> 
> I'd love to see some proper usage of reducers so I can understand what
> is going on...From all the videos I've watched, I 've understood that
> the algorithm I'm implementing (minimax) is an ideal candidate for
> reducers - however I've still not managed to tame them...any
> help/pointers will be massively appreciated! :-)
> 
> Thanks in advance...
> 
> Jim
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why does (conj (transient {}) {}) fail with CCE?

2012-08-09 Thread dennis zhuang
you must use conj! instead of conj.
在 2012-8-9 PM8:49,"Jacek Laskowski" 写道:

> Hi,
>
> I've been digging into the sources of Clojure and found frequencies.
> There's the transient function and I thought I'd use it with a map and
> conj. Why does this fail?
>
> user=> (conj {} {:y 1})
> {:y 1}
> user=> (conj (transient {}) {:y 1})
> ClassCastException   [trace missing]
>
> I ran into the issue before and got a more comprehensible exception.
>
> ClassCastException clojure.lang.PersistentArrayMap$TransientArrayMap
> cannot be cast to clojure.lang.IPersistentCollection
> clojure.core/conj (core.clj:83)
>
> I can't explain why the exception is reported in two different versions.
>
> Should the exception be thrown? What's the rationale behind
> TransientArrayMap *not* being a IPersistentCollection?
>
> Jacek
>
> --
> Jacek Laskowski
> Functional languages (Clojure), Java EE, and IBM WebSphere -
> http://blog.japila.pl
> "Never discourage anyone who continually makes progress, no matter how
> slow." Plato
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] Okku 0.1.0 - Akka interface for Clojure

2012-07-21 Thread dennis zhuang
I try to run okku-pi,but it could not find okku 0.1.1-SNAPSHOT:

Could not find artifact org.clojure.gaverhae:okku:jar:0.1.1-SNAPSHOT in
clojars (https://clojars.org/repo/)

Should i use 0.1.0?

2012/7/21 dennis zhuang 

> Great work.Thanks.
>
> 2012/7/20 Gary Verhaegen 
>
>> Okku is a thin wrapper around the Akka library that makes it easy to
>> use it from Clojure. The Actor model can be considered a nice
>> alternative for concurrent programming, but it really shines when you
>> want to distribute your application - it really is nearly transparent.
>>
>> As the version number suggests, the library is in a very early stage.
>> This is also my very first time sharing any type of code with anyone
>> (I'm still at university), so do not expect too much in terms of
>> quality. On the other hand, I'm eager to learn, so do not hesitate to
>> (constructively) criticize it.
>>
>> In particular, the core library needs some internal refactorings, and
>> as of right now there is absolutely no test or documentation in the
>> library itself. I have, however, translated two Akka tutorials to
>> Okku, which you can find here:
>>
>> https://github.com/gaverhae/okku-pi
>> https://github.com/gaverhae/okku-remote
>>
>> Together, these two tutorials currently show off almost all the
>> features of Okku. The actual library can be found on github:
>>
>> https://github.com/gaverhae/okku
>>
>> and is already available on clojars as [org.clojure.gaverhae/okku "0.1.0"]
>>
>> --
>> 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
>>
>
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] Okku 0.1.0 - Akka interface for Clojure

2012-07-21 Thread dennis zhuang
Great work.Thanks.

2012/7/20 Gary Verhaegen 

> Okku is a thin wrapper around the Akka library that makes it easy to
> use it from Clojure. The Actor model can be considered a nice
> alternative for concurrent programming, but it really shines when you
> want to distribute your application - it really is nearly transparent.
>
> As the version number suggests, the library is in a very early stage.
> This is also my very first time sharing any type of code with anyone
> (I'm still at university), so do not expect too much in terms of
> quality. On the other hand, I'm eager to learn, so do not hesitate to
> (constructively) criticize it.
>
> In particular, the core library needs some internal refactorings, and
> as of right now there is absolutely no test or documentation in the
> library itself. I have, however, translated two Akka tutorials to
> Okku, which you can find here:
>
> https://github.com/gaverhae/okku-pi
> https://github.com/gaverhae/okku-remote
>
> Together, these two tutorials currently show off almost all the
> features of Okku. The actual library can be found on github:
>
> https://github.com/gaverhae/okku
>
> and is already available on clojars as [org.clojure.gaverhae/okku "0.1.0"]
>
> --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: {ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-19 Thread dennis zhuang
I've released ring.velocity 0.1.0
https://github.com/killme2008/ring.velocity
Thanks.

2012/7/18 Sun Ning 

> enlive最大的好处是页面html页面不会掺入任何模板语言**,直接就可以在浏览器里预览页面设计
> 但是用的时候思维确实和传统的模板引擎不太一样
>
>
> On Wed 18 Jul 2012 12:50:39 PM CST, Shen, Feng wrote:
>
>> 同感enlive较复杂。前段时间,转向了Mustache。
>>
>> 沈锋
>> 美味书签 http://mei.fm
>>
>>
>>
>> On Wed, Jul 18, 2012 at 11:59 AM, dennis zhuang > <mailto:killme2...@gmail.com>> wrote:
>>
>> 其实就是几行代码封装下,**我觉的velocity比什么enlive好用多了。
>>
>> 2012/7/18 Shen, Feng mailto:shen...@gmail.com>>
>>
>>
>> 不错不错。
>> velocity 在java中用得较广。
>> 这样为potential 的 clojure用户铺了一下道路。
>>
>> 沈锋
>> 美味书签 http://meiwei.fm <http://mei.fm>
>>
>>
>>
>>
>> On Wed, Jul 18, 2012 at 12:00 AM, dennis zhuang
>> mailto:killme2...@gmail.com>> wrote:
>>
>> A little error in getting started missing :age
>>
>>
>> |(render "test.vm" :name "dennis" :age 29)|
>>
>>
>> 2012/7/17 dennis zhuang > <mailto:killme2...@gmail.com>>
>>
>> Hi,all
>>
>> Apache velocity <http://velocity.apache.org/>**is a
>>
>> great java template engine used widely. I want to use
>> it in clojure with compojure and ring framework,so
>> i've created this project---ring.velocity.
>>
>> Home: 
>> https://github.com/killme2008/**ring.velocity<https://github.com/killme2008/ring.velocity>
>> Getting started:
>>
>> Adds dependency in leiningen project.clj:
>>
>>
>> |   [ring.velocity "0.1.0-SNAPSHOT"]
>> |
>>
>> Create a directory named |templates| in your project
>> directory to keep all velocity templates.
>>
>> Create a template |templates/test.vm|:
>>
>>
>>     |   hello,$name,your age is $age.
>> |
>>
>> Use ring.velocity in your namespace:
>>
>>
>> |   (use '[ring.velocity.core :only [render]])
>> |
>>
>> Use |render| function to render template with vars:
>>
>>
>> |   (render "test.vm" :name "dennis" 29)
>> |
>>
>> The |test.vm| will be interpreted equals to:
>>
>>
>> |   hello,dennis,your age is 29.
>> |
>>
>> Use ring.velocity in compojure:
>>
>>
>> |   (defroutes app-routes
>>   (GET "/" [] (render "test.vm" :name "dennis" :age
>> 29))
>>   (route/not-found "Not Found"))
>> |
>>
>> Use ring.velocity in ring:
>>
>>
>> |   (use '[ring.util.response])
>>(response (render "test.vm" :name "dennis" :age 29))
>> |
>>
>> Custom velocity properties,just put a file named
>> |ring-velocity.properties| to your classpath or
>> resource paths.The default velocity properties is in
>> src/default/velocity.**properties
>> <https://github.com/**killme2008/ring.velocity/blob/**
>> master/src/default/velocity.**properties<https://github.com/killme2008/ring.velocity/blob/master/src/default/velocity.properties>
>> >.
>>
>>
>> --
>> 庄晓丹
>> Email: killme2...@gmail.com
>> <mailto:killme2...@gmail.com> xzhu...@avos.com
>> <mailto:xzhu...@avos.com>
>> Site: http://fnil.net <http://fnil.net>
>> Twitter:  @killme2008
>>
>>
>>
>>
>>
>>
>> --
>> 庄晓丹
>> Email: killme2...@gmail.com <mailto:killme2...@gmail.com>
>> xzhu...@avos.com <mailto:xzhu...@avos.com>
>> Site: http://fnil.net <http://fnil.net>
>> Twitter:  @killme2008
>>
>>
>>
>>
>>
>>
>>
>> --
>> 庄晓丹
>> Email: killme2...@gmail.com <mailto:killme2...@gmail.com>
>> xzhu...@avos.com <mailto:xzhu...@avos.com>
>> Site: http://fnil.net <http://fnil.net>
>> Twitter:  @killme2008
>>
>>
>>
>>
>>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: why does Clojure need to cache keywords?

2012-07-18 Thread dennis zhuang
I think this cache is just the same with String.intern method in java,it
just want to reduce the cost (memory & cpu) of producing keywords
frequently especial when using them with map structure.

2012/7/18 jaime 

> I doubt because keyword will use its internal Symbol object to compare
> with each other (or other objects), it means it's Symbol's interned
> strings(ns & name) make the comparison fast but not this caching stuff. I
> found a "find()" method in source code but not sure if the cache is
> relevant to this method.
>
> 在 2012年7月18日星期三UTC+8下午4时52分25秒,dennis写道:
>
>> Compare keywords can be very fast.
>> 在 2012-7-18 PM4:51,"jaime" 写道:
>>
>>> Hello,
>>>
>>> When I read the source code keyword, say, Keyword.java (V1.3), I found
>>> that when we "intern" a keyword,   (if I understand it correctly)  it uses
>>> a cache for keywords:
>>> ==**===
>>> public static Keyword intern(Symbol sym) {
>>>  if (sym.meta() != null)
>>> sym = (Symbol) sym.withMeta(null);
>>> *Util.clearCache(rq, table);*
>>>  Keyword k = new Keyword(sym);
>>> Reference existingRef = table.putIfAbsent(sym,
>>>  new WeakReference(k, rq));
>>> if (existingRef == null)
>>>  return k;
>>> Keyword existingk = existingRef.get();
>>> if (existingk != null)
>>>  return existingk;
>>> // entry died in the interim, do over
>>> table.remove(sym, existingRef);
>>>  return intern(sym);
>>> }
>>> ==**
>>>
>>> well, I just don't understand why we need caching for keywords. Anyone
>>> could give me a hint?
>>>
>>> --
>>> 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+unsubscribe@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: why does Clojure need to cache keywords?

2012-07-18 Thread dennis zhuang
Compare keywords can be very fast.
在 2012-7-18 PM4:51,"jaime" 写道:

> Hello,
>
> When I read the source code keyword, say, Keyword.java (V1.3), I found
> that when we "intern" a keyword,   (if I understand it correctly)  it uses
> a cache for keywords:
> =
> public static Keyword intern(Symbol sym) {
> if (sym.meta() != null)
> sym = (Symbol) sym.withMeta(null);
> *Util.clearCache(rq, table);*
> Keyword k = new Keyword(sym);
> Reference existingRef = table.putIfAbsent(sym,
> new WeakReference(k, rq));
> if (existingRef == null)
> return k;
> Keyword existingk = existingRef.get();
> if (existingk != null)
> return existingk;
> // entry died in the interim, do over
> table.remove(sym, existingRef);
> return intern(sym);
> }
> ==
>
> well, I just don't understand why we need caching for keywords. Anyone
> could give me a hint?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: {ANN} clojure-control 0.4.1 released.

2012-07-18 Thread dennis zhuang
I see,thanks.

Pallet is more powerful than clojure-control.It seems that it contains many
features for cloud service rather than just a deployment tool.

And clojure-control is just a deployment tool like fabric in python for
many machines using SSH,it can reuse tasks and clusters,and have a simple
bash script to run them.


2012/7/18 Murtaza Husain 

>
> http://palletops.com/
>
>
> On Wednesday, July 18, 2012 11:41:11 AM UTC+5:30, dennis wrote:
>>
>> I am sorry,i don't know pallet,any links? thanks.
>>
>> 2012/7/18 Murtaza Husain 
>> 
>> >
>>
>>>
>>> Hi,
>>>
>>> How is this different from pallet ?
>>>
>>> Thanks,
>>> Murtaza
>>>
>>>
>>> On Wednesday, July 18, 2012 10:52:57 AM UTC+5:30, dennis wrote:
>>>>
>>>> Clojure-control <https://github.com/killme2008/clojure-control> is a
>>>> clojure tool library to execute user defined tasks on remote machines
>>>> grouped into cluster just like fabric in python or node-control in node.js.
>>>>
>>>> *Home*: 
>>>> https://github.com/**killm**e2008/clojure-control<https://github.com/killme2008/clojure-control>
>>>>
>>>> Control 0.4.1 released,it has a little improvement in command line,
>>>> introduced -f option to set control file,for example
>>>>
>>>>control -f mycontrol.clj run mycluster mytask
>>>>
>>>> You can upgrade it by
>>>>
>>>>control upgrade
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> 庄晓丹
>>>> Email:killme2...@gmail.com xzhu...@avos.com
>>>> Site:   http://fnil.net
>>>> Twitter:  @killme2008
>>>>
>>>>
>>>>
>>>>   --
>>> 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+unsubscribe@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>>
>>
>>
>>
>> --
>> 庄晓丹
>> Email:killme2...@gmail.com xzhu...@avos.com
>> Site:   http://fnil.net
>> Twitter:  @killme2008
>>
>>
>>
>>  --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: {ANN} clojure-control 0.4.1 released.

2012-07-17 Thread dennis zhuang
I am sorry,i don't know pallet,any links? thanks.

2012/7/18 Murtaza Husain 

>
> Hi,
>
> How is this different from pallet ?
>
> Thanks,
> Murtaza
>
>
> On Wednesday, July 18, 2012 10:52:57 AM UTC+5:30, dennis wrote:
>>
>> Clojure-control <https://github.com/killme2008/clojure-control> is a
>> clojure tool library to execute user defined tasks on remote machines
>> grouped into cluster just like fabric in python or node-control in node.js.
>>
>> *Home*: 
>> https://github.com/**killme2008/clojure-control<https://github.com/killme2008/clojure-control>
>>
>> Control 0.4.1 released,it has a little improvement in command line,
>> introduced -f option to set control file,for example
>>
>>control -f mycontrol.clj run mycluster mytask
>>
>> You can upgrade it by
>>
>>control upgrade
>>
>> Thanks.
>>
>> --
>> 庄晓丹
>> Email:killme2...@gmail.com xzhu...@avos.com
>> Site:   http://fnil.net
>> Twitter:  @killme2008
>>
>>
>>
>>   --
> 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




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

{ANN} clojure-control 0.4.1 released.

2012-07-17 Thread dennis zhuang
Clojure-control  is a
clojure tool library to execute user defined tasks on remote machines
grouped into cluster just like fabric in python or node-control in node.js.

*Home*: https://github.com/killme2008/clojure-control

Control 0.4.1 released,it has a little improvement in command line,
introduced -f option to set control file,for example

   control -f mycontrol.clj run mycluster mytask

You can upgrade it by

   control upgrade

Thanks.

-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: {ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-17 Thread dennis zhuang
其实就是几行代码封装下,我觉的velocity比什么enlive好用多了。

2012/7/18 Shen, Feng 

> 不错不错。
> velocity 在java中用得较广。
> 这样为potential 的 clojure用户铺了一下道路。
>
> 沈锋
> 美味书签 http://meiwei.fm <http://mei.fm>
>
>
>
> On Wed, Jul 18, 2012 at 12:00 AM, dennis zhuang wrote:
>
>> A little error in getting started missing :age
>>
>> (render "test.vm" :name "dennis" :age 29)
>>
>>
>> 2012/7/17 dennis zhuang 
>>
>>> Hi,all
>>>
>>> Apache velocity <http://velocity.apache.org/>is a great java
>>> template engine used widely. I want to use it in clojure with compojure and
>>> ring framework,so i've created this project---ring.velocity.
>>>
>>> Home: https://github.com/killme2008/ring.velocity
>>> Getting started:
>>>
>>>   Adds dependency in leiningen project.clj:
>>>
>>>   [ring.velocity "0.1.0-SNAPSHOT"]
>>>
>>> Create a directory named templates in your project directory to keep
>>> all velocity templates.
>>>
>>> Create a template templates/test.vm:
>>>
>>>   hello,$name,your age is $age.
>>>
>>> Use ring.velocity in your namespace:
>>>
>>>   (use '[ring.velocity.core :only [render]])
>>>
>>> Use render function to render template with vars:
>>>
>>>   (render "test.vm" :name "dennis" 29)
>>>
>>> The test.vm will be interpreted equals to:
>>>
>>>   hello,dennis,your age is 29.
>>>
>>> Use ring.velocity in compojure:
>>>
>>>   (defroutes app-routes
>>>  (GET "/" [] (render "test.vm" :name "dennis" :age 29))
>>>  (route/not-found "Not Found"))
>>>
>>> Use ring.velocity in ring:
>>>
>>>   (use '[ring.util.response])
>>>   (response (render "test.vm" :name "dennis" :age 29))
>>>
>>> Custom velocity properties,just put a file named
>>> ring-velocity.properties to your classpath or resource paths.The
>>> default velocity properties is in 
>>> src/default/velocity.properties<https://github.com/killme2008/ring.velocity/blob/master/src/default/velocity.properties>
>>> .
>>>
>>> --
>>> 庄晓丹
>>> Email:killme2...@gmail.com xzhu...@avos.com
>>> Site:   http://fnil.net
>>> Twitter:  @killme2008
>>>
>>>
>>>
>>>
>>
>>
>> --
>> 庄晓丹
>> Email:killme2...@gmail.com xzhu...@avos.com
>> Site:   http://fnil.net
>> Twitter:  @killme2008
>>
>>
>>
>>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: {ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-17 Thread dennis zhuang
A little error in getting started missing :age

(render "test.vm" :name "dennis" :age 29)


2012/7/17 dennis zhuang 

> Hi,all
>
> Apache velocity <http://velocity.apache.org/>is a great java template
> engine used widely. I want to use it in clojure with compojure and ring
> framework,so i've created this project---ring.velocity.
>
> Home: https://github.com/killme2008/ring.velocity
> Getting started:
>
>   Adds dependency in leiningen project.clj:
>
>   [ring.velocity "0.1.0-SNAPSHOT"]
>
> Create a directory named templates in your project directory to keep all
> velocity templates.
>
> Create a template templates/test.vm:
>
>   hello,$name,your age is $age.
>
> Use ring.velocity in your namespace:
>
>   (use '[ring.velocity.core :only [render]])
>
> Use render function to render template with vars:
>
>   (render "test.vm" :name "dennis" 29)
>
> The test.vm will be interpreted equals to:
>
>   hello,dennis,your age is 29.
>
> Use ring.velocity in compojure:
>
>   (defroutes app-routes
>  (GET "/" [] (render "test.vm" :name "dennis" :age 29))
>  (route/not-found "Not Found"))
>
> Use ring.velocity in ring:
>
>   (use '[ring.util.response])
>   (response (render "test.vm" :name "dennis" :age 29))
>
> Custom velocity properties,just put a file named ring-velocity.properties to
> your classpath or resource paths.The default velocity properties is in
> src/default/velocity.properties<https://github.com/killme2008/ring.velocity/blob/master/src/default/velocity.properties>
> .
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

{ANN} ring.velocity: render apache velocity templates for ring in clojure.

2012-07-17 Thread dennis zhuang
Hi,all

Apache velocity <http://velocity.apache.org/>is a great java template
engine used widely. I want to use it in clojure with compojure and ring
framework,so i've created this project---ring.velocity.

Home: https://github.com/killme2008/ring.velocity
Getting started:

  Adds dependency in leiningen project.clj:

  [ring.velocity "0.1.0-SNAPSHOT"]

Create a directory named templates in your project directory to keep all
velocity templates.

Create a template templates/test.vm:

  hello,$name,your age is $age.

Use ring.velocity in your namespace:

  (use '[ring.velocity.core :only [render]])

Use render function to render template with vars:

  (render "test.vm" :name "dennis" 29)

The test.vm will be interpreted equals to:

  hello,dennis,your age is 29.

Use ring.velocity in compojure:

  (defroutes app-routes
     (GET "/" [] (render "test.vm" :name "dennis" :age 29))
 (route/not-found "Not Found"))

Use ring.velocity in ring:

  (use '[ring.util.response])
  (response (render "test.vm" :name "dennis" :age 29))

Custom velocity properties,just put a file named ring-velocity.properties to
your classpath or resource paths.The default velocity properties is in
src/default/velocity.properties<https://github.com/killme2008/ring.velocity/blob/master/src/default/velocity.properties>
.

-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Why :inline have to define the function twice?

2012-07-16 Thread dennis zhuang
Thanks.
Yeath,i know the defline macro,and it is the best way to define inline
function.I got your point,thanks.

2012/7/17 Aaron Cohen 

> On Mon, Jul 16, 2012 at 11:26 AM, dennis zhuang 
> wrote:
> >
> > Yes, thank you for your reply,i total agree with you about why we need
> :inline form in meta map.
> > But my problem is that why clojure compiler could not use the body form
> as the :inline value automatically for us instead of writing a duplicate
> form? I think below codes is more suitable:
>
> > (defn pos?
> >   "Returns true if num is greater than zero, else false"
> >   {
> >:inline true
> >:added "1.0"}
> >   [x] (. clojure.lang.Numbers (isPos x)))
> >
> >
> > Then clojure compiler finds out that we set :inline to be true and
> captures the body form as the :inline value automatically,is it not better?
> >
> > If the function accepts different arguments arities, we can set
> :inline-arities value to make compiler captures the body form  which
> arguments count equals to :inline-arities value as :inline value.
> >
>
> As I said, that's precisely what definline does. As many things in
> clojure, the simple pieces are given and "easy" things can be built on
> top of them. I don't know precisely when in clojure.clj that "pos?" is
> defined, but if it is late enough that "definline" has been defined,
> it could be rewritten as:
>
> (definline pos?
> "Returns true if num is greater than zero, else false"
> {:added "1.0"}
>[x] `(. clojure.lang.Numbers (isPos x)))
>
> Which is pretty much what you asked for, isn't it?
>
> The fact that it isn't written that way is either historical or
> because it needs to exist before definline does.
>
> --Aaron
>
> --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Why :inline have to define the function twice?

2012-07-16 Thread dennis zhuang
Yes, thank you for your reply,i total agree with you about why we need
:inline form in meta map.
But my problem is that why clojure compiler could not use the body form as
the :inline value automatically for us instead of writing a duplicate form?
I think below codes is more suitable:

(defn pos?

  "Returns true if num is greater than zero, else false"

  {

   :inline true

   :added "1.0"}

  [x] (. clojure.lang.Numbers (isPos x)))


Then clojure compiler finds out that we set :inline to be true and captures
the body form as the :inline value automatically,is it not better?

If the function accepts different arguments arities, we can set
:inline-arities value to make compiler captures the body form  which
arguments count equals to :inline-arities value as :inline value.



2012/7/16 Aaron Cohen 

> My guess: to allow functions with :inline metadata to still be used as
> higher order (first class) functions.
>
> Note, the fn specified by :inline is more of a macro than a function, it's
> called at compile time.
>
> How would the following work without a function body?
>
> (map pos? [-1 0 1])
>
> definline gives you what you're asking for, a way to define an :inline
> function without repetition.
>
> --Aaron
>
> On Sun, Jul 15, 2012 at 10:43 PM, dennis zhuang wrote:
>
>> Inline a function in clojure is easy,just define a :inline form to meta
>> map and it will be inlined into the form which calls it.For example,the
>> pos? function in clojure.core:
>>
>> (defn pos?
>>
>>   "Returns true if num is greater than zero, else false"
>>
>>   {
>>
>>:inline (fn [x] *`(. clojure.lang.Numbers (isPos ~x))*)
>>
>>:added "1.0"}
>>
>>   [x] *(. clojure.lang.Numbers (isPos x))*)
>>
>>
>> But i have a question about the usage,why we have to write the body
>> form(Here is *(. clojure.lang.Numbers (isPos ~x))*) twice both in
>> function's body and :inline value? Why :inline form could not just use the
>> form in function's body instead of duplicate definition?
>>
>>
>> --
>> 庄晓丹
>> Email:killme2...@gmail.com xzhu...@avos.com
>> Site:   http://fnil.net
>> Twitter:  @killme2008
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: 'last' on empty collections

2012-07-01 Thread Dennis Haupt
i'd do (actually, i did) it like this:
(my-special-last coll) -> returns the last element or throws an
exception if there is none
(my-special-last coll if-empty) -> in case of an empty collections,
ifEmpty is returned



Am 01.07.2012 21:47, schrieb Warren Lynn:
> Right now
> 
> (last []) => nil
> (last [nil]) => nil
> 
> So there is no way to differentiate these two (except with some
> emptiness checking). In my opinion (last []) should throw an
> exception, because that's when last does not apply. From another point
> of view, there are two cases:
> 
> 1. The local semantics requires the collection not to be empty.
> Throwing an exception here will remove the burden of manual checking.
> 
> 2. The local semantics allows the collection to be empty, in that case
> the caller needs to do
> (when-not (empty? c) (last c)).
> 
> case 1 is the "normal case" with higher probability, so the burden of
> checking should be on the second case.
> 
> Your opinion?
> 
> Note this is rather academic because it probably is too late do
> anything about it at this stage. But it may help future cases.
> 


-- 



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Buggy FP behavior with Clojure 1.3

2012-06-25 Thread dennis zhuang
Added a postfix "M" to make the number as BigDecimal or "N" as a BigInteger:

user=> 1e308M
1E+308M
user=> (class 1e308M)
java.math.BigDecimal
user=> (* 10.0 1e108M)
1.0E109

2012/6/26 Cedric Greevey 

> On Tue, Jun 26, 2012 at 1:11 AM, Sean Corfield 
> wrote:
> > On Mon, Jun 25, 2012 at 9:19 PM, Cedric Greevey 
> wrote:
> >> user=> 1e309
> >> Infinity
> >
> > FWIW, on 1.4.0 I get:
> >
> > user=> 1e309
> > CompilerException java.lang.RuntimeException: Unable to resolve
> > symbol: Infinity in this context, compiling:(NO_SOURCE_PATH:1)
>
> That's *really* broken.
>
> Unfortunately, digging deeper I found that the 1023 exponent limit is
> 2^1023, not 10^1023, which means it really is around 309. I've had to
> reimplement some stuff using BigDecimals and to write these, since
> there seem to be no corresponding methods built into Java anywhere:
>
> (defn log [x]
>   (if (instance? BigDecimal x)
> (let [s (.scale x)]
>   (+ (Math/log (.scaleByPowerOfTen x s)) (* (- s) (Math/log 10.0
> (Math/log x)))
>
> (defn log10 [x]
>   (/ (log x) (Math/log 10.0)))
>
> (defn exp [x]
>   (let [r (Math/exp x)]
> (if (.isInfinite r)
>   (let [p10 (int (/ x (Math/log 10.0)))]
>   (.scaleByPowerOfTen (bigdec (Math/exp (- x (* p10 (Math/log
> 10.0) p10))
>   r)))
>
> These seem to work fine, where extended precision isn't really needed,
> only large exponents. However, I've run into another problem, which is
> that when doubles and BigDecimals mix 1.3 seems to convert to doubles.
> This appears to contradict part of
>
> http://dev.clojure.org/display/doc/Documentation+for+1.3+Numerics
>
> specifically "When different types of numbers are used in a math
> operation, the result will be the larger or more general of the two
> types."
>
> That doesn't seem to hold when the types are double and BigDecimal,
> for some reason. Is there any setting I can change (analogous to
> with-precision) to force BigDecimal contagion? I considered using
> those icky primed operators, but for some reason /' seems to be
> missing from the set and I need division...
>
> --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Buggy FP behavior with Clojure 1.3

2012-06-25 Thread dennis zhuang
user=> Double/MAX_VALUE
1.7976931348623157E308


2012/6/26 Sean Corfield 

> On Mon, Jun 25, 2012 at 9:19 PM, Cedric Greevey 
> wrote:
> > user=> 1e309
> > Infinity
>
> FWIW, on 1.4.0 I get:
>
> user=> 1e309
> CompilerException java.lang.RuntimeException: Unable to resolve
> symbol: Infinity in this context, compiling:(NO_SOURCE_PATH:1)
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

{ANN} clj.monitor: monitoring applications in clojure

2012-05-12 Thread dennis zhuang
Hi,all

I've implemented a simple DSL for monitoring apps in clojure based on
SSH.

Usage:  https://github.com/killme2008/clj.monitor
An example:

  (defcluster mysql
:clients [{:user "deploy" :host "mysql.app.com"}])
  (defmonitor mysql-monitor
 ;;Tasks to monitor mysql,we just ping mysql and make sure that
average load in 5 minutes is less than 3
 :tasks [(ping-mysql "root" "password")
 (system-load :5 3)]
 ;;Mysql clusters for monitoring
 :clusters [:mysql])

   (start-monitors
 :cron "* 0/5 * * * ?" ;;run monitors every five
minutes.
 :alerts [(mail :from "al...@app.com" :to "yourn...@app.com")]
;;send alerts to email address.
 :monitors [mysql-monitor])

Now it is just a beta release, if you have any questions or find
issues,please let me know,thanks.




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: {ANN} Clojure-control 0.3.4 released

2012-05-10 Thread dennis zhuang
I am sorry, 0.3.5 will break the example with only :clients in cluster.
I've push 0.3.6 to clojars, upgrade control by:

  lein plugin install control 0.3.6

Sorry for this issue,thanks.

2012/5/11 Rostislav Svoboda 

> I took the steps from your README.md and it seems like something's
> missing :( see below
>
> Bost
>
> bost@bost-desktop:~/dev$ rm -rf mycontrol/
> bost@bost-desktop:~/dev$ lein1 version
> Leiningen 1.7.1 on Java 1.7.0_04 Java HotSpot(TM) Client VM
> bost@bost-desktop:~/dev$ lein1 plugin install control 0.3.5
> [INFO] Unable to find resource 'control:control:jar:0.3.5' in
> repository central (http://repo1.maven.org/maven2)
> Installing shell wrapper to /home/bost/.lein/bin/clojure-control
> Copying 2 files to /tmp/lein-f0119cb7-6660-4181-aeed-149113f38fc1/lib
> Including control-0.3.5.jar
> Including clojure-1.3.0.jar
> Including tools.cli-0.2.1.jar
> Created control-0.3.5.jar
> bost@bost-desktop:~/dev$ lein1 new mycontrol
> Created new project in: /home/bost/dev/mycontrol
> Look over project.clj and start coding in mycontrol/core.clj
> bost@bost-desktop:~/dev$ cd mycontrol/
> bost@bost-desktop:~/dev/mycontrol$ lein1 control init
> bost@bost-desktop:~/dev/mycontrol$ cat
> classes/ control.clj  .gitignore   project.clj  README   src/
>   test/
> bost@bost-desktop:~/dev/mycontrol$ cat control.clj
> (defcluster :default-cluster
>  :clients [
>{:host "localhost" :user "root"}
>  ])
>
> (deftask :date "echo date on cluster"  []
>  (ssh "date"))
> bost@bost-desktop:~/dev/mycontrol$ lein1 control run default-cluster date
> Empty hosts for cluster default-cluster
> Exception in thread "main" java.lang.reflect.InvocationTargetException
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>at java.lang.reflect.Method.invoke(Method.java:601)
>at jline.ConsoleRunner.main(ConsoleRunner.java:69)
> Caused by: java.lang.RuntimeException: Empty hosts for cluster
> default-cluster (NO_SOURCE_FILE:0)
>at clojure.lang.Compiler.eval(Compiler.java:5440)
>at clojure.lang.Compiler.eval(Compiler.java:5391)
>at clojure.core$eval.invoke(core.clj:2382)
>at clojure.main$eval_opt.invoke(main.clj:235)
>at clojure.main$initialize.invoke(main.clj:254)
>at clojure.main$script_opt.invoke(main.clj:270)
>at clojure.main$main.doInvoke(main.clj:354)
>at clojure.lang.RestFn.invoke(RestFn.java:551)
>at clojure.lang.Var.invoke(Var.java:390)
>at clojure.lang.AFn.applyToHelper(AFn.java:193)
>at clojure.lang.Var.applyTo(Var.java:482)
>at clojure.main.main(main.java:37)
>... 5 more
> Caused by: java.lang.RuntimeException: Empty hosts for cluster
> default-cluster
>at control.core$do_begin.invoke(core.clj:353)
>at leiningen.control$run_control.invoke(control.clj:30)
>at leiningen.control$run.doInvoke(control.clj:97)
>at clojure.lang.RestFn.applyTo(RestFn.java:139)
>at clojure.core$apply.invoke(core.clj:542)
>at leiningen.control$control.doInvoke(control.clj:136)
>at clojure.lang.RestFn.invoke(RestFn.java:464)
>at clojure.lang.Var.invoke(Var.java:377)
>at clojure.lang.AFn.applyToHelper(AFn.java:172)
>at clojure.lang.Var.applyTo(Var.java:482)
>at clojure.core$apply.invoke(core.clj:542)
>at leiningen.core$apply_task.invoke(core.clj:262)
>at leiningen.core$_main.doInvoke(core.clj:329)
>at clojure.lang.RestFn.applyTo(RestFn.java:139)
>at clojure.core$apply.invoke(core.clj:542)
>at leiningen.core$_main.invoke(core.clj:332)
>at user$eval42.invoke(NO_SOURCE_FILE:1)
>at clojure.lang.Compiler.eval(Compiler.java:5424)
>... 16 more
>
> --
> 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




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: {ANN} Clojure-control 0.3.4 released

2012-05-10 Thread dennis zhuang
*A new release 0.3.5:*

--Now you can run a task with user@host rather than a pre-defined cluster
by:

  lein control run user@host task args

*Upgrade:*

   lein plugin install control 0.3.5



2012/5/10 dennis zhuang 

> Clojure-control:  a clojure DSL for system admin and deployment with many
> remote machines via ssh
>
> Usage: https://github.com/killme2008/clojure-control
>
> *Release 0.3.4*
>
> - New function (local cmd) to execute command on local machine : (local
> "tar zcvf app.tar.gz app/")
> - Custer name could be a symbol rather than keyword
> - (set-options!) now could accept several options: (set-options! :user
> "deploy" :parallel true)
> - New function (clear-options!) to clear global options.
> - Using host and user of cluster in task by &host and &user :
>  (deftask test [] (println (str &user "@" &host)))
> *
> *
> *Upgrade:*
>
>lein plugin install control 0.3.4
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
>
>


-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

{ANN} Clojure-Control 0.3.3 release

2012-04-30 Thread dennis zhuang
Clojure-control:  a clojure DSL for system admin and deployment with many
remote machines via ssh

Usage: https://github.com/killme2008/clojure-control

*Release 0.3.3*

- New function (set-options! key value) to set global options,include keys
:ssh-options,:scp-options,:rsync-options and :user for all cluster.
-Task name could be a symbol rather than keyword
- Improve documents and leiningen plugin commands.
- Other small changes.

*Upgrade:*

   lein plugin install control 0.3.3



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Inconsistent refs within an STM transaction.

2012-04-16 Thread dennis zhuang
I think the key point is that the read transaction doesn't change the
value,so it will see the snapshots before or after ref1 updated,and both of
two snapshot could be treated consistently.

All reads of Refs will see a consistent snapshot of the 'Ref world' as of
the starting point of the transaction (its 'read point'). The transaction
will see any changes it has made. This is called the in-transaction-value.

The document said that we can see a consistent snapshot as of the read
point.While the read point is changed when tx is restarted,then the
snapshot is changed,*but it is still consist. *

Why read transaction is restarted even if there is an old value before the
read point? My opinion is that clojure want to provide a  "newest
consistent snapshot" as it can.But when you changed the ref value in your
transaction ,it will cache the in-transaction value to provide "current"
consist snapshot and keep the cache until commit fails to restart.


2012/4/17 Neale Swinnerton 

> Hi,
>
> We're all agreed that the behaviour I'm seeing is because the READ
> transaction is re-starting. It sounds like the community thinks that's the
> right behaviour and I'm happy to be educated
>
> I don't believe that the READ transaction should need to restart just
> because the underlying refs changed after it started and in fact if the
> refs have history then the READ transaction isn't restarted.
>
> I guess my observations could be re-phrased...
>
>
> Is it desirable that the semantics around transaction re-start where the
> transaction is purely a read-only transaction differ based on whether the
> refs have history or not.
>
>
> If everyone's happy that that's the case then an update to that point #1
> on clojure.org/refs is probably in order, because that's not how it reads
> at the moment at least in my understanding.
>
> thanks for your time.
>
> Neale
> {t: @sw1nn <https://twitter.com/#!/sw1nn>, w: sw1nn.com }
>
>
>
> On Tue, Apr 17, 2012 at 7:20 AM, dennis zhuang wrote:
>
>> Hi,
>>
>>   I know your meaning.But it is real that the read transaction is
>> restarted,you can observer it by stm-profile:
>> https://github.com/killme2008/stm-profiler
>>
>>   (.start (Thread.
>>  #(do (Thread/sleep 1)
>>  (prn (ref-stats r1)
>>
>>   (Thread/sleep 2000)
>>
>> r1 statistics:
>>
>>{:deref 2, :get-fault 1}
>>
>> It meant that r1's dereference get fault once,because no version of r1
>> value precedes the read point in the first transaction.
>>
>> Clojure STM deference value from new to old,that the newest value will be
>> in ref history queue head,and it found that the newest value's point is
>> great than transaction read point,so the tx is restarted.I think that
>> in-transaction value means that you can change the value in the transaction
>> in an atomic way and is thread safe that you don't have to worry about
>> concurrency.It's consistent in the transaction,but it may be not consistent
>> with other transactions.
>>
>>
>> 2012/4/17 Neale Swinnerton 
>>
>>>
>>> Hi Stu,
>>>
>>> The point is that there's no reason for the READ transaction to restart,
>>> it has only made reads of refs and those reads should be consistent with
>>> each other from the snapshot of the the ref world as per...
>>>
>>> In practice, this means:
>>>
>>>1. All reads of Refs will see a consistent snapshot of the 'Ref
>>>world' as of the starting point of the transaction (its 'read point'). 
>>> The
>>>transaction *will*see any changes it has made. This is called the *
>>>in-transaction-value*
>>>
>>> *
>>> *
>>> from: http://clojure.org/refs
>>>
>>> The fact that the behaviour changes in the presence of history is a
>>> problem in my opinion.
>>>
>>> Yes you can 'ensure' that the refs aren't modified, but that means
>>> writes are blocked by reads - is that desired?
>>>
>>> Neale
>>> {t: @sw1nn <https://twitter.com/#!/sw1nn>, w: sw1nn.com }
>>>
>>>
>>>
>>> On Tue, Apr 17, 2012 at 2:59 AM, Stuart Halloway <
>>> stuart.hallo...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> [disclojure]: I've asked about this on SO, but figured out what was
>>>> happening myself[1] and that led to this enquiry.
>>>>
>>>>
>&

Re: Inconsistent refs within an STM transaction.

2012-04-16 Thread dennis zhuang
Hi,

  I know your meaning.But it is real that the read transaction is
restarted,you can observer it by stm-profile:
https://github.com/killme2008/stm-profiler

  (.start (Thread.
 #(do (Thread/sleep 1)
 (prn (ref-stats r1)

  (Thread/sleep 2000)

r1 statistics:

   {:deref 2, :get-fault 1}

It meant that r1's dereference get fault once,because no version of r1
value precedes the read point in the first transaction.

Clojure STM deference value from new to old,that the newest value will be
in ref history queue head,and it found that the newest value's point is
great than transaction read point,so the tx is restarted.I think that
in-transaction value means that you can change the value in the transaction
in an atomic way and is thread safe that you don't have to worry about
concurrency.It's consistent in the transaction,but it may be not consistent
with other transactions.


2012/4/17 Neale Swinnerton 

>
> Hi Stu,
>
> The point is that there's no reason for the READ transaction to restart,
> it has only made reads of refs and those reads should be consistent with
> each other from the snapshot of the the ref world as per...
>
> In practice, this means:
>
>1. All reads of Refs will see a consistent snapshot of the 'Ref world'
>as of the starting point of the transaction (its 'read point'). The
>transaction *will*see any changes it has made. This is called the *
>in-transaction-value*
>
> *
> *
> from: http://clojure.org/refs
>
> The fact that the behaviour changes in the presence of history is a
> problem in my opinion.
>
> Yes you can 'ensure' that the refs aren't modified, but that means writes
> are blocked by reads - is that desired?
>
> Neale
> {t: @sw1nn , w: sw1nn.com }
>
>
>
> On Tue, Apr 17, 2012 at 2:59 AM, Stuart Halloway <
> stuart.hallo...@gmail.com> wrote:
>
>> Hi,
>>
>> [disclojure]: I've asked about this on SO, but figured out what was
>> happening myself[1] and that led to this enquiry.
>>
>>
>> It seems that the consistency of refs within an STM transaction (dosync)
>> depends on whether the ref has history.
>>
>> So if you create 2 refs and then read them in a transaction they could be
>> inconsistent with each other. i.e they won't necessarily return the value
>> the ref had at the start of the transaction.
>>
>>
>> However, if you give the refs some history by updating them in a prior
>> transaction, then the two refs will be consistent with each other in
>> subsequent transactions.
>>
>> This seems rather dangerous to me. Is there a rational for not creating
>> at least 1 history entry for a ref at ref creation time.
>>
>> Neale
>> {t: @sw1nn , w: sw1nn.com }
>>
>>
>> [1]
>> http://stackoverflow.com/questions/10178639/are-refs-really-consistent-within-a-stm-transaction
>>
>>
>> Hi Neale,
>>
>> Your example does not appear to match your conclusion. It shows that a
>> transaction restarts, and that the reads are all consistent as of the
>> restarted transaction.
>>
>> Cheers,
>> Stu
>>
>>
>> Stuart Halloway
>> Clojure/core
>> http://clojure.com
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>  --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: question about partial

2012-04-16 Thread dennis zhuang
user=> (defn f[x y] (+ x y))
#'user/f
user=> (-> 3 ((partial f 2)))
5

It must works :). Please notice the extra parentheses.

2012/4/17 larry 

>
>
> On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote:
>>
>> (-> 3 ((partial f 2))) should also work.
>>
>
>
> I just wrote that it DOESN'T WORK. That's the point of the question.I
> should get 5 instead I get
> t#
>
>
>  --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Inconsistent refs within an STM transaction.

2012-04-16 Thread dennis zhuang
Hi

  Transaction "read point" is changed every time when transaction is
started or retried.So the result is all right.If you want the ref1 cloud
not be modified by other transactions ,you can use "ensure":

(defn deref-delay-deref [ref1 ref2 delay]
(.start
   (Thread.
  #((println "READ start")
(dosync
 (println "transaction starting")
* (ensure ref1)*
  (let [a @ref2]
 (Thread/sleep delay)
 (println "S r1=" @ref1))) ; should be consistent with
@ref2
(println "READ end")

2012/4/17 Herwig Hochleitner 

> > So if you create 2 refs and then read them in a transaction they could be
> > inconsistent with each other. i.e they won't necessarily return the value
> > the ref had at the start of the transaction.
> >
> > However, if you give the refs some history by updating them in a prior
> > transaction, then the two refs will be consistent with each other in
> > subsequent transactions.
> >
> > This seems rather dangerous to me. Is there a rational for not creating
> at
> > least 1 history entry for a ref at ref creation time.
>
> I haven't looken into your examples in detail, but clojure has
> http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ensure
> to get consistent reads.
>
> I don't know exactly why read skew is allowed by default. Maybe it's
> along the lines of: If reads were consistent by default, performance
> would suffer and write skew would still be possible (which can be
> prevented by (ref-set ref @ref))
>
> kind regards
>
> --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: seeking a lazy way to interleave a constant

2012-04-09 Thread dennis zhuang
D o you want this?
user=> (def x (interleave (iterate inc 1) (repeat 0)))
#'user/x
user=> (take 10 x)
(1 0 2 0 3 0 4 0 5 0)

2012/4/10 Andrew 

> Given a lazy sequence of numbers is there a way to interleave a constant
> and get another lazy sequence? Say the first sequence is 1 2 3 4 ... I'd
> like the second sequence to be 1 0 2 0 3 0 4 0 
>
> Thanks in advance!
>
> --
> 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




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Boolean

2012-04-07 Thread Dennis Haupt
i've never seen a "new Boolean(...)" in my 10 years of developing java code.

Am 07.04.2012 22:49, schrieb Michael Klishin:
> Steven Obua:
> 
>> (if (Boolean. false) "jesus" "christ")
>>
>> will return "jesus", not "christ". Googling this on the net, I found
>> that this is a known phenomenon
> 
> http://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html#Boolean(boolean)
>  says:
> 
> «Note: It is rarely appropriate to use this constructor. Unless a new 
> instance is required, the static factory valueOf(boolean) is generally a 
> better choice.»
> 
> Now lets take a look at some of the alternative choices:
> 
> user=> (if (Boolean/valueOf true) "true" "false")
> "true"
> user=> (if (Boolean/valueOf false) "true" "false")
> "false"
> user=> (if (Boolean/valueOf "false") "true" "false")
> "false"
> user=> (if (Boolean/valueOf "true") "true" "false")
> "true"
> user=> (if (Boolean/TRUE) "true" "false")
> "true"
> user=> (if (Boolean/FALSE) "true" "false")
> "false"
> user=> (if false "true" "false")
> "false"
> user=> (if true "true" "false")
> "true"
> 
> So, what does all this mean?
> 
> 1. This is not a Clojure behavior but a Java one. Somehow millions of Java 
> developers and projects
> managed to get by with this weird behavior.
> 
> 2. This fact is documented and there are alternatives.
> 
> 3. You can get very far with just true and false literals, especially in pure 
> Clojure programs.
> 
> MK
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Boolean

2012-04-07 Thread Dennis Haupt
why is there an exception for Boolean.FALSE?

Am 07.04.2012 17:28, schrieb Softaddicts:
> Hi,
> 
> You are not in the Clojure play ground when you use (Boolean. false).
> 
> This expression creates a Java object, hence (if any-java-object ...)
> always evaluate the "true" branch in Clojure.
> 
> In Clojure, anything not nil is true except false which is equivalent to the 
> Java
> false value.
> (if false) (if nil ...) will both evaluate the "false" branch.
> 
> In your specific case, (if (.booleanValue (Boolean. false)) ...) would 
> correctly
> evaluate since booleanValue returns the value in the object, not the
> object itself.
> 
> If you can, stay in Clojure and avoid Java for a while until you get more
> code lines behind you.
> 
> Hope I am clear enough, just woke up :)
> 
> Luc
> 
> 
>> Hi,
>>
>> I am using Clojure for a month now. I like it a lot so far, but there
>> are a couple of little details that make me very afraid. Foremost:
>>
>> (if (Boolean. false) "jesus" "christ")
>>
>> will return "jesus", not "christ". Googling this on the net, I found
>> that this is a known phenomenon, and some rationalizations of why this
>> is the correct thing to do (it is not, sorry Rich).
>>
>> I could live with this, but I have code that is written completely in
>> clojure, and does not create Boolean objects in any explicit way, or
>> uses third-party libraries except for the stuff in clojure.core and
>> slingshot. Nevertheless, somehow Boolean objects seem to creep into
>> live, and I have code like that:
>>
>> (if (:leaf m-node)
>> 
>> ...
>> )
>>
>> that breaks because of it. I am using from the github repository
>> ( 14428c296de483ea666bd874701046e7088e545c).
>>
>> This means that I cannot trust my code on the most basic level, and
>> this is unacceptable.
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
> --
> Softaddicts sent by ibisMail!
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure Toolbox

2012-03-24 Thread dennis zhuang
Another link http://cnlojure.org/open.html

2012/3/24 Rostislav Svoboda 

> A nice list of tools and libraries I stumbled upon. Enjoy!
>
> http://www.clojure-toolbox.com/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

{ANN}Clojure-Control 0.3.2 is out

2012-03-24 Thread dennis zhuang
Hi,all
   I am pleased to announce that clojure-control 0.3.2 is
out.Clojure-control is a clojure DSL for system admin and deployment with
many remote machines via ssh.Please see
https://github.com/killme2008/clojure-control

   Main highlights in 0.3.2:
1.You can include other clusters in defcluster,for example,you have defined
cluster named frontend and backend,then you can define a new cluster
named all to include all of them:

  (defcluster :all
  :includes [:frontend :backend])

2.Fixed issue 11: control could not run on some jdk version.
3.Adds new commands for lein control plugin,you can start a control server
by "lein control server",then you don't have to compile control file every
time when running task,you can run task by "lein control run mycluster task
-r",it will connect to control server and run the task on server,returns
result to client at last.
4.Improve api document.

You can upgrade control by "lein plugin install control 0.3.2" and change
the dependency version in project.clj.



--
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Parallel SSH and system monitoring in Clojure

2012-03-15 Thread dennis zhuang
There is a clojure-control:
https://github.com/killme2008/clojure-control

2012/3/16 Chris McBride 

> Hi,
>
>   I releases two simple clojure libraries to help running commands
> via SSH on multiple servers. Hopefully someone will find it useful.
>
>
> http://info.rjmetrics.com/blog/bid/54114/Parallel-SSH-and-system-monitoring-in-Clojure
>   https://github.com/RJMetrics/Parallel-SSH
>   https://github.com/RJMetrics/Server-Stats
>
> Best,
> Chris McBride
>
> --
> 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




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

{ANN} Clojure-Control 0.3.0 is out

2012-02-18 Thread dennis zhuang
Hi,all
Clojure-control  is a
clojure DSL for system admin and deployment with many remote machines via
ssh.
I am pleased to annoucment that clojure-control 0.3.0 is out.It adds
some  powerful features in this release ,includes:

   - ssh and scp both have a new option :sudo  to be executed as root on
   remote machines,for example:

   (ssh "/etc/init.d/ssh restart" :sudo true)

   - scp has a new  option :mode to change file modes copied from local:

   (scp "start.sh" "/etc/init.d/start.sh" :sudo true :mode 755)

   - A  new function "exists?" to test if a file exists on remote
   machines:

   (if (not (exists? (str "/home/deploy/.ssh")))
 (ssh (sudo (str "mkdir -p /home/deploy/.ssh"

   - Call other task in deftask with "call" function:

   (deftask :ps "A task to grep process" [process]
   (ssh (str "ps aux | grep " process)))
   (deftask :start_ha []
   (ssh "/etc/init.d/haproxy start")
   (call :ps "haproxy"))

   - A new function "append" to append a line to a file on remote machines:

   (ssh (append "/etc/hosts" "192.168.1.100 web" :sudo true))

   - A new function "sed" to replace lines in a file on remote machines,and
   comm/uncomm to comment/uncomment a line in a file:

(sed:flags  :limit  :backup )

   Equivalent to

sed -i -r -e " s///g "

   -

   Limits max output line to 1.

   -

   Adds more documents in wiki:
https://github.com/killme2008/clojure-control/wiki 



You can install the new version by :

lein plugin install control 0.3.0   #For clojure 1.3
lein plugin install control 0.3.1   #For clojure 1.2

More information please visit it on github:
https://github.com/killme2008/clojure-control

And wiki: https://github.com/killme2008/clojure-control/wiki
  <../../../>




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Problem with amap over byte arrays

2012-02-16 Thread dennis zhuang
Because bit-xor returns a integer,so you have to cast it to byte:

(amap ^bytes an-array
 idx
 ret
 (byte (bit-xor (byte 0)
(aget ^bytes an-array idx

2012/2/17 Andreas Kostler 

> Hi all,
> I'm experiencing the following problem:
>
> (def an-array (byte-array 200 (byte 1)))
> (amap ^bytes an-array
>  idx
>  ret
>  (bit-xor (byte 0)
> (aget ^bytes an-array idx)))
>
> Resulting in:
>
> No matching method found: aset
>
> Wheras this:
>
> (def another-array (int-array 200 (int 1)))
> (amap ^ints an-array
>  idx
>  ret
>  (bit-xor (int 0)
> (aget ^ints another-array idx)))
>
> Works as expected. Does anyone know what's going on?
> Clojure version is 1.3.0
>
> --
> 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




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

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

{ANN} clojure-control 0.2.4 is out

2012-02-13 Thread dennis zhuang
Hi,all

Clojure-control is a clojure DSL for system admin and deployment with
many remote machines via ssh,and i have checked out a branch to make it
work with clojure 1.3 now. At last, control 0.2.4 works well with clojure
1.3,and 0.2.3 works well with clojure 1.2:

:dev-dependencies [[control "0.2.3"]]   ; clojure 1.2
:dev-dependencies [[control "0.2.4"]]   ; clojure 1.3

More information please visit the project home:

https://github.com/killme2008/clojure-control

-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Best IDE

2012-01-20 Thread Dennis Peterson
That third trick works in standard vim when you type "da("...except you
don't have to be on the opening paren, you can be anyplace within the sexp
(as long as you're not within a smaller sexp, in which case you'll get that
one.)

A couple quick macros can handle the other two. If those three are the main
benefits of paredit, then vim might be a better fit for lisp than I'd
realized. (I'm a lispy newb so I don't have a whole lot of experience
trying to edit it yet.)

On Thu, Jan 19, 2012 at 8:26 PM, Mark Nutter  wrote:

> On Thu, Jan 19, 2012 at 11:42 AM, David Brunell 
> wrote:
> > How long did it take you to get comfortable with paredit?  I keep getting
> > frustrated and going back to manually matching parens.
>
> I had the same experience for a while, but then I realized I just had
> to remember 3 things:
>
> To enclose an existing sexp inside a new one---in other words, if I
> have (map...) and I want (doall (map...))---put the cursor on the
> opening paren of the existing sexp and type M-( and it automatically
> wraps the whole sexp in parens, correctly balanced.
>
> To pull an existing sexp out of its enclosing sexp---i.e. to turn
> (doall (map ...)) back into (map...)---put the cursor on the opening
> paren of the inner sexp and type M-uparrow. Use with caution, because
> it nukes anything else in the same enclosing sexp, but that's not too
> bad because:
>
> If you put the cursor on the opening paren and then hit C-k, it cuts
> out exactly that sexp (and its contents) but no more, keeping the
> parens perfectly balanced.
>
> That last trick is what made paredit a must-have for me, because I do
> a lot of cut and paste, and paredit makes it a piece of cake. You
> don't have to worry about selecting the beginning and ending parens,
> just put the cursor on the open paren and hit C-k, and it cuts exactly
> as much as it needs to grab a balanced sexp, even across multiple
> lines, leaving any other close-parens untouched. It's awesome.
>
> I think paredit does other stuff too, but those three things get me
> through the day.
>
> Mark
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Best IDE

2012-01-19 Thread Dennis Haupt
i'm also using ldea 11 ultimate + the newest plugin, but i the only
debugger i can use is the standard java debugger, so i can only debug if i
go a few steps back until i am inside the clojure internal classes
i don't see/can evaluate any native clojure stuff

can you send me a screenshot so i can believe what you are saying? :)


2012/1/18 Jay Fields 

> I'm not running the community edition (and I'm not sure if you are
> either). I've updated to the latest LaClojure (when I upgraded to
> IntelliJ 11). I've evaluated expressions successfully in the past, and
> when I set a breakpoint I can see locals.
>
> That said, when I tried to do those things and capture a snapshot my
> IntelliJ crashed. So, for whatever reason I'm getting more
> functionality than you are, but it's not exactly coming "for free".
>
> I would love it if La Clojure got more love, but I'm not holding my breath.
>
> On Wed, Jan 18, 2012 at 4:00 PM, Dennis Haupt 
> wrote:
> > when i say "debugging", i mean "inspect fields and evaluate expressions".
> >
> > i attached a screenshot of all i get: a useless stacktrace and no
> > variables. how do you debug?
> >
> >
> > Am 18.01.2012 21:29, schrieb Jay Fields:
> >> intelliJ debugging support and find usage both got much better when I
> >> moved to IntelliJ 11. Also, you can auto-complete class names with
> >> ctrl+alt+space and it auto-imports.
> >>
> >> I'd still recommend emacs for Clojure only work, but the IntelliJ
> >> support has gotten much better.
> >>
> >> On Wed, Jan 18, 2012 at 3:27 PM, Dennis Haupt 
> wrote:
> >>> Am 18.01.2012 21:10, schrieb Sean Corfield:
> >>>> On Wed, Jan 18, 2012 at 10:42 AM, Dennis Haupt <
> d.haup...@googlemail.com> wrote:
> >>>>> there is no really good ide (analysis, error highlighting, debugging)
> >>>>
> >>>> Hmm, I have error highlighting and debugging. Not sure what you mean
> >>>> by "analysis".
> >>>
> >>> call hierarchy, find usage, stuff like that.
> >>> what tool do you use? i could neither debug in intellij nor netbeans
> >>>
> >>>
> >>> --
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Clojure" group.
> >>> To post to this group, send email to clojure@googlegroups.com
> >>> Note that posts from new members are moderated - please be patient
> with your first post.
> >>> To unsubscribe from this group, send email to
> >>> clojure+unsubscr...@googlegroups.com
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/clojure?hl=en
> >>
> >
> >
> > --
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Sorry Don't understand "for macro", a bug or a newbie-question??

2012-01-18 Thread dennis zhuang
for returns a lazy sequence.You may prefer doseq:
(defn fortest2 []
 (doseq [a (range 2 10)
 b (range 2 10)]
   (do
 (println "x: " a " b:" b)
 (list a b)))
 (println "ende")
 )
(fortest2)

doseq will be forced for side-effects.

2012/1/19 Jack Moffitt 

> > doesn't show any effect of the for.
> > The only difference is the additional statement at the end.
> > I can not imagine how this statement sequentially behind can influence
> > the for.
>
> for returns a lazy sequence. In the first case, in printing out the
> result to the REPL, the lazy sequence is realized, and in the second,
> the result is discarded so it is never realized.
>
> jack.
>
> --
> 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
>



-- 
庄晓丹
Email:killme2...@gmail.com
伯岩(花名)  bo...@taobao.com
Site:   http://fnil.net

淘宝(中国)软件有限公司 / 产品技术部 / Java中间件

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Best IDE

2012-01-18 Thread Dennis Haupt
Am 18.01.2012 21:10, schrieb Sean Corfield:
> On Wed, Jan 18, 2012 at 10:42 AM, Dennis Haupt  
> wrote:
>> there is no really good ide (analysis, error highlighting, debugging)
> 
> Hmm, I have error highlighting and debugging. Not sure what you mean
> by "analysis".

call hierarchy, find usage, stuff like that.
what tool do you use? i could neither debug in intellij nor netbeans


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Best IDE

2012-01-18 Thread Dennis Haupt
there is no really good ide (analysis, error highlighting, debugging)

Am 18.01.2012 17:18, schrieb Jay Fields:
> Use emacs, if you want the path of least resistance for writing pure
> clojure code. You'll have the most support from the community.
> 
> Use whatever IDE you already use for Java, if you need to do a decent
> amount of interop.
> 
> I use both emacs (pure clj projects) & IntelliJ (when doing interop)
> and don't have much trouble swapping back and forth when working on
> different projects.
> 
> On Wed, Jan 18, 2012 at 11:08 AM, Devin Walters  wrote:
>> Clooj is an option. I learned emacs when I started, but I've tried textmate, 
>> ccw, la clojure, enclojure, etc.
>>
>> My suggestion is: Don't spend too much time trying to be "right" in which 
>> editor you choose. I've seen people using just about every editor under the 
>> sun to write clojure. Learning the language is more important than the 
>> environment you edit in. If you don't know what you want I'd try clooj to 
>> give you some frame of reference to evaluate other environments.
>>
>> Experience reports are welcome.
>>
>> Sent via mobile
>>
>> On Jan 17, 2012, at 9:28 PM, Sean Corfield  wrote:
>>
>>> On Tue, Jan 17, 2012 at 1:38 PM, Josef Frydl  wrote:
 Can you please recommend the Best IDE for Clojure? I have Eclipse
 NetBeans and JetBrain already installed.
>>>
>>> Two possible answers:
>>> * use whichever IDE you're already most familiar with and install the
>>> appropriate Clojure plugin
>>> * use Emacs :)
>>>
>>> By which I mean to imply that there's no objective "Best IDE" for
>>> Clojure - it will depend on what you're used to already, what you're
>>> looking for, and how much you're willing to learn in an IDE, just to
>>> program in Clojure.
>>>
>>> When I first started with Clojure, I used TextMate with the Clojure
>>> bundle. It was great for working on Clojure code independent of
>>> everything else. It was basic, functional and did what I needed at the
>>> time.
>>>
>>> Once I started using Clojure "at work", I installed CounterClockWise
>>> because I already used Eclipse at work and I had a definite workflow
>>> that I wanted Clojure to fit into. CCW is awesome - kudos to Laurent
>>> and Chas (and everyone else who has contributed to it).
>>>
>>> As Clojure started to become my primary language, I wanted a more
>>> Clojure-centric workflow and I wanted things that CCW doesn't (yet)
>>> provide such as code completion / auto-suggest, debugging... I also
>>> wanted something more lightweight than Eclipse so that I could have
>>> the same environment on both my low-powered netbook while traveling
>>> and my quad core 16GB RAM desktop. So I switched to Emacs.
>>> Technically, I switched _back_ to Emacs after about 20 years of other
>>> editors and IDEs. The first week was very painful(!) but soon I found
>>> myself more productive and enjoying working with Clojure even more.
>>> For all sorts of reasons, Emacs is still the primary choice for
>>> Clojure developers - see Chas Emerick's "State of the Union" survey
>>> for 2011: 
>>> http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
>>> --
>>> Sean A Corfield -- (904) 302-SEAN
>>> An Architect's View -- http://corfield.org/
>>> World Singles, LLC. -- http://worldsingles.com/
>>>
>>> "Perfection is the enemy of the good."
>>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with 
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: are non programmers the better programmers?

2012-01-18 Thread Dennis Haupt
let's call it the "biased experience effect". if there are 20 ways to solve
a problem, and you just know 3 of them, you are a hammer and the problem
looks like a nail. if you have a broader knowledge, you can pick a more
appropriate solution.
what i claim is that if you know NO solutions, the one you'll come up with
will most likely be better than the one you come up with if you know 3
solutions because you are not biased.

2012/1/18 Baishampayan Ghose 

> On Wed, Jan 18, 2012 at 3:16 AM, James Reeves 
> wrote:
> > To borrow from Stuart Halloway: simplicity ain't easy.
>
> +1. Simplicity comes with experience.
>
> Nevertheless, my entry -
>
> (defn odd-occurrences [coll]
>(for [[k v] (frequencies coll) :when (odd? v)]
>k))
>
> Regards,
> BG
>
> --
> Baishampayan Ghose
> b.ghose at gmail.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: are non programmers the better programmers?

2012-01-17 Thread Dennis Haupt
Am 17.01.2012 23:08, schrieb daly:
> On Tue, 2012-01-17 at 21:46 +0100, Dennis Haupt wrote:
>> after the "wtf"s have worn off a bit, go on reading.
>> imagine a simple problem: you have a collection of numbers and you have
>> to write a function which collects all the numbers that are contained
>> uneven times. for example, for a collection (1,2,3,2,3,4) the correct
>> result is (1,4)
>>
>> ask a child:
>> "you just make pairs and return the leftovers"
>>
>> ask a non-child human:
>> "count how often a number is in the list and pick the ones that are
>> contained uneven times"
>>
>> i also asked some oo programmers. one of the answers involved a
>> multimap, building it, iterating over it again and putting the result in
>> a new list. one answer was "i don't see any purpose in this".
>> there was no FP coder around at that time.
>>
>> i've noticed this since i started to work as a programmer 10 years ago.
>> programmers in general are supposed to be good at finding simple
>> solutions, but my experience is: they are not. on the contrary, many
>> suffer from their individual tunnel visions without being aware of it.
>> to a hammer, everything looks like a nail.
>>
>> i have walked a different path. when i was a child, i wondered: had i
>> been born in a different country having different friends and parents,
>> how would i be like? would i believe in a different god? would i like
>> different music? i decided to try to be as independent from outside
>> condition as possible, so i needed something as close to "the absolute
>> truth" as possible and base my decisions on that. that absolute truth
>> was nothing other than logic itself. it would always give the same
>> answer, given the same input. it would never lead me to contradictions.
>> it could not answer everything, but if it could, the answer always
>> turned out to be correct - if testable. you could say logic is my
>> personal tunnel through which i see everything, but i have yet to find a
>> better one.
>> i never care about how many people agree or disagree with me. if logic
>> says "it's true", it just is.
>>
>> when solving a problem, i always try to find the most simple and elegant
>> solution thinkable in a grand scheme. i'm pretty demanding here. i
>> barely accept my own code if it doesn't fit exactly to the problem it is
>> supposed to solve :) now back to the topic.
>> when writing code, i try to follow a few simple rules as good as possible:
>> * no one should every have to read the code to figure out how it works.
>> it should always be enough to take a look at what it does, not how.
>> * when changing code, everything that is not in the current mental scope
>> should not have any connection to the code that is being changed. it
>> should always be possible to ignore everything else without breaking it
>> by accident.
>> * use the highest abstraction level that still makes sense.
>> * not applicable to clojure, but: type your code well. well typed code
>> is easy to analyse and hard to use wrong. if you're working with tables
>> and define a rowint and a colint-type, you would never be able to
>> confuse them. if you had a nonzeroint and a zeroint-type, you would
>> never accidently divide by zero. if you are accessing an array that is
>> zero-based, there should be a zerobasedindexint. otherwise, there should
>> be a onebasedindexint.
>> * if you need something more than once, there should be an easily
>> useable and accessible function for it.
>> * write code in such a way that it cannot go wrong :)
>> * solve problems once (and for all) with structure, not with flat logic
>> at many points. if a solution is too simple, its users will have to make
>> up for it by adding logic on the outside.
>>
>> this email didn't really have a purpose, i just didn't know a better
>> place to post this.
>>
> 
> Unfortunately you are reasoning "in the small". Real systems have very
> complex webs where some particular piece of code hangs. The code depends
> on a LOT of other factors. I have attached a "simple" piece of algebra
> code that is REALLY strongly typed and implements Algebraic Function
> Fields in Axiom. It does an amazing amount of work in a relatively
> trivial bit of code. It implements perfectly clear algorithms and was
> written by a world-class computational mathematician. 
> 
> I have other examples from my Magnus project in the area of infinite
> group theory. A few lines of C++ 

Re: are non programmers the better programmers?

2012-01-17 Thread Dennis Haupt
Am 17.01.2012 22:46, schrieb James Reeves:
> On 17 January 2012 20:46, Dennis Haupt  wrote:
>> i've noticed this since i started to work as a programmer 10 years ago.
>> programmers in general are supposed to be good at finding simple
>> solutions, but my experience is: they are not. on the contrary, many
>> suffer from their individual tunnel visions without being aware of it.
>> to a hammer, everything looks like a nail.
> 
> To borrow from Stuart Halloway: simplicity ain't easy.
> 
> The example solutions you provide from non-programmers seem
> straightforward, but that's because they're instructions designed to
> be followed by a human being, who can infer and reason, rather than a
> programming language that is constructed around the idea of precise
> commands.
> 
> For instance, "you just make pairs" hides a considerable amount of
> depth. How do you make pairs? You might select one number, then look
> for another number that is identical, but how do you ensure you don't
> pick the same number?
> 
> Or what about "count how often a number is in the list". Again, it
> seems a simple thing to do, but only if you're giving instructions to
> a human. In programming there are many additional questions, like
> where to store the numbers whilst you're counting them. Do you go
> through the whole list for each number, or do you go through the list
> once and keep a tally? If you keep a tally, which data structure
> should be used to implement this?

in the end, the program must work down to the lowest level and there
cannot be unanswered questions. but take a look at the 3 solutions given
until now. in 2 cases, all i read is "do this, then that, i don't care
how". in the third, a hashset was picked. but it didn't have to be one.
any non-map-collection type would have worked here.

> 
> It's often a lot easier to find a complex solution to a problem than a
> simple one. Simple solutions are hard work to find.

i'd say they require different strategies to find

> 
> - James
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: are non programmers the better programmers?

2012-01-17 Thread Dennis Peterson
"There are two ways of constructing a software design. One way is to make
it so simple that there are obviously no deficiencies. And the other way is
to make it so complicated that there are no obvious deficiencies."— C.A.R.
Hoare.

On Tue, Jan 17, 2012 at 3:46 PM, Dennis Haupt wrote:

> after the "wtf"s have worn off a bit, go on reading.
> imagine a simple problem: you have a collection of numbers and you have
> to write a function which collects all the numbers that are contained
> uneven times. for example, for a collection (1,2,3,2,3,4) the correct
> result is (1,4)
>
> ask a child:
> "you just make pairs and return the leftovers"
>
> ask a non-child human:
> "count how often a number is in the list and pick the ones that are
> contained uneven times"
>
> i also asked some oo programmers. one of the answers involved a
> multimap, building it, iterating over it again and putting the result in
> a new list. one answer was "i don't see any purpose in this".
> there was no FP coder around at that time.
>
> i've noticed this since i started to work as a programmer 10 years ago.
> programmers in general are supposed to be good at finding simple
> solutions, but my experience is: they are not. on the contrary, many
> suffer from their individual tunnel visions without being aware of it.
> to a hammer, everything looks like a nail.
>
> i have walked a different path. when i was a child, i wondered: had i
> been born in a different country having different friends and parents,
> how would i be like? would i believe in a different god? would i like
> different music? i decided to try to be as independent from outside
> condition as possible, so i needed something as close to "the absolute
> truth" as possible and base my decisions on that. that absolute truth
> was nothing other than logic itself. it would always give the same
> answer, given the same input. it would never lead me to contradictions.
> it could not answer everything, but if it could, the answer always
> turned out to be correct - if testable. you could say logic is my
> personal tunnel through which i see everything, but i have yet to find a
> better one.
> i never care about how many people agree or disagree with me. if logic
> says "it's true", it just is.
>
> when solving a problem, i always try to find the most simple and elegant
> solution thinkable in a grand scheme. i'm pretty demanding here. i
> barely accept my own code if it doesn't fit exactly to the problem it is
> supposed to solve :) now back to the topic.
> when writing code, i try to follow a few simple rules as good as possible:
> * no one should every have to read the code to figure out how it works.
> it should always be enough to take a look at what it does, not how.
> * when changing code, everything that is not in the current mental scope
> should not have any connection to the code that is being changed. it
> should always be possible to ignore everything else without breaking it
> by accident.
> * use the highest abstraction level that still makes sense.
> * not applicable to clojure, but: type your code well. well typed code
> is easy to analyse and hard to use wrong. if you're working with tables
> and define a rowint and a colint-type, you would never be able to
> confuse them. if you had a nonzeroint and a zeroint-type, you would
> never accidently divide by zero. if you are accessing an array that is
> zero-based, there should be a zerobasedindexint. otherwise, there should
> be a onebasedindexint.
> * if you need something more than once, there should be an easily
> useable and accessible function for it.
> * write code in such a way that it cannot go wrong :)
> * solve problems once (and for all) with structure, not with flat logic
> at many points. if a solution is too simple, its users will have to make
> up for it by adding logic on the outside.
>
> this email didn't really have a purpose, i just didn't know a better
> place to post this.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: are non programmers the better programmers?

2012-01-17 Thread Dennis Haupt
Am 17.01.2012 22:17, schrieb Cedric Greevey:
> On Tue, Jan 17, 2012 at 3:46 PM, Dennis Haupt  
> wrote:
>> after the "wtf"s have worn off a bit, go on reading.
>> imagine a simple problem: you have a collection of numbers and you have
>> to write a function which collects all the numbers that are contained
>> uneven times. for example, for a collection (1,2,3,2,3,4) the correct
>> result is (1,4)
>>
>> ask a child:
>> "you just make pairs and return the leftovers"
>>
>> ask a non-child human:
>> "count how often a number is in the list and pick the ones that are
>> contained uneven times"
>>
>> i also asked some oo programmers. one of the answers involved a
>> multimap, building it, iterating over it again and putting the result in
>> a new list. one answer was "i don't see any purpose in this".
>> there was no FP coder around at that time.
> 
> FWIW,
> 
> (defn odd-occurrences [x]
>   (map first
> (filter
>   (fn [[_ v]] (odd? v))
>   (frequencies x
> 
> Signed,
> An FP coder
> 
> :)
> 

it's interesting that the FP solutions translate almost 1:1 to the
explained task

//non child's solution
  def odds(numbers:Seq[Int]) =
numbers.distinct.filter(e => numbers.count(_ == e) % 2 =! 0)

//child's solution - more efficient
  def oddsViaFold(numbers: Seq[Int]) = {
numbers.foldLeft(HashSet.empty[Int])((acc, e) => {
  // store those which are waiting for a second number in a set
  if (acc.contains(e)) acc - e else acc + e
})
  }

-- 

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


are non programmers the better programmers?

2012-01-17 Thread Dennis Haupt
after the "wtf"s have worn off a bit, go on reading.
imagine a simple problem: you have a collection of numbers and you have
to write a function which collects all the numbers that are contained
uneven times. for example, for a collection (1,2,3,2,3,4) the correct
result is (1,4)

ask a child:
"you just make pairs and return the leftovers"

ask a non-child human:
"count how often a number is in the list and pick the ones that are
contained uneven times"

i also asked some oo programmers. one of the answers involved a
multimap, building it, iterating over it again and putting the result in
a new list. one answer was "i don't see any purpose in this".
there was no FP coder around at that time.

i've noticed this since i started to work as a programmer 10 years ago.
programmers in general are supposed to be good at finding simple
solutions, but my experience is: they are not. on the contrary, many
suffer from their individual tunnel visions without being aware of it.
to a hammer, everything looks like a nail.

i have walked a different path. when i was a child, i wondered: had i
been born in a different country having different friends and parents,
how would i be like? would i believe in a different god? would i like
different music? i decided to try to be as independent from outside
condition as possible, so i needed something as close to "the absolute
truth" as possible and base my decisions on that. that absolute truth
was nothing other than logic itself. it would always give the same
answer, given the same input. it would never lead me to contradictions.
it could not answer everything, but if it could, the answer always
turned out to be correct - if testable. you could say logic is my
personal tunnel through which i see everything, but i have yet to find a
better one.
i never care about how many people agree or disagree with me. if logic
says "it's true", it just is.

when solving a problem, i always try to find the most simple and elegant
solution thinkable in a grand scheme. i'm pretty demanding here. i
barely accept my own code if it doesn't fit exactly to the problem it is
supposed to solve :) now back to the topic.
when writing code, i try to follow a few simple rules as good as possible:
* no one should every have to read the code to figure out how it works.
it should always be enough to take a look at what it does, not how.
* when changing code, everything that is not in the current mental scope
should not have any connection to the code that is being changed. it
should always be possible to ignore everything else without breaking it
by accident.
* use the highest abstraction level that still makes sense.
* not applicable to clojure, but: type your code well. well typed code
is easy to analyse and hard to use wrong. if you're working with tables
and define a rowint and a colint-type, you would never be able to
confuse them. if you had a nonzeroint and a zeroint-type, you would
never accidently divide by zero. if you are accessing an array that is
zero-based, there should be a zerobasedindexint. otherwise, there should
be a onebasedindexint.
* if you need something more than once, there should be an easily
useable and accessible function for it.
* write code in such a way that it cannot go wrong :)
* solve problems once (and for all) with structure, not with flat logic
at many points. if a solution is too simple, its users will have to make
up for it by adding logic on the outside.

this email didn't really have a purpose, i just didn't know a better
place to post this.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A STM profile tool

2012-01-16 Thread dennis zhuang
hi,all
I've upgraded the version to 1.0.1-SNAPSHOT.
And added a new function ref-stats to get the statistics information of a
reference.For example:

=>(use'stm)
=>(def a (ref 1))
=>(def b (ref 2))
=>(dotimes [_ 100] (future (dosync (alter a + 1) (alter b - 1

=>@a
101
=>@b
-98

=>(stm-stats)
{"(alter a + 1)(alter b - 1)" {:not-running 9, :average-retry 15,
:total-cost 3048, :get-fault 52, :barge-fail 372, :change-committed 1064,
:total-times 100, :average-cost 30}}

=>(ref-stats a)
{"(alter a + 1)(alter b - 1)" {:alter 1601, :get-fault 52, :barge-fail 372,
:change-committed 1064}}

We can get a detail information of a reference involed in a tranaction.The
:alter means it was invoked with alter 1601 times including retry times.
:get-fault means we can't get a committed value before the transaction read
point,so we have to retry it. :change-commited means that other transaction
has commited a new value of this reference before our transaction,so we
have to retry it again. :barge-fail means we wanted to barge other
transaction,but we failed,we still have to retry the transaction.

2012/1/16 Jonathan Cardoso 

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




-- 
庄晓丹
Email:killme2...@gmail.com
伯岩(花名)  bo...@taobao.com
Site:   http://fnil.net

淘宝(中国)软件有限公司 / 产品技术部 / Java中间件

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: i am so bored

2012-01-15 Thread Dennis Haupt
native = not high level

Am 14.01.2012 16:43, schrieb Joseph Smith:
> How about a native I/O library that'll detect the platform and architecture 
> at runtime? Something like java 1.7's nio, but they'll work on clojure hosted 
> on 1.5.x? Make use of JNA to make native calls to get file system details, 
> etc. 
> 
> Right now you cannot even stat a file from clojure without calling the stat 
> command from a shell. :/
> 
> 
> ---
> Joseph Smith
> j...@uwcreations.com
> (402)601-5443
> 
> 
> On Jan 14, 2012, at 6:12 AM, Dennis Haupt  wrote:
> 
>> hi there,
>>
>> i am looking for something to do, preferably something that makes me
>> rich, but that is not a must have - if it's interesting, i'll code for free.
>>
>> i can offer almost 15 years of coding experience (important: while being
>> open minded the whole time). i am a one man army, if you will :)
>> (procedural, OO (that one for money), FP, even some assembler). one
>> thing i have not yet done is write something big without static type
>> checking, so that'll be new.
>>
>> clojure has caught my interest. in general, high level programming has.
>> i played around with clojure a bit and would like to get something done
>> that has at least some purpose. are there any small/new projects looking
>> for help?
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: i am so bored

2012-01-14 Thread Dennis Haupt
looks like there will be some macro related work which is one of the
things i wanted to look into. i wrote a simple expression (+,-,*,/) and
a creole parser in scala once and spent 2 years on a fps shooter (hello
vector math) so i am not completely lost here :)

did you upload your stuff to github yet?

Am 14.01.2012 13:31, schrieb Samuel Lê:
> Hi there,
> 
> I was just looking for someone like you.
> I have started to develop a mathematica clone in clojure (OK, I started.
> For now it calculates the derivatives and does a bit of expression
> simplification). For now I have couple of function that I test on the
> REPL. I was trying to write a command line interface so I would have
> something to show to people. My next step would be to make a clojure
> syntax translator (from "derivative(x^2,x)" to (derivative '(^ x 2) 'x)  ).
> If you find it interesting we can work together (I consider myself as a
> clojure noob - you can see that from the question I posted on this
> mailing list earlier today-  I am starting to get OK with the syntax, I
> am something like 400-500th on 4clojure, but I have no experience in
> deploying anything in clojure).
> If I can get stuff done I am planning to make a web app from it at some
> point, but I am starting to realize I am not good enough to do the whole
> thing by myself, hence that email.
> 
> Looking forward to have a reply from you,
> Sam
> 
> On Sat, Jan 14, 2012 at 12:12 PM, Dennis Haupt  <mailto:d.haup...@googlemail.com>> wrote:
> 
> hi there,
> 
> i am looking for something to do, preferably something that makes me
> rich, but that is not a must have - if it's interesting, i'll code
> for free.
> tax
> i can offer almost 15 years of coding experience (important: while being
> open minded the whole time). i am a one man army, if you will :)
> (procedural, OO (that one for money), FP, even some assembler). one
> thing i have not yet done is write something big without static type
> checking, so that'll be new.
> 
> clojure has caught my interest. in general, high level programming has.
> i played around with clojure a bit and would like to get something done
> that has at least some purpose. are there any small/new projects looking
> for help?
> 
> --
> 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
> <mailto: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
> <mailto:clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


A STM profile tool

2012-01-14 Thread dennis
I written a profile tool for clojure STM,it statistics all
transactions information such as execution times,execution cost,the
retry reason and times etc.

If you are interested in it,please check it on github:

https://github.com/killme2008/stm-profiler

It's just a try to profile STM,if you have any problems ,please let me
know,thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: converting a string to a list

2012-01-14 Thread dennis zhuang
You can do this
> ((comp #(map str %) seq) "abcdef")
("a" "b" "c" "d" "e" "f")

2012/1/15 Bruce Durling 

> Sam,
>
> Strings can be turned into sequences with seq.
>
> > (seq "foo")
> (\f \o \o)
>
> The backslashes are because f o and o are character literals.
>
> cheers,
> Bruce
>
> On Sat, Jan 14, 2012 at 10:13, Samuel Lê  wrote:
> > Hi,
> >
> > I was wondering if there was a function to convert a list into a string,
> > something like:
> > (string-to-list "abcde")   ;; (a b c d e)
> >
> > thanks!
> >
> > Sam
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> your
> > first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
庄晓丹
Email:killme2...@gmail.com
伯岩(花名)  bo...@taobao.com
Site:   http://fnil.net

淘宝(中国)软件有限公司 / 产品技术部 / Java中间件

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

i am so bored

2012-01-14 Thread Dennis Haupt
hi there,

i am looking for something to do, preferably something that makes me
rich, but that is not a must have - if it's interesting, i'll code for free.

i can offer almost 15 years of coding experience (important: while being
open minded the whole time). i am a one man army, if you will :)
(procedural, OO (that one for money), FP, even some assembler). one
thing i have not yet done is write something big without static type
checking, so that'll be new.

clojure has caught my interest. in general, high level programming has.
i played around with clojure a bit and would like to get something done
that has at least some purpose. are there any small/new projects looking
for help?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread Dennis Haupt
in java i would throw an exception and parse its stack trace. don't know
how to do that in clojure, but probably similar

Am 15.12.2011 06:48, schrieb jaime:
> Hello there,
> 
> I want to write a function named "debug" which will print out "date-
> time msg + current source-line + etc. info", but I don't know how to
> get the current source and line number of the running point (just like
> what REPL does when encounter any exceptions) ...
> 
> Got any ideas?
> 
> Thanks!
> 


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Problem with Korma and clj-soap

2011-11-28 Thread Dennis Crenshaw
For the for the record and in case anyone has run into something similar,
I've fixed my problem and come to an understanding of it's nature...

First, the why:

As it turns out, Axis2, et. al defaults to yelling on the DEBUG log4j level
for it's activity logs. Thus, if the root appender says DEBUG is the
default log level, Axis2 proceeds to constantly dump logs out to console.
It seems broken in that state and no programmer in their right mind will go
and try to digest a WSDL when the console is filling up with hundreds of
lines of DEBUG spewing out with what looks like stack-traces. So the real
answer was, I should have ignored the screaming logs and tried things
anyway.

You can fix it two ways, both of which involve providing your own log4j.xml:

1) You can set root log level to anything above DEBUG (INFO, for example.)

2) You can add two new loggers to contain the screaming server logs:
"org.apache.axis2" and "org.apache.axiom" at, again at any log level above
DEBUG.

Hope this helps!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Problem with Korma and clj-soap

2011-11-28 Thread Dennis Crenshaw
Eeyup, that seems to do the trick! It complains about proper initialization
and Axis2 no longer logs to stdout, but I can serve soap again!

I now just need to find a way to harmonize the logging from Korma and the
logging that Axis2 provides. But that's an exercise left to the OP. :)

Thanks for your help everyone, I hope your holidays are pleasant!

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

Problem with Korma and clj-soap

2011-11-25 Thread Dennis Crenshaw
So I'm trying to create a drop-in implementation of a SOAP webservice with
Clojure. Naturally I look into libraries that accomplish the different
bits. I need something to do SQL work with a relational db
(Korma,
check!) and I need to present a SOAP interface
(clj-soap,
check!)

Unfortunately I'm having tooling issues putting the two together.

The first problem, I'm pretty sure, was simply a Clojure version
mismatch: I and Korma were using Clojure 1.3 and alj-soap was using 1.2--
so I checked out the clj-soap source and updated the libraries (Clojure to
1.3, the Axis2 libraries to their latest) and ran the tests to make sure
all was still working-- it was. So I pushed the 'new' clj-soap to clojars
as [org.clojars.crenshawda/clj-soap "0.1.2"] and tried again.

Much to my chagrin I started getting seemingly endless byzantine DEBUG log
traces spewed out into the repl when I try to start the soap server.

If I comment Korma out of the project.clj, lein deps, and lein repl the
same thing works like a charm. I also checked out each of Korma's
dependencies individually and ran the same serve function and it worked
(the log4j dep made it complin, but it still served just fine.)

I'm not exactly sure WHAT is causing the collision between Korma and
clj-soap, but it's damaging my calm at this point. :) I have a gut feeling
that it's somehow logging related, but I don't know why it would cause
clj-soap to flip out so badly.

To recreate my scenario, start a new project and add these dependencies to
the project.clj:

[org.clojure/clojure "1.3.0"] ;; if is isn't already there by default, I
want to use 1.3
[korma "0.3.0-apha4"]
[org.clojars.crenshawda/clj-soap "0.1.2"] ;; use [clj-soap "0.1.1"] if you
want to see what I was talking about with the 1.2/1.3 mismatch

Since Axis2 (what clj-soap is build upon) requires compiled classes to
serve soap, you'll probably have to define a service in a clj file so 'lein
repl' will pre-compile it for convenience sake.

You can use this:

(soap/defservice service.Hello
(hello ^String [^String s]
(str "Hello Yourself")))

So when you start your repl you should have classes/services/Hello.class in
your classes/ directory. After you have to invoke clj-soap's serve function:

(serve "service.Hello")

... nd you should have a lovely logging wreck in your repl. I'd be
happier if I could at least figure out WHY it happens when I put Korma in
my dependencies. Sorry for the wall of text, but I figure too much info is
usually better than not enough. :)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure-in-CommonLisp?

2011-11-15 Thread Dennis Crenshaw
I haven't dealt with CL in quite a while, but there is this (which I was
involved with in my undergrad at CofC):

http://clforjava.org/

CLforJava may be helpful since it is, "a totally new version of the Common
Lisp language that runs on the Java Virtual Machine and is intertwined with
the Java language in such a way that users of Lisp can directly access Java
libraries and vice versa."

Sounds familliar? :)

Clojure <-> Java <-> CLforJava

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: SQL Korma Missing Pred

2011-11-09 Thread Dennis Crenshaw
So it does, thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

SQL Korma Missing Pred

2011-11-08 Thread Dennis Crenshaw
Let me start by saying, I'm loving this SQLKorma, it feels like just the
right amount of syntax. And there's exec-raw for super fast integration
into an project with existing SQL statements.

However, while kicking the tires I ran into a weird problem, every
predicate works except <=, eg:

$=> (select table (where {:id [<= 1]}))
$=> CompilerException java.lang.RuntimeException: No such var:
korma.internal.sql/pred-<=, compiling:(NO_SOURCE_PATH:46)

Perhaps I'm missing something but all the rest of the pred-vars are there,
that specific one is missing. I wanted to ask before I bother someone with
a ticket.

Thanks,
Dennis

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Another newbie question

2011-11-07 Thread Dennis Haupt
actually, we avoid dynamically typed languages like the plague. i am
taking a peek at clojure because i'm curious.

Am 07.11.2011 11:19, schrieb pron:
> I see. So namespaces are helpful here. 
> What other team practices do you use? E.g. what do you use for effective
> documentation? With Java you can easily find all helpful operations that
> can be used to manipulate a type. 

can you really? you can quickly find all methods in a certain class, but
you never know if there isn't a useful little helper method somewhere.

the clojure-equivalent would be "functions in namespace"

How do you make sure developers find
> all relevant functions in Clojure and don't re-implement old
> functionality? 

laziness is the key.

Not that it's a nonexistent problem in the Java world,
> but Javadoc is very helpful there. 
> 
> I understand my questions could be directed at most dynamic languages,
> and I'm absolutely not entering the static vs. dynamic debate - but
> before I recommend Clojure for use in a team, I'd like to hear some
> experiences. Another member

it was me :D

 of this forum has asked about refactoring
> and was told that the problem doesn't arise that often in Clojure.
> That's good to know. But I would like to hear more. I guess that in some
> organizations the question is not "how do I program in a new language",
> but "how do I develop software in a large team using a new language".

i wouldn't suggest using a language no one has experience in at the
start of a new project. you'll mess up the core design and everyone will
course you for decades.

> I've tried to find some online material that addresses this issue, but
> couldn't find any. 
> 
> Some languages, such as Erlang, induce a model that is very similar to
> OO, so the development practices, I can assume, are similar. But Clojure
> is completely different. I tried to think back to how we did things in
> C, but there we had header files, that, while annoying, did provide some
> documentation and communicated intents rather well. But in Clojure the
> pieces just seem so... disconnected. 

i am beginning to understand how lisp/clojure is supposed to work. can't
put it in words yet.

It is elegant, but does it provide
> any tools for team communication? Has anyone even encountered such
> problems at all?
> 
> And perhaps I shouldn't have used the world "invariably".
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt
Am 07.11.2011 14:02, schrieb Scott Jaderholm:
> On Mon, Nov 7, 2011 at 4:27 AM, Dennis Haupt  <mailto:d.haup...@googlemail.com>> wrote:
> 
> Am 07.11.2011 10:18, schrieb Dennis Haupt:
> >
> >>
> >>
> >> In his code I did notice he doesn't use destructing very much.
> >>
> >
> > where would that have been useful?
> 
> defn x [{:keys [foo bar]} param]
> 
> instead of
> 
> defn x [param]
> (let [foo (:foo param)...])
> 
> This
> 
> (defn advance-movement [game-element]
>   (let [stats (:stats game-element)
> position-change (:movement stats)
> x-change (:x position-change)
> y-change (:y position-change)
> with-new-movement
> (update-in game-element [:stats :position ] #(translated %
> x-change y-change))]
> with-new-movement))
> 
> can be this
> 
> (defn advance-movement [{{{:keys [x y]} :movement} :stats}]



>   (update-in game-element [:stats :position ] translated x y))
> 
> or if you want the docstring to be short
> 
> (defn advance-movement [game-element]
>   (let [{{{:keys [x y]} :movement} :stats} game-element]
>(update-in game-element [:stats :position ] translated x y)))
> 
> Note how you don't need the extra function #().
> 
> I've also noticed that you name your last result in a let and then
> return it. I think it's more common to just return it and not name the
> final thing.

that's because there once was some code which i deleted. i was too lazy
to remove the part in the let :)

> 
> Also sometimes you create a separate let under a let divided maybe only
> by side effects, such as in split-up-asteroid. You could use one let and
> use _ bindings for side effects.

let [_ (println "like this?")]

> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt
Am 07.11.2011 14:01, schrieb Milton Silva:
> 
> 
> On Nov 7, 12:41 pm, Milton Silva  wrote:
>> On Nov 7, 9:14 am, Dennis Haupt  wrote:
>>
>>>>> The main thing to keep in mind is that when coming from java/scala,
>>>>> you'll have a hard time adjusting to clojure, and you're making it
>>>>> harder by trying something so inherently full of state. I understand
>>>>> the need to tackle problems that we like, but without a good
>>>>> understanding of the language you're going to have a really hard time,
>>>>> and that reflects in your code.
>>
>>> what would you have done differently?
>>
>> Generally, I think the best approach is, to represent everything with
>> seqs, work with them and then display them. Something close to 
>> thishttps://github.com/ztellman/penumbra/blob/master/test/example/game/as...
> 
> Maybe this last post isn't very clear. Look at your split-asteroid.
> that fn is either doing much more than splitting asteroids or you have
> the wrong representation of asteroids. I have no idea which is it
> because I cannot understand it(It is doing too much at a time). Now
> look at the split-asteroid in the resource I gave you.
> 

my function *really* splits the asteroid into two parts. it breaks off a
randomly generated part where the bullet hit the asteroid and returns 2
new asteroids, both having sub-polygons of the original asteroid.  there
are some transformations and area operations involved which makes the
function more complex than yours - especially because it's not possible
without making some java calls which in turn have side effects.

i can rewrite the function to make it look more simple (e.g. extract the
polygon operations), but i cannot reduce the total complexity significantly.

what i learned so far:

* assoc has a batch mode
* destructuring in a function signature.
* ->
* ->>
* lots of little things

i think i'll rewrite my asteroids as soon as i find the time (vacation
is over) and make the second version more beautiful. and remove that
IRender-protocol that someone suggested. it turned out that i either
have to use it also for collision checks because it knows the polygon or
add redundancy because the polygon is needed at two spots.

-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt
Am 07.11.2011 08:00, schrieb Sean Corfield:
> On Sun, Nov 6, 2011 at 12:15 PM, Dennis Haupt  
> wrote:
>> if by compatible you mean "has a specific set of functions and fields",
>> then scala can do that without sacrificing static type safety:
> 
> Yes, I started working with Scala in 2009 and it's certainly much
> better than Java but it still forces you to express that sort of
> commonality thru the type system. 

which is a good thing. type safety is good.

-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Another newbie question

2011-11-07 Thread Dennis Haupt
Am 06.11.2011 12:56, schrieb pron:
> Hi. I'm new to Clojure, and enjoy using it very much. It's been years
> since I learned Scheme back in college, and it's a pleasure going back
> to lisp. 
> I do, however, have a question regarding real-world Clojure use in large
> teams. While I clearly understand the pros of common data
> access/manipulation, doesn't the lack of encapsulation prove problematic
> in large projects with many developers? E.g., one developer may add a
> keyword to a map for one purpose, and another, use the same keyword for
> a different purpose. 

give each developer its own namespace for keywords
http://stackoverflow.com/questions/2481984/when-should-clojure-keywords-be-in-namespaces

from then on, it's the same as an evil oo-developer misusing someone
elses field, preferably via reflection so it's difficult to track


With classes, all data manipulation for a single
> type is located in one place, so such clashes can easily be prevented,
> let alone the fact that encapsulation helps delineate legal operations
> with the data.
> I realize there are always tradeoffs, and perhaps the pros outweigh the
> cons, but I would like to know how you deal with such problems, that
> invariably arise in large-team development.
> 
> Thanks.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt
Am 07.11.2011 10:18, schrieb Dennis Haupt:
> 
>>
>>
>> In his code I did notice he doesn't use destructing very much.
>>
> 
> where would that have been useful?

defn x [{:keys [foo bar]} param]

instead of

defn x [param]
(let [foo (:foo param)...])

?

-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt

> 
> 
> In his code I did notice he doesn't use destructing very much.
> 

where would that have been useful?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt

> 
>> The main thing to keep in mind is that when coming from java/scala,
>> you'll have a hard time adjusting to clojure, and you're making it
>> harder by trying something so inherently full of state. I understand
>> the need to tackle problems that we like, but without a good
>> understanding of the language you're going to have a really hard time,
>> and that reflects in your code.
> 

what would you have done differently?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-06 Thread Dennis Haupt
Am 06.11.2011 22:00, schrieb Alex Baranosky:
> The problem with Java is you can write a ton of it easily with Intellij
> (my facorite IDE), but Intellij cant read that code for you, so now you
> have a novel to wade through when the code is revisited.

after some time, your brain will filter the clutter out. all i need is a
big screen. :)

but you're right, reading concise high level code > reading verbose low
level code

> 
> On Nov 6, 2011 11:49 AM, "Dennis Haupt"  <mailto:d.haup...@googlemail.com>> wrote:
> 
> "special cases" that depend on mutable state are evil. i avoid mutable
> states as much as possible, no matter which language i am using.
> what i meant were cases where i roughly think about 3/4 of all cases,
> start coding and along the way i notice that in one case in need
> another input parameter for my function and have to refactor
> everything i have written so far.
> 
> my experience is that you need to balance out planning and actual
> coding. there's a limit for planning. if you plan too much, it won't
> help. you'll just introduce problems and won't notice it because you
> are skipping the reality check. reality never misses a case, but even
> the smartest guy/gal does :)
> 
> what i do in  is to just start somewhere and code
> recursively. as soon as something gets to complex, i split it up or do
> minor refactorings. this works pretty good and i rarely end up in a
> situation where i have to go back a big step. i rarely lose speed,
> even if i encounter a surprise.
> 
> i'll become faster once i get used to clojure, but i doubt i'll be
> able to be as fast as in scala or java. this is not because the
> language itself is bad. java is really verbose, but that doesn't
> matter at all. i don't write java code. i use intellij idea. it writes
> and rewrites java code for me.
> with equal tool support, i'd prefer clojure over java.
> 
> 
> 
> 
> 
> Am 06.11.2011 14:48, schrieb Colin Yates:
>> But aren't the "edge cases" fewer given the notion that functions
>> should be entirely defined by their inputs as oppose to being
>> dependant on mutable state external to he function, in the most
>> part.
> 
>> I am agreeing with you, and find these real world experiences
>> incredibly useful.
> 
>> Sent from my iPad
> 
>> On 6 Nov 2011, at 13:03, Dennis Haupt  <mailto:d.haup...@googlemail.com>>
>> wrote:
> 
>> Am 06.11.2011 13:44, schrieb Colin Yates:
>>>>> I have a hunch (as oppose to IME as I don't have any yet :))
>>>>> that Clojure doesn't require as much due to at least the
>>>>> following points:
>>>>>
>>>>> - there is much less incidental complexity and ceremony
>>>>> required to manage (and therefore refactor) - implementations
>>>>> in Clojure require more thought and are much more focused on
>>>>> one thing then in Java, therefore there is a much higher
>>>>> chance that you get it right the first time
> 
>> this is a double edged sword. you *do* get it right *if* you think
>> it through, but reality is often more complex than you assume. if
>> you suddenly see that you forgot to handle special case x, you are
>> punished harder than in .
> 
>> in oo, you can do a few "emergency hacks" before everything
>> becomes unmaintainable. in clojure, i could not do this without
>> committing maintenance suicide immediately. for each case that
>> popped up surprisingly, i had to do a bit of refactoring.
> 
>> that whole "dynamically typed" thing is creeping me out.
> 
> 
>>>>>
>>>>> To put it another way, how much refactoring we we do in Java
>>>>> is down to managing the complexity of the problems inherent
>>>>> in Java the language; complecting state and identity for
>>>>> example.
>>>>>
>>>>> A concrete example: I know I often refactor code out of one
>>>>> class into a utility once that becomes useful by other
>>>>> classes.  The reason I need to do this is because in java the
>>>>> functionality is ring fenced by the data that it works on
>>>>> (I.e. encapsulation in the container called a class).  In
>>>>> clojure that association can be made but right off the get-go
>>>>> data and functionality are separate.
>>>>>
>>>>> Just my two-pence worth and I still haven't written more than
>>>>> 2 lines of clojure so it probably isn't worth 

Re: problems of a newbie

2011-11-06 Thread Dennis Haupt
Am 06.11.2011 20:56, schrieb Sean Corfield:
> On Sun, Nov 6, 2011 at 11:12 AM, Dennis Haupt  
> wrote:
>> let me guess: you had some classes that were used more than they should
>> have been because they were the best match and introducing a better one
>> would have taken more time - and since they could do so much, they were
>> just used at more and more places and in the end, they became god
>> classes which infested everything?
> 
> I generally refactored them into submission before they reached "god"
> status but they sometimes reached "saint" or "minor deity" status :)
> 
> The other problem I ran into with OO (a lot in the early 90's, less so
> as I got more experienced) was identifying what turned out to be an
> incorrect set of classes and then finding myself "stuck" when
> requirements changed and needing to completely redesign whole sections
> of the application. That's the aspect of static type systems that I
> don't like: if you make choices that seem reasonable but turn out not
> to match a future set of requirements, those types are _everywhere_ -
> woven into the very fabric of your application's structure as well as
> liberally sprinkled throughout any code that touches objects of those
> types. Scala helps with type inference but also expects you to encode
> even more of your application's structure and logic into the type
> system (which makes the "wrong type" decisions even worse when they
> pop up).
> 
> Without a rigid type system, generic functions can operate on any
> compatible data structures without needing a typed wrapper (not even a
> parameterized type wrapper with inference). 

if by compatible you mean "has a specific set of functions and fields",
then scala can do that without sacrificing static type safety:

http://www.artima.com/scalazine/articles/scalas_type_system.html

"Bill Venners: One of the things I have observed about Scala is that
there are a lot more things I can express or say about my program in
Scala's type system compared to Java's. People fleeing Java to a dynamic
language often explain that they were frustrated with the type system
and found they have a better experience if they throw out static types.
Whereas it seems like Scala's answer is to try and make the type system
better, to improve it so it is more useful and more pleasant to use.
What kind of things can I say in Scala's type system that I can't in Java's?

Martin Odersky: One objection leveled against Java's type system is that
it doesn't have what's often called duck typing. Duck typing is
explained as, if it walks like a duck and quacks like a duck, it is a
duck. Translated, if it has the features that I want, then I can just
treat it as if it is the real thing. For instance, I want to get a
resource that is closable. I want to say, "It needs to have a close
method." I don't care whether it's a File or a Channel or anything else.

In Java, for this to work you need a common interface that contains the
method, and everybody needs to implement that interface. First, that
leads to a lot of interfaces and a lot of boilerplate code to implement
all that. And second, it is often impossible to do if you think of this
interface after the fact. If you write the classes first and the classes
exist already, you can't add a new interface later on without breaking
source code unless you control all the clients. So you have all these
restrictions that the types force upon you.

One of the aspects where Scala is more expressive than Java is that it
lets you express these things. In Scala it is possible to have a type
that says: anything with a close method that takes no parameter and
returns Unit (which is similar to void in Java). You can also combine it
with other constraints. You can say: anything inheriting from a
particular class that in addition has these particular methods with
these signatures. Or you can say: anything inheriting from this class
that has an inner class of a particular type. Essentially, you can
characterize types structurally by saying what needs to be in the types
so that you can work with them. "

Yes, there's a trade off
> in that you can pass the "wrong" data but if you're test-driving your
> code (whether you do it in your head, in the REPL or with physical
> tests in code) and building it in small pieces, there's much less risk
> of doing so (IMO & IME).
> 
>> with mutable states, i can "hide" that one additional parameter for the
>> one special case that would otherwise ruin my design by using a secret
>> static threadlocal or whatever else does the job. this is a pact with
>> the devil that will backfire when a certain threshold is reached,

Re: problems of a newbie

2011-11-06 Thread Dennis Haupt
Am 06.11.2011 19:06, schrieb Sean Corfield:
> On Sunday, November 6, 2011, Dennis Haupt  <mailto:d.haup...@googlemail.com>> wrote:
>> this is a double edged sword. you *do* get it right *if* you think it
>> through, but reality is often more complex than you assume. if you
>> suddenly see that you forgot to handle special case x, you are
>> punished harder than in .
> 
> I'll go a little further than Colin and say "IME"...
> 
> As a veteran of C++ and Java with time spent in Groovy, Scala and more
> recently Clojure - and a decade of dynamic scripting languages for the
> web - I've generally found OO languages, especially with strong type
> systems, punish my design missteps much more harshly.

let me guess: you had some classes that were used more than they should
have been because they were the best match and introducing a better one
would have taken more time - and since they could do so much, they were
just used at more and more places and in the end, they became god
classes which infested everything?

> 
>> in oo, you can do a few "emergency hacks" before everything becomes
>> unmaintainable. in clojure, i could not do this without committing
>> maintenance suicide immediately. for each case that popped up
>> surprisingly, i had to do a bit of refactoring.
> 
> I think this might be a combination of the novelty of the pure
> functional approach and your comfort level with OO. You're probably
> prepared to accept a certain amount of hackery in OO that makes you
> immediately uncomfortable in Clojure. 

it does in every functional language.
with mutable states, i can "hide" that one additional parameter for the
one special case that would otherwise ruin my design by using a secret
static threadlocal or whatever else does the job. this is a pact with
the devil that will backfire when a certain threshold is reached, but it
*is* faster than doing a small refactoring every time.
if everything i'm supposed to use are immutable parameters and one
return value, these hacks are out of the question.


I actually think that's a benefit
> of Clojure: it encourages doing it right.

i'm pretty pragmatic here: sometimes doing it wrong now and doing a big
refactoring later is the better way.

> 
>> that whole "dynamically typed" thing is creeping me out.
> 
> I've gone back and forth with type systems over the decades and these
> days I'm firmly in the dynamic camp. Part of my PhD research in the 80's
> was around type inference in dynamic functional languages (partly for
> performance but mostly about correctness since that was my supervisor's
> big thing). Working code was clearly working code, but the inferred
> types were often more generic than anyone working in a statically typed
> language would have picked - which meant more opportunities for reuse
> and more flexibility.
> 
> I can definitely understand your feelings on this topic but I think as
> you stick with it you'll get more comfortable with the thinking vs doing
> approach, and writing truly generic code will mean fewer special cases
> and less refactoring. So don't be discouraged!

can you give an example of truly generic code vs not so generic code?

> 
> Oh, while I've got your attention, could you turn off the PGP signature
> for this mailing list? The UPPERCASE HEADINGS and big blocks of
> signature text make your posts really hard to read, especially when
> you're replying and quoting heavily in a thread. I'm writing this on my
> iPhone where the PGP stuff is particularly unpleasant to work around!

done

> 
> Thanx,
> Sean
> 
> 
> -- 
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
> 
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en


-- 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 06.11.2011 18:11, schrieb Colin Yates:
> I suspect programming in clojure effectively is as much about
> changing the *way* you develop as much as it is about about the
> shape of the solution.  It sounds as if you are suggesting this is
> so.

yes. you are (almost) never going to write the final code. you are
going to write code which you are going to change later, so code
should be written in a way that allows you to do so quickly.

> I am about to start my first clojure project tomorrow which is to 
> replace an existing web app which is a case study in how short
> term wins quickly build up technical and architectural debt.

you *can* have short term wins without adding complexity. you just
can't have it always ;)

 It is also a
> wonderful example of how painful it is to live in a world where
> the code base is so bad that changing it is too dangerous so lets
> add another layer .   Yuck.
> 
> How did you find IntelliJ iDEA for clojure?

very stable, but aside from the project/module setup, it's barely more
than a text editor with symbol highlighting, basic code
completion/auto import and basic function call resolution. compared to
the groovy, scala or even java capabilities of intellij - no contest.

i guess given the dynamic nature of clojure, you'd have to put a LOT
of resources in developing useful code analysis algorithms.

 I have used both it and
> eclipse (STs) for years but am considering emacs (with which I have
> a beginner's competency).  I am intentionally not using spring or 
> hibernate and I expect the project will be fairly small in the
> short term actually so I think emacs might be  achievable  (I
> am also switching from spring MVC and jquery to conjure and yui3 -
> this is all about using the right technology from the start and I
> love vert iCal learning curves :)
> 
> To explain why this madness might actually be a great idea - the 
> existing app will be deployed with some additional json services
> so the new app will initially just be a very thin skin that uses
> those json services in the short term.  Later on the functionality
> will be rewritten in the new app.
> 
> Exciting times!
> 
> Sent from my iPad
> 
> On 6 Nov 2011, at 16:49, Dennis Haupt 
> wrote:
> 
> "special cases" that depend on mutable state are evil. i avoid
> mutable states as much as possible, no matter which language i am
> using. what i meant were cases where i roughly think about 3/4 of
> all cases, start coding and along the way i notice that in one case
> in need another input parameter for my function and have to
> refacto everything i have written so far.
> 
> my experience is that you need to balance out planning and actual 
> coding. there's a limit for planning. if you plan too much, it
> won't help. you'll just introduce problems and won't notice it
> because you are skipping the reality check. reality never misses a
> case, but even the smartest guy/gal does :)
> 
> what i do in  is to just start somewhere and
> code recursively. as soon as something gets to complex, i split it
> up or do minor refactorings. this works pretty good and i rarely
> end up in a situation where i have to go back a big step. i rarely
> lose speed, even if i encounter a surprise.
> 
> i'll become faster once i get used to clojure, but i doubt i'll be 
> able to be as fast as in scala or java. this is not because the 
> language itself is bad. java is really verbose, but that doesn't 
> matter at all. i don't write java code. i use intellij idea. it
> writes and rewrites java code for me. with equal tool support, i'd
> prefer clojure over java.
> 
> 
> 
> 
> 
> Am 06.11.2011 14:48, schrieb Colin Yates:
>>>> But aren't the "edge cases" fewer given the notion that
>>>> functions should be entirely defined by their inputs as
>>>> oppose to being dependant on mutable state external to he
>>>> function, in the most part.
>>>> 
>>>> I am agreeing with you, and find these real world
>>>> experiences incredibly useful.
>>>> 
>>>> Sent from my iPad
>>>> 
>>>> On 6 Nov 2011, at 13:03, Dennis Haupt
>>>>  wrote:
>>>> 
>>>> Am 06.11.2011 13:44, schrieb Colin Yates:
>>>>>>> I have a hunch (as oppose to IME as I don't have any
>>>>>>> yet :)) that Clojure doesn't require as much due to at
>>>>>>> least the following points:
>>>>>>> 
>>>>>>> - there is much less incidental complexity and
>>>>>>> cere

Re: problems of a newbie

2011-11-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

"special cases" that depend on mutable state are evil. i avoid mutable
states as much as possible, no matter which language i am using.
what i meant were cases where i roughly think about 3/4 of all cases,
start coding and along the way i notice that in one case in need
another input parameter for my function and have to refactor
everything i have written so far.

my experience is that you need to balance out planning and actual
coding. there's a limit for planning. if you plan too much, it won't
help. you'll just introduce problems and won't notice it because you
are skipping the reality check. reality never misses a case, but even
the smartest guy/gal does :)

what i do in  is to just start somewhere and code
recursively. as soon as something gets to complex, i split it up or do
minor refactorings. this works pretty good and i rarely end up in a
situation where i have to go back a big step. i rarely lose speed,
even if i encounter a surprise.

i'll become faster once i get used to clojure, but i doubt i'll be
able to be as fast as in scala or java. this is not because the
language itself is bad. java is really verbose, but that doesn't
matter at all. i don't write java code. i use intellij idea. it writes
and rewrites java code for me.
with equal tool support, i'd prefer clojure over java.





Am 06.11.2011 14:48, schrieb Colin Yates:
> But aren't the "edge cases" fewer given the notion that functions 
> should be entirely defined by their inputs as oppose to being 
> dependant on mutable state external to he function, in the most
> part.
> 
> I am agreeing with you, and find these real world experiences
> incredibly useful.
> 
> Sent from my iPad
> 
> On 6 Nov 2011, at 13:03, Dennis Haupt 
> wrote:
> 
> Am 06.11.2011 13:44, schrieb Colin Yates:
>>>> I have a hunch (as oppose to IME as I don't have any yet :))
>>>> that Clojure doesn't require as much due to at least the
>>>> following points:
>>>> 
>>>> - there is much less incidental complexity and ceremony
>>>> required to manage (and therefore refactor) - implementations
>>>> in Clojure require more thought and are much more focused on
>>>> one thing then in Java, therefore there is a much higher
>>>> chance that you get it right the first time
> 
> this is a double edged sword. you *do* get it right *if* you think
> it through, but reality is often more complex than you assume. if
> you suddenly see that you forgot to handle special case x, you are 
> punished harder than in .
> 
> in oo, you can do a few "emergency hacks" before everything
> becomes unmaintainable. in clojure, i could not do this without
> committing maintenance suicide immediately. for each case that
> popped up surprisingly, i had to do a bit of refactoring.
> 
> that whole "dynamically typed" thing is creeping me out.
> 
> 
>>>> 
>>>> To put it another way, how much refactoring we we do in Java
>>>> is down to managing the complexity of the problems inherent
>>>> in Java the language; complecting state and identity for
>>>> example.
>>>> 
>>>> A concrete example: I know I often refactor code out of one
>>>> class into a utility once that becomes useful by other
>>>> classes.  The reason I need to do this is because in java the
>>>> functionality is ring fenced by the data that it works on
>>>> (I.e. encapsulation in the container called a class).  In
>>>> clojure that association can be made but right off the get-go
>>>> data and functionality are separate.
>>>> 
>>>> Just my two-pence worth and I still haven't written more than
>>>> 2 lines of clojure so it probably isn't worth 2p :)
>>>> 
>>>> Sent from my iPad
>>>> 
>>>> On 5 Nov 2011, at 12:16, Dennis Haupt
>>>>  wrote:
>>>> 
>>>> hi,
>>>> 
>>>> i'm half done with my asteroids clone. i stumbled over a few 
>>>> problems and wanted to know how others already solved them
>>>> :)
>>>> 
>>>> i am used to "less concrete programming". i ask my tools to
>>>> do the actual analysis and coding for me: * where is that
>>>> used? * rename that * show me all errors * add a parameter
>>>> here * autocomplete this for me, i am too lazy to even
>>>> remember the exact method name * show me a list of all
>>>> methods and fields starting with an "e" that fit in here. i
&

Re: problems of a newbie

2011-11-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 06.11.2011 13:44, schrieb Colin Yates:
> I have a hunch (as oppose to IME as I don't have any yet :)) that 
> Clojure doesn't require as much due to at least the following
> points:
> 
> - there is much less incidental complexity and ceremony required
> to manage (and therefore refactor) - implementations in Clojure
> require more thought and are much more focused on one thing then in
> Java, therefore there is a much higher chance that you get it right
> the first time

this is a double edged sword. you *do* get it right *if* you think it
through, but reality is often more complex than you assume. if you
suddenly see that you forgot to handle special case x, you are
punished harder than in .

in oo, you can do a few "emergency hacks" before everything becomes
unmaintainable. in clojure, i could not do this without committing
maintenance suicide immediately. for each case that popped up
surprisingly, i had to do a bit of refactoring.

that whole "dynamically typed" thing is creeping me out.


> 
> To put it another way, how much refactoring we we do in Java is
> down to managing the complexity of the problems inherent in Java
> the language; complecting state and identity for example.
> 
> A concrete example: I know I often refactor code out of one class
> into a utility once that becomes useful by other classes.  The
> reason I need to do this is because in java the functionality is
> ring fenced by the data that it works on (I.e. encapsulation in the
> container called a class).  In clojure that association can be made
> but right off the get-go data and functionality are separate.
> 
> Just my two-pence worth and I still haven't written more than 2
> lines of clojure so it probably isn't worth 2p :)
> 
> Sent from my iPad
> 
> On 5 Nov 2011, at 12:16, Dennis Haupt 
> wrote:
> 
> hi,
> 
> i'm half done with my asteroids clone. i stumbled over a few
> problems and wanted to know how others already solved them :)
> 
> i am used to "less concrete programming". i ask my tools to do the 
> actual analysis and coding for me: * where is that used? * rename
> that * show me all errors * add a parameter here * autocomplete
> this for me, i am too lazy to even remember the exact method name *
> show me a list of all methods and fields starting with an "e" that 
> fit in here. i know the one i want is in that list.
> 
> as elegant as clojure may be as a language, it's dragging me down
> to almost native text editing which i did more than 10 years ago
> when i wrote a game in turbo pascal.
> 
> how did you solve these problem and get some tool-support? or
> don't you miss it because of something i am not aware of?
> 
> 
> 
>> 
>> -- 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
> 


- -- 

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOtoWuAAoJENRtux+h35aG/3gQAJEyUDT4/qMyTdgHURekwgga
+x0x75y3hcgutZ8ij2m4B+UGfg6Yg7cjXIuwyqtbvXFVyN02/C28MSWGj2xPMP0j
UI36zTiNzVikfafP4sxP0CLNQOBjIvH+MJ/xbFWe7p49l4hb9IWdYTJ237v1ik9h
YL5qulyqC1CrrJfqOr7eskErcQkyS9gLjdn+frByaq5N4dEGoh36sZfhgF6rSGqg
ZlMLUCxBsasTooktHOSGURbhorHuSHlheyfNX/z9dp/qBEBhMgRmLDnfsxMmAcFb
W5bbYKmqeIEfm+IHTRz0UUk1SbHoZVaDYY81qGI0rQgTpFFV1yRtC5TdQ2/lanGU
4Aklxb4CqEt8mek5GBrwp7526ebVxF48hWQ5elP6ycUcI4LyBtQhIqT2Zqq8G7MG
hOdZSNQ7IXYq+mjLx1yGQrKQkZTlmWb+j3KbC2anz73qAw7jz1hmhBLjyFlhSWcG
LAJIuPT+WY+xJKMfl15l1XCO4xc8osd1FUBcfWEvPZvxqiH1RA/5YxL1W/Qou/NL
AJSxixJCQcONZd9ynppzJKSVyrcjzE0FUPMutynitmVFgtuSKz4eb+8U3SaX8HEm
GJOV8/e9ETms75TbSfGSjRPLXGaMTwswpWzpnA+B3wOHF6qGPxDFGr7uIxZa/ky+
I3QAs0vzTFfhyjZP4SDg
=opYc
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: problems of a newbie

2011-11-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 06.11.2011 11:33, schrieb Razvan Rotaru:
> I remember having the same frustrations some time ago. Not that
> they are gone now. :) It obviously depends on the tool, and these
> code analysis you describe you get only in IDEs. I don't know what
> tool you are using now, but you have them all described in the
> Getting Started page (http:// 
> dev.clojure.org/display/doc/Getting+Started).
> 
> My experience is only with vim + slimv
> (http://www.vim.org/scripts/ script.php?script_id=2531) +
> swank-clojure (https://github.com/ technomancy/swank-clojure), and
> I can tell you it's far from what you are looking for. Emacs +
> slime + swank-clojure is probably better, but not by much. I would
> recommend Intellij + La Clojure (without actually having tried  it
> myself), and that's because of the emphasis of Intellij on these
> analysis tools. La Clojure seems to be supported by JetBrains, and
> that gives it a big potential.

i'm already using it. it does offer code completion for imported java
classes and public functions of used namespaces which is better than
nothing. i can also misuse(?) its code highlighting features to spot
unresolvable function calls, and it offers basic "find
usage"-searches. but it's far from what i'm used to.

java is a lot more verbose, but with the current level of tool
support, i'm slower using clojure as soon as i have to change existing
code :/

> 
> However it seems that in the lisp world, code analysis tools are
> that wanted. We have Common Lisp for quite some time now, and
> people seem quite happy with slime.
> 
> Razvan
> 
> On Nov 5, 2:16 pm, Dennis Haupt  wrote: 
> hi,
> 
> i'm half done with my asteroids clone. i stumbled over a few
> problems and wanted to know how others already solved them :)
> 
> i am used to "less concrete programming". i ask my tools to do the 
> actual analysis and coding for me: * where is that used? * rename
> that * show me all errors * add a parameter here * autocomplete
> this for me, i am too lazy to even remember the exact method name *
> show me a list of all methods and fields starting with an "e" that 
> fit in here. i know the one i want is in that list.
> 
> as elegant as clojure may be as a language, it's dragging me down
> to almost native text editing which i did more than 10 years ago
> when i wrote a game in turbo pascal.
> 
> how did you solve these problem and get some tool-support? or
> don't you miss it because of something i am not aware of?
> 
> 
- -- 

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOtmf2AAoJENRtux+h35aG/jMQALdbpiYxm7K68JrXKXp2oX/s
oAmmA/cakavJiosBOt21dFwPbxzPBjCO5KyVpYt05y2k76AmOwu3ZeMTsklS889P
zJdFiVU+Sp/dUa3lXBBdpz0DQkyCsXE4z77fXMUET1z2B7Uz8WvaDC/BMqPfBC2p
SHFnQOo+mmFCeZuyFzyQg6Rj0PzIpcNyS01WOG0yO1JIhMtz7LjxuMq61MOqHree
5GA+Iq9SESfbZGJr9T9XI/8fSLPI6NCJvjxVrysOrA4H63LfEC/BFkEJyD4HUETP
AaJOwqKbDFtHt34E9xoQLzBdHXaJSTz4NivPCkwOhfTjloLA1RckrfvEov25vg4N
CCMYRyc99/VUPkVeZYWh4M64H17B0hrH0XEvMqkkePnlJlkBFzjty/6OUARdRG4D
jIHJGHu9aZr7CDQUE9Pr38ZpH2JY6I1G1D6nGg0bs2v/DjAgzKyxIG7M4Ey7g5vQ
MB0ioRCQWXwLq0FVioytQ8DSZIG2N6bjWVrTI+tP7myJV7ql+aVcxqdFUFGW1RWG
/I3B5cJflZsKs/86RGOfwgbgCUGbCH8rksRUh1kPrB90aoPUGgl/GIvLXQXVs4at
plNRmW104ShFYsM8wnSuWM2clwxf9ILvmbwTiHZtllxBJjH8dwS5fpxOg3lAapqL
3VGCZ3arYNGP3xMEx1Zz
=vORH
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: anyone interested in a small game?

2011-11-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 30.10.2011 19:32, schrieb Dennis Haupt:
> hi community,
> 
> i decided to create a (small) game in clojure to get a bit of 
> non-theoretical experience. i'm pretty much a clojure noob (only
> did a few experiments) but have done a few real things in scala -
> which is totally awesome btw - so i do have some functional
> programming experience.
> 
> if there's someone here who would like to join, just do so by 
> answering "yes" or something like that.
> 
> i was thinking about a game like asteroids, tower defense or that
> old game with lots of aliens on the top and two players at the
> bottom, shooting upwards.
> 
> 
> 

in case anyone is still interested, i committed a running prototype to
github: https://github.com/HamsterofDeath/Clojureoids

i went all the way and used Java's
so-complex-that-not-even-public-area operations for cutting off parts
of randomly generated asteroids instead of just replacing big ones by
smaller ones. the broken off parts are not yet flying around, but you
see where i am going with this.



-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOtl0aAAoJENRtux+h35aGt24QAK9rWtaAW1eTTxyszCiAHGbv
EisjQy7qz+De4BjYwovC8DKYA3knBfcFPxoe95UrF1sDiKEtVCYOxN85v4DKiRpb
FqmxD6YlkCW7sarjUuSzbCKz8wZ4yEdOT2p8SZt5T71rXhYXFOrCaBDQemNUHBrA
fLSwUGPmtvAJxhiAQsB0AeG0ZG6goptwXlO3At/87fgKhn3u1R6+OYBkNS78PG/u
Q0N7OccME3Dl7GtTi0zPRnx3QdrO+Sh7JbTP3b/gICmtRSnfS3s5yuubOdIBHZCQ
LmCnuDp2VEUw6Y1z9OoeJk52FFDvau9sq46n/5yWMMrsBn7W43CpRuHP0YAB3OIj
k+p8qjVfo5wLDV+PSLKDje4mbHMt3iaE/fK9ah5J+KfNRhHFyxhP+c4njZrWVBfw
ZHvX7g9vooBQsW+e8ock3XFIqa6YIElgpG8rxctBVWKmPVjbGBIp9pblKWoVXh+q
dOqjI/JqK4oSMZgsdrEB47Sa06N9yf0JYkOSBvPQilGFldUI4YFn4VTKPfjbwE22
whLDR8wTtn5MBBZhoRVH7tjdPVX8UtHIRKvf+D1AOvtjnoJc8R2csZ0SeoLr+RT+
MHREkcYJyJedT4r+J00QAPPkW2S/JNmtrlsq6N8o+6JsMYw0m66hmdDZ8ezOtZsl
jOOOE1Jnt/VZNj6amCUy
=DGsg
-END PGP SIGNATURE-

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


problems of a newbie

2011-11-05 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

hi,

i'm half done with my asteroids clone. i stumbled over a few problems
and wanted to know how others already solved them :)

i am used to "less concrete programming". i ask my tools to do the
actual analysis and coding for me:
* where is that used?
* rename that
* show me all errors
* add a parameter here
* autocomplete this for me, i am too lazy to even remember the exact
method name
* show me a list of all methods and fields starting with an "e" that
fit in here. i know the one i want is in that list.

as elegant as clojure may be as a language, it's dragging me down to
almost native text editing which i did more than 10 years ago when i
wrote a game in turbo pascal.

how did you solve these problem and get some tool-support? or don't
you miss it because of something i am not aware of?



-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOtSkdAAoJENRtux+h35aGeeQP+gJbQdNSZEdEIgjVFC/VZvRe
z1Rh9Z8xVwxbuyl/kx1GMLU3jZxJKkhp0OIp7RLbDgjwFFzwBnQ0CZSeuHd9bFD/
S5Vmf6tXB4AdC3u3a7wZilEQuSuq+ARtJhMKdGIQfoXgqDYA7JwOvV8ZkpiR2T2d
pKqswheRVstBqo9/xyinfuLsJMujDlF9NshoIC0n1b/L4tzddq/kgzIATcg/NJ4N
I0Qd1lqGC1THU2nHtiaSR66KQE5Ciq22FN0nVoT3jW9EU/kJ9tao7L6SUTY3tcaA
th8mxKLYId/NrbRmsYUTyWe6O30HAUTLLFEnImYTW2fUMdwRYeAoZGc7t5V3yJ/p
dU4JN0dGA/ADbdTItykaao1DtGI2/kGe6p9VaKk3IPCVAOio9UwgOCUQylTKqy7M
CWbrDcSFCQs5pTY1Sw5We9LV2VOBoTsai6vH/qE7t98mJLVf0wHvLLIBOkf/QO5a
HuSyCJRpOrWQF2jbooDqAbaJAa6huxLQjMeO9Ri4sDx2gDRYsf9Fmdjp4TFWWjdZ
O5HEzhUR165peQHo4RQLLf8dnlkibsdbx60n+VJ0E4iE7ID+hBOFC76bAllnAS1K
Q8HqXUogMi/ZLXIAB4BA83q71IEDVcytuYAn9Ku2FQLrmWCiOD57uMhSLjtzK/8J
TIuaLwipARdzsqi/piwl
=MnRq
-END PGP SIGNATURE-

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


<    1   2   3   >