Re: ClojureScriptOne remote

2012-04-26 Thread Pierre-Henry Perret
Yes, that was it, just adding a key solved it.
Thanks

Le mercredi 25 avril 2012 20:42:42 UTC+2, David Nolen a écrit :

 Perhaps you are calling 'get' on something which has not implemented or 
 not been extended to ILookup. 

 On Wed, Apr 25, 2012 at 2:38 PM, Pierre-Henry Perret  wrote:

 When returning a response from a remote call, it fails to a server error:

 __
 Uncaught Error: No protocol method ILookup.-lookup defined for type 
 object: [object Object] 
 

 Have someone any idea what it origins from ?

 Thanks

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




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

How to use an Enlive template in ClojureScript file

2012-04-26 Thread Pierre-Henry Perret
Hi,

In ClojureScriptOne view, the *snippets* macros are required (with 
'require-macros' ) in the view.cljs file.

My question is : how to use an Enlive  *html/deftemplate* * *in  this same 
file. 

For instance in snippets I have this macro: (html/deftemplate a-template  
 forms...)


If in the *view.cljs* there is a *(:require-macros [one.sample.snippets] 
:as snippets)*
*
*
When I call *snippets/a-template * , it complains it can't find it.

I must add that I have reload the macros file to recompile it.


 

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

2012-04-26 Thread Tim King
I have been working on a fork of Phil's nrepl.el for the past few nights.
So far I have gotten the basic bencode/bdecode transport working and am
able to send and receive to an nREPL server.
Beyond that, it isn't really in anything close to a usable state yet, but I
plan to continue plugging away at it.

http://www.github.com/kingtim/nrepl.el

Cheers,
Tim not an emacs lisp hacker King

On Mon, Apr 23, 2012 at 4:08 PM, Phil Hagelberg p...@hagelb.org wrote:

 On Thu, Mar 29, 2012 at 9:52 AM, Phil Hagelberg p...@hagelb.org wrote:
  Anyway, I'd be happy if someone went ahead with nrepl.el even so;
  don't let me discourage you.

 For what it's worth I sketched out a bare skeleton of what this could
 look like. Nothing works yet, but if someone were to want to hack on
 it, this might be a good place to start:

https://github.com/technomancy/nrepl.el

 I don't have plans to finish it myself.

 -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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

