Re: Clojure for Beginners eBook

2013-05-02 Thread Rich Morin
On May 1, 2013, at 17:40, Asim Jalis wrote:
 Any thoughts or feedback would be great.

I'd be happy to see a section on Just Enough Java, for folks who don't
have a Java background.  You mqay also want to take a look at my (WIP!)
wiki pages on Key Concepts in Clojure:

  http://wiki.cfcl.com/bin/view/Projects/Clojure/Key/WebHome

-r

 -- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume r...@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Software system design, development, and documentation


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




[ANN] bleach 0.0.11

2013-05-02 Thread David Lowe
bleach: whitens unsightly code!

When you bleach your code, it continues to work as before, only now it
looks like:

(use 'bleach.core) #bleach/ed 






Find it here: https://github.com/dlowe/bleach

Enjoy :)
David Lowe

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




Re: emacs - how to wean me off the family of Java IDEs

2013-05-02 Thread Kendall Shaw

On 5/1/2013 5:46 PM, James Thornton wrote:

...
Before I realized my bad habit, I would contort my left hand to hit 
Ctrl Alt x -- this feels awkward and if you do it enough times over 
the years the repetitive stress builds up. A better way is to use both 
hands. This may seem obvious to those who did it right from the 
beginning, but if you start off down the wrong path, it can be a real 
pain.


To execute C-M-x using both hands, simultaneously hold down the Ctrl 
key with your left pinky while holding down the Alt key with your 
right thumb, and hit x with your left index finger. Doing it this 
way feels natural and smooth. Now I almost always use my right thumb 
for Meta/Alt, and once I realized this, the Emacs command combinations 
made much more sense.
I spent years with the beginnings of carpal tunnel syndrome and tried 
all sorts of changes, including using both hands. But, finally, I 
started using viper mode (vi key bindings) and I have had no carpal 
tunnel symptoms for 10 years.


Kendall

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

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread David Toomey
Is this serious? No one knows how to create a login form in Compojure?
I'm seriously confused. I can create accounts, but I can't get the
login part to work. What could I possibly be doing wrong? Is there
anything in my code that indicates something wrong? Is there anything
I could show that could reveal the problem?

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




Re: [ANN] Prismatic's Plumbing/Graph 0.1.0 is released with huge performance improvements

2013-05-02 Thread László Török
Hi,

First all congratulations to the new release!

Looking at the change log, I'm not sure I understand the following:
Explicit output-schema metadata on a fnk is taken as gold, rather than
being merged with explicit data by analyzing the fnk body, and must be
explicit rather than a spec
Thx

Sent from my phone
On May 1, 2013 8:46 PM, Jason Wolfe ja...@w01fe.com wrote:

Version 0.1.0 of Prismatic's Plumbing/Graph has just been released.

The biggest change is backwards-compatible performance improvements of up
to 40x for eager compilation, brining Graph to within 20% or so of
hand-coded performance for trivial node functions.  This was work done by
Leon Barrett on a 'sprintbatical' from the Climate Corp, and he's written a
great blog post about the update [1].  There are also a handful of small
changes and improvements described in the changelog [2].

We've also created a mailing list for Plumbing/Graph [3], so feel free to
ask/answer questions, discuss feature requests/bugs, and generally talk
about how you are or would like to use Plumbing/Graph there.

Cheers,
Jason

[1]
http://blog.getprismatic.com/blog/2013/5/1/graph-faster-abstractions-for-structured-computation
[2] https://github.com/Prismatic/plumbing/blob/v0.1.0/CHANGELOG.md
[3] https://groups.google.com/forum/#!forum/prismatic-plumbing

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

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




Re: [ANN] Prismatic's Plumbing/Graph 0.1.0 is released with huge performance improvements

2013-05-02 Thread Jason Wolfe
Yes, I suppose that's not very clear.

Fnk attempts to guess the output schema of your function by looking at the 
body -- if the return value has literal map structure, this is 
automatically taken as the output schema.  Since this analysis is fragile 
(maps are created programatically, within a let, by a delegate fn, etc), 
you can also provide explicit ^:output-schema metadata on the argument 
vector of the fnk. 

The previous version of plumbing attempted to be smart and 'merge' these 
two sources of schema data.  Your explicit schema could provide additional 
details about structure, but  if it contradicted the literal map structure 
an exception was thrown.  Unfortunately, this required calling 'eval' on 
the explicit output schema so that it could be analyzed at compile time, in 
the case that it was itself not literal.  We decided that this was a bad 
idea, so now when you pass ^:output-schema metadata it's directly used as 
the output-schema rather than trying to reconcile with the fnk body, 
obviating the need for 'eval'.  Moreover, there used to be a special 
shortcut syntax that could be used in ^:output-schema, which was 
undocumented -- this has been removed, so ^:output-schema needs to be an 
actual schema.  

Does this make more sense?  Do you forsee running into any issues with this 
change?  

Thanks,
Jason

On Thursday, May 2, 2013 12:22:07 AM UTC-7, Las wrote:

 Hi,

 First all congratulations to the new release! 

 Looking at the change log, I'm not sure I understand the following:
 Explicit output-schema metadata on a fnk is taken as gold, rather than 
 being merged with explicit data by analyzing the fnk body, and must be 
 explicit rather than a spec
 Thx

 Sent from my phone
 On May 1, 2013 8:46 PM, Jason Wolfe ja...@w01fe.com javascript: 
 wrote:

 Version 0.1.0 of Prismatic's Plumbing/Graph has just been released.  

 The biggest change is backwards-compatible performance improvements of up 
 to 40x for eager compilation, brining Graph to within 20% or so of 
 hand-coded performance for trivial node functions.  This was work done by 
 Leon Barrett on a 'sprintbatical' from the Climate Corp, and he's written a 
 great blog post about the update [1].  There are also a handful of small 
 changes and improvements described in the changelog [2].  

 We've also created a mailing list for Plumbing/Graph [3], so feel free to 
 ask/answer questions, discuss feature requests/bugs, and generally talk 
 about how you are or would like to use Plumbing/Graph there.

 Cheers,
 Jason

 [1] 
 http://blog.getprismatic.com/blog/2013/5/1/graph-faster-abstractions-for-structured-computation
 [2] https://github.com/Prismatic/plumbing/blob/v0.1.0/CHANGELOG.md
 [3] https://groups.google.com/forum/#!forum/prismatic-plumbing
  
 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com javascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  



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




ANN Scrypt 1.0.0

2013-05-02 Thread Michael Klishin
Scrypt is a tiny Clojure library for working with the scrypt key derivation
function. It is an alternative to bcrypt and PBKDF2.

Release notes:
http://blog.clojurewerkz.org/blog/2013/05/02/scrypt-1-dot-0-0-is-released/
-- 
MK

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

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




higher order functions and metadata

2013-05-02 Thread Phillip Lord


I've been refactoring some code recently, part of which has include the
introduction of higher-order function. But this is causing me some
grief in terms of extra work. Let me give an example:

user (defn my-function [x y])
#'user/my-function
user (doc my-function)
-
user/my-function
([x y])
  nil
nil
user (def my-partial-function (partial my-function 10))
#'user/my-partial-function
user (doc my-partial-function)
-
user/my-partial-function
  nil
nil

The problem is that documentation for my-partial-function doesn't
include an arglist. Now I can add this in my hand, but that's a pain. 

