Re: Example of a real-world ClojureScript web application

2011-08-11 Thread Filip de Waard
On Wed, Aug 10, 2011 at 11:22 PM, Scott Jaderholm jaderh...@gmail.comwrote:

 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?


I'm using 100% ClojureScript, with Google Closure as the only external
dependency. I don't miss Backbone.js, because it's design makes less sense
with ClojureScript than it does with JavaScript (i.e. it is based on the
JavaScript OOP paradigm). I used what I learned from Backbone.js  while
writing my ClojureScript code. I copied the idea of a routes function that
generates views based on the URI. I use this routing method to generate
views without reloading the page, using an event listener and the
goog.history.Html5History module. One of my favorite aspects of Backbone.js
is Underscore.js, which brings Lisp functions like filter, map and reduce to
JavaScript, but this is clearly redundant in ClojureScript. Backbone.js is
not something I would use with ClojureScript, but it is definitely designed
by smart people and it is a useful source of inspiration when building
client-side applications.


 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


Vix has three quite separate components: the visitor-facing presentation
layer (flat HTML pages that are used as Enlive templates and CSS), the
Clojure backend (basically a document repository with a JSON API) and the
ClojureScript client-side code. The client-side code, including it's
templates, is fully written using the Google Closure tools and
ClojureScript, so there is almost no overlap. Off the top of my head I can
think of a single utility function that I copied between the ClojureScript
and Clojure parts. As far as I'm aware it is not possible to share code by
other means than copying yet, because there are some practical barriers for
interoperability.

How has the debugging/error notification experience been?


The stack traces aren't always very informative, so some things took a while
to figure out. This was usually my own fault, because I skimmed over
something important in the docs, for example, but it wouldn't hurt if it was
easier to figure out what was going wrong. I suggest using the generated
JavaScript as the starting point for debugging. My process is pretty much to
check if the  JavaScript output looks correct and use the debuggers in
Firefox and Gnome if that doesn't help. I've also used the occasional
(js/console.log) call and even edited the generated JavaScript on occasion
to figure out the root of a particularly nasty problem.

- fmw

-- 
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-11 Thread Filip de Waard
On Thu, Aug 11, 2011 at 4:03 AM, Timothy Washington twash...@gmail.comwrote:

 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.


 I don't have it at hand, right now, because I'm not at home, but I think
the Google Closure book suggests using Selenium to automatically run the
tests. Alternatively, using script/repljs might work. Do you have the tests
running a browser window already? If so, I'd love to have a look at how you
did that, because I haven't gotten that far yet myself. I'm going to give
this another shot soon, because I've learned quite a lot about ClojureScript
since I last tried to get testing to work.

-fmw

 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


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

Silly Chat: Clojure, ClojureScript and WebSockets

2011-08-11 Thread Hubert Iwaniuk
Good news everyone!

Here is a sample Clojure ClojureScript application that uses WebSocket for 
communication.
http://lab01.kungfoo.pl:8108/

Source code: https://github.com/neotyk/ws-cljs/

Nothing really fancy, just a POC kind of thing.


Cheers,
Hubert.

P.S. We are hiring in Amsterdam.

-- 
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: Silly Chat: Clojure, ClojureScript and WebSockets

2011-08-11 Thread Paulo Pinto
nice

On Aug 11, 9:29 am, Hubert Iwaniuk neo...@kungfoo.pl wrote:
 Good news everyone!

 Here is a sample Clojure ClojureScript application that uses WebSocket for 
 communication.http://lab01.kungfoo.pl:8108/

 Source code:https://github.com/neotyk/ws-cljs/

 Nothing really fancy, just a POC kind of thing.

 Cheers,
 Hubert.

 P.S. We are hiring in Amsterdam.

-- 
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] Lacij v.0.4.0

2011-08-11 Thread Pierre Allix
Hello,

I'm pleased to announce the release of the version 0.4.0 of the Lacij
graph visualization library.

The release includes a new automatic layout called hierarchical
layout. It is similar to a tree layout or family tree but works on any
type of graph (tree or not). An example of this layout can be seen
here http://minus.com/ll9M1g it is a PNG exported from the generated
SVG. The release also extends the API and fixes a couple of bugs.

The library is available on GitHub:
https://github.com/pallix/lacij

and Clojars:
http://clojars.org/lacij


Please get in touch if you want to help the Lacij project and
implement additional layouts algorithms.

