protocols and interfaces

2012-02-10 Thread drewn
I've just started learning protocols, deftype, etc.  The first thing I
did was try to extend a Clojure type (maps) to operate as a
specialized Java Swing interface (AttributeSet), forgetting that
interfaces are not protocols; i.e.

(extend-type clojure.lang.PersistentArrayMap
  javax.swing.text.AttributeSet
  (getAttribute [this k]
(get this k)))

Is there any way of doing what is intended here: get Clojure maps to
implement Java's AttributeSet?  I've seen Chas Emerick's flowchart,
but I'm still trying to wrap my head around all the choices.

Thanks, Andrew

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


Re: Persistent collections and garbage collection

2012-02-10 Thread pron
And have you profiled the objects making it to the old generation 
(requiring/causing the full GC)? Are persistent collection nodes a 
significant part of those?

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

Call for Papers: European Lisp Symposium 2012, Zadar, Croatia

2012-02-10 Thread Marco Antoniotti
European Lisp Symposium 2012, Zadar, Croatia, April 30th - May 1st, 2012

PAPER SUBMISSION DEADLINE APPROACHING

http://european-lisp-symposium.org

The purpose of the European Lisp Symposium is to provide a forum for
the discussion and dissemination of all aspects of design,
implementation and application of any of the Lisp and Lisp-inspired
dialects, including Common Lisp, Scheme, Emacs Lisp, AutoLisp, ISLISP,
Dylan, Clojure, ACL2, ECMAScript, Racket, SKILL, and so on. We
encourage everyone interested in Lisp to participate.


The main theme of the 2012 European Lisp Conference is
Interoperability: Systems, Libraries, Workflows.  Lisp based and
functional-languages based systems have grown a variety of solutions
to become more and more integrated with the wider world of Information
and Communication Technologies in current use.  There are several
dimensions to the scope of the solutions proposed, ranging from
embedding of interpreters in C-based systems, to the development of
abstractions levels that facilitate the expression of complex context
dependent tasks, to the construction of exchange formats handling
libraries, to the construction of theorem-provers for the Semantic
Web.  The European Lisp Symposium 2012 solicits the submission of
papers with this specific theme in mind, alongside the more
traditional tracks which have appeared in the past editions.

We invite submissions in the following forms:

Papers: Technical papers of up to 15 pages that describe original
results or explain known ideas in new and elegant ways.

Demonstrations: Abstracts of up to 4 pages for demonstrations of
tools, libraries, and applications.

Tutorials: Abstracts of up to 4 pages for in-depth presentations about
topics of special interest for at least 90 minutes and up to 180
minutes.

Lightning talks: Abstracts of up to one page for talks to last for no
more than 5 minutes.

All submissions should be formatted following the ACM SIGS guidelines
and include ACM classification categories and terms. For more
information on the submission guidelines and the ACM keywords, see:
http://www.acm.org/sigs/publications/proceedings-templates and
http://www.acm.org/about/class/1998.


Important dates:

February 15th 2012: submission deadline (extended deadline)
March 7th 2012: acceptance results

April 30th 2012: Conference opens


Program Commitee.
Chair:
Marco Antoniotti, Università degli Studi di Milano Bicocca, Milan, ITALY

Local organizers:
Damir Ćavar, Eastern Michigan University
Franjo Pehar, University of Zadar
Damir Kero, University of Zadar

Members:
Giuseppe Attardi, Università degli Studi di Pisa, Pisa, ITALY
Pascal Costanza, Intel, Bruxelles, BELGIUM
Marc Feeley, Universitè de Montreal, Montreal, CANADA
Scott McKay, Google, U.S.A.
Kent Pitman, U.S.A.
Christophe Rhodes, Department of Computing, Goldsmiths, University of 
London, London, UNITED KINGDOM
Robert Strandh, LABRI, Universitè de Bordeaux, Bordaux, FRANCE
Didier Verna, EPITA / LRDE, FRANCE
Taiichi Yuasa, Kyoto University, JAPAN

-- 
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 CDT up, cont, down, local-names throws arity errors after hitting breakpoint

