Re: ANN: clojure.java.jdbc 0.0.7

2011-10-13 Thread Marko Kocić
Looking at the log seems like MS Access doesn't support prepared statements.
It shouldn't have anything to do with jdbc.

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

2011-10-13 Thread Bruce Durling
I probably won't be able to make it this weekend, but if someone wants
to implement Benford's Law, that would be cool.

http://econerdfood.blogspot.com/2011/10/benfords-law-and-decreasing-reliability.html

cheers,
Bruce

On Mon, Oct 10, 2011 at 21:44, Ben Evans  wrote:
> Hi,
>
> There is an Incanter Hack Day taking place on Sunday at the Royal
> Festival Hall in London. We'll be on the 5th floor, Blue side.
>
> The group will begin turning up at 1000, but feel free to come a bit
> later if that's too early. We'll go for some lunch somewhere close by
> on Southbank when everyone gets hungry, then come back for a few more
> hours hacking in the afternoon. It's very laid-back and informal, and
> we try to be accessible to interested developers of all levels. Feel
> free to bring Incanter tasks to hack on (but we always have a stock of
> open tasks if people need something to work on).
>
> These are regular, monthly events - every 3rd Sunday of the month.
> Upcoming dates are:
>
> 16th October
> 20th November
> 18th December
>
> Hope to see you on Sunday!
>
> Thanks,
>
> Ben
>

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

2011-10-13 Thread keeds
Hi,
Don't disagree about MS Access but it's a useful simple tool some times...

