Re: clojurescript failing silently?

2012-10-29 Thread David Mohs
Sorry to revive this old thread, but I want to answer a question I had in 
exactly the place I looked for the answer months ago.

On Friday, July 6, 2012 3:12:40 AM UTC-4, kovasb wrote:
>
> On Fri, Jul 6, 2012 at 2:59 AM, David Nolen 
> > 
> wrote: 
> > On Fri, Jul 6, 2012 at 2:43 AM, kovas boguta 
> > > 
> wrote: 
> >> For instance the protocol in the namespace that I forget to quality 
> >> doesn't get recognized: 
> >> WARNING: Symbol mvc/IMVC is not a protocol at line 38 
> >> src/cljs/client/subsession.cljs 
> >> 
> >> yet it works anyway. (have no idea how to make that go away) 
>

I had a properly namespaced protocol used in a number of places that worked 
perfectly, but I always got a compiler warning of the above form. I learned 
to ignore it, but it definitely hurt productivity.

For me, the fix was to replace the dashes in the file name with 
underscores. I renamed "my-thing.cljs" to "my_thing.cljs" and the warning 
went away.

Cheers,
-David

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

Re: Build Issues with Eclipse

2012-10-29 Thread David McNeil
Does this thread address your need?

https://groups.google.com/forum/?fromgroups=#!searchin/clojure/local$20repository$20/clojure/1Ne8RqiffVI/aGoCPWiiCakJ

-David

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

Build Issues with Eclipse

2012-10-29 Thread JvJ
I'm working on a project that requires clojure-java interop.  I'd like to 
have a clojure project referenced by a java project, but there seems to be 
some issues.

