Re: Why do map/get and similar return nil if not found?

2016-01-12 Thread Dennis Haupt
i agree with the fast fail camp
if a value is nil but is not supposed to be, i want the program to
immediately tell me about that instead of telling me later and force me to
trace it back.

in scala, this is solved by providing 2 methods. one that gives you a
result or crashes, one that maybe gives you a result and never crashes,
depending on your use case.

2016-01-12 23:03 GMT+01:00 Gregg Reynolds :

>
> On Jan 12, 2016 2:25 PM, "mattias w"  wrote:
> >
> > Clojure and Erlang are very similar, except for the syntax, macros and
> that you can use Java libraries.
> >
> > There is one big difference: In Erlang, fail as early as possible is the
> norm. In Clojure it is almost the opposite.
> >
> > Many errors in Clojure code will result in nil, and most operations
> accept nil as a valid parameter, i.e. many fails will not even be visible
> unless you check the result.
> >
> > The most common I stumble on is assuming that a value exists in a map,
> but that is just the top of the iceberg
>
> Not finding what you're looking for is not failure.  Nil means you have
> successfully discovered that you can't always get what you want.  There is
> no error there.
>
> Gregg
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: DSL in RTL (Right to Left) languages.

2015-01-14 Thread Dennis Haupt
i encountered a german progamming language once. it was terrible.
everybody should stick to english when it comes ot programming - you have
to do it anyway, and there is no reason not to go ahead and learn a
language since that is what brains are built for

2015-01-14 17:11 GMT+01:00 Jesse Alama jesse.al...@gmail.com:

 On Wednesday, January 14, 2015 at 2:42:57 PM UTC+1, clojur...@gmail.com
 wrote:


 Thanks Jan,

 Good idea!

 It is just a hobby project for now... I am thinking of a language for
 kids (8+) . Would be interesting to see how kids react to programming in a
 more familiar language.


 Some similar work has been with قلب.  It's a Scheme-like language
 written entirely in Arabic.  Article about the language:

 http://www.theregister.co.uk/2013/01/25/arabic_programming_language

 GitHub repo:

 https://github.com/nasser/---

 Jesse


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


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


Re: Considering dropping Eclipse 3.x support for counterclockwise

2014-12-04 Thread Dennis Haupt
yuno


2014-12-04 11:45 GMT+01:00 Laurent PETIT laurent.pe...@gmail.com:

 The following Eclipse names are 3.x based : Indigo, Helios, Galileo

 The following are 4.x based : Juno, Kepler, Luna

 2014-12-04 11:17 GMT+01:00 Laurent PETIT laurent.pe...@gmail.com:

 Hello,

 Eclipse 4.x has been around for many years now, and I'm considering
 dropping definitely the support for Eclipse 3.x.

 This would simplify ccw internals (merge 2 plugins which are separate due
 to this), and also allow ccw to embrace Eclipse 4.x APIs in more areas than
 today (today only User Plugins use Eclipse 4.x APIs).

 Before committing to this choice, I'd like to hear from you if some think
 it's still too early to do so.

 Cheers,

 --
 Laurent Petit




 --
 Laurent Petit

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


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


Re: shenandoah

2014-03-13 Thread Dennis Haupt
i also did an asteroid game in clojure. i don't think you can ever achieve
the performance of hackedyhack-mutablility with pure functional algorithms
- my approach to get the best performance while staying as clean as
possible would be to keep two copies of the game world, using one as source
data and generating the next version into the other, and vice versa.
similar to double buffering.
as long as you can guarantee that objects in the working copy are just
data that is not referenced anywhere, you can pretend that an initAll
method on an object is nothing else than a fully working constructor - just
that the object you initialize is initially filled with random data instead
of not yet existing.
you can pretend it's new, and pretend your algorithms are functional^^


2014-03-13 0:19 GMT+01:00 Jacob Goodson submissionfight...@gmx.com:

 Let me state that, as long as it is a asteroids clone, it is fine.
 However, compared to Java, the performance was much worse(when just playing
 with it and drawing tons of asteroids in opengl).  Also, I do not know what
 you mean when you say that you have tested it... the

 pure way or the mutate objects in place way?  I can get great performance
 with clojure, no doubt about it, by violating the shat out of functional
 programming.  I can not get great performance with the beautiful, pure,
 composable, clojure that I desire!  I have seen many game

 examples in clojure where, basically, clojure is just a scripting
 language that wraps java.  It is no problem if this is the case, my
 question has jack crap to do about getting good performance writing
 asteroids.  My question is: Will clojure(the immutable composable side)

 benefit from shenandoah(blasted font) at all?  Can someone who knows a
 good bit about clojure tell me if a more powerful garbage collector would
 allow us clojurians to be more pure or is it something else inherently in
 immutable land that will never(it will take a long time) get fixed.


 On Wednesday, March 12, 2014 6:53:43 PM UTC-4, James Reeves wrote:

 I've done a fair bit of experimentation with writing games in Clojure,
 and I haven't noticed any major performance issues. If you're getting
 issues on a 2D asteroids clone, I suspect there might be something
 inefficient in your code. I find Criterium useful for benchmarking parts of
 my code in isolation to get an idea of how its running.

 - James


 On 12 March 2014 21:53, Jacob Goodson submissio...@gmx.com wrote:

 How many people have heard of this GC?  http://www.jclarity.com/2014/
 02/19/shenandoah-a-new-low-pause-garbage-collection-
 algorithm-for-the-java-hotspot-jvm/

 I want to know if this would benefit clojure.  I wrote a small asteroids
 game in clojure and the performance was not good.  I stuck to purity when
 writing the game, only mutating my data after it had passed through a
 bazillion pure functions.  I was wondering, would a GC like this one(or
 Azul's) make a significant impact so that I, or others, could make games in
 a more pure fashion?  I WANT MY EFFIN PURITY!

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com

 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com

 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@googlegroups.com.

 For more options, visit https://groups.google.com/d/optout.


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


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

Re: Do I have to have knowlegde about Lisp

2014-03-10 Thread Dennis Haupt
you can learn clojure without learning lisp first :)


2014-03-10 15:41 GMT+01:00 Roelof Wobben rwob...@hotmail.com:

 Hello,

 I like the idea of Clojure but I wonder if I have to know a lot of Lisp to
 work with Clojure.

 What is the best way to go from a absolute beginner to someone who can
 work with Clojure.

 Roelof

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


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


Re: JRE/JVM for development

2014-01-29 Thread Dennis Haupt
my vm starts up within a second or so, what's the problem for you?


2014-01-29 ton...@gmail.com

 Are there any Java VMs strictly for development use that could be started
 up quicker, use less memory or compile clojure during execution?
 Alternatively can OpenJDK or similar be configured to do so? I don't care
 about application performance during development.

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


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


Re: equality

2014-01-27 Thread Dennis Haupt
one does not simply compare floating point numbers for equality


2014-01-27 Eric Le Goff eleg...@gmail.com

 Newbie question :

 user= (= 42 42)
 true
 user= (= 42 42.0)
 false

 I did not expect last result.

 I understand that underlying classes are not the same
 i.e
 user= (class 42)
 java.lang.Long
 user= (class 42.0)
 java.lang.Double


 but anyway I'am surprised

 Cheers


 --
 Eric

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


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


Re: Read Microsoft Word .doc files in Clojure

2014-01-02 Thread Dennis Haupt
use apache poi and write a small wrapper or something
this is what i did


2014/1/2 Joshua Mendoza joshua.m...@gmail.com

 Hi!,

 I've been looking for libraries or resources to read MS .doc files in
 Clojure, but found none. Does anyone have tried, used, encountered or
 witnessed such a thing to read them?

 I found a lot of info publicly available by the government in .doc files
 but I want to process them automatically with Clojure.

 The closest thing I know is using Incanter but to read XLS files, which is
 not useful at all for this...

 Well, any help would be great.

 Thank you!

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


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


some clojure experience

2013-12-31 Thread Dennis Haupt
i solved a few little thingy with clojure now, including some euler
problems, java interop and an asteroids clone.

my summary would be:
* very nice to write +1. i used clojure's collections for a lot of things,
and they made a good impression
* you need to plan far ahead compared to java. in java, it's easy to
hack-fix something if it doesn't work by adding a field somewhere and
read its value later, or add a parameter to a call hierarchy. i know this
isn't the way it should be done, but sometimes code quality is irrelevant
(for example if you are just making some experiments)
* the effort to modify code is either very low, or very high - in java, it
was kind of always the same. in clojure, it seems to depend a lot on the
existing code.
* debugging is impossible (or very hard) if you want to debug like you are
used to do it in java - meaning stop if condition x is true and evaluate
expressions at that point. i made some mistakes that i would have
immediately seen in a standard debug session, but i don't know how i could
have seen it in clojure. i needed to think a lot more or add debug output
to understand those bugs - like flipping x and y in a grid. so, fixing bugs
took longer than it takes in java.
* how do you deal with complex data structures? since i cannot tell what
the type of a parameter is, it could be anything, including a map with
unknown content. i can only see which properties of it are immediately
accessed. is that the trick? to not care about what you don't care about?
and having something like hallucinated interfaces?

what are your experiences?

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


Re: Is Clojure right for me?

2013-12-26 Thread Dennis Haupt
exactly which part of OOP is missing in clojure that you would like to use?
if you took my java code and ported it to clojure, the main difference
would be (a b) instead of b.a , but the main design would be similar