The code is:
(defn get-target
  [bu measure year]
  (with-connection db
(with-query-results rs ["Select Period_Month, Target From Targets_Qry 
Where BU_ID = ? And Measure_Code = ? And Period_Year = ?" bu measure year]
  (to-dataset (into [] rs)

It worked fine with clojure 1.2 and clojure.contrib.sql

Thanks,
Andrew

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

2011-10-13 Thread Ivan Koblik
Fail enough. I guess, to allow nested spawning and avoid deadlocks, tasks
should finish without waiting for the result but spawn a new task similar to
itself that would check for the completion of the child tasks, repeating the
cycle if necessary.

Imagine that task t1 is monitored through a future f1, now it spawns child
task t2 which is monitored through a future f2. t1 doesn't wait for t2 to
complete, but reschedules a new task t3 that would check f2 for completion,
and if f2 is done then sets f1 to done, otherwise reschedules itself as t4.

Although I don't know how memory hungry it may get and what would be the
impact on the length of the task queue. Maybe we could make the queue of
limited length and if new task t2 gets rejected then it is performed within
the task t1?

Cheers,
Ivan.


On 13 October 2011 00:21, j-g-faustus  wrote:

> On Tuesday, October 11, 2011 8:07:16 PM UTC+2, Andy Fingerhut wrote:
> > If it were implemented not by creating Java Threads for each task, but
> submitting a task to an ExecutorService...
>
> As far as I understand, that's easy if you're willing to use it
> asynchronously: Push tasks on the queue, let the worker threads deal with
> them whenever they get around to it, and never block waiting for results
> within a task.
> I.e. a task could submit nested tasks to the queue, but it couldn't use
> them to compute partial results for its own use.
>
> If you want synchronous behavior, there are only two ways that I know of to
> do that: Either disallow nesting, like (await agent), or use an unbounded
> thread pool, like pmap.
>
> If you allow unbounded nesting of "submit task and wait for the result" on
> a fixed size thread pool, I'm pretty sure you'll end up with deadlock.
> (Which is why agents disallow it, I assume.)
> Imagine a 1-thread ExecutorService where the task running on the single
> work thread submits a new task to the service and blocks until it receives a
> result: The only thread that can process that task just went to sleep, and
> it won't wake up until it receives a result that there are no threads left
> to compute.
> The issue is the same with more worker threads; except that it will work,
> more or less, as long as at least one thread is still awake. But the
> scenario where every worker thread submits-and-waits simultaneously is bound
> to happen at some point.
>
>
> With the disclaimer that I might be missing something,
>
> jf
>
>
> On Tuesday, October 11, 2011 8:07:16 PM UTC+2, Andy Fingerhut wrote:
>
>> One benefit would be convenience of enabling parallelism on nested data
>> structures.  One function at the top level could use parallelism, and the
>> pieces, perhaps handled by separate functions, and perhaps nested several
>> levels deep in function calls, could also use parallelism.
>>
>> If it were implemented not by creating Java Threads for each task, but
>> submitting a task to an ExecutorService, then the actual number of active
>> Java Threads could be kept reasonably low (e.g. maybe 2 times the number of
>> physical CPU cores), whereas the number of parallel tasks the work is
>> divided into could be limited only by memory for storing the tasks scheduled
>> for future execution.
>>
>> Andy
>>
>>
>> On Tue, Oct 11, 2011 at 10:55 AM, j-g-faustus wrote:
>>
>>>  On Tuesday, October 11, 2011 3:55:09 AM UTC+2, Lee wrote:


 Does your pmap-pool permit nesting? (That is, does it permit passing
 pmap-pool a function which itself calls pmap-pool?). If so then that would
 be a reason to prefer it over my pmapall.

>>> I expect it would be possible to nest it (possible as in "no exceptions
>>> or deadlocks"), but I can't see any scenario where you would want to - you
>>> would get an exponentially increasing number of threads. If 48 cores each
>>> start 48 threads, each of those threads start another 48 etc., it doesn't
>>> take long before you have enough threads to bog down even the most powerful
>>> server.
>>>
>>> But what would be the purpose of a nested "run this on all cores"
>>> construct? You are already running on all cores, there are no spare
>>> resources, so in terms of CPU time I can't see how it would differ from
>>> merely having the pmapped function use a plain same-thread map?
>>>
>>> There are no particular advantages to pmap-pool over pmapall that I can
>>> see, except that pmap-pool lets you control the number of threads more
>>> easily. (E.g. for debugging "where does it stop scaling linearly" problems.)
>>> I thought creating thousands of agents (as pmapall does) would be more
>>> expensive, so I tried an alternative, but in practice they seem to be
>>> equally fast; at least on this test and the kind of hardware I have access
>>> to.
>>> So pmapall wins by having fewer lines of code.
>>>
>>>
>>> jf
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>>
>>> Note that posts from new m

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-13 Thread Ivan Koblik
Sorry I meant "Fair enough ..."

Cheers,
Ivan.


On 13 October 2011 12:41, Ivan Koblik  wrote:

> Fail enough. I guess, to allow nested spawning and avoid deadlocks, tasks
> should finish without waiting for the result but spawn a new task similar to
> itself that would check for the completion of the child tasks, repeating the
> cycle if necessary.
>
> Imagine that task t1 is monitored through a future f1, now it spawns child
> task t2 which is monitored through a future f2. t1 doesn't wait for t2 to
> complete, but reschedules a new task t3 that would check f2 for completion,
> and if f2 is done then sets f1 to done, otherwise reschedules itself as t4.
>
> Although I don't know how memory hungry it may get and what would be the
> impact on the length of the task queue. Maybe we could make the queue of
> limited length and if new task t2 gets rejected then it is performed within
> the task t1?
>
> Cheers,
> Ivan.
>
>
>
> On 13 October 2011 00:21, j-g-faustus  wrote:
>
>> On Tuesday, October 11, 2011 8:07:16 PM UTC+2, Andy Fingerhut wrote:
>> > If it were implemented not by creating Java Threads for each task, but
>> submitting a task to an ExecutorService...
>>
>> As far as I understand, that's easy if you're willing to use it
>> asynchronously: Push tasks on the queue, let the worker threads deal with
>> them whenever they get around to it, and never block waiting for results
>> within a task.
>> I.e. a task could submit nested tasks to the queue, but it couldn't use
>> them to compute partial results for its own use.
>>
>> If you want synchronous behavior, there are only two ways that I know of
>> to do that: Either disallow nesting, like (await agent), or use an unbounded
>> thread pool, like pmap.
>>
>> If you allow unbounded nesting of "submit task and wait for the result" on
>> a fixed size thread pool, I'm pretty sure you'll end up with deadlock.
>> (Which is why agents disallow it, I assume.)
>> Imagine a 1-thread ExecutorService where the task running on the single
>> work thread submits a new task to the service and blocks until it receives a
>> result: The only thread that can process that task just went to sleep, and
>> it won't wake up until it receives a result that there are no threads left
>> to compute.
>> The issue is the same with more worker threads; except that it will work,
>> more or less, as long as at least one thread is still awake. But the
>> scenario where every worker thread submits-and-waits simultaneously is bound
>> to happen at some point.
>>
>>
>> With the disclaimer that I might be missing something,
>>
>> jf
>>
>>
>> On Tuesday, October 11, 2011 8:07:16 PM UTC+2, Andy Fingerhut wrote:
>>
>>> One benefit would be convenience of enabling parallelism on nested data
>>> structures.  One function at the top level could use parallelism, and the
>>> pieces, perhaps handled by separate functions, and perhaps nested several
>>> levels deep in function calls, could also use parallelism.
>>>
>>> If it were implemented not by creating Java Threads for each task, but
>>> submitting a task to an ExecutorService, then the actual number of active
>>> Java Threads could be kept reasonably low (e.g. maybe 2 times the number of
>>> physical CPU cores), whereas the number of parallel tasks the work is
>>> divided into could be limited only by memory for storing the tasks scheduled
>>> for future execution.
>>>
>>> Andy
>>>
>>>
>>> On Tue, Oct 11, 2011 at 10:55 AM, j-g-faustus wrote:
>>>
  On Tuesday, October 11, 2011 3:55:09 AM UTC+2, Lee wrote:
>
>
> Does your pmap-pool permit nesting? (That is, does it permit passing
> pmap-pool a function which itself calls pmap-pool?). If so then that would
> be a reason to prefer it over my pmapall.
>
 I expect it would be possible to nest it (possible as in "no exceptions
 or deadlocks"), but I can't see any scenario where you would want to - you
 would get an exponentially increasing number of threads. If 48 cores each
 start 48 threads, each of those threads start another 48 etc., it doesn't
 take long before you have enough threads to bog down even the most powerful
 server.

 But what would be the purpose of a nested "run this on all cores"
 construct? You are already running on all cores, there are no spare
 resources, so in terms of CPU time I can't see how it would differ from
 merely having the pmapped function use a plain same-thread map?

 There are no particular advantages to pmap-pool over pmapall that I can
 see, except that pmap-pool lets you control the number of threads more
 easily. (E.g. for debugging "where does it stop scaling linearly" 
 problems.)
 I thought creating thousands of agents (as pmapall does) would be more
 expensive, so I tried an alternative, but in practice they seem to be
 equally fast; at least on this test and the kind of hardware I have access
 to.
 So pmapall wins by having fewer lines of code.

Re: The Website / Wikispaces

2011-10-13 Thread Simon Morgan
On Oct 12, 6:25 pm, Sean Corfield  wrote:
> Can someone provide a tried and true navigation path that shows this
> problem?

I don't think so, and that's what makes it so strange.

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

2011-10-13 Thread David Nolen
Fixed in master.

On Wed, Oct 12, 2011 at 2:22 PM, David Nolen  wrote:

> Thanks for the report, CLJS-62 reopened,
> http://dev.clojure.org/jira/browse/CLJS-62
>
> David
>
> On Wed, Oct 12, 2011 at 2:10 PM, Praki  wrote:
>
>> I am running into a problem with memoized functions in ClojureScript.
>> Functions which take a single argument work okay but functions of two
>> args throw an error.
>>
>> I haven't been able to isolate the bug (I am able to hash vectors and
>> nested vectors just fine). Any hints on the root cause or workarounds
>> is greatly appreciated.
>>
>> Repl transcript follows.
>>
>> > ~/tools/clojurescript/script/repljs
>> "Type: " :cljs/quit " to quit"
>> ClojureScript:cljs.user> (defn foo [a] a)
>> #<
>> function foo(a) {
>>return a;
>> }
>> >
>> ClojureScript:cljs.user> (defn bar [a b] [a b])
>> #<
>> function bar(a, b) {
>>return cljs.core.Vector.fromArray([a, b]);
>> }
>> >
>> ClojureScript:cljs.user> (def foo-m (memoize foo))
>> #<
>> function (var_args) {
>>var args = null;
>>if (goog.isDef(var_args)) {
>>args =
>> cljs.core.array_seq(Array.prototype.slice.call(arguments, 0), 0);
>>}
>>return G__4512__delegate.call(this, args);
>> }
>> >
>> ClojureScript:cljs.user> (def bar-m (memoize bar))
>> #<
>> function (var_args) {
>>var args = null;
>>if (goog.isDef(var_args)) {
>>args =
>> cljs.core.array_seq(Array.prototype.slice.call(arguments, 0), 0);
>>}
>>return G__4512__delegate.call(this, args);
>> }
>> >
>> ClojureScript:cljs.user> (foo 1)
>> 1
>> ClojureScript:cljs.user> (foo-m 1)
>> 1
>> ClojureScript:cljs.user> (bar 1 2)
>> [1 2]
>> ClojureScript:cljs.user>
>> (bar-m 1 2)
>> "Error evaluating:" (bar-m 1 2) :as "cljs.user.bar_m.call(null,1,2);
>> \n"
>> org.mozilla.javascript.JavaScriptException: Error: Index out of bounds
>> (cljs/core.cljs#974)
>>at cljs/core.cljs:974 (anonymous)
>>at cljs/core.cljs:991 (anonymous)
>>at cljs/core.cljs:115 (anonymous)
>>at cljs/core.cljs:161 (anonymous)
>>at cljs/core.cljs:319 (anonymous)
>>at cljs/core.cljs:338 (anonymous)
>>at cljs/core.cljs:307 (anonymous)
>>at cljs/core.cljs:314 (anonymous)
>>at cljs/core.cljs:181 (anonymous)
>>at cljs/core.cljs:204 (anonymous)
>>at cljs/core.cljs:733 (anonymous)
>>at cljs/core.cljs:740 (anonymous)
>>at cljs/core.cljs:1035 (hash_coll)
>>at cljs/core.cljs:296 (anonymous)
>>at cljs/core.cljs:158 (_hash)
>>at cljs/core.cljs:525 (hash)
>>at cljs/core.cljs:2167 (anonymous)
>>at cljs/core.cljs:148 (_assoc)
>>at cljs/core.cljs:472 (anonymous)
>>at cljs/core.cljs:519 (anonymous)
>>at cljs/core.cljs:2191 (anonymous)
>>at cljs/core.cljs:2207 (anonymous)
>>at cljs/core.cljs:2100 (anonymous)
>>at cljs/core.cljs:148 (_assoc)
>>at cljs/core.cljs:472 (anonymous)
>>at cljs/core.cljs:519 (anonymous)
>>at cljs/core.cljs:2841 (anonymous)
>>at cljs/core.cljs:2878 (anonymous)
>>at cljs/core.cljs:3013 (anonymous)
>>at cljs/core.cljs:3022 (anonymous)
>>at :9 (anonymous)
>>at :9
>>
>> nil
>> ClojureScript:cljs.user>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>

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

2011-10-13 Thread David Nolen
Also fixed in master.

On Tue, Oct 11, 2011 at 9:17 AM, David Nolen  wrote:

> Looks like a bug, ticket created -
> http://dev.clojure.org/jira/browse/CLJS-85
>
>
> On Tue, Oct 11, 2011 at 2:16 AM, Praki  wrote:
>
>> In Clojure (read-string ":a:b:c") returns :a:b:c (a keyword with two
>> embedded colons) whereas ClojureScript returns :a. In ClojureScript
>> reading of a token ends at whitespace or a macro character (except '
>> and #). Is this difference deliberate or just an oversight and colon
>> to be allowed to be part of keywords as in Clojure?
>>
>> 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

Excellent blog post on core.logic

2011-10-13 Thread David Nolen
Ryan Senior has put together an excellent post on appendo - a relation from
core.logic. Highly recommended.

http://objectcommando.com/blog/2011/10/13/appendo-the-great/

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: [ANN] dj 0.1.0 released

2011-10-13 Thread Brent Millare
0.2.0 Released
Made a new API namespace called "dj"

Now all the utilities I think users would typically need are in this 
namespace. This also allowed me to clean up the core code since it doesn't 
cater to the users anymore.

The functions currently are:

get-classpaths
get-current-classloader - gets current thread classloader
reload-class-file - allows you to reload a .class file
ls-repo - list directories in a repository given a group path
get-repository-urls - lists current repository URLs
add-to-classpath! - adds path to classpath
add-dependencies! - obtains dependencies and adds to classpath

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

clojure.contrib.except's future?

2011-10-13 Thread ffailla
Does anyone now if clojure.contrib.except being ported to the new
contrib?  Thanks.

Frank Failla

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

2011-10-13 Thread Tom Hicks
typo: try https://github.com/clojure/data.codec

On Oct 10, 6:31 pm, Alexander Taggart  wrote:
> Base64 decoding support has been added.
>
> http://github.com/ataggart/clojure.data.codec

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

2011-10-13 Thread Sean Corfield
On Thu, Oct 13, 2011 at 11:19 AM, ffailla  wrote:
> Does anyone now if clojure.contrib.except being ported to the new
> contrib?  Thanks.

So far no one has volunteered to maintain it so the question hadn't come up...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

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

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


ClojureScript: integration with jQuery

2011-10-13 Thread Frank Warren
Howdy

This particular story starts with vast existing code base using
jQuery. We'd love to switch to ClojureScript given its pure
awesomeness, but we still have to somehow cope with the existing bits,
at least to maintain the same look&feel.

Is there any good approach to invoke jQuery functionality from
ClojureScript?

Is it feasible to wrap existing jQuery into some sort of helper class
and invoke it instead?

I would highly appreciate any suggestions,
F.

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

2011-10-13 Thread Samuel Lê
Hi,
I can do Benford's law.
See you on suday,
Samuel

On Thu, Oct 13, 2011 at 10:02 AM, Bruce Durling  wrote:

> I probably won't be able to make it this weekend, but if someone wants
> to implement Benford's Law, that would be cool.
>
>
> http://econerdfood.blogspot.com/2011/10/benfords-law-and-decreasing-reliability.html
>
> cheers,
> Bruce
>
> On Mon, Oct 10, 2011 at 21:44, Ben Evans 
> wrote:
> > Hi,
> >
> > There is an Incanter Hack Day taking place on Sunday at the Royal
> > Festival Hall in London. We'll be on the 5th floor, Blue side.
> >
> > The group will begin turning up at 1000, but feel free to come a bit
> > later if that's too early. We'll go for some lunch somewhere close by
> > on Southbank when everyone gets hungry, then come back for a few more
> > hours hacking in the afternoon. It's very laid-back and informal, and
> > we try to be accessible to interested developers of all levels. Feel
> > free to bring Incanter tasks to hack on (but we always have a stock of
> > open tasks if people need something to work on).
> >
> > These are regular, monthly events - every 3rd Sunday of the month.
> > Upcoming dates are:
> >
> > 16th October
> > 20th November
> > 18th December
> >
> > Hope to see you on Sunday!
> >
> > Thanks,
> >
> > Ben
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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: integration with jQuery

2011-10-13 Thread David Nolen
ClojureScript can access globals via js/foo. You can easily interact with
your existing codebase using this simple feature. For example:

(ns foo.bar)

(def j js/jQuery)

(.text (j "div#foo") "jQuery works!")

Were you looking for something more sophisticated then this?

David

On Wed, Oct 12, 2011 at 8:08 PM, Frank Warren  wrote:

> Howdy
>
> This particular story starts with vast existing code base using
> jQuery. We'd love to switch to ClojureScript given its pure
> awesomeness, but we still have to somehow cope with the existing bits,
> at least to maintain the same look&feel.
>
> Is there any good approach to invoke jQuery functionality from
> ClojureScript?
>
> Is it feasible to wrap existing jQuery into some sort of helper class
> and invoke it instead?
>
> I would highly appreciate any suggestions,
> F.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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: The Website / Wikispaces

2011-10-13 Thread Stuart Sierra
You can see the redirect with:

 wget http://clojure.org/


-S

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

2011-10-13 Thread Luc Prefontaine
Hi,

If no one steps forward and if this lib has some future
I can do it for next Thursday, it looks small enough to fit migration and in 
that time frame.

I need an approved name and the usual stuff (github repo, hudson built setup, 
...)

Should I repost to clojure-dev ?

Looks like I am about to collect more shrapnel fragments in that 1.3 migration 
effort :)))

Luc P.

On Thu, 13 Oct 2011 12:09:48 -0700
Sean Corfield  wrote:

> On Thu, Oct 13, 2011 at 11:19 AM, ffailla  wrote:
> > Does anyone now if clojure.contrib.except being ported to the new
> > contrib?  Thanks.
> 
> So far no one has volunteered to maintain it so the question hadn't
> come up...



-- 
Luc P.


The rabid Muppet

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


newbie, installation problem

2011-10-13 Thread Bruce Gordon
I'm trying to install Clojure following the directions at
http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html . I'm
installing on SimplyMepis. I've installed the sun JDK and can verify
the installation with the following:

[root@mepis1 clojure]# java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

When I run ant I get the following error.

---
 [java] Testing clojure.test-clojure.java.io
 [java]
 [java] ERROR in (test-socket-iofactory) (PlainSocketImpl.java:-2)
 [java] Uncaught exception, not in assertion.
 [java] expected: nil
 [java]   actual: java.net.SocketException: Network is unreachable
 [java]  at java.net.PlainSocketImpl.socketConnect
(PlainSocketImpl.java:-2)
 [java] java.net.PlainSocketImpl.doConnect
(PlainSocketImpl.java:351)
 [java] java.net.PlainSocketImpl.connectToAddress
(PlainSocketImpl.java:213)
 [java] java.net.PlainSocketImpl.connect (PlainSocketImpl.java:
200)
 [java] java.net.SocksSocketImpl.connect (SocksSocketImpl.java:
366)
 [java] java.net.Socket.connect (Socket.java:529)
 [java] java.net.Socket.connect (Socket.java:478)
 [java] java.net.Socket. (Socket.java:375)
 [java] java.net.Socket. (Socket.java:189)
 [java] clojure.test_clojure.java.io/fn (io.clj:199)
 [java] clojure.test$test_var$fn__6484.invoke (test.clj:693)
 [java] clojure.test$test_var.invoke (test.clj:693)
 [java] clojure.test$test_all_vars$fn__6488$fn__6495.invoke
(test.clj:709)
 [java] clojure.test$default_fixture.invoke (test.clj:663)
 [java] clojure.test$test_all_vars$fn__6488.invoke (test.clj:
709)
 [java] clojure.test$default_fixture.invoke (test.clj:663)
 [java] clojure.test$test_all_vars.invoke (test.clj:705)
 [java] clojure.test$test_ns.invoke (test.clj:728)
 [java] clojure.core$map$fn__3811.invoke (core.clj:2431)
 [java] clojure.lang.LazySeq.sval (LazySeq.java:42)
 [java] clojure.lang.LazySeq.seq (LazySeq.java:60)
 [java] clojure.lang.Cons.next (Cons.java:39)
 [java] clojure.lang.RT.boundedLength (RT.java:1607)
 [java] clojure.lang.RestFn.applyTo (RestFn.java:130)
 [java] clojure.core$apply.invoke (core.clj:602)
 [java] clojure.test$run_tests.doInvoke (test.clj:743)
 [java] clojure.lang.RestFn.applyTo (RestFn.java:137)
 [java] clojure.core$apply.invoke (core.clj:600)
 [java] clojure.test_clojure$eval20580.invoke (run_tests.clj:
59)
 [java] clojure.lang.Compiler.eval (Compiler.java:6493)
 [java] clojure.lang.Compiler.load (Compiler.java:6930)
 [java] clojure.lang.Compiler.loadFile (Compiler.java:6891)
 [java] clojure.main$load_script.invoke (main.clj:282)
 [java] clojure.main$script_opt.invoke (main.clj:342)
 [java] clojure.main$main.doInvoke (main.clj:426)
 [java] clojure.lang.RestFn.invoke (RestFn.java:408)
 [java] clojure.lang.Var.invoke (Var.java:401)
 [java] clojure.lang.AFn.applyToHelper (AFn.java:161)
 [java] clojure.lang.Var.applyTo (Var.java:518)
 [java] clojure.main.main (main.java:37)

-

All the other tests are successful. I'm open to all suggestions,
including alternative installation ideas.

Thanks, -Bruce

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


clojure struct with java

2011-10-13 Thread Diego Pacheco
Hi guys,

I’m trying to call Clojure from Java(I already managed to do it
compiling Clojure using :gen-class  ).

I want call Clojure using Java without compiling Clojure… I’m having
issues with my structs they are not behaving in the way that I want, I
tested the Clojure code on REPL and it seems to be ok...

I Guess is something that I’m doing in java(possibly wrong )

[company.clj]

(ns user)

(def employees (ref []))

(defstruct employee :name :age :role :salary)

(defn hire[e]
  (dosync (alter employees conj e))
)

(defn print-employee[e]
  (prn (str "Name: " (:name e) " - Age: " (:age e)
" - Role: " (:role e) " - Salary:" (:salary e)
)
  )
)

(defn print-employees[]
  (for [i (range (count @employees))]
   (print-employee (employees i))
  )
)

[JavaCallsClojureInterpreted.java]

import clojure.lang.RT;
import clojure.lang.Var;

/**
 *
 * @author Diego Pacheco
 *
 */
public class JavaCallsClojureInterpreted {

  public static void main(String args[]) throws
Throwable{
try{

RT.loadResourceScript("company.clj");

Var struct = RT.var("clojure.core",
"struct","employee :diego 10 :coach 1000");

Var hire = RT.var("user", "hire");
Object r = hire.invoke(struct);
System.out.println(r);

Var printee = RT.var("user", "print-employee");
Object r2 = printee.invoke(struct);
System.out.println(r2);

Var print = RT.var("user", "print-employees");
Object result = print.invoke();
System.out.println(result);

}catch(Exception e){
  e.printStackTrace();
}
  }

}

This code produce the following output:

[#'clojure.core/struct]
"Name:  - Age:  - Role:  - Salary:"
null
"Name:  - Age:  - Role:  - Salary:"
clojure.lang.LazySeq@1f

Any Clue ?

Thanks for your help.

Cheers,
Diego Pacheco
@diego_pacheco

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


Re: newbie, installation problem

2011-10-13 Thread Phil Hagelberg
On Thu, Oct 13, 2011 at 4:51 PM, Bruce Gordon  wrote:
> I'm trying to install Clojure following the directions at
> http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html . I'm
> installing on SimplyMepis. I've installed the sun JDK and can verify
> the installation with the following:

Those instructions are very out of date. I recommend the official documentation:

http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

-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


Exception in thread "main" java.lang.Exception: Unable to resolve symbol: PK♥♦¶

2011-10-13 Thread jayvandal
I am trying to run "CRUD in clojure" 2010 and I get this problem

lein uberjar
 Some  problem ?
Any help thanks

Exception in thread "main" java.lang.Exception: Unable to resolve
symbol: PK♥♦¶
  t↕N? in this context (core.clj:1)


Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\jim>cd\

C:\>cd cl*

C:\clojure>cd proj

C:\clojure\proj>lein new crud
Created new project in: C:\clojure\proj\crud

C:\clojure\proj>cd crud

C:\clojure\proj\crud>lein deps
Copying 7 files to C:\clojure\proj\crud\lib
Copying 1 file to C:\clojure\proj\crud\lib\dev

C:\clojure\proj\crud>lein uberjar
Cleaning up.
Copying 7 files to C:\clojure\proj\crud\lib
Exception in thread "main" java.lang.Exception: Unable to resolve
symbol: PK♥♦¶
  t↕N? in this context (core.clj:1)
at clojure.lang.Compiler.analyze(Compiler.java:5205)
at clojure.lang.Compiler.analyze(Compiler.java:5151)
at clojure.lang.Compiler.compile1(Compiler.java:5928)
at clojure.lang.Compiler.compile(Compiler.java:5992)
at clojure.lang.RT.compile(RT.java:368)
at clojure.lang.RT.load(RT.java:407)
at clojure.lang.RT.load(RT.java:381)
at clojure.core$load$fn__4519.invoke(core.clj:4915)
at clojure.core$load.doInvoke(core.clj:4914)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:4729)
at clojure.core$compile$fn__4524.invoke(core.clj:4926)
at clojure.core$compile.invoke(core.clj:4925)
at user$eval7.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$null_opt.invoke(main.clj:279)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:369)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.Exception: Unable to resolve symbol: PK♥♦¶  t↕N?
in this co
ntext
at clojure.lang.Compiler.resolveIn(Compiler.java:5677)
at clojure.lang.Compiler.resolve(Compiler.java:5621)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:5584)
at clojure.lang.Compiler.analyze(Compiler.java:5172)
... 26 more
Uberjar aborting because jar/compilation failed.

C:\clojure\proj\crud>lein uberjar
Cleaning up.
Copying 7 files to C:\clojure\proj\crud\lib
Exception in thread "main" java.lang.Exception: Unable to resolve
symbol: PK♥♦¶
  ?↕N? in this context (core.clj:1)
at clojure.lang.Compiler.analyze(Compiler.java:5205)
at clojure.lang.Compiler.analyze(Compiler.java:5151)
at clojure.lang.Compiler.compile1(Compiler.java:5928)
at clojure.lang.Compiler.compile(Compiler.java:5992)
at clojure.lang.RT.compile(RT.java:368)
at clojure.lang.RT.load(RT.java:407)
at clojure.lang.RT.load(RT.java:381)
at clojure.core$load$fn__4519.invoke(core.clj:4915)
at clojure.core$load.doInvoke(core.clj:4914)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:4729)
at clojure.core$compile$fn__4524.invoke(core.clj:4926)
at clojure.core$compile.invoke(core.clj:4925)
at user$eval7.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$null_opt.invoke(main.clj:279)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:369)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.Exception: Unable to resolve symbol: PK♥♦¶  ?↕N?
in this co
ntext
at clojure.lang.Compiler.resolveIn(Compiler.java:5677)
at clojure.lang.Compiler.resolve(Compiler.java:5621)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:5584)
at clojure.lang.Compiler.analyze(Compiler.java:5172)
... 26 more
Uberjar aborting because jar/compilation failed.

