Re: Simple Made Easy - Any Examples?

2011-10-31 Thread jmis
If you want to improve then you will need to invest time understanding
core development concepts.  You don't want to accidentally do the
right thing because your language pushes you in that direction.
 Instead, you want to purposefully do the right thing by having a good
understanding of the fundamentals (e.g. scope, state, composition,
etc.).  You want to arrive, by yourself, to many of the same
conclusions as Rich.
Testing was my route to understanding development at a deeper level.
 Growing Object Oriented Software Guided by Tests is, in my opinion,
one of the best software development books out there.  The authors,
Steve Freeman and Nat Pryce, will show you how to decompose, simplify,
and analyze your code by probing it with tests.  They cover a wealth
of topics including composition, context independence, values, design,
unit testing, acceptance testing, and more.  They also provide an
extensive working example to give you insight into their thought
processes, practices, and to show you how to apply the concepts.  This
book is a great starting point for developers looking to get to the
next level.
In the end, you're just going to have to get your hands dirty and
tackle these ideas head on.  Check out that book, practice, push
yourself, ask yourself a lot of questions, try things, learn from
mistakes, don't be satisified or complacent, and, after awhile, you'll
find that you can give talks like Rich. =P

-- 
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: Homoiconicity in clojure (macro power)

2011-10-31 Thread Baishampayan Ghose
> I am from java Background. We say Homoiconicity in Clojure (Lisp).
> Code is data and data is code. I read various blogs on it, still not
> clear, Can you give me some example?

Using macros it's possible to add "new syntax" to the language which
is extremely hard (if possible at all) to achieve in non-homoiconic
languages.