From the README:
Lacij is a graph visualization library written in Clojure. It allows
the display and the dynamic modification of graphs as SVG documents
that can be viewed with a Web browser or with a Swing component. Undo/
redo is supported for the dynamic modification. Automatic layout is
provided for the visualization.

-- 
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-11 Thread Kevin Sookocheff
Thanks Justin, this is a terrific implementation.

-- 
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-11 Thread Armando Blancas
 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?

That should be possible with your simple attempt using (binding); I'm
surprised it hasn't worked. Can you post which libs you're using and
which function you want to override?

-- 
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: Elegant tools deserve elegant solutions. -- L. E. Gant

2011-08-11 Thread Petr Gladkikh
On Mon, Aug 8, 2011 at 1:46 PM, Tuba Lambanog tuba.lamba...@gmail.com wrote:
 Hello,

 I’m doing a word stemmer for a non-English language. A stemmer parses
 a word into its word parts: prefixes, roots, suffixes. The input word
 is at least a root word (English example would be ‘cloud’), but can be
 any combination of  prefix(es) and a root (e.g., 'pre-nuptial'), or a
 root and suffix(es) (‘cloudy’), or all three ('unidirection'). A
 sequence of more than one prefix in a word is considered one
 occurrence of a prefix, and similarly for complex prefixes, thus,
 ‘directional’ is considered to have the ‘single’ suffix ‘ional’. The
 prefixes, roots, and suffixes are in their own set data structure.

 The approach I am pursuing is to create a set of potential suffixes
 that the input word contains. Asssume, for simplicity, that the suffix
 set consists of #{-or, -er, -al, -ion, -ional, able}. The input
 ‘directional’ would have the candidate suffix set #{-al –ional}. Now,
 drop the longest suffix (‘ional’) from the input then check the
 remaining string (‘direct’) if it is a root; if it is, done. If not,
 try the next suffix (‘-al’) in the potential suffix set.  Prefixes
 will be similarly processed. Input words with both prefixes and
 affixes will be fun to do ;)

 I’m having a hard time thinking through the process of generating the
 candidate suffix set using set forms, and I’m beginning to think I
 have selected an arduous path (for me).

 Thoughts?


Somehow offtopic maybe, but have you looked at Snowball
http://snowball.tartarus.org/ ?
Algorithm is different but language that is used to describe stemmers
there is almost lisp and may be useful at least as reference.

-- 
Petr Gladkikh

-- 
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: Passing ClojureScript objects to JavaScript functions

2011-08-11 Thread Brenton
There is an issue for this:

http://dev.clojure.org/jira/browse/CLJS-37

and work is being done to come up with a good solution. The comment in
the issue is outdated. There was some discussion last week about how
best to do this. I can't remember the details but I know that doing
anything automatically is out. I think it will either be a macro or a
reader-macro and will only create js objects out of literals or
expressions which can be evaluated to a literal.

Brenton

On Aug 10, 9:04 pm, Kevin Lynagh klyn...@gmail.com wrote:
 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


Re: rebind var for all threads

2011-08-11 Thread Mark Rathwell
(This is all moot at this point, since the author or Noir has made changes
that allow it to be compatible with App Engine.)

Background:

This was with noir version 1.1.0, and appengine-magic version 0.4.3.
 appengine-magic needs a ring handler, which noir provided with
noir.server/gen-handler.   However, that handler had a bunch of default
middlewares added by compojure.handler/site.  One of those middlewares was
the ring multipart-params middleware, added by
ring.middleware.multipart-params/wrap-multipart-params.  This middleware
uses java.rmi.server.UID, which is not an allowed class on app engine.  For
that reason, appengine-magic already has a replacement in
appengine-magic-multipart-params/wrap-multipart-params.  What I was trying
to do was re-bind the var that was bound to the ring middleware, instead
binding it to the appengine-magic replacement, for all threads executing the
servlet.

Since this runs on app engine, who knows which thread initializes the
servlet, who know which threads are executing the code on each request, etc.
 A couple methods worked in the repl, and in local testing, but not in the
live app engine environment.  I believe this may be one of those, but I
tried so many things it is hard to remember:

Code:


(ns test-site.core
  (:require [appengine-magic.core :as gae]
[noir.server :as server]))

(defn handler []
  (binding [ring.middleware.multipart-params/wrap-multipart-params
appengine-magic.multipart-params/wrap-multipart-params]
(server/gen-handler)))