C:\clojure\proj\crud>

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

A question about lazy-seq fn.

2011-10-13 Thread mmwaikar
Hi,

Most of the examples I see about using the lazy-seq fn. make use of cons to 
build the list (or a seq).

Can we not use lazy-seq with a conj? And why?
If it possible to use lazy-seq with a conj, then an example would be great.

Thanks,
Manoj.

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

Basic Question on Record construction

2011-10-13 Thread Dave Sann
Hi all, this may be a very simple question but I have not been able to find 
any docs that help me

(defrecord R [a b c])

Is there something equivalent to:

(def r (apply R. ["a" "b" "c"]))

available? (without writing macros?)

(in practice the list would be generated by some other function - say 
splitting a string or mapping over something else)

Thanks

Dave


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

Re: Basic Question on Record construction

2011-10-13 Thread Stephen Compall
On Thu, 2011-10-13 at 21:41 -0700, Dave Sann wrote:
> Hi all, this may be a very simple question but I have not been able to find 
> any docs that help me

I suggest http://dev.clojure.org/display/design/defrecord
+improvements#defrecordimprovements-Generatedfactoryfunctions .

> (defrecord R [a b c])
> 
> Is there something equivalent to:
> 
> (def r (apply R. ["a" "b" "c"]))
> 
> available? (without writing macros?)

The above generates ->r in 1.3.  Check the link above for more.

-- 
Stephen Compall
^aCollection allSatisfy: [:each|aCondition]: less is better

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


Re: A question about lazy-seq fn.

2011-10-13 Thread Stephen Compall
On Thu, 2011-10-13 at 21:38 -0700, mmwaikar wrote:
> Most of the examples I see about using the lazy-seq fn. make use of cons to 
> build the list (or a seq).
> 
> Can we not use lazy-seq with a conj? And why?

Not really.

user=> (clojure-version)
"1.3.0"
user=> (do (cons 88 (map prn [4 6])) nil)
nil
user=> (do (conj (map prn [4 6]) 88) nil)
4
6
nil

Conj forces its collection argument if it's a lazy seq.

-- 
Stephen Compall
^aCollection allSatisfy: [:each|aCondition]: less is better

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

2011-10-13 Thread Alexander Taggart
I suspect this...

Var struct = RT.var("clojure.core", "struct","employee :diego 10 :coach 
1000"); 

isn't doing what you think it will.  That will set the root binding of 
clojure.core/struct to the string you gave it.  you probably want to get the 
var for the struct function, and then invoke it with the arguments to create 
an employee struct instance.

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