First of all, I can't seem to get the standard ccw Clojure project to 
generate any compiled classes, so I've resorted to using Leiningen 
projects.  However, I don't understand how
to get the Lein projects to recognize local Jar/native dependencies (I 
don't mean local repositories, I mean local files).  I'm sharing the 
project with another person on GitHub, and
I'd like all the dependencies to be as localized as possbile.

Does anyone have a solution to this problem?  Thanks.

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

Re: monads

2012-10-29 Thread Michael Bradley, Jr.
On Friday, October 26, 2012 11:06:59 AM UTC-5, Brian Craft wrote:

> I've read about four tutorials on monads so far, but it still escapes me.
>
> In fact, I'm still not sure what problem it solves. I'm familiar with the 
> problem of having, say, three functions like f(a) -> b, g(c) -> d, h(e) -> 
> f, which you'd like to chain like f(g(h(x))), but you can't because b is a 
> different type from c and d is a different type from e. The monad tutorials 
> all start with a problem like this, but I still can't tell if they're 
> actually providing a solution, because it appears every monad is specific 
> to a particular type. E.g. a sequence monad. So, great, I have something 
> that takes a scalar and returns a sequence. That might solve g(h(x)) if f 
> is a scalar and c is a sequence by letting me write g(s(h(x))), but it 
> doesn't solve the whole problem, since I still have f() to worry about.
>
> 
>


Brian, you may have looked at it already, but I found Konrad Hinsen's 
4-part tutorial linked from the README in Clojure's algo.monads repository 
to be quite helpful:

https://github.com/clojure/algo.monads

By the way, the links in that README to Jim Duey's tutorials are broken; 
here is the correct link to Part 1 of Jim's tutorials:

http://www.intensivesystems.net/tutorials/monads_101.html

I read Jim's tutorials first, and then tried Konrad's. I found the latter a 
bit more helpful. Also, Konrad's explanation of the state monad in Part 3 
really "clicked" with me, so I felt it was worth working through Parts 1 
and 2, even though I was still scratching my head a bit when I finished 
Part 2.

Jim also has a more recent set of blog posts dedicated to exploring monads:

http://www.clojure.net/archive.html

I worked from the bottom of that list to the top, after reading the other 
tutorials, and came away with a basic but sound understanding of the core 
concepts:  m-result, m-bind, the Monad Laws, etc.

Also note that Jim has developed a new monads library for Clojure, 
implemented with protocols:

https://github.com/jduey/protocol-monads

Working through that library's test suite seems like a good way improve 
one's understanding of monads; also, I'm going to try to "port" the 
examples from algo.monads over to protocol-monads. I haven't done that yet, 
but when I do you will be able to find them in my fork of protocol-monads 
(if things go well, I'll submit a pull request):

https://github.com/michaelsbradleyjr/protocol-monads/blob/examples/src/examples/monads.clj

The original examples for algo.monads:

https://github.com/clojure/algo.monads/blob/master/src/examples/clojure/examples/monads.clj

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

Re: Cdr car

2012-10-29 Thread Andy Fingerhut
I typed up the transcript, and as a result of this message decided to republish 
the transcript in a place that isn't gone yet:

http://jafingerhut.github.com/clojure-info/clojure-for-lispers-transcript.txt

If anyone has permission to update the link to the transcript beneath part 1 of 
the video on blip.tv, it would be cool if they did that.

Andy

On Oct 17, 2012, at 12:10 PM, Jeff Heon wrote:

> If I may suggest the following presentation:
> 
> http://blip.tv/clojure/clojure-for-lisp-programmers-part-1-1319721
> http://blip.tv/clojure/clojure-for-lisp-programmers-part-2-1319826
> 
> There used to a transcript available on the newsgroup until Google decided to 
> remove all files from newsgroup 8)
> 
> On Wednesday, October 17, 2012 2:16:01 PM UTC-4, Curtis wrote:
> Cons seems to be strange
> 
> How do i use Cons with an atom to make a list?
> 
> (cons 1 1) 
>  
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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

Re: compile fails but stack trace does not mention a line of code in my app

2012-10-29 Thread Ambrose Bonnaire-Sergeant
This error is much better in Clojure 1.5.0-beta1.

#

Thanks,
Ambrose

On Tue, Oct 30, 2012 at 12:26 AM, larry google groups <
lawrencecloj...@gmail.com> wrote:

> > Since we're wild mass guessing, I'd say from that stack trace that
> there's
>
> > invalid syntax in a defn's signature somewhere.
>
>
> Good guess! A copy and paste error left 2 extra letters:
>
>
> (defn is-user-valid? wh [request]
>
>
> That "wh" was tough to find.
>
>
>
>
>
>
>
> On Thursday, October 25, 2012 3:05:25 PM UTC-4, Philip Potter wrote:
>
>> Since we're wild mass guessing, I'd say from that stack trace that
>> there's invalid syntax in a defn's signature somewhere.
>>
>> I'm basing this on the references to clojure.core$defn and
>> clojure.core$sigs shortly above compile and macroexpand.
>>
>> Phil
>> On Oct 25, 2012 7:36 PM, "larry google groups" 
>> wrote:
>>
>>>
>>> I am finding the following stack trace unusually devoid of information.
>>> My app is Clojure 1.3. I run "lein compile" and I get the following stack
>>> trace. Am I blind, or does this stack trace fail to tell me what line I
>>> should look at?
>>>
>>>
>>>
>>> lein compile
>>> Compiling who-is-logged-in.core
>>> Exception in thread "main" java.lang.**IllegalArgumentException: Don't
>>> know how to create ISeq from: clojure.lang.Symbol
>>> at clojure.lang.RT.seqFrom(RT.**java:487)
>>> at clojure.lang.RT.seq(RT.java:**468)
>>> at clojure.lang.RT.first(RT.java:**560)
>>> at clojure.core$first.invoke(**core.clj:55)
>>> at clojure.core$map$fn__3811.**invoke(core.clj:2432)
>>> at clojure.lang.LazySeq.sval(**LazySeq.java:42)
>>> at clojure.lang.LazySeq.seq(**LazySeq.java:60)
>>> at clojure.lang.RT.seq(RT.java:**466)
>>> at clojure.core$seq.invoke(core.**clj:133)
>>> at clojure.core$filter$fn__3830.**invoke(core.clj:2468)
>>> at clojure.lang.LazySeq.sval(**LazySeq.java:42)
>>> at clojure.lang.LazySeq.seq(**LazySeq.java:60)
>>> at clojure.lang.RT.seq(RT.java:**466)
>>> at clojure.core$seq.invoke(core.**clj:133)
>>> at clojure.core$assert_valid_**fdecl.invoke(core.clj:6464)
>>> at clojure.core$sigs.invoke(core.**clj:220)
>>> at clojure.core$defn.doInvoke(**core.clj:293)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:525)
>>> at clojure.lang.Var.invoke(Var.**java:421)
>>> at clojure.lang.AFn.**applyToHelper(AFn.java:185)
>>> at clojure.lang.Var.applyTo(Var.**java:518)
>>> at clojure.lang.Compiler.**macroexpand1(Compiler.java:**6320)
>>> at clojure.lang.Compiler.**macroexpand(Compiler.java:**6381)
>>> at clojure.lang.Compiler.**compile1(Compiler.java:6970)
>>> at clojure.lang.Compiler.compile(**Compiler.java:7046)
>>> at clojure.lang.RT.compile(RT.**java:385)
>>> at clojure.lang.RT.load(RT.java:**425)
>>> at clojure.lang.RT.load(RT.java:**398)
>>> at clojure.core$load$fn__4610.**invoke(core.clj:5386)
>>> at clojure.core$load.doInvoke(**core.clj:5385)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:408)
>>> at clojure.core$load_one.invoke(**core.clj:5200)
>>> at clojure.core$compile$fn__4615.**invoke(core.clj:5397)
>>> at clojure.core$compile.invoke(**core.clj:5396)
>>> at user$eval27.invoke(NO_SOURCE_**FILE:1)
>>> at clojure.lang.Compiler.eval(**Compiler.java:6465)
>>> at clojure.lang.Compiler.eval(**Compiler.java:6455)
>>> at clojure.lang.Compiler.eval(**Compiler.java:6431)
>>> at clojure.core$eval.invoke(core.**clj:2795)
>>> at clojure.main$eval_opt.invoke(**main.clj:296)
>>> at clojure.main$initialize.**invoke(main.clj:315)
>>> at clojure.main$null_opt.invoke(**main.clj:348)
>>> at clojure.main$main.doInvoke(**main.clj:426)
>>> at clojure.lang.RestFn.invoke(**RestFn.java:421)
>>> at clojure.lang.Var.invoke(Var.**java:405)
>>> at clojure.lang.AFn.**applyToHelper(AFn.java:163)
>>> at clojure.lang.Var.applyTo(Var.**java:518)
>>> at clojure.main.main(main.java:**37)
>>> Compilation failed.
>>>
>>>  --
>>> 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 post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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