As an exercise, try writing the `or' function in Java and then take a
look at the Clojure implementation -
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L789

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


Re: A Taste of cKanren (via a coding challenge)

2011-10-31 Thread David Nolen
A blog post explaining the solution step by step
http://dosync.posterous.com/another-taste-of-ckanren.

On Mon, Oct 31, 2011 at 9:36 PM, David Nolen  wrote:

> Here's a correct version that solves the puzzle in ~12ms,
> https://gist.github.com/1329580. A bit longer but it fun to combine
> constraints w/ search.
>
> Will try to find some time to write a more detailed explanation.
>
> On Sun, Oct 30, 2011 at 9:00 PM, David Nolen wrote:
>
>> Heh, as someone pointed out this doesn't actually solve the puzzle since
>> I'm not considering putting stones on either side of the scale. Still I
>> think the idea of what cKanren can do is communicated :)
>>
>>
>> On Sun, Oct 30, 2011 at 8:34 PM, Brent Millare 
>> wrote:
>>
>>> Looks really cool. Can't wait to see the talk.
>>>
>>> --
>>> 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.2.1 released.

2011-10-31 Thread sunng
A snapshot of lein-control 0.2.1 (which ships clojure-control 0.2.1) has 
been pushed to clojars.
You can use these new features of clojure-control with your control file.

Add lein-control to your dev-dependencies like:

:dev-dependencies [[lein-control "0.2.1-SNAPSHOT"]]

For more information, please check the README:
https://github.com/sunng87/lein-control



-- 
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 Taste of cKanren (via a coding challenge)

2011-10-31 Thread David Nolen
Here's a correct version that solves the puzzle in ~12ms,
https://gist.github.com/1329580. A bit longer but it fun to combine
constraints w/ search.

Will try to find some time to write a more detailed explanation.

On Sun, Oct 30, 2011 at 9:00 PM, David Nolen  wrote:

> Heh, as someone pointed out this doesn't actually solve the puzzle since
> I'm not considering putting stones on either side of the scale. Still I
> think the idea of what cKanren can do is communicated :)
>
>
> On Sun, Oct 30, 2011 at 8:34 PM, Brent Millare wrote:
>
>> Looks really cool. Can't wait to see the talk.
>>
>> --
>> 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: Homoiconicity in clojure (macro power)

2011-10-31 Thread daly
While Peter Norvig was discussing Python with John McCarthy
(inventor of lisp) in the audience:

John simply asked if Python could gracefully manipulate
Python code as data.

"No, John, it can't" was Peter's reply.

Create a list and call read on it.
Create a function, manipulate it as a list to modify it,
walk it, print it, and treat it as a list in general.

In particular, a macro is a list that operates on a
list to produce a list that gets used as a list, possibly
to define a data structure, or a function, or another
macro or whatever else you might want.

Lisp code is data. Lisp data is code.
This is not true in most other languages.

Tim Daly

On Mon, 2011-10-31 at 02:40 -0700, vikbehal wrote:
> I am from java Background. We say Homoiconicity in Clojure (Lisp).
> Code is data and data is code. I read various blogs on it, still not
> clear, Can you give me some example?
> 


-- 
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: Please try the alphas and betas!

2011-10-31 Thread Phil Hagelberg
On Mon, Oct 31, 2011 at 4:57 PM, JMatt  wrote:
> Everyone that I know who writes clojure professionally or on a daily basis
> uses lein to start. The simplest way to expose far more people to alphas and
> betas is to add the sonatype repo to the default-repos function in lein:
> https://github.com/technomancy/leiningen/blob/1.x/src/leiningen/core.clj#L128
> Is there a reason that lein shouldn't / doesn't support the new repos?

Adding snapshot repositories to the default repo list incurs an
additional cost for checking every single snapshot dependency you add.
I would rather have folks call out explicit usage of snapshots.
Leiningen 2.0 will probably even remove Clojars snapshots by default.

-Phil

-- 
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: Lazy behavior

2011-10-31 Thread nchurch
The problem you're having doesn't have anything to do with file
reads.  Every time you call (take 5 data), you're calling it on the
same item 'data'; your variable 'data' doesn't change between each
call.  The chief thing you have to understand about Clojure is that
variables never change.  Never.  If you want 'change' you need to use
refs, atoms, etc.

So for instance if you wrote

(let [x (iterate inc 1)]
   [(take 5 x) (take 5 x)])

you'd get

[(1 2 3 4 5) (1 2 3 4 5)]

You need to make the next call on the \rest of the sequence, which you
can get by calling (drop n data).  Then your processing function could
be something like

(loop [x data]
  (your-processing-function-here (take 5 x))
  (recur (drop 5 x)))

That will walk right through the sequence or the file or whatever you
have (if it's infinite, make sure to write a terminating condition,
e.g.:

(loop [x (iterate inc 1)]
  (print (take 5 x))
  (if (> (first x) 50) nil
(recur (drop 5 x
)



On Oct 31, 2:53 pm, Nicolas  wrote:
> Hi everybody!
>
> I'am experimenting with clojure and as an exercice I use the facebook
> puzzles (http://www.facebook.com/careers/puzzles.php?puzzle_id=20)
> Most puzzles require to read from a text file "efficiently". So I try
> to not read the full file at a time, but process it lazily.
>
> For that I made a very small helper library that try to benefit of
> lazy sequences:
>
> ;Pattern instances are immutables and thread safe
> (def split-pattern (java.util.regex.Pattern/compile "\\s"))
>
> (defn split-words [string]
>   "Split the provided string into words. Separators are space and
> tabs"
>   (if (nil? string)
>     nil
>     (vec (remove #(.equals % "") (.split split-pattern string)
>
> (defn read-text-file [file-name]
>    "Read a text file, line per line, lazily returning nil when end of
> file has been reached. Each line is a vector of words"
>    (let [reader (java.io.BufferedReader. (java.io.FileReader. file-
> name))]
>      (map split-words (repeatedly #(.readLine reader)
>
> (defn next-line [lines]
>   (first (take 1 lines)))
>
> So basically, a file is a lazy sequence of lines, and each line is a
> vector of words.
>
> Lazy behavior seems to be working at first, it I write:
>
>  (let [data (read-text-file "liars.txt")]
>   (take 5 data))
>
> -> (["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"])
>
> It correctly return the 5 first lines of my file. Perfect that's
> exactly what I want.
>
> But when really using it, it doesn't work. If I call several time the
> take function, it always return the first lines instead of providing
> the next ones:
>
> (let [data (read-text-file "liars.txt")]
>   [(take 5 data) (take 5 data)])
> =>[(["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"])
> (["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"])]
>
> If I call take 10 directly, it works as expected:
>
> (let [data (read-text-file "liars.txt")]
>   (take 10 data))
> =>(["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"]
> ["Isaac" "1"] ["Tommaso"] ["Galileo" "1"] ["Tommaso"] ["George" "2"])
>
> You would say, why not just take all data from the stream and then
> process it?
>
> Well the file has a specific format, first line contain some data,
> then few next line contain another data and so on. So I want to have a
> function that will read only a subpart of the file for example,
> another function another part and call them sequentially. But as shown
> in the simple previous example it simply doesn't work.
>
> My understanding is that some immutable thing is in the middle and it
> act like the data reference isn't changed between calls. That not what
> I want obviously as I'am getting data from a java stream, that is not
> supposed to be immutable.
>
> And how can I manage correctly this kind of cases? Efficiantly and
> idiomatically.
>
> Thanks in advance,
>
> Nicolas.

-- 
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: Nested Syntax Quote, Quote and unquote example

2011-10-31 Thread Aquahappy
Those are great links Linus, thank you.

Also highly relevant and beginner friendly is the text adventure game
chapter from the, "Land of Lisp" book, of
which a free clojure translation is available online:

http://www.lisperati.com/clojure-spels/casting.html

Cheers,
Joshua

On Oct 31, 6:01 pm, Linus Ericsson 
wrote:
> "No one can be told what the matrix is."
>
> Well, the best way to understand the macros is to try it out yourself. John
> Lawrence Aspden published some really helpful tutorials om macros, and a
> kata - try it! Links in the end.
>
> There are some other code examples around, also look in the source-code of
> clojure core and various clojure contrib libraries for a lot of examples,
> some of which you have to contemplate and come back to later. They have
> some macros in the code. Also beware that you most often don't want to use
> macros in the first place, since you can solve most problems with the
> incredible powerful functions as well.
>
> Last but not least I would recommend getting some good books on Clojure, I
> started with "Programming Clojure" of Stuart Halloway and it was really
> helpful for me.
>
> Most problems can be expressed as a sequences of key-value-maps to which
> you apply map and reduce (or nowadays protocols for more speed). Be
> prepared to spend some time getting your head around the transition to
> functional, lazy, immutable code with macro-programming, it will be worth
> it. You will still have good use of you java-knowledge, but will probably
> structure your programs differently.
>
> I also had great help of the beginning of Paul Grahams Practical Common
> Lisp avail free at:http://pragprog.com/book/shcloj/programming-clojure
>
> Macro 
> kata:http://www.learningclojure.com/2010/11/syntax-quote-kata-for-confused...
> Macro 
> tutorial:http://www.learningclojure.com/2010/09/clojure-macro-tutorial-part-i-...
> Clojure source code repositories:https://github.com/clojure/
> Programming Clojure:http://pragprog.com/book/shcloj/programming-clojure
>
> /Linus
>
> 2011/10/31 vikbehal 
>
>
>
>
>
>
>
> > Can anyone give me some basic example which contained nested quotes
> > and unquotes? with explanation at each step!
>
> > --
> > 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: Nested Syntax Quote, Quote and unquote example

2011-10-31 Thread Linus Ericsson
"No one can be told what the matrix is."

Well, the best way to understand the macros is to try it out yourself. John
Lawrence Aspden published some really helpful tutorials om macros, and a
kata - try it! Links in the end.

There are some other code examples around, also look in the source-code of
clojure core and various clojure contrib libraries for a lot of examples,
some of which you have to contemplate and come back to later. They have
some macros in the code. Also beware that you most often don't want to use
macros in the first place, since you can solve most problems with the
incredible powerful functions as well.

Last but not least I would recommend getting some good books on Clojure, I
started with "Programming Clojure" of Stuart Halloway and it was really
helpful for me.

Most problems can be expressed as a sequences of key-value-maps to which
you apply map and reduce (or nowadays protocols for more speed). Be
prepared to spend some time getting your head around the transition to
functional, lazy, immutable code with macro-programming, it will be worth
it. You will still have good use of you java-knowledge, but will probably
structure your programs differently.

I also had great help of the beginning of Paul Grahams Practical Common
Lisp avail free at: http://pragprog.com/book/shcloj/programming-clojure

Macro kata:
http://www.learningclojure.com/2010/11/syntax-quote-kata-for-confused.html
Macro tutorial:
http://www.learningclojure.com/2010/09/clojure-macro-tutorial-part-i-getting.html
Clojure source code repositories: https://github.com/clojure/
Programming Clojure: http://pragprog.com/book/shcloj/programming-clojure

/Linus


2011/10/31 vikbehal 

> Can anyone give me some basic example which contained nested quotes
> and unquotes? with explanation at each step!
>
> --
> 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: Please try the alphas and betas!

2011-10-31 Thread Colin Yates
I expect this discussion isn't what Rich had in mind so let's draw it
to a close.  If any one else thinks there is merit in a vehicle that
provides the clojure team with access to many real life examples of
how clojure is being used in the wild and equally providing those
submitters with early feedback on any broken changes then drop me an
email/start another thread.  I assume Kevin, that you won't be
hammering on my door to lead this idea?  To be honest I won't be doing
anything about it either, it was just an idea.

Let's agree to disagree and allow this one to die gracefully :)

Sent from my iPad (one of many Internet connected devices which allow
me to be ridiculed :))

On 31 Oct 2011, at 23:45, Kevin Downey  wrote:

> On Mon, Oct 31, 2011 at 2:57 PM, Colin Yates  wrote:
>> Don't want to feed the trolls but can you justify "ridiculous"?
>> Rather a strong term.or maybe your definition is "I don't
>> understand the value".
>
> The value of having people piece together ad-hoc test suites vs.
> adding tests to Clojure (and the Clojure build) is in some sense the
> same.
>
> The tests will flush out undesired behavior regardless.
>
> In another sense the value of having your own test suite is higher
> because you have it test what you care about and don't have to jump
> through hoops to get it into Clojure's suite.
>
> In yet another sense the value of having tests in Clojure's test suite
> is higher because some failures will be detected early (and fixing it
> early is some how less expensive).
>
> The idea is not ridiculous. The circumstances that would drive to it's
> implementation would be.
>
> It would make Clojure, to my knowledge, the only open source project
> were contribution of test cases is so difficult the community more or
> less forks the tests suite from the controlling body and runs it
> themselves.
>
> Your email starts off "Whacky idea… ", so maybe I should have said
> "which is whack."
>
> My guess is rich wrote this in response (at least in some part) to
> nathan's recent thread about the change to box ints as Longs in
> Clojure 1.3.
>
> This change would cause tests written to detect the boxed type of
> numbers to fail, but so what? The change is deliberate and planned so
> of course tests will fail, the tests just no longer reflect what you
> want.
>
> My understanding is what rich wants is use cases to guide changes in
> the semantics of the language.
>
> e.g. "I used to do X in clojure version N, but in the latest snapshot
> with change C, X isn't as easy to do, is there some C' that would make
> this better?"
>
> e.g. "I used to stick ints into collections and turn around and use
> them for interop in clojure version 1.2, but in 1.3 with changes to
> how clojure boxes numbers, interop isn't as easy to do, is there some
> other change we could use to enforce clojure's semantics in
> collections that would make this better?"
>
>
>> Maybe you are right, maybe we should provide an easy way to submit
>> test cases which are automatically run as part of a CI buildno
>> wait, that was my ridiculous suggestion.
>>
>> Please ask yourself how your response added anything at all to this
>> thread or community other than making it just a little harder for
>> people to suggest things for fear of being ridiculed without any form
>> of justification.  A much better response would have been "I don't get
>> it, please explain".  Based on your ability to read Rich's thoughts
>> maybe you have already had that conversation with me telepathically.
>> Dunno.
>
> Keeping up with the state of play is hardly mind reading, and I don't
> think it is too much to ask of people who want to participate in
> discussions.
>
> I will not pretend to know rich's mind (I still don't understand why
> Clojure can't take pull requests) but absent clarification by rich and
> given the "whacky" idea of yours, the "use case" interpretation is the
> only thing that makes sense.
>
>>
>> My (I.e. this) response hasn't added anything except to flag up a very
>> unhelpful and negative comment (and been just a little therapeutic)
>>
>> Sent from my iPad
>
> If you cannot deal with having an idea you profess to be "whacky"
> called "ridiculous" by someone on the internet, you might need fewer
> internet connected devices.
>
>>
>> On 31 Oct 2011, at 21:42, Kevin Downey  wrote:
>>
>>> the responses to rich here sort of read like "lets make an ad-hoc test
>>> suite for clojure and everyone can run it" which is ridiculous.
>>>
>>> tests should be contributed back to clojure.
>>>
>>> if contributing tests is so difficult people instead create their own
>>> test suites and report results then we need to stream line the
>>> contribution process.
>>>
>>> I cannot imagine this the kind of response rich was looking for, maybe
>>> he will clarify.
>>>
>>> On Mon, Oct 31, 2011 at 2:08 PM, Stuart Sierra
>>>  wrote:
 Yes, the Sonatype repositories have every Clojure development snapshot 
 since
 1.3.

 -Stuart Sie

Re: Please try the alphas and betas!

2011-10-31 Thread JMatt
It can still be difficult to find the right repo and documentation for 
alpha and betas. Especially for the new contrib. It really doesn't have 
anything to do with the Core team or the actual documentation (when it's 
finally found). To me the problem is sifting through the countless highly 
ranked old and/or bad information.

On Monday, October 31, 2011 1:25:30 PM UTC-7, Sean Corfield wrote:
>
>  :repositories [["sonatype-snapshots"
> "https://oss.sonatype.org/content/repositories/snapshots/";]]
>   :dependencies [[org.clojure/clojure "1.4.0-master-SNAPSHOT"] ...]
>
Everyone that I know who writes clojure professionally or on a daily basis 
uses lein to start. The simplest way to expose far more people to alphas 
and betas is to add the sonatype repo to the default-repos function in lein:

https://github.com/technomancy/leiningen/blob/1.x/src/leiningen/core.clj#L128

Is there a reason that lein shouldn't / doesn't support the new repos?

Rich and Core team, thanks for pointing out the importance of using alphas 
and betas. Sometimes it's not clear what we can do to help with the 
project. Posts like this that are actionable definitely provide guidance 
and transparency as to how all of us can give back.


JMatt

-- 
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: Please try the alphas and betas!

2011-10-31 Thread Kevin Downey
On Mon, Oct 31, 2011 at 2:57 PM, Colin Yates  wrote:
> Don't want to feed the trolls but can you justify "ridiculous"?
> Rather a strong term.or maybe your definition is "I don't
> understand the value".

The value of having people piece together ad-hoc test suites vs.
adding tests to Clojure (and the Clojure build) is in some sense the
same.

The tests will flush out undesired behavior regardless.

In another sense the value of having your own test suite is higher
because you have it test what you care about and don't have to jump
through hoops to get it into Clojure's suite.

In yet another sense the value of having tests in Clojure's test suite
is higher because some failures will be detected early (and fixing it
early is some how less expensive).

The idea is not ridiculous. The circumstances that would drive to it's
implementation would be.

It would make Clojure, to my knowledge, the only open source project
were contribution of test cases is so difficult the community more or
less forks the tests suite from the controlling body and runs it
themselves.

Your email starts off "Whacky idea… ", so maybe I should have said
"which is whack."

My guess is rich wrote this in response (at least in some part) to
nathan's recent thread about the change to box ints as Longs in
Clojure 1.3.

This change would cause tests written to detect the boxed type of
numbers to fail, but so what? The change is deliberate and planned so
of course tests will fail, the tests just no longer reflect what you
want.

My understanding is what rich wants is use cases to guide changes in
the semantics of the language.

e.g. "I used to do X in clojure version N, but in the latest snapshot
with change C, X isn't as easy to do, is there some C' that would make
this better?"

e.g. "I used to stick ints into collections and turn around and use
them for interop in clojure version 1.2, but in 1.3 with changes to
how clojure boxes numbers, interop isn't as easy to do, is there some
other change we could use to enforce clojure's semantics in
collections that would make this better?"


> Maybe you are right, maybe we should provide an easy way to submit
> test cases which are automatically run as part of a CI buildno
> wait, that was my ridiculous suggestion.
>
> Please ask yourself how your response added anything at all to this
> thread or community other than making it just a little harder for
> people to suggest things for fear of being ridiculed without any form
> of justification.  A much better response would have been "I don't get
> it, please explain".  Based on your ability to read Rich's thoughts
> maybe you have already had that conversation with me telepathically.
> Dunno.

Keeping up with the state of play is hardly mind reading, and I don't
think it is too much to ask of people who want to participate in
discussions.

I will not pretend to know rich's mind (I still don't understand why
Clojure can't take pull requests) but absent clarification by rich and
given the "whacky" idea of yours, the "use case" interpretation is the
only thing that makes sense.

>
> My (I.e. this) response hasn't added anything except to flag up a very
> unhelpful and negative comment (and been just a little therapeutic)
>
> Sent from my iPad

If you cannot deal with having an idea you profess to be "whacky"
called "ridiculous" by someone on the internet, you might need fewer
internet connected devices.

>
> On 31 Oct 2011, at 21:42, Kevin Downey  wrote:
>
>> the responses to rich here sort of read like "lets make an ad-hoc test
>> suite for clojure and everyone can run it" which is ridiculous.
>>
>> tests should be contributed back to clojure.
>>
>> if contributing tests is so difficult people instead create their own
>> test suites and report results then we need to stream line the
>> contribution process.
>>
>> I cannot imagine this the kind of response rich was looking for, maybe
>> he will clarify.
>>
>> On Mon, Oct 31, 2011 at 2:08 PM, Stuart Sierra
>>  wrote:
>>> Yes, the Sonatype repositories have every Clojure development snapshot since
>>> 1.3.
>>>
>>> -Stuart Sierra
>>> 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
>>
>>
>>
>> --
>> And what is good, Phaedrus,
>> And what is not good—
>> Need we ask anyone to tell us these things?
>>
>> --
>> 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 

Re: easy sum of squares refactor question

2011-10-31 Thread nchurch
Glad I could help!  SICP is a wonderful book, and Clojure is a dream
come true in that it gives you a step from SICP into the real world.
Clojure would be just about perfect if it had general tail call
optimization and continuations, but I don't really miss those so far
(in any case they can't really be added until the JVM supports them).
And the seq abstraction and readable data structures are such a huge
plus I'd never go back to Scheme.  I remember getting frustrated with
those exact two deficiencies when using Scheme, and wanting to have a
language that fixed that; along came Clojure.  Clojure is also
constantly improving and getting more polished, and moving into more
and more fields of use.

On Oct 31, 10:06 am, Aquahappy  wrote:
> Thanks so much for your help!!! I'm so glad you had the time to
> respond to my newbie question.
>
> And as if you read my mind as I was going through the SICP lecture and
> referencing chapter two in Manning's Joy of Clojure book I was
> wondering how to turn this explicit recursive call taken from the
> scheme example into a Clojure non-tail recursion using 'recur'. I had
> been unsuccessful in my trials, so thank you times two!!!
>
> I'm off to try this out in my REPL!
>
> Many bows,
> Joshua
>
> On Oct 30, 11:29 pm, nchurch  wrote:
>
>
>
>
>
>
>
> > Another solution, this time using Clojure's tail recursion:
>
> > (defn sum2 [func incr a b]
> >   (loop [accum 0
> >          x a]
> >     (if (> x b)
> >       accum
> >       (recur (+ (func x) accum) (incr x)
>
> > This may be getting ahead of where you are now, so come back and look
> > when you've covered map, reduce, and tail recursion!

-- 
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: Please try the alphas and betas!

2011-10-31 Thread Colin Yates
Don't want to feed the trolls but can you justify "ridiculous"?
Rather a strong term.or maybe your definition is "I don't
understand the value".

Maybe you are right, maybe we should provide an easy way to submit
test cases which are automatically run as part of a CI buildno
wait, that was my ridiculous suggestion.

Please ask yourself how your response added anything at all to this
thread or community other than making it just a little harder for
people to suggest things for fear of being ridiculed without any form
of justification.  A much better response would have been "I don't get
it, please explain".  Based on your ability to read Rich's thoughts
maybe you have already had that conversation with me telepathically.
Dunno.

My (I.e. this) response hasn't added anything except to flag up a very
unhelpful and negative comment (and been just a little therapeutic)

Sent from my iPad

On 31 Oct 2011, at 21:42, Kevin Downey  wrote:

> the responses to rich here sort of read like "lets make an ad-hoc test
> suite for clojure and everyone can run it" which is ridiculous.
>
> tests should be contributed back to clojure.
>
> if contributing tests is so difficult people instead create their own
> test suites and report results then we need to stream line the
> contribution process.
>
> I cannot imagine this the kind of response rich was looking for, maybe
> he will clarify.
>
> On Mon, Oct 31, 2011 at 2:08 PM, Stuart Sierra
>  wrote:
>> Yes, the Sonatype repositories have every Clojure development snapshot since
>> 1.3.
>>
>> -Stuart Sierra
>> 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
>
>
>
> --
> And what is good, Phaedrus,
> And what is not good—
> Need we ask anyone to tell us these things?
>
> --
> 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


Lazy behavior

2011-10-31 Thread Nicolas
Hi everybody!

I'am experimenting with clojure and as an exercice I use the facebook
puzzles (http://www.facebook.com/careers/puzzles.php?puzzle_id=20)
Most puzzles require to read from a text file "efficiently". So I try
to not read the full file at a time, but process it lazily.

For that I made a very small helper library that try to benefit of
lazy sequences:

;Pattern instances are immutables and thread safe
(def split-pattern (java.util.regex.Pattern/compile "\\s"))

(defn split-words [string]
  "Split the provided string into words. Separators are space and
tabs"
  (if (nil? string)
nil
(vec (remove #(.equals % "") (.split split-pattern string)

(defn read-text-file [file-name]
   "Read a text file, line per line, lazily returning nil when end of
file has been reached. Each line is a vector of words"
   (let [reader (java.io.BufferedReader. (java.io.FileReader. file-
name))]
 (map split-words (repeatedly #(.readLine reader)

(defn next-line [lines]
  (first (take 1 lines)))

So basically, a file is a lazy sequence of lines, and each line is a
vector of words.

Lazy behavior seems to be working at first, it I write:

 (let [data (read-text-file "liars.txt")]
  (take 5 data))

-> (["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"])

It correctly return the 5 first lines of my file. Perfect that's
exactly what I want.

But when really using it, it doesn't work. If I call several time the
take function, it always return the first lines instead of providing
the next ones:

(let [data (read-text-file "liars.txt")]
  [(take 5 data) (take 5 data)])
=>[(["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"])
(["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"])]

If I call take 10 directly, it works as expected:

(let [data (read-text-file "liars.txt")]
  (take 10 data))
=>(["5"] ["Stephen" "1"] ["Tommaso"] ["Tommaso" "1"] ["Galileo"]
["Isaac" "1"] ["Tommaso"] ["Galileo" "1"] ["Tommaso"] ["George" "2"])

You would say, why not just take all data from the stream and then
process it?

Well the file has a specific format, first line contain some data,
then few next line contain another data and so on. So I want to have a
function that will read only a subpart of the file for example,
another function another part and call them sequentially. But as shown
in the simple previous example it simply doesn't work.

My understanding is that some immutable thing is in the middle and it
act like the data reference isn't changed between calls. That not what
I want obviously as I'am getting data from a java stream, that is not
supposed to be immutable.

And how can I manage correctly this kind of cases? Efficiantly and
idiomatically.

Thanks in advance,

Nicolas.

-- 
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: Please try the alphas and betas!

2011-10-31 Thread Kevin Downey
the responses to rich here sort of read like "lets make an ad-hoc test
suite for clojure and everyone can run it" which is ridiculous.

tests should be contributed back to clojure.

if contributing tests is so difficult people instead create their own
test suites and report results then we need to stream line the
contribution process.

I cannot imagine this the kind of response rich was looking for, maybe
he will clarify.

On Mon, Oct 31, 2011 at 2:08 PM, Stuart Sierra
 wrote:
> Yes, the Sonatype repositories have every Clojure development snapshot since
> 1.3.
>
> -Stuart Sierra
> 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



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
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: Confusion with doc macro

2011-10-31 Thread Mark Rathwell
> No, I'm looking for a copy meta routine.
>
> The mysterious defmeta macro does this, in one call.
>
> (defmeta a map)
>
> (= (meta (var a)) (meta map))

This will do what you want, but I would not advise using it:

(defmacro def-with-meta [symbol init]
  `(let [m# (meta ~init)]
 (def ~symbol ~init)
 (reset-meta! (var ~symbol) m#)
 (var ~symbol)))

Then:

  (= (meta (var symbol)) (meta init))  ;=> true
  (= (meta (var symbol)) (meta symbol))  ;=> true



> On Oct 31, 4:20 pm, Mark Rathwell  wrote:
>> def already adds metadata on the symbol as metadata on the var.  Did
>> you need more than this (below)?
>>
>> user> (def ^{:doc "foo"} x [1 2 3])
>> #"user/x
>>
>> user> (meta (var x))
>> {:ns #, :name x, :doc "foo", :line 1, :file "NO_SOURCE_FILE"}
>>
>> user> (doc x)
>> -
>> user/x
>>   foo
>> nil
>>
>> user> (defn ^{:doc "foo foo"} xx [] (println "hello"))
>> #'user/xx
>>
>> user> (meta (var xx))
>> {:arglists ([]), :ns #, :name xx, :doc "foo foo",
>> :line 1, :file "NO_SOURCE_FILE"}
>>
>> user> (doc xx)
>> -
>> user/xx
>> ([])
>>   foo foo
>> nil
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Oct 31, 2011 at 4:08 PM, Sean Devlin  
>> wrote:
>> > Okay, then I need a hand with something then.  I'm trying to come up
>> > with a macro that does the following:
>>
>> > (defmacro def-with-meta ...) -> You supply this
>>
>> > (def-with-meta symbol init)
>>
>> > (= (meta (var symbol)) (meta init)) -> True
>>
>> > Any suggestions folks?
>>
>> > Sean Devlin
>>
>> > On Oct 31, 2:59 pm, Mark Rathwell  wrote:
>> >> It uses (meta (var common/basic-logger)).
>>
>> >> On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin  
>> >> wrote:
>> >> > I'm a bit confused by what the doc macro is doing.  Doesn't it simply
>> >> > work of the metadata of what is passed to it?
>>
>> >> > I try this at the REPL:
>>
>> >> > user=> (doc common/basic-logger)
>> >> > -
>> >> > decorators.common/basic-logger
>> >> > nil
>> >> >  nil
>> >> > nil
>>
>> >> > For the following item:
>>
>> >> > user=> (meta common/basic-logger)
>> >> > {:ns #, :name basic-logger, :file
>> >> > "decorators/common.clj", :line 13, :arglists ([f]), :doc "This is a
>> >> > very basic logging decorator."}
>>
>> >> > Shouldn't I see something like this:
>>
>> >> > user=> (doc common/basic-logger)
>> >> > -
>> >> > decorators.common/basic-logger
>> >> > ([f])
>> >> >  This is a very basic logging decorator.
>> >> > nil
>>
>> >> > Any help would be great.
>>
>> >> > --
>> >> > 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: Clojure Conj extracurricular activities spreadsheet

2011-10-31 Thread Larry Johnson
Ahh.  Yes, it is really, really hard.  I may have misunderstood the nature
of the session.

Larry

On Mon, Oct 31, 2011 at 5:18 PM, Gary Trakhman wrote:

> I think we're just playing it, no?  :-)   Isn't it really really hard
> to solve go?
>
> On Mon, Oct 31, 2011 at 5:12 PM, Larry Johnson
>  wrote:
> > Damn, Damn, Damn.  I'm very new to clojure, and joined this forum just a
> few
> > weeks ago.  The fact that there are sessions at Clojure Conj  on two of
> my
> > passions (Go and Literate Programming), and that I'm unable to attend,
> > frustrates me to no end.
> >
> > I assume that the session on Go refers to the Asian board game known as
> > Go/Baduk/Wei Chi.  If someone could pop a note to me offline on what work
> > Clojure programmers are doing with Go, I'd really appreciate it.
> >
> >
> >
> > On Mon, Oct 31, 2011 at 1:58 PM, h.h 
> wrote:
> >>
> >> Can someone add me (hunter.hutchinson) to:
> >> * Clojurescript
> >> * Go
> >> * Pallet
> >> * D3 & Clojurescript
> >> * The web & Clojure
> >>
> >> Thanks!
> >>
> >> On Oct 31, 7:36 am, Fogus  wrote:
> >> > I've added everyone to this thread as an editor of the spreadsheet.
> >> > Please feel free to add yourself and your sessions at your leisure.
> >>
> >> --
> >> 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
> >
> >
> > --
> >
> > Off the Beaten Path in Technology
> > http://otbeatenpath.wordpress.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
>



-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.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

Re: Clojure Conj extracurricular activities spreadsheet

2011-10-31 Thread Gary Trakhman
I think we're just playing it, no?  :-)   Isn't it really really hard
to solve go?

On Mon, Oct 31, 2011 at 5:12 PM, Larry Johnson
 wrote:
> Damn, Damn, Damn.  I'm very new to clojure, and joined this forum just a few
> weeks ago.  The fact that there are sessions at Clojure Conj  on two of my
> passions (Go and Literate Programming), and that I'm unable to attend,
> frustrates me to no end.
>
> I assume that the session on Go refers to the Asian board game known as
> Go/Baduk/Wei Chi.  If someone could pop a note to me offline on what work
> Clojure programmers are doing with Go, I'd really appreciate it.
>
>
>
> On Mon, Oct 31, 2011 at 1:58 PM, h.h  wrote:
>>
>> Can someone add me (hunter.hutchinson) to:
>> * Clojurescript
>> * Go
>> * Pallet
>> * D3 & Clojurescript
>> * The web & Clojure
>>
>> Thanks!
>>
>> On Oct 31, 7:36 am, Fogus  wrote:
>> > I've added everyone to this thread as an editor of the spreadsheet.
>> > Please feel free to add yourself and your sessions at your leisure.
>>
>> --
>> 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
>
>
> --
>
> Off the Beaten Path in Technology
> http://otbeatenpath.wordpress.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: Clojure Conj extracurricular activities spreadsheet

2011-10-31 Thread Larry Johnson
Damn, Damn, Damn.  I'm very new to clojure, and joined this forum just a
few weeks ago.  The fact that there are sessions at Clojure Conj  on two of
my passions (Go and Literate Programming), and that I'm unable to attend,
frustrates me to no end.

I assume that the session on Go refers to the Asian board game known as
Go/Baduk/Wei Chi.  If someone could pop a note to me offline on what work
Clojure programmers are doing with Go, I'd really appreciate it.



On Mon, Oct 31, 2011 at 1:58 PM, h.h  wrote:

> Can someone add me (hunter.hutchinson) to:
> * Clojurescript
> * Go
> * Pallet
> * D3 & Clojurescript
> * The web & Clojure
>
> Thanks!
>
> On Oct 31, 7:36 am, Fogus  wrote:
> > I've added everyone to this thread as an editor of the spreadsheet.
> > Please feel free to add yourself and your sessions at your leisure.
>
> --
> 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
>



-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.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

Re: Please try the alphas and betas!

2011-10-31 Thread Stuart Sierra
Yes, the Sonatype repositories have every Clojure development snapshot 
since 1.3.

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

Re: install clojure-contrib [noob]

2011-10-31 Thread Stuart Sierra
Managing Java/Clojure libraries is usually handled by a dedicated tool like 
Maven or Leiningen.

Leiningen is an easy-to-use tool designed specifically for Clojure:
https://github.com/technomancy/leiningen

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

Re: Clojure Conj extracurricular activities spreadsheet

2011-10-31 Thread h.h
Can someone add me (hunter.hutchinson) to:
* Clojurescript
* Go
* Pallet
* D3 & Clojurescript
* The web & Clojure

Thanks!

On Oct 31, 7:36 am, Fogus  wrote:
> I've added everyone to this thread as an editor of the spreadsheet.
> Please feel free to add yourself and your sessions at your leisure.

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


Nested Syntax Quote, Quote and unquote example

2011-10-31 Thread vikbehal
Can anyone give me some basic example which contained nested quotes
and unquotes? with explanation at each step!

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


Homoiconicity in clojure (macro power)

2011-10-31 Thread vikbehal
I am from java Background. We say Homoiconicity in Clojure (Lisp).
Code is data and data is code. I read various blogs on it, still not
clear, Can you give me some example?

-- 
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-10-31 Thread Vikrant Behal
Yes, I am interested. Wanna get some practical experience in clojure.

Cheers!
Vikrant Behal
+91 8884963403

P Please do not print this email unless it is absolutely necessary.
Spread environmental awareness.





On Mon, Oct 31, 2011 at 12:02 AM, Dennis Haupt  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> 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.
>
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOrZhRAAoJENRtux+h35aGzE4P/2llb/0Pfy/qJSjK0pEM/plD
> ySU/CYupObaI3aZN+1aK8LwCQmiznyk6AUa8UcdO9fYcvEXDTBvHbWJUpimG0gUC
> pMUuL/wfTqB232gtuNbYMc6zYRoN3ddq4yZIq0QFnbqXI8PaxjQJBaS7J+5DZEGG
> JXaaA9RpTL6mnyTxxlw29BwHgmsv+xxbu09yAg8VHABD2TcuRUuz81OKmHTUxxhm
> 1ZtlP9dw+jVzryNUHfE3lygn+stfIJxC3ui3cf4Rfham+CbhjpseClkXWA4nNYYF
> tqsQHxxe76CewXbQBpnKhqPvB9REo+qGdADi6camML5k+i6FYen4QXIvh5bF8PmO
> jkOFQZLN2t05pPEmq+lamMmpb3LA2VLVv4zC/m9mEgrJ/rB34Ewv1upU76Qme+OB
> r/++jgFeb0OcjdFs4kvJpF7wKFKHJv0nMfyzKnzrx4D0HckrpQdsBGsXjhDqsvZQ
> 6QwamOZhk9yugPlqgEy3eN6VrKxY9JawQ0H6e5P+DD0F7UyDbYtBk/HcEx916Kjj
> CBNEIwImHoR/0uA7Dyzrn08LoaTcej7kSA06UOkOiRaw71T9EnQuOjDDabrzmsyk
> Go/R+rPMlgFTpdt6w43dnmmXqrOfKJqmFrvYztKBAulVoibY0ZSkwmKd/cftiYNw
> WSOA0yQMG5qN1pBmpiCk
> =j+7J
> -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

-- 
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: install clojure-contrib [noob]

2011-10-31 Thread S. Mosciatti
Ok, I've installed clojure 1.3 without any problems...

So, to install any libraries, what are the step ???
Just download and put it in the path and in the dependence of the
project ???

I'm sorry for this so stupid question, but I can't find answer on
internet...

On Oct 30, 4:22 pm, Stuart Sierra  wrote:
> Hi S.,
>
> Those are very old instructions.  Clojure's Git repository is now
> located athttp://github.com/clojure/clojure
>
> You can get the latest release of clojure fromhttp://clojure.org/
>
> "clojure-contrib" is no longer one big thing that you download and
> install. Instead it is a collection of small libraries. More
> information here:http://dev.clojure.org/display/design/Clojure+Contrib
>
> -Stuart Sierra
> clojure.com
>
> On Oct 30, 11:30 am, "S. Mosciatti"  wrote:
>
>
>
>
>
>
>
> > Hi guys,
>
> > I'm so sorry, but I'de spend so much time without success, that now i
> > want try to ask, i know that i'm not the first, but please...
>
> > I'm in Ubuntu 11.04, I' ve installed clojure following this steps,
> > [url]http://riddell.us/ClojureOnUbuntu.html[/url], but i'm stopped
> > here:
>
> > >Install clojure-contrib
>
> > >clojure-contrib is the offical clojure language extension library. It also 
> > >includes a start-up script for launching a REPL with various java options.
>
> > >~$ cd ~/opt
>
> > >~$ git clone git://github.com/richhickey/clojure-contrib.git
>
> > >~$ cd clojure-contrib
>
> > >~$ mvn install
>
> > >~$ cp target/clojure-contrib*.jar ~/.clojure/clojure-contrib.jar
>
> > mvn install doesn't create any .jar file ???
>
> > So i tried to do mvn package but i get an error:
>
> > >[INFO] 
> > >
> > >[ERROR] BUILD ERROR
> > >[INFO] 
> > >
> > >[INFO] Failed to resolve artifact.
>
> > >Missing:
> > >--
> > >1) org.clojure:clojure:jar:1.2.0-master-SNAPSHOT
>
> > >  Try downloading the file manually from the project website.
>
> > >  Then, install it using the command:
> > >      mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure 
> > > -Dversion=1.2.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
>
> > >  Alternatively, if you host your own repository you can deploy the file 
> > > there:
> > >      mvn deploy:deploy-file -DgroupId=org.clojure -DartifactId=clojure 
> > > -Dversion=1.2.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file 
> > > >-Durl=[url] -DrepositoryId=[id]
>
> > >  Path to dependency:
> > >    1) org.clojure:clojure-contrib:jar:1.2.0-SNAPSHOT
> > >    2) org.clojure:clojure:jar:1.2.0-master-SNAPSHOT
>
> > >--
> > >1 required artifact is missing.
>
> > >for artifact:
> > >  org.clojure:clojure-contrib:jar:1.2.0-SNAPSHOT
>
> > >>from the specified remote repositories:
> > >  central (http://repo1.maven.org/maven2),
> > >  clojure-snapshots (http://build.clojure.org/snapshots),
> > >  clojure-releases (http://build.clojure.org/releases)
>
> >  and I've no idea what file download...
>
> > Can somebody help me???
>
> > 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: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

if you *really* make zero assumptions, every second call has to be a
protocol/interface call. *i know what i am, so no assumption* ->
*interface call* -> *repeat*

i think "no assumptions" should be "make no assumptions about the
internals of what you are calling". as long as you just code against
the "outer shell", you should be fine.

Am 31.10.2011 20:54, schrieb Michael Gardner:
> On Oct 31, 2011, at 2:03 PM, Timothy Baldridge wrote:
> 
>> This is what Clojure excels at...de-coupling, or as Rich put it
>> in his recent talk "Simple made Easy": don't assume things about
>> your code. Don't assume that all models will always fit into the
>> concept of a polygon...don't assume that you'll always want to
>> represent your models via Java2D.
> 
> It's impossible to make zero assumptions about your code; the trick
> is figuring out which are the appropriate ones. Making too many
> assumptions leads to brittle and hard-to-extend code, but making
> too few leads to over-generalized, ponderous code that does way
> more than it's ever likely to be used for.
> 
> In a case like this game, it should be easy to refactor away from
> the "everything is a polygon" model if and when the game outgrows
> it, so I'd argue against introducing the extra complexity of
> per-entity renderers until it's actually necessary.
> 
> That's a strength of dynamic, expressive languages like Clojure,
> IMO: because there's so much less code, refactoring is much easier.
> So instead of trying to predict all future requirements and
> possibly ending up with over-generalized code, you can make
> assumptions based on current/near-term requirements and refactor
> when those assumptions no longer apply.
> 


- -- 

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

iQIcBAEBAgAGBQJOrwmYAAoJENRtux+h35aGTQgQAMC1bUbjN0Mz90fmOQVUCjBN
zO+UJXfaiVo6DmR0usZkv1ynwTyuZwQm+llhamabAMLUZXsIiAcbpu0KLjkxJwjJ
S6EpZwAsRnqYtUTn3DvdFC3kTkgUR5+KD7fQ97PBHBmyNKcy+GcU7MQP0bsZ9KdQ
26K6qo5TqWmkQEzvg9kVBrB2W5FQj6BuH7UA3LQxHSegpc4Wryxf9qQZFEa5mqFg
IdRUFFR2oLOD1rCBcVoeV9hvyPeIdw8ntHoVVepfeDN+PspC3Z58f09dr9E8gar6
Jp9DSgOsZr6ClUHVGUhVOaWPiFeZLunOe9cOCJTaanXKzkE1fejzuQez51sAo3ns
mSF40Ezip30kTpJWld1mQV4/mFgsmfymegQiJ71r8V0nEJxOESpmGPb3by0CIAyE
sqoFyh/oqbp8lwupwHI636L6O9DPqKYwIVv1ba0q09NhO6rbvDe93+9lWTs3n+XB
XLJprZjoU8A7PtUxCEdVCWx75Hi5Lt3FXaFeF/36clWCftRC9yyy+61ZAM5UrmsC
4QjUIG3jJCX7aeHteerWZrkApieYr5JBxL81Zyvf6at0wnINr/x8drWuB8R9gwKy
gBIpi+WrjSZhlCgkaQnJocgxrMhNTkdk1XsRcdHDFt1j5kLfb3ZdjK+rSr13XX0H
5FLhhzQZOnnlDibXw1P9
=nWrK
-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: Confusion with doc macro

2011-10-31 Thread Sean Devlin
No, I'm looking for a copy meta routine.

The mysterious defmeta macro does this, in one call.

(defmeta a map)

(= (meta (var a)) (meta map))

On Oct 31, 4:20 pm, Mark Rathwell  wrote:
> def already adds metadata on the symbol as metadata on the var.  Did
> you need more than this (below)?
>
> user> (def ^{:doc "foo"} x [1 2 3])
> #"user/x
>
> user> (meta (var x))
> {:ns #, :name x, :doc "foo", :line 1, :file "NO_SOURCE_FILE"}
>
> user> (doc x)
> -
> user/x
>   foo
> nil
>
> user> (defn ^{:doc "foo foo"} xx [] (println "hello"))
> #'user/xx
>
> user> (meta (var xx))
> {:arglists ([]), :ns #, :name xx, :doc "foo foo",
> :line 1, :file "NO_SOURCE_FILE"}
>
> user> (doc xx)
> -
> user/xx
> ([])
>   foo foo
> nil
>
>
>
>
>
>
>
> On Mon, Oct 31, 2011 at 4:08 PM, Sean Devlin  wrote:
> > Okay, then I need a hand with something then.  I'm trying to come up
> > with a macro that does the following:
>
> > (defmacro def-with-meta ...) -> You supply this
>
> > (def-with-meta symbol init)
>
> > (= (meta (var symbol)) (meta init)) -> True
>
> > Any suggestions folks?
>
> > Sean Devlin
>
> > On Oct 31, 2:59 pm, Mark Rathwell  wrote:
> >> It uses (meta (var common/basic-logger)).
>
> >> On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin  
> >> wrote:
> >> > I'm a bit confused by what the doc macro is doing.  Doesn't it simply
> >> > work of the metadata of what is passed to it?
>
> >> > I try this at the REPL:
>
> >> > user=> (doc common/basic-logger)
> >> > -
> >> > decorators.common/basic-logger
> >> > nil
> >> >  nil
> >> > nil
>
> >> > For the following item:
>
> >> > user=> (meta common/basic-logger)
> >> > {:ns #, :name basic-logger, :file
> >> > "decorators/common.clj", :line 13, :arglists ([f]), :doc "This is a
> >> > very basic logging decorator."}
>
> >> > Shouldn't I see something like this:
>
> >> > user=> (doc common/basic-logger)
> >> > -
> >> > decorators.common/basic-logger
> >> > ([f])
> >> >  This is a very basic logging decorator.
> >> > nil
>
> >> > Any help would be great.
>
> >> > --
> >> > 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: Please try the alphas and betas!

2011-10-31 Thread Sean Corfield
On Mon, Oct 31, 2011 at 8:06 AM, Timothy Baldridge  wrote:
> I'd like to second what Bill said...I don't really have the time to
> setup a clojure build process to test out the 1.4 Alphas/Betas, but if
> there was a way for me to get to it via lein...I would just target 1.4
> for all my day-to-day development.

This should work:

  :repositories [["sonatype-snapshots"
"https://oss.sonatype.org/content/repositories/snapshots/";]]
  :dependencies [[org.clojure/clojure "1.4.0-master-SNAPSHOT"] ...]
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

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

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


Re: Confusion with doc macro

2011-10-31 Thread Mark Rathwell
def already adds metadata on the symbol as metadata on the var.  Did
you need more than this (below)?

user> (def ^{:doc "foo"} x [1 2 3])
#"user/x

user> (meta (var x))
{:ns #, :name x, :doc "foo", :line 1, :file "NO_SOURCE_FILE"}

user> (doc x)
-
user/x
  foo
nil

user> (defn ^{:doc "foo foo"} xx [] (println "hello"))
#'user/xx

user> (meta (var xx))
{:arglists ([]), :ns #, :name xx, :doc "foo foo",
:line 1, :file "NO_SOURCE_FILE"}

user> (doc xx)
-
user/xx
([])
  foo foo
nil


On Mon, Oct 31, 2011 at 4:08 PM, Sean Devlin  wrote:
> Okay, then I need a hand with something then.  I'm trying to come up
> with a macro that does the following:
>
> (defmacro def-with-meta ...) -> You supply this
>
> (def-with-meta symbol init)
>
> (= (meta (var symbol)) (meta init)) -> True
>
> Any suggestions folks?
>
> Sean Devlin
>
> On Oct 31, 2:59 pm, Mark Rathwell  wrote:
>> It uses (meta (var common/basic-logger)).
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin  
>> wrote:
>> > I'm a bit confused by what the doc macro is doing.  Doesn't it simply
>> > work of the metadata of what is passed to it?
>>
>> > I try this at the REPL:
>>
>> > user=> (doc common/basic-logger)
>> > -
>> > decorators.common/basic-logger
>> > nil
>> >  nil
>> > nil
>>
>> > For the following item:
>>
>> > user=> (meta common/basic-logger)
>> > {:ns #, :name basic-logger, :file
>> > "decorators/common.clj", :line 13, :arglists ([f]), :doc "This is a
>> > very basic logging decorator."}
>>
>> > Shouldn't I see something like this:
>>
>> > user=> (doc common/basic-logger)
>> > -
>> > decorators.common/basic-logger
>> > ([f])
>> >  This is a very basic logging decorator.
>> > nil
>>
>> > Any help would be great.
>>
>> > --
>> > 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: Confusion with doc macro

2011-10-31 Thread Sean Devlin
Okay, then I need a hand with something then.  I'm trying to come up
with a macro that does the following:

(defmacro def-with-meta ...) -> You supply this

(def-with-meta symbol init)

(= (meta (var symbol)) (meta init)) -> True

Any suggestions folks?

Sean Devlin

On Oct 31, 2:59 pm, Mark Rathwell  wrote:
> It uses (meta (var common/basic-logger)).
>
>
>
>
>
>
>
> On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin  wrote:
> > I'm a bit confused by what the doc macro is doing.  Doesn't it simply
> > work of the metadata of what is passed to it?
>
> > I try this at the REPL:
>
> > user=> (doc common/basic-logger)
> > -
> > decorators.common/basic-logger
> > nil
> >  nil
> > nil
>
> > For the following item:
>
> > user=> (meta common/basic-logger)
> > {:ns #, :name basic-logger, :file
> > "decorators/common.clj", :line 13, :arglists ([f]), :doc "This is a
> > very basic logging decorator."}
>
> > Shouldn't I see something like this:
>
> > user=> (doc common/basic-logger)
> > -
> > decorators.common/basic-logger
> > ([f])
> >  This is a very basic logging decorator.
> > nil
>
> > Any help would be great.
>
> > --
> > 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: anyone interested in a small game?

2011-10-31 Thread Michael Gardner
On Oct 31, 2011, at 2:03 PM, Timothy Baldridge wrote:

> This is what Clojure excels at...de-coupling, or as Rich put it in his
> recent talk "Simple made Easy": don't assume things about your code.
> Don't assume that all models will always fit into the concept of a
> polygon...don't assume that you'll always want to represent your
> models via Java2D.

It's impossible to make zero assumptions about your code; the trick is figuring 
out which are the appropriate ones. Making too many assumptions leads to 
brittle and hard-to-extend code, but making too few leads to over-generalized, 
ponderous code that does way more than it's ever likely to be used for.

In a case like this game, it should be easy to refactor away from the 
"everything is a polygon" model if and when the game outgrows it, so I'd argue 
against introducing the extra complexity of per-entity renderers until it's 
actually necessary.

That's a strength of dynamic, expressive languages like Clojure, IMO: because 
there's so much less code, refactoring is much easier. So instead of trying to 
predict all future requirements and possibly ending up with over-generalized 
code, you can make assumptions based on current/near-term requirements and 
refactor when those assumptions no longer apply.

-- 
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-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

this is my opinion as well:
adding a layer of abstraction at a later point in time is much more
difficult than removing one that is just delegating calls, so it often
pays off to add one in the beginning just in case. i decided to just
skip that because everything is going to be a polygon, even lines and
circles can be represented as polygons.

i did what you suggested anyway.

Am 31.10.2011 20:03, schrieb Timothy Baldridge:
> As far as the mutable state goes, yes, that's probably a better
> route, at least for a simple game. However I would recommend
> against "everything is a polygon" route. Once again, for a simple
> game, this may be fine, but you're now making an assumption:
> "everything is a polygon". What if you want a simple laser
> point-to-point entity? What if you want a planet that is
> represented by a circle? What if you want your ship to be a
> different color than the asteroids? By implementing IRender


, you get two side effects:
> 
> 1) you can now de-couple the presentation of the object, from the
> code that presents it 2) you can have very complex models (multiple
> polygons and colors) without having complex render code 3) you can
> have entities represented by bitmaps, polygons, circles, arcs, 3d
> meshes, etc.
> 
> This is what Clojure excels at...de-coupling, or as Rich put it in
> his recent talk "Simple made Easy": don't assume things about your
> code. Don't assume that all models will always fit into the concept
> of a polygon...don't assume that you'll always want to represent
> your models via Java2D.
> 
> Now, I'm not saying that your idea is bad for a simple game...but
> for a larger project you may run into problems with this approach.
> 
> If you want a good way to think about this, I'd recommend trying
> to design the engine to run on both Clojure and ClojureScript. Have
> it support Java2D, SVG and Canvas front ends...even if you don't 
> implement anything but the JVM version, if you can at least show
> that your engine would work on these other platforms without heavy 
> modifications (massive kodos if you can do this without any 
> modifications to the core engine at all) then I would say you have 
> reached a "higher plane of understanding" in when it comes to
> Clojure.



> 
> Timothy
> 
> 
> 
> On Mon, Oct 31, 2011 at 1:42 PM, Dennis Haupt
>  wrote: no need for "IRender" since
> everything has a java.awt.polygon. i just draw it. in a sense, the
> polygon is my IRender and it's data is the implementation.
> 
> i was thinking about using a simple type (:asteroid, :ship,
> :bullet) for each entity and pick an "advance"-function (input =
> complete old game state + one specific entity, output = new entity)
> depending on it. -> {:asteroid advance-asteroid :ship
> advance-ship}
> 
> i'd like to avoid mutable states as much as possible which means
> there will be one atom or agent for the whole world and a
> bufferedimage. other than that, i'd like to stay purely
> functional.
> 
> Am 31.10.2011 19:03, schrieb Timothy Baldridge:
> In the OOP languages, entity systems seem to be all the
> rage. I suggest stealing ideas from there if you can.
 
 
 In this same vein, I'd recommend thinking about the
 following approach:
 
 First, read up on reify and protocols. Next, create protocols
 for the main areas of your engine. Perhaps start with IRender
 and IPhysicalEntity
 
 (defprotocol IRender (render [this]))
 
 (defprotocol IPhysicalEntity (update-position [this
 timespan]))
 
 
 
 then for the user ship, you can do something as simple as:
 
 (defn new-ship [x y] (let [pos (atom {:x x :y y})] (reify
 IRender (render [this] (render-ship-model pos))
 IPhysicalEntity (update-position [this timespan] (swap! pos
 #(hash-map :x (inc (:x %)) :y (:y %)))
 
 there's bound to be errors in the above code, but you get
 the point. The thing I love about the above example is that
 we've completely abstracted away the parts of this engine. We
 can have entities that implement different protocols, we can
 have a separate data structure for each and every entity,
 depending on its needs, and everything is abstracted nicely.
 Static objects can just implement IRender, and invisible
 objects can implement IPhysicalEntity. Extend this to
 implement ICollideable (for collision detection), and you
 have the makings of a very extensible system.
 
 Timothy
 
> 
> 
>> 
>> -- 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-10-31 Thread Jack Moffitt
> However I would recommend against
> "everything is a polygon" route. Once again, for a simple game, this
> may be fine, but you're now making an assumption: "everything is a
> polygon". What if you want a simple laser point-to-point entity? What
> if you want a planet that is represented by a circle? What if you want
> your ship to be a different color than the asteroids?

A simple example is a trigger. This in fact has a polygon (or rather,
a volume or area), and causes some event to happen when some object
collides with it. However, it is not rendered itself.

Lots of game logic is implemented as triggers and other things, which
are entities but not rendered. This is overkill perhaps for the simple
games, but very flexible for the not so simple ones.

I highly recommend reading this description of the Thief engine:
http://www.gamasutra.com/view/feature/3355/postmortem_thief_the_dark_project.php?print=1

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


Re: ClojureCLR survey now open

2011-10-31 Thread dmiller
ClojureCLR survey closing tonight at midnight my time (Central
Daylight Time).


On Oct 26, 12:22 pm, dmiller  wrote:
> Keep those cards and letters coming.
>
> Just a reminder that time is running out on participating in the
> ClojureCLRsurvey.
>
> I put in a BOF request for ClojureCLR at the conj on the spreadsheet
> that was getting passed around.  I'll publish thesurveyresults prior
> to conj.  I hope that will help drive the conversation.
>
> -David
>
> On Oct 22, 11:43 pm, dmiller  wrote:
>
>
>
>
>
>
>
> > Inspired by Chas Emerick's Clojure surveys, I have created asurveyto
> > assess the experiences and needs of (potential or actual) users of
> > ClojureCLR.  Building community and lowering barriers to adoption have
> > to be priorities for this project.  I hope thissurveywill provide
> > some guidance for this.
>
> > Thesurveyis available here:
>
> >https://docs.google.com/spreadsheet/viewform?formkey=dDE3YnlYbXBxc3lj...
>
> > Thesurveyis will be available through October 31.
>
> > For more 
> > information:http://clojureclr.blogspot.com/2011/10/2011-clojureclr-survey-is-open...
>
> > If there is interest, perhaps a ClojureCLR BOF at the conj to discuss
> > the results?
>
> > -David Miller

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

2011-10-31 Thread gaz jones
thanks for sharing, this looks extremely useful.

On Mon, Oct 31, 2011 at 11:43 AM, dennis  wrote:
> Clojure-control is a clojure DSL for system admin and deployment with
> many remote machines via ssh/rsync.It is on github:
> https://github.com/killme2008/clojure-control
>
> 0.2.1 has been released,main highlights:
> First,A shell command DSL by sunny87,for example:
>
> (cd "/home/login"
>    (run "ls")
>    (cd "bin"
>        (run "ls")))
>
> (cd "/home/login"
>    (path "/home/login/bin"
>        (env "JAVA_OPTS" "-XMaxPermSize=128m"
>            (run "clojure"
>
> Second,Supports ssh/scp/rsync options when defining cluster,they can
> be a string or a vector:
>
> (defcluster :mycluster
>              :ssh-options "-p 44"
>              :scp-options "-v"
>              :rsync-options ["-arz" "--delete"]
>              :clients [
>                       { :host "c.domain.com" :user "clogin" :ssh-
> options "-v -p 43"}
>                       ]
>              :user "login"
>              :addresses ["a.domain.com" "b.domain.com"])
>
> Third, It supports executing task in parallel now,just define cluster
> by
> (defcluster :mycluster
>                      :parallel true
>                      )
>
> At last, i recommend everyone try the lein-control plugin developed by
> sunny87 for using cc much more simply,please visit
> https://github.com/sunng87/lein-control
>
> --
> 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: anyone interested in a small game?

2011-10-31 Thread Timothy Baldridge
As far as the mutable state goes, yes, that's probably a better route,
at least for a simple game. However I would recommend against
"everything is a polygon" route. Once again, for a simple game, this
may be fine, but you're now making an assumption: "everything is a
polygon". What if you want a simple laser point-to-point entity? What
if you want a planet that is represented by a circle? What if you want
your ship to be a different color than the asteroids? By implementing
IRender, you get two side effects:

1) you can now de-couple the presentation of the object, from the code
that presents it
2) you can have very complex models (multiple polygons and colors)
without having complex render code
3) you can have entities represented by bitmaps, polygons, circles,
arcs, 3d meshes, etc.

This is what Clojure excels at...de-coupling, or as Rich put it in his
recent talk "Simple made Easy": don't assume things about your code.
Don't assume that all models will always fit into the concept of a
polygon...don't assume that you'll always want to represent your
models via Java2D.

Now, I'm not saying that your idea is bad for a simple game...but for
a larger project you may run into problems with this approach.

If you want a good way to think about this, I'd recommend trying to
design the engine to run on both Clojure and ClojureScript. Have it
support Java2D, SVG and Canvas front ends...even if you don't
implement anything but the JVM version, if you can at least show that
your engine would work on these other platforms without heavy
modifications (massive kodos if you can do this without any
modifications to the core engine at all) then I would say you have
reached a "higher plane of understanding" in when it comes to Clojure.

Timothy



On Mon, Oct 31, 2011 at 1:42 PM, Dennis Haupt  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> no need for "IRender" since everything has a java.awt.polygon. i just
> draw it. in a sense, the polygon is my IRender and it's data is the
> implementation.
>
> i was thinking about using a simple type (:asteroid, :ship, :bullet)
> for each entity and pick an "advance"-function (input = complete old
> game state + one specific entity, output = new entity) depending on it.
> - ->
> {:asteroid advance-asteroid :ship advance-ship}
>
> i'd like to avoid mutable states as much as possible which means there
> will be one atom or agent for the whole world and a bufferedimage.
> other than that, i'd like to stay purely functional.
>
> Am 31.10.2011 19:03, schrieb Timothy Baldridge:
>>> In the OOP languages, entity systems seem to be all the rage. I
>>> suggest stealing ideas from there if you can.
>>
>>
>> In this same vein, I'd recommend thinking about the following
>> approach:
>>
>> First, read up on reify and protocols. Next, create protocols for
>> the main areas of your engine. Perhaps start with IRender and
>> IPhysicalEntity
>>
>> (defprotocol IRender (render [this]))
>>
>> (defprotocol IPhysicalEntity (update-position [this timespan]))
>>
>>
>>
>> then for the user ship, you can do something as simple as:
>>
>> (defn new-ship [x y] (let [pos (atom {:x x :y y})] (reify IRender
>> (render [this] (render-ship-model pos)) IPhysicalEntity
>> (update-position [this timespan] (swap! pos #(hash-map :x (inc (:x
>> %)) :y (:y %)))
>>
>> there's bound to be errors in the above code, but you get the
>> point. The thing I love about the above example is that we've
>> completely abstracted away the parts of this engine. We can have
>> entities that implement different protocols, we can have a separate
>> data structure for each and every entity, depending on its needs,
>> and everything is abstracted nicely. Static objects can just
>> implement IRender, and invisible objects can implement
>> IPhysicalEntity. Extend this to implement ICollideable (for
>> collision detection), and you have the makings of a very extensible
>> system.
>>
>> Timothy
>>
>
>
> - --
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOruwPAAoJENRtux+h35aG0NsP/3CmDZHPnWjIYS2wULzTE4cp
> t9w+Citz3ZEfK5KmLDpy2dPB9l5bu2K4r7cwcgfmLLdZ90rcxgcan+WbtkffiPwd
> RZdB/E6IJrVPd2RvTt858VjNYvIeWxeU4XhpgS9EUBjiqRurQHrVrV/5bKFudRGn
> E8WO+wYv8kMGRxlB/3YjYxhxRtqy7Kevaf508J3Tq+U49TBnzpBYPvO8yX+HzRO2
> RNDVOr4S1ANf4OPn0l7AETxnEcvsI5D359JwSMGQ5whSk60kveZXTsMiD6nCFsQ0
> 2CD57iGlhHisNF78gnT78x+Qi1aMmkzWl2adfeXrW/zqZLXghLHaWamEy9dETATY
> TZxRlvYgqkp7Bwqh4+PHCB20uzRPTHex2bSw6SqY53XYiK8IWCG6iecwz0t/cuOt
> BxWRn+uTOlgX8FPZqX954eMmu1/5QjNRje5+i8kS7naRuXeZQLxwgZt6uFHN8jTS
> H4s2aso0eWyfimTQXgwQx1K+81LzbF+bDk2iI/6lk6sdbCoD1RkaIzp5qYJIxU4v
> zmFInbt+tPQFHtl8taEoUavN/Vc8//evcBDQpfdZ32JhzmZUHqGeJXEHQuVFojSr
> ursyF9oiCrWRlm4j63hWrYYdf6OUIzOYlzN2ehXGWt0Ek8TbV2J36XY8Jf6sPu3v
> 9LVXoiGlFmrjEtPKxog0
> =8KV+
> -END PGP SIGNATURE-
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To

Re: Confusion with doc macro

2011-10-31 Thread Mark Rathwell
It uses (meta (var common/basic-logger)).

On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin  wrote:
> I'm a bit confused by what the doc macro is doing.  Doesn't it simply
> work of the metadata of what is passed to it?
>
> I try this at the REPL:
>
> user=> (doc common/basic-logger)
> -
> decorators.common/basic-logger
> nil
>  nil
> nil
>
> For the following item:
>
> user=> (meta common/basic-logger)
> {:ns #, :name basic-logger, :file
> "decorators/common.clj", :line 13, :arglists ([f]), :doc "This is a
> very basic logging decorator."}
>
> Shouldn't I see something like this:
>
> user=> (doc common/basic-logger)
> -
> decorators.common/basic-logger
> ([f])
>  This is a very basic logging decorator.
> nil
>
> Any help would be great.
>
> --
> 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: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

no need for "IRender" since everything has a java.awt.polygon. i just
draw it. in a sense, the polygon is my IRender and it's data is the
implementation.

i was thinking about using a simple type (:asteroid, :ship, :bullet)
for each entity and pick an "advance"-function (input = complete old
game state + one specific entity, output = new entity) depending on it.
- ->
{:asteroid advance-asteroid :ship advance-ship}

i'd like to avoid mutable states as much as possible which means there
will be one atom or agent for the whole world and a bufferedimage.
other than that, i'd like to stay purely functional.

Am 31.10.2011 19:03, schrieb Timothy Baldridge:
>> In the OOP languages, entity systems seem to be all the rage. I 
>> suggest stealing ideas from there if you can.
> 
> 
> In this same vein, I'd recommend thinking about the following
> approach:
> 
> First, read up on reify and protocols. Next, create protocols for
> the main areas of your engine. Perhaps start with IRender and 
> IPhysicalEntity
> 
> (defprotocol IRender (render [this]))
> 
> (defprotocol IPhysicalEntity (update-position [this timespan]))
> 
> 
> 
> then for the user ship, you can do something as simple as:
> 
> (defn new-ship [x y] (let [pos (atom {:x x :y y})] (reify IRender 
> (render [this] (render-ship-model pos)) IPhysicalEntity 
> (update-position [this timespan] (swap! pos #(hash-map :x (inc (:x
> %)) :y (:y %)))
> 
> there's bound to be errors in the above code, but you get the
> point. The thing I love about the above example is that we've
> completely abstracted away the parts of this engine. We can have
> entities that implement different protocols, we can have a separate
> data structure for each and every entity, depending on its needs,
> and everything is abstracted nicely. Static objects can just
> implement IRender, and invisible objects can implement
> IPhysicalEntity. Extend this to implement ICollideable (for
> collision detection), and you have the makings of a very extensible
> system.
> 
> Timothy
> 


- -- 

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

iQIcBAEBAgAGBQJOruwPAAoJENRtux+h35aG0NsP/3CmDZHPnWjIYS2wULzTE4cp
t9w+Citz3ZEfK5KmLDpy2dPB9l5bu2K4r7cwcgfmLLdZ90rcxgcan+WbtkffiPwd
RZdB/E6IJrVPd2RvTt858VjNYvIeWxeU4XhpgS9EUBjiqRurQHrVrV/5bKFudRGn
E8WO+wYv8kMGRxlB/3YjYxhxRtqy7Kevaf508J3Tq+U49TBnzpBYPvO8yX+HzRO2
RNDVOr4S1ANf4OPn0l7AETxnEcvsI5D359JwSMGQ5whSk60kveZXTsMiD6nCFsQ0
2CD57iGlhHisNF78gnT78x+Qi1aMmkzWl2adfeXrW/zqZLXghLHaWamEy9dETATY
TZxRlvYgqkp7Bwqh4+PHCB20uzRPTHex2bSw6SqY53XYiK8IWCG6iecwz0t/cuOt
BxWRn+uTOlgX8FPZqX954eMmu1/5QjNRje5+i8kS7naRuXeZQLxwgZt6uFHN8jTS
H4s2aso0eWyfimTQXgwQx1K+81LzbF+bDk2iI/6lk6sdbCoD1RkaIzp5qYJIxU4v
zmFInbt+tPQFHtl8taEoUavN/Vc8//evcBDQpfdZ32JhzmZUHqGeJXEHQuVFojSr
ursyF9oiCrWRlm4j63hWrYYdf6OUIzOYlzN2ehXGWt0Ek8TbV2J36XY8Jf6sPu3v
9LVXoiGlFmrjEtPKxog0
=8KV+
-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


Confusion with doc macro

2011-10-31 Thread Sean Devlin
I'm a bit confused by what the doc macro is doing.  Doesn't it simply
work of the metadata of what is passed to it?

I try this at the REPL:

user=> (doc common/basic-logger)
-
decorators.common/basic-logger
nil
  nil
nil

For the following item:

user=> (meta common/basic-logger)
{:ns #, :name basic-logger, :file
"decorators/common.clj", :line 13, :arglists ([f]), :doc "This is a
very basic logging decorator."}

Shouldn't I see something like this:

user=> (doc common/basic-logger)
-
decorators.common/basic-logger
([f])
  This is a very basic logging decorator.
nil

Any help would be great.

-- 
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-10-31 Thread Timothy Baldridge
> In the OOP languages, entity systems seem to be all the rage. I
> suggest stealing ideas from there if you can.


In this same vein, I'd recommend thinking about the following approach:

First, read up on reify and protocols. Next, create protocols for the
main areas of your engine. Perhaps start with IRender and
IPhysicalEntity

(defprotocol IRender
(render [this]))

(defprotocol IPhysicalEntity
(update-position [this timespan]))



then for the user ship, you can do something as simple as:

(defn new-ship [x y]
   (let [pos (atom {:x x :y y})]
(reify
 IRender
(render [this]
(render-ship-model pos))
 IPhysicalEntity
(update-position [this timespan]
(swap! pos
 #(hash-map :x (inc (:x %)) :y (:y %)))

there's bound to be errors in the above code, but you get the point.
The thing I love about the above example is that we've completely
abstracted away the parts of this engine. We can have entities that
implement different protocols, we can have a separate data structure
for each and every entity, depending on its needs, and everything is
abstracted nicely. Static objects can just implement IRender, and
invisible objects can implement IPhysicalEntity. Extend this to
implement ICollideable (for collision detection), and you have the
makings of a very extensible system.

Timothy

-- 
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-10-31 Thread Jack Moffitt
> for example, right now i have a record called gameentity which
> contains a position, the current health, speed, the polygon
> representation which should be rendered and a few more things - but
> haven't figured out yet where to put the logic and how to apply it so
> that everything is easily extensible

In the OOP languages, entity systems seem to be all the rage. I
suggest stealing ideas from there if you can.

I'll note that most descriptions of such systems are very much written
for C++ programmers, and many of their explanations are tough to get
through if you aren't familiar with the problems.

The basic idea is something like splitting up your record above into a
record per feature. An entity is then just an aggregation of such
features. Then for each feature, there is a function which handles
changes to that feature.  The game loop goes through each function,
runs it against all entities, and then continues.

In some ways, the entities are data and relations, and the functions
that operate on them take queries on this data as input.

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


Re: Trickiness with protocols and extends (1.3.0)

2011-10-31 Thread Howard Lewis Ship
On Sat, Oct 29, 2011 at 7:02 AM, David McNeil  wrote:
> A couple of more thoughts on this.
>
> On Oct 28, 12:46 pm, Howard Lewis Ship  wrote:
>> (extend-type cascade.Asset
>>   ToAttributeValueString
>>   (to-attribute-value-string [asset] (:client-url asset)))
>
> The reason this is probably not what you really want is that the set
> of types which satisfy the Asset protocol is a superset of the set of
> types which satisfy the cascade.Asset interface. This is certainly not
> immediately obvious, but one way to understand it is that if you
> extend a built-in Java type to implement your protocol, it does not
> change the underlying type to implement the protocol's interface.
> Rather it provides machinery in the protocol itself that knows how to
> use the built-in Java type to satisfy the protocol.
>
>> I don't think it is useful to try and think of this as interface
>> inheritance because it is not the same as interface inheritance in
>> Java.
>
> I wasn't used to thinking of it as inheritance, but after thinking
> about it more it seems like "inheritance" is a reasonable way to think
> of it. Adapting protocol A to protocol B is like saying that all types
> satisfying protocol B can also be used as if they satisfy protocol A
> and furthermore there is a default implementation (that can be over-
> ridden) of protocol A for them.

And then, before you know it, you've created Haskell type classes.

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



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.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


Re: easy sum of squares refactor question

2011-10-31 Thread Aquahappy
Thanks so much for your help!!! I'm so glad you had the time to
respond to my newbie question.

And as if you read my mind as I was going through the SICP lecture and
referencing chapter two in Manning's Joy of Clojure book I was
wondering how to turn this explicit recursive call taken from the
scheme example into a Clojure non-tail recursion using 'recur'. I had
been unsuccessful in my trials, so thank you times two!!!

I'm off to try this out in my REPL!

Many bows,
Joshua

On Oct 30, 11:29 pm, nchurch  wrote:
> Another solution, this time using Clojure's tail recursion:
>
> (defn sum2 [func incr a b]
>   (loop [accum 0
>          x a]
>     (if (> x b)
>       accum
>       (recur (+ (func x) accum) (incr x)
>
> This may be getting ahead of where you are now, so come back and look
> when you've covered map, reduce, and tail recursion!

-- 
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-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

i'm not looking for people to split the work and get things done
faster, i'm looking for people to think about how and why things
should be done.

for example, right now i have a record called gameentity which
contains a position, the current health, speed, the polygon
representation which should be rendered and a few more things - but
haven't figured out yet where to put the logic and how to apply it so
that everything is easily extensible





Am 31.10.2011 15:44, schrieb Timothy Baldridge:
> I once wrote a test game engine that handled used a one-agent per 
> entity approach, and the idea was that it "should" be close to 
> linearly scale-able. It actually worked quite well. I think in the
> end I tested it with more than 10,000 entities flying in a 
> flocking/following pattern, and the engine ran like a dream. IIRC
> the limit with 10,000 entities was more because my GPU on my laptop
> is crap, and couldn't push much more than that at a single time.
> With 10,000 entities on my quad-core desktop the app worked like a
> dream.
> 
> Now all this is overkill for a small game, but it did seem to work 
> well. Unfortunately, I'm not sure a game as small as asteroids
> would work well to have multiple people working on it. Simply
> because each part of the game (graphics, physics, gui, etc.) are
> all so small, that multiple developers would just step on each
> other's toes.
> 
> Timothy
> 
> On Mon, Oct 31, 2011 at 9:37 AM, Dennis Haupt
>  wrote: one agent per entity? i'd have
> done an agent for the whole world and apply functions like
> "apply-collision" and "apply-shot-fired" to it
> 
> Am 31.10.2011 14:46, schrieb Timothy Baldridge:
 Haha! I forgot about Java2d... Yeah, that would work just
 fine. No, Clojure does not support remote agents. But agents
 can really help in a system like this to express objects as
 distinct entities. That is, you have one object per item on
 the screen, and then each object basically can "live" on its
 own:
 
 (send entity update-time timespan)
 
 (send asteroid do-split)
 
 etc.
 
 Actually, this really isn't too long of a project, at least
 the asteroids part isn't.
 
 Timothy
 
 On Mon, Oct 31, 2011 at 8:00 AM, Dennis Haupt 
  wrote: isn't openGL a bit of
 overkill (we can just use java2d), or do you want to add a
 renderer doing all sorts of awesome stuff which totally
 contradicts the white-polygon-on-black-background graphics?
 might give the game a pretty unique look :)
 
 Am 31.10.2011 12:41, schrieb Timothy Baldridge:
>>> I'd be up for something like this. I have a fair amount
>>> of clojure experience, and I've done quite allot of
>>> work with OpenGL in other languages, so this actually
>>> sounds fun! Another option to consider, is the old DOS
>>> version of SpaceWar!
>>> 
>>> http://www.youtube.com/watch?v=yY5qHe2VadA
>>> 
>>> I like the idea of doing a Asteroids/Spacewar! clone,
>>> mostly because it would give us a chance to introduce
>>> Agents as the building block of the game engine.
>>> 
>>> Timothy
>>> 
>>> On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt 
>>>  wrote: 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.
>>> 
>>> 
>>> 
 
 -- 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
 
>>>

{ANN} clojure-control 0.2.1 released.

2011-10-31 Thread dennis
Clojure-control is a clojure DSL for system admin and deployment with
many remote machines via ssh/rsync.It is on github:
https://github.com/killme2008/clojure-control

0.2.1 has been released,main highlights:
First,A shell command DSL by sunny87,for example:

(cd "/home/login"
(run "ls")
(cd "bin"
(run "ls")))

(cd "/home/login"
(path "/home/login/bin"
(env "JAVA_OPTS" "-XMaxPermSize=128m"
(run "clojure"

Second,Supports ssh/scp/rsync options when defining cluster,they can
be a string or a vector:

(defcluster :mycluster
  :ssh-options "-p 44"
  :scp-options "-v"
  :rsync-options ["-arz" "--delete"]
  :clients [
   { :host "c.domain.com" :user "clogin" :ssh-
options "-v -p 43"}
   ]
  :user "login"
  :addresses ["a.domain.com" "b.domain.com"])

Third, It supports executing task in parallel now,just define cluster
by
(defcluster :mycluster
  :parallel true
  )

At last, i recommend everyone try the lein-control plugin developed by
sunny87 for using cc much more simply,please visit
https://github.com/sunng87/lein-control

-- 
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.Compile output in clojure-clr 1.3.0

2011-10-31 Thread dmiller
That is an side effect of changes that were made to naming/location of
the assemblies output from compilation.

Whether it's a feature or bug depends on how hard it is to change.  :)

Issue posted.

-David



On Oct 29, 6:58 am, Ian  wrote:
> Hi all,
>
> In Clojure 1.2.0, if I run a command like:
>
> c:\clojure\Clojure.Compile.exe program
>
> then the output .dll and .exe files turn up in the current directory
> as expected, but since 1.3.0 the output files land in the c:\clojure\
> directory (i.e. the location of the compiler), which seems rather
> strange. Is this a feature or a bug?
>
> Cheers,
> Ian

-- 
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: Please try the alphas and betas!

2011-10-31 Thread Timothy Baldridge
I'd like to second what Bill said...I don't really have the time to
setup a clojure build process to test out the 1.4 Alphas/Betas, but if
there was a way for me to get to it via lein...I would just target 1.4
for all my day-to-day development.

Timothy

On Mon, Oct 31, 2011 at 10:00 AM, Joel Gluth  wrote:
> Worth pointing out that the Clojure team don't have to do this
> necessarily - a motivated person could set up a CI server that
> monitors pre-release SNAPSHOTS on one side, and takes code
> snippets/lein projects/gists/test-is packages on the other?
>
> On Sun, Oct 30, 2011 at 4:04 PM, Colin Yates  wrote:
>> Whacky idea - is there a way for people to submit snippets which are
>> run as part of the CI process?
> --
> [what were the skies like when you were young?]
>
> --
> 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



-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
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: Please try the alphas and betas!

2011-10-31 Thread Joel Gluth
Worth pointing out that the Clojure team don't have to do this
necessarily - a motivated person could set up a CI server that
monitors pre-release SNAPSHOTS on one side, and takes code
snippets/lein projects/gists/test-is packages on the other?

On Sun, Oct 30, 2011 at 4:04 PM, Colin Yates  wrote:
> Whacky idea - is there a way for people to submit snippets which are
> run as part of the CI process?
-- 
[what were the skies like when you were young?]

-- 
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-10-31 Thread Jack Moffitt
> Unfortunately, I'm not sure a game as small as asteroids would
> work well to have multiple people working on it. Simply because each
> part of the game (graphics, physics, gui, etc.) are all so small, that
> multiple developers would just step on each other's toes.

What we need is a Clojure game jam :)

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


Re: anyone interested in a small game?

2011-10-31 Thread Timothy Baldridge
I once wrote a test game engine that handled used a one-agent per
entity approach, and the idea was that it "should" be close to
linearly scale-able. It actually worked quite well. I think in the end
I tested it with more than 10,000 entities flying in a
flocking/following pattern, and the engine ran like a dream. IIRC the
limit with 10,000 entities was more because my GPU on my laptop is
crap, and couldn't push much more than that at a single time. With
10,000 entities on my quad-core desktop the app worked like a dream.

Now all this is overkill for a small game, but it did seem to work
well. Unfortunately, I'm not sure a game as small as asteroids would
work well to have multiple people working on it. Simply because each
part of the game (graphics, physics, gui, etc.) are all so small, that
multiple developers would just step on each other's toes.

Timothy

On Mon, Oct 31, 2011 at 9:37 AM, Dennis Haupt  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> one agent per entity? i'd have done an agent for the whole world and
> apply functions like "apply-collision" and "apply-shot-fired" to it
>
> Am 31.10.2011 14:46, schrieb Timothy Baldridge:
>> Haha! I forgot about Java2d... Yeah, that would work just fine.
>> No, Clojure does not support remote agents. But agents can really
>> help in a system like this to express objects as distinct entities.
>> That is, you have one object per item on the screen, and then each
>> object basically can "live" on its own:
>>
>> (send entity update-time timespan)
>>
>> (send asteroid do-split)
>>
>> etc.
>>
>> Actually, this really isn't too long of a project, at least the
>> asteroids part isn't.
>>
>> Timothy
>>
>> On Mon, Oct 31, 2011 at 8:00 AM, Dennis Haupt
>>  wrote: isn't openGL a bit of overkill
>> (we can just use java2d), or do you want to add a renderer doing
>> all sorts of awesome stuff which totally contradicts the
>> white-polygon-on-black-background graphics? might give the game a
>> pretty unique look :)
>>
>> Am 31.10.2011 12:41, schrieb Timothy Baldridge:
> I'd be up for something like this. I have a fair amount of
> clojure experience, and I've done quite allot of work with
> OpenGL in other languages, so this actually sounds fun!
> Another option to consider, is the old DOS version of
> SpaceWar!
>
> http://www.youtube.com/watch?v=yY5qHe2VadA
>
> I like the idea of doing a Asteroids/Spacewar! clone, mostly
> because it would give us a chance to introduce Agents as the
> building block of the game engine.
>
> Timothy
>
> On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt
>  wrote: 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.
>
>
>
>>
>> -- 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
>>
>>
>>
>
>
> - --
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOrrKfAAoJENRtux+h35aG8xMP/RNYGqwEAXbuovpdI1KDyiny
> fxUTQc+cppQwDNl43OwkdHlqlj7hHoWZVSshd5GoKjTBGGU/H6McILD0mKCvGUPw
> EMOSDdzORPEJkQFc/VINGzBW3veQwAy/3K6TujwyO6ChsSCGbBepSABVvAtdUHpM
> xU9CkSCu2s5iwxO25CrlsTliwV6xAAwUUkM0Rp7AR+qYco5msOPLBG0+KU/XVIPO
> hqRX82SaqifPAbk2Yx4vRoR5wamF0w4vd0rRMVENMckImI3DteX1To+k3hHwCvLt
> GJKyHwJXZRJ0JzBzUITjqfuVUI9pW+71RBh5odb13PuDNOpRou/k/JgDeTXK6e8t
> l1BKpbchs+ar1IO38mlWSvsVwYDySuzkopBH1cSgOyAgUa1Yi/0HNSA05BgXxlyZ
> voGnTGBjis/eLZ2Bdbz3EgITetxG/ypM41hlIj0QHEX6JWiAP9tCq7xvTLUVQ0a4
> zzt+knoDOatQwbn+TgtcYyfl8ObtVrMJaQhpY5PnpdN3MDXFVqJpIZ8urm2UAn9w
> 35

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

one agent per entity? i'd have done an agent for the whole world and
apply functions like "apply-collision" and "apply-shot-fired" to it

Am 31.10.2011 14:46, schrieb Timothy Baldridge:
> Haha! I forgot about Java2d... Yeah, that would work just fine.
> No, Clojure does not support remote agents. But agents can really
> help in a system like this to express objects as distinct entities.
> That is, you have one object per item on the screen, and then each
> object basically can "live" on its own:
> 
> (send entity update-time timespan)
> 
> (send asteroid do-split)
> 
> etc.
> 
> Actually, this really isn't too long of a project, at least the 
> asteroids part isn't.
> 
> Timothy
> 
> On Mon, Oct 31, 2011 at 8:00 AM, Dennis Haupt
>  wrote: isn't openGL a bit of overkill
> (we can just use java2d), or do you want to add a renderer doing
> all sorts of awesome stuff which totally contradicts the
> white-polygon-on-black-background graphics? might give the game a
> pretty unique look :)
> 
> Am 31.10.2011 12:41, schrieb Timothy Baldridge:
 I'd be up for something like this. I have a fair amount of
 clojure experience, and I've done quite allot of work with
 OpenGL in other languages, so this actually sounds fun!
 Another option to consider, is the old DOS version of
 SpaceWar!
 
 http://www.youtube.com/watch?v=yY5qHe2VadA
 
 I like the idea of doing a Asteroids/Spacewar! clone, mostly 
 because it would give us a chance to introduce Agents as the 
 building block of the game engine.
 
 Timothy
 
 On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt 
  wrote: 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.
 
 
 
> 
> -- 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
> 
> 
> 


- -- 

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

iQIcBAEBAgAGBQJOrrKfAAoJENRtux+h35aG8xMP/RNYGqwEAXbuovpdI1KDyiny
fxUTQc+cppQwDNl43OwkdHlqlj7hHoWZVSshd5GoKjTBGGU/H6McILD0mKCvGUPw
EMOSDdzORPEJkQFc/VINGzBW3veQwAy/3K6TujwyO6ChsSCGbBepSABVvAtdUHpM
xU9CkSCu2s5iwxO25CrlsTliwV6xAAwUUkM0Rp7AR+qYco5msOPLBG0+KU/XVIPO
hqRX82SaqifPAbk2Yx4vRoR5wamF0w4vd0rRMVENMckImI3DteX1To+k3hHwCvLt
GJKyHwJXZRJ0JzBzUITjqfuVUI9pW+71RBh5odb13PuDNOpRou/k/JgDeTXK6e8t
l1BKpbchs+ar1IO38mlWSvsVwYDySuzkopBH1cSgOyAgUa1Yi/0HNSA05BgXxlyZ
voGnTGBjis/eLZ2Bdbz3EgITetxG/ypM41hlIj0QHEX6JWiAP9tCq7xvTLUVQ0a4
zzt+knoDOatQwbn+TgtcYyfl8ObtVrMJaQhpY5PnpdN3MDXFVqJpIZ8urm2UAn9w
35V+SiIV3/1UOAVaEdzmCLhDMPcHCuuB09rWZ7QpcywnomDyoGmURcog7hZX64hJ
OrhqBc1j39LmNwWO1cxSn9rPITsb8tozXt3VW5hIMXPWuIw2/uVla72PNl3jS7t8
OabAgU9XWOlNQOb5Vd/4
=FyCY
-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: Dynamic test creation?

2011-10-31 Thread Nate Young
On 10/28/2011 09:42 AM, AndyK wrote:
> I am setting up tests with clojure.test that are driven by a CSV where
> each line represents one test case. Right now, there is a single
> deftest function that runs all the assertions. That's ok but creates
> reporting like 1 test was run with 1000s of assertions. Clojure being
> so dynamic, is it possible to create tests on-the-fly and run them
> where each dynamic test represents each row so that the reporting says
> X tests (where X == number of CSV rows).
> 
> I'm fairly new to clojure and quite unfamiliar with the ins-and-outs
> of clojure.test.
> Any pointers here would be appreciated.
> 
> Thank you
> 
It absolutely would be possible, and furthermore this is an area where
macros really shine.

I would choose macros because from what you describe, it sounds like
you'd like to write a program that generates a bunch of deftest forms,
and then runs those tests. But you need language facilities like reading
from a csv file in order to do so. Clojure (and indeed all lisps) give
you this ability.

You could write a macro that reads in the CSV file and for each line,
generates a deftest form. Below is a quick sketch of what it might look
like if your CSV file consisted of two columns of values that were
supposed to be equal to each other.

(use 'clojure.test)
(require '[clojure.java.io :as io]
 '[clojure.data.csv :as csv])

(defn testdef-form [n [expected actual]]
  `(deftest ~(str "testfromline" n)
 (is (= ~expected ~actual

(defmacro defcsvtests [filename]
  (with-open [in-file (io/reader "in-file.csv")]
(let [testdefs (csv/read-csv in-file)]
  `(do ~@(map testdef-form (iterate inc 1) testdefs)

(defcsvtests "test-cases.csv")

-- 
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-10-31 Thread Timothy Baldridge
Haha! I forgot about Java2d... Yeah, that would work just fine. No,
Clojure does not support remote agents. But agents can really help in
a system like this to express objects as distinct entities. That is,
you have one object per item on the screen, and then each object
basically can "live" on its own:

(send entity update-time timespan)

(send asteroid do-split)

etc.

Actually, this really isn't too long of a project, at least the
asteroids part isn't.

Timothy

On Mon, Oct 31, 2011 at 8:00 AM, Dennis Haupt  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> isn't openGL a bit of overkill (we can just use java2d), or do you
> want to add a renderer doing all sorts of awesome stuff which totally
> contradicts the white-polygon-on-black-background graphics? might give
> the game a pretty unique look :)
>
> Am 31.10.2011 12:41, schrieb Timothy Baldridge:
>> I'd be up for something like this. I have a fair amount of clojure
>> experience, and I've done quite allot of work with OpenGL in other
>> languages, so this actually sounds fun! Another option to consider,
>> is the old DOS version of SpaceWar!
>>
>> http://www.youtube.com/watch?v=yY5qHe2VadA
>>
>> I like the idea of doing a Asteroids/Spacewar! clone, mostly
>> because it would give us a chance to introduce Agents as the
>> building block of the game engine.
>>
>> Timothy
>>
>> On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt
>>  wrote: 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.
>>
>>
>>
>>>
>>> -- 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/
>
> iQIcBAEBAgAGBQJOrpwDAAoJENRtux+h35aGBx4P/RXFWjr+zFQMjA49bHobnOKY
> PbepwqpwunucJ9M6zp0MDnudoXWDyE2zCG7QgAf/ZgaSoI4+4KvRL5IwYgPwBDO2
> rgAEMSyK30/HLnSnn5zgTrFRRTNde2oCFMB5soE5qYNvRKB0lXJ58DbKHF3f21H9
> NXPwz4x6GU1Vs1w9Kx94Skx+Rf4mJKX7sN6choI8ENOE8dEiXiyTFdqO1cNjPZyR
> iimmEhaXzwjkHCcCPiLo1rTSn14yNty0EObNvo/WhFqK/4Y3YP7NR9tWrHJSN5ll
> Sc4n9+B+qpaHrun+QvjIE41vXaMF3LPrXLRM9tM042ImRdvy210eVBU5h1riGA97
> R/0c9fm6L4UbeuhS/SBVEg3m9bdL62dcxOmDcYi0kuYrNRRcBbioptEYCxiyhcmy
> bna6/k6UZX+YeLNtvXBk49+K2fQElC3TIzEmIkotMd3Q0gjhhSsoYgcW3uCvWLy1
> 0RNSPSmKmQ9m6Htif/yO2dCnCVadO/nJgqeE8LsDMhtLlh8gj4Q+x3ppU6cxtiEP
> S9mGISRv6Sk6p88TVHZGVKXEHLaRuhWrfC0Nu1mTQQEwm3ilQ10ipSLrnvlGfvBs
> eqCqVJpXtx/m6cvtLLczB3WoKpsGvLhDJMq0TFxYMIKbws726YdpN/VRaEMSkGFm
> YJWqDYGOPOubGge4tJbn
> =JTgF
> -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



-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
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-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

isn't openGL a bit of overkill (we can just use java2d), or do you
want to add a renderer doing all sorts of awesome stuff which totally
contradicts the white-polygon-on-black-background graphics? might give
the game a pretty unique look :)

Am 31.10.2011 12:41, schrieb Timothy Baldridge:
> I'd be up for something like this. I have a fair amount of clojure 
> experience, and I've done quite allot of work with OpenGL in other 
> languages, so this actually sounds fun! Another option to consider,
> is the old DOS version of SpaceWar!
> 
> http://www.youtube.com/watch?v=yY5qHe2VadA
> 
> I like the idea of doing a Asteroids/Spacewar! clone, mostly
> because it would give us a chance to introduce Agents as the
> building block of the game engine.
> 
> Timothy
> 
> On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt
>  wrote: 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.
> 
> 
> 
>> 
>> -- 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/

iQIcBAEBAgAGBQJOrpwDAAoJENRtux+h35aGBx4P/RXFWjr+zFQMjA49bHobnOKY
PbepwqpwunucJ9M6zp0MDnudoXWDyE2zCG7QgAf/ZgaSoI4+4KvRL5IwYgPwBDO2
rgAEMSyK30/HLnSnn5zgTrFRRTNde2oCFMB5soE5qYNvRKB0lXJ58DbKHF3f21H9
NXPwz4x6GU1Vs1w9Kx94Skx+Rf4mJKX7sN6choI8ENOE8dEiXiyTFdqO1cNjPZyR
iimmEhaXzwjkHCcCPiLo1rTSn14yNty0EObNvo/WhFqK/4Y3YP7NR9tWrHJSN5ll
Sc4n9+B+qpaHrun+QvjIE41vXaMF3LPrXLRM9tM042ImRdvy210eVBU5h1riGA97
R/0c9fm6L4UbeuhS/SBVEg3m9bdL62dcxOmDcYi0kuYrNRRcBbioptEYCxiyhcmy
bna6/k6UZX+YeLNtvXBk49+K2fQElC3TIzEmIkotMd3Q0gjhhSsoYgcW3uCvWLy1
0RNSPSmKmQ9m6Htif/yO2dCnCVadO/nJgqeE8LsDMhtLlh8gj4Q+x3ppU6cxtiEP
S9mGISRv6Sk6p88TVHZGVKXEHLaRuhWrfC0Nu1mTQQEwm3ilQ10ipSLrnvlGfvBs
eqCqVJpXtx/m6cvtLLczB3WoKpsGvLhDJMq0TFxYMIKbws726YdpN/VRaEMSkGFm
YJWqDYGOPOubGge4tJbn
=JTgF
-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-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

seems to be pretty similar to asteriods. we can just do an engine that
can do both. at the same time.

does clojure support remote agents?


Am 31.10.2011 12:41, schrieb Timothy Baldridge:
> I'd be up for something like this. I have a fair amount of clojure 
> experience, and I've done quite allot of work with OpenGL in other 
> languages, so this actually sounds fun! Another option to consider,
> is the old DOS version of SpaceWar!
> 
> http://www.youtube.com/watch?v=yY5qHe2VadA
> 
> I like the idea of doing a Asteroids/Spacewar! clone, mostly
> because it would give us a chance to introduce Agents as the
> building block of the game engine.
> 
> Timothy
> 
> On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt
>  wrote: 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.
> 
> 
> 
>> 
>> -- 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/

iQIcBAEBAgAGBQJOrpI5AAoJENRtux+h35aG4TYQAI/fKfaddP0UAotFk44WekQs
joW3ea7v84rcg6qsCgQe0by0Zsa+oYP2nlQ4lneTu9VT4JQHC3MpLesRVYQ3qLQv
7VrBvuifLb84UeHWZhlYflMApVDr0l200anaHEhXbgxbG38MR0oBsAVg6wP5gx6a
TW17BSAIPEmu4XqMQxD9yYJvJMoMsKwDrA2Yguj7/hgJh3znNlADZZ6JVqKMv6h3
IyyYkDaYBJNAAhZiEm8zV1BVgzA6Lyh/IgBCWg2/o2oq4OkcjL2UBd2suvRO/gVS
24bBJoPHn+w2XVaplBWsxF/lEPnogOo9CeK5MOnaTVIA2Jq0e6cCnSM30OSsQ5UU
2kdnU6dOZ6VNocfL80T5b2eFvTjQKU6k3GIPV03FP6LxvRT8g/y5qqecTYlBW7G2
KJXY0Xw7otHQcaQxQD4kF//FCyim2+bQj5i//MhKzeMGRLr6CE8fSgov2nmwd6M8
yuCdip7bzOEsw2Bzr4iiC1dTp3pZhqLSIeDUJgFCI35argB4rai0RKne0eTly1fj
1jaQKddTY1mDrPKKsuKSwVAxFj6LeVHnBrdyzIr/9fEC/ccThIB8HoZmHbGU4jOZ
EwU9rCGNyd/lY1AcA6ou1MR2YY+MtlTmep7gczUHwelAsqbBxK3HS/2puPgQuOl+
8J+pEDcccpqAXRCKRSrp
=z8nu
-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-10-31 Thread Timothy Baldridge
I'd be up for something like this. I have a fair amount of clojure
experience, and I've done quite allot of work with OpenGL in other
languages, so this actually sounds fun! Another option to consider, is
the old DOS version of SpaceWar!

http://www.youtube.com/watch?v=yY5qHe2VadA

I like the idea of doing a Asteroids/Spacewar! clone, mostly because
it would give us a chance to introduce Agents as the building block of
the game engine.

Timothy

On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> 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.
>
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOrZhRAAoJENRtux+h35aGzE4P/2llb/0Pfy/qJSjK0pEM/plD
> ySU/CYupObaI3aZN+1aK8LwCQmiznyk6AUa8UcdO9fYcvEXDTBvHbWJUpimG0gUC
> pMUuL/wfTqB232gtuNbYMc6zYRoN3ddq4yZIq0QFnbqXI8PaxjQJBaS7J+5DZEGG
> JXaaA9RpTL6mnyTxxlw29BwHgmsv+xxbu09yAg8VHABD2TcuRUuz81OKmHTUxxhm
> 1ZtlP9dw+jVzryNUHfE3lygn+stfIJxC3ui3cf4Rfham+CbhjpseClkXWA4nNYYF
> tqsQHxxe76CewXbQBpnKhqPvB9REo+qGdADi6camML5k+i6FYen4QXIvh5bF8PmO
> jkOFQZLN2t05pPEmq+lamMmpb3LA2VLVv4zC/m9mEgrJ/rB34Ewv1upU76Qme+OB
> r/++jgFeb0OcjdFs4kvJpF7wKFKHJv0nMfyzKnzrx4D0HckrpQdsBGsXjhDqsvZQ
> 6QwamOZhk9yugPlqgEy3eN6VrKxY9JawQ0H6e5P+DD0F7UyDbYtBk/HcEx916Kjj
> CBNEIwImHoR/0uA7Dyzrn08LoaTcej7kSA06UOkOiRaw71T9EnQuOjDDabrzmsyk
> Go/R+rPMlgFTpdt6w43dnmmXqrOfKJqmFrvYztKBAulVoibY0ZSkwmKd/cftiYNw
> WSOA0yQMG5qN1pBmpiCk
> =j+7J
> -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



-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
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 Conj extracurricular activities spreadsheet

2011-10-31 Thread Fogus
I've added everyone to this thread as an editor of the spreadsheet.
Please feel free to add yourself and your sessions at your leisure.

-- 
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 Conj extracurricular activities spreadsheet

2011-10-31 Thread Michael
Can someone add me (michael.campbell) to:

The web and Clojure and
Java Dependency Injection Using Clojure

Many 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