2012-02-10 Thread Sean Neilan
On Thu, Feb 9, 2012 at 8:20 PM, Phil Hagelberg p...@hagelb.org wrote:

 Sean Neilan s...@seanneilan.com writes:

  It's on the github page at the top.

 Forgive me if I'm slow, but I can't find it. Can you be more specific?

 The canonical page for swank-clojure is
 https://github.com/technomancy/swank-clojure


Sorry about that. Yes, the swank-clojure github page, on the readme under
the Usage heading. It says to install.. wait.. nevermind, it says to
install clojure-mode from the repo.

OK, that's my bad. I misread directions.


 Are you talking about instructions for using swank-clojure.el or
 something else?


I think I meant for using swank-clojure.el.


  It does say to use 1.3.4 over here:
  http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
  That's definitely one of the things I got confused on. As a noob, I
  take dev.clojure.org as gospel since it's part of clojure.org.

 Yes, that was a bit confusing because development on 1.4.0 was blocked
 on getting a stable version of the cdt debugger released, so we went
 back to working on 1.3.x for a while. But that's no longer an issue.



I understand now. There's a lot of information out there still. All the
extra info confused me. I now know that the swank-clojure github page is
the canonical page.


 -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: protocols and interfaces

2012-02-10 Thread Stuart Sierra
Nope, can't be done. Java interfaces can't do this.

Java 8 may have Interface Injection which will make this possible.
-S

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

Re: Clojure on PyPy

2012-02-10 Thread Timothy Baldridge
 I have some set of algorithms that needs such-and-such operations to
be as fast as possible. Can I create a VM that is tailored for that?

Yes, this is basically what PyPy does for Regexes, they have a custom
regex engine that has can_enter_jit in it. So basically what you get
is a jitted regex engine. The results are astounding:
http://morepypy.blogspot.com/2010/06/jit-for-regular-expression-matching.html
They show a 8x speed improvement over the Java Regex engine. Now for
core.logic...that's a bit of a different story.

The thing about tracing JITs is that they excel at making small tight
loops extremely efficient, so depending on the implementation of
core.logic, that may or may not apply.


It would be pretty impressive if one could parameterize the VM space,
and access different parts of that space within a contiguous clojure
program.

So that's a bit hard due to the way PyPy implements types...or
doesn't. PyPy does not define what a type is at all. Instead it leaves
the typing system open to the developer of the interpreter. So a C#
interpreter may define a type's vtable as a list, and use ids to
figure out what method to run, or a Python jit may just use a
dictionary to look up a method on a given type. Because of this, the
JIT really has no way to perform interop between two types. On top of
that, PyPy does not allow loading any modules at runtime. All interop
with outside libs must be through FFI (like ctypes in Python). So
actually the standard library in pypy is 100% pure python code that
makes FFI calls to C Libraries. In CPython, there is a mixture of C
and Python code.

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: Persistent collections and garbage collection

2012-02-10 Thread Armando Blancas
Not sure if I understand your concern since I wonder how's that
different from, say, some ephemeral Java collection that happens to be
around after a given generational threshold and then becomes
unreachable.

On Feb 10, 4:01 am, pron ron.press...@gmail.com wrote:
 And have you profiled the objects making it to the old generation
 (requiring/causing the full GC)? Are persistent collection nodes a
 significant part of those?

-- 
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: protocols and interfaces

2012-02-10 Thread drewn
 Nope, can't be done. Java interfaces can't do this.

I'm glad I asked the question.  Given that it can't be done, any
suggestions for the best way of handling this interop scenario?

-- 
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: protocols and interfaces

2012-02-10 Thread Aaron Cohen
On Fri, Feb 10, 2012 at 3:13 AM, drewn naylor...@gmail.com wrote:
 I've just started learning protocols, deftype, etc.  The first thing I
 did was try to extend a Clojure type (maps) to operate as a
 specialized Java Swing interface (AttributeSet), forgetting that
 interfaces are not protocols; i.e.

 (extend-type clojure.lang.PersistentArrayMap
  javax.swing.text.AttributeSet
  (getAttribute [this k]
                (get this k)))

