Re: Alternate set literal syntax?

2012-03-28 Thread Sean Corfield
On Wed, Mar 28, 2012 at 12:56 PM, Devin Walters  wrote:
> The set literal also seem fairly abundant in test code.

Yup, I have a bunch of tests where success is to get back any of a
known set of values.

> We have: '(), [], {}, #{}

Well... (), [], {}, #{} - the ' isn't needed on the empty list, right?
-- 
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: Is it possible to extend a parameterized type using gen-class?

2012-03-28 Thread Jim Blomo
sim, I don't think it is possible right now.  I am not an expert, but...

On Fri, Mar 2, 2012 at 5:04 AM, Daniel Solano Gomez  wrote:
> Yes, it is possible.  At the byte-code level there is (at least at
> run-time) no difference between a generic and a non-generic class.  All
> methods take/return the generic type just use Object.

This is mostly true, but for the use case needed, deriving from a
parameterized superclass, the JVM does track the parameterized
generic.  Class.getGenericSuperclass returns a ParameterizedType for
Classes extending a parameterized generic.

I would like this functionality as well for writing a Dropwizard
service in Clojure.  The Dropwizard framework relies on reflecting on
the parameter of a parent, and this doesn't seem possible in Clojure
right now.  Writing a Java shim to do the inheritance also won't work
with the current version of Dropwizard (though perhaps that is a
design bug in the framework).

I've taken a look at how annotations are done in generate-class, and
would like input on the best way to add this functionality.  My rough
plan is:

- Create an implementation of ParameterizedType for Clojure
- Add a metadata argument to the symbol passed to gen-class :extends
or :implements
- when that metadata is present, override getGenericSuperclass in the
generated class to return the ParameterizedType

Is this reasonable?  Are there other areas that need to expose generic
parameters?

Jim

http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getGenericSuperclass()
https://github.com/codahale/dropwizard/blob/master/dropwizard-core/src/main/java/com/yammer/dropwizard/AbstractService.java#L75

-- 
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: Forgetting (require…) => nasty bug

2012-03-28 Thread Phil Hagelberg
On Wed, Mar 28, 2012 at 9:05 PM, Frank Siebenlist
 wrote:
> leiningen v3.0 ?  ;-)

2.0 isn't done yet; there's still a chance!

Seriously, if you'd like to add it I can give you details; maybe best
to find me on IRC.

-Phil

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


Re: Forgetting (require…) => nasty bug

2012-03-28 Thread Frank Siebenlist
leiningen v3.0 ?  ;-)


On Mar 28, 2012, at 8:48 PM, Phil Hagelberg wrote:

> On Wed, Mar 28, 2012 at 8:30 PM, Frank Siebenlist
>  wrote:
>> Or is it possible to create a sandbox in an existing jvm that would give you 
>> similar isolation? (which would be far less slow)
> 
> You could probably do this with isolated classloaders in most cases.
> 
> -Phil
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Re: Forgetting (require…) => nasty bug

2012-03-28 Thread Phil Hagelberg
On Wed, Mar 28, 2012 at 8:30 PM, Frank Siebenlist
 wrote:
> Or is it possible to create a sandbox in an existing jvm that would give you 
> similar isolation? (which would be far less slow)

You could probably do this with isolated classloaders in most cases.

-Phil

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