2013/12/26 Massimiliano Tomassoli kiuhn...@gmail.com

 On Thursday, December 26, 2013 7:51:39 PM UTC+1, James Reeves wrote:

 On 26 December 2013 16:32, Massimiliano Tomassoli kiuh...@gmail.comwrote:

 Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm
 a little bit worried about the absence of support for OOP in Clojure. How
 do you decompose large systems in Clojure?


 You write functions. To quote Alan J. Perlis:

 It is better to have 100 functions operate on one data structure than to
 have 10 functions operate on 10 data structures.


 Classes or objects are not simple data structures.


 IMO, OOP just makes it harder to build modular systems, because OOP
 involves a lot of implicit connections between components. Clojure, and
 other functional languages, tend to emphasise isolation more.


 Why implicit? Objects communicate through well-defined channels. OOP can
 certainly be misused but it served me well for over 20 years (C++/C#). And
 Scala proves that FP and OOP are orthogonal paradigms. I can't see how the
 lack of OOP is a good thing for Clojure, honestly. I'm willing to give up
 mutability because I never programmed that way and I believe it can be a
 good thing (after I get used to it), but giving up OOP means going back to
 something I already know and I don't like.

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


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


Re: How to go about 'proving' why dynamically typed languages are better.

2013-12-20 Thread Dennis Haupt
in my mental world, there is a pure human, and a 4 armed human would
probably be a 95% human or something, just like a hobbit would be. the
other way round, a human would be a 95% hobbit. an elephant would be 4%
hobbit on that scale.
this model is flexible, covers everything, and is not really helpful when
you ask what is it? you have to ask is this at least 90% cat?


2013/12/20 Phillip Lord phillip.l...@newcastle.ac.uk

 zcaudate z...@caudate.me writes:
  @philip lord.
 
  Where would mutant elephants and the elephant god Ganesha fit in that
 classification?


 It might surprise you to know that there is actually quite a lot work on
 both of these.

 The problem with mutant elephants generalises into the problem with
 abnormalities; for example, if I build a model of a human which says,
 humans have two hands, and two legs then there are plenty of counter
 examples, having more or less than two hands (mostly less). If, on the
 other hand, you have a model which can cope with these exceptions, then
 it gets too complex to handle, and you can rarely conclude anything
 useful.

 Ganesha causes a different problem: that is does he exist at all, and if
 he does, is he an elephant. Now there are those who say no he isn't, so
 he shouldn't be in the model. And, there are those (like me) who say,
 well it depends on your application and what you are trying to achieve.

 Farcical as all of this sounds, it does actually have implications for
 the way that we build data models, particularly for biology and
 medicine. If you are interested, you can read my paper on the subject
 here:

 http://www.russet.org.uk/blog/1713

 And a companion article by my co-author. It's about unicorns, but most
 of it probably covers Ganesha also.

 http://robertdavidstevens.wordpress.com/2011/05/26/unicorns-in-my-ontology/

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


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


Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
let's see...
really used:
sql
java
javascript
basic
pascal/delphi
scala

experimented with:
logo (some old language intended to teach people to make their first steps)
haskell
kotlin
clojure

seen in action:
php
groovy

still prefer smart static typing :D




2013/10/9 Nando Breiter na...@aria-media.com


 The best explanation of these misunderstandings I've come across is What
 to Know Before Debating Type Systems:

 http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/


 I have learned quite a lot from reading this article and following this
 discussion, particularly that type and type checking is much more
 nuanced and complex than I have understood until now, and that the terms
 static and dynamic expand into a much larger range of issues upon close
 examination, such as the difference between explicitly declaring types (as
 in Java) and implicitly inferring types from code context. Quoting from the
 article:

 *Many programmers approach the question of whether they prefer static or
 dynamic types by comparing some languages they know that use both
 techniques. This is a reasonable approach to most questions of preference.
 The problem, in this case, is that most programmers have limited
 experience, and haven’t tried a lot of languages. For context, here, six or
 seven doesn't count as “a lot.”*
 *
 *

 So I can say I prefer dynamic typing, but the reasons are more personal,
 and molded by my development experience.

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


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


Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
especially haskell  scala are missing in your list :)
as long as you haven't at least seen haskell, you haven't seen the creme de
la creme of statically typed languages


2013/10/9 Softaddicts lprefonta...@softaddicts.ca

 Let's see:

 strong data typing:

 Fortran
 Cobol
 Pl/1
 Pascal
 C/C++
 Java
 C#
 Ruby

 à la carte data typing or no data typing at all:

 Basic (more or less depending on the implementation)
 Lisp
 Clojure
 A dozen assemblers
 A dozen scripting languages

 And I probably forgot some while excluding the ones I worked with
 (Algol, Simula, GPSS, ...) in academic projects. I used the above ones
 on real projects at work and not small projects.

 Lets keep SQL out of the picture, it's an exaggeration to call this a
 programming
 language.

 Still prefer less data typing or no typing at all :)

 Luc P.


  let's see...
  really used:
  sql
  java
  javascript
  basic
  pascal/delphi
  scala
 
  experimented with:
  logo (some old language intended to teach people to make their first
 steps)
  haskell
  kotlin
  clojure
 
  seen in action:
  php
  groovy
 
  still prefer smart static typing :D
 
 
 
 
  2013/10/9 Nando Breiter na...@aria-media.com
 
  
   The best explanation of these misunderstandings I've come across is
 What
   to Know Before Debating Type Systems:
  
   http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/
  
  
   I have learned quite a lot from reading this article and following this
   discussion, particularly that type and type checking is much more
   nuanced and complex than I have understood until now, and that the
 terms
   static and dynamic expand into a much larger range of issues upon
 close
   examination, such as the difference between explicitly declaring types
 (as
   in Java) and implicitly inferring types from code context. Quoting
 from the
   article:
  
   *Many programmers approach the question of whether they prefer static
 or
   dynamic types by comparing some languages they know that use both
   techniques. This is a reasonable approach to most questions of
 preference.
   The problem, in this case, is that most programmers have limited
   experience, and haven’t tried a lot of languages. For context, here,
 six or
   seven doesn't count as “a lot.”*
   *
   *
  
   So I can say I prefer dynamic typing, but the reasons are more
 personal,
   and molded by my development experience.
  
   --
   --
   You received this message because you are subscribed to the Google
   Groups Clojure group.
   To post to this group, send email to clojure@googlegroups.com
   Note that posts from new members are moderated - please be patient with
   your first post.
   To unsubscribe from this group, send email to
   clojure+unsubscr...@googlegroups.com
   For more options, visit this group at
   http://groups.google.com/group/clojure?hl=en
   ---
   You received this message because you are subscribed to the Google
 Groups
   Clojure group.
   To unsubscribe from this group and stop receiving emails from it, send
 an
   email to clojure+unsubscr...@googlegroups.com.
   For more options, visit https://groups.google.com/groups/opt_out.
  
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
 Groups Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 --
 Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad!

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


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For 

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-08 Thread Dennis Haupt
while i can see the strengths of both sides, the ideal solution is imho
this:

everything is statically typed. always. but you *never* have to write
the type explicitly. you *can* do it, but it is always optional.

i made good experiences with both scala and haskell (although i just
wrote minor things in the latter). the compiler really helps spotting
oops-errors early on, and the ide (in case of scala) has a lot of
information about the code and can assist you in ways that are simply
impossible without static typing.

please, do not confuse java with static typing. static typing could
also track all supported methods of an object as its type. imagine java,
but let every class implement one interface for each method that can be
called on it - its inferred type is, instead of just a simple class, the
set of interfaces necessary for the code to compile.
to actually write that would be completely annoying, but if a compiler
actually does the work for you and breaks it down, you would have a lot
of error checking and static information without losing much flexibility

