Q about eval-and-print function in clojurescript's cljs.repl (repl.clj)

2012-09-18 Thread Frank Siebenlist
I'm trying to understand the clojurescript-code of the repl functionality, and 
I'm confused…

The following cljs.repl/eval-and-print function takes a cljs-form, compiles it, 
sends it to the browser as javascript, and then receives the result, and the… 
try's to use "read-string" on that return value:

---
(defn- eval-and-print [repl-env env form]
  (let [ret (evaluate-form repl-env
   (assoc env :ns (ana/get-namespace ana/*cljs-ns*))
   ""
   form
   (wrap-fn form))]
(try (prn (read-string ret))
 (catch Exception e
   (if (string? ret)
 (println ret)
 (prn nil))
---

Why does it call read-string on the returned result from the js-eval?

The eval'ed compiled javascript could result in a clojure-form that would be 
eval'ed on the return (???), and the result of the latter is then printed.

Confusingly yours, FrankS.

-- 
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] nrepl.el 0.1.4 released

2012-09-18 Thread Stefan Hübner
I get the the following error when trying to auto-complete e.g. "(pri":

--8<---cut here---start->8---
java.lang.NullPointerException: null
 at clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:314)
clojure.stacktrace$print_stack_trace.invoke (stacktrace.clj:51)
clojure.stacktrace$print_stack_trace.invoke (stacktrace.clj:49)
user$eval6701.invoke (nrepl-server.clj:2)
clojure.lang.Compiler.eval (Compiler.java:6465)
clojure.lang.Compiler.eval (Compiler.java:6431)
clojure.core$eval.invoke (core.clj:2795)
clojure.main$repl$read_eval_print__5967.invoke (main.clj:244)
clojure.main$repl$fn__5972.invoke (main.clj:265)
clojure.main$repl.doInvoke (main.clj:265)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__768.invoke 
(interruptible_eval.clj:57)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:600)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1769)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke 
(interruptible_eval.clj:42)

clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__809$fn__811.invoke
 (interruptible_eval.clj:170)
clojure.core$comp$fn__3758.invoke (core.clj:2276)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__802.invoke 
(interruptible_eval.clj:137)
clojure.lang.AFn.run (AFn.java:24)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask 
(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run 
(ThreadPoolExecutor.java:908)
java.lang.Thread.run (Thread.java:662)
--8<---cut here---end--->8---

I use tools.nrepl 0.2.0-beta9 and clojure-complete 0.2.2

The nREPL server is started with this script (nrepl-server.clj as seen
in stack-trace):

--8<---cut here---start->8---
(use '[clojure.tools.nrepl.server :only [start-server stop-server]])

(defonce server (start-server :port 4005))
(println "nREPL server started at port 4005")
--8<---cut here---end--->8---


-Stefan

Tim King  writes:

> I am happy to announce the release of nrepl.el v0.1.4, an Emacs client for
> nREPL.
>
> https://github.com/kingtim/nrepl.el
>
> v0.1.4 is available now on Marmalade, and should also be available on Melpa.
> See the github Readme for installation and usage instructions.
>
> Notable additions since our last release:
>  - Improvements and simplifications for completion (Tassilo Horn)
>  - Fix paredit .. don't make clojure-mode-map parent of
> nrepl-interaction-mode-map (Tassilo Horn)
>  - Documentation additions and fixes (Ryan Fowler, Nikita Beloglazov, Bozhidar
> Batsov, Juha Syrjälä, Philipp Meier)
>  - Make completion back-end and error handler configurable (Hugo Duncan)
>  - Accept host as well as port on connect (Ken Restivo)
>  - Enable nrepl-interaction-mode in clojurescript-mode (Nelson Morris)
>  - Emit stdout from interactive evaluations into the repl buffer
>  - Various bug fixes:
>    - Fixes for ECB interop (Matthew Willson)
>    - Namespace qualify tooling calls (Justin Kramer)
>    - Eldoc fixes (Jack Moffitt)
>    - Fix path quoting in load file for Windows (Philipp Meier)
>    - Fix nREPL / Emacs error "Unable to resolve symbol: if-let"
>
> Many thanks to all the contributors who have reported issues and 
> submitted pull
> requests.
>
> Cheers,
> Tim
>
> --
> 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: Evolving the Clojure contribution process and goals

2012-09-18 Thread Andy Fingerhut
On Tue, Sep 18, 2012 at 9:01 PM, Paul deGrandis wrote:

>
> 1.) Clojure.org should have a better host of documentation, especially for
> newcomers.
> We saw from the Clojure Survey, as well as threads here on the mailing
> list, that documentation is still something on which we as a community need
> to work.
> Could perhaps a different process govern documentation contributions,
> something more akin to http://docs.scala-lang.org/contribute.html that
> doesn't involve the CA?
> How could we best integrate such a project into Clojure.org?  Would anyone
> be willing to help push such a project forward?
>

I am not personally willing to push such a project forward at this time.  I
have some suggestions if someone else is.

The only things required for someone to create a new web site dedicated to
better Clojure documentation is time, knowledge, and some money.  If you,
perhaps together with a group of like-minded colleagues, have those
resources, my guess is that it would be easier to create a new site than to
expect someone else to do an overhaul on clojure.org.  You would own your
own destiny.  You would never need to wait on someone else to do something
for you, unless it was someone at the company you chose to host your site,
or one of your colleagues to do their part.

It is quick and easy for clojure.org to add one or several links to such a
site once it is up and going.  The Clojure cheatsheet (
http://clojure.org/cheatsheet) currently links to ClojureDocs.org, but it
would be easy to switch those links to point to another site if something
else superseded it (I've edited the cheatsheet significantly 6 months ago,
and the links are now auto-generated, and thus easy to retarget :-)

Create a site that does everything ClojureDocs.org does and even more, with
the ability to add examples specific to Clojure 1.4, and in the future
Clojure 1.5+, but otherwise lets examples for older versions of Clojure be
displayed until and unless they are tagged by someone as obsolete.  It
would be cool if it allowed submissions not only for the contrib modules,
but was able to quickly "import" any Clojure library, i.e. write some code
that automates most of the steps of adding a new Clojure library to the web
site.  Even better if people wrote tutorials on how to use a library as a
whole and put it on the site, and not only for individual functions.

For whoever thinks they might want to do such a thing, expect many thanks,
many bug reports and suggestions for improvements, and sometimes complaints
that you aren't doing what others think you ought to be doing.  If that and
what you will learn are enough to motivate you, go for it.  Bonus points if
you have a team of people working on it that can keep it going even as
people move on to other projects in their lives.

Andy

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

Evolving the Clojure contribution process and goals

2012-09-18 Thread Paul deGrandis
Clojure Conj is nearly upon us.  Last year there was a very positive 
meeting to discuss and help improve the contribution process.
This year I thought it might be helpful to get some ideas on the table and 
refined by the community before the Conj.

This has also been a common topic in #clojure.  I'm doing my best to report 
my notes from those conversations as well.
As always, please be sincere, civil, and constructive.

1.) Clojure.org should have a better host of documentation, especially for 
newcomers.
We saw from the Clojure Survey, as well as threads here on the mailing 
list, that documentation is still something on which we as a community need 
to work.
Could perhaps a different process govern documentation contributions, 
something more akin to http://docs.scala-lang.org/contribute.html that 
doesn't involve the CA?
How could we best integrate such a project into Clojure.org?  Would anyone 
be willing to help push such a project forward?

2.) Clojure/dev should announce upcoming changes on the Clojure mailing 
list and potentially via a blog connected to Planet Clojure
This used to happen more frequently, and was a nice way to keep the 
community included in the evolution of the language.
It could even be a weekly column in something as informal as the Clojure 
Gazette or something monthly if that's more appropriate.
Ideally updates would include core as well as contrib.
Perhaps someone in the community wants to step up to fill this gap? (I 
would be more than happy to send out changelogs and summaries to the 
mailing list)

3.) Much like an Emergency Room, there should be a a fast-track to getting 
smaller patches approved and merged.
This is actually not a problem consistent across all areas of the language 
- some contrib libraries and ClojureScript in particular seem to be getting 
this *just right*.
Is there a way we can adjust the current workflow to fill need?  It seems 
like even with more screeners, patches are sitting idle.
One possible solution is if we extended contrib-like ownership into parts 
of Clojure proper, like clojure.test, clojure.string, etc.

4.) What are the limitations behind changing the CA process?  Can the CA 
process be made digital (a scan of a signed CA, SSH shared key, OAuth 
credential confirmation) or potentially reformed to allow more of the 
community to easily get involved, especially for smaller patches or doc 
changes?
After looking at similar communities (Scala - 
http://docs.scala-lang.org/sips/sip-submission.html, Python - 
http://www.python.org/psf/contrib/), it seems like there are potential 
improvements we could make as the language, ecosystem, and community evolve.

An additional project idea:
A nice start to unifying the documentation could be gathering all the CC 3 
licensed Clojure-related works, organizing them, and linking them 
together.  Anyone want to take it and run with it?

Thoughts?

Paul

-- 
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: Tagged literals: undefined tags blow up reader

2012-09-18 Thread kovas boguta
So the edn spec gives the following guidelines:
"If a reader encounters a tag for which no handler is registered, the
implementation can either report an error, call a designated 'unknown
element' handler, or create a well-known generic representation that
contains both the tag and the tagged element, as it sees fit. Note
that the non-error strategies allow for readers which are capable of
reading any and all edn, in spite of being unaware of the details of
any extensions present."

https://github.com/edn-format/edn

It would suffice then to have *unknown-element-handler* , and avoid
specifying the "well-known generic representation" for now if people
want to delay decisions on metadata and protocols.

-- 
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: array literal syntax

2012-09-18 Thread David Nolen
On Tue, Sep 18, 2012 at 9:20 PM, Andrew  wrote:
> I tried this but it didn't work. (identical? (array 1 2) (foo)) Did you mean
> this?

No. Sorry I meant that equality between two primitive arrays is based
on whether they point to the same thing in memory. You want to test
two arrays for equality it's best put them into something immutable
and test those for equality -

(= (into [] array1) (into [] array2))

You could also do something like the following if you're sure that
no-one else has aliased the arrays -

(= (seq array1) (seq array2))

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: array literal syntax

2012-09-18 Thread Andrew
I tried this but it didn't work. (identical? (array 1 2) (foo)) Did you 
mean this?

On Tuesday, September 18, 2012 5:08:11 PM UTC-4, David Nolen wrote:
>
> On Tue, Sep 18, 2012 at 4:54 PM, Andrew > 
> wrote: 
> > In my ClojureScript unit tests, the following doesn't evaluate to true 
> (= 
> > (array 1 2) (foo)) even though all foo does is return (array 1 2). 
> > 
> > What should I do differently? 
>
> Those are primitive mutable arrays and are compared via identity. 
>
> 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: Request to create new contrib: data.dependency

2012-09-18 Thread Stuart Sierra
I didn't get approval to create data.dependency, so instead I've merged 
that work into tools.namespace, currently available as 0.2.0-SNAPSHOT.

-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: Confused by reference to "capturing" (as opposed to "binding") in C. Grand's talk "(not= DSL macros)"

2012-09-18 Thread Matching Socks

The Google can find a PDF by that name.  It uses "capturing" in the sense 
of regular expressions.  I think his idea is that in the DSL you identify 
or produce information (capture it), but you do not specify the names by 
which the user's program will refer to it (bind 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: array literal syntax

2012-09-18 Thread David Nolen
On Tue, Sep 18, 2012 at 5:07 PM, Andrew Cheng  wrote:
> FYI, in #clojure, duck11232 suggested the following which works for me.
>
> (defn arr= [a b] (not (or (< a b) (> a b

This is not valid Clojure. Using this in CLJS will result in things
like the following:

(arr= (array 1) (array "1"))
;; => true

< and > only have defined behavior when given numerical values - not
arrays, not strings, etc. Depending on this behavior is not
recommended.

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: Modelling for DAG with identity map - or not?

2012-09-18 Thread Bob Hutchison

On 2012-09-16, at 3:21 PM, Patrik Sundberg  wrote:

> I'm asking myself though if there's a more functional design for 
> accomplishing the same goals? My main goals are to do things consistently so 
> that changing a value X propagates properly, and being able to find 
> dependencies of a given value. A DAG+identity map is my first take, but there 
> may be something more natural for FP I'm completely missing.

Sounds like a reasonable approach to me. There's nothing wrong with state, just 
how you manipulate it. The STM in Clojure is really nice in this regard. You 
might want to have a look at Functional Reactive Programming (FRP). There's a 
lot of stuff available about that in the Haskell community, but usually for UIs 
and things like that. They sometimes use spread sheets as an example (spread 
sheets can be thought of as a DAG with values and computations in cells… you 
can see the mapping between them in your application (where the mapping doesn't 
work or is hard might be pointing at something quite interesting). There's also 
something called 'Cells' in Common Lisp that might be interesting. I'm not sure 
what's been done in Clojure.

Cheers,
Bob

> 
> Thanks,
> Patrik
> 

-- 
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: array literal syntax

2012-09-18 Thread Andrew Cheng
FYI, in #clojure, duck11232 suggested the following which works for me.

(defn arr= [a b] (not (or (< a b) (> a b

On Tue, Sep 18, 2012 at 4:54 PM, Andrew  wrote:

> In my ClojureScript unit tests, the following doesn't evaluate to true (=
> (array 1 2) (foo)) even though all foo does is return (array 1 2).
>
> What should I do differently?
>
> On Tuesday, January 10, 2012 2:51:06 PM UTC-5, David Nolen wrote:
>>
>> There is no array literal syntax yet, but (array 22 33) should work for
>> you.
>>
>> On Tue, Jan 10, 2012 at 2:46 PM, billh2233  wrote:
>>
>>> How do I code an array literal in clojurescript that translates to an
>>> array literal in javascript? What's the syntax?
>>>
>>> If I code in clojurescript:
>>> ... [22 33] ...
>>> it translates to a javascript vector:
>>> cljs.core.Vector.fromArray([**22,33])
>>>
>>> Javascript (fx/Animation) needs an array defining an X Y point and
>>> complains that this parameter is not an array.
>>>
>>> Thanks.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en
>>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
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: array literal syntax

2012-09-18 Thread David Nolen
On Tue, Sep 18, 2012 at 4:54 PM, Andrew  wrote:
> In my ClojureScript unit tests, the following doesn't evaluate to true (=
> (array 1 2) (foo)) even though all foo does is return (array 1 2).
>
> What should I do differently?

Those are primitive mutable arrays and are compared via identity.

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: array literal syntax

2012-09-18 Thread Andrew
In my ClojureScript unit tests, the following doesn't evaluate to true (= 
(array 1 2) (foo)) even though all foo does is return (array 1 2). 

What should I do differently?

On Tuesday, January 10, 2012 2:51:06 PM UTC-5, David Nolen wrote:
>
> There is no array literal syntax yet, but (array 22 33) should work for 
> you.
>
> On Tue, Jan 10, 2012 at 2:46 PM, billh2233 
> > wrote:
>
>> How do I code an array literal in clojurescript that translates to an
>> array literal in javascript? What's the syntax?
>>
>> If I code in clojurescript:
>> ... [22 33] ...
>> it translates to a javascript vector:
>> cljs.core.Vector.fromArray([22,33])
>>
>> Javascript (fx/Animation) needs an array defining an X Y point and
>> complains that this parameter is not an array.
>>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>

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

Re: Confused by reference to "capturing" (as opposed to "binding") in C. Grand's talk "(not= DSL macros)"

2012-09-18 Thread Baishampayan Ghose
Apparently blip.tv is down now. I will take a look at the video when
it's available again and get back to you.

Regards,
BG

On Tue, Sep 18, 2012 at 12:47 PM, Alex Dowad  wrote:
> Dear B.G., thanks for your response. I already understand the problem of
> variable capture in macros well. However, is that really what C. Grand is
> talking about in "(not= DSL macros)"? If you have a video of the talk, the
> part where he talks about "capturing" comes at about 13:40.
>
> --
> 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



-- 
Baishampayan Ghose
b.ghose at gmail.com

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


ANN Welle 1.3.1

2012-09-18 Thread Michael Klishin
Welle is an expressive Clojure client for Riak with batteries included.

1.3.1 is a bug fix release:

 * Welle now uses reasonable vclock pruning settings by default

Detailed change log:
https://github.com/michaelklishin/welle/blob/1.3.x-stable/ChangeLog.md

Documentation guides:
http://clojureriak.info
-- 
MK

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

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

Re: Confused by reference to "capturing" (as opposed to "binding") in C. Grand's talk "(not= DSL macros)"

2012-09-18 Thread Alex Dowad
Dear B.G., thanks for your response. I already understand the problem of 
variable capture in macros well. However, is that really what C. Grand is 
talking about in "(not= DSL macros)"? If you have a video of the talk, the 
part where he talks about "capturing" comes at about 13:40.

-- 
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: Confused by reference to "capturing" (as opposed to "binding") in C. Grand's talk "(not= DSL macros)"

2012-09-18 Thread Baishampayan Ghose
"Variable Capture" (a common problem with unhygenic macros) can
introduce defects in your code.

Wikipedia has some info on it -
https://en.wikipedia.org/wiki/Common_Lisp#Variable_capture_and_shadowing

For more, you should take a look at "On Lisp" by Paul Graham.

Regards,
BG

On Tue, Sep 18, 2012 at 12:33 PM, Alex Dowad  wrote:
> In his talk entitled "(not= DSL macros)", C. Grand recommends designing the
> core of a DSL with "capturing" rather than binding, then adding binding
> macros as an extra layer on top if desired.
>
> I'm trying to understand what exactly he means by "capturing" in this
> context. I'm familiar with the use of the word "capture" to describe what
> lexical closures can do with variables from the surrounding scope, and also
> to describe what non-hygienic macros can do with variables from the
> surrounding scope, but it seems he's referring to something else here. A
> Google search doesn't bring up anything enlightening. Can anyone offer a
> brief explanation?
>
> --
> 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



-- 
Baishampayan Ghose
b.ghose at gmail.com

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


Confused by reference to "capturing" (as opposed to "binding") in C. Grand's talk "(not= DSL macros)"

2012-09-18 Thread Alex Dowad
In his talk entitled "(not= DSL macros)", C. Grand recommends designing the 
core of a DSL with "capturing" rather than binding, then adding binding 
macros as an extra layer on top if desired.

I'm trying to understand what exactly he means by "capturing" in this 
context. I'm familiar with the use of the word "capture" to describe what 
lexical closures can do with variables from the surrounding scope, and also 
to describe what non-hygienic macros can do with variables from the 
surrounding scope, but it seems he's referring to something else here. A 
Google search doesn't bring up anything enlightening. Can anyone offer a 
brief explanation?

-- 
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: Some feedback on clojurescript

2012-09-18 Thread Gergely Nagy
Wes Freeman  writes:

> A separate mailing list for ClojureScript would be great. Also, enabling
> the label [Clojure] for all subjects of emails would be great (this must be
> a setting in google groups, because most of the larger groups have it
> enabled), as I filter through a great deal of email I don't care about, and
> I actually would like to read the latest emails from the Clojure list.

As far as the subject prefix goes: there's already List-Id: and
X-BeenThere headers on all mails to the list, which you can filter
on. GMail supports these well too, so adding a label onto them to make
it clear what list a mail arrived to is very, very easy.

Personally, I like that everything Clojure-ish is here, from Clojure,
through ClojureCLR to ClojureScript. The subject usually makes it clear
which of those the mail is about, so it can easily be marked read.

-- 
|8]

-- 
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: instantiating a clojure record from Java

2012-09-18 Thread Sean Corfield
On Tue, Sep 18, 2012 at 11:04 AM, Jim - FooBar(); wrote:

> However i get again:  ClassNotFoundException Clondie24.games.chess.Player
>

That suggests the Clojure code isn't AOT compiled and/or isn't on your
class path?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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

Re: Some feedback on clojurescript

2012-09-18 Thread David Nolen
On Tue, Sep 18, 2012 at 2:29 PM, Alexey Petrushin
 wrote:
>> issues on JIRA
> Theres a barrier - You has to register to JIRA to submit issue - many people
> won't bother with that and just ignore small bugs or proposals vs. almost
> everyone has github account.

Small bugs are submitted to JIRA all the time. It may be barrier for
some, but more contributions does not mean better contributions. The
contributions we've received so far have been stellar - so I'm
inclined to think the "barrier" is an illusion.

Bigger proposals generally need discussion - that's what the
clojure-dev mailing list and the Confluence design pages are for.

>> JVM
> Yeah, would be nice to have JS-on-the-fly compiler (like CoffeeScript)

Yes it would, but by and large the users of ClojureScript are Clojure
users. So we haven't seen much real interest in this yet.

> Would be also nice to have Node.js and NPM support.

There is rudimentary support for Node.js. I think everyone would love
to see more support but any such additions will be driven by a
community of people that actively develop these desirable features.
The most popular usage of ClojureScript seems to be Clojure
applications that want to target browser based clients.

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: Some feedback on clojurescript

2012-09-18 Thread Alexey Petrushin
> issues on JIRA
Theres a barrier - You has to register to JIRA to submit issue - many 
people won't bother with that and just ignore small bugs or proposals vs. 
almost everyone has github account.

> JVM
Yeah, would be nice to have JS-on-the-fly compiler (like CoffeeScript)

Would be also nice to have Node.js and NPM support.

-- 
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: instantiating a clojure record from Java

2012-09-18 Thread Jim - FooBar();

trying at the repl:


(class (Player. nil 1))
 =>Clondie24.games.chess.Player

if the fully-qualified name won't work I don't know what will! 
weird-stuff...


Jim



On 18/09/12 19:04, Jim - FooBar(); wrote:
I want to instantiate a record and call a fn from java source code... 
I've got this in my .java file:


//prepare java-clojure interop
private static IFn requireFn = RT.var("clojure.core", 
"require").fn();
static {requireFn.invoke(Symbol.intern("Clondie24.games.chess"));} 
//the namespace
private static IFn fitnessFn = RT.var("Clondie24.games.chess", 
"ga-fitness").fn();  //the fn I need






private int compete (final MLRegression contestant){
  BasicNetwork opponent = pickRandom();
   if (!contestant.equals(opponent))
return (Integer)fitnessFn.invoke(new 
Clondie24.games.chess.Player(contestant, 1),
 new 
Clondie24.games.chess.Player(opponent, -1));//the actual tournament

   else
return compete(contestant);  //recurse once
}



and this in my clj :

(defrecord Player [brain direction])

However i get again:  ClassNotFoundException Clondie24.games.chess.Player

It seems I've underestimated the degree of difficulty when going from 
clojure to java and back to clojure!


thanks for any pointers...

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


instantiating a clojure record from Java

2012-09-18 Thread Jim - FooBar();
I want to instantiate a record and call a fn from java source code... 
I've got this in my .java file:


//prepare java-clojure interop
private static IFn requireFn = RT.var("clojure.core", "require").fn();
static {requireFn.invoke(Symbol.intern("Clondie24.games.chess"));} 
//the namespace
private static IFn fitnessFn = RT.var("Clondie24.games.chess", 
"ga-fitness").fn();  //the fn I need






private int compete (final MLRegression contestant){
  BasicNetwork opponent = pickRandom();
   if (!contestant.equals(opponent))
return (Integer)fitnessFn.invoke(new 
Clondie24.games.chess.Player(contestant, 1),
 new 
Clondie24.games.chess.Player(opponent, -1));//the actual tournament

   else
return compete(contestant);  //recurse once
}



and this in my clj :

(defrecord Player [brain direction])

However i get again:  ClassNotFoundException Clondie24.games.chess.Player

It seems I've underestimated the degree of difficulty when going from 
clojure to java and back to clojure!


thanks for any pointers...

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: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();

On 18/09/12 17:54, Jim - FooBar(); wrote:

On 18/09/12 17:50, Aaron Cohen wrote:

I actually just tried this (I don't recommend this approach though),
and it worked for me, maybe you missed a step.



what jar is lein2 using? the one with the nice name or the one with 
the numbers at the end? which one of the 2 did you modify?


Jim

ps: btw thanks a million for your time


 it's the jar with the funny numbers at the end!!! I was trying the 
other one with the proper name!


ok I guess I'll push one more SNAPSHOT without any hyphens/underscores!

thanks a lot Aaron... :-)

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: ClojureScript dead-code elimination

2012-09-18 Thread Mimmo Cosenza
I'm studying clojurescript/closure to better understand if using 
clojurescript could be really a step ahead in developing rich web based 
application. So, I'm still a newbie. I found in some way useful this google 
service http://closure-compiler.appspot.com/home  to evaluate gclosure 
benefits form code reduction point of view.

In any case I think that the dead-code elimination is a great thing, but 
more importants, IMHO, are others two issues:

a) resolving impedance mismatch between FP/UI (functional reactive 
programming? use macro to minimize incidental complexity in using OO UI?) 

b) clojurescript debugging 

I would never choose clojurescript on the client-side just to obtain a 
dead-code reduction (in any case it's a plus), but because it can reduce 
develoment time and increase robustness.

Mimmo 

On Tuesday, September 18, 2012 4:03:29 PM UTC+2, Matt Campbell wrote:
>
> On 9/18/2012 8:57 AM, David Nolen wrote: 
> > I've heard of several large 
> > ClojureScript programs that generate 1.2-1.8 *megabytes* of 
> > JavaScript. After advanced compilation and gzipping the applications 
> > are around 40k-50k (http://blog.mezeske.com/?p=552). This is pretty 
> > impressive given that jQuery, which is pretty standard these days, 
> > itself is 32k gzipped. 
>
> That is indeed impressive. I'd say the overhead of ClojureScript in 
> small programs is a non-issue then. Sorry for making a fuss about it. 
>
> Matt 
>
>

-- 
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: mixing clojure source with java class files problem!

2012-09-18 Thread Aaron Cohen
On Tue, Sep 18, 2012 at 12:54 PM, Jim - FooBar();  wrote:
> On 18/09/12 17:50, Aaron Cohen wrote:
>>
>> I actually just tried this (I don't recommend this approach though),
>> and it worked for me, maybe you missed a step.
>
>
>
> what jar is lein2 using? the one with the nice name or the one with the
> numbers at the end? which one of the 2 did you modify?
>
> Jim
>
> ps: btw thanks a million for your time

The one with the full timestamp. I extracted the whole thing, renamed
the directory and recompressed it.

user=> (import encog_java.customGA.CustomNeuralGeneticAlgorithm)
encog_java.customGA.CustomNeuralGeneticAlgorithm

-- 
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: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();

On 18/09/12 17:50, Aaron Cohen wrote:

I actually just tried this (I don't recommend this approach though),
and it worked for me, maybe you missed a step.



what jar is lein2 using? the one with the nice name or the one with the 
numbers at the end? which one of the 2 did you modify?


Jim

ps: btw thanks a million for your time

--
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: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();

On 18/09/12 17:50, Aaron Cohen wrote:

I actually just tried this (I don't recommend this approach though),
and it worked for me, maybe you missed a step.


what? seriously? You mean you downloaded the jar and managed to import 
some class from inside encog_java/customGA/ in some dummy project of yours ?


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: mixing clojure source with java class files problem!

2012-09-18 Thread Aaron Cohen
On Tue, Sep 18, 2012 at 12:39 PM, Jim - FooBar();  wrote:
> On 18/09/12 17:28, Aaron Cohen wrote:
>
> What did you use to compile this? I don't believe hyphens are legal in
> Java package names.
>
>
> I used regular
>
>  javac -cp blah:blah:blah  encog-java/customGA/*.java
>
> the compiler did not complain because the actual package declaration uses
> underscore instead of hyphen.
> yes hyphens are indeed illegal... that is, you cannot write "package
> foo-bar;" but you can write "package foo_bar;"  when in fact being in the
> "foo-bar" folder.
>
> It will be hard to use this in clojure, clojure converts hyphens to
> underscores automatically behind the scenes in package names. But your
> package actually has a (possibly invalid) hyphen in it's name, so the
> mangling prevents your class from being found.

I was actually wrong here, I think. I should probably check closer,
but I now think that clojure only mangles its own package names when
necessary. I don't think it ever mangles doing pure interop.


> exactly!!! when I ask from clojure  (:import [encog-java.customGA aClass])
> clojure should convert the hyphen to match the actual package found in the
> declaration of class files. UNderscores are certainly legal characters...the
> thing is, it doesn't matter whether i use an underscore or not when
> importing - I always get the same error which makes me slightly
> suspicious...
>
> In my desperation, I went into my ~/.m2 directory and actually modified the
> jar by hand so the folder "encog-java" was renamed to "encog_java" but again
> the same story! I don't get it!!!

I actually just tried this (I don't recommend this approach though),
and it worked for me, maybe you missed a step.

 I think you'll have best luck if you make your directory structure
match the package name.

--Aaron

-- 
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: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();

On 18/09/12 17:28, Aaron Cohen wrote:

What did you use to compile this? I don't believe hyphens are legal in
Java package names.


I used regular

*javac -cp blah:blah:blah  encog-java/customGA/*.java*

the compiler did not complain because the actual package declaration 
uses underscore instead of hyphen.
yes hyphens are indeed illegal... that is, you cannot write "package 
foo-bar;" but you can write "package foo_bar;"  when in fact being in 
the "foo-bar" folder.



It will be hard to use this in clojure, clojure converts hyphens to
underscores automatically behind the scenes in package names. But your
package actually has a (possibly invalid) hyphen in it's name, so the
mangling prevents your class from being found.


exactly!!! when I ask from clojure  (:import [encog-java.customGA 
aClass]) clojure should convert the hyphen to match the actual package 
found in the declaration of class files. UNderscores are certainly legal 
characters...the thing is, it doesn't matter whether i use an underscore 
or not when importing - I always get the same error which makes me 
slightly suspicious...


In my desperation, I went into my ~/.m2 directory and actually modified 
the jar by hand so the folder "encog-java" was renamed to "encog_java" 
but again the same story! I don't get it!!!


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: mixing clojure source with java class files problem!

2012-09-18 Thread Aaron Cohen
What did you use to compile this? I don't believe hyphens are legal in
Java package names.

It will be hard to use this in clojure, clojure converts hyphens to
underscores automatically behind the scenes in package names. But your
package actually has a (possibly invalid) hyphen in it's name, so the
mangling prevents your class from being found.

--Aaron

On Tue, Sep 18, 2012 at 11:58 AM, Jim - FooBar();  wrote:
> decompiling a simple interface gives:
>
> package encog_java.customGA;
>
> import org.encog.ml.MLRegression;
> import org.encog.ml.genetic.population.Population;
>
> public abstract interface CalculateScore
> {
> public abstract double calculateScore(MLRegression paramMLRegression);
>
> public abstract boolean shouldMinimize();
>
> public abstract void setPopulation(Population paramPopulation);
> }
>
> the package declaration seems perfectly fine in the class files (as
> expected)...what on earth is happening? Tried both hyphen/underscore when
> :import-ing but i get the same error!
>
> Jim
>
>
> On 18/09/12 16:51, Jim - FooBar(); wrote:
>
> It still not finding the compiled classes! I compiled them all using the
> exact same package declaration as the one found in the jar that I'm
> producing!
> I was also careful to convert the hyphen (directory name) to an underscore
> (in the .java file)...
>
> I am still getting a :
>
> ClassNotFoundException encog_java.customGA.CustomNeuralGeneticAlgorithm
> java.net.URLClassLoader$1.run (URLClassLoader.java:366)
>
> the jar i'm referring to is on clojars [enclog "0.5.6-SNAPSHOT"] in case you
> have any doubts that the classes are in there...
>
> any pointers are greatly appreciated...
>
> Jim
>
>
>
>
>
> On 18/09/12 16:16, Jim - FooBar(); wrote:
>
> On 18/09/12 16:00, Aaron Cohen wrote:
>
> The package is baked into the .class file format. You can't change it
> after the fack by just moving files in the directory structure.
>
>
> regardless of whether there is an actual package declaration?
>
> So, you're saying that if I compile the java source inside a replicated
> directory structure as the one it will be consumed from, everything will be
> fine?
> I honestly thought i could skip all that, by not having any packages at all!
> I also tried putting the class files right next to the clj files but again
> it wouldn't find them!
>
> What are you trying to accomplish by doing this?
>
>
> well, the short story is that I'm wrapping a library but I'm not completely
> satisfied with the way it does a couple of things...too many assumptions in
> some places - so I'm trying to sort of re-implement a couple of
> classes/interfaces and include them already compiled in a separate folder in
> the jar in case someone else faces similar issues. It took a while to write
> the java code and of course compile it successfully against all the
> prerequisites...now, apparently i need to recompile in a replicated dir
> structure...
>
> I did not use proxy and the gang cos it just seemed easier (mutable
> variables/inheritance etc etc)
>
> 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

-- 
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: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();

decompiling a simple interface gives:

*package*encog_java.customGA;

*import*org.encog.ml.MLRegression;
*import*org.encog.ml.genetic.population.Population;

*public**abstract**interface*CalculateScore
{
*public**abstract**double*calculateScore(MLRegression paramMLRegression);

*public**abstract**boolean*shouldMinimize();

*public**abstract**void*setPopulation(Population paramPopulation);
}

the package declaration seems perfectly fine in the class files (as  
expected)...what on earth is happening? Tried both hyphen/underscore 
when :import-ing but i get the same error!


Jim

On 18/09/12 16:51, Jim - FooBar(); wrote:
It still not finding the compiled classes! I compiled them all using 
the exact same package declaration as the one found in the jar that 
I'm producing!
I was also careful to convert the hyphen (directory name) to an 
underscore (in the .java file)...


I am still getting a :

ClassNotFoundException 
encog_java.customGA.CustomNeuralGeneticAlgorithm 
java.net.URLClassLoader$1.run (URLClassLoader.java:366)


the jar i'm referring to is on clojars [enclog "0.5.6-SNAPSHOT"] in 
case you have any doubts that the classes are in there...


any pointers are greatly appreciated...

Jim





On 18/09/12 16:16, Jim - FooBar(); wrote:

On 18/09/12 16:00, Aaron Cohen wrote:

The package is baked into the .class file format. You can't change it
after the fack by just moving files in the directory structure.


regardless of whether there is an actual package declaration?

So, you're saying that if I compile the java source inside a 
replicated directory structure as the one it will be consumed from, 
everything will be fine?
I honestly thought i could skip all that, by not having any packages 
at all! I also tried putting the class files right next to the clj 
files but again it wouldn't find them!



What are you trying to accomplish by doing this?


well, the short story is that I'm wrapping a library but I'm not 
completely satisfied with the way it does a couple of things...too 
many assumptions in some places - so I'm trying to sort of 
re-implement a couple of classes/interfaces and include them already 
compiled in a separate folder in the jar in case someone else faces 
similar issues. It took a while to write the java code and of course 
compile it successfully against all the prerequisites...now, 
apparently i need to recompile in a replicated dir structure...


I did not use proxy and the gang cos it just seemed easier (mutable 
variables/inheritance etc etc)


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: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
It still not finding the compiled classes! I compiled them all using the 
exact same package declaration as the one found in the jar that I'm 
producing!
I was also careful to convert the hyphen (directory name) to an 
underscore (in the .java file)...


I am still getting a :

ClassNotFoundException encog_java.customGA.CustomNeuralGeneticAlgorithm 
java.net.URLClassLoader$1.run (URLClassLoader.java:366)


the jar i'm referring to is on clojars [enclog "0.5.6-SNAPSHOT"] in case 
you have any doubts that the classes are in there...


any pointers are greatly appreciated...

Jim





On 18/09/12 16:16, Jim - FooBar(); wrote:

On 18/09/12 16:00, Aaron Cohen wrote:

The package is baked into the .class file format. You can't change it
after the fack by just moving files in the directory structure.


regardless of whether there is an actual package declaration?

So, you're saying that if I compile the java source inside a 
replicated directory structure as the one it will be consumed from, 
everything will be fine?
I honestly thought i could skip all that, by not having any packages 
at all! I also tried putting the class files right next to the clj 
files but again it wouldn't find them!



What are you trying to accomplish by doing this?


well, the short story is that I'm wrapping a library but I'm not 
completely satisfied with the way it does a couple of things...too 
many assumptions in some places - so I'm trying to sort of 
re-implement a couple of classes/interfaces and include them already 
compiled in a separate folder in the jar in case someone else faces 
similar issues. It took a while to write the java code and of course 
compile it successfully against all the prerequisites...now, 
apparently i need to recompile in a replicated dir structure...


I did not use proxy and the gang cos it just seemed easier (mutable 
variables/inheritance etc etc)


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: Calling Clojurescript code from Clojure

2012-09-18 Thread Brent Millare
Actually, after looking through the source myself, I noticed eval-and-print 
just calls evaluate-form, which is better since its public. I can take care 
of printing myself so this is probably 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: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();

On 18/09/12 16:00, Aaron Cohen wrote:

The package is baked into the .class file format. You can't change it
after the fack by just moving files in the directory structure.


regardless of whether there is an actual package declaration?

So, you're saying that if I compile the java source inside a replicated 
directory structure as the one it will be consumed from, everything will 
be fine?
I honestly thought i could skip all that, by not having any packages at 
all! I also tried putting the class files right next to the clj files 
but again it wouldn't find them!



What are you trying to accomplish by doing this?


well, the short story is that I'm wrapping a library but I'm not 
completely satisfied with the way it does a couple of things...too many 
assumptions in some places - so I'm trying to sort of re-implement a 
couple of classes/interfaces and include them already compiled in a 
separate folder in the jar in case someone else faces similar issues. It 
took a while to write the java code and of course compile it 
successfully against all the prerequisites...now, apparently i need to 
recompile in a replicated dir structure...


I did not use proxy and the gang cos it just seemed easier (mutable 
variables/inheritance etc etc)


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: Calling Clojurescript code from Clojure

2012-09-18 Thread Brent Millare
Hi Frank,

That is pretty much exactly as I wanted. The only problem is that you are 
calling a private fn and therefore the code is susceptible to change. I 
think this should be looked into more and become officially supported. This 
is a great hook that opens up the door to a more interactive development 
experience for clojurescript.

On Tuesday, September 18, 2012 2:00:08 AM UTC-4, FrankS wrote:
>
> I have the same requirement to have a clojurescript-form in my 
> clojure-environment that I want to evaluate in the browser… 
>
> To make the following code-snippet work, you're supposed to have a 
> browser-repl session running, and start a new repl-session on that same JVM 
> from where you invoke the following forms to execute either javascript-code 
> or clojurescript-forms in the browser. 
>
> --- 
> user=> (require 'cljs.repl) 
> nil 
>
> user=> (require 'cljs.repl.browser) 
> nil 
>
> user=> (cljs.repl.browser/browser-eval "alert('No Way!')") 
> {:status :success, :value ""} 
>
> user=> (def my-repl-env {:port 9000, :optimizations :simple, :working-dir 
> ".lein-cljsbuild-repl", :serve-static true, :static-dir ["." "out/"], 
> :preloaded-libs []}) 
> #'user/my-repl-env 
>
> user=> (def my-env {:context :statement :locals {}}) 
> #'user/my-env 
>
> user=> (#'cljs.repl/eval-and-print my-repl-env my-env '(js/alert "Yes 
> Way!")) 
> nil 
> nil 
>
> user=> 
> --- 
>
> The public function "cljs.repl.browser/browser-eval" seems to allow you to 
> send javascript code as a string to the browser to execute over the 
> existing browser-repl connection. 
>
> The private function "cljs.repl/eval-and-print" will take a clojurescript 
> form, compile it to javascript and send it to the browser for execution. 
> The "my-repl-env" and "my-env" values are artifacts needed that are 
> normally only available within the context of the function. 
>
> My apology for this huge&ugly hack… please see it as a proof of principle. 
>
> There may be much more elegant solutions available… I've only scratch the 
> surface of understanding how this clojurescript repl works in detail. 
>
> -Enjoy, FrankS 
>
>
> On Sep 17, 2012, at 9:03 PM, Brent Millare > 
> wrote: 
>
> > And yes by eval I mean compile and run on the target (browser) 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> > Note that posts from new members are moderated - please be patient with 
> your first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com  
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
>
>

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

Re: Calling Clojurescript code from Clojure

2012-09-18 Thread Brent Millare
Shantanu,

Quiddity does not fulfill my requirements since I need to control the 
environment from interop such as load-file and interop.

On Tuesday, September 18, 2012 12:03:27 AM UTC-4, Shantanu Kumar wrote:
>
>
>
> On Sep 18, 8:27 am, Brent Millare  wrote: 
> > I forgot to mention an additional condition, this should work with the 
> browser as an eval environment 
>
> Quiddity (URL below) may not load an entire file, but you can eval an 
> S-expression by supplying all values: 
>
> https://github.com/kumarshantanu/quiddity 
>
> Shantanu 
>

-- 
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: mixing clojure source with java class files problem!

2012-09-18 Thread Aaron Cohen
On Tue, Sep 18, 2012 at 10:52 AM, Jim - FooBar();  wrote:
> Hi all,
>
> I'm having a really ridiculous problem...let's say there is jar on clojars
> with the following structure:
>
> --- top-level (.jar)
>   --foo (clojure namespaces)
> -a.clj
> -b.clj
> -c.clj
>   --
>   --bar (java .class files - no package declaration when compiled)

The package is baked into the .class file format. You can't change it
after the fack by just moving files in the directory structure.

You'll have to use a bytecode editor (such as Jar Jar Links:
http://code.google.com/p/jarjar/) to change the package
after-the-fact.

What are you trying to accomplish by doing this?

--Aaron

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


mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();

Hi all,

I'm having a really ridiculous problem...let's say there is jar on 
clojars with the following structure:


--- top-level (.jar)
  --foo (clojure namespaces)
-a.clj
-b.clj
-c.clj
  --
  --bar (java .class files - no package declaration when compiled)
 --baz
  -d.class
  -g.class
--
  --
project.clj
--

When i require namespaces from foo there is no problem (:require [foo.a 
:as A])...but when I try to import a couple of java class files from 
bar  (:import  [bar.baz d g]) it's not finding them!


I compiled them specifically without package declarations so I can put 
them anywhere...I also tried without the "bar.baz" prefixing them but it 
doesn't work...


what am I missing? any pointers?

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 Programming is a great book

2012-09-18 Thread Chas Emerick
On Sep 13, 2012, at 4:40 PM, larry google groups wrote:

> I want to offer a big thanks to Chas Emerick, Brian Carper and Christophe 
> Grand. I just got their book "Clojure Programming" from Amazon yesterday. 
> Spent the whole night reading it. This is my favorite Clojure book so far. 

Thank you (and anyone else that has said good things about the book) for the 
kind words.  I'm glad that you are enjoying it so far, and I hope it helps you 
along in your Clojure journey. :-)

Cheers,

- Chas

--
http://cemerick.com
[Clojure Programming from O'Reilly](http://www.clojurebook.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

Re: ClojureScript dead-code elimination

2012-09-18 Thread Matt Campbell

On 9/18/2012 8:57 AM, David Nolen wrote:

I've heard of several large
ClojureScript programs that generate 1.2-1.8 *megabytes* of
JavaScript. After advanced compilation and gzipping the applications
are around 40k-50k (http://blog.mezeske.com/?p=552). This is pretty
impressive given that jQuery, which is pretty standard these days,
itself is 32k gzipped.


That is indeed impressive. I'd say the overhead of ClojureScript in 
small programs is a non-issue then. Sorry for making a fuss about it.


Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: ClojureScript dead-code elimination

2012-09-18 Thread Moritz Ulrich

Hi,

Matt Campbell writes:

> When run in advanced mode, the Google Closure Compiler tries to 
> eliminate dead code. This currently doesn't seem to be very effective 
> for ClojureScript. A minimal hello-world example currently compiles to 
> 90 KB in advanced mode. Is this the best that can be done? Is Clojure's 
> dynamism an insurmountable obstacle at this point? Or does this area 
> just need more work?
>
> Matt

This is something I'm interested in too.

One solution I can think of is distributing an 'official' precompiled
clojure.core.js file on some CDN. This would enable caching of the
biggest part of the compiled code.

-- 
Moritz Ulrich


pgpvKB8iufMw5.pgp
Description: PGP signature


Re: ClojureScript dead-code elimination

2012-09-18 Thread David Nolen
On Tue, Sep 18, 2012 at 9:40 AM, Matt Campbell  wrote:
> When run in advanced mode, the Google Closure Compiler tries to eliminate
> dead code. This currently doesn't seem to be very effective for
> ClojureScript. A minimal hello-world example currently compiles to 90 KB in
> advanced mode. Is this the best that can be done? Is Clojure's dynamism an
> insurmountable obstacle at this point? Or does this area just need more
> work?
>
> Matt

Avoid making any assumptions about what advanced compilation can do
based on trivial ClojureScript programs. I've heard of several large
ClojureScript programs that generate 1.2-1.8 *megabytes* of
JavaScript. After advanced compilation and gzipping the applications
are around 40k-50k (http://blog.mezeske.com/?p=552). This is pretty
impressive given that jQuery, which is pretty standard these days,
itself is 32k gzipped.

But yes, we can do better and there are some things in ClojureScript
that seem to prevent some dead code from being eliminated in small
programs. There's an open issue for that though no one has tackled it
yet. Note the dead code issue doesn't have much to do with dynamism -
rather issues with the generated JS such that Closure doesn't seem to
want to remove some unused code.

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


[ANN] nrepl.el 0.1.4 released

2012-09-18 Thread Tim King
I am happy to announce the release of nrepl.el v0.1.4, an Emacs client for
nREPL.

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

v0.1.4 is available now on Marmalade, and should also be available on Melpa.
See the github Readme for installation and usage instructions.

Notable additions since our last release:
 - Improvements and simplifications for completion (Tassilo Horn)
 - Fix paredit .. don't make clojure-mode-map parent of
nrepl-interaction-mode-map (Tassilo Horn)
 - Documentation additions and fixes (Ryan Fowler, Nikita Beloglazov,
Bozhidar Batsov, Juha Syrjälä, Philipp Meier)
 - Make completion back-end and error handler configurable (Hugo Duncan)
 - Accept host as well as port on connect (Ken Restivo)
 - Enable nrepl-interaction-mode in clojurescript-mode (Nelson Morris)
 - Emit stdout from interactive evaluations into the repl buffer
 - Various bug fixes:
   - Fixes for ECB interop (Matthew Willson)
   - Namespace qualify tooling calls (Justin Kramer)
   - Eldoc fixes (Jack Moffitt)
   - Fix path quoting in load file for Windows (Philipp Meier)
   - Fix nREPL / Emacs error "Unable to resolve symbol: if-let"

Many thanks to all the contributors who have reported issues and
submitted pull requests.

Cheers,
Tim

-- 
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: Why does cljs.core redefine String.prototype.apply?

2012-09-18 Thread David Nolen
On Tue, Sep 18, 2012 at 9:27 AM, Matt Campbell  wrote:
> On 9/18/2012 8:06 AM, David Nolen wrote:
>>
>> It's a yucky bit of code that needs to be removed. It's there to
>> support using keywords as functions - in ClojureScript keywords are
>> just JS Strings.
>
>
> Is there another way to do the same thing, without a significant performance
> penalty?
>
> Matt

Probably! A simple clean solution could probably deal with the issue
immediately. A more ambitious solution would address the performance
issues that currently exist around keywords as fns.

A patch most welcome.

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


ClojureScript dead-code elimination

2012-09-18 Thread Matt Campbell
When run in advanced mode, the Google Closure Compiler tries to 
eliminate dead code. This currently doesn't seem to be very effective 
for ClojureScript. A minimal hello-world example currently compiles to 
90 KB in advanced mode. Is this the best that can be done? Is Clojure's 
dynamism an insurmountable obstacle at this point? Or does this area 
just need more work?


Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Why does cljs.core redefine String.prototype.apply?

2012-09-18 Thread Matt Campbell

On 9/18/2012 8:06 AM, David Nolen wrote:

It's a yucky bit of code that needs to be removed. It's there to
support using keywords as functions - in ClojureScript keywords are
just JS Strings.


Is there another way to do the same thing, without a significant 
performance penalty?


Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Request to create new contrib: data.dependency

2012-09-18 Thread Stuart Sierra
It's open source. You can do whatever you want, under the terms of the EPL.
-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: ANN Quartzite 1.0 (final)

2012-09-18 Thread Softaddicts
Look at this around the middle of the page:

http://www.slf4j.org/codes.html

Quartz is linked to the slf4j api. At runtime this API tries to find an 
implementation
of the static log binder.

It will not prevent your code from running. If you want to get rid of the 
warning and
get logging (which can be nice :), add one of the listed libs in the page above.

Luc

> Hi,
> 
> I'm trying to use Quartzite so followed the tutorial but I have a problem 
> at executing the -main function.
> I already add the dependency of 
> 
> [clojurewerkz/quartzite "1.0.1"]
> 
> 
> user=> (-main)
> SLF4J: Failed to load class 
> "org.slf4j.impl.StaticLoggerBinder".# org.quartz.impl.StdScheduler@12993463>
> SLF4J: Defaulting to no-operation (NOP) logger implementation
> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
> details. 
> 
> Could you figure what is the problem ? 
> 
> 
> 
>  * Ability to define jobs, triggers and schedules using a DSL
> >  * Scheduling, unscheduling, pausing and resuming jobs and triggers.
> >  * Querying scheduler for information, convenient predicate functions
> >  * Ability to register listeners for scheduler events
> >  * Access to durable scheduler data stores (JDBC databases out of the box, 
> > other stores via plugins)
> >  * Solid documentation (my favorite feature)
> > ,
> >
> > New in 1.0 final:
> >
> >  * Documentation updates
> >  * Stateful jobs support
> >  * Clojure 1.4 by default
> >  * Better names for functions that remove triggers
> >
> > Full change log is available on GitHub [4].
> >
> > Quartzite targets Clojure 1.3+, tested against 3 Clojure versions x 3 JDKs 
> > on travis-ci.org, and is released under the Eclipse Public License.
> >
> > Learn more in the Getting Started guide [2] and the rest of the docs [1].
> >
> > The source is available on GitHub [3]. We also use GitHub to track issues.
> >
> >
> > 1. http://clojurequartz.info
> > 2. http://clojurequartz.info/articles/getting_started.html
> > 3. http://github.com/michaelklishin/quartzite
> > 4. 
> > https://github.com/michaelklishin/quartzite/blob/1.0.x-stable/ChangeLog.md
> > -- 
> > MK
> >
> > http://github.com/michaelklishin
> > http://twitter.com/michaelklishin
> >
> >
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
Softaddicts sent by ibisMail from my ipad!

-- 
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: Why does cljs.core redefine String.prototype.apply?

2012-09-18 Thread David Nolen
On Mon, Sep 17, 2012 at 11:26 AM, Matt Campbell  wrote:
> I noticed that cljs.core redefines String.prototype.apply. Being new to
> Clojure, I don't understand what this redefinition does or what it is for.
> But I do know that redefining functions in the JS standard library, or
> defining new ones on standard objects, is something that should be done with
> great care, to avoid breaking other pieces of JavaScript running in the same
> context (e.g. on the same page). (And lest you think your JavaScript is sure
> to be the only JavaScript on your page, bear in mind that some browsers make
> web pages accessible to blind users by injecting their own JS into the
> page.)
>
> I know there are always trade-offs. And perhaps this definition of
> String.prototype.apply is known not to conflict with any other JavaScript
> code. But I would appreciate an explanation of what purpose it serves.
>
> Thanks,
> Matt

It's a yucky bit of code that needs to be removed. It's there to
support using keywords as functions - in ClojureScript keywords are
just JS Strings.

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: Data Structure server (Redis in Clojure)

2012-09-18 Thread Moritz Ulrich

Hi!

I don't have the time to look at your code right now, but I have one suggestion:

Artem Yankov writes:

> 2. What would be a best way to implement sorted sets (like in Redis)? I 
> used sorted maps and sorting them by values which I highly doubt is a 
> log(n) operation..

`clojure.core/sorted-set' and `clojure.core/sorted-set-by'

http://clojuredocs.org/clojure_core/clojure.core/sorted-set

-- 
Moritz Ulrich


pgphaYjwAMe51.pgp
Description: PGP signature


Data Structure server (Redis in Clojure)

2012-09-18 Thread Artem Yankov
Hi,

So I really wanted to learn Clojure and get familiar with the functional 
programming. As a side project I decided
to write a simple data structure server similar to Redis. It uses Redis 
protocol and already supports same data structures and main commands.
So any standard redis client can be used to connect to it as well as 
standard redis-benchmark tool.

Eventually I'd want to make it fast, distributed and extensible (so you can 
easily add any data structures you want). But for
now I'm solving very basic problems while learning the language.

https://github.com/yankov/memobot

Code must be very messy and not idiomatic - I never  had experience with 
Lisps nor functional programming before. I kept cleaning it up, but figured 
it'd be better to try to get feedback first. Would be very grateful if you 
guy could point me some obvious weirdness and bad choices in code.

Also some general questions: 

1. *How to achieve good throughput?* I run the same benchmarking tool as 
for redis and for SET command I get ~200 operations per second (for Redis 
it's 30k/sec). To implement a server I used a very simple jboss netty 
example without any tweaking. What would be a bottle neck here?

2. What would be a best way to implement sorted sets (like in Redis)? I 
used sorted maps and sorting them by values which I highly doubt is a 
log(n) operation..

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: Calling Clojurescript code from Clojure

2012-09-18 Thread Frank Siebenlist
I have the same requirement to have a clojurescript-form in my 
clojure-environment that I want to evaluate in the browser…

To make the following code-snippet work, you're supposed to have a browser-repl 
session running, and start a new repl-session on that same JVM from where you 
invoke the following forms to execute either javascript-code or 
clojurescript-forms in the browser.

---
user=> (require 'cljs.repl)
nil

user=> (require 'cljs.repl.browser)
nil

user=> (cljs.repl.browser/browser-eval "alert('No Way!')")
{:status :success, :value ""}

user=> (def my-repl-env {:port 9000, :optimizations :simple, :working-dir 
".lein-cljsbuild-repl", :serve-static true, :static-dir ["." "out/"], 
:preloaded-libs []})
#'user/my-repl-env

user=> (def my-env {:context :statement :locals {}})
#'user/my-env

user=> (#'cljs.repl/eval-and-print my-repl-env my-env '(js/alert "Yes Way!"))
nil
nil

user=> 
---

The public function "cljs.repl.browser/browser-eval" seems to allow you to send 
javascript code as a string to the browser to execute over the existing 
browser-repl connection.

The private function "cljs.repl/eval-and-print" will take a clojurescript form, 
compile it to javascript and send it to the browser for execution. The 
"my-repl-env" and "my-env" values are artifacts needed that are normally only 
available within the context of the function.

My apology for this huge&ugly hack… please see it as a proof of principle.

There may be much more elegant solutions available… I've only scratch the 
surface of understanding how this clojurescript repl works in detail.

-Enjoy, FrankS 


On Sep 17, 2012, at 9:03 PM, Brent Millare  wrote:

> And yes by eval I mean compile and run on the target (browser)
> 
> -- 
> 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: ANN Quartzite 1.0 (final)

2012-09-18 Thread Luis Reyes
Hi,

I'm trying to use Quartzite so followed the tutorial but I have a problem 
at executing the -main function.
I already add the dependency of 

[clojurewerkz/quartzite "1.0.1"]


user=> (-main)
SLF4J: Failed to load class 
"org.slf4j.impl.StaticLoggerBinder".#
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details. 

Could you figure what is the problem ? 



 * Ability to define jobs, triggers and schedules using a DSL
>  * Scheduling, unscheduling, pausing and resuming jobs and triggers.
>  * Querying scheduler for information, convenient predicate functions
>  * Ability to register listeners for scheduler events
>  * Access to durable scheduler data stores (JDBC databases out of the box, 
> other stores via plugins)
>  * Solid documentation (my favorite feature)
> ,
>
> New in 1.0 final:
>
>  * Documentation updates
>  * Stateful jobs support
>  * Clojure 1.4 by default
>  * Better names for functions that remove triggers
>
> Full change log is available on GitHub [4].
>
> Quartzite targets Clojure 1.3+, tested against 3 Clojure versions x 3 JDKs 
> on travis-ci.org, and is released under the Eclipse Public License.
>
> Learn more in the Getting Started guide [2] and the rest of the docs [1].
>
> The source is available on GitHub [3]. We also use GitHub to track issues.
>
>
> 1. http://clojurequartz.info
> 2. http://clojurequartz.info/articles/getting_started.html
> 3. http://github.com/michaelklishin/quartzite
> 4. 
> https://github.com/michaelklishin/quartzite/blob/1.0.x-stable/ChangeLog.md
> -- 
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
>

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

Why does cljs.core redefine String.prototype.apply?

2012-09-18 Thread Matt Campbell
 I noticed that cljs.core redefines String.prototype.apply. Being new to 
Clojure, I don't understand what this redefinition does or what it is for. 
But I do know that redefining functions in the JS standard library, or 
defining new ones on standard objects, is something that should be done 
with great care, to avoid breaking other pieces of JavaScript running in 
the same context (e.g. on the same page). (And lest you think your 
JavaScript is sure to be the only JavaScript on your page, bear in mind 
that some browsers make web pages accessible to blind users by injecting 
their own JS into the page.) 

I know there are always trade-offs. And perhaps this definition of 
String.prototype.apply is known not to conflict with any other JavaScript 
code. But I would appreciate an explanation of what purpose it serves. 

Thanks, 
Matt 

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

Why does cljs.core redefine String.prototype.apply?

2012-09-18 Thread Matt Campbell
I noticed that cljs.core redefines String.prototype.apply. Being new to 
Clojure, I don't understand what this redefinition does or what it is 
for. But I do know that redefining functions in the JS standard library, 
or defining new ones on standard objects, is something that should be 
done with great care, to avoid breaking other pieces of JavaScript 
running in the same context (e.g. on the same page). (And lest you think 
your JavaScript is sure to be the only JavaScript on your page, bear in 
mind that some browsers make web pages accessible to blind users by 
injecting their own JS into the page.)


I know there are always trade-offs. And perhaps this definition of 
String.prototype.apply is known not to conflict with any other 
JavaScript code. But I would appreciate an explanation of what purpose 
it serves.


Thanks,
Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Some feedback on clojurescript

2012-09-18 Thread Wes Freeman
Glad I'm not the only one!

A separate mailing list for ClojureScript would be great. Also, enabling
the label [Clojure] for all subjects of emails would be great (this must be
a setting in google groups, because most of the larger groups have it
enabled), as I filter through a great deal of email I don't care about, and
I actually would like to read the latest emails from the Clojure list.

Thanks,
Wes

On Sun, Sep 16, 2012 at 8:32 PM, Irakli Gozalishvili wrote:

>  Hi Folks,
>
> I'm still new to clojurescript, but I thought I would share with you some
> of the annoyances that person
> person coming from JS (like myself) will likely run into:
>
> http://jeditoolkit.com/2012/09/16/coljurescript-feedback.html
>
>
> Regards
> --
> Irakli Gozalishvili
> Web: http://www.jeditoolkit.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

Problems trying to run the M003 branch of clojurescript one

2012-09-18 Thread Taylor Sando


I'm having trouble getting the M003 branch to work. I would like to update 
the project so that it will work with the newest dependencies, and work 
with leiningen 2. The problem is that when I do:
lein repl
(go)

The chrome browser loads properly, and the page works, but I can't connect 
with the repl. Any commands at the Clojurescript:cljs.user prompt just 
hang. In the browser, I get the following errors:

clojure.browser.net.into is undefined 
clojure.browser.repl is undefined

I get the same problem, even if just run the M003 branch without changing 
anything else.

This is the error I get when trying to run the production code:

java.lang.NullPointerException
Matcher.java:1151 java.util.regex.Matcher.getTextLength
Matcher.java:308 java.util.regex.Matcher.reset
Matcher.java:228 java.util.regex.Matcher.
Pattern.java:905 java.util.regex.Pattern.matcher
utils.clj:6 clj-stacktrace.utils/re-gsub
core.clj:14 clj-stacktrace.core/clojure-ns
core.clj:68 clj-stacktrace.core/parse-trace-elem
core.clj:2434 clojure.core/map[fn]
LazySeq.java:42 clojure.lang.LazySeq.sval
LazySeq.java:60 clojure.lang.LazySeq.seq
Cons.java:39 clojure.lang.Cons.next
RT.java:587 clojure.lang.RT.next
core.clj:64 clojure.core/next
core.clj:880 clojure.core/reduce1
core.clj:888 clojure.core/reverse
core.clj:88 clj-stacktrace.core/trim-redundant
core.clj:105 clj-stacktrace.core/parse-cause-exception
core.clj:123 clj-stacktrace.core/parse-exception
repl.clj:106 clj-stacktrace.repl/pst-on
repl.clj:123 clj-stacktrace.repl/pst-str
RestFn.java:408 clojure.lang.RestFn.invoke
stacktrace.clj:17 ring.middleware.stacktrace/wrap-stacktrace-log[fn]
stacktrace.clj:79 ring.middleware.stacktrace/wrap-stacktrace-web[fn]
Var.java:415 clojure.lang.Var.invoke
jetty.clj:18 
ring.adapter.jetty/proxy-handlerfn
ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle
HandlerWrapper.java:111 
org.eclipse.jetty.server.handler.HandlerWrapper.handle
Server.java:349 org.eclipse.jetty.server.Server.handle
AbstractHttpConnection.java:452 
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
AbstractHttpConnection.java:884 
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete
AbstractHttpConnection.java:938 
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete
HttpParser.java:634 org.eclipse.jetty.http.HttpParser.parseNext
HttpParser.java:230 org.eclipse.jetty.http.HttpParser.parseAvailable
AsyncHttpConnection.java:76 
org.eclipse.jetty.server.AsyncHttpConnection.handle
SelectChannelEndPoint.java:609 
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle
SelectChannelEndPoint.java:45 
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run
QueuedThreadPool.java:599 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob
QueuedThreadPool.java:534 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run
Thread.java:679 java.lang.Thread.run

I can run the original 1.0.0 version without a problem, but I'd really like 
to be able to use the newest versions of clojurescript and the rest of the 
libraries in the dependencies.

This gist has the settings I wanted to use in project.clj: 
https://gist.github.com/3734941

-- 
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] clj-ns-browser 1.3.0 - the "cool button-row widget" release

2012-09-18 Thread Mayank Jain
This is really nice to learn and play with clojure :)
Thanks!

On Sun, Sep 16, 2012 at 10:02 PM, Denis Labaye wrote:

>
>
> On Fri, Sep 14, 2012 at 7:53 PM, Frank Siebenlist <
> frank.siebenl...@gmail.com> wrote:
>
>> We're happy to announce the new clj-ns-browser 1.3.0 - the "cool
>> button-row widget" - release.
>>
>> The Clojure Namespace Browser is a GUI-based, Smalltalk-like development
>> tool that makes it easy to see, inspect, search, and browse the different
>> namespaces, classes/types, and vars of your live Clojure environment. It
>> allows you to see the online docs, the source code, the associated
>> clojuredocs comments/examples/see-alsos, as well as the var's meta-data and
>> values.
>>
>> Installation is achieved by adding a single line to your project.clj:
>>
>> ;; Leiningen version 1
>> :dev-dependencies [[clj-ns-browser "1.3.0"]]
>>
>> ;; Leiningen version 2
>> :profiles {:dev {:dependencies [[clj-ns-browser "1.3.0"]]}}
>>
>> After (use 'clj-ns-browser.sdoc), the browser can be invoked at the REPL
>> with for example: (sdoc map)
>> where "sdoc" is a macro equivalent to and compatible with the venerable
>> "clojure.repl/doc" one, but give you just a "little" more info. After the
>> browser's GUI is invoked, you can point&click to your heart's content.
>>
>> A few of the highlights of the new release are:
>>
>> • upgraded dependencies to latest&greatest (clojure 1.4, seesaw 1.4.2,
>> etc.)
>>
>> • Andy concocted a cool, new, button-row widget that allows for a more
>> flexible display of var/class/namespace information.
>>
>> • syntax highlighting of source code thru use of rsyntaxtextarea
>>
>> • improved invocation of external web-browser
>>
>> • many invisible improvements...
>>
>> There are too many other great features to mention here - please take a
>> look at:
>> "https://github.com/franks42/clj-ns-browser";
>>
>> Enjoy,
>> Frank Siebenlist
>> Andy Fingerhut
>>
>
> Congrats !
>
> That's really great, especially for newcomers, the combo: REPL (to modify
> the environment) + ns-browser (to view/explore the environment) makes
> working with Clojure really comfortable.
>
>
>
>>
>> --
>> 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