(gae/def-appengine-app test-site-gae (handler))


Relevant code files, if you want to look, but this is all moot at this
point:

ring.middleware.multipart-params  =
https://raw.github.com/mmcgrana/ring/8dc40e8f38c59c9a1275991d7b7522b620b3a180/ring-core/src/ring/middleware/multipart_params.clj
compojure.handler  =
https://raw.github.com/weavejester/compojure/master/src/compojure/handler.clj
noir.server  =
https://raw.github.com/ibdknox/noir/master/src/noir/server.clj
appengine-magic.multipart-params  =
https://raw.github.com/gcv/appengine-magic/master/src/appengine_magic/multipart_params.clj



On Thu, Aug 11, 2011 at 10:43 AM, Armando Blancas armando_blan...@yahoo.com
 wrote:

  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?

 That should be possible with your simple attempt using (binding); I'm
 surprised it hasn't worked. Can you post which libs you're using and
 which function you want to override?

 --
 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: Elegant tools deserve elegant solutions. -- L. E. Gant

2011-08-11 Thread Tuba Lambanog
Hi, Petr,
Thank you for the pointer to the site. Indeed a treasure trove of ideas on
stemmer algorithms.
Tuba

On Thu, Aug 11, 2011 at 8:45 AM, Petr Gladkikh petrg...@gmail.com wrote:

 On Mon, Aug 8, 2011 at 1:46 PM, Tuba Lambanog tuba.lamba...@gmail.com
 wrote:
  Hello,
 
  I’m doing a word stemmer for a non-English language. A stemmer parses
  a word into its word parts: prefixes, roots, suffixes. The input word
  is at least a root word (English example would be ‘cloud’), but can be
  any combination of  prefix(es) and a root (e.g., 'pre-nuptial'), or a
  root and suffix(es) (‘cloudy’), or all three ('unidirection'). A
  sequence of more than one prefix in a word is considered one
  occurrence of a prefix, and similarly for complex prefixes, thus,
  ‘directional’ is considered to have the ‘single’ suffix ‘ional’. The
  prefixes, roots, and suffixes are in their own set data structure.
 
  The approach I am pursuing is to create a set of potential suffixes
  that the input word contains. Asssume, for simplicity, that the suffix
  set consists of #{-or, -er, -al, -ion, -ional, able}. The input
  ‘directional’ would have the candidate suffix set #{-al –ional}. Now,
  drop the longest suffix (‘ional’) from the input then check the
  remaining string (‘direct’) if it is a root; if it is, done. If not,
  try the next suffix (‘-al’) in the potential suffix set.  Prefixes
  will be similarly processed. Input words with both prefixes and
  affixes will be fun to do ;)
 
  I’m having a hard time thinking through the process of generating the
  candidate suffix set using set forms, and I’m beginning to think I
  have selected an arduous path (for me).
 
  Thoughts?
 

 Somehow offtopic maybe, but have you looked at Snowball
 http://snowball.tartarus.org/ ?
 Algorithm is different but language that is used to describe stemmers
 there is almost lisp and may be useful at least as reference.

 --
 Petr Gladkikh

 --
 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-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 2:05 PM, Mark Rathwell mark.rathw...@gmail.com wrote:
 (This is all moot at this point, since the author or Noir has made changes
 that allow it to be compatible with App Engine.)

App Engine.

 Background:
 This was with noir version 1.1.0, and appengine-magic version 0.4.3.
  appengine-magic needs a ring handler, which noir provided with
 noir.server/gen-handler.   However, that handler had a bunch of default
 middlewares added by compojure.handler/site. ...

Compojure.

App Engine ... Compojure.

Wait, what?

You are trying to run a WEB SERVER on a PHONE?

This really must be the 21st century ... :)

-- 
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-11 Thread Alan Malloy
On Aug 11, 12:31 pm, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Aug 11, 2011 at 2:05 PM, Mark Rathwell mark.rathw...@gmail.com 
 wrote:
  (This is all moot at this point, since the author or Noir has made changes
  that allow it to be compatible with App Engine.)

 App Engine.

  Background:
  This was with noir version 1.1.0, and appengine-magic version 0.4.3.
   appengine-magic needs a ring handler, which noir provided with
  noir.server/gen-handler.   However, that handler had a bunch of default
  middlewares added by compojure.handler/site. ...

 Compojure.

 App Engine ... Compojure.

 Wait, what?

 You are trying to run a WEB SERVER on a PHONE?

 This really must be the 21st century ... :)