Re: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Shantanu Kumar
> If you control the third line of:
>
> (defn foo [x y]
>   (let [z (bar y (next x))]
>     (println "Done in " (find-name) ".")
>     (* 4 z (count x
>
> then don't you control the first?

Cedric – Unfortunately, no. The target is pre-written code that may
have been created using (1) clojure.core/defn or (2) several `defxyz`
kind of macros already. Injecting a macro that internally uses `find-
name` is something I can do, hence this need.

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: Forgetting (require…) => nasty bug

2012-03-28 Thread Frank Siebenlist
"slow mode"…

Is that a setup where you would bring-up a new jvm-instance for each file such 
that you can truly compile/test in isolation?

Or is it possible to create a sandbox in an existing jvm that would give you 
similar isolation? (which would be far less slow)

-FrankS.



On Mar 28, 2012, at 8:20 PM, Phil Hagelberg wrote:

> On Wed, Mar 28, 2012 at 8:03 PM, Frank Siebenlist
>  wrote:
>> For example, if you have a lein plugin that require's clojure.set, and you 
>> use any fqn in that ns without require'ing it in your file, then your fresh 
>> repl will not catch that (… if I understand your setup).
> 
> The lein check task currently ensures that each namespace is
> compilable, but it does all the namespaces in a single process. You
> could add a "slow mode" to it that would ensure that each worked in
> isolation.
> 
> -Phil
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Re: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 10:58 PM, Shantanu Kumar
 wrote:
> Rostislav and Cedric – I cannot supply my own version of defn; the
> macro should work with the regular clojure.core/defn.

If you control the third line of:

(defn foo [x y]
  (let [z (bar y (next x))]
(println "Done in " (find-name) ".")
(* 4 z (count x

then don't you control the first?

-- 
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: Forgetting (require…) => nasty bug

2012-03-28 Thread Phil Hagelberg
On Wed, Mar 28, 2012 at 8:03 PM, Frank Siebenlist
 wrote:
> For example, if you have a lein plugin that require's clojure.set, and you 
> use any fqn in that ns without require'ing it in your file, then your fresh 
> repl will not catch that (… if I understand your setup).

The lein check task currently ensures that each namespace is
compilable, but it does all the namespaces in a single process. You
could add a "slow mode" to it that would ensure that each worked in
isolation.

-Phil

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


Re: Forgetting (require…) => nasty bug

2012-03-28 Thread Frank Siebenlist
Not sure if that would work for all cases…

For example, if you have a lein plugin that require's clojure.set, and you use 
any fqn in that ns without require'ing it in your file, then your fresh repl 
will not catch that (… if I understand your setup).

However, if you then run it outside of the dev-environment, i.e. without any 
plugins or with other plugins, you will feel the pain.

But even when your trick works for many cases, it would be preferable if the 
compiler would simply catch that bug for you if possible.

-FrankS.


On Mar 28, 2012, at 7:26 PM, Armando Blancas wrote:

> Is there a way to capture those kind of bugs earlier?
> 
> For each namespace I get a fresh repl and (use) the one in turn, then try the 
> whole program. 

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Shantanu Kumar
Rostislav and Cedric – I cannot supply my own version of defn; the
macro should work with the regular clojure.core/defn.

Thomas – Your example works well with Clojure 1.2.x but doesn't with
Clojure 1.3 and 1.4. As you rightly said, &env should not be relied
upon. :)

Shantanu

On Mar 29, 4:17 am, Cedric Greevey  wrote:
> On Wed, Mar 28, 2012 at 3:30 PM, Rostislav Svoboda
>
>
>
>
>
>
>
>
>
>  wrote:
> >> Steve – Your example is already compact, but maybe it can be made even
> >> cheaper by specifying maxDepth of 1:
> >>http://docs.oracle.com/javase/6/docs/api/java/lang/management/ThreadM...,
> >> int)
>
> > @Shantanu: What about the defn0 macro from Steve:
>
> > (defmacro defn0 [name & fdcls]
> >  `(let [~'%0 (symbol (name (ns-name *ns*)) (name '~name))]
> >    (defn ~name ~@fdcls)))
>
> > (defn0 foo [a b]
> >    (println "Running function"%0 ":" (+ a b)))
>
> > user=> (foo 1 2)
> > Running function user/foo : 3
> > nil
>
> > Is't it what do you need?
>
> He wants to be able to use plain defn, which suggests
>
> (defmacro defn [name & other-args]
>   `(let [~'current-fn '~name]
>      (clojure.core/defn ~name ~@other-args)))
>
> ...
>
> (defn foo [x y]
>   (println current-fn)
>   (+ x y))
>
> user=> (foo 3 4)
> foo
> 7
> user=>

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


Re: Forgetting (require…) => nasty bug

2012-03-28 Thread Armando Blancas

>
> Is there a way to capture those kind of bugs earlier?
>
For each namespace I get a fresh repl and (use) the one in turn, then try 
the whole program. 

-- 
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: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-28 Thread endbegin
On Tuesday, March 27, 2012 2:51:41 PM UTC-4, Jay Fields wrote:
>
> I recently ran into some code** that was in Java, and ran in single
> digit microseconds (not millis). I converted it to clojure, and got it
> running at about the same speed... though it did take me a day to
> figure out all the tweaks.
>
> It can be done, if you're willing to invest the time and learn the tricks.
>
> Cheers, Jay
>
>
> That is good to know. Is there a place where the tricks involved were 
documented? As in, "here" is what you should think about to get Java-like 
performance. I've seen fragments in different places, and a lot of them 
applied to Clojure 1.2 or earlier. Based on what I have seen on Stack 
Overflow, it seems like if you want Java performance, then you have dig 
down into direct Java interop, and use things like Java arrays.

-- 
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: Polymorphic namespaces?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 8:46 PM, Chris McBride  wrote:
> I'm not trying to do anything in particular. I do OO programming at work and 
> it's been pounded in my head that loose coupling is better than gift 
> coupling. I've found it useful on a few occasions. One example, in the 
> frontend we wrap all the database calls in a caching layer but we don't need 
> that when the same code runs in the backend. I wouldnt know how to do this 
> with clojure.

A higher-order function, I should think, so you have something like

(defn basic-retrieval-fn [query & opts] ...)

(def caching-retrieval-fn (some-sort-of-fancy-memoize basic-retrieval-fn))

(defn do-something [conn query retrieval-fn mumble frotz] ...)

Or maybe a dynamic bind:

(def ^:dynamic *retrieval-fn* caching-retrieval-fn)

Or even a configuration file:

(defn get-retrieval-fn []
  (let [blah blah blah (Properties. +config-file+) blah blah]
(if foo caching-retrieval-fn basic-retrieval-fn)))

or even

(defn get-retrieval-fn []
  (let [symb (with-open [in (open-config-file)] (symbol (first (line-seq in]
(resolve symb)))

-- 
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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Nathan Sorenson


> > Put another way: why does apply need to promise not to realize its seq
> > argument?
>
> (apply + some-lazy-seq-too-big-to-fit-in-main-memory)
>
> Not "avoid evaluating some of its arguments" but "avoid holding onto
> the head" in that case.
>
I'd reach for 'reduce' in this case but that's still a valid point.
 

-- 
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: Polymorphic namespaces?

2012-03-28 Thread Nathan Sorenson


> One example, in the frontend we wrap all the database calls in a caching 
> layer but we don't need that when the same code runs in the backend. 
>

One option for something like this (a configuration option that doesn't 
change much between function calls/expected to largely remain the same for 
your program) is a dynamic var. You could just rebind eg *caching* to true, 
and your database calls could dispatch accordingly. 

Code loading is a first-order thing in Clojure as well, so you could do a 
conditional require:

(if *caching* (require '[db.cached :as db]) (require '[db.uncached :as db]))

I'm not sure if this is often done, though?

I am also interested in the answer to your question. I wonder If anyone's 
played with the idea of parameterized imports a la ML's functors:

(ns my-database-helpers
 (require ...)
 (args [& {:keys [db]}])

Then in the configuration code something like:

(require '[(my-database-helpers :db db.cached) :as helpers])

I know a big philosophy guiding Newspeak (http://newspeaklanguage.org/) is 
that ALL imports should be done this way-- no code should explicitly 
hard-code the libraries it uses.

-- 
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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 7:16 PM, Timothy Baldridge  wrote:
> "May be delayed"
>
> But I don't think they ever are:
>
> user=> (def oddseq (map #(do (print %) %) (range 30)))
> #'user/oddseq
>
> user=> (defn foo [& args] 'd)
> #'user/foo
>
> user=> (apply foo oddseq)
> 01234567891011121314151617181920212223242526272829d
>
> user=> (def oddseq (map #(do (print %) %) (range 1)))
> #'user/oddseq
>
> user=> (apply foo oddseq)
> 0d
>
> user=>
>
> I don't think it's possible to ever have apply not evaluate all its
> arguments? I think this is what Nathan was saying. Given the above
> example, is there anyway to not have the side effects automatically
> run when invoking apply?

Range is chunked, and I think the map-generated sequence inherits
that. On the other hand, I thought the chunk size was 16, and that it
didn't matter anyway if no element was ever requested. On the gripping
hand, (apply f x) calls (seq x), which realizes the first element (and
thus the first chunk, for chunked seqs) to determine if x is empty and
it should therefore return nil.

-- 
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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 8:32 PM, Nathan Sorenson  wrote:
>
>> I don't think it's possible to ever have apply not evaluate all its
>> arguments? I think this is what Nathan was saying.
>
> Cedric is right that apply, itself, is strict and evaluates its arguments as
> one might expect. But I'm not referring to manual thunking/delaying your
> arguments to mimic laziness in a strict language. What I'm trying to
> understand is that one is able to write a polyvariadic function that
> *doesn't* completely realize the "& rest" parameter (but only in the case
> that the fn is invoked via apply with a lazy seq argument). It's this
> combination of requirements that means apply should *not* construct a tuple
> (as in clojure-py) or cons arguments together into a list (as I'm currently
> doing in clojure-scheme) as these operations will cause the realization of
> the entire applied sequence.

I suggest that "apply" should, if the function has no rest argument,
realize enough of its input(s) to either be ready to call the function
or know there's at least one more argument than the function's highest
arity and throw an exception; if the function has a rest argument, it
should cons up a list of arguments until either it runs out or there's
enough for all the non-rest arguments of the highest arity overload,
then call the function (or throw) if it's exhausted its input or else
call the function with the rest argument bound to the unrealized tail
of the input.

So, if the input is (range), then:

for (defn foo [a b]) it would realize 0, 1, and 2, then throw arity.

for (defn foo [a b & r]) it would realize 0 and 1, then call foo with
(nth (range) 0) (nth (range) 1) (next (next (range))) as a, b, and r.

> My question is what would require this sort of function? Is there a use-case
> for a function that expects to be called via 'apply' to avoid evaluating
> some of its arguments?

I can't think of any offhand.

> Put another way: why does apply need to promise not to realize its seq
> argument?

(apply + some-lazy-seq-too-big-to-fit-in-main-memory)

Not "avoid evaluating some of its arguments" but "avoid holding onto
the head" in that case.

-- 
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 cheatsheet with tooltips (alpha)

2012-03-28 Thread Dave Sann
How are you able to make the tooltips extend beyond the browser window. I 
have not seen this before.

Dave

On Saturday, 24 March 2012 21:15:20 UTC+11, Andy Fingerhut wrote:
>
> There are still some problems with this, but it is ready for experimental 
> use, at least.  Alex, please don't put this on clojure.org -- it ain't 
> ready yet.
>
>
> http://homepage.mac.com/jafingerhut/files/cheatsheet-clj-1.3.0-v1.4-tooltips/cheatsheet-full.html
>
> I found and used TipTip for tooltips [1], because it advertises the 
> ability to keep the tooltips within the browser window no matter where the 
> cursor is relative to the window border.  I've tweaked a few settings that 
> may cause it to fail to do this properly sometimes, and there are many 
> cases where the tooltip appears so close to the cursor that it "flashes" on 
> and off quickly.  As a workaround, try moving the cursor away from the 
> tooltip, but still hovering over the link if you can.  If anyone knows how 
> to correct those problems by tweaking the JavaScript code or CSS settings, 
> please let me know.
>
> The tooltips consist of the normal doc strings, with the first line of 
> dashes removed, and truncated to the first 15 lines if it is longer than 
> that (very few are).  Most links go to clojuredocs.org, as usual.
>
> Give it a test drive and see what you think.
>
> Andy
>
>
> [1] http://code.drewwilson.com/entry/tiptip-jquery-plugin
>
>

-- 
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: Polymorphic namespaces?

2012-03-28 Thread Chris McBride
I'm not trying to do anything in particular. I do OO programming at work and 
it's been pounded in my head that loose coupling is better than gift coupling. 
I've found it useful on a few occasions. One example, in the frontend we wrap 
all the database calls in a caching layer but we don't need that when the same 
code runs in the backend. I wouldnt know how to do this with clojure. 

-- 
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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Nathan Sorenson
An example of "lazy" apply, with your foo fn:

> (apply foo (iterate inc 0))
d

-- 
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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Nathan Sorenson


> I don't think it's possible to ever have apply not evaluate all its
> arguments? I think this is what Nathan was saying. 
>

Cedric is right that apply, itself, is strict and evaluates its arguments 
as one might expect. But I'm not referring to manual thunking/delaying your 
arguments to mimic laziness in a strict language. What I'm trying to 
understand is that one is able to write a polyvariadic function that 
*doesn't* completely realize the "& rest" parameter (but only in the case 
that the fn is invoked via apply with a lazy seq argument). It's this 
combination of requirements that means apply should *not* construct a tuple 
(as in clojure-py) or cons arguments together into a list (as I'm currently 
doing in clojure-scheme) as these operations will cause the realization of 
the entire applied sequence.

 

> Given the above
> example, is there anyway to not have the side effects automatically
> run when invoking apply?
>
Yes. If you bury an effect into the lazy-seq at some position n, it won't 
be realized unless the applied function is either fixed-arity up to n, or 
chooses to force the lazy-seq up to n (modulo chunked evaluation). 

My question is what would require this sort of function? Is there a 
use-case for a function that expects to be called via 'apply' to avoid 
evaluating some of its arguments? 

(Again, this isn't a question of thunking; The user of this hypothetical 
function can apply it with a strict list or a lazy list and no code needs 
to change--I, as a caller, don't need to explicitly thunk arguments for 
laziness and the fn doesn't need to explicitly force/dereference them).

Put another way: why does apply need to promise not to realize its seq 
argument?

-- 
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: Alternate set literal syntax?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 7:36 PM, Timothy Baldridge  wrote:
> "not-unreasonable because otherwise people
> will acquire a negative opinion of me."
>
> On the contrary...I find that people who admit that their "cool idea
> after further thought probably isn't so cool" garner better respect
> from the community at large.

But I never claimed it was a "cool idea" in the first place. I said,
and I quote:

#{foo bar baz} is somewhat ugly. It occurs to me that one could modify
the reader to additionally accept ... it looks nicer, IMO ..."

There's two statements of opinion -- X is somewhat ugly and Y looks
nicer than X -- and one statement of fact, that Y could be implemented
without it being a breaking change. The former two are somewhat
subjective and the latter was proved true.

So, I've been attacked for purportedly holding a much stronger
position on the matter than I really do.

In any event, the die is cast now. Either I successfully defend my
having made that original post as not having been a wrong/unreasonable
thing to do, or else people regard me as having done a
wrong/unreasonable thing. There's no alternative, by the law of the
excluded middle.

-- 
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: Alternate set literal syntax?

2012-03-28 Thread Timothy Baldridge
"not-unreasonable because otherwise people
will acquire a negative opinion of me."

On the contrary...I find that people who admit that their "cool idea
after further thought probably isn't so cool" garner better respect
from the community at large.

Just my $0.02...

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: Alternate set literal syntax?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 3:56 PM, Devin Walters  wrote:
> We have: '(), [], {}, #{}

Not quite. '() isn't strictly analogous to #{}, because quote
suppresses evaluation of what's inside.

user=> (def foo 42)
#'user/foo

user=> (for [x ['(foo) [foo] {:a foo} #{foo}]]
 (println x))
(foo)
[42]
{:a 42}
#{42}
(nil nil nil nil)

user=>

There's no list literal. It's like array-map or sorted-set:

(array-map this)
(sorted-set that)
(list these things)

> No one seems to be dumbfounded by '(). I suppose one could imagine something
> nasty like $1 2 3$ being proposed for a single character set wrapper, but
> blech. No thank you.

Indeed. Using the same symbol as both start and end delimiter fails
when there's nesting. It's fine for string literals; not so much for a
type of data structure that might contain the same type as an element.

> On top of that, lets say we do want a literal syntax...if we have to
> teach some bizarre syntax that people will rarely use...what's the big
> difference between #{} and <{}> ?

Symmetry.

I'm not really sour on #{} or dead-set on having something else,
though. It was just a mostly idle idea I had. But it produced such a
strong attack in response to it, for whatever reason, that now I'm
stuck having to defend it as not-unreasonable because otherwise people
will acquire a negative opinion of me.

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 3:30 PM, Rostislav Svoboda
 wrote:
>> Steve – Your example is already compact, but maybe it can be made even
>> cheaper by specifying maxDepth of 1:
>> http://docs.oracle.com/javase/6/docs/api/java/lang/management/ThreadMXBean.html#getThreadInfo(long,
>> int)
>
> @Shantanu: What about the defn0 macro from Steve:
>
> (defmacro defn0 [name & fdcls]
>  `(let [~'%0 (symbol (name (ns-name *ns*)) (name '~name))]
>    (defn ~name ~@fdcls)))
>
> (defn0 foo [a b]
>    (println "Running function"%0 ":" (+ a b)))
>
> user=> (foo 1 2)
> Running function user/foo : 3
> nil
>
> Is't it what do you need?

He wants to be able to use plain defn, which suggests

(defmacro defn [name & other-args]
  `(let [~'current-fn '~name]
 (clojure.core/defn ~name ~@other-args)))

...

(defn foo [x y]
  (println current-fn)
  (+ x y))

user=> (foo 3 4)
foo
7
user=>

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


Re: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Timothy Baldridge
"May be delayed"

But I don't think they ever are:

user=> (def oddseq (map #(do (print %) %) (range 30)))
#'user/oddseq

user=> (defn foo [& args] 'd)
#'user/foo

user=> (apply foo oddseq)
01234567891011121314151617181920212223242526272829d

user=> (def oddseq (map #(do (print %) %) (range 1)))
#'user/oddseq

user=> (apply foo oddseq)
0d

user=>

I don't think it's possible to ever have apply not evaluate all its
arguments? I think this is what Nathan was saying. Given the above
example, is there anyway to not have the side effects automatically
run when invoking apply?

Timothy



-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
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: GSOC Idea: Interactive documentation with autodoc

2012-03-28 Thread Andy Fingerhut
My fork of cd-client has code to create a local snapshot of all examples, 
see-alsos, and comments in clojuredocs.org, save it to a file, and switch to 
"local mode", which pulls all results from the snapshot file instead of 
clojuredocs.org.

https://github.com/jafingerhut/cd-client

Andy

On Mar 26, 2012, at 7:40 AM, Colin Jones wrote:

> One thing missing from reply's clojuredocs integration is the ability
> to have a local cache of the examples. Currently, we're just making an
> API call every time (using the clojuredocs-client library), which is
> great for getting off the ground and for having the latest examples,
> but not so great for offline work and speed.
> 
> I talked very briefly about this at Clojure/West with Lee Hinman
> (author of clojuredocs-client) and Zack Kim (of clojuredocs fame), and
> it sounded like they're open to this idea and even have ideas about
> how it might work. I'm not sure whether it's big or interesting enough
> for a GSOC project, or even which projects would be involved, but it's
> certainly something I'd like to have.
> 
> 
> 
> 
> On Mon, Mar 26, 2012 at 9:09 AM, David Nolen  wrote:
>> Zack,
>> 
>> Having examples in the Clojure source has come up before and it's probably
>> not going to happen. Also the repl-y project that is now integrated into
>> lein 2 has this functionality. However I think you're on an interesting
>> track as far as how Mathematica works. I don't think anyone has tackled a
>> rich interactive REPL with good integrated graphics support (that is also
>> interactive). I recall that Chas Emerick and others were interested in this.
>> 
>> 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: Using the Clojure Logo

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 2:32 PM, Daniel Gagnon  wrote:
> On Wed, Mar 28, 2012 at 1:40 PM, Chip Collier  wrote:
>>
>> I was also intending on using the logo in such a way to communicate that
>> a site I'm building is "powered by clojure" or something to that effect
>> with a link to clojure.org. Is that frowned upon?
>>
>> Chip
>
> Unfortunately, trademark laws are written in such a way that allowing this
> risk making Rich lose his trademark. If he knows about it, he must put a
> stop to it otherwise he can't claim to own the trademark. This is quite
> different from copyrights where you are the author no matter what.

I don't know if this differs in other countries, but in America that's
a gross oversimplification at best.

First of all, one only has to police unauthorized use of the
trademark. One can authorize its use under particular circumstances,
and then those uses don't need to be policed to avoid losing the
trademark.

Second, trademark law only covers "use in commerce". Use on a personal
webpage would not be covered, and would not have to be policed or risk
losing the mark. Use on a commercial site (which might be broadly
inclusive of, for instance, pages with revenue-generating ads) might
be another matter, if it's seen as implying an endorsement or a claim
to be the product/service the mark names. But...

Third, use of the mark in a purely factual manner is not, to my
knowledge, governed by law. So, a store needn't negotiate a license
with Coca Cola Inc. to say they have Coca Cola for sale, at least as
long as they aren't lying. Saying a site is powered by X, when it
really is powered by X, may fall under the same rule, given that
there's no implication that the site *is* X or is endorsed by X.

Identifying a noncommercial user group as a Clojure user group would
be analogous to identifying a noncommercial Web site as powered by
Clojure, to my mind. Trademark law would not apply, and Rich wouldn't
risk losing the trademark by not sending a lawyer after the group.

However, an earlier post claimed Rich had *copyrighted* the logo,
which is another kettle of fish. On the one hand there's no need to
police use or risk losing a copyright; on the other, a copyright
covers noncommercial use as well as commercial. I'm not sure how
copyrightable a fairly simple logo design really is, though. There are
circumstances that exempt one from needing a copyright license, "fair
use", that tend to include noncommercial activities that don't harm
the copyright holder's market. If Rich has copyrighted the logo, but
isn't selling copies or cheap licenses to use it, a noncommercial use
might well be found to be a fair use.

Personally, I think it would be silly to block uses of the logo to
refer to Clojure in circumstances that don't imply an endorsement that
doesn't exist, but obviously Rich is not obligated to share my opinion
of what would be silly.

-- 
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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 2:13 PM, Timothy Baldridge  wrote:
>>>is there a use case behind apply being lazy when Clojure is otherwise a 
>>>strictly evaluating language
>
> In clojure-py we have to pass vararg arguments as tuples. So it ends
> up a lot like
>
> (to-tuple (concat args seqarg))
>
> I always saw the seq argument in IFn as a crutch to get around the "we
> have too many vars to pass to this function" problem. Basically, since
> the JVM doesn't support lazy varargs, Clojure doesn't either.

Apply isn't really non-strict. If your source contains

(apply foo x y z w)

then apply, foo, x, y, z, and w will all be evaluated, in
left-to-right order, before foo is called with x, y, z, and the
contents of w as arguments. If w is a literal such as [w1 w2 w3 w4]
then w1, w2, w3, and w4 will get evaluated, after z and in
left-to-right order, before foo is called.

In other words, any side effects in a line like

(apply foo x y z [w1 w2 w3 w4])

happen in the order one would expect. And if w is really a lazy
sequence, and a lambda involved in generating it has side effects, the
fact that the side effects are in a lambda (or not even in the
(apply...) line) tells you that the side effects may be delayed.

Further, it's possible to get a kind of non-strict-analogous behavior
(side effects may be delayed, reordered, or not happen at all) in
Clojure if foo and its caller are written specially. For example,

(defn weird-and [x y]
  (if @x @y))

(weird-and (delay (long-running-test-1)) (delay (long-running-test-2)))

will only compute the second expensive test if the first didn't return
logical false. (The built-in and macro also short-circuits, but does
so by being a macro. Unlike and, weird-and could be passed to a HOF.
But the HOF would have to know to pass it delays rather than normal
booleans. You could do (reduce weird-and [(delay this) (delay that)
...]).)

-- 
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: Forgetting (require…) => nasty bug

2012-03-28 Thread Phil Hagelberg
Frank Siebenlist  writes:

> Wouldn't it be better to have the compiler or (load-file) generate an
> error/warning, as it should be able to detect a missing require?

It's been proposed in the past. I don't recall Rich's argument against
it, but I only use fully-qualified vars when debugging.

-Phil

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


Re: Forgetting (require…) => nasty bug

2012-03-28 Thread Frank Siebenlist

On Mar 28, 2012, at 3:15 PM, Phil Hagelberg wrote:

> ...
> In general though I recommend simply using :require :as for
> everything; if your code won't compile without the :as alias in place
> then you'll be safe.


I realize that's a pragmatic way to force compilation errors.

However, I thought of using FQNs as a best practice as it's always clear which 
entity you're refering to as it's… fully qualified. 

Then only use require…:as if it becomes too tedious to write the full fqn, and 
only use "refer/use" if even that becomes too much of a pain.

Wouldn't it be better to have the compiler or (load-file) generate an 
error/warning, as it should be able to detect a missing require?

-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: Forgetting (require…) => nasty bug

2012-03-28 Thread Phil Hagelberg
On Wed, Mar 28, 2012 at 3:13 PM, Frank Siebenlist
 wrote:
> I've been bitten a couple of times now by the following scenario:

Slamhound won't help you catch those issues as they arise, but it can
catch them after they've happened:

https://github.com/technomancy/slamhound/

In general though I recommend simply using :require :as for
everything; if your code won't compile without the :as alias in place
then you'll be safe.

-Phil

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


Forgetting (require…) => nasty bug

2012-03-28 Thread Frank Siebenlist
I've been bitten a couple of times now by the following scenario:

- Use fully qualified names in the code

- Forget to add (require…) for the associated namspace

- But one other file already require'ed the same namespace, and the 
compiler&runtime is happy - all works fine.

- Then you include that file in an other app…

- no other module require's that namespace before this clj-module

- boom, crash… confusion as all seem to have worked before… and now it doesn't…


Is there a way to capture those kind of bugs earlier?

Thanks, 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: Polymorphic namespaces?

2012-03-28 Thread gaz jones
I would ask why you would want to do dependency injection? If it is to
swap out functions for testing, just use 'with-redefs'. I have
personally found it (DI) completely unnecessary...

On Wed, Mar 28, 2012 at 1:13 PM, Chris McBride  wrote:
> I was wondering how dependency injection is done in Clojure since functions
> live in static namespaces. It seems like this could be achieved by having a
> macro that can use runtime information to determine the mapping between a
> namespace and its implementation. Does this make sense? Is there a better
> way to dependency injection in Clojure?
>
> --
> 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: Polymorphic namespaces?

2012-03-28 Thread Brian Marick

On Mar 28, 2012, at 1:13 PM, Chris McBride wrote:

> I was wondering how dependency injection is done in Clojure since functions 
> live in static namespaces. It seems like this could be achieved by having a 
> macro that can use runtime information to determine the mapping between a 
> namespace and its implementation. Does this make sense? Is there a better way 
> to dependency injection in Clojure?

To what end are you injecting dependencies? (If it's for testing, I have 
something useful to say; if not, not.)


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


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


Re: Alternate set literal syntax?

2012-03-28 Thread Timothy Baldridge
> That's surprising to me. You never use something like this?
> (map #{:fred :bob :ted} [:fred :bob])

I think it's more that most of what I work with is either seq like,
vectors, or has some sort of key->value relationship. Most of the time
if I need a set of unique keys, I also need sets of data attached to
those keys.

> To my eye, the empty set is a fairly common occurrence and that seems to be
> how #{} gets used the most.

Agreed.

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: Alternate set literal syntax?

2012-03-28 Thread Devin Walters
On Wednesday, March 28, 2012 at 12:58 PM, Timothy Baldridge wrote:
> Let's take a step back and look at this idea from a new user's view.
> The way I see it, whatever we do, we'll have to explain to users how
> to create sets. Hashmaps, and vectors follow (roughly) the JSON/Python
> syntax:
>  
> vector = [1 2 3 4]
> map = {1 2 3 4}
>  
> So how to these languages represent sets?
>  
> Python does it via extra syntax sugar:
>  
> set = {"foo", "bar"}
> map = {"foo": "bar", "foo2" : "bar2"}
>  
> I think the thing we have to keep in mind is that I can't think of a
> single other language that has set literals.  
>  
>  

Good point, but I disagree with the suggestion that because other languages 
don't have a set literal we shouldn't have one either. I like having the 
literal, FWIW. It makes sets feel like a more natural datastructure to use 
throughout the language. I've seen people write all sorts of crazy methods and 
functions to do what sets give you for free in other languages before they 
realized "oh right, this should probably be a set". Keeping sets front and 
center with a literal promotes their use in general. I think that's a Good 
Thing™. In other languages I sometimes feel like they're an afterthought, and 
using them feels like they're somehow foreign. As in I often find myself 
thinking: "Where's my set literal? Why am I not writing this in Clojure?" ;)
> So whatever we come up
> with will be a bit bizzare to new users. So let's look at the options
> given above:
>  
> {{"foo"}} ;; looks like a hash of a hash
> <{"foo"}> ;; could work, but no other form in all of clojure has two
> forms at the end.
> #{"foo"} ;; not exactly pretty
>  
> My thoughts are this...who actually uses the literal hash set? In the
> thousands of lines of Clojure code I've written a hash set once. So my
> first reaction is why have a literal at all? Why not use:
>  
>  

That's surprising to me. You never use something like this?
(map #{:fred :bob :ted} [:fred :bob])

Would you use:
(into (hash-set) [1 2 2 3])
(reduce conj (hash-set) [1 2 2 3])

Instead of:
(into #{} [1 2 2 3])
(reduce conj #{} [1 2 2 3])

To my eye, the empty set is a fairly common occurrence and that seems to be how 
#{} gets used the most. The set literal also seem fairly abundant in test code. 
Contrived example: (= (map inc #{1 2 3}) '(2 3 4))  This finding is based on a 
rushed `ack -aui "#{"` of popular projects I'd consider to be "idiomatic" 
clojure. So take my "research" with a grain of salt.

(sorted-set), (sorted-map), and (array-map) make more sense to me to call 
without args (sorted-set) or with args (sorted-set 1 2 2 3) over introducing a 
literal.

We have: '(), [], {}, #{}

No one seems to be dumbfounded by '(). I suppose one could imagine something 
nasty like $1 2 3$ being proposed for a single character set wrapper, but 
blech. No thank you. I rather like #{} and wouldn't be shy about introducing it 
to a beginner.
> On top of that, lets say we do want a literal syntax...if we have to
> teach some bizarre syntax that people will rarely use...what's the big
> difference between #{} and <{}> ?
>  
> If we want to actually go back to the original lisps, they didn't have
> any special syntax at all, besides the quote literal. This isn't
> ruby/python/C#. If something can be implemented without syntactic
> sugar, most times it should be. So my question for Cedric is...why all
> the fuss about set? Why not just use (set ["foo", "bar"]) it's clean,
> and makes plenty of sense to newbies.
>  
> 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 
> (mailto: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 
> (mailto: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: Is it possible to get only the time with the function 'time'

2012-03-28 Thread Marcus Lindner

Thanks.
I will try it.

Am 28.03.2012 21:45, schrieb Moritz Ulrich:

Looks like it could work. If you want to track even short times, use
System/nanoTime. If you're interested, take a look at the
implementation of `time':
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3424

On Wed, Mar 28, 2012 at 21:40, Marcus Lindner
  wrote:

Something like this?

(tracktime [f]
let [start (System/currentTimeMillis)
   result (f)
   end (System/currentTimeMillis)]
(vector result (- end start)))



Am 28.03.2012 21:34, schrieb Moritz Ulrich:


You should use java interop for this:

(java.lang.System/currentTimeMillis)

On Wed, Mar 28, 2012 at 21:32, Goldritter
wrote:

I wanted to aks if it is possible to get only the passed milliseconds
from the function 'time' without the sentence "Elapsed time: 0.119
msecs". I would only need the 0.119 and best as a number and not as a
String.
Or have I to write a function which extracts the number out of the
String?

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




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





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


Re: Is it possible to get only the time with the function 'time'

2012-03-28 Thread Moritz Ulrich
Looks like it could work. If you want to track even short times, use
System/nanoTime. If you're interested, take a look at the
implementation of `time':
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3424

On Wed, Mar 28, 2012 at 21:40, Marcus Lindner
 wrote:
> Something like this?
>
> (tracktime [f]
>    let [    start (System/currentTimeMillis)
>               result (f)
>               end (System/currentTimeMillis)]
> (vector result (- end start)))
>
>
>
> Am 28.03.2012 21:34, schrieb Moritz Ulrich:
>
>> You should use java interop for this:
>>
>> (java.lang.System/currentTimeMillis)
>>
>> On Wed, Mar 28, 2012 at 21:32, Goldritter
>>   wrote:
>>>
>>> I wanted to aks if it is possible to get only the passed milliseconds
>>> from the function 'time' without the sentence "Elapsed time: 0.119
>>> msecs". I would only need the 0.119 and best as a number and not as a
>>> String.
>>> Or have I to write a function which extracts the number out of the
>>> String?
>>>
>>> --
>>> 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



-- 
Moritz Ulrich

-- 
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: Is it possible to get only the time with the function 'time'

2012-03-28 Thread Marcus Lindner

Something like this?

(tracktime [f]
let [start (System/currentTimeMillis)
   result (f)
   end (System/currentTimeMillis)]
(vector result (- end start)))



Am 28.03.2012 21:34, schrieb Moritz Ulrich:

You should use java interop for this:

(java.lang.System/currentTimeMillis)

On Wed, Mar 28, 2012 at 21:32, Goldritter
  wrote:

I wanted to aks if it is possible to get only the passed milliseconds
from the function 'time' without the sentence "Elapsed time: 0.119
msecs". I would only need the 0.119 and best as a number and not as a
String.
Or have I to write a function which extracts the number out of the
String?

--
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: Is it possible to get only the time with the function 'time'

2012-03-28 Thread Moritz Ulrich
You should use java interop for this:

(java.lang.System/currentTimeMillis)

On Wed, Mar 28, 2012 at 21:32, Goldritter
 wrote:
> I wanted to aks if it is possible to get only the passed milliseconds
> from the function 'time' without the sentence "Elapsed time: 0.119
> msecs". I would only need the 0.119 and best as a number and not as a
> String.
> Or have I to write a function which extracts the number out of the
> String?
>
> --
> 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



-- 
Moritz Ulrich

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


Is it possible to get only the time with the function 'time'

2012-03-28 Thread Goldritter
I wanted to aks if it is possible to get only the passed milliseconds
from the function 'time' without the sentence "Elapsed time: 0.119
msecs". I would only need the 0.119 and best as a number and not as a
String.
Or have I to write a function which extracts the number out of the
String?

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Rostislav Svoboda
> Steve – Your example is already compact, but maybe it can be made even
> cheaper by specifying maxDepth of 1:
> http://docs.oracle.com/javase/6/docs/api/java/lang/management/ThreadMXBean.html#getThreadInfo(long,
> int)

@Shantanu: What about the defn0 macro from Steve:

(defmacro defn0 [name & fdcls]
 `(let [~'%0 (symbol (name (ns-name *ns*)) (name '~name))]
(defn ~name ~@fdcls)))

(defn0 foo [a b]
(println "Running function"%0 ":" (+ a b)))

user=> (foo 1 2)
Running function user/foo : 3
nil

Is't it what do you need?

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Thomas Winant


On 28/03/2012 18:15, Shantanu Kumar wrote:

 On Mar 28, 8:57 pm, Ram Krishnan  wrote:
> Did you just need the name of the function? something like this?

 Sorry, I should explained using code what I am looking for:

 (defmacro find-name []
 ;; some magic here
 ..)

 (defn foo []
 ..
 (println (find-name)) ; should print "foo"
 ..)

 I am looking for a way to write the `find-name` macro. So, you can see
 I want to use it with regular functions defined using `defn`.

 Shantanu


My solution:

(defmacro find-name []
  (let [[[sym _]] (filter (fn [[_ binding]]
(zero? (.idx binding)))
&env)]
`'~sym))


(defn foo []
  (println (find-name)))

(foo)
=> foo
nil


One has access to the environment in which the macro was expanded
through the relatively unknown `&env`. The value of `&env` is a map of
symbols to bindings. The bindings are numbered, so the binding with 0
as index (`.idx`) is the function that is being defined. Remember that
(defn x [] ..) roughly (ignoring metadata) expands to:
(def x (fn x [] ..))

Even in the following case (to my surprise), the `foo`-binding still
has index 0:

(let [x 1]
  (defn foo []
(let [y 2]
  (println (find-name)

This is quite 'hackish' and should not be relied upon.



dewinant



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

Newbie's Guide to Learning Clojure

2012-03-28 Thread Elango Cheran
Hi everyone,
On Gregg's suggestion, I want to share a writeup about how total beginners
can learn Clojure in a minimally painful way.  I'd welcome any comments,
suggestions, etc.

http://www.elangocheran.com/blog/2012/03/the-newbies-guide-learning-clojure/

Thanks.

Elango

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Shantanu Kumar
Thanks all for responding.

Ram – Appreciate both versions, but I need to use it with regular
functions created with `defn`.

Rostislav – I need to do this in a regular function created using
`defn`; not sure how can I use named let in this case. Am I missing
something?

Steve – Your example is already compact, but maybe it can be made even
cheaper by specifying maxDepth of 1:
http://docs.oracle.com/javase/6/docs/api/java/lang/management/ThreadMXBean.html#getThreadInfo(long,
int)

Shantanu

On Mar 28, 10:18 pm, Ram Krishnan  wrote:
> On Wednesday, March 28, 2012 at 9:15 AM, Shantanu Kumar wrote:
>
> > On Mar 28, 8:57 pm, Ram Krishnan http://gmail.com)> 
> > wrote:
> > > Did you just need the name of the function? something like this?
>
> > Sorry, I should explained using code what I am looking for:
>
> > (defmacro find-name []
> > ;; some magic here
> > ..)
>
> > (defn foo []
> > ..
> > (println (find-name)) ; should print "foo"
> > ..)
>
> > I am looking for a way to write the `find-name` macro. So, you can see
> > I want to use it with regular functions defined using `defn`.
>
> If you can't use a specialized `defn` you could try something like the 
> following, assuming that you need this for just a temporary while (say during 
> development):
>
> >88<
>
> (def ^{:dynamic true} *myself* nil)
> (defn find-name [] *myself*)
>
> (defmacro trace [sym]
>   `(let [old# ~sym]
>      (def ~sym (fn [& args#]
>                  (binding [*myself* '~sym]
>                    (apply old# args#))
>
> (defn foo [a b] [(find-name) (+ a b)])
>
> (foo 1 2) => [nil 3]
>
> (trace foo)
>
> (foo 1 2) => [foo 3]
>
> >88<
>
> It requires you explicitly `trace` the functions within which you want to 
> call `find-name`, otherwise the name will just be `nil`.
>
>
>
>
>
>
>
>
>
> > 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 
> > (mailto: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 
> > (mailto: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: clj-browserchannel-demo, cljs <-> clj communication

2012-03-28 Thread ckirkendall
Nice work! I have been looking into this also. I think I have found
something to keep me busy this weekend.


On Mar 28, 7:45 am, "Gijs S."  wrote:
> Here is the chat app on Heroku:
>
> http://cold-stream-6156.herokuapp.com/index.html
>
> -Gijs
>
> On Mar 28, 1:39 pm, "Gijs S."  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > clj-browserchannel-demo demonstrates cross-browser compatible, real-
> > time, bi-directional communication between ClojureScript and Clojure
> > using Google Closure BrowserChannel.
>
> > From the Google Closure API: "A BrowserChannel simulates a
> > bidirectional socket over HTTP. It is the basis of the Gmail Chat IM
> > connections to the server."
> > The javascript api of BrowserChannel is open-source and part of the
> > Google Closure library. The server component is not, as is noted in
> > the Google Closure book ("Closure: The Definitive Guide by Michael
> > Bolin").
>
> > clj-browserchannel-demo is an example chat application using a server
> > side implementation for BrowserChannel written in Clojure. The server
> > component is for BrowserChannel version 8.
>
> > This enables client->server and server->client communication in
> > ClojureScript and Closure web apps, without any javascript
> > dependencies other than the Google Closure library.
>
> > The chat example runs in at least:
> > * Chrome
> > * Firefox
> > * Internet Explorer 5.5+ (!!)
> > * Android browser
>
> > The code is on github:https://github.com/thegeez/clj-browserchannel-demo
>
> > Read the README for instructions on running and for further background
> > on the BrowserChannel protocol and capabilities.
>
> > Cheers,
> > Gijs Stuurmanhttp://twitter.com/thegeez/http://thegeez.github.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: New(er) Clojure cheatsheet hot off the presses

2012-03-28 Thread Andy Fingerhut
Just to follow up quickly, two possible ways have been suggested for doing 
this, but one way seems to require increasing the distance between words on the 
page, which I'd prefer not to do.  The other I haven't looked into in enough 
detail to see whether it will work, but I may do that soon.

As a potential workaround, would it suit your purposes nearly as well to make 
the font size larger?  That increases the area for which a particular tooltip 
shows up, at the cost of reducing how many symbols fit inside your browser 
window at one time.  Might be worth a try to see if you like it better.

Andy

On Mar 27, 2012, at 3:41 PM, Andy Fingerhut wrote:

> I would be happy to, if someone could teach me how to do it.  I didn't write 
> the JavaScript that does the tooltips -- I just took the TipTip jQuery plugin 
> and bashed away at it slightly until it did what I wanted.  I've tried using 
> "keepAlive: true" in the options it already implements to see if it does what 
> you want, but that behaves very strangely in my testing on Firefox 11.0 (see 
> [1] if you are curious).  I'm new to JavaScript, so what is possible to do 
> and how to do it are still mostly mysteries to me.
> 
> [1] 
> https://github.com/jafingerhut/clojure-cheatsheets/blob/master/src/clj-jvm/cheatsheet_files/jquery.tipTip.js
> 
> Andy
> 
> On Mar 27, 2012, at 10:22 AM, Mark wrote:
> 
>> Love the new cheatsheet!  Because no good deed go unpunished:  Can you make 
>> hiding the popup a little less sensitve?  I find myself looking at a popup 
>> and then unconsciously moving the mouse into the popup text and that causes 
>> the popup to disappear.

-- 
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: Can "lein install" create checksum (MD5, SHA-1) files?

2012-03-28 Thread Phil Hagelberg
On Tue, Mar 27, 2012 at 9:41 PM, Julien Chastang
 wrote:
> I have Clojure project artifacts that are not in a public Maven repository,
> but simply in a local repository (so-called unmanaged dependencies). When
> pushing a project to Heroku, Heroku will attempt to install the local
> dependencies from a Maven repository that is bundled with your project. See
> https://devcenter.heroku.com/articles/local-maven-dependencies. If the
> artifacts do not contain checksum files, they are ignored by the
> installation process, or at the very least you get pesky warnings about
> this. (The whole unmanaged dependency Heroku deployment is fragile, and took
> me a while to get right.)

OK, I see. I've been working on a better approach to private
dependencies, but it's not very well documented yet.

The gist of it is to get the dependencies into a repository hosted on
a private S3 bucket. Getting them out there is pretty easy once you
have an AWS account; just follow the steps on
https://github.com/technomancy/s3-wagon-private and do "lein deploy"
once you've added the bucket to :repositories with an s3p:// URL.

Then on Heroku you'll need to switch on the build-time config flag:
https://devcenter.heroku.com/articles/labs-user-env-compile followed
by adding your AWS credentials as config vars:

$ heroku config:add AWS_ACCESS_KEY=[...] AWS_SECRET_KEY=[...]

Then you need to pull in the latest revision of the Clojure buildpack
as it's still a relatively new feature:

$ heroku config:add
BUILDPACK_URL=http://github.com/heroku/heroku-buildpack-clojure.git

Then check in a file under .lein/init.clj that sets leiningen-auth
using System/getenv:

(def leiningen-auth {"s3p://secret-bucket/releases"
 {:username (System/getenv "AWS_ACCESS_KEY")
  :passphrase (System/getenv "AWS_SECRET_KEY")}})

I hope to have this better documented soon. Let me know if you have
any issues with it.

-Phil

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


Re: Using the Clojure Logo

2012-03-28 Thread Daniel Gagnon
On Wed, Mar 28, 2012 at 1:40 PM, Chip Collier  wrote:

> I was also intending on using the logo in such a way to communicate that
> a site I'm building is "powered by clojure" or something to that effect
> with a link to clojure.org. Is that frowned upon?
>
> Chip


Unfortunately, trademark laws are written in such a way that allowing this
risk making Rich lose his trademark. If he knows about it, he must put a
stop to it otherwise he can't claim to own the trademark. This is quite
different from copyrights where you are the author no matter what.

Most projects get around that with an officially endorsed "powered by"
graphic for such purposes.

-- 
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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Timothy Baldridge
>>is there a use case behind apply being lazy when Clojure is otherwise a 
>>strictly evaluating language

In clojure-py we have to pass vararg arguments as tuples. So it ends
up a lot like

(to-tuple (concat args seqarg))

I always saw the seq argument in IFn as a crutch to get around the "we
have too many vars to pass to this function" problem. Basically, since
the JVM doesn't support lazy varargs, Clojure doesn't either.


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


Polymorphic namespaces?

2012-03-28 Thread Chris McBride
I was wondering how dependency injection is done in Clojure since functions 
live in static namespaces. It seems like this could be achieved by having a 
macro that can use runtime information to determine the mapping between a 
namespace and its implementation. Does this make sense? Is there a better 
way to dependency injection in Clojure?

-- 
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: Alternate set literal syntax?

2012-03-28 Thread Timothy Baldridge
Let's take a step back and look at this idea from a new user's view.
The way I see it, whatever we do, we'll have to explain to users how
to create sets. Hashmaps, and vectors follow (roughly) the JSON/Python
syntax:

vector = [1 2 3 4]
map = {1 2 3 4}

So how to these languages represent sets?

Python does it via extra syntax sugar:

set = {"foo", "bar"}
map = {"foo": "bar", "foo2" : "bar2"}

I think the thing we have to keep in mind is that I can't think of a
single other language that has set literals. So whatever we come up
with will be a bit bizzare to new users. So let's look at the options
given above:

{{"foo"}}  ;; looks like a hash of a hash
<{"foo"}> ;; could work, but no other form in all of clojure has two
forms at the end.
#{"foo"} ;; not exactly pretty

My thoughts are this...who actually uses the literal hash set? In the
thousands of lines of Clojure code I've written a hash set once. So my
first reaction is why have a literal at all? Why not use:

On top of that, lets say we do want a literal syntax...if we have to
teach some bizarre syntax that people will rarely use...what's the big
difference between #{} and <{}> ?

If we want to actually go back to the original lisps, they didn't have
any special syntax at all, besides the quote literal. This isn't
ruby/python/C#. If something can be implemented without syntactic
sugar, most times it should be. So my question for Cedric is...why all
the fuss about set? Why not just use (set ["foo", "bar"]) it's clean,
and makes plenty of sense to newbies.

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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Nathan Sorenson
Actually now that I've thought about it, you couldn't mimic non-strict 
evaluation with lazy apply, so that's not a use-case. All you could provide 
is left-to-right argument non-strictness which is not sufficient. W.r.t. 
your example,  you can force evaluation the first 3 args, but you can't, 
say, force the evaluation of only the 3rd argument like in Haskell.

I use apply to leverage list processing functions to massage input to 
functions that are generally non-seq-ey. If a function is intended to 
operate on lazy sequences, it seems to me that you would pass those 
sequences in as explicit arguments, in the same manner as all the Clojure 
seq operations.

Again, we don't have the machinery to mimic non-strict evaluation so I 
don't think building functions that behave in this halfways-non-strict 
manner is obvious design. I'd like to see a function that depends on the 
left-to-right-non-strictness that lazy apply provides.

-- 
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: Using the Clojure Logo

2012-03-28 Thread Chip Collier
I was also intending on using the logo in such a way to communicate that
a site I'm building is "powered by clojure" or something to that effect
with a link to clojure.org. Is that frowned upon?

Chip


On 3/28/12 5:37 AM, Dimitrios wrote:
> On 28/03/12 13:12, Stuart Sierra wrote:
>> Rich Hickey holds the copyright on the Clojure logo design, and it's
>> not under an open-source license.
>>
>> He has asked that the logo not be used to refer to anything except
>> the language itself.
>
> Does that mean it can be used freely by anyone
> (presentations/web-sites etc) as long as it refers to Clojure itself?
>
> Jim
>




signature.asc
Description: OpenPGP digital signature


Re: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Nathan Sorenson
Your right the core apply is lazy too. The same question still remains: is 
there a use case behind apply being lazy when Clojure is otherwise a 
strictly evaluating language? Perhaps is this the intended mechanism to 
smuggle non-strictness into evaluation?

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Ram Krishnan
On Wednesday, March 28, 2012 at 9:15 AM, Shantanu Kumar wrote:
> 
> 
> On Mar 28, 8:57 pm, Ram Krishnan http://gmail.com)> 
> wrote:
> > Did you just need the name of the function? something like this?
> 
> 
> Sorry, I should explained using code what I am looking for:
> 
> (defmacro find-name []
> ;; some magic here
> ..)
> 
> (defn foo []
> ..
> (println (find-name)) ; should print "foo"
> ..)
> 
> I am looking for a way to write the `find-name` macro. So, you can see
> I want to use it with regular functions defined using `defn`.
> 
> 

If you can't use a specialized `defn` you could try something like the 
following, assuming that you need this for just a temporary while (say during 
development):

>88<

(def ^{:dynamic true} *myself* nil)
(defn find-name [] *myself*)

(defmacro trace [sym]
  `(let [old# ~sym]
 (def ~sym (fn [& args#]
 (binding [*myself* '~sym]
   (apply old# args#))

(defn foo [a b] [(find-name) (+ a b)])

(foo 1 2) => [nil 3]

(trace foo)

(foo 1 2) => [foo 3]

>88<

It requires you explicitly `trace` the functions within which you want to call 
`find-name`, otherwise the name will just be `nil`.
> 
> 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 
> (mailto: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 
> (mailto: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: Alternate set literal syntax?

2012-03-28 Thread Devin Walters


'(Devin Walters)


On Tuesday, March 27, 2012 at 8:54 PM, Cedric Greevey wrote:

> On Tue, Mar 27, 2012 at 3:05 PM, Herwig Hochleitner
> mailto:hhochleit...@gmail.com)> wrote:
> > 2012/3/26 Cedric Greevey mailto:cgree...@gmail.com)>:
> > > (comp <{:k1 5 :k2 6}), that is not used in production whereas (comp <
> > > {:k1 5 :k2 6}) (note spacing) is used in production but isn't broken.
> > > 
> > 
> > 
> > (comp <{:k1 5 :k2 6}) _is_ used in Production,
> 
> Without a space right after the  
> > > > Without even showing a page of code using said new syntax, let alone
> > > > make an effort to enumerate cases where it would break.
> > > > 
> > > 
> > > 
> > > I did in fact make such an effort, which should also have been clear
> > > from an earlier post.
> > > 
> > 
> > 
> > Not in your initial post and none of the latter ones, as far as I saw
> > while skimming.
> > 
> 
> 
> If you're not very good at skimming without missing important points,
> just set aside some time at some point and read it thoroughly.
> 
> > > > Furthermore you don't seem to recognize the gravity of those issues
> > > 
> > > The only issue arguably possessing substantial gravity is the
> > > oddly-spaced (comp <{:k1 5 :k2 6}) and similar.
> > > 
> > 
> > 
> > That statement is arguably wrong.
> 
> And I am arguably a butterfly dreaming I'm a man. But it's a
> hypothesis of no real practical import.
> 
> > - Hacking a second pass into the compiler (the single pass compiler is
> > a feature)
> > 
> 
> 
> Avoided by <{...}> (or <[...]>).
> 
> > - Breaking existing conventions
> 
> I disagree that adding a syntax (without removing #{}) is "breaking" a
> convention. On the other hand, allowing sets to be specified with a
> symmetric delimiter pair arguably is UNbreaking a convention.
> 
> > - Dual end tokens (the reason i chose lisp is, that I don't want to
> > bother with foo.bar(); note the _);_ ). Yes, this makes a difference
> > when you edit your program.
> > 
> 
> 
> But you don't mind dual start tokens, or you'd object to #{. Seems
> you're being fairly arbitrary there.
> 
> > Lisp is about prefix notation.
> 
> I don't see what bearing this has. Moreover, Lisp is many things to
> many people. Others would say Lisp is about lambdas; still others,
> that Lisp is about macros; and of course many would say Lisp is about
> list processing.
> 
> > - Adding duplicate reader syntax (the only other place we've done that
> > is #^, which is deprecated and where nobody liked the original syntax,
> > esp. in combo with type hinting) (the other examples you gave, e.g.
> > deref vs @ were the reader macro vs the form into which it gets
> > translated)
> > 
> 
> 
> Duplicate syntax is duplicate syntax. Your reader vs. other
> distinction is an artificial one.
> 
> > - Introducing a new reader table (i.e. a prefix character that
> > switches the reader mode) for '{', '<', or whichever you choose. right
> > now the '#' is the only reader table and it is an important visual
> > indicator for "here, the reader inserts a datatype determined by the
> > next character" [or few characters, since we have tagged literals])
> > 
> 
> 
> And this is just plain wrong. There must be a reader table for the
> default case as well as a secondary one activated for the next token
> by #. Also, there's nothing inherently icky about adding one more.
> Furthermore, the notion that # indicates "here, the reader inserts a
> datatype determined by what's next" is ... a simplification, at best.
> #^, though deprecated, still exists and attaches metadata rather than
> deciding a datatype. #_ comments out the following form rather than
> deciding a datatype (and can't really be interpreted as making what
> follows some sort of "do nothing" datatype; (two-arg-fn 1 #_2 3) won't
> throw bad arity). #' suppresses lookup of a var's contents, so the
> form is the var itself instead of whatever's inside it. In fact, #{,
> #", and arguably #( are the ones that do specify a datatype, and do
> not outnumber the others.
> 
> > > I offer(ed) my ideas for free.
> > 
> > Yes you can _offer_ them for free. Which doesn't mean we can
> > _implement_ them for free.
> > 
> 
> 
> Nobody claimed otherwise. You, on the other hand, erroneously implied
> that I was charging or costing you money.
> 
> > Also, getting your idea implemented is
> > valued very highly in this community, even if you get no money.
> > 
> 
> 
> How is that relevant to the question of price? In fact by your own
> admission ("even if you get no money") it's orthogonal to the question
> of price, and therefore *not* relevant.
> 
> > > Are you implying that you think I don't have a coherent view?
> > 
> > I only implied that you didn't _demonstrate_ it (please read)
> 
> Now you're implying that I lack reading comprehension skills. Please
> stop being gratuitously insulting and rude. And please stop implying
> things about me that are untrue.
> 
> > > Because such an implication would be both factually false and an insulting
>

Re: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Steve Miner
I don't know how to get the fn name at runtime, except by looking at the 
stacktrace which is going to expensive as you mentioned.

;; original:
;; 
http://groups.google.com/group/clojure/browse_thread/thread/234ac3ff0a4b6b80?pli=1
;; but slightly changed for Clojure updates since 1.0

(defn unmangle
"Given the name of a class that implements a Clojure function, returns the 
function's name in Clojure. Note: If the true Clojure function name
contains any underscores (a rare occurrence), the unmangled name will
contain hyphens at those locations instead."
  [class-name]
  (.replace
   (clojure.string/replace class-name #"^(.+)\$([^@]+)(|@.+)$" "$1/$2")
   \_ \-))

;; only appropriate for debugging
(defmacro current-fn-name []
  "Returns a string, the name of the current Clojure function"
  `(-> (Throwable.) .getStackTrace first .getClassName unmangle))


If you have control over the source code, defining your own version of defn 
will work better.  I choose %0 as my local symbol for the fn name, inspired by 
the convention for args to anonymous functions.  I found this useful for some 
pre-conditions and error-reporting.

;; %0 is bound to the function's name within the function.
(defmacro defn0 [name & fdcls]
  `(let [~'%0 (symbol (name (ns-name *ns*)) (name '~name))]
 (defn ~name ~@fdcls)))


Steve Miner
stevemi...@gmail.com


On Mar 28, 2012, at 11:02 AM, Shantanu Kumar wrote:

> Hi,
> 
> Is it possible to write a macro that when used in a top-level function
> (created using defn) can find out the name of the immediate top-level
> function? I know *ns* returns the namespace and it's possible to walk
> the current thread's stack trace to find out the function name, but I
> am looking for a computationally cheap way to do it.
> 
> Thanks,
> 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

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Rostislav Svoboda
> Sorry, I should explained using code what I am looking for:

Oh yea!!!

> (defmacro find-name []
>  ;; some magic here
>  ..)
>
> (defn foo []
>  ..
>  (println (find-name)) ; should print "foo"
>  ..)
>
> I am looking for a way to write the `find-name` macro. So, you can see
> I want to use it with regular functions defined using `defn`.

you may start here
https://groups.google.com/forum/?fromgroups#!topic/clojure/RZIFCLWNKuk
and especially - take a look at the macro written by Henk Boom in that thread:

(defmacro nlet [name args & body]
(let [arg-names (take-nth 2 args)
  arg-inits (and args (take-nth 2 (rest args)))]
  `((fn ~name [~@arg-names] ~@body) ~@arg-inits)))

-- 
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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Shantanu Kumar


On Mar 28, 8:57 pm, Ram Krishnan  wrote:
> Did you just need the name of the function? something like this?

Sorry, I should explained using code what I am looking for:

(defmacro find-name []
  ;; some magic here
  ..)

(defn foo []
  ..
  (println (find-name)) ; should print "foo"
  ..)

I am looking for a way to write the `find-name` macro. So, you can see
I want to use it with regular functions defined using `defn`.

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: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Ram Krishnan
Did you just need the name of the function? something like this?

>88<

(def ^{:dynamic true} *myself* nil)

(defmacro defn* [name args & body]
  `(defn ~name ~args
 (binding [*myself* '~name]
   ~@body)))

(defn* foo [a b] [*myself* (+ a b)])

>88<

This is, of course, quite ugly and grossly oversimplified, but would work for a 
limited use case.

Cheers,

-ram 


On Wednesday, March 28, 2012 at 8:02 AM, Shantanu Kumar wrote:

> Hi,
> 
> Is it possible to write a macro that when used in a top-level function
> (created using defn) can find out the name of the immediate top-level
> function? I know *ns* returns the namespace and it's possible to walk
> the current thread's stack trace to find out the function name, but I
> am looking for a computationally cheap way to do it.
> 
> Thanks,
> 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 
> (mailto: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 
> (mailto: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

Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Shantanu Kumar
Hi,

Is it possible to write a macro that when used in a top-level function
(created using defn) can find out the name of the immediate top-level
function? I know *ns* returns the namespace and it's possible to walk
the current thread's stack trace to find out the function name, but I
am looking for a computationally cheap way to do it.

Thanks,
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: Appcache

2012-03-28 Thread Murphy McMahon
I never saw an appcache file automatically generated in ClojureScript
One, but if you want an example of how to implement serving the cache
manifest for offline use of your webapp, this repo of mine (branched
from one master) has one:

https://github.com/pandeiro/multiedit/blob/multi-edit/src/app/clj/one/sample/dev_server.clj#L83


On Sun, Mar 25, 2012 at 9:17 AM, Pierre-Henry Perret  wrote:
> How to disable/enable the appcache in One ?
>
> This is related to a manifest cache which is present in the root folder of
> the application.
> But in One, it seems to be automatically generated...
>
>
> --
> 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: New(er) Clojure cheatsheet hot off the presses

2012-03-28 Thread David Martin
There is a jquery plugin called "hoverintent" which accomplishes this.
http://cherne.net/brian/resources/jquery.hoverIntent.html

-Dave

On Tue, Mar 27, 2012 at 3:41 PM, Andy Fingerhut wrote:

> I would be happy to, if someone could teach me how to do it.  I didn't
> write the JavaScript that does the tooltips -- I just took the TipTip
> jQuery plugin and bashed away at it slightly until it did what I wanted.
>  I've tried using "keepAlive: true" in the options it already implements to
> see if it does what you want, but that behaves very strangely in my testing
> on Firefox 11.0 (see [1] if you are curious).  I'm new to JavaScript, so
> what is possible to do and how to do it are still mostly mysteries to me.
>
> [1]
> https://github.com/jafingerhut/clojure-cheatsheets/blob/master/src/clj-jvm/cheatsheet_files/jquery.tipTip.js
>
> Andy
>
> On Mar 27, 2012, at 10:22 AM, Mark wrote:
>
> Love the new cheatsheet!  Because no good deed go unpunished:  Can you
> make hiding the popup a little less sensitve?  I find myself looking at a
> popup and then unconsciously moving the mouse into the popup text and that
> causes the popup to disappear.
>
> On Monday, March 26, 2012 2:25:17 PM UTC-7, Andy Fingerhut wrote:
>>
>> Welcome, Pierre.
>>
>> Thanks for the info.  My current thinking is to start publishing on
>> clojure.org two, or maybe even three versions of the cheatsheet:
>>
>> (1) no tooltips, just like the one published now, in case people find
>> them annoying:
>> http://clojure.org/cheatsheet
>>
>> (2) tooltips with the title attribute, for those that prefer
>> web-standards-compliant pages, such as this one:
>> http://homepage.mac.com/**jafingerhut/files/cheatsheet-**
>> clj-1.3.0-v1.4-tooltips/**cheatsheet-title-attribute.**html
>>
>> (3) tooltips using a modified TipTip jQuery plugin tool, for people like
>> me who like its look & feel better than (2).
>> http://homepage.mac.com/**jafingerhut/files/cheatsheet-**
>> clj-1.3.0-v1.4-tooltips/**cheatsheet-full.html
>>
>> The nice thing is that all three of these are currently generated from
>> the same program.  Not only are those three pages generated, but also
>> several variations of A4-size and US letter-size PDF files, with links (but
>> no tooltips in the PDF -- I don't know how to do that if it is even
>> possible).  So far, it is still pretty straightforward for me to add a new
>> symbol or category to the cheatsheet, and regenerate all of these things in
>> a minute.
>>
>> There shouldn't need to be any argument over which of these should be
>> "the one".  I say publish them all, with an easy way to get from one
>> version to another in case you change your mind which one you want to use.
>>
>> And if I am stretching what a tooltip is meant to be, and thereby join
>> the ranks of web-standards-heathens who stretch the original intent of
>> these mechanisms, I do so proudly :-)
>>
>> Andy
>>
>> On Mar 25, 2012, at 10:36 PM, Pierre Mariani wrote:
>>
>>
>>
>> On Saturday, March 24, 2012 11:59:49 PM UTC-7, Andy Fingerhut wrote:
>>>
>>> I've tried again using links with doc strings as the values of the title
>>> attribute, but when the text in Firefox 11.0 it does not honor the line
>>> breaks in my text, but reflows it.  Try it out yourself at [1]:
>>>
>>> [1] http://homepage.mac.com/​**jafingerhut/files/cheatsheet-​**
>>> clj-1.3.0-v1.4-tooltips/​**cheatsheet-title-attribute.​**html
>>>
>>> Is there a way that Firefox will let me specify where line breaks should
>>> go?  If I put  or  tags in the text of a title attribute, those
>>> just show up literally in the text that the browser displays in the tool
>>> tip.  I have line breaks in the title attribute value in my HTML, but
>>> Firefox seems to be ignoring those.
>>>
>>> Safari and Chrome seem to honor the line breaks in the title attribute,
>>> but they make the popup windows so narrow that the lines break in the
>>> middle, in addition to where I put my line breaks, which is better but not
>>> great.  Is there a way to tell the browser to make the popup windows wider?
>>>
>>> Andy
>>>
>> This is my first post to the list, so hi everybody!
>>
>> Andy,
>>
>> Tooltips are being rendered by the browser itself and you cannot control
>> their aspect with HTML or CSS.
>> This bug 
>> https://bugzilla.mozilla.org/**show_bug.cgi?id=358452seems
>>  to be related to your issue, and it indicates that the behavior you
>> are looking for should be implemented in FF12. Unfortunately, that doesn't
>> fix it for other browsers, or older versions of FF.
>>
>> Sorry if it sounds critical and isn't very helpful at this stage, but I
>> think

Re: Using the Clojure Logo

2012-03-28 Thread Dimitrios

On 28/03/12 13:12, Stuart Sierra wrote:
Rich Hickey holds the copyright on the Clojure logo design, and it's 
not under an open-source license.


He has asked that the logo not be used to refer to anything except the 
language itself.


Does that mean it can be used freely by anyone (presentations/web-sites 
etc) as long as it refers to Clojure itself?


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: Using the Clojure Logo

2012-03-28 Thread Stuart Sierra
Rich Hickey holds the copyright on the Clojure logo design, and it's not 
under an open-source license.

He has asked that the logo not be used to refer to anything except the 
language itself.

-S


On Monday, March 26, 2012 10:33:39 AM UTC-4, Marco Dalla Stella wrote:
>
> Hi,
>
> We would like to use the Clojure logo for our new Italian Clojure User 
> Group.
> Can we have the permission to use a modified version like the one attached?
> If not, we will use the standard Clojure logo (if permitted).
>
> TIA,
> -- 
> Marco Dalla Stella
> web: http://thediracsea.org
> twitter: http://twitter.com/kra1iz3c
>
>

-- 
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-browserchannel-demo, cljs <-> clj communication

2012-03-28 Thread Gijs S.
Here is the chat app on Heroku:

http://cold-stream-6156.herokuapp.com/index.html

-Gijs

On Mar 28, 1:39 pm, "Gijs S."  wrote:
> Hi,
>
> clj-browserchannel-demo demonstrates cross-browser compatible, real-
> time, bi-directional communication between ClojureScript and Clojure
> using Google Closure BrowserChannel.
>
> From the Google Closure API: "A BrowserChannel simulates a
> bidirectional socket over HTTP. It is the basis of the Gmail Chat IM
> connections to the server."
> The javascript api of BrowserChannel is open-source and part of the
> Google Closure library. The server component is not, as is noted in
> the Google Closure book ("Closure: The Definitive Guide by Michael
> Bolin").
>
> clj-browserchannel-demo is an example chat application using a server
> side implementation for BrowserChannel written in Clojure. The server
> component is for BrowserChannel version 8.
>
> This enables client->server and server->client communication in
> ClojureScript and Closure web apps, without any javascript
> dependencies other than the Google Closure library.
>
> The chat example runs in at least:
> * Chrome
> * Firefox
> * Internet Explorer 5.5+ (!!)
> * Android browser
>
> The code is on github:https://github.com/thegeez/clj-browserchannel-demo
>
> Read the README for instructions on running and for further background
> on the BrowserChannel protocol and capabilities.
>
> Cheers,
> Gijs Stuurmanhttp://twitter.com/thegeez/http://thegeez.github.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: clj-browserchannel-demo, cljs <-> clj communication

2012-03-28 Thread Gijs S.
Hi,

clj-browserchannel-demo demonstrates cross-browser compatible, real-
time, bi-directional communication between ClojureScript and Clojure
using Google Closure BrowserChannel.

>From the Google Closure API: "A BrowserChannel simulates a
bidirectional socket over HTTP. It is the basis of the Gmail Chat IM
connections to the server."
The javascript api of BrowserChannel is open-source and part of the
Google Closure library. The server component is not, as is noted in
the Google Closure book ("Closure: The Definitive Guide by Michael
Bolin").

clj-browserchannel-demo is an example chat application using a server
side implementation for BrowserChannel written in Clojure. The server
component is for BrowserChannel version 8.

This enables client->server and server->client communication in
ClojureScript and Closure web apps, without any javascript
dependencies other than the Google Closure library.

The chat example runs in at least:
* Chrome
* Firefox
* Internet Explorer 5.5+ (!!)
* Android browser

The code is on github: https://github.com/thegeez/clj-browserchannel-demo

Read the README for instructions on running and for further background
on the BrowserChannel protocol and capabilities.

Cheers,
Gijs Stuurman
http://twitter.com/thegeez / http://thegeez.github.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: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Alan Malloy
On Mar 27, 11:51 pm, Nathan Sorenson  wrote:
> When trawling the ClojureScript source, I was a little puzzled when I first
> noticed that cljs.core/apply respects the laziness of the seq its provided.
> Fogus mentioned this feature in his Clojure/west talk and it reminded me of
> my earlier puzzlement.
>
> This choice seems to contradict Clojure's eager argument evaluation
> semantics. Is the motivation of this choice described anywhere? I'm
> guessing I am missing an obvious use case.

You've misunderstood how clojure.core/apply behaves - it passes
sequences lazily as well. For example, (apply (fn f [& args] (take 3
args)) (range)) works fine, even though you pass an infinite number of
arguments to f.

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