I could write a macro which created a new `defx' form. This could use
the higher order function, calculating the metadata from the function
argument. And, indeed, I have done this. But it's a pain also if I want
to replicate the defn functionality (i.e. pre/post conditions, a doc
string and so on), because the macro gets quite complex. 

As far as I can see, this leaves me with the option creating a macro,
say `defdef' which creates new macros of the form `defx'. Which is
something that I would like to avoid writing if possible. 

Am I missing something simple?

Phil


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




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread David Toomey
I committed the codebase to github. I'm open-sourcing the whole
project anyways, so here is what I have thus far. Since I'm stuck at
the login, the conversion stops there, so this isn't the complete
codebase and basically still a skeleton:

https://github.com/dt1/SoloResume

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




Re: [GSoC Idea] cljs layer/dsl over express js

2013-05-02 Thread Omer Iqbal
I've been working on my proposal for this project. Here's a rough draft:
https://gist.github.com/olenhad/5501208 of what I have so far. Would love
some eye balls to verify if its on the right track.
Its a little rushed as I just got free from exams.

Cheers

Omer
@olenhad


On Mon, Feb 25, 2013 at 4:09 AM, David Nolen dnolen.li...@gmail.com wrote:

 Done!

 On Sun, Feb 24, 2013 at 1:53 PM, Omer Iqbal momeriqb...@gmail.com wrote:

 Extending dogfort for real world use
 Brief explanation:  Node.js provides a lightweight and fast server
 implementation, that’s commonly used for real time applications. Although
 its possible to make clojurescript applications targeting nodejs, the
 current experience is far from pleasant. Partly due to node’s heavy use of
 callback hell, and partly because most existing node libraries are heavily
 object oriented and imperative. Dogfort (https://github.com/bodil/dogfort)
 is a nice proof of concept , inspired by ring and compojure, that abstracts
 out quite a few of these issues.


 Expected results: An improved version of dogfort that can be put to real
 world use. New features include:
 - sessions
 - cookies
 - authentication middleware
 - socket.io abstraction
 - route filtering middleware

 **
 Knowledge prerequisites: Familiarity with nodejs
 Mentor: Bodil Stokke



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




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




Re: Clojurians in Austria

2013-05-02 Thread Haymo Meran
Hey Jozef and others,

I am looking for a clojure developer for a project or even employment. The 
company is a well funded startup located in the center of vienna and we 
have built a collaborative editing web app (similar to google docs - but 
for plain html) fully based on clojure.

Anyone interessted, please contact me. 

haymo dot meran at girigiri.io

Thanks.

Cheers
Haymo

On Tuesday, May 29, 2012 4:27:18 PM UTC+2, Jozef Wagner wrote:

 Hi,

 Are there some Clojurians from Austria or is there an Austria Clojure 
 group? 

 I'm looking for a Clojure related job in Austria, and so far I haven't 
 found any Austrian group on meetup.com nor on the google groups :(

 Best,
 Jozef



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




Re: higher order functions and metadata

2013-05-02 Thread Tassilo Horn
phillip.l...@newcastle.ac.uk (Phillip Lord) writes:

 I've been refactoring some code recently, part of which has include
 the introduction of higher-order function. But this is causing me some
 grief in terms of extra work. Let me give an example:

 user (defn my-function [x y])
 #'user/my-function
 user (doc my-function)
 -
 user/my-function
 ([x y])
   nil
 nil
 user (def my-partial-function (partial my-function 10))
 #'user/my-partial-function
 user (doc my-partial-function)
 -
 user/my-partial-function
   nil
 nil

 The problem is that documentation for my-partial-function doesn't
 include an arglist. Now I can add this in my hand, but that's a pain.

Well, that's nothing special wrt. higher-order functions, but a
limitation when you define functions with `def`.  E.g.,

  (def my-function (fn [x y]))

doesn't have :arglists metadata, too.

But since you have to add the docstring by hand anyway, I don't think
that's much of an issue:

  (def ^{:doc Applies my-function to 10 and y.
 :arglists '([y])}
   my-partial-function (partial my-function 10))

Bye,
Tassilo

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




Re: [GSoC Idea] cljs layer/dsl over express js

2013-05-02 Thread JeremyS
Hi everyone,

I was wondering if the interceptor concept from Pedestal would also be a 
good fit in this proposal ?

From what I gathered it helps break the flow of execution of the handling 
of requests while still having 
something that looks like ring middlewares.

Am I off topic or is there something here?

Cheers

Jeremy.

On Thursday, May 2, 2013 11:47:01 AM UTC+2, Omer Iqbal wrote:

 I've been working on my proposal for this project. Here's a rough draft:
 https://gist.github.com/olenhad/5501208 of what I have so far. Would love 
 some eye balls to verify if its on the right track. 
 Its a little rushed as I just got free from exams.

 Cheers

 Omer
 @olenhad


 On Mon, Feb 25, 2013 at 4:09 AM, David Nolen dnolen...@gmail.comjavascript:
  wrote:

 Done!

 On Sun, Feb 24, 2013 at 1:53 PM, Omer Iqbal momer...@gmail.comjavascript:
  wrote:

 Extending dogfort for real world use 
 Brief explanation:  Node.js provides a lightweight and fast server 
 implementation, that’s commonly used for real time applications. Although 
 its possible to make clojurescript applications targeting nodejs, the 
 current experience is far from pleasant. Partly due to node’s heavy use of 
 callback hell, and partly because most existing node libraries are heavily 
 object oriented and imperative. Dogfort (
 https://github.com/bodil/dogfort) is a nice proof of concept , inspired 
 by ring and compojure, that abstracts out quite a few of these issues.


 Expected results: An improved version of dogfort that can be put to 
 real world use. New features include:
 - sessions
 - cookies
 - authentication middleware
 - socket.io abstraction 
 - route filtering middleware

 **
 Knowledge prerequisites: Familiarity with nodejs
 Mentor: Bodil Stokke 



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




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




Re: A JMonkeyEngine3 wrapper?

2013-05-02 Thread Alex Fowler
Hmm, interesting, but games usually involve much state and changes to keep 
up their worlds alive.. how do you abstract over this? For example, if you 
need to move something, then surely you will call for a change.. right 
inside the user code that happens all the time.. isn't it so? Just 
interested in how do you develop the functional philosophy to a really 
usable extent.. I cannot imagine how to avoid changing Vector3f elements at 
runtime.. or maybe you just pass the whole changed app-state to each new 
cycle?

As far as I see, Jonathan and I, too create the wrappers as a side-effect 
of a personal project. I just think that maybe it is possible to factor out 
and assemble the code to a separate library and if you need something in 
your project, you implement it straight to the library and commit. Of 
course that would require a kind of coordination like never before, but it 
is a real FTW and is prone to benifits like finding something you wanted to 
have already being implemented by someone!


четверг, 2 мая 2013 г., 2:14:36 UTC+4 пользователь James Reeves написал:

 On 1 May 2013 21:08, Alex Fowler alex.m...@gmail.com javascript:wrote:

 So, inspired by the latest talks with locals, I propose starting a 
 collective initiative on creating a full-scale wrapper for JME3.

 Actually, I am starting to write my Clojure project with JME3 and I feel 
 like in a desperate need for a clojuric wrapper. So I started implementing 
 wrappers for Material, Texture, Geometry and so on.. but I think that that 
 code would be rather universal and there is no point for it to belong to a 
 personal project. So I think that we might start a community library 
 project on this with those who is interested. Besides that, I think that I 
 am a rather newb in Clojure and if I do that on my own, I will not do it as 
 good as possible :D Is somebody interested in that?


 I have a bunch of code for a game I'm working on, but I've taken a 
 slightly different approach to the problem than other people seem to have 
 so far.

 When you develop in a functional language like Clojure, you typically want 
 to quarantine all behaviour related to I/O, and avoid touching any mutable 
 values directly. In Ring, for instance, we limit the interaction with the 
 underlying servlet classes to a single function: the adapter.

 For jME3, I've been pursuing a similar approach. Essentially I'm aiming 
 for this:

   (run-app (atom initial-app-data))

 The only point of contact between the jME3 classes and the logic in 
 Clojure will be that single function. Everything else will happen through 
 modifying reference to a data structure.

  Right now I've got it working with geometries, textures, a simple HUD, 
 events, very limited physics, collisions, and I'm currently writing an 
 interface to NiftyGUI (which isn't easy, as it's not very well designed).

 The work I've done on this so far is part of a game, but could potentially 
 be factored out. Currently it's very much a work in progress, and I expect 
 it to take several months before I have anything useful outside of my 
 use-case.

 - James


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




Re: [ANN] Prismatic's Plumbing/Graph 0.1.0 is released with huge performance improvements

2013-05-02 Thread László Török
Hi,

 Does this make more sense?
Yes, it's all clear now. :)

 Do you forsee running into any issues with this change?
NATM.

thx

Las


2013/5/2 Jason Wolfe ja...@w01fe.com

 Yes, I suppose that's not very clear.

 Fnk attempts to guess the output schema of your function by looking at the
 body -- if the return value has literal map structure, this is
 automatically taken as the output schema.  Since this analysis is fragile
 (maps are created programatically, within a let, by a delegate fn, etc),
 you can also provide explicit ^:output-schema metadata on the argument
 vector of the fnk.

 The previous version of plumbing attempted to be smart and 'merge' these
 two sources of schema data.  Your explicit schema could provide additional
 details about structure, but  if it contradicted the literal map structure
 an exception was thrown.  Unfortunately, this required calling 'eval' on
 the explicit output schema so that it could be analyzed at compile time, in
 the case that it was itself not literal.  We decided that this was a bad
 idea, so now when you pass ^:output-schema metadata it's directly used as
 the output-schema rather than trying to reconcile with the fnk body,
 obviating the need for 'eval'.  Moreover, there used to be a special
 shortcut syntax that could be used in ^:output-schema, which was
 undocumented -- this has been removed, so ^:output-schema needs to be an
 actual schema.

 Does this make more sense?  Do you forsee running into any issues with
 this change?

 Thanks,
 Jason

 On Thursday, May 2, 2013 12:22:07 AM UTC-7, Las wrote:

 Hi,

 First all congratulations to the new release!

 Looking at the change log, I'm not sure I understand the following:
 Explicit output-schema metadata on a fnk is taken as gold, rather than
 being merged with explicit data by analyzing the fnk body, and must be
 explicit rather than a spec
 Thx

 Sent from my phone
 On May 1, 2013 8:46 PM, Jason Wolfe ja...@w01fe.com wrote:

 Version 0.1.0 of Prismatic's Plumbing/Graph has just been released.

 The biggest change is backwards-compatible performance improvements of up
 to 40x for eager compilation, brining Graph to within 20% or so of
 hand-coded performance for trivial node functions.  This was work done by
 Leon Barrett on a 'sprintbatical' from the Climate Corp, and he's written a
 great blog post about the update [1].  There are also a handful of small
 changes and improvements described in the changelog [2].

 We've also created a mailing list for Plumbing/Graph [3], so feel free to
 ask/answer questions, discuss feature requests/bugs, and generally talk
 about how you are or would like to use Plumbing/Graph there.

 Cheers,
 Jason

 [1] http://blog.getprismatic.com/**blog/2013/5/1/graph-faster-**
 abstractions-for-structured-**computationhttp://blog.getprismatic.com/blog/2013/5/1/graph-faster-abstractions-for-structured-computation
 [2] 
 https://github.com/Prismatic/**plumbing/blob/v0.1.0/**CHANGELOG.mdhttps://github.com/Prismatic/plumbing/blob/v0.1.0/CHANGELOG.md
 [3] 
 https://groups.google.com/**forum/#!forum/prismatic-**plumbinghttps://groups.google.com/forum/#!forum/prismatic-plumbing

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

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

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

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



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






-- 
László Török

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

Re: higher order functions and metadata

2013-05-02 Thread Phillip Lord
Tassilo Horn t...@gnu.org writes:
 I've been refactoring some code recently, part of which has include
 the introduction of higher-order function. But this is causing me some
 grief in terms of extra work. Let me give an example:

 user (defn my-function [x y])
 #'user/my-function
 user (doc my-function)
 -
 user/my-function
 ([x y])
   nil
 nil
 user (def my-partial-function (partial my-function 10))
 #'user/my-partial-function
 user (doc my-partial-function)
 -
 user/my-partial-function
   nil
 nil

 The problem is that documentation for my-partial-function doesn't
 include an arglist. Now I can add this in my hand, but that's a pain.

 Well, that's nothing special wrt. higher-order functions, but a
 limitation when you define functions with `def`.  E.g.,

   (def my-function (fn [x y]))

Yes, of course. But I have defn to use an option in this case. 


 But since you have to add the docstring by hand anyway, I don't think
 that's much of an issue:

   (def ^{:doc Applies my-function to 10 and y.
  :arglists '([y])}
my-partial-function (partial my-function 10))


Sure this is what I have been doing. But when the arglist is more
complex it is a pain and results in a lot of duplication. 

Phil

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




Re: The order of lazy-seq

2013-05-02 Thread Gary Verhaegen
lazy-seq only delays its own evaluation, it is not recursive :
(lazy-seq [0 1 2 3]) will evaluate the whole vector as soon as it is
forced. This means that it should wrap the tail of the lazy sequence
you are building.

Consequently, I find that the easiest way to use lazy-seq is as a
second argument to cons:

(def fib (cons 0 (cons 1 (lazy-seq (map + fib (rest fib))

but that might come from my playing with The Little Schemer.

On 1 May 2013 19:51, Stephen Compall stephen.comp...@gmail.com wrote:
 On Apr 30, 2013 5:32 AM, Liao Pengyu arise...@gmail.com wrote:
 (def fib
   (lazy-seq
 (concat [0 1] (map + fib (rest fib)
 (take 10 fib) ;; Bomb

 The expression (rest fib) forces fib, which is the lazy seq you are already
 trying to force when you eval (rest fib).

 (def fib
   (concat [0 1] (lazy-seq (map + fib (rest fib) ;; Works well

 Whereas here, fib has already been forced when you call (rest fib),

 (def fib
   (lazy-cat [0 1] (map + fib (rest fib ;; Works well

 And here forcing fib doesn't eval (rest fib).

 All of the above program using lazy-seq

 As you have seen, lazy-seq is not a silver bullet.

 --
 Stephen Compall
 If anyone in the MSA is online, you should watch this flythrough.

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



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




Re: higher order functions and metadata

2013-05-02 Thread Tassilo Horn
phillip.l...@newcastle.ac.uk (Phillip Lord) writes:

 Well, that's nothing special wrt. higher-order functions, but a
 limitation when you define functions with `def`.  E.g.,

   (def my-function (fn [x y]))

 Yes, of course. But I have defn to use an option in this case. 

Sure.  `defn` can walk the forms given to it to extract the argument
vectors automatically.

 But since you have to add the docstring by hand anyway, I don't think
 that's much of an issue:

   (def ^{:doc Applies my-function to 10 and y.
  :arglists '([y])}
my-partial-function (partial my-function 10))

 Sure this is what I have been doing. But when the arglist is more
 complex it is a pain and results in a lot of duplication.

The problem is that you can't get the arglists of `my-function` here,
because :arglists is metadata of the var #'my-function, not of the
function being its value.  If :arglists was metadata of functions, then
`partial`, `comp` and friends could return functions with correctly
generated :arglists (given that those are correct).

BTW: At least with complex macros, the real arglists are often very
different than what's in :arglists for documentation purposes.  For
example, look at what `(doc fn)` shows, yet its only real arglist is
just `[ sigs]`.

Bye,
Tassilo

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




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread John D. Hume
On May 2, 2013 2:04 AM, David Toomey dbtoo...@gmail.com wrote:
 Is there anything
 I could show that could reveal the problem?

Yes, you should have shown the stack trace of the exception (or at least
the part from the top of the text down to your code).

But even without that, you have an error coming out of noir.session that
says something is unbound where an atom was expected. That should send you
to the source for noir.session. There you'll see everything depends on the
dynamic global *noir-session*, which is only ever bound by
wrap-noir-session, which you're not calling. That's a compojure middleware
fn. Take a look at some compojure tutorial to see where and how they're
used.

There are likely other similar middleware fn calls noir will expect you to
have made. Hopefully having struggled with this one, figuring the others
out will be easy.

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




[ANN] conf-er 1.0.1

2013-05-02 Thread Adam Clements
A very simple library for loading application level config from a 
configuration file in a nice way, with caching and reloading functionality. 

Any other configuration libraries I found were either massively overkill 
for my needs (full on validation schemas built in), too complicated to set 
up and pass around or involved simply read-evaling a whole namespace which 
could be insecure depending where you get your config.

Simple but useful - I found myself duplicating this code in almost all my 
projects before making it into a library! Well tested and documented, there 
are very few moving parts so I expect this to stay stable and not really 
change over time.

Source:  https://github.com/TouchType/conf-er
Clojars: [conf-er 1.0.1]

The idea is to have a single configuration file which consists of a 
keyworded map, you then look up individual properties with nested keywords, 
for example your config file looks like this (simple EDN map):

;; my-config.conf
 {:username joe.bloggs
  :password letmein
  :database {:host 127.0.0.1
 :port 1234}
  :my.library/number 42}


And then look up the configuration from anywhere within your program! 
Simply include the conf-er namespace

(use 'conf-er) 


 (config :username) = joe.bloggs
 (configured? :database) = true
 (config :database) = {:host 127.0.0.1 :port 1234}
 (config :database :port) = 1234



Tell your program where to find the configuration file from your leiningen 
project.clj during development, or if you are distributing a jar then add 
the property onto the java command line call:

 ...
 :jvm-opts [-Dconfig=~/my-config.conf]
 ...


(config :database :connections) = (Exception Couldn't find :database 
:connections in configuration file)
(opt-config :database :connections) = nil

If you use this from within a library, you must namespace your 
configuration in case the application using your library also wishes to use 
conf-er. You can do this like so:

(ns my.library
   (:require [conf-er :refer [config]]))
 (config ::number) = 42

 
Here :number will expand out to the namespaced keyword :my.library/number, 
which we put in our configuration file earlier.

Hope this is of use to some people.

Adam 

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




Re: A JMonkeyEngine3 wrapper?

2013-05-02 Thread James Reeves
On 2 May 2013 12:09, Alex Fowler alex.murat...@gmail.com wrote:

 Hmm, interesting, but games usually involve much state and changes to keep
 up their worlds alive.. how do you abstract over this?


I work out what changes are required to the scene by comparing the current
data structure with the previous one, then change the scene accordingly.

I'm currently employing a very naive strategy: if the data structure
associated with a tree of nodes has changed, I remove all the child nodes
and recreate them from the data structure. This works well for a relatively
static world, and allows me to have around 50 moving NPCs in the scene and
still maintain 60 fps on modest hardware.

If I want more power, then I'd need a more sophisticated approach. For
instance, I could construct a custom data structure that maintains a log of
changes, then use that to mutate the jME3 node attributes that have
changed. However, I suspect I'll hit other bottlenecks (such as the number
of triangles my GPU can render) long before I need something quite that
complex.


As far as I see, Jonathan and I, too create the wrappers as a side-effect
 of a personal project. I just think that maybe it is possible to factor out
 and assemble the code to a separate library and if you need something in
 your project, you implement it straight to the library and commit. Of
 course that would require a kind of coordination like never before, but it
 is a real FTW and is prone to benifits like finding something you wanted to
 have already being implemented by someone!


My use case might be different enough to make this difficult. I'm using
jME3 classes to save time, but I deviate from standard jME3 practise when
it makes sense to do so. For instance, I don't use the AssetManager from
the SimpleApplication object, because it makes more sense to have a global
AssetManager.

- James

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




Re: higher order functions and metadata

2013-05-02 Thread Phillip Lord
Tassilo Horn t...@gnu.org writes:
 But since you have to add the docstring by hand anyway, I don't think
 that's much of an issue:

   (def ^{:doc Applies my-function to 10 and y.
  :arglists '([y])}
my-partial-function (partial my-function 10))

 Sure this is what I have been doing. But when the arglist is more
 complex it is a pain and results in a lot of duplication.

 The problem is that you can't get the arglists of `my-function` here,
 because :arglists is metadata of the var #'my-function, not of the
 function being its value.  If :arglists was metadata of functions, then
 `partial`, `comp` and friends could return functions with correctly
 generated :arglists (given that those are correct).


Yes, I know. Hence my thought that I have to do this with macros. It's a
shame that the function option including lambda's don't have this
metadata as well. 


 BTW: At least with complex macros, the real arglists are often very
 different than what's in :arglists for documentation purposes.  For
 example, look at what `(doc fn)` shows, yet its only real arglist is
 just `[ sigs]`.

Indeed. I am using this myself, and putting arglists in like

'([individual  classes][ontolology individual  classes])

which only works because I can distinguish between all the entities by
type (they are java objects), so disambiguiate. 

Well, I guess I will code up a simple macro; in my current case, I can
infer the arglists anyway. 

Thanks for the help!

Phil

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




Re: higher order functions and metadata

2013-05-02 Thread John D. Hume
On Thu, May 2, 2013 at 8:33 AM, Phillip Lord
phillip.l...@newcastle.ac.ukwrote:

 Well, I guess I will code up a simple macro; in my current case, I can
 infer the arglists anyway.


Once you do, be sure to weigh the complexity against:

(defn my-partial-function [y] (my-function 10 y))

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




Re: [ANN] Instaparse 1.0.0

2013-05-02 Thread Max Gonzih
Hi, what do you think about dsl version using map?
Nice Idea was proposed here 
http://www.reddit.com/r/Clojure/comments/1djbio/growing_a_lanugage_with_clojure_and_instaparse/c9qwv4d

On Tuesday, April 9, 2013 12:41:38 PM UTC+3, puzzler wrote:

 On Tue, Apr 9, 2013 at 1:33 AM, Tassilo Horn ts...@gnu.org 
 javascript:wrote:

 Nice, but providing the grammar as a plain string looks somewhat
 unnatural to me.  Why not something like this (parser being a macro)?

 (def as-and-bs
   (parser
 S  = AB* .
 AB = A B .
 A  = a + .
 B  = b + .))

 I.e., symbols denote non-terminals, strings denote terminals, and the
 dot indicates the end of a rule.

 Bye,
 Tassilo


 I played around with that, but even if you suppress evaluation by using a 
 macro, Clojure's reader makes strong assumptions about certain symbols.  
 For example, it is standard in EBNF notation for {} to mean zero-or-more.  
 But if you include {A B C} in your grammar using the macro approach, 
 Clojure's reader will throw an error because it treats {} as a map and 
 expects an even number of forms to follow.  That was the main reason, but 
 it also makes the notation much more sensitive to whitespace (for example, 
 AB * versus AB*).  Gradually, those little issues start making it look less 
 and less like traditional notation.  There's something really nice about 
 just being able to copy and paste a grammar off of a website and have it 
 just work.

 I understand where you're coming from, though.  It definitely is part of 
 the Clojure culture to avoid string representations for many kinds of data 
 (e.g., SQL queries).  We do accept it for regular expressions, and for 
 things like #inst 2011-12-31T19:00:00.000-05:00, though, and that's the 
 kind of feel I was going for.  Would it be more psychologically palatable 
 to type:
 #insta/parser S = 'a' 'b'
 rather than
 (insta/parser S = 'a' 'b')
 ?

 What do you think would be gained by making it a macro?  From my 
 perspective, a macro is essentially just a string that is being processed 
 by the Clojure reader (and thus subject to its constraints).  If the 
 grammar were expressed in the way you propose, is it any easier to build up 
 a grammar programmatically?  Is it any easier to compose grammars?  If 
 anything, I think it might be harder.

 Thanks for the comments,

 Mark


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




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread David Toomey


On May 2, 5:21 am, John D. Hume duelin.mark...@gmail.com wrote:
 On May 2, 2013 2:04 AM, David Toomey dbtoo...@gmail.com wrote:

  Is there anything
  I could show that could reveal the problem?

 Yes, you should have shown the stack trace of the exception (or at least
 the part from the top of the text down to your code).

 But even without that, you have an error coming out of noir.session that
 says something is unbound where an atom was expected. That should send you
 to the source for noir.session. There you'll see everything depends on the
 dynamic global *noir-session*, which is only ever bound by
 wrap-noir-session, which you're not calling. That's a compojure middleware
 fn. Take a look at some compojure tutorial to see where and how they're
 used.

 There are likely other similar middleware fn calls noir will expect you to
 have made. Hopefully having struggled with this one, figuring the others
 out will be easy.

Wow. What an amazing answer.

The stack trace: The main error is the title of this thread. The
second line is something about swap! and clojure.core, the next line
traces directly to the line of code that I pointed out 2 times above.
The next line after that points to a route, which I posted above as
well.

Here is the login code from 4clojure: what middleware and what call
to wrap-noir-session is being used here?

(defn do-login [user pwd]
  (let [user (.toLowerCase user)
{db-pwd :pwd} (from-mongo (fetch-one :users :where {:user
user}))
location (session/get :login-to)]
(if (and db-pwd (.checkPassword (StrongPasswordEncryptor.) pwd
db-pwd))
  (do (update! :users {:user user}
   {:$set {:last-login (java.util.Date.)}}
:upsert false) ; never create new users
accidentally
  (session/put! :user user)
  (session/remove! :login-to)
  (response/redirect (or location /problems)))
  (flash-error /login Error logging in.

Clearly, there is none.

Then you give me a total fuck you answer, Hopefully having struggled
with this one, figuring the others out will be easy.

How is that at all helpful? You tell me to look at the Lib-Noir source
and the source says exactly what I already knew (because, clearly you
are psychic and you know that I didn't look already). Wait... do you
want me to ask Google for a Clojure login page tutorial? Done, do you
know what the first several hits are? My blog which explains how to do
it in Noir. The next few are Stack Overflow threads asking about
creating login pages and this very topic:

This thread, with 4 upvotes is unanswered:
http://stackoverflow.com/questions/14806063/howto-use-lib-noir-stateful-sessions-in-compojure

Four upvotes is quite a lot for a Clojure question. This probably
indicates that this is a broad issue that affects many people. Why?
Because of this shit right here. Clojure is a beautiful language, but
these kind of LOL answers are exactly why the community sucks (I've
read and heard more that a few disturbing complaints) and why people
don't want to learn the language, which is further exacerbated by the
sub-optimal documentation and don't even get me started on the half-
assed tutorials (Look at WHAT middleware tutorial?). If a person just
coming to Clojure is struggling to create something incredibly basic
(hell, IDK, a login page?) and when asked, can't get a civil response,
then the language is toast.

I linked to my github. Does the projects look like the work of someone
that is an utter moron at this language or Lisp in general?

Let me take this moment to help you: the correct way to answer the
question is to direct me to a *reputable* source that touches on this
issue, and maybe just maybe accept the retarded idea that I showed you
EXACTLY where the stacktraces pointed (which I did). If all else
fails, you can even tell me the answer or at least try to answer it in
a way that isn't utterly condescending or act like you can't look at 5
LOC and not comprehend that error on this line means error on
this line. Clearly, I don't see what the issue is and I am asking for
help to see where my logic is wrong: I'm not asking you to be an ass.

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




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread John D. Hume
I've never used noir and have barely used 4clojure, but both of them
apparently do hidden global things that make it hard to know the context in
which your code is running. Your app needs to be wrapped in noir's
`wrap-noir-session` middleware in much the same way this blog post shows
Ring's `wrap-session` being used:

http://rjevans.net/post/2628238502/session-support-in-compojure-ring
https://gist.github.com/mirrormatch/768768

I'll leave it at that.

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




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread Jay Fields
On Thursday, May 2, 2013 10:19:51 AM UTC-4, David Toomey wrote:


 [snipped]


If you want help in the future, I'd recommend spending less time demanding 
answers and more time reading responses and code.

I've never looked at the 4clojure source, didn't even know it was on 
github. I've never used ring, compojure, or any other clojure web 
framework. The total time it took me to clone the 4clojure repo, grep for 
what John recommended, and get you this link (
https://github.com/4clojure/4clojure/blob/develop/src/foreclojure/core.clj#L58),
 
about 30 seconds.

Python has been around significantly longer, and has a much larger 
community. If you need that level of support, I don't think Clojure is the 
right language for you.

Cheers, Jay

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




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread gaz jones
 Does the projects look like the work of someone that is an utter moron

... your response certainly is.


On Thu, May 2, 2013 at 10:28 AM, Jay Fields j...@jayfields.com wrote:

 On Thursday, May 2, 2013 10:19:51 AM UTC-4, David Toomey wrote:


 [snipped]


 If you want help in the future, I'd recommend spending less time demanding
 answers and more time reading responses and code.

 I've never looked at the 4clojure source, didn't even know it was on
 github. I've never used ring, compojure, or any other clojure web
 framework. The total time it took me to clone the 4clojure repo, grep for
 what John recommended, and get you this link (
 https://github.com/4clojure/4clojure/blob/develop/src/foreclojure/core.clj#L58),
 about 30 seconds.

 Python has been around significantly longer, and has a much larger
 community. If you need that level of support, I don't think Clojure is the
 right language for you.

 Cheers, Jay

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




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




Re: higher order functions and metadata

2013-05-02 Thread Phillip Lord
John D. Hume duelin.mark...@gmail.com writes:

 On Thu, May 2, 2013 at 8:33 AM, Phillip Lord
 phillip.l...@newcastle.ac.ukwrote:

 Well, I guess I will code up a simple macro; in my current case, I can
 infer the arglists anyway.


 Once you do, be sure to weigh the complexity against:

 (defn my-partial-function [y] (my-function 10 y))


I'd thought about that. Most of my functions are actually increasing the
arity, and a few other bits of bobs in between. Another option would be

(defn my-partial-function [y]
((partial my-function 10) y))

which is functionally equivalent. 

The reason for doing this is that I have 20 or 30 functions all of the
same form, and they currently have more boilerplate than I like. 

Phil

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




Re: emacs - how to wean me off the family of Java IDEs

2013-05-02 Thread Phil Hagelberg

Devin Walters writes:

 Voicing strong disagreement with using emacs-live as a starting
 point. One reason: They rebind a bunch of default emacs bindings,
 which is just fine by me, but C-h to a newcomer is important, and IIRC
 they rebound it.

 I think Phil's emacs-starter-kit modules/packages are a better place to start.

Eh; even the Starter Kit does way too much. It's a common problem with
newcomers who pull in these huge packages that bundle lots of unrelated
functionality together; it's difficult to debug when things don't work
right since you can't tell where a specific piece of functionality comes
from.

These days I recommend pulling in small specific packages for the
things you want rather than a one-size-fits-all config. It means a
little more reading and exploring up front, but it pays off in the end.

I spun off the bare minimum from the Starter Kit into a small, focused,
actually-documented package called better-defaults.el that might be a
good starting place:

https://github.com/technomancy/better-defaults

I plan on doing more work around documenting useful packages in the
future along with putting together some kind of high-level ecosystem
guide, but haven't gotten to it yet. In the mean time, reading the
source for the Starter Kit can be illuminating, even if you don't use it
outright.

-Phil


pgp81vlCdnoBW.pgp
Description: PGP signature


Re: ANN Scrypt 1.0.0

2013-05-02 Thread Manuel Paccagnella
Nice! Thank you for open-sourcing it.

Il giorno giovedì 2 maggio 2013 10:10:38 UTC+2, Michael Klishin ha scritto:

 Scrypt is a tiny Clojure library for working with the scrypt key derivation
 function. It is an alternative to bcrypt and PBKDF2.

 Release notes:
 http://blog.clojurewerkz.org/blog/2013/05/02/scrypt-1-dot-0-0-is-released/
 -- 
 MK

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

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




Re: emacs - how to wean me off the family of Java IDEs

2013-05-02 Thread Devin Walters
I agree with you, but personally found that the starter-kit wasn't as divergent 
from the norm as emacs-live and didn't have as many strong opinions. My big 
complaint is really just the rebinding of C-h. It's important for newcomers to 
be able to use that to learn about bindings and so on that are custom. I 
basically just learned how to use the help commands and then extracted the 
portions of the starter kit I wanted over time.
—
Sent via Mobile

On Thu, May 2, 2013 at 11:17 AM, Phil Hagelberg p...@hagelb.org wrote:

 Devin Walters writes:
 Voicing strong disagreement with using emacs-live as a starting
 point. One reason: They rebind a bunch of default emacs bindings,
 which is just fine by me, but C-h to a newcomer is important, and IIRC
 they rebound it.

 I think Phil's emacs-starter-kit modules/packages are a better place to 
 start.
 Eh; even the Starter Kit does way too much. It's a common problem with
 newcomers who pull in these huge packages that bundle lots of unrelated
 functionality together; it's difficult to debug when things don't work
 right since you can't tell where a specific piece of functionality comes
 from.
 These days I recommend pulling in small specific packages for the
 things you want rather than a one-size-fits-all config. It means a
 little more reading and exploring up front, but it pays off in the end.
 I spun off the bare minimum from the Starter Kit into a small, focused,
 actually-documented package called better-defaults.el that might be a
 good starting place:
 https://github.com/technomancy/better-defaults
 I plan on doing more work around documenting useful packages in the
 future along with putting together some kind of high-level ecosystem
 guide, but haven't gotten to it yet. In the mean time, reading the
 source for the Starter Kit can be illuminating, even if you don't use it
 outright.
 -Phil

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




Re: emacs - how to wean me off the family of Java IDEs

2013-05-02 Thread Gary Trakhman
After a year and a half of use, I still don't know anything about C-h, I've
gotten by for a year or so on 'M-x describe-bindings' and more ad-hoc
methods of finding stuff out.


On Thu, May 2, 2013 at 1:29 PM, Devin Walters dev...@gmail.com wrote:

 I agree with you, but personally found that the starter-kit wasn't as
 divergent from the norm as emacs-live and didn't have as many strong
 opinions. My big complaint is really just the rebinding of C-h. It's
 important for newcomers to be able to use that to learn about bindings and
 so on that are custom. I basically just learned how to use the help
 commands and then extracted the portions of the starter kit I wanted over
 time.
 —
 Sent via Mobile


 On Thu, May 2, 2013 at 11:17 AM, Phil Hagelberg p...@hagelb.org wrote:

 null
 **contents.asc**


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




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




ANN Titanium 1.0.0-beta1 is released

2013-05-02 Thread Michael Klishin
Titanium [1] is a Clojure graph library built on top of Aurelius Titan.

1.0.0-beta1 is a major development milestone that upgrade Titanium to Titan
0.3,
extracts Blueprints graph operations into a separate library (Archimedes)
and
switches Titanium to Ogre [2] for graph querying. This release has major
public API changes.

Archimedes and Ogre also matured quite a bit since the last Titanium
release.

Release notes:
http://blog.clojurewerkz.org/blog/2013/05/02/titanium-1-dot-0-0-beta1-is-released/

I'd like to thank Zack Maril for his hard work on Titanium, Archimedes and
Ogre.
Clojure shapes up to be a great ecosystem for data processing and graph
analysis
in general, in large part thanks to his efforts!

1. http://titanium.clojurewerkz.org
2. http://ogre.clojurewerkz.org
-- 
MK

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

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




Re: [ANN] Instaparse 1.0.0

2013-05-02 Thread Mark Engelberg
On Thu, May 2, 2013 at 7:19 AM, Max Gonzih gon...@gmail.com wrote:

 Hi, what do you think about dsl version using map?


The short answer is that this is already supported.  In the github readme,
you'll find a section labeled Combinators, in which I outline
instaparse's dsl for creating grammars as a map from keywords to
combinators.

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




Re: ANN Titanium 1.0.0-beta1 is released

2013-05-02 Thread Zack Maril
Michael is being far too kind. We've already had multiple people from the 
Clojure community opening issues and pull requests on all three of the 
graphy projects.  Thank you all! On the flip side, if you are interested in 
getting started with (or getting involved) with these projects, shoot me an 
email and I'll find a juicy morsel or issue for you to work on. I've got 
more cool and interesting ideas to work on than I can handle right now and 
I'm always happy to help people get started. I'm trying to take care of the 
dirty API/documentation work so you can focus on doing all the cool stuff.
-Zack

On Thursday, May 2, 2013 10:24:37 PM UTC+4, Michael Klishin wrote:

 Titanium [1] is a Clojure graph library built on top of Aurelius Titan.

 1.0.0-beta1 is a major development milestone that upgrade Titanium to 
 Titan 0.3,
 extracts Blueprints graph operations into a separate library (Archimedes) 
 and
 switches Titanium to Ogre [2] for graph querying. This release has major 
 public API changes.

 Archimedes and Ogre also matured quite a bit since the last Titanium 
 release.

 Release notes:

 http://blog.clojurewerkz.org/blog/2013/05/02/titanium-1-dot-0-0-beta1-is-released/

 I'd like to thank Zack Maril for his hard work on Titanium, Archimedes and 
 Ogre.
 Clojure shapes up to be a great ecosystem for data processing and graph 
 analysis
 in general, in large part thanks to his efforts!

 1. http://titanium.clojurewerkz.org
 2. http://ogre.clojurewerkz.org
 -- 
 MK

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

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




More idiomatic way to use map like this?

2013-05-02 Thread Steven Degutis
Given pseudo-code (Ruby-ish):

due = 100
cards = cards.map do |card|
card.applied_balance = max(0, due - card.balance)
due -= card.applied_balance

Notice how due changes at each turn, and each successive item in
cards sees the change.

What's an idiomatic way to do this in Clojure without using refs?

-Steven

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




Re: More idiomatic way to use map like this?

2013-05-02 Thread Ben Wolfson
You can use reduce to carry forward both the new value on the cards, and
the new value of due.

user (let [due 100
cards [{:balance 120} {:balance 30} {:balance 35} {:balance
40}]]
(reduce (fn [[due cards] card]
(let [applied (max 0 (- due (:balance card)))]
  [(- due applied) (conj cards (assoc card
:applied-balance applied))]))
[due []]
cards))
[30 [{:applied-balance 0, :balance 120} {:applied-balance 70, :balance 30}
{:applied-balance 0, :balance 35} {:applied-balance 0, :balance 40}]]

The first item in the result is the remaining balance, the second is
mutated cards.



On Thu, May 2, 2013 at 2:21 PM, Steven Degutis sbdegu...@gmail.com wrote:

 Given pseudo-code (Ruby-ish):

 due = 100
 cards = cards.map do |card|
 card.applied_balance = max(0, due - card.balance)
 due -= card.applied_balance

 Notice how due changes at each turn, and each successive item in
 cards sees the change.

 What's an idiomatic way to do this in Clojure without using refs?

 -Steven

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





-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure.
[Larousse, Drink entry]

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




Re: [ANN] stories - bdd lib for clojure

2013-05-02 Thread Jeroen van Dijk
Sounds interesting. The repo seems to be unavailable on Github, is that
correct?

Jeroen


On Sun, Apr 28, 2013 at 3:52 PM, Steven Degutis sbdegu...@gmail.com wrote:

 Great, thanks.

 Now it's at https://clojars.org/stories

 -Steven


 On Sun, Apr 28, 2013 at 1:25 AM, Michael Klishin 
 michael.s.klis...@gmail.com wrote:

 2013/4/28 Steven Degutis sbdegu...@gmail.com

 I'd put it on Clojars but I can't really figure out how to deal with
 this gpg stuff. Seems way more complicated. Wish clojure had something
 easier, like homebrew and melpa. But whatever.


 GPG signint is currently optional.

 lein do pom, jar
 scp pom.xml target/[library]-[version].jar cloj...@clojars.org:


 --
 MK

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

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




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




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




Re: [ANN] stories - bdd lib for clojure

2013-05-02 Thread Steven Degutis
Yeah I deleted it. Realized it's not worth anyone's time.

On Thu, May 2, 2013 at 4:44 PM, Jeroen van Dijk
jeroentjevand...@gmail.com wrote:
 Sounds interesting. The repo seems to be unavailable on Github, is that
 correct?

 Jeroen


 On Sun, Apr 28, 2013 at 3:52 PM, Steven Degutis sbdegu...@gmail.com wrote:

 Great, thanks.

 Now it's at https://clojars.org/stories

 -Steven


 On Sun, Apr 28, 2013 at 1:25 AM, Michael Klishin
 michael.s.klis...@gmail.com wrote:

 2013/4/28 Steven Degutis sbdegu...@gmail.com

 I'd put it on Clojars but I can't really figure out how to deal with
 this gpg stuff. Seems way more complicated. Wish clojure had something
 easier, like homebrew and melpa. But whatever.


 GPG signint is currently optional.

 lein do pom, jar
 scp pom.xml target/[library]-[version].jar cloj...@clojars.org:


 --
 MK

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

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




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




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



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




Re: More idiomatic way to use map like this?

2013-05-02 Thread Gavin Grover
Is this code applying an amount due against a customer's list of credit 
cards? If so, there seems to be a bug. The third line should be:

  card.appliedBalance = min(due, card.balance)

and the Clojure code I'd write is:

  (defrecord Card [balance applied-balance])

  (defn apply-due-to-cards [[due new-cards] card]
(let [applied-bal (min due (:balance card))]
  [(- due applied-bal)
   (conj new-cards (-Card (:balance card) applied-bal))]))

  (assert (=
(reduce apply-due-to-cards [100 []]
  [(-Card 10  0) (-Card 30  0) (-Card 150  0)])
[0
  [(-Card 10 10) (-Card 30 30) (-Card 150 60)]]))

Also four lines long like the Ruby example, but it's easier to debug when 
there's a bug just by changing `reduce` to `reductions`. It's also 
threadsafe, and can be parallelized for large datasets by using the Clojure 
5 Reducers library.


On Friday, May 3, 2013 5:21:46 AM UTC+8, Steven Degutis wrote:

 Given pseudo-code (Ruby-ish): 

 due = 100 
 cards = cards.map do |card| 
 card.applied_balance = max(0, due - card.balance) 
 due -= card.applied_balance 

 Notice how due changes at each turn, and each successive item in 
 cards sees the change. 

 What's an idiomatic way to do this in Clojure without using refs? 

 -Steven 


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




Re: [ANN] stories - bdd lib for clojure

2013-05-02 Thread Paulo Suzart
Wow. 

Got surprised with 404! Sad.

On Thursday, May 2, 2013 6:58:57 PM UTC-3, Steven Degutis wrote:

 Yeah I deleted it. Realized it's not worth anyone's time. 

 On Thu, May 2, 2013 at 4:44 PM, Jeroen van Dijk 
 jeroentj...@gmail.com javascript: wrote: 
  Sounds interesting. The repo seems to be unavailable on Github, is that 
  correct? 
  
  Jeroen 
  
  
  On Sun, Apr 28, 2013 at 3:52 PM, Steven Degutis 
  sbde...@gmail.comjavascript: 
 wrote: 
  
  Great, thanks. 
  
  Now it's at https://clojars.org/stories 
  
  -Steven 
  
  
  On Sun, Apr 28, 2013 at 1:25 AM, Michael Klishin 
  michael@gmail.com javascript: wrote: 
  
  2013/4/28 Steven Degutis sbde...@gmail.com javascript: 
  
  I'd put it on Clojars but I can't really figure out how to deal with 
  this gpg stuff. Seems way more complicated. Wish clojure had 
 something 
  easier, like homebrew and melpa. But whatever. 
  
  
  GPG signint is currently optional. 
  
  lein do pom, jar 
  scp pom.xml target/[library]-[version].jar 
  clo...@clojars.orgjavascript:: 

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


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




Re: [ANN] stories - bdd lib for clojure

2013-05-02 Thread Steven Degutis
Here, it's back up for a while: https://github.com/sdegutis/stories

Please fork it.

-Steven

On Thu, May 2, 2013 at 5:36 PM, Paulo Suzart paulosuz...@gmail.com wrote:
 Wow.

 Got surprised with 404! Sad.


 On Thursday, May 2, 2013 6:58:57 PM UTC-3, Steven Degutis wrote:

 Yeah I deleted it. Realized it's not worth anyone's time.

 On Thu, May 2, 2013 at 4:44 PM, Jeroen van Dijk
 jeroentj...@gmail.com wrote:
  Sounds interesting. The repo seems to be unavailable on Github, is that
  correct?
 
  Jeroen
 
 
  On Sun, Apr 28, 2013 at 3:52 PM, Steven Degutis sbde...@gmail.com
  wrote:
 
  Great, thanks.
 
  Now it's at https://clojars.org/stories
 
  -Steven
 
 
  On Sun, Apr 28, 2013 at 1:25 AM, Michael Klishin
  michael@gmail.com wrote:
 
  2013/4/28 Steven Degutis sbde...@gmail.com
 
  I'd put it on Clojars but I can't really figure out how to deal with
  this gpg stuff. Seems way more complicated. Wish clojure had
  something
  easier, like homebrew and melpa. But whatever.
 
 
  GPG signint is currently optional.
 
  lein do pom, jar
  scp pom.xml target/[library]-[version].jar clo...@clojars.org:
 
 
  --
  MK
 
  http://github.com/michaelklishin
  http://twitter.com/michaelklishin
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.com
  Note that posts from new members are moderated - please be patient
  with
  your first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.com
  Note that posts from new members are moderated - please be patient with
  your first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.com
  Note that posts from new members are moderated - please be patient with
  your
  first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

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



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




Re: ANN: vim-redl -- advanced fuzzy omnicompletion and VimClojure-style repl with enhanced debugging features

2013-05-02 Thread Paulo Suzart
Hi,

This is what I get using the head of master.

Typed :ReplHere

E117: Unknown function: fireplace#ns
E116: Invalid arguments for function redl#repl#create

no idea what is going on.


On 4 April 2013 22:19, dgrnbrg dsg123456...@gmail.com wrote:

 You there are plug mappings for all the repl actions:

 Plugclj_repl_enter. -- key for enter press
 Plugclj_repl_eval. -- key to for evaluation in the middle of the repl
 (i.e. not at the end of the form)
 Plugclj_repl_hat. -- equivalent to ^
 Plugclj_repl_Ins. -- equivalent to I
 Plugclj_repl_uphist. -- history up
 Plugclj_repl_downhist. -- history down

 You can look at the repl.vim file to see how to make new mappings. I
 create the default repl mappings only if you haven't provided custom ones.

 On Thursday, April 4, 2013 12:40:38 PM UTC-4, Max Gonzih wrote:

 So I got it working and it's pretty cool. But is there any options to
 remap default keys (for example I'm using -_ instead of $^)?

 Thanks

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






-- 
Paulo Suzart
@paulosuzart

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




Re: ANN: vim-redl -- advanced fuzzy omnicompletion and VimClojure-style repl with enhanced debugging features

2013-05-02 Thread Ryan Stradling
Make sure to have vimfireplace installed and a repl up and going for the 
project.

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




Re: More idiomatic way to use map like this?

2013-05-02 Thread Steven Degutis
Epic win. Thanks guys, this is a really neat technique! I was thinking
the solution must be something like reduce but with two values, the
due amount and the cards, but I couldn't figure out how to get the
cards to map. Turns out conj was the missing piece of the puzzle.
Thanks again!

On Thu, May 2, 2013 at 5:34 PM, Gavin Grover
gavingroovygro...@gmail.com wrote:
 Is this code applying an amount due against a customer's list of credit
 cards? If so, there seems to be a bug. The third line should be:

   card.appliedBalance = min(due, card.balance)

 and the Clojure code I'd write is:

   (defrecord Card [balance applied-balance])

   (defn apply-due-to-cards [[due new-cards] card]
 (let [applied-bal (min due (:balance card))]
   [(- due applied-bal)
(conj new-cards (-Card (:balance card) applied-bal))]))

   (assert (=
 (reduce apply-due-to-cards [100 []]
   [(-Card 10  0) (-Card 30  0) (-Card 150  0)])
 [0
   [(-Card 10 10) (-Card 30 30) (-Card 150 60)]]))

 Also four lines long like the Ruby example, but it's easier to debug when
 there's a bug just by changing `reduce` to `reductions`. It's also
 threadsafe, and can be parallelized for large datasets by using the Clojure
 5 Reducers library.


 On Friday, May 3, 2013 5:21:46 AM UTC+8, Steven Degutis wrote:

 Given pseudo-code (Ruby-ish):

 due = 100
 cards = cards.map do |card|
 card.applied_balance = max(0, due - card.balance)
 due -= card.applied_balance

 Notice how due changes at each turn, and each successive item in
 cards sees the change.

 What's an idiomatic way to do this in Clojure without using refs?

 -Steven

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



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




Re: More idiomatic way to use map like this?

2013-05-02 Thread Armando Blancas
This isn't idiomatic but can be useful for modeling mutable computations in 
pure functions:

(use '[blancas.morph core monads])
 
(def cards [{:balance 30} {:balance 25}])
(def due 100)
 
(run-state (mapm #(monad [due get-state
  app (state (min due (:balance %)))
  _   (put-state (- due app))]
(state (assoc % :applied-balance app))) cards) due)

mapm is a map for monads; (state x) boxes cards; the state is the total due.

;Pair([{:balance 30, :applied-balance 30} {:balance 25, :applied-balance 
25}],45)

On Thursday, May 2, 2013 8:34:41 PM UTC-7, Steven Degutis wrote:

 Epic win. Thanks guys, this is a really neat technique! I was thinking 
 the solution must be something like reduce but with two values, the 
 due amount and the cards, but I couldn't figure out how to get the 
 cards to map. Turns out conj was the missing piece of the puzzle. 
 Thanks again! 

 On Thu, May 2, 2013 at 5:34 PM, Gavin Grover 
 gavingro...@gmail.com javascript: wrote: 
  Is this code applying an amount due against a customer's list of credit 
  cards? If so, there seems to be a bug. The third line should be: 
  
card.appliedBalance = min(due, card.balance) 
  
  and the Clojure code I'd write is: 
  
(defrecord Card [balance applied-balance]) 
  
(defn apply-due-to-cards [[due new-cards] card] 
  (let [applied-bal (min due (:balance card))] 
[(- due applied-bal) 
 (conj new-cards (-Card (:balance card) applied-bal))])) 
  
(assert (= 
  (reduce apply-due-to-cards [100 []] 
[(-Card 10  0) (-Card 30  0) (-Card 150  0)]) 
  [0 
[(-Card 10 10) (-Card 30 30) (-Card 150 60)]])) 
  
  Also four lines long like the Ruby example, but it's easier to debug 
 when 
  there's a bug just by changing `reduce` to `reductions`. It's also 
  threadsafe, and can be parallelized for large datasets by using the 
 Clojure 
  5 Reducers library. 
  
  
  On Friday, May 3, 2013 5:21:46 AM UTC+8, Steven Degutis wrote: 
  
  Given pseudo-code (Ruby-ish): 
  
  due = 100 
  cards = cards.map do |card| 
  card.applied_balance = max(0, due - card.balance) 
  due -= card.applied_balance 
  
  Notice how due changes at each turn, and each successive item in 
  cards sees the change. 
  
  What's an idiomatic way to do this in Clojure without using refs? 
  
  -Steven 
  
  -- 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient with 
 your 
  first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  Clojure group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  


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




Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread David Toomey


On May 2, 7:59 am, John D. Hume duelin.mark...@gmail.com wrote:
 I've never used noir and have barely used 4clojure, but both of them
 apparently do hidden global things that make it hard to know the context in
 which your code is running. Your app needs to be wrapped in noir's
 `wrap-noir-session` middleware in much the same way this blog post shows
 Ring's `wrap-session` being used:

 http://rjevans.net/post/2628238502/session-support-in-compojure-ringhttps://gist.github.com/mirrormatch/768768

 I'll leave it at that.

Cool, thanks.

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