Have you even tried a google search for app engine? It's (a) nothing
to do with a phone, (b) fairly well known, and (c) easy to discover
even if you've never heard of it.

It's also (d) not very convenient to use, from what I've heard, but
there are a number of Clojure people who use 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: Passing ClojureScript objects to JavaScript functions

2011-08-11 Thread Kevin Lynagh
Alright, thanks for the info. Do you know why an automatic solution is
out?

I'm trying to use D3 from ClojureScript, but right now all of the
clarity I get from Clojure's nicer data manipulation abstractions is
lost having to convert to/from JS objects everywhere.


On Aug 11, 9:27 am, Brenton bashw...@gmail.com wrote:
 There is an issue for this:

 http://dev.clojure.org/jira/browse/CLJS-37

 and work is being done to come up with a good solution. The comment in
 the issue is outdated. There was some discussion last week about how
 best to do this. I can't remember the details but I know that doing
 anything automatically is out. I think it will either be a macro or a
 reader-macro and will only create js objects out of literals or
 expressions which can be evaluated to a literal.

 Brenton

 On Aug 10, 9:04 pm, Kevin Lynagh klyn...@gmail.com wrote:

  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


Re: rebind var for all threads

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 4:45 PM, Alan Malloy a...@malloys.org wrote:
 Have you even tried a google search for app engine? It's (a) nothing
 to do with a phone, (b) fairly well known, and (c) easy to discover
 even if you've never heard of it.

Previous discussions of App Engine here have implied it to be
associated with the APIs for Android, a phone OS. I have not directly
looked into the matter, though, lacking an Android phone as I do or
any current interest in developing for the platform.

-- 
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: Passing ClojureScript objects to JavaScript functions

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 5:02 PM, Kevin Lynagh klyn...@gmail.com wrote:
 Alright, thanks for the info. Do you know why an automatic solution is
 out?

 I'm trying to use D3 from ClojureScript, but right now all of the
 clarity I get from Clojure's nicer data manipulation abstractions is
 lost having to convert to/from JS objects everywhere.

At the very least there should be nice functions to call to convert
back and forth explicitly, if automatic conversion is out and a reader
macro will only work for compile time constants. So one could use
@@the-structure for constants, and (to-js the-structure) for anything
else, or something of the sort. Or is such a function already there,
but considered annoying enough to want to be able to hide it in
implicit conversions or short, pithy reader macros? Of course, in the
latter case, a reader macro that expands to the function call could
work on non-constants, though, as @foo already expands to (deref foo)
in normal Clojure and does not require foo to be a compile time
constant.

-- 
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-11 Thread Sean Corfield
On Thu, Aug 11, 2011 at 2:10 PM, Ken Wesson kwess...@gmail.com wrote:

 Previous discussions of App Engine here have implied it to be
 associated with the APIs for Android, a phone OS.


Now you've made me curious... *which* previous discussions implied that?
-- 
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: Passing ClojureScript objects to JavaScript functions

2011-08-11 Thread Kevin Lynagh
Yeah, I ended up writing two such functions for converting Clojure
sequentials into JS arrays and maps into JS objects:

https://gist.github.com/1141054