Re: conversion problems using (count @someatom)

2012-10-29 Thread Sean Corfield
Your last argument is not a sequence - remove the apply.

(and you probably want to remove the conj [] on the free memory call?)

On Mon, Oct 29, 2012 at 9:21 AM, larry google groups
 wrote:
> Now Ihave this and I get errors:
>
> (defn show-stats-regarding-resources-used-by-this-app [request]
>   (response (apply str "Memory in use (percentage/used/max-heap): "
> (who/memory-usage) "  CPU usage (how-many-cpu's/load-average):  "
> (who/cpu-load-usage)  " free memory in jvm: " (conj []
> (who/free-memory-in-jvm))  " How many people are logged in: " (str (count
> @registry)
>
> I get:
>
> 2012-10-29 12:15:02.045:WARN:oejs.AbstractHttpConnection:/show-resources
> java.lang.IllegalArgumentException: Don't know how to create ISeq from:
> java.lang.Long
>
> I tried this with and without the "str". What is wrong with this?

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


Re: conversion problems using (count @someatom)

2012-10-29 Thread AtKaaZ
(apply str "Memory
apply str (list "memory ... )
no?

On Mon, Oct 29, 2012 at 5:21 PM, larry google groups <
lawrencecloj...@gmail.com> wrote:

> I decided I wanted to be able to see some stats about my little app, so I
> added this function:
>
> (defn show-stats-regarding-resources-used-by-this-app [request]
>   (response (apply str "Memory in use (percentage/used/max-heap): "
> (who/memory-usage) "  CPU usage (how-many-cpu's/load-average):  "
> (who/cpu-load-usage)  " free memory in jvm: " (conj []
> (who/free-memory-in-jvm)
>
> This worked great, but then I decided to add this to the end:
>
> " How many people are logged in: " (str (count @registry))
>
> The registry is defined as:
>
> (def registry (atom {}))
>
> And this map keeps maps inside of it, one for each user, so it is a 2D
> map.
>
> Now Ihave this and I get errors:
>
> (defn show-stats-regarding-resources-used-by-this-app [request]
>   (response (apply str "Memory in use (percentage/used/max-heap): "
> (who/memory-usage) "  CPU usage (how-many-cpu's/load-average):  "
> (who/cpu-load-usage)  " free memory in jvm: " (conj []
> (who/free-memory-in-jvm))  " How many people are logged in: " (str (count
> @registry)
>
> I get:
>
> 2012-10-29 12:15:02.045:WARN:oejs.AbstractHttpConnection:/show-resources
> java.lang.IllegalArgumentException: Don't know how to create ISeq from:
> java.lang.Long
>
> I tried this with and without the "str". What is wrong with this?
>
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
I may be wrong or incomplete.
Please express any corrections / additions,
they are encouraged and appreciated.
At least one entity is bound to be transformed if you do ;)

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

Re: compile fails but stack trace does not mention a line of code in my app

2012-10-29 Thread larry google groups


> Since we're wild mass guessing, I'd say from that stack trace that there's

> invalid syntax in a defn's signature somewhere.


Good guess! A copy and paste error left 2 extra letters:


(defn is-user-valid? wh [request] 


That "wh" was tough to find. 







On Thursday, October 25, 2012 3:05:25 PM UTC-4, Philip Potter wrote:
>
> Since we're wild mass guessing, I'd say from that stack trace that there's 
> invalid syntax in a defn's signature somewhere.
>
> I'm basing this on the references to clojure.core$defn and 
> clojure.core$sigs shortly above compile and macroexpand. 
>
> Phil 
> On Oct 25, 2012 7:36 PM, "larry google groups" 
> > 
> wrote:
>
>>
>> I am finding the following stack trace unusually devoid of information. 
>> My app is Clojure 1.3. I run "lein compile" and I get the following stack 
>> trace. Am I blind, or does this stack trace fail to tell me what line I 
>> should look at?
>>
>>
>>
>> lein compile
>> Compiling who-is-logged-in.core
>> Exception in thread "main" java.lang.IllegalArgumentException: Don't know 
>> how to create ISeq from: clojure.lang.Symbol
>> at clojure.lang.RT.seqFrom(RT.java:487)
>> at clojure.lang.RT.seq(RT.java:468)
>> at clojure.lang.RT.first(RT.java:560)
>> at clojure.core$first.invoke(core.clj:55)
>> at clojure.core$map$fn__3811.invoke(core.clj:2432)
>> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>> at clojure.lang.LazySeq.seq(LazySeq.java:60)
>> at clojure.lang.RT.seq(RT.java:466)
>> at clojure.core$seq.invoke(core.clj:133)
>> at clojure.core$filter$fn__3830.invoke(core.clj:2468)
>> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>> at clojure.lang.LazySeq.seq(LazySeq.java:60)
>> at clojure.lang.RT.seq(RT.java:466)
>> at clojure.core$seq.invoke(core.clj:133)
>> at clojure.core$assert_valid_fdecl.invoke(core.clj:6464)
>> at clojure.core$sigs.invoke(core.clj:220)
>> at clojure.core$defn.doInvoke(core.clj:293)
>> at clojure.lang.RestFn.invoke(RestFn.java:525)
>> at clojure.lang.Var.invoke(Var.java:421)
>> at clojure.lang.AFn.applyToHelper(AFn.java:185)
>> at clojure.lang.Var.applyTo(Var.java:518)
>> at clojure.lang.Compiler.macroexpand1(Compiler.java:6320)
>> at clojure.lang.Compiler.macroexpand(Compiler.java:6381)
>> at clojure.lang.Compiler.compile1(Compiler.java:6970)
>> at clojure.lang.Compiler.compile(Compiler.java:7046)
>> at clojure.lang.RT.compile(RT.java:385)
>> at clojure.lang.RT.load(RT.java:425)
>> at clojure.lang.RT.load(RT.java:398)
>> at clojure.core$load$fn__4610.invoke(core.clj:5386)
>> at clojure.core$load.doInvoke(core.clj:5385)
>> at clojure.lang.RestFn.invoke(RestFn.java:408)
>> at clojure.core$load_one.invoke(core.clj:5200)
>> at clojure.core$compile$fn__4615.invoke(core.clj:5397)
>> at clojure.core$compile.invoke(core.clj:5396)
>> at user$eval27.invoke(NO_SOURCE_FILE:1)
>> at clojure.lang.Compiler.eval(Compiler.java:6465)
>> at clojure.lang.Compiler.eval(Compiler.java:6455)
>> at clojure.lang.Compiler.eval(Compiler.java:6431)
>> at clojure.core$eval.invoke(core.clj:2795)
>> at clojure.main$eval_opt.invoke(main.clj:296)
>> at clojure.main$initialize.invoke(main.clj:315)
>> at clojure.main$null_opt.invoke(main.clj:348)
>> at clojure.main$main.doInvoke(main.clj:426)
>> at clojure.lang.RestFn.invoke(RestFn.java:421)
>> at clojure.lang.Var.invoke(Var.java:405)
>> at clojure.lang.AFn.applyToHelper(AFn.java:163)
>> at clojure.lang.Var.applyTo(Var.java:518)
>> at clojure.main.main(main.java:37)
>> Compilation failed.
>>
>>  -- 
>> 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

conversion problems using (count @someatom)

2012-10-29 Thread larry google groups
I decided I wanted to be able to see some stats about my little app, so I 
added this function: 

(defn show-stats-regarding-resources-used-by-this-app [request]
  (response (apply str "Memory in use (percentage/used/max-heap): " 
(who/memory-usage) "  CPU usage (how-many-cpu's/load-average):  " 
(who/cpu-load-usage)  " free memory in jvm: " (conj [] 
(who/free-memory-in-jvm) 

This worked great, but then I decided to add this to the end:

" How many people are logged in: " (str (count @registry))

The registry is defined as: 

(def registry (atom {}))

And this map keeps maps inside of it, one for each user, so it is a 2D map. 

Now Ihave this and I get errors: 

(defn show-stats-regarding-resources-used-by-this-app [request]
  (response (apply str "Memory in use (percentage/used/max-heap): " 
(who/memory-usage) "  CPU usage (how-many-cpu's/load-average):  " 
(who/cpu-load-usage)  " free memory in jvm: " (conj [] 
(who/free-memory-in-jvm))  " How many people are logged in: " (str (count 
@registry) 

I get:

2012-10-29 12:15:02.045:WARN:oejs.AbstractHttpConnection:/show-resources
java.lang.IllegalArgumentException: Don't know how to create ISeq from: 
java.lang.Long

I tried this with and without the "str". What is wrong with this? 







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

Re: Can't start clojurescript browser-connected repl

2012-10-29 Thread vemv
Hi Tim,

I followed your recipe and unfortunately it doesn't work - one keeps 
waiting for the output at the repl.

The `foo` namespace seems to be loaded twice. So I modified index.html to 
load main.js only. This doesn't fix the issue though.

Could you please verify this?

Thanks - Victor

On Wednesday, August 22, 2012 3:59:48 AM UTC+2, frye wrote:
>
> Hey guys, 
>
> This is an interesting thread, as I was playing around with Clojurescript. 
> But I also had a hard time setting up a browser-connected repl. I wanted to 
> do this from a raw leiningen2 project. I finally got it working and thought 
> I would put this up as a reference to anyone wanting to do the same thing. 
> I started from a raw lein2 project.clj file, added noir and clojurescript 
> as dependencies, and got a browser-connected repl. This is the process I 
> used. 
>
>
> # create project and setup directory structure 
> lein.2 new foojs 
> cd foojs 
> mkdir -p public/{javascript,templ/cljs} 
>
>
> # I manually add noir and clojurescript as dependencies. 
> curl http://pastebin.com/raw.php?i=cmRA7jjj > project.clj 
>
> # this core.clj i) uses noir and ii) uses a custom middleware to wrap and 
> send files in the public/ directory
> curl http://pastebin.com/raw.php?i=b6mcjY2C > src/foojs/core.clj 
>
> # the result foo.js gets loaded into the index.html, and connects the 
> client to the cljs repl . replace  with yours
> curl http://pastebin.com/raw.php?i=Mg6vd5Mq > public/templ/cljs/foo.cljs 
>
> # pulls in i) google closure and ii) foo.js, which connects the client to 
> the cljs repl 
> curl http://pastebin.com/raw.php?i=t73k12DM > public/index.html 
>
>
> # I also use lein-cljsbuild to auto compile .cljs files. There are other 
> options like i) lein-clojurescript and ii) noir-cljs, which I haven't tried 
> yet 
> lein cljsbuild once
>
>
> # Now i) start the repl, ii) start jetty in noir, and iii) fire up the 
> cljs repl, waiting for a browser connection
> lein.2 repl 
>
> => (require 'foojs.core)
> => (foojs.core/-main)
> Starting server... 
>
>
> => (require '[cljs.repl :as repl]) 
> => (require '[cljs.repl.browser :as browser]) 
> => (def env (browser/repl-env :port 9000)) 
> => (repl/repl env) 
> "Type: " :cljs/quit " to quit" 
> ClojureScript:cljs.user>   #_=> ;; use your browser here, to open 
> http://:8080 
> ClojureScript:cljs.user>   #_=> (js/alert "I am an evil side-effect") 
>
>
>
> HTH
>
> Tim Washington 
> Interruptsoftware.ca 
> 416.843.9060 
>
>
>
> On Tue, May 22, 2012 at 10:53 AM, D.Bushenko 
> > wrote:
>
>> David,
>>
>> I have just tried hosting index.html, main.js and out/ under 
>> tomcat7/webapps/my/ directory, executed the cljs repl, navigated to 
>> localhost:8080/my/index.html, and it worked!
>>
>> Thanks, that was very helpful! 
>> Dmitry
>>
>> P.S. I think, the note about hosting index.html on some kind of webserver 
>> should be added to the README.md.
>>
>>  

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

reduce, reduce-kv, map, mapv, reducers/map and nil

2012-10-29 Thread Wolodja Wentland
Hi all,

I am currently testing performance of different reduce and map implementations
in my programs and have problems because their treatment of nil is different.
The "normal" clojure.core implementations of reduce and map work well when
called on nil, but reduce-kv and functions in clojure.reducers throw
exceptions.

--- snip ---
user=> (defn fold-into-vec
  "Provided a reducer, concatenate into a vector.

  Note: same as (into [] coll), but parallel."
  ([coll]
   (r/fold (r/monoid into vector) conj coll))
  ([n coll]
   (r/fold n (r/monoid into vector) conj coll)))

user=> (map (fn [el] (* 2 el)) nil)
()
user=> (mapv (fn [el] (* 2 el)) nil)
[]
user=> (fold-into-vec (r/map (fn [el] (* 2 el)) nil))
#
user=> (reduce (fn [ret el] (+ el el)) {} nil)
{}
user=> (reduce (fn [ret [k v]] (+ k v)) {} nil)
{}
user=> (reduce-kv (fn [ret k v] (+ k v)) {} nil)
#
--- snip ---

I find this behaviour quite unfortunate because I now have to explicitly test
for nil? and ensure consistent behaviour. This inconsistency violates the
principle of least-surprise and I am not sure if the current behaviour is
intentional or merely an unfortunate implementation detail.

Wouldn't it make sense if reduce-kv and r/map mirror the behaviour of reduce,
map and mapv in core?

P.S. Would it be possible to have something like fold-into-vec in 
clojure.reducers?
-- 
Wolodja 

4096R/CAF14EFC
081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC


signature.asc
Description: Digital signature


Re: Some Friend documentation and regarding documentation in general

2012-10-29 Thread Patrik Sundberg


On Sunday, October 28, 2012 9:56:35 PM UTC, Patrik Sundberg wrote:
>
> On Sunday, October 28, 2012 8:14:41 PM UTC, Chas Emerick wrote:
>
>> On Oct 28, 2012, at 2:57 PM, Patrik Sundberg wrote:
>>
>> I've looked at this for a bit now. It seems there are some slight 
>> inconsistencies in how the redirect info is used:
>>
>> Where the redirect-on-autth? is being set up for the interactive-form 
>> workflow it looks to me to be assumed to be a boolean flag.
>>
>> https://github.com/sundbp/friend/blob/master/src/cemerick/friend/workflows.clj#L79
>>
>> At that point it's given as an argument when setting up the workflow 
>> (defaulting to true). 
>>
>> Then when it's being used in the generic code it's first picked out - 
>> looking like boolean flag still:
>> https://github.com/sundbp/friend/blob/master/src/cemerick/friend.clj#L145
>>
>> but then all of a sudden assumed to be a string containing the url to 
>> redirect to:
>> https://github.com/sundbp/friend/blob/master/src/cemerick/friend.clj#L149
>>
>> Given that, for the interactive-form workflow, it can only be set at the 
>> time of creating the workflow, it seems impossible to actually achieve the 
>> flow where friend "remembers" which page under authentication that user 
>> tried to access, then do auth, and finally return user to the originally 
>> requested page in a dynamic fashion. Since given at workflow creation time 
>> it can't dynamically reflect things properly I'd have assumed. I'd have 
>> expected it to not be an argument at workflow creation time, but the 
>> originally requested url being dynamically kept track of at the point 
>> friend realizes it needs to redirect the user to do authentication, then 
>> that url being used on L149 up there when the workflow sets 
>> redirect-on-auth? to true.
>>
>> Am I misunderstanding the flow or is there a mixup here? The tests only 
>> tests for boolean state, not as a string url.
>>
>>
>> You're misunderstanding.  If ::redirect-on-auth? is any truthy value 
>> (which includes strings), then `redirect-new-auth` will either:
>>
>> (a) send a redirect to the ::unauthorized-uri as captured in the session, 
>> which is only ever set if the user previously requested a resource for 
>> which they were not authorized (see 
>> https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L200),
>>  
>> or
>>
>> (b) redirect to the value of ::redirect-on-auth? if it is a string, or
>>
>> (c) redirect to the :default-landing-url specified in the configuration 
>> provided to `authenticate`.
>>
>> You're right that (b) will never be the case for the interactive-form 
>> workflow, fundamentally because `cemerick.friend.workflows/make-auth` 
>> merges the `auth-meta` defaults in last, rather than first.  That's a valid 
>> point of enhancement; ticket/patch welcome. :-)
>>
>> Note that ::redirect-on-auth? _is_ poorly named: it was originally 
>> expected to only be a boolean, thus the '?'.  Its name will need to change 
>> in the future to reflect its actual role.
>>
>>
> Ok - I think that's actually what my understanding was :) It just seemed 
> that in the existing workflows if it is stringy (assume make-auth patched 
> although I didn't quite get that yet) it is a fixed string rather than a 
> dynamic value of the url user tried to access. I.e. I can give "/foo" as 
> redirect-on-auth? when setting up the interactive-form workflow, but that's 
> then a fixed url to redirecct to. To redirect to whatever page the user 
> tried to access I'd have thought we need store it away from the original 
> request before we go into the auth process, to later redirect back to it 
> once successfully authenticated.
>
>
Reading the code again I now get it. The redirection I was looking for is 
there. ::unauthorized-uri is the uri I was looking for, misinterpreted the 
name to mean something else and overlooked it. I see how it fits together 
now. Will try to get to making the changes that came up in this discussion 
sometime this week.
 
Thanks

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

Re: what is the simplest user auth system possible?

2012-10-29 Thread Balint Erdi
If you share your pc with your brother then using the classic one 
username/password per site you'd have to log out and back in on each site 
you want to use (or use another browser/incognito window, etc.)

With Persona you only have to do this once.

On Sunday, October 28, 2012 9:05:20 PM UTC+1, Simone Mosciatti wrote:
>
> I never really get Persona (means person in Italian that doesn't really 
> make a lot of sense, but whatever) what if I share my pc with my brother ?
> Maybe i miss something...
>
> If you are using mongodb I am using https://github.com/xavi/noir-auth-app 
> that 
> is using congomongo and since i am using monger i port it in 
> https://github.com/siscia/noir-auth-app ...
>
> It manage maybe too much for your need, email authentication, resend 
> email, change password and other fancy stuff, but the code is really clean 
> and full of comments, really good code imo... 
>
> If you have time you could port it to work with korma... it is not a lot 
> of work at all...
>
> On Sunday, October 28, 2012 8:07:02 PM UTC+1, larry google groups wrote:
>>
>> What happens if the Persona project closes down?
>>
>>
>> On Friday, October 26, 2012 7:06:48 AM UTC-4, Dave Sann wrote:
>>>
>>> For authorisation, I really like mozilla persona (previously browserid) 
>>> which I discovered from refheap. javascript lib plus an http request from 
>>> the server to validate. really simple.
>>>
>>> https://login.persona.org/
>>>
>>> Dave
>>>
>>>
>>>
>>> On Friday, 26 October 2012 01:35:53 UTC+11, Stephen Compall wrote:

 On Oct 25, 2012 9:04 AM, "larry google groups"  
 wrote:
 > For my next step, I need to come up with a user system. My needs are 
 minimal: I only need to know when someone is logged in, and I need to 
 associate them with some user id (the id will simply be the id from a user 
 table kept in MySql). 
 >
 > I am curious what is the absolutely easiest way to do this?

 The easiest auth system to write is the one that's already written.

 https://github.com/cemerick/friend

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

Re: clojure.org requires more clicks now

2012-10-29 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Montag, 29. Oktober 2012 02:20:42 UTC+1 schrieb Vinod Kurup:
>
> On Sunday, October 28, 2012 6:16:12 PM UTC-4, raschedh wrote:
>
>> ... 
>
> If you do not come back, you do not want it enough.
>> ...
>>
>  
> Then a few extra clicks on the homepage shouldn't deter you.
>
> Sorry, couldn't resist :-)
>

There is a difference in quality between a cost which occurs for a smaller 
group of people only initially and a cost which hits a larger group of 
people everyday. And soon the first group moves into the second group and 
will start to complain even louder.

But that doesn't mean, that one shouldn't look for solution which reduces 
the cost for both parties.

Kind regards
Meikel
 

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