Am 09.10.2013 00:36, schrieb Kendall Shaw:
 Some things that I see most of the time when I read debates about
 dynamic vs static are:
 
 1. Statically defined types don't solve everything, so they are not useful.
 
 Some help is better than no help even if the help doesn't solve all of
 your problems.
 
 Yes, you should wash your hands before dinner, even though we are all
 going to die in the end anyway.
 
 2. I like static typing as long as it is optional
 
 In the case where the point of using statically defined types is to have
 a compiler catch problems instead of you needing to predict their
 occurrence then static typing would have to be non-optional.
 
 3. You don't need the compiler to warn you about types, because you can
 write tests.
 
 A difficult problem is one that occurs on a rare occasion in some place
 that you would not have thought to check. So, you can't expect to be
 able to catch them with tests. If the problem is one that would have
 been flagged as a compile-time error, then in that case it would have
 been useful to have been using static typing.
 
 I am still unsure. It seems likely that the usefulness of statically
 defined types would depend upon the application. When using statically
 defined types makes development slower to an extent that outways the
 benefit, then it is bad. If  faster initial development as a result of
 dynamic typing ultimately ends up taking more time because of problems
 that would have been caught by a compiler, then it is bad. If statically
 defined typing makes you not discover things you would have because of
 the overhead of dealing with the static typing, then that is bad.
 
 Kendall
 
 
 On 10/05/2013 08:35 PM, zcaudate wrote:
 I'm a little bit miffed over this current craze of `types` and
 `correctness` of programs. It smells to me of the whole `object` craze
 of the last two decades. I agree that types (like objects) have their
 uses, especially in very well defined problems, but they have got me
 in trouble over and over again when I am working in an area where the
 goal is unclear and requirements are constantly changing. 

 BTW... This is no means a criticism of all the type system work that
 is going on in the clojure community. I am a huge fan of Ambrose's
 Typed Clojure project because it gives me the *option *of using
 types... not shoving it down my throat. I like the freedom to choose.

 My experience of programming in clojure has freed me from thinking
 about types and hierarchies and this article rings so true:
 http://steve.yegge.googlepages.com/is-weak-typing-strong-enough.

 However, everywhere I look, there are smug type-weenies telling me
 that my dynamically typed program is bad because it cannot be `proven
 correct` and not `checked by the compiler`. This question on SO really
 makes me
 angry 
 http://stackoverflow.com/questions/42934/what-do-people-find-so-appealing-about-dynamic-languages
 because no one is defending dynamic languages on there. The reason is
 very simple. because we don`t have a theory to back us up!

 I do want to put up an counter argument against this barrage of abuse
 against dynamic languages. And I want to put some academic weight
 behind this. The only counter I could come up with was to use Godel's
 incompleteness theorem. For those that don't know... here is an
 introduction to the man and his theory.
 http://www.youtube.com/watch?v=i2KP1vWkQ6Y. Godel's theorem,
 invalidated Principia Mathematica as a complete system of description.
 Principia Mathematica btw  effectively led to Type Theory.


 According to http://en.wikipedia.org/wiki/Type_theory. The types
 of type theory were invented by Bertrand Russell in response to
 his discovery that Gottlob Frege's version of naive set theory was
 afflicted with Russell's paradox. This theory of types features
 prominently in Whitehead and Russell's Principia 

Re: too circular?

2013-08-29 Thread Dennis Haupt
thx again


2013/8/30 Bruno Kim Medeiros Cesar brunokim...@gmail.com

 This exact use case is covered by letfn, which creates a named fn
 accessible to all function definitions and the body. That even allows
 mutual recursive definitions without declare. Your example would be

  (defn fib-n [n]
(letfn [(fib [a b]

 (cons a (lazy-seq (fib b (+ b a)]
  (take n (fib 1 1

 Note that its grammar is

 (letfn [fnspecs*] exprs*)
 fnspec == (fname [params*] exprs)

 That is, don't forget to surround a function definition with parentheses
 as above, and not as

 (letfn [fib [a b] ...])
 CompilerException java.lang.IllegalArgumentException: Don't know how to
 create ISeq from: clojure.lang.Symbol

 The reason is that letfn accepts multiple definitions, and as each
 function can have multiple expressions as in a do form, you can't just
 partition the vector as you do in let.

 On Thursday, August 29, 2013 4:32:00 PM UTC-3, Jim foo.bar wrote:

 On 29/08/13 20:23, JvJ wrote:
  I wonder if the somewhat counterintuitive concept of a named
  anonymous function eludes some people, or isn't properly conveyed in
  tutorials.

 I only consider #(...) as an anonymous function. The longer form (fn []
 (...)) has the potential of being perfectly named, it's just you who
 doesn't give it a name usually...

 Jim

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


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


Re: too circular?

2013-08-27 Thread Dennis Haupt
thx


2013/8/26 Marshall Bockrath-Vandegrift llas...@gmail.com

 Dennis Haupt d.haup...@gmail.com writes:

  (defn fib-n [n]
  (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)]
  (take n (fib 1 1
 
  can't i do a recursion here? how can i achieve this without doing an
  outer defn?

 You just need to give the anonymous function a name it can use to refer
 to itself for (non-tail) recursion:

 (defn fib-n [n]
   (let [fib (fn fib [a b] (cons a (lazy-seq (fib b (+ b a)]
 (take n (fib 1 1

 -Marshall

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


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


Re: profiler?

2013-08-27 Thread Dennis Haupt
yep, yourkit


2013/8/27 Jay Fields j...@jayfields.com

 What are you all using these days? I've been using YourKit and I'm
 fairly happy with it. Just making sure I'm not missing out on some new
 hotness.

 Cheers, Jay

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


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


too circular?

2013-08-26 Thread Dennis Haupt
(defn fib-n [n]
  (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)]
(take n (fib 1 1

can't i do a recursion here? how can i achieve this without doing an outer
defn?

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


multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
i found example that i can do
(defmethod x 5 [y] (do stuff))

but can i do
(defmethod #( % 10) [y] (do stuff)) somehow? like in a pattern match of
haskell/scala?

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




Re: multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
i see
thx


2013/6/23 László Török ltoro...@gmail.com

 you need a dispatch functions that produces discrete dispatch values
 using your example:

 (defmulti x #(cond
( % 10) :less-than-10
   ;;... further conditions producing different dispatch
 values
 ))
 ;; dispatch on the dispatch values
 (defmethod x :less-then-10 [x] (do ))

 Hope it helps

 Las


 2013/6/23 Dennis Haupt d.haup...@gmail.com

 i found example that i can do
 (defmethod x 5 [y] (do stuff))

 but can i do
 (defmethod #( % 10) [y] (do stuff)) somehow? like in a pattern match of
 haskell/scala?

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






 --
 László Török

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




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




Re: can't compile anything except def

2013-06-23 Thread Dennis Haupt
plugin version is 0.5.286

Am 23.06.2013 00:25, schrieb Colin Fleming:
 Which version of the IntelliJ plugin are you using? You can see this by
 opening the settings, selecting plugins then selecting the La Clojure
 plugin. In recent versions the compiler has changed and I've had
 occasional problems with it.
 
 
 On 23 June 2013 02:29, Dennis Haupt d.haup...@gmail.com
 mailto:d.haup...@gmail.com wrote:
 
 it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to
 compile clojure files, something strange happens. if i remove the
 option to compile the files (and instead just use clojure.main and
 run them) there is no problem
 
 
 
 
 2013/6/22 Jim - FooBar(); jimpil1...@gmail.com
 mailto:jimpil1...@gmail.com
 
 On 22/06/13 15:21, Dennis Haupt wrote:
 
 clojure jvm, intellij's repl. i'll try to run the file via
 commandline and see what happens
 
 
 where did core.clr come from then?
 
 can you somehow see what version of clojure your intelliJ is
 using? I've got no experience with intelliJ really...it's just
 that your error you reported earlier is very weird...
 
 
 Jim
 
 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 mailto:clojure@googlegroups.com
 Note that posts from new members are moderated - please be
 patient with your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@__googlegroups.com
 mailto:clojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/__group/clojure?hl=en
 http://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the
 Google Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from
 it, send an email to clojure+unsubscribe@__googlegroups.com
 mailto:clojure%2bunsubscr...@googlegroups.com.
 For more options, visit
 https://groups.google.com/__groups/opt_out
 https://groups.google.com/groups/opt_out.
 
 
 
 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 mailto:clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient
 with your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 mailto:clojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it,
 send an email to clojure+unsubscr...@googlegroups.com
 mailto:clojure%2bunsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  
 
 
 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 

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




multimethod noob question

2013-06-22 Thread Dennis Haupt
hi,

i was taking a look at multimethods:
(defmulti fac int)
(defmethod fac 1 [_] 1)
(defmethod fac :default [n] (*' n (fac (dec n

this works

however, this also works:

(defmulti fac print)
(defmethod fac 1 [_] 1)
(defmethod fac :default [n] (*' n (fac (dec n

what exactly is int or print doing? it doesn't seem to have an effect?

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




can't compile anything except def

2013-06-22 Thread Dennis Haupt
hi,

i'm trying to compiler a clojure file using intellij. the error i get is:
Clojure Compiler: java.io.IOException: The system cannot find the path
specified, compiling:(D:\cloj\MultiMethod.clj:3)

where the line number is pointing at a line that contains something that is
declared in core.clr
if i use only def, everything works, i can compile the file

what's the problem?

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




Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
i don't know what properly set up the environment means exactly, but i
can run my script in the repl


2013/6/22 Jim - FooBar(); jimpil1...@gmail.com

 On 22/06/13 15:09, Dennis Haupt wrote:

 where the line number is pointing at a line that contains something that
 is declared in core.clr


 core.clr and intelliJ? I've never used intelliJ but I was under the
 impression it was JVM only...

 are you sure you've got the right version of Clojure and properly set up
 your environment?

 Jim

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




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




Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
i am not trying anything, i just want to figure out what happens. this is
my output for the print version:
user= (defmulti fac print)
(defmethod fac 1 [_] 1)
(defmethod fac :default [n] (*' n (fac (dec n
#'user/fac
#MultiFn clojure.lang.MultiFn@1afb02d
#MultiFn clojure.lang.MultiFn@1afb02d
user= (fac 1)
10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until
stackoverflow


2013/6/22 Chris Bilson cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com writes:

  i was taking a look at multimethods:
  (defmulti fac int)
  (defmethod fac 1 [_] 1)
  (defmethod fac :default [n] (*' n (fac (dec n
 
  this works
 
  however, this also works:
 
  (defmulti fac print)
  (defmethod fac 1 [_] 1)
  (defmethod fac :default [n] (*' n (fac (dec n

 This definately does not work when I try it:

  user (defmulti fac print)
  #Var@6427854d: #MultiFn clojure.lang.MultiFn@4bddef9a
  nil
  user (defmethod fac 1 [_] 1)
  #MultiFn clojure.lang.MultiFn@4bddef9a
  nil
  user (fac 1)
  IllegalArgumentException No method in multimethod 'fac' for dispatch
 value: null  clojure.lang.MultiFn.getFn (MultiFn.java:160)
  1

 The second arg to defmulti's job is to decide which method to call. The
 print function always produces nil, so you would need a defmethod for
 dispatch value nil to use print as a dispatch function:

 user (defmethod fac nil [_] 2)
 #MultiFn clojure.lang.MultiFn@4bddef9a
 nil
 user (fac 1)
 12
 nil

 Notice the 12: the 1 is from print and the 2 is the value the
 method produced.

 Are you trying to print the dispatch values so you can see them for
 tracing or something? If so, you could try something like:

 user (defn inspect [ stuff]
 (println inspect:  stuff)
 (first stuff))
 #Var@5b1413a8:
   #user$eval336$inspect__337 user$eval336$inspect__337@68903261
 nil
 user (inspect 1)
 inspect:  (1)
 1
 nil
 user (defmulti fac2 inspect)
 nil
 nil
 user (defmethod fac2 1 [_] 1)
 #MultiFn clojure.lang.MultiFn@e2df60d
 nil
 user (fac2 1)
 inspect:  (1)
 1
 nil
 user


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




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




Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
clojure jvm, intellij's repl. i'll try to run the file via commandline and
see what happens


2013/6/22 Jim - FooBar(); jimpil1...@gmail.com

 On 22/06/13 15:16, Dennis Haupt wrote:

 i don't know what properly set up the environment means exactly, but i
 can run my script in the repl


 what repl? intelliJ's repl? or a bare repl from your terminal?

 do you want to use Clojure JVM or Clojure CLR?


 Jim

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




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




Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
running the file works (from inside intellij), just intellijs compilation
seems to be broken i can ignore the problem for now


2013/6/22 Dennis Haupt d.haup...@gmail.com

 clojure jvm, intellij's repl. i'll try to run the file via commandline and
 see what happens


 2013/6/22 Jim - FooBar(); jimpil1...@gmail.com

 On 22/06/13 15:16, Dennis Haupt wrote:

  i don't know what properly set up the environment means exactly, but i
 can run my script in the repl


 what repl? intelliJ's repl? or a bare repl from your terminal?

 do you want to use Clojure JVM or Clojure CLR?


 Jim

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .





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




Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to
compile clojure files, something strange happens. if i remove the option to
compile the files (and instead just use clojure.main and run them) there is
no problem




2013/6/22 Jim - FooBar(); jimpil1...@gmail.com

 On 22/06/13 15:21, Dennis Haupt wrote:

 clojure jvm, intellij's repl. i'll try to run the file via commandline
 and see what happens


 where did core.clr come from then?

 can you somehow see what version of clojure your intelliJ is using? I've
 got no experience with intelliJ really...it's just that your error you
 reported earlier is very weird...


 Jim

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




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




Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
yes. all glory to the repl that makes me figure out the internals via
experiments :D
is there a way to just pass the given value along?


2013/6/22 Chris Bilson cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com writes:

  i am not trying anything, i just want to figure out what happens. this
 is my output for the print version:
  user= (defmulti fac print)
  (defmethod fac 1 [_] 1)
  (defmethod fac :default [n] (*' n (fac (dec n
  #'user/fac
  #MultiFn clojure.lang.MultiFn@1afb02d
  #MultiFn clojure.lang.MultiFn@1afb02d
  user= (fac 1)
 
 10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until
  stackoverflow

 Since print produces nil for a dispatch value, and nil is not 1, it
 always calls your :default method.

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




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




Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
(ns experiments.MultiMethod)
(defmulti fac identity)
(defmethod fac 1 [n] (print n: n - ) 1)
(defmethod fac :default [n] (*' n (fac (dec n
(print (fac 125))

if i am getting this right, defmethod fac stuff [stuff2] is the
equivalent to a scala or haskell pattern match, where stuff is the match
and stuff2 is the complete set of original arguments?

can you provide an example where stuff2 has more information than stuff?
for fac, both are equal

thx :D


2013/6/22 Dennis Haupt d.haup...@gmail.com

 yes. all glory to the repl that makes me figure out the internals via
 experiments :D
 is there a way to just pass the given value along?


 2013/6/22 Chris Bilson cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com writes:

  i am not trying anything, i just want to figure out what happens. this
 is my output for the print version:
  user= (defmulti fac print)
  (defmethod fac 1 [_] 1)
  (defmethod fac :default [n] (*' n (fac (dec n
  #'user/fac
  #MultiFn clojure.lang.MultiFn@1afb02d
  #MultiFn clojure.lang.MultiFn@1afb02d
  user= (fac 1)
 
 10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until
  stackoverflow

 Since print produces nil for a dispatch value, and nil is not 1, it
 always calls your :default method.

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





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




Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
identity :)


2013/6/22 Chris Bilson cbil...@pobox.com

 Dennis Haupt d.haup...@gmail.com writes:

  yes. all glory to the repl that makes me figure out the internals via
 experiments :D
  is there a way to just pass the given value along?

 Yes, that's what I meant by my inspect method in my original reply. It
 prints the value and passes it along:

(defn inspect [ args]
  (println inspect: args)
  (first args))

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




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




Re: clojure diffs

2013-06-07 Thread Dennis Haupt
intellij can do exactly what you want


2013/6/7 Moocar anthony.mar...@gmail.com

 Hi all,

 Diffs for clojure code (and lisps in general) can be hard to read. Every
 time we wrap a form, any lines below are indented. The resulting diff just
 shows that you've deleted lines and added lines, even though you've only
 changed a few characters.

 What diff tools do people use to address this? I've found ediff is useful
 in emacs, but what I really want is a way to see good diffs in github pull
 requests.

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




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




Re: Why is this code so slow?

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

Am 03.02.2013 14:28, schrieb Jules:
 The Scala version is probably faster because it uses a range (1 to top)
 which is represented as a pair of integers (the start and endpoint).
 Perhaps the JVM can even eliminate that completely with escape analysis.
 The Java version is repeatedly filling an ArrayList with the numbers in
 that range.
 
 On Sunday, February 3, 2013 12:19:51 PM UTC+1, Casper Clausen wrote:
 
 Given that I don't know much about how scala does optimizations, I
 find the question of why the scala version is faster than the Java
 version even more interesting.
 
 It seems to me that in Scala, the list (don't know the actual data
 type which is created) of 1 to 20 is created each
 time isDivisibleByAll is called which (probably?) creates some
 overhead. 
 
 The Java version doesn't create the list for each check, but it uses
 an ArrayList where it could use an array and Integer where it could
 use int - shenedu makes that optimization in the buttom, but it only
 improves about half a second according to him.
 
 So what's going on the Scala version?
 
 On Sunday, February 3, 2013 3:28:09 AM UTC+1, Alexandros Bantis wrote:
 
 Hello all. I'm working through the Project Euler problems in Java,
 Scala,  Clojure (trying to learn all three?!?). I notice that
 for one
 particular problem, I use--more or less--a similar algorithm for
 all
 three, but the clojure code runs about 20-30 times slower than the
 java/scala versions. Does anyone have any idea why this might
 be? It
 strikes me that it might have something to do with every? but I
 don't
 know because I'm a newbie with Clojure.
 
 
 http://stackoverflow.com/questions/14668272/what-can-i-do-to-speed-up-this-code
 
 http://stackoverflow.com/questions/14668272/what-can-i-do-to-speed-up-this-code
 
 
 thanks,
 
 alex
 
 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  


-- 

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




Re: is intellij idea a good ide for clojure development?

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


2013/1/29 Laurent PETIT laurent.pe...@gmail.com

 Hello Jay,

 I'd like to learn a little bit more from what makes you prefer emacs
 over IntelliJ.
 As the main developer of Counterclockwise, I'm I could learn some
 ideas, if not lessons, from your experience.

 Some questions and remarks inline:

 2013/1/28 Jay Fields j...@jayfields.com:
  I used IntelliJ for clojure dev for almost 3 years. About six months ago
 I
  finally took the time to learn emacs, and I strongly regret not doing it
  much earlier. There are too many reasons to list, but it all comes down
 to a
  simple question for me: do you want the ability to easily automate tasks
  that you often repeat?

 Is this really the core of your concerns? Are you talking about the
 ability for you to write new elisp scripts, or to benefit from a bunch
 of existing elisp scripts from the emacs community? Is this mostly
 related to the fact that Clojure support in IntelliJ is lacking in key
 areas? Or is it really the liberty that comes with emacs lisp that you
 value overall? (And is it overrated, or not ?)


  IntelliJ is great at automating some things (e.g. Import namespace), but
 if
  you want to extend its functionality it's a significant task.
 Conversely, I
  now open my projects with a keystroke,

 Can you describe this open my projects with a keystroke feature to me?

  start my app with a keystroke

 same question. Is it mostly (only?) leiningen apps with a repl ?

  and have the ability to eval any snippet of clojure in the context of my
 app.

  I also automated running tests, creating tests that do not exist, and
  navigating to tests.

 Can you point me to the emacs lisp which does this ? I would be
 interested in studying a little bit what kind of API it provides to
 you, the user (without digging into tons of reference material: a
 concrete example like you automating running tests would be great to
 look at)

 Thanks,

 --
 Laurent

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




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




Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Dennis Haupt
Am 29.01.2013 23:05, schrieb Phil Hagelberg:
 
 Jay Fields writes:
 
 On Tue, Jan 29, 2013 at 11:45 AM, Laurent PETIT laurent.pe...@gmail.com 
 wrote:
 Hello Jay,

 I'd like to learn a little bit more from what makes you prefer emacs
 over IntelliJ.
 As the main developer of Counterclockwise, I'm I could learn some
 ideas, if not lessons, from your experience.

 Sure, responses inline-
 
 While it's great to list features, the specific features really aren't
 the point--the point is that new features can be added with very little
 friction. If you had to restart the program and lose all the state
 you've built up just to try out a new command you're going to be less
 likely to bother with it, but if you can just open up your dotfiles,
 bash out a new defn and try it incrementally, you're going to be more
 likely to experiment with the little things.
 
 I blogged (ranted?) a bit about this a while ago: http://technomancy.us/115
 
 But perhaps it's redundant to praise at length the benefits of a
 repl-driven workflow to this audience. =)
 
 -Phil
 

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

-- 

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




is intellij idea a good ide for clojure development?

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

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




Re: why is nth called here?

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


2012/12/11 Dennis Haupt d.haup...@gmail.com

 i just saw my error :/


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


 --



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

max doesn't return max?

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

(ns euler.Problem8)

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

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

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


why is nth called here?

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

(ns euler.Problem125)

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

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

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

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

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

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

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

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


Re: why is nth called here?

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


Am 11.12.2012 22:22, schrieb Ben Wolfson:
 nth is called in doing the destructuring for the argument lists in
 your fns defined in try-find-sequence.
 
 On Tue, Dec 11, 2012 at 1:20 PM, Dennis Haupt d.haup...@gmail.com wrote:
 i am trying to solve euler problem 125. when i tested this code:

 (ns euler.Problem125)

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

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

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

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

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

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

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

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


-- 

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


Re: help choosing dev environment for clojure

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

Am 25.11.2012 17:57, schrieb Jay Fields:
 I spent 3 years doing Clojure (for prod apps) in IntelliJ. 3 months ago
 I switched to emacs - and would never go back. 
 
 If the idea of customizing your dev environment to automate repetitive
 tasks is appealing to you, start learning emacs immediately. I deeply
 regret not learning emacs earlier. If you just want to get things done
 and don't care too much about your development env, stick with eclipse
 or IntelliJ. 
 
 Sent from my iPad
 
 On Nov 25, 2012, at 8:39 AM, Sol Tourne artists...@yahoo.com
 mailto:artists...@yahoo.com wrote:
 

 hello -- 

 There are a few resources out there to help one getting started with
 emacs+clojure, eclipse+ccw, etc. but I haven't found so far a resource
 helping me decide which learning curve to climb: the pros and cons of
 sweating to learn eclipse/ccw versus sweating learning the emacs
 ecosystem, etc.

 In making that choice, my priority is an environment that complements
 the REPL with a debugger that allows me to step through the execution,
 peek at values at intermediate stages of the computation, evaluate
 expressions within that intermediate stage, etc. Given that, does
 anybody have advice for a newcomer? 

 thanks in advance -- hoping this doesn't initiate a holy-war-of-IDEs...


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


-- 

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


Re: Efficiency of Dijkstra's algorithm

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


2012/11/21 Sergey Didenko sergey.dide...@gmail.com

 I have used mutable code working on Java structures when I was
 implementing the kind of Dijkstra algorithm. As long as it is
 encapsulated in a function it seems quite a good approach to me.

 And also quite readable given the amount of mutable Dijkstra examples
 in the Internet.

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


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

Re: Clojure to Haskell Compiler

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

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


-- 

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


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

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

Am 26.09.2012 06:45, schrieb Leonardo Borges:
 Hi Gregorius!
 
 I think Clojure is a great way to start to learn to program! Clojure
 is a flavour of lisp and so is Scheme - which has been used for
 decades to teach programming to MIT undergrads.
 
 In terms of resources on learning functional programming I think The
 Little Lisper is a terrific book:
 http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992
 
 And if yearn for more advanced things later on, SICP - the actual text
 book used at MIT - can be found for free online here:
 http://mitpress.mit.edu/sicp/
 
 Both books use scheme but I believe you should be able translate the
 examples to Clojure without too much effort.
 
 just my 2c.
 
 Best of luck!
 
 Leonardo Borges
 www.leonardoborges.com
 
 
 On Mon, Sep 24, 2012 at 4:11 PM, Gregorius R. gzym...@gmail.com wrote:
 Hello Clojurists!

 I'm a person in middle age (you know, too old to rock'n'roll, to young to
 die) and would like to programm but starting with functional programming.
 Regarding this i have some questions:

 is clojure a good start to learn programming?
 which (prerfer free online) is a good tut to start?
 am i to old for this stuff?

 thnx in advance for all responses
 Greg

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


-- 

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


Re: language shootout / the phonecode study

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

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


-- 

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


Re: language shootout / the phonecode study

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

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

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

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


-- 

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


Re: language shootout / the phonecode study

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

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

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

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

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


-- 

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


language shootout / the phonecode study

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

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

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

if enough people volunteer i'll set something up

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

Re: language shootout / the phonecode study

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

2012/9/20 David Nolen dnolen.li...@gmail.com

 On Thu, Sep 20, 2012 at 10:52 AM, Dennis Haupt 
 d.haup...@googlemail.comwrote:

 i stumbled upon this:
 http://page.mi.fu-berlin.de/prechelt/phonecode/

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

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

 if enough people volunteer i'll set something up


 Let me know if you want to see a ridiculously concise solution using
 core.logic ;)

 David

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

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

Re: language shootout / the phonecode study

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

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


-- 

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


Re: language shootout / the phonecode study

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

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


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


-- 

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


Re: 'functional' performance VS 'imperative' complexity

2012-08-25 Thread Dennis Haupt
+1

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

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

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


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

Re: real-world usage of reducers?

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

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

a reducer would have been a functional alternative to this


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


-- 

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


Re: Boolean

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

Am 07.04.2012 17:28, schrieb Softaddicts:
 Hi,
 
 You are not in the Clojure play ground when you use (Boolean. false).
 
 This expression creates a Java object, hence (if any-java-object ...)
 always evaluate the true branch in Clojure.
 
 In Clojure, anything not nil is true except false which is equivalent to the 
 Java
 false value.
 (if false) (if nil ...) will both evaluate the false branch.
 
 In your specific case, (if (.booleanValue (Boolean. false)) ...) would 
 correctly
 evaluate since booleanValue returns the value in the object, not the
 object itself.
 
 If you can, stay in Clojure and avoid Java for a while until you get more
 code lines behind you.
 
 Hope I am clear enough, just woke up :)
 
 Luc
 
 
 Hi,

 I am using Clojure for a month now. I like it a lot so far, but there
 are a couple of little details that make me very afraid. Foremost:

 (if (Boolean. false) jesus christ)

 will return jesus, not christ. Googling this on the net, I found
 that this is a known phenomenon, and some rationalizations of why this
 is the correct thing to do (it is not, sorry Rich).

 I could live with this, but I have code that is written completely in
 clojure, and does not create Boolean objects in any explicit way, or
 uses third-party libraries except for the stuff in clojure.core and
 slingshot. Nevertheless, somehow Boolean objects seem to creep into
 live, and I have code like that:

 (if (:leaf m-node)
 
 ...
 )

 that breaks because of it. I am using from the github repository
 ( 14428c296de483ea666bd874701046e7088e545c).

 This means that I cannot trust my code on the most basic level, and
 this is unacceptable.


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

 --
 Softaddictslprefonta...@softaddicts.ca sent by ibisMail!
 


-- 

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


Re: Boolean

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

Am 07.04.2012 22:49, schrieb Michael Klishin:
 Steven Obua:
 
 (if (Boolean. false) jesus christ)

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


-- 

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


Re: Best IDE

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

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


2012/1/18 Jay Fields j...@jayfields.com

 I'm not running the community edition (and I'm not sure if you are
 either). I've updated to the latest LaClojure (when I upgraded to
 IntelliJ 11). I've evaluated expressions successfully in the past, and
 when I set a breakpoint I can see locals.

 That said, when I tried to do those things and capture a snapshot my
 IntelliJ crashed. So, for whatever reason I'm getting more
 functionality than you are, but it's not exactly coming for free.

 I would love it if La Clojure got more love, but I'm not holding my breath.

 On Wed, Jan 18, 2012 at 4:00 PM, Dennis Haupt d.haup...@googlemail.com
 wrote:
  when i say debugging, i mean inspect fields and evaluate expressions.
 
  i attached a screenshot of all i get: a useless stacktrace and no
  variables. how do you debug?
 
 
  Am 18.01.2012 21:29, schrieb Jay Fields:
  intelliJ debugging support and find usage both got much better when I
  moved to IntelliJ 11. Also, you can auto-complete class names with
  ctrl+alt+space and it auto-imports.
 
  I'd still recommend emacs for Clojure only work, but the IntelliJ
  support has gotten much better.
 
  On Wed, Jan 18, 2012 at 3:27 PM, Dennis Haupt d.haup...@googlemail.com
 wrote:
  Am 18.01.2012 21:10, schrieb Sean Corfield:
  On Wed, Jan 18, 2012 at 10:42 AM, Dennis Haupt 
 d.haup...@googlemail.com wrote:
  there is no really good ide (analysis, error highlighting, debugging)
 
  Hmm, I have error highlighting and debugging. Not sure what you mean
  by analysis.
 
  call hierarchy, find usage, stuff like that.
  what tool do you use? i could neither debug in intellij nor netbeans
 
 
  --
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient
 with your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
 
 
 
  --
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en

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


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

Re: are non programmers the better programmers?

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

2012/1/18 Baishampayan Ghose b.gh...@gmail.com

 On Wed, Jan 18, 2012 at 3:16 AM, James Reeves jree...@weavejester.com
 wrote:
  To borrow from Stuart Halloway: simplicity ain't easy.

 +1. Simplicity comes with experience.

 Nevertheless, my entry -

 (defn odd-occurrences [coll]
(for [[k v] (frequencies coll) :when (odd? v)]
k))

 Regards,
 BG

 --
 Baishampayan Ghose
 b.ghose at gmail.com

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


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

Re: Best IDE

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

Am 18.01.2012 17:18, schrieb Jay Fields:
 Use emacs, if you want the path of least resistance for writing pure
 clojure code. You'll have the most support from the community.
 
 Use whatever IDE you already use for Java, if you need to do a decent
 amount of interop.
 
 I use both emacs (pure clj projects)  IntelliJ (when doing interop)
 and don't have much trouble swapping back and forth when working on
 different projects.
 
 On Wed, Jan 18, 2012 at 11:08 AM, Devin Walters dev...@gmail.com wrote:
 Clooj is an option. I learned emacs when I started, but I've tried textmate, 
 ccw, la clojure, enclojure, etc.

 My suggestion is: Don't spend too much time trying to be right in which 
 editor you choose. I've seen people using just about every editor under the 
 sun to write clojure. Learning the language is more important than the 
 environment you edit in. If you don't know what you want I'd try clooj to 
 give you some frame of reference to evaluate other environments.

 Experience reports are welcome.

 Sent via mobile

 On Jan 17, 2012, at 9:28 PM, Sean Corfield seancorfi...@gmail.com wrote:

 On Tue, Jan 17, 2012 at 1:38 PM, Josef Frydl josef_fr...@mac.com wrote:
 Can you please recommend the Best IDE for Clojure? I have Eclipse
 NetBeans and JetBrain already installed.

 Two possible answers:
 * use whichever IDE you're already most familiar with and install the
 appropriate Clojure plugin
 * use Emacs :)

 By which I mean to imply that there's no objective Best IDE for
 Clojure - it will depend on what you're used to already, what you're
 looking for, and how much you're willing to learn in an IDE, just to
 program in Clojure.

 When I first started with Clojure, I used TextMate with the Clojure
 bundle. It was great for working on Clojure code independent of
 everything else. It was basic, functional and did what I needed at the
 time.

 Once I started using Clojure at work, I installed CounterClockWise
 because I already used Eclipse at work and I had a definite workflow
 that I wanted Clojure to fit into. CCW is awesome - kudos to Laurent
 and Chas (and everyone else who has contributed to it).

 As Clojure started to become my primary language, I wanted a more
 Clojure-centric workflow and I wanted things that CCW doesn't (yet)
 provide such as code completion / auto-suggest, debugging... I also
 wanted something more lightweight than Eclipse so that I could have
 the same environment on both my low-powered netbook while traveling
 and my quad core 16GB RAM desktop. So I switched to Emacs.
 Technically, I switched _back_ to Emacs after about 20 years of other
 editors and IDEs. The first week was very painful(!) but soon I found
 myself more productive and enjoying working with Clojure even more.
 For all sorts of reasons, Emacs is still the primary choice for
 Clojure developers - see Chas Emerick's State of the Union survey
 for 2011: 
 http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/

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

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

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


-- 

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


Re: Best IDE

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

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


-- 

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


are non programmers the better programmers?

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

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

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

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

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

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

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

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

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


Re: are non programmers the better programmers?

2012-01-17 Thread Dennis Haupt
Am 17.01.2012 22:17, schrieb Cedric Greevey:
 On Tue, Jan 17, 2012 at 3:46 PM, Dennis Haupt d.haup...@googlemail.com 
 wrote:
 after the wtfs have worn off a bit, go on reading.
 imagine a simple problem: you have a collection of numbers and you have
 to write a function which collects all the numbers that are contained
 uneven times. for example, for a collection (1,2,3,2,3,4) the correct
 result is (1,4)

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

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

 i also asked some oo programmers. one of the answers involved a
 multimap, building it, iterating over it again and putting the result in
 a new list. one answer was i don't see any purpose in this.
 there was no FP coder around at that time.
 
 FWIW,
 
 (defn odd-occurrences [x]
   (map first
 (filter
   (fn [[_ v]] (odd? v))
   (frequencies x
 
 Signed,
 An FP coder
 
 :)
 

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

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

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

-- 

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


Re: are non programmers the better programmers?

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

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

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

i'd say they require different strategies to find

 
 - James
 


-- 

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


Re: are non programmers the better programmers?

2012-01-17 Thread Dennis Haupt
Am 17.01.2012 23:08, schrieb daly:
 On Tue, 2012-01-17 at 21:46 +0100, Dennis Haupt wrote:
 after the wtfs have worn off a bit, go on reading.
 imagine a simple problem: you have a collection of numbers and you have
 to write a function which collects all the numbers that are contained
 uneven times. for example, for a collection (1,2,3,2,3,4) the correct
 result is (1,4)

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

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

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

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

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

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

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

 
 Unfortunately you are reasoning in the small. Real systems have very
 complex webs where some particular piece of code hangs. The code depends
 on a LOT of other factors. I have attached a simple piece of algebra
 code that is REALLY strongly typed and implements Algebraic Function
 Fields in Axiom. It does an amazing amount of work in a relatively
 trivial bit of code. It implements perfectly clear algorithms and was
 written by a world-class computational mathematician. 
 
 I have other examples from my Magnus project in the area of infinite
 group theory. A few lines of C++ code is all you need to write to 
 implement fundamental algorithms. The code is perfectly clear to the
 author. It correctly and efficiently implements the ideas. I won't
 bother with an example but, trust me, the code is as opaque as a brick.
 
 There is the good code meme that all you need to do is use clear
 variable names, properly indented code, and strong typing and *poof*,
 the code is easy to understand. This meme is widespread and wrong.
 It isn't wrong in the sense of good coding but it is being 
 mis-applied, trying to cover human to human communication.
 
 The problem is that understanding is based on communicating *ideas*
 between people. Code is intended to communicate *actions* to a 
 machine

Re: i am so bored

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

Am 14.01.2012 16:43, schrieb Joseph Smith:
 How about a native I/O library that'll detect the platform and architecture 
 at runtime? Something like java 1.7's nio, but they'll work on clojure hosted 
 on 1.5.x? Make use of JNA to make native calls to get file system details, 
 etc. 
 
 Right now you cannot even stat a file from clojure without calling the stat 
 command from a shell. :/
 
 
 ---
 Joseph Smith
 j...@uwcreations.com
 (402)601-5443
 
 
 On Jan 14, 2012, at 6:12 AM, Dennis Haupt d.haup...@googlemail.com wrote:
 
 hi there,

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

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

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

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


-- 

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


i am so bored

2012-01-14 Thread Dennis Haupt
hi there,

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

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

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

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


Re: i am so bored

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

did you upload your stuff to github yet?

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


-- 

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


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

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

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


-- 

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


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt

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

what would you have done differently?

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


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt

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

where would that have been useful?

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


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt
Am 07.11.2011 10:18, schrieb Dennis Haupt:
 


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

 
 where would that have been useful?

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

instead of

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

?

-- 

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


Re: Another newbie question

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

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

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


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


-- 

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


Re: problems of a newbie

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

which is a good thing. type safety is good.

-- 

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


Re: problems of a newbie

2011-11-07 Thread Dennis Haupt
Am 07.11.2011 14:01, schrieb Milton Silva:
 
 
 On Nov 7, 12:41 pm, Milton Silva milton...@gmail.com wrote:
 On Nov 7, 9:14 am, Dennis Haupt d.haup...@googlemail.com wrote:

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

 what would you have done differently?

 Generally, I think the best approach is, to represent everything with
 seqs, work with them and then display them. Something close to 
 thishttps://github.com/ztellman/penumbra/blob/master/test/example/game/as...
 
 Maybe this last post isn't very clear. Look at your split-asteroid.
 that fn is either doing much more than splitting asteroids or you have
 the wrong representation of asteroids. I have no idea which is it
 because I cannot understand it(It is doing too much at a time). Now
 look at the split-asteroid in the resource I gave you.
 

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

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

what i learned so far:

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

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

-- 

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


Re: problems of a newbie

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



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

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

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

let [_ (println like this?)]

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


-- 

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


Re: Another newbie question

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

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

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

the clojure-equivalent would be functions in namespace

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

laziness is the key.

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

it was me :D

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

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

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

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

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


-- 

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


Re: anyone interested in a small game?

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

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

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

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



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

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

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


Re: problems of a newbie

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

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

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

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

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

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

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

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


Re: problems of a newbie

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

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

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

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

that whole dynamically typed thing is creeping me out.


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


- -- 

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

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

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


Re: problems of a newbie

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

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

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

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

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





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

Re: problems of a newbie

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

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

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

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

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

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

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

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

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

Re: problems of a newbie

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

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

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

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


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

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

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

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

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

done

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


-- 

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


Re: problems of a newbie

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

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

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

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

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

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

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

Yes, there's a trade off
 in that you can pass the wrong data but if you're test-driving your
 code (whether you do it in your head, in the REPL or with physical
 tests in code) and building it in small pieces, there's much less risk
 of doing so (IMO  IME).
 
 with mutable states, i can hide that one additional parameter for the
 one special case that would otherwise ruin my design by using a secret
 static threadlocal or whatever else does the job. this is a pact with
 the devil that will backfire when a certain threshold is reached, but it
 *is* faster than doing a small refactoring every time.
 
 Faster overall, or just faster to the next marker post (and then a
 technical debt has accrued which must be repaid at some point)...

ime, you have to refactor your oo-stuff sooner or later (requirements
can change) so you might as well save the small stuff for the big
refactoring that is coming anyway.

 
 i'm

Re: problems of a newbie

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

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

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

 
 On Nov 6, 2011 11:49 AM, Dennis Haupt d.haup...@googlemail.com
 mailto:d.haup...@googlemail.com wrote:
 
 special cases that depend on mutable state are evil. i avoid mutable
 states as much as possible, no matter which language i am using.
 what i meant were cases where i roughly think about 3/4 of all cases,
 start coding and along the way i notice that in one case in need
 another input parameter for my function and have to refactor
 everything i have written so far.
 
 my experience is that you need to balance out planning and actual
 coding. there's a limit for planning. if you plan too much, it won't
 help. you'll just introduce problems and won't notice it because you
 are skipping the reality check. reality never misses a case, but even
 the smartest guy/gal does :)
 
 what i do in random oo language is to just start somewhere and code
 recursively. as soon as something gets to complex, i split it up or do
 minor refactorings. this works pretty good and i rarely end up in a
 situation where i have to go back a big step. i rarely lose speed,
 even if i encounter a surprise.
 
 i'll become faster once i get used to clojure, but i doubt i'll be
 able to be as fast as in scala or java. this is not because the
 language itself is bad. java is really verbose, but that doesn't
 matter at all. i don't write java code. i use intellij idea. it writes
 and rewrites java code for me.
 with equal tool support, i'd prefer clojure over java.
 
 
 
 
 
 Am 06.11.2011 14:48, schrieb Colin Yates:
 But aren't the edge cases fewer given the notion that functions
 should be entirely defined by their inputs as oppose to being
 dependant on mutable state external to he function, in the most
 part.
 
 I am agreeing with you, and find these real world experiences
 incredibly useful.
 
 Sent from my iPad
 
 On 6 Nov 2011, at 13:03, Dennis Haupt d.haup...@googlemail.com
 mailto:d.haup...@googlemail.com
 wrote:
 
 Am 06.11.2011 13:44, schrieb Colin Yates:
 I have a hunch (as oppose to IME as I don't have any yet :))
 that Clojure doesn't require as much due to at least the
 following points:

 - there is much less incidental complexity and ceremony
 required to manage (and therefore refactor) - implementations
 in Clojure require more thought and are much more focused on
 one thing then in Java, therefore there is a much higher
 chance that you get it right the first time
 
 this is a double edged sword. you *do* get it right *if* you think
 it through, but reality is often more complex than you assume. if
 you suddenly see that you forgot to handle special case x, you are
 punished harder than in random statically typed oo language.
 
 in oo, you can do a few emergency hacks before everything
 becomes unmaintainable. in clojure, i could not do this without
 committing maintenance suicide immediately. for each case that
 popped up surprisingly, i had to do a bit of refactoring.
 
 that whole dynamically typed thing is creeping me out.
 
 

 To put it another way, how much refactoring we we do in Java
 is down to managing the complexity of the problems inherent
 in Java the language; complecting state and identity for
 example.

 A concrete example: I know I often refactor code out of one
 class into a utility once that becomes useful by other
 classes.  The reason I need to do this is because in java the
 functionality is ring fenced by the data that it works on
 (I.e. encapsulation in the container called a class).  In
 clojure that association can be made but right off the get-go
 data and functionality are separate.

 Just my two-pence worth and I still haven't written more than
 2 lines of clojure so it probably isn't worth 2p :)

 Sent from my iPad

 On 5 Nov 2011, at 12:16, Dennis Haupt
 d.haup...@googlemail.com mailto:d.haup...@googlemail.com wrote:

 hi,

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

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

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

 how did you solve these problem and get some tool-support?
 or don't

Re: see if any branch of a cond succeeded

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

what about

 (cond (= dir :left) ((move-left)(:ok)) (= dir :up)
 ((move-up)(:ok)) :else :nok)

or whatever the exact syntax is


Am 05.11.2011 08:22, schrieb Alan Malloy:
 On Nov 4, 11:49 pm, Baishampayan Ghose b.gh...@gmail.com wrote:
 On Sat, Nov 5, 2011 at 11:55 AM, Martin DeMello
 martindeme...@gmail.com wrote:
 What's the cleanest way to run a piece of code if any branch of
 a cond statement succeeded, without relying on the return value
 of the individual clauses not to be nil?
 
 For example, if I have the following piece of code that says I
 can only move left or up
 
 (cond (= dir :left) (move-left) (= dir :up)  (move-up))
 
 but (move-left) or (move-up) could themselves return nil, is
 there any nice way to check if one of them was called?
 
 What about something like this -
 
 (cond (= dir :left) (move-left) (= dir :up)  (move-up) :else
 :nok)
 
 Or
 
 (cond (= dir :left) [(move-left)] (= dir :up)  [(move-up)])
 
 Seconded. Though if you can't easily predict what
 move-left/move-up might return (ie they might even return :nok) you
 might need to be more careful. Use a namespaced keyword like
 :my-current-ns/didnt-do- anything, or a gensym (or a fresh Object)
 for guaranteed uniqueness:
 
 (let [nothing (Object.) cond-result (case dir :left (move-left) :up
 (move-up) nothing)] (if (identical? nothing cond-result) ...))
 


- -- 

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

iQIcBAEBAgAGBQJOtP9TAAoJENRtux+h35aGZ6cQALNrIXvCpEUfrLFAYgauJVWP
8cvu+gXUgCDxxcJR41MOBfDvnVOJmeiCJp0LWH3HpYGD0M+7BfJxMoyg/tdrZggn
L5CSq+oXbeOUDe/7LV7E97u8/gZhHrRNELZGyWbgHX/d0VZpezH2QwMMQKTiwwAh
zxkyUHyahJ1+Li6hrFL/1CI8XwH7JEnjgyd4Zfj2BNkkAmgS2E+iBrGYb8vMQtLo
7Pm6WBrTRjNNyrIKi6axHij2SvKdPKSzbAR3oJPjhL+5yDhrvCdHk0AvzJjiTHsK
RMxaGYjR1/hRDt97+69iJu9hxjAOZSZeCYBid4vAPsdHu+qF/K5Ngr49rnWGFp9Y
g8GkznO7q4L2Lde5WW0GRtNAGTgElEp+9cS1PSxDgyzxEw9+SaJUNLxr5cCsCp8I
dI4Gu88gNgxT6AqomMcrIFd4LyHZ3HEW+rTuFcz4oCcmFQGXHqQVJQV6wbF1NpSf
8BuEskip4mTOdVvSfciC5jLjCO3q8xT/46TAYwhyrjUecEBR9FGy/e6ImN4DILiU
nd8RvvTMKayAo3OudBcM/dN1YRzc0UijAqhFzV6/thvPNARGobGqzqwE3zKAseLY
sPW1hKbJteDHHLBbG5Ia0/QyqdpXmSkyXjS8dahiuOefjuzWxeerGDaOl3wTiw/S
o3J73WASesJ1RulPjqeW
=M8Zh
-END PGP SIGNATURE-

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


problems of a newbie

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

hi,

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

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

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

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



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

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

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


Re: a better way to write this

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

my favorite :)
thx

Am 04.11.2011 20:32, schrieb Benny Tsai:
 Oh that is cool!
 
 On Friday, November 4, 2011 12:11:43 PM UTC-6, Paul Mooser wrote:
 
 You could try using every-pred to combine your predicates, which
 I think would be equivalent:
 
 (let [full-test (every-pred type-pred bounds-check contact)] ...
 
 On Nov 4, 9:51 am, Dennis Haupt d.ha...@googlemail.com wrote:
 (let [type-pred #() bounds-check #() contact #() full-test (fn
 [element] (and (type-pred element)
 (bounds-check
 element) (contact element)))] (filter full-test (:game-elements
 @world-atom))
 
 is there a way to write the full-test in a way that doesn't force
 me to repeat the function constant text pattern inside the
 and?
 
 -- You received this message because you are subscribed to the
 Google Groups Clojure group. To post to this group, send email to
 clojure@googlegroups.com Note that posts from new members are
 moderated - please be patient with your first post. To unsubscribe
 from 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/

iQIcBAEBAgAGBQJOtE78AAoJENRtux+h35aGS7EP/ihZ8EgpG4q6WTNuzeBLsBg8
sv+etYJByD+EWg03cIWM5mop1i7YfqslOcg3nZCj7DrFYud9kCxDlxa2fTc6wxHu
+gq6VLzIi4ddcH5skfpKhqHd9ahXiWQDOXalRtKol7eL7Py208ij7NNfGjNEDbNV
OzodeDGtbywqRdgMLe4xtS3OGaQBAw8dVclcgg97h2eVkjjb61YoKex1fdCkPTsv
aSS+K4BSvfzueG+KG95Zac3az4dFtiloqMocCKN5D9FKeopDBp7JhZVwGr/BBoTx
xmU4wjI1lyxIgwPI2AcMxzawzauzGXivaavCopJ2O4NGFBfyMqHlNujRvYz1zbLh
faFePfWgOjAk8M9+ZZUpGiDHV1p9RWleAH7dmJV/qkQWBARA6WN9aM6N+wVdpVRb
aqnQVhYSAMfYNzLQw68/hJLWnnuqpli9ZHB0fCx4bdLxnsrAOP+IhLIHtq6lsO5Q
5ortpvL1334DAw24JXjGZQJoy0hNU+7VifLxMiNrwNbfTYU7tXPfUlJC1GYn2uNz
oTKXlSES1kJy4CxI1f3yCqq5UU+cW3H2Nz7VPfp/qa0tPCesArZYoe0e0FhZdypL
J9BPnne4nBX1aeB/oSC1r3x+SaVek556+qhbuFP4L0utD6PIY9PB00Ex2M0nqnco
YON/jqusioTsqOuYNOC+
=1xzD
-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


- vs - and names vs anonymous function

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

hi there,

i stumbled over two odd things
1) - and - have the same source code. why is that?
2) why can't i use (- hi #(println %)) directly? why do i have to
put my function into a symbol first? is there a way to avoid this?

(let [dummy #(println %)]
(- hi dummy))


- -- 

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

iQIcBAEBAgAGBQJOsQ9cAAoJENRtux+h35aGle8P/ih+1jVTdmrVUmF1o/QM7N06
s+bWnhkvt9qIcs+jB8dNUSIRLaDkdqQBsO6Aj7SvlGhhgjNjKyKrBBkHwAgriCXj
H95Dk4UPAvkILYe1ztLJNkYde0TbEMiOtSHRza7PWdtMChFYRhdwW5RVQxzWQd1j
VZbp681mfPh2k8NXEo1ywG0XRxpC4/gNdV9I3spfLBO/gvLgPDFHutLKzojZtTr9
Ba8HHXxseF3e9Yp/v+j2NqA05RCWgRMqjtNW0WIXOydgmsyYw/xhUQn+mHtNgd9V
43MP6Z9lbU+ZEJNnlnqP7FQ9M07g96z9iLOkPUKV3zMqwgpu3mTmWcJdN5TtPI1B
Uzt5N6Ds/9Sx4yV3MUEK4ROcN6y94zOgUYMMrE1wdR5PvSTUehPXVWp+WfoOkpxV
HO8Li4bTFIffNx8agHAv8N6U4kO513yUqNcM0HsTMwtOZ98unhWp4xcaypszQs0I
7DBoGdR6RV/bFJV2jp5vc4lGNxEpf1+RzMluh3Z9GPKjatVno2yI4MlEblhl/zXf
SHJyOplR3Csr+ojN7v5IZZrVP+EzC41eHdpAXig4pYpVi3p3P8oAfKke7sY5yHAu
kBVG+Q+gmLH4x7vkZZIu9T7JBEX/lMaGx4/pIW95inkjJKfF9rZMNc8BqN8ezqzv
z6SKrE2KpF5YTEr8CscC
=jkOp
-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: - vs - and names vs anonymous function

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

thx
*note: use macroexpand next time*

Am 02.11.2011 10:58, schrieb Jonas:
 
 
 On Wednesday, November 2, 2011 11:37:32 AM UTC+2, HamsterofDeath
 wrote:
 
 hi there,
 
 i stumbled over two odd things 1) - and - have the same source
 code. why is that?
 
 Similar, but not the same [1]: (~(firstform)~x~@(nextform)) vs.
 (~(firstform)~@(nextform)~x)
 
 
 2) why can't i use (- hi #(println %)) directly? why do i have
 to put my function into a symbol first? is there a way to avoid
 this?
 
 #(println %) expands to (fn [%] (println %)) so (- hi #(println
 %)) expands to (fn hi [%] (println %)).
 
 Note also that (- hi println) would work since it's transformed
 into (println hi). Also, the form (- hi (#(println %))) should
 also work fine.
 
 /jonas
 
 [1]
 https://github.com/clojure/clojure/blob/f5f827ac9fbb87e770d25007472504403ed3d7a6/src/clj/clojure/core.clj#L1528

 
 
 -- You received this message because you are subscribed to the
 Google Groups Clojure group. To post to this group, send email to
 clojure@googlegroups.com Note that posts from new members are
 moderated - please be patient with your first post. To unsubscribe
 from 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/

iQIcBAEBAgAGBQJOsRfHAAoJENRtux+h35aGaUwQAI5Uj2j1NYaNn6UotXvkJq9f
JlK34bLhcNu0moWb1lK7m+OQI98OmXtpdjSU1Flc14MECphQ3mst2HkP5fkh1JxE
P1RDUcLwD/pPTy1opZ7JAIi8YygBD8hSGxMYIwMLDv+YZdo6aZoDHSIFlJBcrFla
EFlDZRg7pgRcRUdCL35VUALr4AGuQ7eqtbsfaB2PXyfC6b8qW2JvICukokZofqyQ
ceO37GCc7CjpcMviAEABa+ByDSEwouiawDYkiDDdNTs9ZmsRX6PQUB9w75NQ5C5h
5mTIR/5KsMDqcGO2pNWGUOdA/d5Oj30EkUPd4pwNHwT4mgWjZbZk1aLX/CrfbRyT
KPwenuXrelFsWC7uk0xBwLJwc8Z/85CXsVYATBWItS+05yD+i41GYD4ejnpjBgUw
BiMms+T/A8vorbAjelgVs6Y53PJxndT+7wVL0Osj7HNaj/CItgMoos/yce/rOeig
jGvHo943A8OAxzAtf3LsLvHBf8xUO6eupSCVDJl891jRMdUEfLezRL2aisjXtWj5
ZXkb1rEGJHS11xm5fNBQF35JmFmNwD78zepJKqVgQjaMDVb79sSIQfmI9308F7Iy
TEanIVTCn1ZnoxZiTTy5fbFXuufMvWzrEywVdJ0os9Os8hufGBAatFikArl5OuOD
KKKLbIeI8QvLJuOAwZwE
=nyKh
-END PGP SIGNATURE-

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


Re: anyone interested in a small game?

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

got icq/skype/jabber/anything else?

Am 31.10.2011 10:37, schrieb 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
 d.haup...@googlemail.com 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/

iQIcBAEBAgAGBQJOsCRJAAoJENRtux+h35aGKMIP/R4/eC2XtQVZcK9S6xF9Btcy
BB8RN5LEQnRBp+PS6X7ZKDCGOhjzQyzJfRZYUOgCH3OZ1mgwFIPyrenkkqJZlTQj
YHG8zhlibJllcRWPhnglV6btYYg54kAWs3gRKpBWB2fn6bUFqkJRKwQreaSo8Ma0
i/vSNHWioK7AOKBv4zsJcxHs02AKd+YGRdtv/TbmLnMbSR46KLy/2Dk8YcJF5Eju
FXYXmD3Gd/SJs6qlaOKWG8cireCAzwlmNs5U41nalE+X8kxP1jNt4ryGG9vt1Uqs
HmwG7i465nnS6NUUXdF5VqgEI6m/z/uqSnEiFK3tB9bh3qRA6NPc1JibZg7G6CkN
/R1pYhXkQm354o4f+JYSfE/xOeuDGvg63IT0zMULUqCr77h49LdWnnfPnZ5Huenh
+cSh+rz6vv3vDTLWShzo+nlqOYkQEGfAbhBDZjLfkbsLjVSY4N0mIiuvN4AluwEi
GDByKp0L6jxw7NH/lofJN/Vz35CAQ5HiW5/+EsgEaeDbnM5FOyFa5PZz4lvW/GgR
lzz6/k+DQGeRO9+C/ZqQTHGfH6GkHC2atbe0I5Vp47ve1jHvcgzHgkQvetxQ1MmK
AsR27I9UVqQm4wRO/44kemavJHYuOj1xDtlvliLa9yqYgyRkLaxCQwp7LKcZpz7k
lnjy/jbsVA0c1okdbKcf
=kYM9
-END PGP SIGNATURE-

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


Re: anyone interested in a small game?

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

i went a step further:

since my asteroids are all immutable, they don't contain a renderer.
the renderer would either require a reference to the asteroids data,
position, size and so on - if that changes the renderer would be
obsolete - or would require its caller to know about the internals of
asteroid rendering to the caller can then pass the polygon, position
and so on.

both problems are solved by a rendering-factory :)

any game element carries along a renderer-factory that just requires a
a game element as a parameter. that way i can just do:
(render ((:gen-renderer game-element) game-element) target-image)

for all game elements.
if a game element get's replaced by a new version of itself, the
renderer factory can just be carried along, no need to do messy
internal updates.

decoupling rocks.

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/

iQIcBAEBAgAGBQJOsEKNAAoJENRtux+h35aGe7kP/37maMjp1c+x7yBd77HA52Xo
ap7LO0EL43jcwie28y7iK3qkRT2O12wxCpHMD9RmyCIO3g68H1CmOIrVhT9JYs5g
Q/fjsilXg9kmgHvimATTDsTRng7wg4mNIh3l9n4ZpOj11Q+Ib7aK9DEynUsr2474
PTKsIxiIscD2ZDkb4Xl0qoZBnLj9m2o3xzXTMPkNUEXEepC4MVzuFWowxWsemJ6k
zk9MuaxY7NzKYzdmtAm0UBg2RrtaFfWDSfLobpIp7g3i9es+9WpfCToCj9GdcIdS
bwCaU76AUiS2SJf9Ti8Q5DCtFw2dkICnLqBSYbp4xkO+0aU5ihdEXNF+PpEul087
ic/pxsg0jBzwwy05hngxGx9vlx1zFUjN5A3WLWFLlsWhfkBGPo90LTj+7P+t3mch
y2QLoqLZHOlRA2+r8emFJJhRXQeqHHecTEBy8q0vPPhC9QH1ejt7d4jF2yRi/rkk
UZHJxUqH8yxMzqIj27BGojJUz6UVr7JH/VwWQpuYNLn3I7ThV6J2l8xKcD00SUcX
HjLP4TpM2CT/eJTlUEzm8wzqrSQdN+2XmT5u5x4YNasz2FC61C9bd03Po8WvX2gW
bG+X2GjIaqslzRgP4/NUMkL9FVXD5OY1kkaD6ZXmysTQRNAttTu9VUHahchfsxvk
CPVHu/tMkv4A4EfQFxos
=JsnE
-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
 d.haup...@googlemail.com 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 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
 d.haup...@googlemail.com 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

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
 d.haup...@googlemail.com 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 
 d.haup...@googlemail.com 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: 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
 d.haup...@googlemail.com 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 
 d.haup...@googlemail.com 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 
 d.haup...@googlemail.com 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
 
 
 
 
 
 
 -- You received this message because you are subscribed to the
 Google Groups Clojure group. To post to this group, send email
 to clojure@googlegroups.com Note that posts from new members are
 moderated - please be patient with your first post. To
 unsubscribe from 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

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


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
 d.haup...@googlemail.com 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
 
 
 


- -- 

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

iQIcBAEBAgAGBQJOrvt3AAoJENRtux+h35aGpaUP+wRIRAEckRC/QISuwCUzeYm8

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


Can't take value of a macro aka macro noob needs help

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

i played around a bit

(defmacro times [times  exprs]
  '(let [countdown# ~times]
 (loop [remaining# countdown#]
   (when ( 0 remaining#)
 ~@exprs
 (recur (dec remaining#))

(defmacro forloop [[i end]  code]
  `(let [finish# ~end]
 (loop [~i 0]
   (when ( ~i finish#)
 ~@code
 (recur (inc ~i))

the second one works fine:
(forloop [a 4] (println a)

but when i try to do the loop without an externally applied counter
variable, i get a runtimeerror: Can't take value of a macro

what exactly does it mean? it also happend when using expandmacro, so
i guess my error is really, really obvious. but what is it?
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOrV29AAoJENRtux+h35aGEfAP/AjDZ7VpZOB7xg6xuhWfe0UO
pKH4WG5CDWF4MdezuWvS1n3D6V60cLV2DwdIS5K8TYBHnYKe6iKQwdpssNpDe4HE
3MwmYQIF8X4rbezH5XXhyR1WnWBAKJLrkTg1oB6SJNvUlotF8SnhjYTmROXX9sfV
OE+AiR0Mt8QoxKGnCBQOSDhAw0IMVdKpuAqTbfggUVJD1mQTY+fHA3kwFfh+k2UR
XWcYxRTFIEcK3guVzKBYk0FyBT9A6xBu88En7yzgBUC9fqwwmzN/Q4msIXVq2Ep4
/7p28YQnLEa+PJmQJlLN5bwEBbrsyMAvyvmVU4JbUznIc+o2mCx2Lny9Bv64NAYS
aesIxwp9Qn4enkYtvqdSfyTonEZRyA+O5gmcjPgpZfIuHYiVPgP2Kibr36T9TU5L
CjnKblyRvHyM0a0jo2hfh3D7HNPBzp11aWuB5/wJ3pxqL9yjzdmSKfTW8SWoKgYL
yObnt3e/d4Zm+yZ2+J/THP4AtTZfo4M365Swo/rypDjuecwvOXyTiGA+nbZUXF/k
j8ptkAvOQQX3GZ1btzWE4Wh9+Q0eO6wO9IopNwvwnffC9k7OZ0AebYfynzsBwv/V
LTtNKC+HGrcpvw1gxpF4rnkmjjPWHtn413GwKLNaGMBVmTZ05gofIuR2sQijBRfy
6JF2sFkMro16WxcGf0rw
=estl
-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: Can't take value of a macro aka macro noob needs help

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

your magic eye is right. using a backquote fixed it

Am 30.10.2011 15:37, schrieb David Powell:
 
 
 On Sun, Oct 30, 2011 at 2:22 PM, Dennis Haupt
 d.haup...@googlemail.com mailto:d.haup...@googlemail.com
 wrote:
 
 -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
 
 i played around a bit
 
 (defmacro times [times  exprs] '(let [countdown# ~times] (loop
 [remaining# countdown#] (when ( 0 remaining#) ~@exprs (recur (dec
 remaining#))
 
 
 It looks like you have an apostrophe in '(let - it should be a
 backquote.
 
 Also the error message is confusing because you have named the
 parameter times and the macro times with the same name.
 
 -- Dave
 
 -- You received this message because you are subscribed to the
 Google Groups Clojure group. To post to this group, send email to
 clojure@googlegroups.com Note that posts from new members are
 moderated - please be patient with your first post. To unsubscribe
 from 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/

iQIcBAEBAgAGBQJOrWkcAAoJENRtux+h35aGhXsQAKlTzH85uqEBSGQsGHwBRYZK
nn7xxj/eWbP/nmIhPiHZhBXAkgPfItQZl3SHwjwiKgs5xS8MJVFXZKhRW/2AX6RQ
jIxe2ORK+CmfZamDzeaRnf1dql32aV1qOxb2hXC/VvaAxP1bLOw1X4iykXB8kqFE
AUEMMGnilpWiihYqGGFYxlE3TzvVYUK2SCmah9CESYjW7PyR9QyiAZYvDxfGqC/G
As+JbDloapSt2FiTsNzjXZ14/qlGRhlfP3p3bdZmLlpDpzFrbPnka95QCXS7yG3P
hIvRVTUGkOec3jRWWEAXWnzEURu1LF26KB1QMuJHV+EB7tS+mqGXuwaW5mSiyi/b
U2zKdV5QePvkjk0BkXSDtKnZXP2Mydn/G7PNAwLMdMJVj+yVqV/UlbcU/68lBVRs
g/SDcaSaGzFao+V5iwXLVj4NuTTW4iAvy50nIORtc+A8ikoNhk2+X6+SVkgTo15L
/MNzDF0goC9KpKEt1hJtmJblnyaKqGmXMK45i4QBBiCoHpgYTHdDITfIFqQHBKew
YzBiNkkcS2WkEkkDeQcnsrdMiEw23LjYTz/G4p2j/+VLuKsfDp9Qegat2iVKWAup
EN2Q+302NviZSAGw12en/09k/5PNT5QeBCexHlCI6xkeu5cxJMOQwkgQDzrrZgAP
ZabbzWcl931nYi+XvKxP
=JGAi
-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


anyone interested in a small game?

2011-10-30 Thread Dennis Haupt
-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


  1   2   >