(Note that they won't convert a vector containing maps or vice versa
properly, so they're not quite nice functions yet.)


On Aug 11, 2:14 pm, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Aug 11, 2011 at 5:02 PM, Kevin Lynagh klyn...@gmail.com wrote:
  Alright, thanks for the info. Do you know why an automatic solution is
  out?

  I'm trying to use D3 from ClojureScript, but right now all of the
  clarity I get from Clojure's nicer data manipulation abstractions is
  lost having to convert to/from JS objects everywhere.

 At the very least there should be nice functions to call to convert
 back and forth explicitly, if automatic conversion is out and a reader
 macro will only work for compile time constants. So one could use
 @@the-structure for constants, and (to-js the-structure) for anything
 else, or something of the sort. Or is such a function already there,
 but considered annoying enough to want to be able to hide it in
 implicit conversions or short, pithy reader macros? Of course, in the
 latter case, a reader macro that expands to the function call could
 work on non-constants, though, as @foo already expands to (deref foo)
 in normal Clojure and does not require foo to be a compile time
 constant.

 --
 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-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 5:47 PM, Sean Corfield seancorfi...@gmail.com wrote:
 On Thu, Aug 11, 2011 at 2:10 PM, Ken Wesson kwess...@gmail.com wrote:

 Previous discussions of App Engine here have implied it to be
 associated with the APIs for Android, a phone OS.

 Now you've made me curious... *which* previous discussions implied that?

Eh. I now can't seem to actually find any recent post mentioning both
it and Android. But mentioning it in connection with Google's app
store is another matter. Is the app store for more than just Android
device apps then?

-- 
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-11 Thread Mark Rathwell
Is the app store for more than just Android
device apps then?

Apple has one central app store for iPhone/iPad apps, and now even has one
for Mac apps.  Android's situation I haven't exactly figured out, but I
think there is a central app store somewhat managed by Google, but Amazon
also has an app store for Android, and I don't know if there are others, or
if any carriers have their own stores.

 - Mark

On Thu, Aug 11, 2011 at 9:48 PM, Ken Wesson kwess...@gmail.com wrote:

 On Thu, Aug 11, 2011 at 5:47 PM, Sean Corfield seancorfi...@gmail.com
 wrote:
  On Thu, Aug 11, 2011 at 2:10 PM, Ken Wesson kwess...@gmail.com wrote:
 
  Previous discussions of App Engine here have implied it to be
  associated with the APIs for Android, a phone OS.
 
  Now you've made me curious... *which* previous discussions implied that?

 Eh. I now can't seem to actually find any recent post mentioning both
 it and Android. But mentioning it in connection with Google's app
 store is another matter. Is the app store for more than just Android
 device apps then?

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

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 10:02 PM, Mark Rathwell mark.rathw...@gmail.com wrote:
Is the app store for more than just Android
device apps then?
 Apple has one central app store for iPhone/iPad apps, and now even has one
 for Mac apps.  Android's situation I haven't exactly figured out, but I
 think there is a central app store somewhat managed by Google, but Amazon
 also has an app store for Android, and I don't know if there are others, or
 if any carriers have their own stores.

And meanwhile half these guys are suing the other half for patent
infringement. Anyone with a mobile gadget seems to be being sued, be
it a Kindle, a phone, a pad ...

What a mess.

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


Protocol Power - Pattern Matching Java Classes

2011-08-11 Thread David Nolen
I realized that supporting pattern matching on Java classes is pretty
trivial - 15 lines code needed to be changed. I think this a good example of
how powerful protocol really are:

https://gist.github.com/1141252

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

2011-08-11 Thread Sean Corfield
On Thu, Aug 11, 2011 at 6:48 PM, Ken Wesson kwess...@gmail.com wrote:

 Eh. I now can't seem to actually find any recent post mentioning both
 it and Android. But mentioning it in connection with Google's app
 store is another matter.


There is no Google App Store.

There is an Android Market which is where you get mobile apps for Android
devices: https://market.android.com/

There is Google Apps which is their web-based email, calendar and
documents for teams: http://www.google.com/apps/

Then there's Google App Engine which is their elastic cloud service
supporting Python and Java web applications (with some class restrictions):
http://www.google.com/enterprise/cloud/appengine/

Hope that helps clarify this thread's subject matter...
-- 
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: Example of a real-world ClojureScript web application

2011-08-11 Thread Linus Ericsson
You get Selenium running by using the clj-webdriver [1], thanks to Semperos
for that one!

[1] https://github.com/semperos/clj-webdriver

/Linus

2011/8/11 Filip de Waard f...@vix.io

 On Thu, Aug 11, 2011 at 4:03 AM, Timothy Washington twash...@gmail.comwrote:

 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.


 I don't have it at hand, right now, because I'm not at home, but I think
 the Google Closure book suggests using Selenium to automatically run the
 tests. Alternatively, using script/repljs might work. Do you have the tests
 running a browser window already? If so, I'd love to have a look at how you
 did that, because I haven't gotten that far yet myself. I'm going to give
 this another shot soon, because I've learned quite a lot about ClojureScript
 since I last tried to get testing to work.

 -fmw

 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


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

Typo in Clojure.org docs

2011-08-11 Thread Ambrose Bonnaire-Sergeant
The example for using (bean obj) should be `(bean java.awt.Color/black)`

ATM it is (bean [[http://java.awt.Color/black|java.awt.Color/black]])

http://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-(bean%20obj)

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