I think in this case you should be able to use proxy, maybe.

user= (defn attribute-list [map] (proxy [javax.swing.text.AttributeSet] []
 (getAttribute [k] (get map k

user= (.getAttribute (attribute-list {:a 1 :b 2}) :a)
1

-- 
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: Print only by clojure code

2012-02-10 Thread Simone Mosciatti
Hi Tassilo,

i tried your macro and its work perfectly, thank you.

On 9 Feb, 01:57, Tassilo Horn tass...@member.fsf.org wrote:
 Cedric Greevey cgree...@gmail.com writes:

 Hi Cedric,

  Just in case the java lib in fact uses System.out/err directly, one
  can redirect standard out and error to something else.

  (with-open [w (clojure.java.io/writer /dev/null)]
   (binding [*out* w, *err* w]
     (.noisyJavaCall1 1 2 3)
     (.noisyJavaCall2 3 2 1)))

  Of course, /dev/null is somewhat platform specific.

  Will that work? I was under the impession that binding *out* and *err*
  had no effect on System/out or System/err.

 No, it won't work.  I tested it briefly in a slime repl and forgot the
 fact that java sysouts aren't printed in there anyway.  So using your
 setOut/Err() advice, here's a java quitening macro that actually works:

 --8---cut here---start-8---
 (defmacro without-java-output [ body]
   `(with-open [w# (java.io.PrintStream. /dev/null)]
      (let [oo# System/out, oe# System/err]
        (System/setOut w#)
        (System/setErr w#)
        (try
          ~@body
          (finally
           (System/setOut oo#)
           (System/setErr oe#))

 (without-java-output
  (.println System/out Hello out)
  (.println System/err Hello err))
 --8---cut here---end---8---

 Bye,
 Tassilo

-- 
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: protocols and interfaces

2012-02-10 Thread Cedric Greevey
On Fri, Feb 10, 2012 at 1:07 PM, Aaron Cohen aa...@assonance.org wrote:
 On Fri, Feb 10, 2012 at 3:13 AM, drewn naylor...@gmail.com wrote:
 I've just started learning protocols, deftype, etc.  The first thing I
 did was try to extend a Clojure type (maps) to operate as a
 specialized Java Swing interface (AttributeSet), forgetting that
 interfaces are not protocols; i.e.

 (extend-type clojure.lang.PersistentArrayMap
  javax.swing.text.AttributeSet
  (getAttribute [this k]
                (get this k)))

 I think in this case you should be able to use proxy, maybe.

 user= (defn attribute-list [map] (proxy [javax.swing.text.AttributeSet] []
             (getAttribute [k] (get map k

 user= (.getAttribute (attribute-list {:a 1 :b 2}) :a)
 1

There's also defrecord:

(defrecord foo [my basis keys]
  the.JavaInterface
  (javaIfaceMethod [this foo] ...))

which will work in the specific case that you want a Clojure map that
implements a particular Java interface. Records behave partially as
Clojure maps. For more general mixins, proxy, reify, and deftype are
your friends, and even gen-class may be needed in some instances.

-- 
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: Print only by clojure code

2012-02-10 Thread Simone Mosciatti
Hi Tassilo,

i tried your macro and its work perfectly, thank you.

On 9 Feb, 01:57, Tassilo Horn tass...@member.fsf.org wrote:
 Cedric Greevey cgree...@gmail.com writes:

 Hi Cedric,

  Just in case the java lib in fact uses System.out/err directly, one
  can redirect standard out and error to something else.

  (with-open [w (clojure.java.io/writer /dev/null)]
   (binding [*out* w, *err* w]
     (.noisyJavaCall1 1 2 3)
     (.noisyJavaCall2 3 2 1)))

  Of course, /dev/null is somewhat platform specific.

  Will that work? I was under the impession that binding *out* and *err*
  had no effect on System/out or System/err.

 No, it won't work.  I tested it briefly in a slime repl and forgot the
 fact that java sysouts aren't printed in there anyway.  So using your
 setOut/Err() advice, here's a java quitening macro that actually works:

 --8---cut here---start-8---
 (defmacro without-java-output [ body]
   `(with-open [w# (java.io.PrintStream. /dev/null)]
      (let [oo# System/out, oe# System/err]
        (System/setOut w#)
        (System/setErr w#)
        (try
          ~@body
          (finally
           (System/setOut oo#)
           (System/setErr oe#))

 (without-java-output
  (.println System/out Hello out)
  (.println System/err Hello err))
 --8---cut here---end---8---

 Bye,
 Tassilo

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


Quicksort

2012-02-10 Thread nahiluhmot
Hello all,
I'm very new to clojure, so to familiarize myself I decided to try to
implement the quicksort.  My code looks like this:

(defn qsort
([] nil)
([list]
(let[piv(peek list)
f-half  (filter (fn [n] (= n piv)) 
(pop list))
s-half  (filter (fn [n] (  n piv)) (pop list))]
(concat (qsort f-half) (cons piv (qsort 
s-half))

This looks logical to me, but when I try to run it, I get the
following exception:

user= (qsort [4 1 3])
java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to
clojure.lang.IPersistentStack (NO_SOURCE_FILE:0)

I have tried wrapping a doall around the filter functions, and I get
the same error.

Thanks in advance!

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

2012-02-10 Thread Nathan Sorenson
Couple of things to watch out for, Clojure doesn't pattern match on the 
args in the way you seem to be expecting, so this will blow the stack (i.e. 
calling qsort with the empty list won't call the 0-argument method you have 
there.)

The error you're running into is that pop/peek isn't defined for lazy 
sequences. doall will force your lazy-sequence, but it's still of type 
LazySeq:

(type (lazy-seq [1 2 3]))
clojure.lang.LazySeq

So putting the base-case into an if/else branch, and switching pop/peek for 
rest/first would look like so:

(defn qsort 
  ([list] 
 (if (seq list)
   (let [piv (first list) 
 f-half (filter (fn [n] (= n piv)) (rest list)) 
 s-half (filter (fn [n] (  n piv)) (rest list))] 
 (concat (qsort f-half) (cons piv (qsort s-half
   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: Quicksort

2012-02-10 Thread Nathan Sorenson
Obviously the example of doall not being up to the task should read:

scratch (type (doall (lazy-seq [1 2 3])))
clojure.lang.LazySeq

-- 
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: novice question, performance surprise

2012-02-10 Thread Manuel Paccagnella

On 02/09/2012 11:40 PM, Steve Miner wrote:

filter is lazy so it won't actually do the work unless the values are needed.  
To get a reasonable time, you need to use the result for some computation.  Try 
something like this:

(defn sum-all [m] (reduce + (apply map + (vals m

(time (sum-all (separate-nums (range 1


It was pretty simple. I forgot laziness :/

I ran several times in a row both functions on the same sequence, and I 
obtained these timings (functional first, iterative second):


  Elapsed time: 3019.56405 msecs
  Elapsed time: 621.744839 msecs

  Elapsed time: 867.197906 msecs
  Elapsed time: 551.287444 msecs

  Elapsed time: 314.490382 msecs
  Elapsed time: 647.862119 msecs

  Elapsed time: 328.403288 msecs
  Elapsed time: 621.69671 msecs

  Elapsed time: 334.29854 msecs
  Elapsed time: 839.599691 msecs

  Elapsed time: 272.061383 msecs
  Elapsed time: 499.008063 msecs

The patterns seems to be this: initially the functional one is slower, 
but quickly begins to run about twice as fast as the iterative one.


Using instead a sequence of random numbers, I got a more stable result: 
in average the functional approach is slower than the iterative one.


I think the lesson here is this: use a functional approach, that way the 
code is easier to write, read, compose and reason about. If and when you 
need to optimize, one option is to rewrite some core functions in an 
iterative style. A plus here is that functional code is easier to profile.


--
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: protocols and interfaces

2012-02-10 Thread drewn
 There's also defrecord

I considered using that, but I need to do something more with the
constructor (e.g. convert the map into a Java array for internal
use).  Also, defrecords only takes positional arguments, which will be
hard to use with tens of arguments.  (An alternative is just to pass
in one argument as a map itself, but that seems to defeat the
purpose.)

On Feb 10, 10:32 am, Cedric Greevey cgree...@gmail.com wrote:
 On Fri, Feb 10, 2012 at 1:07 PM, Aaron Cohen aa...@assonance.org wrote:
  On Fri, Feb 10, 2012 at 3:13 AM, drewn naylor...@gmail.com wrote:
  I've just started learning protocols, deftype, etc.  The first thing I
  did was try to extend a Clojure type (maps) to operate as a
  specialized Java Swing interface (AttributeSet), forgetting that
  interfaces are not protocols; i.e.

  (extend-type clojure.lang.PersistentArrayMap
   javax.swing.text.AttributeSet
   (getAttribute [this k]
                 (get this k)))

  I think in this case you should be able to use proxy, maybe.

  user= (defn attribute-list [map] (proxy [javax.swing.text.AttributeSet] []
              (getAttribute [k] (get map k

  user= (.getAttribute (attribute-list {:a 1 :b 2}) :a)
  1

 There's also defrecord:

 (defrecord foo [my basis keys]
   the.JavaInterface
   (javaIfaceMethod [this foo] ...))

 which will work in the specific case that you want a Clojure map that
 implements a particular Java interface. Records behave partially as
 Clojure maps. For more general mixins, proxy, reify, and deftype are
 your friends, and even gen-class may be needed in some instances.

-- 
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: Persistent collections and garbage collection

2012-02-10 Thread Patrick Moriarty
Hi Ron,

I've profiled a 20k line Clojure application and have never seen anything like 
what you seem to be suggesting. It seems (though you've not been very clear) 
that you suspect that persistent collections may be holding references to nodes 
longer than necessary. That is, longer than a mutable collection would. My 
reading of the implementation suggests that this is not the case. Do you have 
any specific evidence or is this just a hunch? Any 'modifications' to a 
persistent collection return a new collection which may or may not share 
structure with the previous one. If you don't hold a reference to the previous 
version the collection and the unshared nodes become eligible for garbage 
collection. Am I missing something here?

Paudi

On 10 Feb 2012, at 15:56, Armando Blancas wrote:

 Not sure if I understand your concern since I wonder how's that
 different from, say, some ephemeral Java collection that happens to be
 around after a given generational threshold and then becomes
 unreachable.
 
 On Feb 10, 4:01 am, pron ron.press...@gmail.com wrote:
 And have you profiled the objects making it to the old generation
 (requiring/causing the full GC)? Are persistent collection nodes a
 significant part of those?
 
 -- 
 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: - and -

2012-02-10 Thread j1n3l0
You can always check out clojuredocs.org:

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

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

clojurescript why: (def ... is failing whereas (let ... succeeds

2012-02-10 Thread billh2233
I don't understand (def someVar (newInstantiatedGoogFxObject...)).
Why does (def someVar (new-goog-fx-object ...)) fail whereas (let
[somevar (new-goog-fx-object ...) ] works?

I'm trying to define a variable using def and instantiate a new
goog.fx.DragDrop, but this clojurescript:

(def dragSource (fx/DragDrop. myText stuff))

produces this javascript and resulting error:

dom.test.dragSource = (new goog.fx.DragDrop(myText,stuff));

--Uncaught TypeError: undefined is not a function

whereas the let-based version instantiates and executes just fine:

(defn run-draganddrop []
(let [dragSource (fx/DragDrop. myText stuff)]
...
)
)

---
Here is the actual source file:

(ns dom.test
  (:require [goog.fx   :as fx]
[goog.graphics :as graphics]
))

;FAILS in the browser. It requires the expression to be a function.
The expression is undefined.
;IMO the expression should produce a new object and should not be a
function.
(def dragSource (fx/DragDrop. myText stuff))

;SUCCEEDS.
(defn run-draganddrop []
  (let [dragSource (fx/DragDrop. myText stuff)]
  )
)

Thanks.  Bill

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