Re: Newbie question on OO/records

2011-11-06 Thread Alan Malloy
On Nov 5, 10:43 pm, Baishampayan Ghose  wrote:
> > Okay, I'm trying to understand records. I read this article:
> >http://freegeek.in/blog/2010/05/clojure-protocols-datatypes-a-sneak-p...
> > (Clojure Protocols & Datatypes - A sneak peek by Baishampayan Ghose. I
> > found it helpful, but the usage of datatypes and protocols looks/feels
> > very object-oriented to me. Am I wrong? Is it just because the
> > function comes before the record instance?
>
> > (fly hummingbird)
>
> > As opposed to calling:
>
> > hummingbird.fly() in a standard OO language.
>
> Records & Protocols are indeed a way of achieving polymorphism and is
> quite similar to class-based single dispatch found in Java, etc. Thus
> the calling conventions can look quite familiar.
>
> Having said that, records & protocols are fundamentally different from
> class based OO since unlike classes, records & protocols don't
> complect state and abstractions.
>
> In your standard OO example, the state as well as the abstraction
> method implementations "reside" in the hummingbird object. In case of
> Clojure the state is provided by the record/datatype and the method
> implementations are provided by the protocols which the record type
> chooses to extend.

Even more so, the value, state, *and* polymorphism "reside" in the
hummingbird object (as do a number of other things). With records and
protocols, the values live in the record; the polymorphism lives in
the protocol; and the state (if any) lives in whatever reference type
you use. Clojure takes the many, many features that classes and
objects typically have, and separates them each into their own place:
composable where useful, but fundamentally separate.

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

2011-11-06 Thread Baishampayan Ghose
>> Records & Protocols are indeed a way of achieving polymorphism and is
>> quite similar to class-based single dispatch found in Java, etc. Thus
>> the calling conventions can look quite familiar.
>>
>> Having said that, records & protocols are fundamentally different from
>> class based OO since unlike classes, records & protocols don't
>> complect state and abstractions.
>>
>> In your standard OO example, the state as well as the abstraction
>> method implementations "reside" in the hummingbird object. In case of
>> Clojure the state is provided by the record/datatype and the method
>> implementations are provided by the protocols which the record type
>> chooses to extend.
>
> Even more so, the value, state, *and* polymorphism "reside" in the
> hummingbird object (as do a number of other things). With records and
> protocols, the values live in the record; the polymorphism lives in
> the protocol; and the state (if any) lives in whatever reference type
> you use. Clojure takes the many, many features that classes and
> objects typically have, and separates them each into their own place:
> composable where useful, but fundamentally separate.

+1. My exact thoughts.

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


appengine-magic + servlets

2011-11-06 Thread Razvan Rotaru
Hi,

appengine-magic (https://github.com/gcv/appengine-magic) uses ring-
handlers to turn into servlets that are accepted by GAE. Does anybody
know how to use servlets directly with appengine-magic? I'm not using
ring, I have a servlet which I need to feed to appengine-magic.

Thanks,
Razvan

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

However it seems that in the lisp world, code analysis tools are that
wanted. We have Common Lisp for quite some time now, and people seem
quite happy with slime.

Razvan

On Nov 5, 2:16 pm, Dennis Haupt  wrote:
> -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: problems of a newbie

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

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

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

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

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

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

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

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


Re: problems of a newbie

2011-11-06 Thread 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

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

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

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

Sent from my iPad

On 5 Nov 2011, at 12:16, Dennis Haupt  wrote:

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

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

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

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


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


- -- 

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

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

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


Re: problems of a newbie

2011-11-06 Thread Colin Yates
But aren't the "edge cases" fewer given the notion that functions
should be entirely defined by their inputs as oppose to being
dependant on mutable state external to he function, in the most part.

I am agreeing with you, and find these real world experiences incredibly useful.

Sent from my iPad

On 6 Nov 2011, at 13:03, Dennis Haupt  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Am 06.11.2011 13:44, schrieb Colin Yates:
>> I have a hunch (as oppose to IME as I don't have any yet :)) that
>> Clojure doesn't require as much due to at least the following
>> points:
>>
>> - there is much less incidental complexity and ceremony required
>> to manage (and therefore refactor) - implementations in Clojure
>> require more thought and are much more focused on one thing then in
>> Java, therefore there is a much higher chance that you get it right
>> the first time
>
> this is a double edged sword. you *do* get it right *if* you think it
> through, but reality is often more complex than you assume. if you
> suddenly see that you forgot to handle special case x, you are
> punished harder than in .
>
> in oo, you can do a few "emergency hacks" before everything becomes
> unmaintainable. in clojure, i could not do this without committing
> maintenance suicide immediately. for each case that popped up
> surprisingly, i had to do a bit of refactoring.
>
> that whole "dynamically typed" thing is creeping me out.
>
>
>>
>> To put it another way, how much refactoring we we do in Java is
>> down to managing the complexity of the problems inherent in Java
>> the language; complecting state and identity for example.
>>
>> A concrete example: I know I often refactor code out of one class
>> into a utility once that becomes useful by other classes.  The
>> reason I need to do this is because in java the functionality is
>> ring fenced by the data that it works on (I.e. encapsulation in the
>> container called a class).  In clojure that association can be made
>> but right off the get-go data and functionality are separate.
>>
>> Just my two-pence worth and I still haven't written more than 2
>> lines of clojure so it probably isn't worth 2p :)
>>
>> Sent from my iPad
>>
>> On 5 Nov 2011, at 12:16, Dennis Haupt 
>> wrote:
>>
>> hi,
>>
>> i'm half done with my asteroids clone. i stumbled over a few
>> problems and wanted to know how others already solved them :)
>>
>> i am used to "less concrete programming". i ask my tools to do the
>> actual analysis and coding for me: * where is that used? * rename
>> that * show me all errors * add a parameter here * autocomplete
>> this for me, i am too lazy to even remember the exact method name *
>> show me a list of all methods and fields starting with an "e" that
>> fit in here. i know the one i want is in that list.
>>
>> as elegant as clojure may be as a language, it's dragging me down
>> to almost native text editing which i did more than 10 years ago
>> when i wrote a game in turbo pascal.
>>
>> how did you solve these problem and get some tool-support? or
>> don't you miss it because of something i am not aware of?
>>
>>
>>
>>>
>>> -- You received this message because you are subscribed to the
>>> Google Groups "Clojure" group. To post to this group, send email
>>> to clojure@googlegroups.com Note that posts from new members are
>>> moderated - please be patient with your first post. To
>>> unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com For more options, visit this
>>> group at http://groups.google.com/group/clojure?hl=en
>>
>
>
> - --
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOtoWuAAoJENRtux+h35aG/3gQAJEyUDT4/qMyTdgHURekwgga
> +x0x75y3hcgutZ8ij2m4B+UGfg6Yg7cjXIuwyqtbvXFVyN02/C28MSWGj2xPMP0j
> UI36zTiNzVikfafP4sxP0CLNQOBjIvH+MJ/xbFWe7p49l4hb9IWdYTJ237v1ik9h
> YL5qulyqC1CrrJfqOr7eskErcQkyS9gLjdn+frByaq5N4dEGoh36sZfhgF6rSGqg
> ZlMLUCxBsasTooktHOSGURbhorHuSHlheyfNX/z9dp/qBEBhMgRmLDnfsxMmAcFb
> W5bbYKmqeIEfm+IHTRz0UUk1SbHoZVaDYY81qGI0rQgTpFFV1yRtC5TdQ2/lanGU
> 4Aklxb4CqEt8mek5GBrwp7526ebVxF48hWQ5elP6ycUcI4LyBtQhIqT2Zqq8G7MG
> hOdZSNQ7IXYq+mjLx1yGQrKQkZTlmWb+j3KbC2anz73qAw7jz1hmhBLjyFlhSWcG
> LAJIuPT+WY+xJKMfl15l1XCO4xc8osd1FUBcfWEvPZvxqiH1RA/5YxL1W/Qou/NL
> AJSxixJCQcONZd9ynppzJKSVyrcjzE0FUPMutynitmVFgtuSKz4eb+8U3SaX8HEm
> GJOV8/e9ETms75TbSfGSjRPLXGaMTwswpWzpnA+B3wOHF6qGPxDFGr7uIxZa/ky+
> I3QAs0vzTFfhyjZP4SDg
> =opYc
> -END PGP SIGNATURE-
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subsc

Re: Question:Multi-Core processor affinity for load balancing Clojure Web apps

2011-11-06 Thread Gary Trakhman
it seems like the only difference would be 4 garbage collectors working on 
smaller heaps, however there would be much  more memory overhead that way. 
 I assume if you can load-balance your app like that, that it is stateless, 
and won't use a whole bunch of static memory.  You might do better with 
changing some performance tuning parameters.  This is a great video that 
describes the tradeoffs: http://www.parleys.com/#id=2662&st=5

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

ClojureScript and CouchDB?

2011-11-06 Thread Antonio Recio
I would like to use ClojureScript to interact with databases. 
Which is the database engine that you recommend me to use with 
ClojureScript? 
Is CouchDB most recommendable than PostgreSQL? 
Do you know some project using ClojureScript to interact with databases?

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

2011-11-06 Thread Mark Rathwell
> I'm not using
> ring, I have a servlet which I need to feed to appengine-magic.

Not sure what you mean by this, could you expand on it a little more?
You have an existing Java servlet that you want to handle some url
pattern, and you want to integrate that into your appengine-magic app?

On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru  wrote:
> Hi,
>
> appengine-magic (https://github.com/gcv/appengine-magic) uses ring-
> handlers to turn into servlets that are accepted by GAE. Does anybody
> know how to use servlets directly with appengine-magic? I'm not using
> ring, I have a servlet which I need to feed to appengine-magic.
>
> Thanks,
> Razvan
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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: ClojureScript and CouchDB?

2011-11-06 Thread Chas Emerick

On Nov 6, 2011, at 9:24 AM, Antonio Recio wrote:

> I would like to use ClojureScript to interact with databases. 
> Which is the database engine that you recommend me to use with ClojureScript? 
> Is CouchDB most recommendable than PostgreSQL? 
> Do you know some project using ClojureScript to interact with databases?

I doubt that anyone will be able to write a postgres driver for ClojureScript 
any time soon.  A CouchDB library for ClojureScript would be interesting though.

Remember that ClojureScript runs entirely in the browser.  So, in many (most?) 
cases, you probably don't want authentication credentials to your database 
being in all of your client's browsers.  That said, CouchDB does support 
authentication and authorization solely through HTTP, so a really quality 
CouchDB library for ClojureScript could provide for pleasant, secured CouchDB 
access.

Currently, everyone (AFAIK) delegates database access to the backend that is 
serving up the ClojureScript front-end.  Once there, there's plenty of support 
for postgres (via java.jdbc[1], korma[2], et al.) and CouchDB (I prefer 
clutch[3], but I'm biased).

In case you're interested in writing CouchDB views using ClojureScript, there's 
this:

https://github.com/cemerick/clutch-clojurescript

Cheers,

- Chas

[1] https://github.com/clojure/java.jdbc
[2] http://sqlkorma.com/
[3] http://github.com/ashafa/clutch

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

2011-11-06 Thread Razvan Rotaru
I want integration of servlet in appengine-magic.

Documentation describes that you use a ring handler to call def-
appengine-app:

(appengine-magic.core/def-appengine-app my-app #'my-ring-handler)

I have a servlet and want to build an application, something like:

(appengine-magic.core/def-appengine-servlet-app my-app #'my-servlet)

Razvan

On Nov 6, 4:32 pm, Mark Rathwell  wrote:
> > I'm not using
> > ring, I have a servlet which I need to feed to appengine-magic.
>
> Not sure what you mean by this, could you expand on it a little more?
> You have an existing Java servlet that you want to handle some url
> pattern, and you want to integrate that into your appengine-magic app?
>
>
>
>
>
>
>
> On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru  wrote:
> > Hi,
>
> > appengine-magic (https://github.com/gcv/appengine-magic) uses ring-
> > handlers to turn into servlets that are accepted by GAE. Does anybody
> > know how to use servlets directly with appengine-magic? I'm not using
> > ring, I have a servlet which I need to feed to appengine-magic.
>
> > Thanks,
> > Razvan
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en

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


Re: problems of a newbie

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

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

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

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

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





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

Re: problems of a newbie

2011-11-06 Thread 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.

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.  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?  I have used both it and
eclipse (STs) for years but am considering emacs (with which I have a
beginner's competency).  I am intentionally not using spring or
hibernate and I expect the project will be fairly small in the short
term actually so I think emacs might be  achievable  (I am also
switching from spring MVC and jquery to conjure and yui3 - this is all
about using the right technology from the start and I love vert iCal
learning curves :)

To explain why this madness might actually be a great idea - the
existing app will be deployed with some additional json services so
the new app will initially just be a very thin skin that uses those
json services in the short term.  Later on the functionality will be
rewritten in the new app.

Exciting times!

Sent from my iPad

On 6 Nov 2011, at 16:49, Dennis Haupt  wrote:

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

Re: problems of a newbie

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

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

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

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

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

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

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

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

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

Re: appengine-magic + servlets

2011-11-06 Thread Mark Rathwell
I'm still not quite following.  What appengine-magic does is provides
Clojure wrappers for many of the App Engine for Java service APIs, and
from a ring handler creates a servlet suitable for deployment to App
Engine.  If you already have the servlet, I'm not sure why you need
appengine-magic.  Where is this servlet coming from?  And what are you
wanting to do with it once you have integrated it with
appengine-magic?

 - Mark

On Sun, Nov 6, 2011 at 11:41 AM, Razvan Rotaru  wrote:
> I want integration of servlet in appengine-magic.
>
> Documentation describes that you use a ring handler to call def-
> appengine-app:
>
> (appengine-magic.core/def-appengine-app my-app #'my-ring-handler)
>
> I have a servlet and want to build an application, something like:
>
> (appengine-magic.core/def-appengine-servlet-app my-app #'my-servlet)
>
> Razvan
>
> On Nov 6, 4:32 pm, Mark Rathwell  wrote:
>> > I'm not using
>> > ring, I have a servlet which I need to feed to appengine-magic.
>>
>> Not sure what you mean by this, could you expand on it a little more?
>> You have an existing Java servlet that you want to handle some url
>> pattern, and you want to integrate that into your appengine-magic app?
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru  
>> wrote:
>> > Hi,
>>
>> > appengine-magic (https://github.com/gcv/appengine-magic) uses ring-
>> > handlers to turn into servlets that are accepted by GAE. Does anybody
>> > know how to use servlets directly with appengine-magic? I'm not using
>> > ring, I have a servlet which I need to feed to appengine-magic.
>>
>> > Thanks,
>> > Razvan
>>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clojure@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with 
>> > your first post.
>> > To unsubscribe from 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: Korma - cannot acquire connections

2011-11-06 Thread AndyK
My mistake in the original post - that should've read (sql/defenity
mytable)
Two seprate forms - the defentity + the select.

On Nov 4, 3:21 pm, Base  wrote:
> Did you mean to define the select within the defentity?
>
> (sql/defentity mytable    (sql/select mytable (sql/fields :id) (sql/
> where {:id 1})))
>
> I does this work?
>
> (sql/defentity mytable
>   (:pk <<< YOUR PRIMARY KEY AS A KEYWORD>>>)
>   (table <<>>)
>  (database devdb))
>
> (sql/select mytable (sql/fields :id) (sql/where {:id 1}))
>
> On Nov 4, 10:44 am,AndyK wrote:
>
>
>
>
>
>
>
> > I believe I have setup korma correctly with
> > (require '[korma.db :as db])
> > (require '[korma.core :as sql])
> > (db/defdb devdb (db/mysql {:db "mydb" :host "localhost" :user
> > "me" :password "mypass"}))
> > (sql/defentity mytable
> > (sql/select mytable (sql/fields :id) (sql/where {:id 1})))
>
> > But I'm getting
> > SQLException:
> >  Message: Connections could not be acquired from the underlying
> > database!
> >  SQLState: null
> >  Error Code: 0
>
> > (db/get-connection devdb) returns a clojure.lang.PersistentHashMap -
> > is that right? or should it be the underlying java.sql.Connection?
>
> > I have the mysql driver in my classpath, am able to Class/forName the
> > driver, create a connection, and query on the connection - all
> > manually. Korma looks pretty cool and I'd like to be using, any ideas?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 Sean Corfield
On Sunday, November 6, 2011, Dennis Haupt  wrote:
> this is a double edged sword. you *do* get it right *if* you think it
> through, but reality is often more complex than you assume. if you
> suddenly see that you forgot to handle special case x, you are
> punished harder than in .

I'll go a little further than Colin and say "IME"...

As a veteran of C++ and Java with time spent in Groovy, Scala and more
recently Clojure - and a decade of dynamic scripting languages for the web
- I've generally found OO languages, especially with strong type systems,
punish my design missteps much more harshly.

> 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. I actually think that's a benefit of Clojure: it encourages
doing it right.

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

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!

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

Re: Solving this with logic programing

2011-11-06 Thread Michael Jaaka
Well, despite of fact that core.logic is fine tool and is worth of study, I 
have implemented own solution to my problem.

Here is a full implementation: http://pastebin.com/Z5BETZd3

And the idea is to index each value in record perserving the record and 
meaning of values. Then search by these values. The mini DSL contains "from 
insert select where" keywords.

The resulting usage code is:

(defn permission[ roles ops states ]
(letfn [ (or-nil [ a ] (or a #{ nil })) ]
(from :permission
(doseq[ r (or-nil roles) o (or-nil ops) s (or-nil states) ]
(insert { :role r :op o :state s })

(permission #{:admin :operator } #{:reject :accept} #{:applied} )
(permission #{:auditor :operator } #{:list} any )
(permission #{:operator } #{:enter} #{:dirty} )

(defn can-access[ role op state ]
(not (empty? (from :permission
(where { :role role :op op :state state })

(defn get-operations[ role state ]
(map :op (from :permission
(select [ :op ]
(where { :role role :state state })

; Some tests

(get-operations  :operator :applied)
(can-access :auditor :list :applied)
(can-access :admin :enter :dirty)

 

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

Stanford ai-class

2011-11-06 Thread finbeu
Hi

who is taking the Stanford ai-class with Peter Norvig and Sebastian Thrun? 
I remember there was a thread on this group in august. I'm doing now the 
advanced track and it is a lot of fun although we have no programming 
assignments (was dropped because of mass enrollment of 140K students). The 
campus students have programming assignments like pacman and this has to be 
done in python. The homework, which is due every week, is the same like the 
campus students have.

Anyway, the lectures are more or less what you will find in Norvig's book 
AIMA (Artficial Intelligence, a Modern Approach). Interesting stuff like 
machine learning, bayes networks, and so on ...

Finn



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

Re: ClojureScript and CouchDB?

2011-11-06 Thread David Nolen
If you want to have a lot of database options you could target Node.js.

David

On Sunday, November 6, 2011, Antonio Recio  wrote:
> I would like to use ClojureScript to interact with databases.
> Which is the database engine that you recommend me to use with
ClojureScript?
> Is CouchDB most recommendable than PostgreSQL?
> Do you know some project using ClojureScript to interact with databases?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
your first post.
> To unsubscribe from 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 finbeu
I second your comment regarding the PGP sig. 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 19:06, schrieb Sean Corfield:
> On Sunday, November 6, 2011, Dennis Haupt  > wrote:
>> this is a double edged sword. you *do* get it right *if* you think it
>> through, but reality is often more complex than you assume. if you
>> suddenly see that you forgot to handle special case x, you are
>> punished harder than in .
> 
> I'll go a little further than Colin and say "IME"...
> 
> As a veteran of C++ and Java with time spent in Groovy, Scala and more
> recently Clojure - and a decade of dynamic scripting languages for the
> web - I've generally found OO languages, especially with strong type
> systems, punish my design missteps much more harshly.

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

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

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


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

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

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

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

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

done

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


-- 

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


Re: problems of a newbie

2011-11-06 Thread Sean Corfield
On Sun, Nov 6, 2011 at 11:12 AM, Dennis Haupt  wrote:
> let me guess: you had some classes that were used more than they should
> have been because they were the best match and introducing a better one
> would have taken more time - and since they could do so much, they were
> just used at more and more places and in the end, they became god
> classes which infested everything?

I generally refactored them into submission before they reached "god"
status but they sometimes reached "saint" or "minor deity" status :)

The other problem I ran into with OO (a lot in the early 90's, less so
as I got more experienced) was identifying what turned out to be an
incorrect set of classes and then finding myself "stuck" when
requirements changed and needing to completely redesign whole sections
of the application. That's the aspect of static type systems that I
don't like: if you make choices that seem reasonable but turn out not
to match a future set of requirements, those types are _everywhere_ -
woven into the very fabric of your application's structure as well as
liberally sprinkled throughout any code that touches objects of those
types. Scala helps with type inference but also expects you to encode
even more of your application's structure and logic into the type
system (which makes the "wrong type" decisions even worse when they
pop up).

Without a rigid type system, generic functions can operate on any
compatible data structures without needing a typed wrapper (not even a
parameterized type wrapper with inference). 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)...

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

Doing it wrong and having a small refactoring later is OK but accruing
a big refactoring isn't something I'd want in my code - but I guess it
depends on what you define as "big" (and how "wrong" the shortcut
feels).

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

Not specifically. I'm not there yet but I feel I'm getting better...

[PGP]
> done

Thanx Dennis!
-- 
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


Re: problems of a newbie

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

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

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

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

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

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

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

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

Re: appengine-magic + servlets

2011-11-06 Thread Razvan Rotaru
The servlet is coming from an external jar, which is written in Java.
I need appengine-magic for the other services, like datastore.

Razvan

On Nov 6, 7:45 pm, Mark Rathwell  wrote:
> I'm still not quite following.  What appengine-magic does is provides
> Clojure wrappers for many of the App Engine for Java service APIs, and
> from a ring handler creates a servlet suitable for deployment to App
> Engine.  If you already have the servlet, I'm not sure why you need
> appengine-magic.  Where is this servlet coming from?  And what are you
> wanting to do with it once you have integrated it with
> appengine-magic?
>
>  - Mark
>
>
>
>
>
>
>
> On Sun, Nov 6, 2011 at 11:41 AM, Razvan Rotaru  
> wrote:
> > I want integration of servlet in appengine-magic.
>
> > Documentation describes that you use a ring handler to call def-
> > appengine-app:
>
> > (appengine-magic.core/def-appengine-app my-app #'my-ring-handler)
>
> > I have a servlet and want to build an application, something like:
>
> > (appengine-magic.core/def-appengine-servlet-app my-app #'my-servlet)
>
> > Razvan
>
> > On Nov 6, 4:32 pm, Mark Rathwell  wrote:
> >> > I'm not using
> >> > ring, I have a servlet which I need to feed to appengine-magic.
>
> >> Not sure what you mean by this, could you expand on it a little more?
> >> You have an existing Java servlet that you want to handle some url
> >> pattern, and you want to integrate that into your appengine-magic app?
>
> >> On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru  
> >> wrote:
> >> > Hi,
>
> >> > appengine-magic (https://github.com/gcv/appengine-magic) uses ring-
> >> > handlers to turn into servlets that are accepted by GAE. Does anybody
> >> > know how to use servlets directly with appengine-magic? I'm not using
> >> > ring, I have a servlet which I need to feed to appengine-magic.
>
> >> > Thanks,
> >> > Razvan
>
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "Clojure" group.
> >> > To post to this group, send email to clojure@googlegroups.com
> >> > Note that posts from new members are moderated - please be patient with 
> >> > your first post.
> >> > To unsubscribe from 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: appengine-magic + servlets

2011-11-06 Thread Mark Rathwell
I'm still having trouble figuring out what it is you are wanting to
do, but if you have an existing Java servlet that will handle some url
pattern, and you want to write an appengine-magic app that will create
a servlet to handle some other url pattern, and use both servlets in
one app engine app, then you should be able to add the jar as a
dependency to your project such that the jar ends up in
war/WEB-INF/lib, and setup that servlet and url pattern in web.xml
just as you normally would, and setup the appengine-magic servlet to
handle some other desired url pattern.

On Sun, Nov 6, 2011 at 3:24 PM, Razvan Rotaru  wrote:
> The servlet is coming from an external jar, which is written in Java.
> I need appengine-magic for the other services, like datastore.
>
> Razvan
>
> On Nov 6, 7:45 pm, Mark Rathwell  wrote:
>> I'm still not quite following.  What appengine-magic does is provides
>> Clojure wrappers for many of the App Engine for Java service APIs, and
>> from a ring handler creates a servlet suitable for deployment to App
>> Engine.  If you already have the servlet, I'm not sure why you need
>> appengine-magic.  Where is this servlet coming from?  And what are you
>> wanting to do with it once you have integrated it with
>> appengine-magic?
>>
>>  - Mark
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Nov 6, 2011 at 11:41 AM, Razvan Rotaru  
>> wrote:
>> > I want integration of servlet in appengine-magic.
>>
>> > Documentation describes that you use a ring handler to call def-
>> > appengine-app:
>>
>> > (appengine-magic.core/def-appengine-app my-app #'my-ring-handler)
>>
>> > I have a servlet and want to build an application, something like:
>>
>> > (appengine-magic.core/def-appengine-servlet-app my-app #'my-servlet)
>>
>> > Razvan
>>
>> > On Nov 6, 4:32 pm, Mark Rathwell  wrote:
>> >> > I'm not using
>> >> > ring, I have a servlet which I need to feed to appengine-magic.
>>
>> >> Not sure what you mean by this, could you expand on it a little more?
>> >> You have an existing Java servlet that you want to handle some url
>> >> pattern, and you want to integrate that into your appengine-magic app?
>>
>> >> On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru  
>> >> wrote:
>> >> > Hi,
>>
>> >> > appengine-magic (https://github.com/gcv/appengine-magic) uses ring-
>> >> > handlers to turn into servlets that are accepted by GAE. Does anybody
>> >> > know how to use servlets directly with appengine-magic? I'm not using
>> >> > ring, I have a servlet which I need to feed to appengine-magic.
>>
>> >> > Thanks,
>> >> > Razvan
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups "Clojure" group.
>> >> > To post to this group, send email to clojure@googlegroups.com
>> >> > Note that posts from new members are moderated - please be patient with 
>> >> > your first post.
>> >> > To unsubscribe from 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: problems of a newbie

2011-11-06 Thread 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.
On Nov 6, 2011 11:49 AM, "Dennis Haupt"  wrote:

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

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

Re: clojure-test-mode

2011-11-06 Thread Chris Jenkins
Did you ever figure out what was causing this? I'm on clojure-mode 1.11.2
with Clojure 1.3. When I run clojure-test-run-tests from within emacs, I
see "error in process filter:  Invalid read syntax: "#"" in the status mini
buffer. The tests do seem to run ok but I'm curious what is going on.

On 19 June 2011 14:59, Gregg Reynolds  wrote:

> Hi folks,
>
> I somehow managed to get clojure-test-mode working, so I can execute
> C-c C-, from a test file and see the test results in the slime repl.
> However, in the mini-buffer I get the following message:
>
> error in process filter:  Invalid read syntax: "#"
>
> Any idea what that means?  It doesn't seem to prevent C-c C-, from
> working, but I'd like to fix it.
>
> Thanks,
>
> 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 question on deftest- macro.

2011-11-06 Thread Young Kim
Thanks a lot, Phil!

I agree with you because your soultion can be a good workaround.
But I want to know the reason why the deftest- macro is not working as
intended.
Could you tell me why?

Did the developer of the deftest- macro  write a incorrect code or
am I wrong in understanding the prupose of the deftest- macro?


On Nov 6, 5:33 am, Phil Hagelberg  wrote:
> On Sat, Nov 5, 2011 at 6:57 AM, Young Kim  wrote:
> > The unexpected result was that the message "Ran 5 tests containing 8
> > assertions".
>
> > The expected message was that "Ran 3 tests containing 4 assertions",
> > because of two dertest- macros in my test code.
>
> > How can I block the execution of the two private deftest- macros in my
> > test code?
>
> Just use defn instead of deftest-. There's no reason calls to "is"
> can't occur in regular function bodies.
>
> -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


Another newbie question

2011-11-06 Thread 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. 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

Re: problems of a newbie

2011-11-06 Thread Milton Silva
On Nov 5, 12:16 pm, Dennis Haupt  wrote:
> -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?

Your editor does have a search fn right?

> * rename that

again, all editors have this.

> * show me all errors

what do you mean? for example when I compile a file in emacs I
(normally) get the line where the error is. or do you mean runtime
errors?

> * add a parameter here

not sure I understand this one. if you mean (defn [a]..) to (defn [a
b] ...) how do you do that without manual intervention in any language/
editor? (just adding more args to something doesn't mean they will be
properly handled... that is our job)

> * autocomplete this for me, i am too lazy to even remember the exact
> method name

emacs has this(possible not out of the box) and I suspect other too.

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

emacs also has this(possible not out of the box) and again I suspect
other too.

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

I know IDE support isn't as good as in java but, after looking at your
code, yes, there is something your not aware of and that is why
clojure is giving you a hard time.

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.

First, understand the philosophy of clojure. look here 
http://tinyurl.com/5u3suzf
and here http://www.infoq.com/presentations/Simple-Made-Easy

If you understand that philosophy and identify with it then try to
solve very small problems(preferably with little to no inherent
state), and try to be as idiomatic as possible. To understand how to
solve problems idiomatically, read books (e.g. joy of clojure) ask in
the IRC or here on how to solve particular problems and complement
this with understanding the key ideas of libraries that excel in
this(e.g Ring).

When you have a good understanding of the language and underling
philosophy, invest some time to think about your problem and how to
properly express it clojure.

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


Twitterbuzz Clojurescript sample

2011-11-06 Thread Bayard Randel
The following is more an observation than a problem.

While investigating Clojurescript my first port of call after reading
the initial documentation was to read through the sample code
provided. Naturally one of the first questions a beginner is going to
ask when looking at Clojurescript is, how do I manipulate the dom?

The Twitterbuzz sample includes a dom helper library written
specifically for the project (https://github.com/clojure/clojurescript/
blob/master/samples/twitterbuzz/src/twitterbuzz/dom-helpers.cljs), so
my initial understanding was that there was no cljs library for dom
manip. As Rich has done in the sample, I began my project thinking I
would need to roll my own wrappers for the goog/dom. Eventually
however I discovered clojure.browser.dom (https://github.com/clojure/
clojurescript/blob/master/src/cljs/clojure/browser/dom.cljs). Would it
be sensible to update the Twitterbuzz sample to use the native cljs
library instead?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 aboy021
In terms of Clojure refactoring tools the ones that looks most
promising to me are Emacs with Paredit, Swank, and Slime and,
hopefully as it matures, Clojure-refactoring (https://github.com/
joodie/clojure-refactoring).

Chas Emerick did a blog post last year that talks about what he would
want in his ideal Clojure Development environment, as far as I can
tell we're not there yet:
http://cemerick.com/ideal-clojure-development-environment/

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

2011-11-06 Thread David Cabana
This worked for me, with mysql 5.1 on Ubuntu Natty.  The clojure_test
library and fruit table already existed.

(ns foo.core
  (use [korma.db])
  (use [korma.core]))

(defdb mydb {:subprotocol "mysql"
 :subname "//127.0.0.1:3306/clojure_test"
 :user "clojure_test"
 :password "clojure_test"})

(defentity fruit
  (database mydb)
  (table :fruit))

(select fruit)

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


Re: Clojure Conj extracurricular activities spreadsheet

2011-11-06 Thread Christopher Maier
I'm interested in attending the core.logic, overtone, literate programming, 
web, and clojurescript sessions.

Thanks!

-Chris

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

Speculative Execution

2011-11-06 Thread daly
One of the benefits of immutable data structures is the
ability to do speculative execution. You can compute an
answer and if you don't like it you can just abandon it.

This is useful for techniques like backtracking. 

I don't see this idea mentioned anywhere in Clojure but
I think it would make an interesting bullet point.

Tim Daly


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

2011-11-06 Thread David Nolen
Yup. core.logic uses persistent hash maps to store logic variable bindings.

David

On Sun, Nov 6, 2011 at 10:32 PM, daly  wrote:

> One of the benefits of immutable data structures is the
> ability to do speculative execution. You can compute an
> answer and if you don't like it you can just abandon it.
>
> This is useful for techniques like backtracking.
>
> I don't see this idea mentioned anywhere in Clojure but
> I think it would make an interesting bullet point.
>
> Tim Daly
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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 Scott Jaderholm
On Sun, Nov 6, 2011 at 11:33 AM, Milton Silva  wrote:

> On Nov 5, 12:16 pm, Dennis Haupt  wrote:
> > -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?
>
> Your editor does have a search fn right?
>
> A normal search function does not distinguish between matches in comments,
docstrings, strings, variables, and function calls. A where called function
in an IDE does. Slime has slime-who-calls. I don't know how good it is.
There are various other slime-who functions that are just waiting for
volunteers to implement in swank-clojure.


> > * rename that
>
> again, all editors have this.
>

Again, they don't distinguish between the various contexts in which a
matching identifier can appear (e.g. as a substring of a different
identifier, or identical but in a distinct context). There are two renaming
refactorings in clojure-refactoring. How good they are at renaming only the
right things I do not know.

>
> > * show me all errors
>
> what do you mean? for example when I compile a file in emacs I
> (normally) get the line where the error is. or do you mean runtime
> errors?
>

IDEs for Java will show you multiple errors all at once, whereas I think
environments like Slime will stop compiling once they hit an error.


> > * add a parameter here
>
> not sure I understand this one. if you mean (defn [a]..) to (defn [a
> b] ...) how do you do that without manual intervention in any language/
> editor? (just adding more args to something doesn't mean they will be
> properly handled... that is our job)
>
>
IDEs have refactorings for things like this. See Eclipse and IntelliJ. You
give a default value and it changes all calls to use that.

 > * autocomplete this for me, i am too lazy to even remember the exact
> > method name
>
> emacs has this(possible not out of the box) and I suspect other too.
>

ac-slime is pretty limited compared to intellisense systems in static
languages, it doesn't know about context such as what methods can be called
on what objects, other than I think it knows about static methods. Granted
I'm not sure what the limits are in a dynamic language (probably whatever
Smalltalk environments do).


>
> > * 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.
>
> emacs also has this(possible not out of the box) and again I suspect
> other too.
>
> Nope, ac-slime doesn't know what identifiers are field names let alone
where they are appropriate. Ditto with methods.

 >
> > 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?
>
> I know IDE support isn't as good as in java but, after looking at your
>

There's lots of reasonable goals for Clojure environments. Being as good as
Java, at least in terms of refactorings, probably isn't one, since in terms
of refactoring there are probably very few languages today that are where
Java was 10 years ago. That said I'm a long time user of
clojure-refactoring and try to encourage people to use it every change I
get.


> code, yes, there is something your not aware of and that is why
> clojure is giving you a hard time.
>
>
In his code I did notice he doesn't use destructing very much.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-06 Thread Daniel Pittman
On Sun, Nov 6, 2011 at 03:56, pron  wrote:

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

Is this in any way different to how the developer might use a slot on
a class, or a get/set method pair for different purposes?

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

>From my experience, if you have an architecture that encourages
developers to think in terms of discrete functional units, and to have
documented interfaces between the functional units, you wind up with a
system that works - regardless of the control the language expresses
over access to members.

On the other hand, if you have an architecture (or culture) that
encourages poking into the implementation details, or just getting
things done - the pragmatic solution - rather than doing things right,
you will wind up with problems no matter which approach you take.

In other words I question your "invariably", rather than any other
part of your statement.  These are not automatic problems, and they
are not all that, in my experience, related to the degree that your
language forces you to go through a single channel for all access to a
particular bit of data.

Do you have more concrete concerns here, or is it just the general
assumption that without data hiding and a "one object, one file" model
you can't have a working large scale system?

Daniel
-- 
♲ Made with 100 percent post-consumer electrons

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


cljr install makes .cjr directory

2011-11-06 Thread jayvandal
Whay does cljr-installer.jar make directories  with .(period) in front
of the dir name as .cljr and .lein and m2.

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

On 6/11/2011 12:56, pron wrote:
E.g., one developer may add a keyword to a map for one purpose, and 
another, use the same keyword for a different purpose. 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.


One way to encapsulate things in clojure is namespaces. For this 
specific example you gave there, one might use namespace qualified 
keywords to add some data to your map. This way name clashes are only 
possible when you want them. I am actually using that very technique to 
add application (and namespace) specific data to the request map from a 
ring (web) application as it is passed further down through different 
namespaces during the routing of the request. Namespaces can have 
private vars and functions as well.


The documented interfaces mentioned by Daniel are very useful too, 
protocols are providing this functionality. Though i must confess I 
sometimes still use multimethods to that effect =)


In my opinion, far from being a weakness, programming in the large is a 
strong point of clojure.


Sacha


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


Clojurescript browser repl woes

2011-11-06 Thread Praki
Hi,

I have a clojurescript app which connects to a repl server. But it
never worked, always hanging in evaluating the expression. As the repl
sample app which comes with clojurescript worked, I soon managed to
establish that my browser repl works as expected if I don't run my
application code (which makes an xhrio request to the server and
displays some UI.)

I am not sure what is causing this. Isn't the browser repl event-
driven as everything else in the browser? Any thoughts on debugging
this further?

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-06 Thread Sean Corfield
On Sun, Nov 6, 2011 at 12:15 PM, Dennis Haupt  wrote:
> if by compatible you mean "has a specific set of functions and fields",
> then scala can do that without sacrificing static type safety:

Yes, I started working with Scala in 2009 and it's certainly much
better than Java but it still forces you to express that sort of
commonality thru the type system. Scala is getting dynamic types...
-- 
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


Re: Another newbie question

2011-11-06 Thread Sean Corfield
On Sun, Nov 6, 2011 at 3:56 AM, pron  wrote:
> 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.

Why do you think this sort of problem is invariably going to arise in
large-team development?
-- 
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


Re: cljr install makes .cjr directory

2011-11-06 Thread Sean Corfield
On Sun, Nov 6, 2011 at 8:51 PM, jayvandal  wrote:
> Whay does cljr-installer.jar make directories  with .(period) in front
> of the dir name as .cljr and .lein and m2.

.(program-name) is fairly standard for programs to store configuration.

.m2 is the local repository cache for Maven 2.

.lein is where Leiningen stores its JARs (for self-installs) and where
you can put user.clj which is executed as setup.

I assume .cljr is where the cljr program puts its configuration.
-- 
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