Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-10 Thread Peter Taoussanis
This is great stuff: thank you! I can totally see this being the kind
of thing like destructuring, where once you've used it you won't want
to go back :)

--
Peter

-- 
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: standalone indentation tool

2011-08-10 Thread Tom Faulhaber
 I've tried pprint and found it lacking as it inserts newlines in
 awkward places apart from the medatada/comments issue mentioned.

Are you using pprint with code-dispatch? That tends to work a lot
better, though it will put newlines where it deems fit. This is either
a good thing or a bad thing depending your context.

It also handles all the read macros that it can:

(with-pprint-dispatch code-dispatch (pprint '#(+ % 1) ))
= #(+ % 1)

But some get eaten by the reader and are therefore impossible for
pprint to deal with (since it's working on clojure data structures and
not the raw text). These are: `, ~@, ;, ^, and the comma character.

 I think your best bet is to use Emacs from the command-line. Even if

I agree that when you're just trying to reindent human written source
code, emacs is going to produce the best results. pprint is probably
better for machine generated code, as long as you're not depending on
the macros above. (It would also be possible to annotate your code in
clojure with that and have some custom dispatch that generated those
characters as appropriate.)

HTH,

Tom

-- 
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: Optimizing JDBC code

2011-08-10 Thread Shoeb Bhinderwala
Many thanks for adding this feature. Without it the Clojure code would
have been left in the dust.

On Aug 9, 11:46 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Tue, Aug 9, 2011 at 9:39 AM, Shoeb Bhinderwala 

 shoeb.bhinderw...@gmail.com wrote:
  With these options added the Clojure code runs just about as fast as
  Java. I set the fetch size to 1000 for both of them.

  Average run times to load 69,000 records:

   Java = 2.67 seconds
   Clojure = 2.72 seconds

 Nice! Makes me even more glad I added that stuff to clojure.java.jdbc (and
 Shantanu was the one pressing hardest for that sort of capability :)

 Right now you can only control the PreparedStatement / ResultSet in
 with-query-results. I haven't figured out a clean way to add such control to
 other functions, but I suspect the other functions are not such a critical
 path (unless you're doing mass updates or inserts I suppose).
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View --http://corfield.org/
 World Singles, LLC. --http://worldsingles.com/
 Railo Technologies, Inc. --http://www.getrailo.com/

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

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


Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-10 Thread James Sofra
Hi David,

Looks really neat!

Just to clarify, you can extend the matching to new types but the match is 
'closed' in the sense that unlike mutimethods you can't add additional 
cases? Is that correct?

Hope that makes sense,
James Sofra

-- 
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: Optimized Pattern Matching Library for Clojure

2011-08-10 Thread Ambrose Bonnaire-Sergeant
Hi James,

On Wed, Aug 10, 2011 at 5:43 PM, James Sofra james.so...@gmail.com wrote:

 Just to clarify, you can extend the matching to new types but the match is
 'closed' in the sense that unlike mutimethods you can't add additional
 cases? Is that correct?


For the 0.1 release, that is correct.

In future releases, we will explore 'open' matching, a la multimethods.

Thanks,
Ambrose

-- 
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: Creating a map algorithmically

2011-08-10 Thread Kevin Sookocheff
Thanks Sumil.

Does anyone know what algorithm they are implementing? It looks like a wheel 
factorization but I can't tell from lack ofcomments.

-- 
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: How to read project.clj file.

2011-08-10 Thread mmwaikar
Thanks Shantanu and Daniel.

I am trying to merge some functionality from two different projects, so the 
credentials could be stored in properties file or the project.clj file. And 
mine is not a leiningen plugin so I parsed the project.clj file.

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

A place to talk Marginalia

2011-08-10 Thread Fogus
If anyone is interested, I have a group for talking about Marginalia
and the art of documentation and code reading.  Various other topics
will be fair-game (within reason).

Follow this link if you dare: http://groups.google.com/group/marginalia-clj

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


at-at

2011-08-10 Thread Sam Aaron
Hi,

I just wanted to announce the arrival of the newly-born at-at library - freshly 
extracted from Overtone:

https://github.com/overtone/at-at

at-at is an ahead-of-time function scheduler which essentially provides a 
friendly wrapper around Java's ScheduledThreadPoolExecutor.

Enjoy!

Sam

---
http://sam.aaron.name

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

2011-08-10 Thread David Nolen
On Wed, Aug 10, 2011 at 1:37 PM, Sam Aaron samaa...@gmail.com wrote:

 Hi,

 I just wanted to announce the arrival of the newly-born at-at library -
 freshly extracted from Overtone:

 https://github.com/overtone/at-at

 at-at is an ahead-of-time function scheduler which essentially provides a
 friendly wrapper around Java's ScheduledThreadPoolExecutor.

 Enjoy!

 Sam


Nice!

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: ClojureScript Compile errors

2011-08-10 Thread Rich Hickey
:use … :only doesn't have the problems of full :use.

Enhancement ticket and patch for :use … :only welcome. Note it must support 
:use … :only only, i.e. :only is required.

Rich

On Aug 9, 2011, at 10:01 AM, David Nolen wrote:

 On Sat, Aug 6, 2011 at 5:30 PM, Rich Hickey richhic...@gmail.com wrote:
 In Clojure, namespaces are different from the host's packages, in 
 ClojureScript they are the same (insofar as they match the Google Closure 
 approach).
 
 Makes sense.
  
 Why all the attention to :use - I thought everyone agreed using it is a bad 
 idea?
 
 I like pairing :use with :only especially between files that belong to the 
 same library.
  
 In any case, ClojureScript is a subset and right now that subset doesn't 
 include :use. People who want it will have to explain why they think it's 
 important. Its cost is that namespaces have to be enumerable, which poses 
 challenges for code (re)loading and modularity for Clojure. The only benefit 
 I see is that you can avoid a (minimum 2 character) prefix.
 
 Rich
 
 Yeah I can see the cost/benefit here. I haven't had time to dig into 
 ClojureScript for anything substantial so I don't know if this feels 
 problematic in practice. I suspect in the end it won't matter much and it 
 does encourage good style.
 
 David
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

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


Re: Creating a map algorithmically

2011-08-10 Thread Justin Kramer
See also David Nolan's post:

http://dosync.posterous.com/lispers-know-the-value-of-everything-and-the

Justin

On Tuesday, August 9, 2011 6:02:00 PM UTC-4, pmbauer wrote:

 For the sieve, if performance matters, clojure's native data structures may 
 not be the best choice.
 A mutable array of boolean primitives could be more apropos.

 (defn prime-sieve [^long n]
   (let [^booleans sieve (make-array Boolean/TYPE (inc n))]
 ...)

 ... using aset/aget to write/read sieve.

 On Tuesday, August 9, 2011 1:18:46 PM UTC-7, Chouser wrote:

 On Tue, Aug 9, 2011 at 12:50 PM, Kevin Sookocheff
 kevin...@gmail.com wrote:
  Hi,
 
  I have a question regarding the map data structure. I'm trying to 
 program a
  Sieve of Eratosthenes using the algorithm at Wikipedia:
 
  Input: an integer n  1
 
  Let A be an array of bool values, indexed by integers 2 to n,
  initially all set to true.
 
  for i = 2, 3, 4, ..., while i^2 ≤ n:
if A[i] is true:
  for j = i^2, i^2 + i, i^2 + 2i, ..., while j ≤ n:
A[j] = false
 
  Now all i such that A[i] is true are prime.
 
  I'm having a problem creating the data structure A.
 
  What I want to do is create a map of integers from 2 to n all 
 initialized to
  true that I can then prune using the algorithm.
 
  Any ideas?

 Since the keys are consecutive integers, you might consider a vector
 of booleans:

 (def A (vec (repeat (inc n) true)))

 You can then use assoc to set any particular index to false:

 (assoc A 5 false)

 Differences using a vector instead of a hash-map: will stay in numeric
 order, doesn't allow arbitrary dissoc, nth and assoc may be faster,
 use less memory, (vector-of :bool) will definitely use less memory,
 and probably others.  Depending on your goals, a vector may or may not
 be preferable to a hash-map.

 --Chouser



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

rebind var for all threads

2011-08-10 Thread Mark Rathwell
There is a function in a library I am using that I want to have rebound to a
function of mine for all threads, and can't seem to figure this out, or if
it is even possible.  binding, push-thread-bindings, in-ns with def, etc.
are not working, seemingly because they are only rebinding for the current
thread, but I don't know.

This is what I have tried, without success:

(clojure.lang.RT/var other-ns other-fn my-ns/my-fn)
(some-other-ns/fn-using-other-fn params)
;; still uses original binding

(push-thread-bindings {(var other-ns/other-fn) (var my-ns/my-fn)})
(some-other-ns/fn-using-other-fn params)
;; still uses original binding

(in-ns 'other-ns)
(def other-fn my-ns/my-fn)
(in-ns 'previous-ns)
(some-other-ns/fn-using-other-fn params)
;; still uses original binding

(binding [other-ns/other-fn my-ns/my-fn]
  (some-other-ns/fn-using-other-fn params))
;; still uses original binding

Is what I am trying to do possible?

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: rebind var for all threads

2011-08-10 Thread Ken Wesson
On Wed, Aug 10, 2011 at 3:52 PM, Mark Rathwell mark.rathw...@gmail.com wrote:
 Is what I am trying to do possible?

alter-var-root

Handle with care.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: rebind var for all threads

2011-08-10 Thread Timothy Baldridge
 Is what I am trying to do possible?

Even if you can, I don't think you want to. This sort of thing would
basically remove the immutable nature of Clojure. Instead I would
recommend using a atom...

Timothy

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


Small bug in clojure.core/bases?

2011-08-10 Thread Alf Kristian Støyle
I think I found a small bug in clojure.core/bases. Extending the
existing unit test reveals it:

(deftest test-bases
  (are [x y] (= x y)
  (bases java.lang.Math)
(list java.lang.Object)
  (bases java.lang.Integer)
(list java.lang.Number java.lang.Comparable) )
(is (seq? (bases java.util.List

Test output is:

FAIL in (test-bases) (java_interop.clj:143)
expected: (seq? (bases java.util.List))
  actual: (not (seq? #Class[] [Ljava.lang.Class;@363256a5))

When calling bases on an inteface it returns an array. Should this not
be a seq?

An easy fix though, 'seq' the else part:

(defn bases
  Returns the immediate superclass and direct interfaces of c, if any
  {:added 1.0
   :static true}
  [^Class c]
  (when c
(let [i (.getInterfaces c)
  s (.getSuperclass c)]
  (not-empty
   (if s (cons s i) (seq i))

Should I file a bug, submit a pull request, or is the behavior intended?

Cheers,
Alf

-- 
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: rebind var for all threads

2011-08-10 Thread Mark Rathwell
 alter-var-root

It is still somehow using the original binding.  I am trying change the
binding from aot compiled code, would that change anything?

 Even if you can, I don't think you want to.

I agree, I don't want to, however, I am trying to get multiple third party
libraries to play together, so unfortunately my choices seem to be:

  1. get them all to accept corresponding changes just for me
  2. modify and maintain my own copies of the libs
  3. try a temporary hack until I can figure out something better



On Wed, Aug 10, 2011 at 3:58 PM, Timothy Baldridge tbaldri...@gmail.comwrote:

  Is what I am trying to do possible?

 Even if you can, I don't think you want to. This sort of thing would
 basically remove the immutable nature of Clojure. Instead I would
 recommend using a atom...

 Timothy

 --
 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: rebind var for all threads

2011-08-10 Thread Ken Wesson
On Wed, Aug 10, 2011 at 4:54 PM, Mark Rathwell mark.rathw...@gmail.com wrote:
 alter-var-root
 It is still somehow using the original binding.  I am trying change the
 binding from aot compiled code, would that change anything?

Yes. The compiler probably optimized away the var lookup to an
embedded constant. You'll need to use an atom, as Baldridge suggested.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: rebind var for all threads

2011-08-10 Thread Mark Rathwell
Yes. The compiler probably optimized away the var lookup to an
embedded constant. You'll need to use an atom, as Baldridge suggested.

My code calls a function in 3rd party library A, which in turn calls a
function in 3rd party library B.  The lib B function uses blacklisted Java
classes, causing my app to crash when lib A calls it.  I would like to
replace that function with a safe version, so that lib A is forced to use
the safe version instead, all without modifying any 3rd party code.  Is this
possible?


On Wed, Aug 10, 2011 at 5:08 PM, Ken Wesson kwess...@gmail.com wrote:

 On Wed, Aug 10, 2011 at 4:54 PM, Mark Rathwell mark.rathw...@gmail.com
 wrote:
  alter-var-root
  It is still somehow using the original binding.  I am trying change the
  binding from aot compiled code, would that change anything?

 Yes. The compiler probably optimized away the var lookup to an
 embedded constant. You'll need to use an atom, as Baldridge suggested.

 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

 --
 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: Example of a real-world ClojureScript web application

2011-08-10 Thread Scott Jaderholm
I haven't read the code yet but I have a few questions:
Do you miss backbone.js? Are you going to use it with cljs?
Have you shared any code between the frontend and backend? As in run the
same functions on both sides. If so, are you duplicating the code in both
.clj and .cljs or doing something else?
How has the debugging/error notification experience been?

Scott


On Tue, Aug 9, 2011 at 8:53 PM, Filip de Waard f...@vix.io wrote:

 I'm working on Vix, which is a document repository and content
 management system written in Clojure with a CouchDB backend. After the
 announcement on July 23 I immediately got excited about ClojureScript
 and the Google Closure toolkit, so I dropped the existing Backbone.js
 and jQuery code and rewrote all client-side functionality in
 ClojureScript. Despite (or maybe because of) the fact that the
 functionality is still very minimal I wanted to share this code as an
 example of ClojureScript in the wild.

 Be warned that:
 - this is not perfect, clean example code written by a ClojureScript
 expert (in several places I've used hacks and shortcuts to make things
 work), but hopefully at least a starting point for others working on
 similar functionality,
 - you should read the installation instructions carefully (e.g. there
 is still a hardcoded path in src/vix/db.clj at the time of this
 writing, which I hope to correct in the near future),
 - I'm actively developing this application, so things will change and
 new features will be added frequently,
 - the application isn't done yet, although it has a working prototype.

 I'm concentrating on adding features that will allow users to manage
 feeds (currently blog is the default feed), add media files like
 images and to manage users. I had trouble getting unit testing to work
 properly for the ClojureScript part of the application, so I
 grudgingly wrote it using a non-TDD approach. Retrofitting unit tests
 into the ClojureScript part is a priority. The user interface is also
 lacking some bells and whistles that I had previously implemented in
 jQuery, but still have to rewrite using Google Closure. Eventually, I
 want to turn Vix into a commercial SaaS offering, with a focus on
 performance (e.g. Amazon CloudFront support), scalability and webshop
 functionality. The application itself, however, will be perpetually
 available as open source software, because I'm committed to sharing my
 code.

 Here is the GitHub page for Vix: https://github.com/fmw/vix

 This is not a launch post for Vix, because we're not ready for
 supporting typical end-users yet, but I hope that the code will be
 useful to other developers in the meantime. I'm also happy to receive
 any feedback (positive as well as negative) and answer questions. You
 can reply to this post, but if you prefer to contact me privately you
 can also find my contact information on Github (https://github.com/
 fmw).

 Sincerely,

 F.M. (Filip) de Waard / fmw

 P.S. I'd like to thank the ClojureScript developers. There are
 surprisingly few glitches considering that the project has only just
 been released. The language is incredibly well designed and a pleasure
 to use. Thanks for making client-side development more enjoyable!

 --
 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: rebind var for all threads

2011-08-10 Thread Timothy Baldridge
 My code calls a function in 3rd party library A, which in turn calls a
 function in 3rd party library B.  The lib B function uses blacklisted Java
 classes, causing my app to crash when lib A calls it.  I would like to
 replace that function with a safe version, so that lib A is forced to use
 the safe version instead, all without modifying any 3rd party code.  Is this
 possible?


I don't think it is...most likely all your libraries are aot compiled,
which means you're basically asking to change the bytecode within the
compiled .class files. I think your only choice is to patch the
libraries. If it's really this serious of an issue, then perhaps the
makers of the libraries will at least accept a patch from you that
adds a hook that will swap out parts of the libraries.


Timothy

-- 
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: rebind var for all threads

2011-08-10 Thread Mark Rathwell
Thank you both for the help.

If it's really this serious of an issue, then perhaps the
makers of the libraries will at least accept a patch from you that
adds a hook that will swap out parts of the libraries.

Not a serious issue by any means, but I will see what the sentiment is with
the library makers.  The easiest solution is for me to change environments,
but we'll see.  Thanks again.

 - Mark

On Wed, Aug 10, 2011 at 5:27 PM, Timothy Baldridge tbaldri...@gmail.comwrote:

  My code calls a function in 3rd party library A, which in turn calls a
  function in 3rd party library B.  The lib B function uses blacklisted
 Java
  classes, causing my app to crash when lib A calls it.  I would like to
  replace that function with a safe version, so that lib A is forced to use
  the safe version instead, all without modifying any 3rd party code.  Is
 this
  possible?
 

 I don't think it is...most likely all your libraries are aot compiled,
 which means you're basically asking to change the bytecode within the
 compiled .class files. I think your only choice is to patch the
 libraries. If it's really this serious of an issue, then perhaps the
 makers of the libraries will at least accept a patch from you that
 adds a hook that will swap out parts of the libraries.


 Timothy

 --
 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: rebind var for all threads

2011-08-10 Thread Ken Wesson
On Wed, Aug 10, 2011 at 5:20 PM, Mark Rathwell mark.rathw...@gmail.com wrote:
 The lib B function uses blacklisted Java classes, ...

Blacklisted???

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: rebind var for all threads

2011-08-10 Thread Mark Rathwell
Or, more accurately, not whitelisted, on App Engine.

On Wed, Aug 10, 2011 at 6:34 PM, Ken Wesson kwess...@gmail.com wrote:

 On Wed, Aug 10, 2011 at 5:20 PM, Mark Rathwell mark.rathw...@gmail.com
 wrote:
  The lib B function uses blacklisted Java classes, ...

 Blacklisted???

 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

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

Passing ClojureScript objects to JavaScript functions

2011-08-10 Thread Kevin Lynagh
What is the best way to pass Clojure vectors and maps to JavaScript
functions?

Currently when I need to call a JavaScript function that takes an
array I do something like

(js/my_js_fn (.array (vector 1 2 3)))

and I pass Clojure maps like

(js/my_js_fn (.strobj (hash-map a 1 b 2)))

This feels a bit gross, since I'm digging into the implementation
details.

Is there a recommended way to do this yet?
Some kind of reader macro (say @@) would be okay, turning

(js/my_js_fn @@(vector 1 2 3))

into

(js/my_js_fn (.array (vector 1 2 3)))

at read time.

Ideally though, the compiler would automatically convert ClojureScript
objects into JavaScript native objects when they're passed to a
function in the js/ namespace.

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


Adding ClojureScript support to a noir-based project

2011-08-10 Thread Daniel Jomphe
For what it may be worth to you:

In trying out the Noir framework (which neatly assembles 
ring+compojure+hiccup+other stuff) for its new bindings to ClojureScript 
(using noir-cljs and pivot), I thought some people might like to see what 
kind of diff is needed to add basic ClojureScript support to a noir project.

Here goes the diff on GitHub: http://goo.gl/oJjkI

Note that for now, I haven't yet written a single line of ClojureScript; but 
if you launch the server in simple/advanced mode, you'll already be able to 
observe that the generated .js file is already different. In advanced 
compilation, it's empty. In simple compilation, it contains a few KBs of 
Javascript code.

Since my project on GitHub is very much at its infancy for now, you might 
like to browse its few lines of code to see how Noir expects you to code a 
(very) basic website. For more information on Noir, visit its website; it's 
been updated by the author with nice examples.

Mentioned:

   - Noir: http://www.webnoir.org/
   - Noir-cljs: https://github.com/ibdknox/noir-cljs
   - Pinot (not demonstrated in my diff): https://github.com/ibdknox/pinot

-- 
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: Example of a real-world ClojureScript web application

2011-08-10 Thread Timothy Washington
Good on you. I've been looking to find a reliable way to have Javascript
unit testing run in a v8 (or any JS) shell. I've tried Jasmine and am now
trying Google Closure's unit testing framework, but have so far come up
short.


Have you come up with anything that works? For now, i'm just having the
tests run in the browser. But trying with Nodejs is the next step.


Keep it up

Tim



On Tue, Aug 9, 2011 at 8:53 PM, Filip de Waard f...@vix.io wrote:

 I'm working on Vix, which is a document repository and content
 management system written in Clojure with a CouchDB backend. After the
 announcement on July 23 I immediately got excited about ClojureScript
 and the Google Closure toolkit, so I dropped the existing Backbone.js
 and jQuery code and rewrote all client-side functionality in
 ClojureScript. Despite (or maybe because of) the fact that the
 functionality is still very minimal I wanted to share this code as an
 example of ClojureScript in the wild.

 Be warned that:
 - this is not perfect, clean example code written by a ClojureScript
 expert (in several places I've used hacks and shortcuts to make things
 work), but hopefully at least a starting point for others working on
 similar functionality,
 - you should read the installation instructions carefully (e.g. there
 is still a hardcoded path in src/vix/db.clj at the time of this
 writing, which I hope to correct in the near future),
 - I'm actively developing this application, so things will change and
 new features will be added frequently,
 - the application isn't done yet, although it has a working prototype.

 I'm concentrating on adding features that will allow users to manage
 feeds (currently blog is the default feed), add media files like
 images and to manage users. I had trouble getting unit testing to work
 properly for the ClojureScript part of the application, so I
 grudgingly wrote it using a non-TDD approach. Retrofitting unit tests
 into the ClojureScript part is a priority. The user interface is also
 lacking some bells and whistles that I had previously implemented in
 jQuery, but still have to rewrite using Google Closure. Eventually, I
 want to turn Vix into a commercial SaaS offering, with a focus on
 performance (e.g. Amazon CloudFront support), scalability and webshop
 functionality. The application itself, however, will be perpetually
 available as open source software, because I'm committed to sharing my
 code.

 Here is the GitHub page for Vix: https://github.com/fmw/vix

 This is not a launch post for Vix, because we're not ready for
 supporting typical end-users yet, but I hope that the code will be
 useful to other developers in the meantime. I'm also happy to receive
 any feedback (positive as well as negative) and answer questions. You
 can reply to this post, but if you prefer to contact me privately you
 can also find my contact information on Github (https://github.com/
 fmw).

 Sincerely,

 F.M. (Filip) de Waard / fmw

 P.S. I'd like to thank the ClojureScript developers. There are
 surprisingly few glitches considering that the project has only just
 been released. The language is incredibly well designed and a pleasure
 to use. Thanks for making client-side development more enjoyable!

 --
 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: tasting pinot noir

2011-08-10 Thread Mark Rathwell
 i would love to read other community-member's opinion
 on pinot noir ...

I've gotten into these over the last week, and I've got to say, Chris is
doing a very nice job on these frameworks.  They are really turning into a
nicely integrated offering to develop Clojure and ClojureScript web apps.
 Definitely worth checking out.

In case you are not familiar:

  noir [1] = a light and simple wrapper over compojure/ring and hiccup

  noir-cljs [2] = middleware to add ClojureScript compilation and
integration to your development

  pinot [3] = wrapper over some GClosure libraries, and client side hiccup
templating, offering an alternative to closure templates for client and
server side templates

[1] http://www.webnoir.org/
[2] https://github.com/ibdknox/noir-cljs
[3] https://github.com/ibdknox/pinot

On Mon, Aug 8, 2011 at 6:45 AM, faenvie fanny.aen...@gmx.de wrote:

 recently i took a closer look at noir (http://webnoir.org)
 and found it a quite promising and in the words best sense
 minimalistic approach of a clojure-based full-stack framework
 for building webapps.

 noir is in an early stage and lacks some of the features that
 established frameworks like rails, django, grails have.

 IMO one thing that could make noir special and outstand from the
 other frameworks - despite from being clojure -  is integration with
 client-side clojurescript(ing).

 2 very new projects that target this subject are: pinot und noir-
 cljs.
 i did not have time, to check them out in detail, but will do so
 during
 the week and i would love to read other community-member's opinion
 on pinot noir ...

 have a successful 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

-- 
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: tasting pinot noir

2011-08-10 Thread Timothy Baldridge
 I've gotten into these over the last week, and I've got to say, Chris is
 doing a very nice job on these frameworks.  They are really turning into a
 nicely integrated offering to develop Clojure and ClojureScript web apps.

So...I've been wanting to get into using Cljs recently for a project
I'm working on (porting a small Silverlight app to JS/HTML), and I
wasn't sure how I wanted to setup my workflow. This is exactly what I
was looking for. Being able to abstract away my async calls, routes,
etc, is just awesome! Now all I need is to setup Clutch to run Clojure
for my CouchDB views, and I'll have a end-to-end clojure web stack.

Timothy

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