(update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread blais
Hi,
I have this use-case for (update-in) which keeps showing up in my code 
which I don't have a solution for and I'm wondering if there isn't a 
solution.
How do I _efficiently_ obtain the new value created by an invocation of 
(update-in), that is, without having to get the modified value by lookups 
in the new map?

Simplified example:

(def m {:planet {:country {:state {:city {:borough 4})

(let [mm (update-in m
[:planet :country :state :city :borough]
(fn [old] (if (nil? old) 0 (inc old]
  (get-in mm [:planet :country :state :city :borough]))

(update-in) returns the new/modified map, but what I want is to obtain the 
new count returned by the anonymous function.
Having to call (get-in) right after is inefficient.

This is obviously a contrived example for this question, but I have a lot 
of real use cases for this (where at the top level of my app I have a ref 
for a deep structure which changes as a response to network events).

Is there an idiomatic way to do this without having to resort to mutability?
(The only solution that comes to my mind is to wrap up update-in and the 
modifier function with a special version that updates a local mutable and 
return both the new map and the new object.)
Nasty?

Thank you,



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

Re: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread Andy Fingerhut
Here is one way to do it called update-in+.  It returns a vector consisting
of the new udpated value, like update-in does, followed by the original
value (in case you might want to see that for some reason), followed by the
updated value.

(defn update-in+
  ([m [k  ks] f  args]
 (if ks
   (let [[new-map old-val new-val] (apply update-in+ (get m k) ks f
args)]
 [(assoc m k new-map) old-val new-val])
   (let [old-val (get m k)
 new-val (apply f old-val args)]
 [(assoc m k new-val) old-val new-val]

Andy

On Thu, Apr 26, 2012 at 9:19 AM, Ambrose Bonnaire-Sergeant 
abonnaireserge...@gmail.com wrote:

 Hi,

 You shouldn't need mutation for such a function.

 If you look at the source of update-in, it's fairly straightforward.

 (defn update-in
   ([m [k  ks] f  args]
(if ks
  (assoc m k (apply update-in (get m k) ks f args))
  (assoc m k (apply f (get m k) args)

 Just create another function that returns a vector of the result of
 applying f, and the update-in result. It should be easy starting from
 update-in's source.

 (I'm not aware of an existing solution)

 Thanks,
 Ambrose

 On Fri, Apr 27, 2012 at 12:00 AM, blais goo...@furius.ca wrote:

 Hi,
 I have this use-case for (update-in) which keeps showing up in my code
 which I don't have a solution for and I'm wondering if there isn't a
 solution.
 How do I _efficiently_ obtain the new value created by an invocation of
 (update-in), that is, without having to get the modified value by lookups
 in the new map?

 Simplified example:

 (def m {:planet {:country {:state {:city {:borough 4})

 (let [mm (update-in m
 [:planet :country :state :city :borough]
 (fn [old] (if (nil? old) 0 (inc old]
   (get-in mm [:planet :country :state :city :borough]))

 (update-in) returns the new/modified map, but what I want is to obtain
 the new count returned by the anonymous function.
 Having to call (get-in) right after is inefficient.

 This is obviously a contrived example for this question, but I have a lot
 of real use cases for this (where at the top level of my app I have a ref
 for a deep structure which changes as a response to network events).

 Is there an idiomatic way to do this without having to resort to
 mutability?
 (The only solution that comes to my mind is to wrap up update-in and the
 modifier function with a special version that updates a local mutable and
 return both the new map and the new object.)
 Nasty?

 Thank you,



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


  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from 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: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread Jay Fields
I would have written the fn like this, if I was following what you've been
doing:

(def m {:planet {:country {:state {:city {:borough 4})

(let [mm (update-in m [:planet :country :state :city :borough ] (fnil inc
-1))]
  (get-in mm [:planet :country :state :city :borough ]))

However, when I run into this pattern I usually

(let [v ((fnil inc -1) (get-in m [:planet :country :state :city :borough
]))]
  (assoc-in m [:planet :country :state :city :borough ] v))

The update in does a get, and I do a get-in, so I'm guessing the
performance is pretty similar, though I haven't tested it.

Cheers, Jay

On Thu, Apr 26, 2012 at 12:00 PM, blais goo...@furius.ca wrote:

 Hi,
 I have this use-case for (update-in) which keeps showing up in my code
 which I don't have a solution for and I'm wondering if there isn't a
 solution.
 How do I _efficiently_ obtain the new value created by an invocation of
 (update-in), that is, without having to get the modified value by lookups
 in the new map?

 Simplified example:

 (def m {:planet {:country {:state {:city {:borough 4})

 (let [mm (update-in m
 [:planet :country :state :city :borough]
 (fn [old] (if (nil? old) 0 (inc old]
   (get-in mm [:planet :country :state :city :borough]))

 (update-in) returns the new/modified map, but what I want is to obtain the
 new count returned by the anonymous function.
 Having to call (get-in) right after is inefficient.

 This is obviously a contrived example for this question, but I have a lot
 of real use cases for this (where at the top level of my app I have a ref
 for a deep structure which changes as a response to network events).

 Is there an idiomatic way to do this without having to resort to
 mutability?
 (The only solution that comes to my mind is to wrap up update-in and the
 modifier function with a special version that updates a local mutable and
 return both the new map and the new object.)
 Nasty?

 Thank you,



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

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

2012-04-26 Thread Laurent PETIT
Le 26 avr. 2012 à 02:15, Brian Marick mar...@exampler.com a écrit :

 Midje is getting to the point where it probably wants some sort of 
 configuration/customization file. Is there any sort of emerging idiom for 
 those in Clojure-land?

 - Naming convention? Beginning with a dot? Ending in rc? Etc.

 - If Joe User wants a config file in his home directory, will we force him to 
 put that in his Java classpath? [Speaking as a Unix guy for 30 years: ick.]

I don't know what kind of configuration your talking about, but
wouldn't that be project specific, thus better placed, anyway,
somewhere inside the project's. folder ?



 - Etc.

 -
 Brian Marick, Artisanal Labrador
 Now working at http://path11.com
 Contract programming in Ruby and Clojure
 Occasional consulting on Agile


 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from 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: When I use Agents for logging I have a different behavior in the REPL as in the program

2012-04-26 Thread Marcus Lindner
I tried it with doseq many times, but the behvior is the same. In the 
REPL I got a full map of information, but when I use the program the map 
with the agent logs is empty.


Am 22.04.2012 19:51, schrieb Moritz Ulrich:

Just a quick guess after a quick glimpse at the code you linked:

  (map #(send % a-day-in-the-life-agent-fn) domiciles)

map is lazy. It doesn't execute anything until you request the result.
(do ... (map ...) (foo)) discards the result of map, making it a
no-op.
This also explains why it works in the repl: It prints out the result
of the call. In an (implicit) do, it doesn't.

Use doseq in such situations.

On Sun, Apr 22, 2012 at 16:52, Goldritter
marcus.goldritter.lind...@googlemail.com  wrote:

I wanted to log some information during the execution of the genetic
algorithm I posted earlier here. So I chnaged the code and changed the
function 'track-evolution' so, that it now accept a maximal runtime and
returns a map which contains the logged information.
The information where stored first as states in the agents which take part
in this algorithm as a Map, which has as key the time, when the function is
started and as value the information how long it takes to finishes the
function and if there was an exception in the agent.
When 'track-evolution' finishes, it retrieves the states of the agents and
put these map into an other map with more infomrations and then returns the
map.

When I write the following code into the REPL:
=  (prepare-evolution 3) (start-evolution) (def stat (track-evolution 5
:second))

(:creator-log stat)
Then I get as result
=  {593848 {Map of the Agent}, 9db6ff {Map of the Agent}, d03269
{Map of the Agent}}

(Map of the Agent  is the Map with the information I described above).

To make it easier I wrote a function which I want to execute

(defn retrieve-new-stats
   [number-of-creators time timetype]
   (prepare-evolution number-of-creators)
 (start-evolution)
 (track-evolution time timetype))

And when I use this function
=(def stat (retrieve-new-stats 3 5 :second))
I get as result for '(:creator-log stat)' this:
{593848 {}, 9db6ff {}, d03269 {}}

In this case I get only empty maps. I tried also to use do in the function
like

(defn retrieve-new-stats
   [number-of-creators time timetype]
   (do (prepare-evolution number-of-creators)
 (start-evolution)
 (track-evolution time timetype)))

But there I got only empty maps too.

So I wonder why I get filled maps, when I write these three function into
the REPL directly and only empty maps, when I execute them in a function.
What is the difference?

Has anybody an idea?

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


Question about special macroexpansions

2012-04-26 Thread Nahuel Greco
The (.method1 obj) = (. obj method1) macroexpansion is defined as an
special one, and I suppose the macroexpansion (Integer/MAX_VALUE) =
(. Integer MAX_VALUE) is another one. Correct me if I'm wrong, but I
think they are special because you reference the macro not by the
first symbol in the expression but as an special punctuation syntax.

My question is, which other special  macroexpansions exists? There
is a complete list somewhere? Where these macros are located in the
Clojure compiler source?

Saludos,
Nahuel Greco.

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

2012-04-26 Thread Guofeng Zhang
Trying ctest.

if I clone the project then run  lein cljsbuild auto in it, I got:
Copying 3 files to D:\projects\app\clojure\contrib\ctest\.lein-plugins
Compiling ClojureScript.
Error: Could not find or load main class clojure.main

If I run lein deps, then run lein cljsbuild auto, I got:
That's not a task. Use lein help to list all tasks.

Do I need extra configuration for my environment?

Leiningen 1.7.1 on Java 1.7.0_03 Java HotSpot(TM) 64-Bit Server VM
 Windows 7

Thanks

-Original Message-
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
nchurch
Sent: Thursday, April 26, 2012 12:49 PM
To: Clojure
Subject: Re: Having trouble running clojurescript repl

BTW, I pushed a minimal lein-cljsbuild project with REPL here:

https://github.com/nchurch/ctest

On Apr 25, 9:30 pm, Sean Neilan s...@seanneilan.com wrote:
 Holy shnikes! That did it!

 Thank you so much!

 I'll submit a patch to the documentation.

 On Wed, Apr 25, 2012 at 11:27 PM, David Nolen dnolen.li...@gmail.comwrote:







  sounds like you didn't set CLOJURESCRIPT_HOME or that it was set 
  incorrectly.

  On Wed, Apr 25, 2012 at 9:40 PM, Sean Neilan sneil...@gmail.com wrote:

  Hi All,

  I'm not sure if this has been asked before.

  I followed the quickstart guide:
 https://github.com/clojure/clojurescript/wiki/Quick-Startand did

  git clone git://github.com/clojure/clojurescript.git
  cd clojurescript
  ./script/bootstrap

  Then I tried
  rmc-235-244:clojurescript seanneilan$ ./script/repl Clojure 
  1.3.0-beta1 user= which worked

  But, when I did
  user= (require '[cljs.repl :as repl]) I got FileNotFoundException 
  Could not locate cljs/repl__init.class or cljs/repl.clj on 
  classpath:   clojure.lang.RT.load (RT.java:430)

  I tried running
  rmc-235-244:clojurescript seanneilan$ ./script/repljs

  But I got
  Exception in thread main java.lang.RuntimeException:
  java.io.FileNotFoundException: Could not locate 
  cljs/repl__init.class or cljs/repl.clj on classpath:
   at clojure.lang.Util.runtimeException(Util.java:153)
  at clojure.lang.Compiler.eval(Compiler.java:6417)
   at clojure.lang.Compiler.eval(Compiler.java:6372)
  at clojure.core$eval.invoke(core.clj:2745)
   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) Caused by: 
  java.io.FileNotFoundException: Could not locate 
  cljs/repl__init.class or cljs/repl.clj on classpath:
   at clojure.lang.RT.load(RT.java:430) at 
  clojure.lang.RT.load(RT.java:398)
   at clojure.core$load$fn__4636.invoke(core.clj:5377)
  at clojure.core$load.doInvoke(core.clj:5376)
   at clojure.lang.RestFn.invoke(RestFn.java:408)
  at clojure.core$load_one.invoke(core.clj:5191)
   at clojure.core$load_lib.doInvoke(core.clj:5228)
  at clojure.lang.RestFn.applyTo(RestFn.java:142)
   at clojure.core$apply.invoke(core.clj:602)
  at clojure.core$load_libs.doInvoke(core.clj:5262)
   at clojure.lang.RestFn.applyTo(RestFn.java:137)
  at clojure.core$apply.invoke(core.clj:602)
   at clojure.core$require.doInvoke(core.clj:5343)
  at clojure.lang.RestFn.invoke(RestFn.java:408)
   at user$eval1.invoke(NO_SOURCE_FILE:1)
  at clojure.lang.Compiler.eval(Compiler.java:6406)
   ... 11 more

  I'm not sure what's going on. Thank you for your time!

  -Sean
  s...@seanneilan.com

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

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

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

Having Problems with excercise noob.

2012-04-26 Thread Asranz
Hi. im having a little problem i need to do a parser like to do
operations but i dont get how to do it very well

ex.

 1+2*3+4-5*6+7*8-9 = 431
i have to do it with sums but i dont get it how i can take all the
operations.
any advices?

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

2012-04-26 Thread Kevin

On Apr 25, 6:47 am, Timothy Baldridge tbaldri...@gmail.com wrote:

 After seeing the talk I looked for the source code for this, and
 couldn't find it. I have a fairly in-depth background in graphics
 rendering and am interested to see how this all is implemented. In the
 past few days I've been reading up on OMeta, but have yet to see
 anything besides compiler-esque software written in it. Writing a
 calculator program is one thing, I'd love to see a ant-simulator, or
 a web app written with these new ideas. Overall I can't find many
 examples at all on this.

You can find the best summary of where source code is located at:

http://www.vpri.org/vp_wiki/index.php/Main_Page.

The graphical pieces of Gezira/Nile pointed to here:

http://www.vpri.org/vp_wiki/index.php/Gezira

I haven't tried to build it myself, but I understand that the source
code isn't always easily built externally.  Their only repository of
putting everything together is at

http://tinlizzie.org/dbjr/

Kevin.

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


new with clojure, need help!

2012-04-26 Thread omer
hello im need to learn how to use clojure and how it works,
i found some videos the helped me a bit to understand how clojure works,
but i need a more basic guidence on how to install the nessecery plugins 
to eclipse, and what to do with them...
any tutorial will do! thats...
p.s. im using windows and i need to learn how to operate it for a course in 
programing languge pricipals...

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

Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj

2012-04-26 Thread Chirag Ghiyad
hi,

I have created one lein project,
than updating its project.clj with dev-dependency of eclips

I ran lein deps

it downloaded all dependencies

but into my.m2/repository directory there is no clojure directory.
and this causes me

leiningen.eclipse  Problem loading: java.io.FileNotFoundException:
Could not locate clojure/contrib/duck_streams__init.class or clojure/
contrib/duck_streams.clj on classpath:  (eclipse.clj:1)

error when i ran lein help which abandons me to develop with eclipse
because i cant run my lein eclipse command.

Any solution for this???
Thanks in advance.

my project.clj is given below

(defproject for_test 1.0.0-SNAPSHOT
  :description FIXME: write description
  :dependencies [[org.clojure/clojure 1.2.1]]
  :dev-dependencies [[lein-eclipse 1.0.0]]
)

Thnks 'n Regards,
chirag ghiyad

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


ClojureScript Reflection

2012-04-26 Thread Sean Nilan
Hi, I was wondering what support there is in ClojureScript for reflection. 
Is there any way to get a constructor function from just the name of the 
record / class? ClojureScript doesn't have support for reading in records 
from a string like Clojure does.

Basically what I'd like to do is:

(defrecord Card [suit number])

(def card (Card. :spades 10))
(def str-card (pr-str card))

(def new-card (read-record str-card))

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

Exception when trying to run the REPL

2012-04-26 Thread Cole Rowland
I'm new to Clojure and anything having to do with Java or the JVM.

I downloaded and unzipped clojure 1.4 and when I run java -cp
clojure-1.4.0.jar clojure.main I get the following error:

Exception in thread main java.lang.NoClassDefFoundError:
clojure.main
   at gnu.java.lang.MainThread.run(libgcj.so.10)
Caused by: java.lang.ClassNotFoundException: clojure.main not found in
gnu.gcj.runtime.SystemClassLoader{urls=[],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.10)
   at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.10)
   at java.lang.ClassLoader.loadClass(libgcj.so.10)
   at java.lang.ClassLoader.loadClass(libgcj.so.10)
   at gnu.java.lang.MainThread.run(libgcj.so.10)

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


[ANN] Clauth - OAuth2 provider for Ring

2012-04-26 Thread Pelle Braendgaard
This is a simple OAuth 2 provider that is designed to be used as a primary
authentication provider for a Clojure Ring app.

I am a relative Clojure novice, but have am very experienced in OAuth.
Please help give feedback on use of idiomatic clojure.

It currently handles OAuth2 bearer authentication and interactive
authentication.

By interactive authentication I mean, it can be used for primary end user
authentication by sticking a token in a session. This means that you could
eventually provide google/facebook like session overviews and log off
remote sessions.

The following bearer tokens are implemented:

* Authorization header
http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.1
* Form encoded body parameter
http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.2
* URI query field
http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.3
* Non standard http cookie ('access_token') for use in interactive
applications
* Non standard session ('access_token') for use in interactive applications

Authorization response types:

* Authorization Code Grant
http://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.1
* Implicit Grant
http://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.2

Currently the following Grant types are supported:

* Authorization Code Grant
http://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.1
* Client Credential Grant
http://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.4
* Resource Owner Password Credential Grant
http://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.3

Currently it supports Redis and in memory for tokens, apps and users. There
is a very easy protocol to implement to add further stores. I will probably
add a separate one for korma and for datomic. These will be released as
separate projects.

For an interactive demo of it:

  lein run -m clauth.demo

I am working on a demo app that I will deploy on heroku.

P
-- 
http://agree2.com - Reach Agreement!
http://stakeventures.com - My blog about startups and agile banking

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

Re: ANN: ClojureScript Synonyms

2012-04-26 Thread mega
I made a version of synonym with a fixed repl at the bottom and a run 
button for the code examples (also made them editable with codemirror).

https://github.com/megakorre/himera

I haven't updated all the code examples to be runnable yet.
Anny thoughts?

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

2012-04-26 Thread Yann Schwartz
Since rxjs is being considered with ClojureScript (
https://github.com/Reactive-Extensions/rxjs-jquery/blob/master/examples/KonamiCode.html),
I would love to see something akin to Reactive Extensions (
http://msdn.microsoft.com/en-us/data/gg577609 and
http://www.codefornuts.com/2010/05/reactive-extensions-rx-for-net-few.html for
some examples) make its way into Storm...

Rx is not distributed, but its monadic goodness would be a great fit for
clojure (and storm).

On Mon, Apr 23, 2012 at 11:23 PM, Rogier Peters rogier.pet...@gmail.comwrote:

 Good questions. Mostly that it seems a technology domain (a dsl for
 event streams) that would fit clojure well. If it hasn't been done,
 interop would be no problem.

 On Mon, Apr 23, 2012 at 8:16 PM, Paul deGrandis
 paul.degran...@gmail.com wrote:
  I've had some success using Esper directly in Clojure for an internal
  project at work.
 
  Are you just looking to avoid interop?  Are you just curious about
  what other Clojure-specific options exist?
  Or is there a specific tradeoff, design constraint, or quality
  attribute you're working with?
 
  Paul
 
 
  On Apr 23, 1:49 pm, Rogier Peters rogier.pet...@gmail.com wrote:
  Hi Mark,
 
  Thanks. Some work has been done by Thomas Dudziak on integrating storm
  with esper [1][2].
 
  What esper offers is:
  a. queries (select average(price) from events where type=buy)
  b. windows (the above for a window of 30 minutes)
  c. patterns (if event a is not followed within 5 minutes by event b)
  d. the dsl (everything can be done in sql-like query)
 
  So it can probably be built in storm, but it's not as easy to use. And
  since I don't need storm's distributed nature it could probably even
  be done in raw clojure.
 
  [1]http://tomdzk.wordpress.com/2011/09/28/storm-esper/
  [2]https://github.com/tomdz/storm-esper
 
 
 
 
 
 
 
 
 
  On Mon, Apr 23, 2012 at 6:44 PM, Mark Rathwell mark.rathw...@gmail.com
 wrote:
   I would start with storm:
 
  https://github.com/nathanmarz/storm
 
   On Apr 23, 2012, at 9:51 AM, Rogier Peters rogier.pet...@gmail.com
 wrote:
 
   Hi,
 
   For a java project I have been looking at Esper (esper.codehaus.org
 ),
   a component for complex event processing:
 
   Complex event processing (CEP) delivers high-speed processing of
 many
   events across all the layers of an organization, identifying the most
   meaningful events within the event cloud, analyzing their impact, and
   taking subsequent action in real time (source:Wikipedia).
 
   Esper offers a Domain Specific Language (DSL) for processing events.
   The Event Processing Language (EPL) is a declarative language for
   dealing with high frequency time-based event data.
 
   Some typical examples of applications are:
 
   Business process management and automation (process monitoring, BAM,
   reporting exceptions, operational intelligence)
   Finance (algorithmic trading, fraud detection, risk management)
   Network and application monitoring (intrusion detection, SLA
 monitoring)
   Sensor network applications (RFID reading, scheduling and control of
   fabrication lines, air traffic)
 
   tl;dr:
 
   My question is: is there an alternative for this in the clojure
   ecosystem (since clojure seems like a good fit for this), and if not,
   what kind of clojure components/libraries would be a good starting
   point to implement someting similar
 
   --
   Rogier Peters
   rogier@twitter, flickr, delicious
 
   --
   You received this message because you are subscribed to the Google
   Groups Clojure group.
   To post to this group, send email to clojure@googlegroups.com
   Note that posts from new members are moderated - please be patient
 with your first post.
   To unsubscribe from 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
 
  --
  Rogier Peters
  rogier@twitter, flickr, delicious
 
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with
 your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en



 --
 Rogier Peters
 rogier@twitter, flickr, delicious

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

Re: Clojure alternatives to Esper

2012-04-26 Thread Toby DiPasquale
On Monday, April 23, 2012 9:51:39 AM UTC-4, Rogier wrote:

 My question is: is there an alternative for this in the clojure
 ecosystem (since clojure seems like a good fit for this), and if not,
 what kind of clojure components/libraries would be a good starting
 point to implement someting similar

I know of no complete alternatives, but there are some projects doing 
similar things for similar reasons. There is one that I saw recently that 
looks interesting:

https://github.com/aphyr/riemann

Stream processing for monitoring. Not quite sure why he didn't use ESPer 
for this, but there it is. There is also Lamina:

https://github.com/ztellman/lamina

which is more of a concurrency library but you could build a stream 
processing engine with it pretty simply.

--
Toby



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

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
Depends on what you're doing but one simple way is:

(defn for-all [gs]
  (if (seq gs)
(all
  gs
  (for-all (rest gs)))
s#))

On Thu, Apr 26, 2012 at 1:08 PM, Daniel Kwiecinski 
daniel.kwiecin...@gmail.com wrote:

 Is there such standard goal in clojure.logic or do I need to write
 something like:


 (defn for-all



   A goal that succeeds if all goals succeeds.


   [g p l]


   (fresh [a d]


(conso a d l)


(g p a)


(for-all g p d)))



 If it is the latter, is my proposed solution correct and idiomatic?

 Kind Regards,
 Daniel Kwiecinski

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

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

Re: ClojureScript Reflection

2012-04-26 Thread David Nolen
Just hasn't been implemented yet. Patch welcome :)

On Wed, Apr 25, 2012 at 3:18 AM, Sean Nilan sean.ni...@gmail.com wrote:

 Hi, I was wondering what support there is in ClojureScript for reflection.
 Is there any way to get a constructor function from just the name of the
 record / class? ClojureScript doesn't have support for reading in records
 from a string like Clojure does.

 Basically what I'd like to do is:

 (defrecord Card [suit number])

 (def card (Card. :spades 10))
 (def str-card (pr-str card))

 (def new-card (read-record str-card))

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

2012-04-26 Thread Phil Hagelberg
Cole Rowland cole.w.rowl...@gmail.com writes:

 I'm new to Clojure and anything having to do with Java or the JVM.

It looks like you're trying to use gcj or something; you'll be better
off with OpenJDK. Also, using Clojure from the raw jar file is very
cumbersome; if you are getting started I recommend Leiningen:
http://leiningen.org

-Phil

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


Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
Oops didn't read closely enough. Yes, your solution looks good to me.

On Thu, Apr 26, 2012 at 1:08 PM, Daniel Kwiecinski 
daniel.kwiecin...@gmail.com wrote:

 Is there such standard goal in clojure.logic or do I need to write
 something like:


 (defn for-all



   A goal that succeeds if all goals succeeds.


   [g p l]


   (fresh [a d]


(conso a d l)


(g p a)


(for-all g p d)))



 If it is the latter, is my proposed solution correct and idiomatic?

 Kind Regards,
 Daniel Kwiecinski

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

2012-04-26 Thread Asranz
Oh sorry i mean i didt wit sums and multiplications but i dont get how
it can do it conbined in the same line

On 25 abr, 22:18, Asranz alekx.on...@gmail.com wrote:
 Hi. im having a little problem i need to do a parser like to do
 operations but i dont get how to do it very well

 ex.

  1+2*3+4-5*6+7*8-9 = 431
 i have to do it with sums but i dont get it how i can take all the
 operations.
 any advices?

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

2012-04-26 Thread Alex Ott
lein-eclipse was released 2 years ago... I think, that now it's better
to work via pom.xml - generate it with 'lein pom' and import into
eclipse

On Wed, Apr 25, 2012 at 2:55 PM, Chirag Ghiyad chirag.ghi...@searce.com wrote:
 hi,

 I have created one lein project,
 than updating its project.clj with dev-dependency of eclips

 I ran lein deps

 it downloaded all dependencies

 but into my.m2/repository directory there is no clojure directory.
 and this causes me

 leiningen.eclipse  Problem loading: java.io.FileNotFoundException:
 Could not locate clojure/contrib/duck_streams__init.class or clojure/
 contrib/duck_streams.clj on classpath:  (eclipse.clj:1)

 error when i ran lein help which abandons me to develop with eclipse
 because i cant run my lein eclipse command.

 Any solution for this???
 Thanks in advance.

 my project.clj is given below

 (defproject for_test 1.0.0-SNAPSHOT
  :description FIXME: write description
  :dependencies [[org.clojure/clojure 1.2.1]]
  :dev-dependencies [[lein-eclipse 1.0.0]]
 )

 Thnks 'n Regards,
 chirag ghiyad

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



-- 
With best wishes,                    Alex Ott
http://alexott.net/
Tiwtter: alexott_en (English), alexott (Russian)
Skype: alex.ott

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

2012-04-26 Thread Jim - FooBar();

On 26/04/12 04:18, Asranz wrote:

Hi. im having a little problem i need to do a parser like to do
operations but i dont get how to do it very well

ex.

  1+2*3+4-5*6+7*8-9 = 431
i have to do it with sums but i dont get it how i can take all the
operations.
any advices?



if you need a macro that tranforms infix arithmetic expressions to 
prefix expressions i've got the right macro for you


Jim

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


Re: Clojure-Specific Emacs Environment

2012-04-26 Thread Phil Hagelberg
Tim King king...@gmail.com writes:

 I have been working on a fork of Phil's nrepl.el for the past few
 nights.
 So far I have gotten the basic bencode/bdecode transport working and
 am able to send and receive to an nREPL server.
 Beyond that, it isn't really in anything close to a usable state yet,
 but I plan to continue plugging away at it.

Wonderful! Best of luck to you. Let us know once you've got something
that needs testing.

-Phil

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


Re: Having Problems with excercise noob.

2012-04-26 Thread Jim - FooBar();

On 26/04/12 19:06, Asranz wrote:

Oh sorry i mean i didt wit sums and multiplications but i dont get how
it can do it conbined in the same line

On 25 abr, 22:18, Asranzalekx.on...@gmail.com  wrote:

Hi. im having a little problem i need to do a parser like to do
operations but i dont get how to do it very well

ex.

  1+2*3+4-5*6+7*8-9 = 431
i have to do it with sums but i dont get it how i can take all the
operations.
any advices?

Here it is:

;(infix (1 + 4 * 5 - 10 / 3)) - 5
(defmacro infix [expr]
 `(loop [
  ops#   (filter #(not (number? %)) '~expr) ;operators
  args#  (filter #(number? %) '~expr) ;operands
 ]
 (if (empty? ops#) (first args#)
 (recur
   (rest ops#)
   (conj (rest (rest args#))
   ((eval (first ops#)) (first args#) (second args#)))
--

It is worth pointing out that this macro violates one of the 
macro-writing 'rules'...that is, macros are not supposed to return 
values but expressions. It would be nicer if instead of calculating the 
actual result inside the macro, to simply transform the expression into 
prefix form and let clojure calculate the result on that...it also would 
be easier to write than this...


Jim

ps: the above macro does not handle parenthesis or operator 
precedenceif you want to go the full way have a look at the incanter 
source...hope that helps!


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

2012-04-26 Thread Asranz
Hi tahnks!
  i just need to do that operation. to conbert that string. for
example for sums i did
(defn sum [s]
(apply + (map #(- (int (first %)) (int \0)) (re-seq #[0-9] s
and it just sums the the numbers but if a have also multiplications,
substracyions and divsions how i do it??



On 26 abr, 13:07, Jim - FooBar(); jimpil1...@gmail.com wrote:
 On 26/04/12 04:18, Asranz wrote:

  Hi. im having a little problem i need to do a parser like to do
  operations but i dont get how to do it very well

  ex.

    1+2*3+4-5*6+7*8-9 = 431
  i have to do it with sums but i dont get it how i can take all the
  operations.
  any advices?

 if you need a macro that tranforms infix arithmetic expressions to
 prefix expressions i've got the right macro for you

 Jim

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


Re: Having Problems with excercise noob.

2012-04-26 Thread Jim - FooBar();

On 26/04/12 19:15, Asranz wrote:

Hi tahnks!
   i just need to do that operation. to conbert that string. for
example for sums i did
(defn sum [s]
 (apply + (map #(- (int (first %)) (int \0)) (re-seq #[0-9] s
and it just sums the the numbers but if a have also multiplications,
substracyions and divsions how i do it??


You need to rethink your approach...If you want to transform a piece of 
code you can't really do so without macros...otherwise your argument 
(the infix expression) will be evaluated before your function is even 
called - yielding compile error (cos it is not understandable from 
clojure's point of view)...


Jim

ps:also i'm pretty sure you don't need regex for something like 
thisyou're just making your life difficult!


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


lein-cljsbuild on Windows?

2012-04-26 Thread nchurch
It sounds like lein deps is not getting all the dependencies (there
should be four files to .lein-plugins and one to lib); it must be a
windows-specific issue as I have no problem cloning the project on
Mac; and unfortunately I do not have access to Windows, so can't say
what the problem may be.  There may be a Windows issue with lein-
cljsbuild; see this thread:

http://groups.google.com/group/clojure/browse_thread/thread/52e41094d69f6577

I wonder if you could copy the dependencies manually.  Another thing
you could try is to intall lein-cljsbuild globally with lein plugin
install.

On Apr 26, 2:36 am, Guofeng Zhang guof...@radvision.com wrote:
 Trying ctest.

 if I clone the project then run  lein cljsbuild auto in it, I got:
 Copying 3 files to D:\projects\app\clojure\contrib\ctest\.lein-plugins
 Compiling ClojureScript.
 Error: Could not find or load main class clojure.main

 If I run lein deps, then run lein cljsbuild auto, I got:
 That's not a task. Use lein help to list all tasks.

 Do I need extra configuration for my environment?

 Leiningen 1.7.1 on Java 1.7.0_03 Java HotSpot(TM) 64-Bit Server VM
  Windows 7

 Thanks







 -Original Message-
 From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
 nchurch
 Sent: Thursday, April 26, 2012 12:49 PM
 To: Clojure
 Subject: Re: Having trouble running clojurescript repl

 BTW, I pushed a minimal lein-cljsbuild project with REPL here:

 https://github.com/nchurch/ctest

 On Apr 25, 9:30 pm, Sean Neilan s...@seanneilan.com wrote:
  Holy shnikes! That did it!

  Thank you so much!

  I'll submit a patch to the documentation.

  On Wed, Apr 25, 2012 at 11:27 PM, David Nolen dnolen.li...@gmail.comwrote:

   sounds like you didn't set CLOJURESCRIPT_HOME or that it was set
   incorrectly.

   On Wed, Apr 25, 2012 at 9:40 PM, Sean Neilan sneil...@gmail.com wrote:

   Hi All,

   I'm not sure if this has been asked before.

   I followed the quickstart guide:
  https://github.com/clojure/clojurescript/wiki/Quick-Startanddid

   git clone git://github.com/clojure/clojurescript.git
   cd clojurescript
   ./script/bootstrap

   Then I tried
   rmc-235-244:clojurescript seanneilan$ ./script/repl Clojure
   1.3.0-beta1 user= which worked

   But, when I did
   user= (require '[cljs.repl :as repl]) I got FileNotFoundException
   Could not locate cljs/repl__init.class or cljs/repl.clj on
   classpath:   clojure.lang.RT.load (RT.java:430)

   I tried running
   rmc-235-244:clojurescript seanneilan$ ./script/repljs

   But I got
   Exception in thread main java.lang.RuntimeException:
   java.io.FileNotFoundException: Could not locate
   cljs/repl__init.class or cljs/repl.clj on classpath:
    at clojure.lang.Util.runtimeException(Util.java:153)
   at clojure.lang.Compiler.eval(Compiler.java:6417)
    at clojure.lang.Compiler.eval(Compiler.java:6372)
   at clojure.core$eval.invoke(core.clj:2745)
    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) Caused by:
   java.io.FileNotFoundException: Could not locate
   cljs/repl__init.class or cljs/repl.clj on classpath:
    at clojure.lang.RT.load(RT.java:430) at
   clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4636.invoke(core.clj:5377)
   at clojure.core$load.doInvoke(core.clj:5376)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
   at clojure.core$load_one.invoke(core.clj:5191)
    at clojure.core$load_lib.doInvoke(core.clj:5228)
   at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
   at clojure.core$load_libs.doInvoke(core.clj:5262)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
   at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$require.doInvoke(core.clj:5343)
   at clojure.lang.RestFn.invoke(RestFn.java:408)
    at user$eval1.invoke(NO_SOURCE_FILE:1)
   at clojure.lang.Compiler.eval(Compiler.java:6406)
    ... 11 more

   I'm not sure what's going on. Thank you for your time!

   -Sean
   s...@seanneilan.com

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

    --
   You received this message because you are subscribed to the Google
   Groups Clojure group.
   To post to this group, send email to clojure@googlegroups.com Note
   that posts from new 

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
On Thu, Apr 26, 2012 at 1:38 PM, Daniel Kwiecinski 
daniel.kwiecin...@gmail.com wrote:

 Does it make sense at all to you.


Makes sense, but sounds outside the scope of what core.logic currently does.

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: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread blais
Thanks Andy,
Two comments:

1. Your version does not use a transient/mutable, which is great, but it 
does create one vector for each level. I thought that since this would be 
wrapped and hidden from external view, a mutable would have been more 
appropriate.  More generally, I still don't know yet where to position 
myself when I code in Clojure, in terms of performance: I'm used to coding 
in C where I care a lot about every little detail, like cache coherency, or 
in Python for glue code where I really don't worry about such minute 
optimizations. Perhaps I tend to eagerly overoptimize in Clojure? Don't 
know.  I like your version in any case, thank you.

2. More importantly: I don't understand why I'm often having to add some 
functionality which I think of as something that everyone would need 
everywhere, and that makes me think I'm thinking about it the wrong way. 
For example, when I'm being careful about not using any mutable objects 
anywehre I end up with code that essentially recreates a new path to the 
root application every time I need to modify/store something in memory 
(i.e., I get a new version of the world on every update). So I wonder... 
isn't anybody else in dire need for something like update-in+?  How come 
not?  Isn't it a really common case that you need to modify some object 
far from the root object of your application, and if so, that you may need 
to do multiple things with that new object, beyond storing it by 
recreating all the intervening objects?  (e.g. (dosync (alter update-in 
...))) )

(Generally I find I get too little cultural osmosis when it comes to 
practical application of Clojure, so questions like this one come up all 
the time while I'm coding. Meetups and books touch on topics I understand 
well but rarely do people talk about the kinds of issues I'm encountering, 
like the one above. Libraries and other people's code often doesn't help 
all that much because it's fairly easy to do away with mutability in a 
library context.  I'll just read more OPC for now I guess.)


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

2012-04-26 Thread John Gabriele
On Apr 25, 10:37 am, omer omeryco...@gmail.com wrote:
 hello im need to learn how to use clojure and how it works,
 i found some videos the helped me a bit to understand how clojure works,
 but i need a more basic guidence on how to install the nessecery plugins
 to eclipse, and what to do with them...
 any tutorial will do! thats...
 p.s. im using windows and i need to learn how to operate it for a course in
 programing languge pricipals...

Hi omer,

At http://dev.clojure.org/display/doc/Home there's links on the left
under Getting Started that might be of use to you.

---John

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread David Nolen
On Thu, Apr 26, 2012 at 4:30 PM, blais goo...@furius.ca wrote:

 (Generally I find I get too little cultural osmosis when it comes to
 practical application of Clojure, so questions like this one come up all
 the time while I'm coding. Meetups and books touch on topics I understand
 well but rarely do people talk about the kinds of issues I'm encountering,
 like the one above. Libraries and other people's code often doesn't help
 all that much because it's fairly easy to do away with mutability in a
 library context.  I'll just read more OPC for now I guess.)


Do you need to represent your data with that much nesting?

(def m {:planet ...
   :country ...
   :state ...
   :city ...
   :borough 4})

What's wrong with this representation?

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: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread blais
On Thursday, April 26, 2012 4:36:52 PM UTC-4, David Nolen wrote:

 On Thu, Apr 26, 2012 at 4:30 PM, blais goo...@furius.ca wrote:

 (Generally I find I get too little cultural osmosis when it comes to 
 practical application of Clojure, so questions like this one come up all 
 the time while I'm coding. Meetups and books touch on topics I understand 
 well but rarely do people talk about the kinds of issues I'm encountering, 
 like the one above. Libraries and other people's code often doesn't help 
 all that much because it's fairly easy to do away with mutability in a 
 library context.  I'll just read more OPC for now I guess.)


 Do you need to represent your data with that much nesting?

 (def m {:planet ...
:country ...
:state ...
:city ...
:borough 4})

 What's wrong with this representation?

 
Well this was just to simplify my original question; the real application 
has a root instance that is a networked application class, which contains 
some list of clients, each of which has a mapping of orders (per exchange / 
market, this is a trading application) which themselves map to events 
related to those orders.  So it's more like application - client-handler 
- feed - market - order-id - event.  These aren't necessarily pure 
data classes--some of these may be records with implementations of 
protocols. 

I suppose I could elect to move refs for modifiable things towards the 
leaves, but that seems to me like going against the grain and may have 
implications for concurrency (there are few but some threads running in 
parallel in this application).  In this specific example of an application 
tree, where would you recommend the mutable objects be placed?

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: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread Daniel Kwiecinski
So how would you tackle, lets say n-queen problem on m square board (for
realy huge m) knowing that additional small set of chess pieces can be
added to the problem (let's say K K N N B) the new pieces attack fraction
of the board potentially not taken by any queens so far. Some of prev
solutions would be no longer valid of course but for sure adding new pieces
will not add new queen placements. It only limits it. Would be it possible
to extend Clojure.logic to reuse prev results, or I should forget about it
and restart search from scratch?

Daniel
On Apr 26, 2012 7:55 PM, David Nolen dnolen.li...@gmail.com wrote:

 On Thu, Apr 26, 2012 at 1:38 PM, Daniel Kwiecinski 
 daniel.kwiecin...@gmail.com wrote:

 Does it make sense at all to you.


 Makes sense, but sounds outside the scope of what core.logic currently
 does.

 David

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

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

Re: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread David Nolen
On Thu, Apr 26, 2012 at 4:52 PM, blais goo...@furius.ca wrote:

 I suppose I could elect to move refs for modifiable things towards the
 leaves, but that seems to me like going against the grain and may have
 implications for concurrency (there are few but some threads running in
 parallel in this application).  In this specific example of an application
 tree, where would you recommend the mutable objects be placed?


Why do you need refs at leaves?

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: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
core.logic can remember previous results via tabling.

As far as n-queens - that's a problem best left for constraint logic
programming (CLP). core.logic doesn't have constraint programming
facilities yet, but I've mentioned the desire to implement cKanren many
times on this list.

Haven't really considered how CLP and tabling could be combined in
core.logic - but it's been done elsewhere.

David

On Thu, Apr 26, 2012 at 4:55 PM, Daniel Kwiecinski 
daniel.kwiecin...@gmail.com wrote:

 So how would you tackle, lets say n-queen problem on m square board (for
 realy huge m) knowing that additional small set of chess pieces can be
 added to the problem (let's say K K N N B) the new pieces attack fraction
 of the board potentially not taken by any queens so far. Some of prev
 solutions would be no longer valid of course but for sure adding new pieces
 will not add new queen placements. It only limits it. Would be it possible
 to extend Clojure.logic to reuse prev results, or I should forget about it
 and restart search from scratch?

 Daniel
 On Apr 26, 2012 7:55 PM, David Nolen dnolen.li...@gmail.com wrote:

 On Thu, Apr 26, 2012 at 1:38 PM, Daniel Kwiecinski 
 daniel.kwiecin...@gmail.com wrote:

 Does it make sense at all to you.


 Makes sense, but sounds outside the scope of what core.logic currently
 does.

 David

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

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


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread blais
On Thursday, April 26, 2012 4:59:31 PM UTC-4, David Nolen wrote:

 On Thu, Apr 26, 2012 at 4:52 PM, blais goo...@furius.ca wrote:

 I suppose I could elect to move refs for modifiable things towards the 
 leaves, but that seems to me like going against the grain and may have 
 implications for concurrency (there are few but some threads running in 
 parallel in this application).  In this specific example of an application 
 tree, where would you recommend the mutable objects be placed?


 Why do you need refs at leaves?


I receive events from a network. My application calls for storing these 
events and doing different things based on the changing status of orders 
attached to these events. I need to store them somewhere, I need to track 
this state in my app. At one extreme, I could store the changing state near 
the leaves (i.e. a list of events by order-id by ...). At another extreme, 
I could recreate the entire path of immutable objects all the way to the 
root application on every update (using update-in, and with a single ref 
for the root application).  And then there's all the other options in 
between, I could have refs are every level if I chose to (but that seems 
very, very wrong, somehow).

Java would call for mutability at the leaves.  
Clojure makes it easy to build it one way or another, but the language is 
calling for refs at the root. 

Isn't this a really common case of every type of application out there 
which has to store some changing state somewhere?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread David Nolen
On Thu, Apr 26, 2012 at 5:08 PM, blais goo...@furius.ca wrote:

 I receive events from a network. My application calls for storing these
 events and doing different things based on the changing status of orders
 attached to these events. I need to store them somewhere, I need to track
 this state in my app. At one extreme, I could store the changing state near
 the leaves (i.e. a list of events by order-id by ...). At another extreme,
 I could recreate the entire path of immutable objects all the way to the
 root application on every update (using update-in, and with a single ref
 for the root application).  And then there's all the other options in
 between, I could have refs are every level if I chose to (but that seems
 very, very wrong, somehow).

 Java would call for mutability at the leaves.
 Clojure makes it easy to build it one way or another, but the language is
 calling for refs at the root.

 Isn't this a really common case of every type of application out there
 which has to store some changing state somewhere?


You've already stated that your multithreaded needs are modest. Why not one
atom wrapping all your data, each piece indexed by the most relevant key,
and each actual piece of data is flat.

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: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread nchurch
For the benefit of bystanders, could anyone explain why and how
Daniel's for-all function works?  (I've gotten to chapter 4 of TRS.)

On Apr 26, 2:04 pm, David Nolen dnolen.li...@gmail.com wrote:
 core.logic can remember previous results via tabling.

 As far as n-queens - that's a problem best left for constraint logic
 programming (CLP). core.logic doesn't have constraint programming
 facilities yet, but I've mentioned the desire to implement cKanren many
 times on this list.

 Haven't really considered how CLP and tabling could be combined in
 core.logic - but it's been done elsewhere.

 David

 On Thu, Apr 26, 2012 at 4:55 PM, Daniel Kwiecinski 







 daniel.kwiecin...@gmail.com wrote:
  So how would you tackle, lets say n-queen problem on m square board (for
  realy huge m) knowing that additional small set of chess pieces can be
  added to the problem (let's say K K N N B) the new pieces attack fraction
  of the board potentially not taken by any queens so far. Some of prev
  solutions would be no longer valid of course but for sure adding new pieces
  will not add new queen placements. It only limits it. Would be it possible
  to extend Clojure.logic to reuse prev results, or I should forget about it
  and restart search from scratch?

  Daniel
  On Apr 26, 2012 7:55 PM, David Nolen dnolen.li...@gmail.com wrote:

  On Thu, Apr 26, 2012 at 1:38 PM, Daniel Kwiecinski 
  daniel.kwiecin...@gmail.com wrote:

  Does it make sense at all to you.

  Makes sense, but sounds outside the scope of what core.logic currently
  does.

  David

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

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

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

2012-04-26 Thread Brian Marick

On Apr 26, 2012, at 12:09 PM, Laurent PETIT wrote:

 Le 26 avr. 2012 à 02:15, Brian Marick mar...@exampler.com a écrit :
 
 Midje is getting to the point where it probably wants some sort of 
 configuration/customization file. Is there any sort of emerging idiom for 
 those in Clojure-land?

 I don't know what kind of configuration your talking about, but
 wouldn't that be project specific, thus better placed, anyway,
 somewhere inside the project's. folder ?


Some would be project-specific. Some would be settings that a person would want 
to apply to all projects she was working on. 

-
Brian Marick, Artisanal Labrador
Now working at http://path11.com
Contract programming in Ruby and Clojure
Occasional consulting on Agile


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread kurtharriger
I think you are too concerned with micro optimizations.  get-in is probably 
just as efficient as attempting to bubble the state change back up and 
certainly simpler to work with.  In practice, optimizations like this do not 
have a significant impact on the overall performace.  
Measure before you optimize.  I might also add, parrelize before you optimize. 
Immutable data structures often makes it much easier to parrelize the 
algorithm, so even if you do have slow spots if the applications critical path 
is not affected you still may not need to optimize. 

There probably are several methods in clojure that can be significantly 
optimized and eventually someone will, but the best optimizations will come 
from real world performance problems not theoretical ones.  Do some research on 
clojures vector implementation and you'll see the fastest implementation in 
theory is comparitively slow in practice due to the way the caching works. 

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

2012-04-26 Thread Dave Sann
lein-eclipse works great for me.

The problem is that duck-streams is part of the old consolidated clojure 
contrib. Which you can still get - but haven't referenced as a dependency.

try adding

[org.clojure/clojure-contrib 1.2.0]


to your dependencies.

But be aware that this is all deprecated.

D




On Friday, 27 April 2012 04:07:07 UTC+10, Alex Ott wrote:

 lein-eclipse was released 2 years ago... I think, that now it's better 
 to work via pom.xml - generate it with 'lein pom' and import into 
 eclipse 

 On Wed, Apr 25, 2012 at 2:55 PM, Chirag Ghiyad chirag.ghi...@searce.com 
 wrote: 
  hi, 
  
  I have created one lein project, 
  than updating its project.clj with dev-dependency of eclips 
  
  I ran lein deps 
  
  it downloaded all dependencies 
  
  but into my.m2/repository directory there is no clojure directory. 
  and this causes me 
  
  leiningen.eclipse  Problem loading: java.io.FileNotFoundException: 
  Could not locate clojure/contrib/duck_streams__init.class or clojure/ 
  contrib/duck_streams.clj on classpath:  (eclipse.clj:1) 
  
  error when i ran lein help which abandons me to develop with eclipse 
  because i cant run my lein eclipse command. 
  
  Any solution for this??? 
  Thanks in advance. 
  
  my project.clj is given below 
  
  (defproject for_test 1.0.0-SNAPSHOT 
   :description FIXME: write description 
   :dependencies [[org.clojure/clojure 1.2.1]] 
   :dev-dependencies [[lein-eclipse 1.0.0]] 
  ) 
  
  Thnks 'n Regards, 
  chirag ghiyad 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clojure@googlegroups.com 
  Note that posts from new members are moderated - please be patient with 
 your first post. 
  To unsubscribe from this group, send email to 
  clojure+unsubscr...@googlegroups.com 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 



 -- 
 With best wishes,Alex Ott 
 http://alexott.net/ 
 Tiwtter: alexott_en (English), alexott (Russian) 
 Skype: alex.ott 


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

2012-04-26 Thread Shantanu Kumar
That sounds quite interesting! Do you have a Github URL of the project
to share?

Shantanu

On Apr 25, 12:29 am, Pelle Braendgaard pel...@gmail.com wrote:
 This is a simple OAuth 2 provider that is designed to be used as a primary
 authentication provider for a Clojure Ring app.

 I am a relative Clojure novice, but have am very experienced in OAuth.
 Please help give feedback on use of idiomatic clojure.

 It currently handles OAuth2 bearer authentication and interactive
 authentication.

 By interactive authentication I mean, it can be used for primary end user
 authentication by sticking a token in a session. This means that you could
 eventually provide google/facebook like session overviews and log off
 remote sessions.

 The following bearer tokens are implemented:

 * Authorization 
 headerhttp://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.1
 * Form encoded body 
 parameterhttp://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.2
 * URI query 
 fieldhttp://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-08#section-2.3
 * Non standard http cookie ('access_token') for use in interactive
 applications
 * Non standard session ('access_token') for use in interactive applications

 Authorization response types:

 * Authorization Code 
 Granthttp://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.1
 * Implicit Granthttp://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.2

 Currently the following Grant types are supported:

 * Authorization Code 
 Granthttp://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.1
 * Client Credential 
 Granthttp://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.4
 * Resource Owner Password Credential 
 Granthttp://tools.ietf.org/html/draft-ietf-oauth-v2-25#section-4.3

 Currently it supports Redis and in memory for tokens, apps and users. There
 is a very easy protocol to implement to add further stores. I will probably
 add a separate one for korma and for datomic. These will be released as
 separate projects.

 For an interactive demo of it:

   lein run -m clauth.demo

 I am working on a demo app that I will deploy on heroku.

 P
 --http://agree2.com- Reach Agreement!http://stakeventures.com- My blog about 
 startups and agile banking

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

2012-04-26 Thread Guofeng Zhang
I need to copy or install lein-cljsbuild-0.1.8.jar to LEIN's plugins directory. 
Then each steps works well.

Thanks for your help.

-Original Message-
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
nchurch
Sent: Friday, April 27, 2012 2:49 AM
To: Clojure
Subject: lein-cljsbuild on Windows?

It sounds like lein deps is not getting all the dependencies (there should be 
four files to .lein-plugins and one to lib); it must be a windows-specific 
issue as I have no problem cloning the project on Mac; and unfortunately I do 
not have access to Windows, so can't say what the problem may be.  There may be 
a Windows issue with lein- cljsbuild; see this thread:

http://groups.google.com/group/clojure/browse_thread/thread/52e41094d69f6577

I wonder if you could copy the dependencies manually.  Another thing you could 
try is to intall lein-cljsbuild globally with lein plugin install.

On Apr 26, 2:36 am, Guofeng Zhang guof...@radvision.com wrote:
 Trying ctest.

 if I clone the project then run  lein cljsbuild auto in it, I got:
 Copying 3 files to D:\projects\app\clojure\contrib\ctest\.lein-plugins
 Compiling ClojureScript.
 Error: Could not find or load main class clojure.main

 If I run lein deps, then run lein cljsbuild auto, I got:
 That's not a task. Use lein help to list all tasks.

 Do I need extra configuration for my environment?

 Leiningen 1.7.1 on Java 1.7.0_03 Java HotSpot(TM) 64-Bit Server VM
  Windows 7

 Thanks







 -Original Message-
 From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On 
 Behalf Of nchurch
 Sent: Thursday, April 26, 2012 12:49 PM
 To: Clojure
 Subject: Re: Having trouble running clojurescript repl

 BTW, I pushed a minimal lein-cljsbuild project with REPL here:

 https://github.com/nchurch/ctest

 On Apr 25, 9:30 pm, Sean Neilan s...@seanneilan.com wrote:
  Holy shnikes! That did it!

  Thank you so much!

  I'll submit a patch to the documentation.

  On Wed, Apr 25, 2012 at 11:27 PM, David Nolen dnolen.li...@gmail.comwrote:

   sounds like you didn't set CLOJURESCRIPT_HOME or that it was set 
   incorrectly.

   On Wed, Apr 25, 2012 at 9:40 PM, Sean Neilan sneil...@gmail.com wrote:

   Hi All,

   I'm not sure if this has been asked before.

   I followed the quickstart guide:
  https://github.com/clojure/clojurescript/wiki/Quick-Startanddid

   git clone git://github.com/clojure/clojurescript.git
   cd clojurescript
   ./script/bootstrap

   Then I tried
   rmc-235-244:clojurescript seanneilan$ ./script/repl Clojure
   1.3.0-beta1 user= which worked

   But, when I did
   user= (require '[cljs.repl :as repl]) I got 
   FileNotFoundException Could not locate cljs/repl__init.class or 
   cljs/repl.clj on
   classpath:   clojure.lang.RT.load (RT.java:430)

   I tried running
   rmc-235-244:clojurescript seanneilan$ ./script/repljs

   But I got
   Exception in thread main java.lang.RuntimeException:
   java.io.FileNotFoundException: Could not locate 
   cljs/repl__init.class or cljs/repl.clj on classpath:
    at clojure.lang.Util.runtimeException(Util.java:153)
   at clojure.lang.Compiler.eval(Compiler.java:6417)
    at clojure.lang.Compiler.eval(Compiler.java:6372)
   at clojure.core$eval.invoke(core.clj:2745)
    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) Caused by:
   java.io.FileNotFoundException: Could not locate 
   cljs/repl__init.class or cljs/repl.clj on classpath:
    at clojure.lang.RT.load(RT.java:430) at
   clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4636.invoke(core.clj:5377)
   at clojure.core$load.doInvoke(core.clj:5376)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
   at clojure.core$load_one.invoke(core.clj:5191)
    at clojure.core$load_lib.doInvoke(core.clj:5228)
   at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
   at clojure.core$load_libs.doInvoke(core.clj:5262)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
   at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$require.doInvoke(core.clj:5343)
   at clojure.lang.RestFn.invoke(RestFn.java:408)
    at user$eval1.invoke(NO_SOURCE_FILE:1)
   at clojure.lang.Compiler.eval(Compiler.java:6406)
    ... 11 more

   I'm not sure what's going on. Thank you for your time!

   -Sean
   s...@seanneilan.com

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

RE: new with clojure, need help!

2012-04-26 Thread Guofeng Zhang
See if the following is helpful:

http://dev.clojure.org/display/doc/Getting+Started+with+Eclipse+and+Counterclockwise


From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
omer
Sent: Wednesday, April 25, 2012 10:37 PM
To: clojure@googlegroups.com
Subject: new with clojure, need help!

hello im need to learn how to use clojure and how it works,
i found some videos the helped me a bit to understand how clojure works,
but i need a more basic guidence on how to install the nessecery plugins
to eclipse, and what to do with them...
any tutorial will do! thats...
p.s. im using windows and i need to learn how to operate it for a course in 
programing languge pricipals...
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to 
clojure@googlegroups.commailto:clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.commailto: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