defs in Clojurescript REPL

2012-05-14 Thread Mark Engelberg
In Clojure, when you def a variable, the REPL prints the name of the
variable rather than the value.
In Clojurescript, when you def a variable, the REPL prints the value
assigned to the variable.

This is problematic when working with lazy values.  Is there any particular
reason the Clojurescript REPL is designed to behave in this way?

Thanks,

Mark

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

Re: How to configure a Clojure library at runtime?

2012-05-14 Thread Roberto Mannai
Instead of using alter-var-root you could use the binding form. On this
subject of factory methods you could find useful the following article,
expecially the with-implementation macro:

http://pragprog.com/magazines/2011-07/growing-a-dsl-with-clojure

IMHO that solution should not prevent the callers from instantiate
different implementations of the same generic API, even from the same
thread.

Cheers,
Roberto


On Sat, May 12, 2012 at 2:49 PM, James Thornton james.thorn...@gmail.comwrote:


 On Saturday, May 12, 2012 12:44:45 AM UTC-5, Baishampayan Ghose wrote:


 There are many ways of doing this. One approach that I have seen a lot
 is something like this -

 ;; core.clj

 (def ^:dynamic *settings* {:default :stuff}) ;; the default settings can
 be nil


 I was experimenting with the dynamic varr approach...

 ;; bulbs/neo4jserver/client.clj

 (def ^:dynamic *config* default-config)

 (defn set-config!
   [config]
   (alter-var-root #'*config* (fn [_] (merge default-config config

 (defn neo4j-client
   [ config]
   (set-config! (first config)))

 (neo4j-client {:root_uri http://localhost:7474/data/db/})

 (println *config*)


 ...but Andrew Cooke pointed out that using a global var would preclude you
 from being able to use multiple, independent graph instances in your
 program, whereas you can in the Python version (
 http://stackoverflow.com/questions/10540999/how-to-configure-a-clojure-library-at-runtime
 ).



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

Re: clojurescript error

2012-05-14 Thread Raju Bitter
I've compiled your code without problems in the CLJS REPL, and embedded in
a CLJS app I'm working on. Do you get the same bug when you evaluate your
code snippet using the script/repljs?

Raju

-- 
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: tracing cljsbuild error

2012-05-14 Thread Herwig Hochleitner
From the stacktrace and some source reading, it seems clj-stacktrace
passes null as class-name in clj-stacktrace.core/clojure-ns, which
passes it to a regex function.
That should not even be possible, because it passes the same value to
clj-stacktrace.core/clojure-code?, which would already throw, a few
lines before.
Also, the null value originates from StackTraceElement.getClassName()
which I'm not even sure is allowed to be null.

Maybe it was some funky state you got your JVM into. Can you reproduce
the error?

-- 
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: tracing cljsbuild error

2012-05-14 Thread Herwig Hochleitner
Also, are you running the latest version of clj-stacktrace?

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


Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread James
When a new technology (a programming language) comes out, initially
there are very few people who are really proficient in it. One can
learn by one's own, but tremendous learning acceleration can be gained
if one pairs with more experienced devs than oneself.

So I'd like to ask: is there any place in the world where I can pair
with more experienced people on Clojure as a beginner? Put very
shortly, I have: decent Ruby skills; some Rails experience; very good
OO, TDD, and business modeling skills; a mastery of web standards, and
experience with Responsive Web Design. I'm into web as platform,
HTML5, apps, and that kind of stuff.

I'm currently based in Denmark but am flexible with moving.

Cheers,
James
http://jamesabbottdd.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: defs in Clojurescript REPL

2012-05-14 Thread David Nolen
Do you have a more specific example of why this is a problem?

On Monday, May 14, 2012, Mark Engelberg wrote:

 In Clojure, when you def a variable, the REPL prints the name of the
 variable rather than the value.
 In Clojurescript, when you def a variable, the REPL prints the value
 assigned to the variable.

 This is problematic when working with lazy values.  Is there any
 particular reason the Clojurescript REPL is designed to behave in this way?

 Thanks,

 Mark

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to 
 clojure@googlegroups.comjavascript:_e({}, 'cvml', 
 '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 javascript:_e({}, 'cvml',
 'clojure%2bunsubscr...@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: tracing cljsbuild error

2012-05-14 Thread Murtaza Husain

Herwig thanks for your comments.

I was able to solve the problem by doing the following. I created a new 
source directory and changed the src path for lein-cljsbuild to the new src 
dir. Then I started saving one file after another to the dir. All this 
while I had lein cljsbuild running as auto. The instance I saved the file 
having faulty code to the new dir, the error stacktrace showed up in the 
terminal running cljsbuild.

It did solve my problem, however is there a better way to do it then the 
trial and error method ?

Thanks,
Murtaza

On Monday, May 14, 2012 4:07:48 PM UTC+5:30, Herwig Hochleitner wrote:

 Also, are you running the latest version of clj-stacktrace? 


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

Bootstrapping Clojure-in-Clojure

2012-05-14 Thread Timothy Baldridge
Over the weekend there was some talk in IRC about why clojure-py
didn't use Clojurescript as the basis for its compiler. The reasons I
had, basically boiled down to this: Clojurescript is written in
Clojure-JVM and as such requires that the JVM be installed, and also
requires that all macros be Clojure-JVM and not ClojureScript. For
Clojurescript this is fine. But for Clojure-Py this results in me
writing a fair amount of translated code. Recently I've been
thinking about how to change this.

Much of the more recent code in Clojure is very cross platform. Stuff
like reducers can simply be copied over, fixed up a bit, and it runs.
If we could ever get to the point where we write Clojure in Clojure,
by default, then we could support the CLR, PVM, gambit, js, lua, etc.
all with a single file edit.

Over the weekend I've been thinking over how to make this all
possible, and I think we're very close. The GSOC projects  are working
at making a plugable backend (code emmiters) for ClojureScript, so
that part is being taken care of. All we really need now, is a
cross-platform ClojureScript compiler in ClojureScript.  From there,
porting to a new platform would be simple:

1) generate a new backed as per the GSOC project
2) compile the ClojureScript compiler using the new backend
3) compile your code using native macros, etc.

Platforms that do not have the ability to eval (gambit, JS, etc.) they
could simply stick with writing Java macros. For the rest of the
platforms (CLR, JVM, PVM, lua) they could then have native macros and
be able to distribute only non-Java code.

One of the original goals of Clojure-py was to be able to translate
the entire compiler and runtime to RPython. However, to make this
happen, certain things must be changed in the Python code. For
instance, all primitives must be boxed. This means turning code like
this:

x = 1 + 2

into this:

x = W_Add(Int(1), Int(2))

Under the current Clojure-py codebase this would be a bit hard to
maintain. However, with Clojure-in-Clojure this is just a different
backend.

I see this all as being a major boon to anyone looking to port Clojure
to a different platform. Hopefully at this point we could start
looking at what it would take to port Clojure to LLVM and CUDA.

Thoughts from the ClojureScript, clojure-gambit, GSOC people?

Timothy Baldridge (halagri)

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


Re: clojurescript error

2012-05-14 Thread Murtaza Husain

Raju thanks for your comments. I tried building using cljsbuild and the 
code is now compiling without any errors. 

I am curious to know, when you say script/repljs, are you referring to the 
browser based repl that cljsbuild provides access to or a cmd based repl? 
How do you access the latter? 

Thanks,
Murtaza

On Monday, May 14, 2012 3:53:11 PM UTC+5:30, Raju Bitter wrote:

 I've compiled your code without problems in the CLJS REPL, and embedded in 
 a CLJS app I'm working on. Do you get the same bug when you evaluate your 
 code snippet using the script/repljs? 

 Raju


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

deps.js in cljsbuild?

2012-05-14 Thread Murtaza Husain
Hi,

I am using lein-cljsbuild to compile the cljs code. I see reference to a 
deps.js file that is added after the tag in which I have included the 
generated js file. The browser naturally fails to find the file as it does 
not exist. 

What is the deps.js file and how do I resolve its 404 error?

Thanks,
Murtaza

-- 
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 beginner in search of peer-induced enlightenment

2012-05-14 Thread Jay Fields
James,
For learning, I'd recommend 4clojure.com and compare your solutions with
solutions submitted by other people. Also, if you have the cash, you could
pay clojure/core to pair with you. Unfortunately, I've never heard of
anyone doing that kind of thing as a mutually beneficial situation - (you
learn from them, you help them with their work)

Cheers, Jay

On Mon, May 14, 2012 at 7:45 AM, James abbott...@gmail.com wrote:

 When a new technology (a programming language) comes out, initially
 there are very few people who are really proficient in it. One can
 learn by one's own, but tremendous learning acceleration can be gained
 if one pairs with more experienced devs than oneself.

 So I'd like to ask: is there any place in the world where I can pair
 with more experienced people on Clojure as a beginner? Put very
 shortly, I have: decent Ruby skills; some Rails experience; very good
 OO, TDD, and business modeling skills; a mastery of web standards, and
 experience with Responsive Web Design. I'm into web as platform,
 HTML5, apps, and that kind of stuff.

 I'm currently based in Denmark but am flexible with moving.

 Cheers,
 James
 http://jamesabbottdd.com/

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


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

Re: Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread James
Hi Jay,-

I agree, paying to sweep someone's dojo does sound a bit strong.

/ James

On May 14, 3:24 pm, Jay Fields j...@jayfields.com wrote:
 James,
 For learning, I'd recommend 4clojure.com and compare your solutions with
 solutions submitted by other people. Also, if you have the cash, you could
 pay clojure/core to pair with you. Unfortunately, I've never heard of
 anyone doing that kind of thing as a mutually beneficial situation - (you
 learn from them, you help them with their work)

 Cheers, Jay







 On Mon, May 14, 2012 at 7:45 AM, James abbott...@gmail.com wrote:
  When a new technology (a programming language) comes out, initially
  there are very few people who are really proficient in it. One can
  learn by one's own, but tremendous learning acceleration can be gained
  if one pairs with more experienced devs than oneself.

  So I'd like to ask: is there any place in the world where I can pair
  with more experienced people on Clojure as a beginner? Put very
  shortly, I have: decent Ruby skills; some Rails experience; very good
  OO, TDD, and business modeling skills; a mastery of web standards, and
  experience with Responsive Web Design. I'm into web as platform,
  HTML5, apps, and that kind of stuff.

  I'm currently based in Denmark but am flexible with moving.

  Cheers,
  James
 http://jamesabbottdd.com/

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

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


Re: Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread James
PS. My last post wasn't clearly formulated, so let me re-phrase that:

I think that paying clojure/core to pair up is a perfectly legit
solution if one wants to jump ahead of the curve. My point was that I
wish the sweeping the dojo model was more widespread (one does
whatever other work there is while learning a skill one currently
lacks).

/ James


On May 14, 3:32 pm, James abbott...@gmail.com wrote:
 Hi Jay,-

 I agree, paying to sweep someone's dojo does sound a bit strong.

 / James

 On May 14, 3:24 pm, Jay Fields j...@jayfields.com wrote:







  James,
  For learning, I'd recommend 4clojure.com and compare your solutions with
  solutions submitted by other people. Also, if you have the cash, you could
  pay clojure/core to pair with you. Unfortunately, I've never heard of
  anyone doing that kind of thing as a mutually beneficial situation - (you
  learn from them, you help them with their work)

  Cheers, Jay

  On Mon, May 14, 2012 at 7:45 AM, James abbott...@gmail.com wrote:
   When a new technology (a programming language) comes out, initially
   there are very few people who are really proficient in it. One can
   learn by one's own, but tremendous learning acceleration can be gained
   if one pairs with more experienced devs than oneself.

   So I'd like to ask: is there any place in the world where I can pair
   with more experienced people on Clojure as a beginner? Put very
   shortly, I have: decent Ruby skills; some Rails experience; very good
   OO, TDD, and business modeling skills; a mastery of web standards, and
   experience with Responsive Web Design. I'm into web as platform,
   HTML5, apps, and that kind of stuff.

   I'm currently based in Denmark but am flexible with moving.

   Cheers,
   James
  http://jamesabbottdd.com/

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

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


Re: deps.js in cljsbuild?

2012-05-14 Thread Allen Johnson
I think the current fix is to add this JS declaration before you
import your cljs generated js file.  IIRC, this is only needed when
building without advanced optimizations.

script type=text/javascript
  var CLOSURE_NO_DEPS = true;
/script
script type=text/javascript src=js/myapp.js/script

AJ

On Mon, May 14, 2012 at 9:21 AM, Murtaza Husain
murtaza.hus...@sevenolives.com wrote:
 Hi,

 I am using lein-cljsbuild to compile the cljs code. I see reference to a
 deps.js file that is added after the tag in which I have included the
 generated js file. The browser naturally fails to find the file as it does
 not exist.

 What is the deps.js file and how do I resolve its 404 error?

 Thanks,
 Murtaza

 --
 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: Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread David Nolen
James,

Another way - I would recommend contributing to one of the Clojure contrib
libraries or an open source Clojure project. It's a great way to
familiarize yourself with non-trivial Clojure code, get feedback and offer
something up to the community.

You'll definitely get feedback from me if you contribute to any of these:

- core.match
- core.logic
- test.benchmark
- ClojureScript
- mori, http://swannodette.github.com/mori/

David

On Mon, May 14, 2012 at 7:45 AM, James abbott...@gmail.com wrote:

 When a new technology (a programming language) comes out, initially
 there are very few people who are really proficient in it. One can
 learn by one's own, but tremendous learning acceleration can be gained
 if one pairs with more experienced devs than oneself.

 So I'd like to ask: is there any place in the world where I can pair
 with more experienced people on Clojure as a beginner? Put very
 shortly, I have: decent Ruby skills; some Rails experience; very good
 OO, TDD, and business modeling skills; a mastery of web standards, and
 experience with Responsive Web Design. I'm into web as platform,
 HTML5, apps, and that kind of stuff.

 I'm currently based in Denmark but am flexible with moving.

 Cheers,
 James
 http://jamesabbottdd.com/

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

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

Re: Bootstrapping Clojure-in-Clojure

2012-05-14 Thread David Nolen
Sounds reasonable. Is there some specific direction you are suggesting?

David

On Mon, May 14, 2012 at 8:35 AM, Timothy Baldridge tbaldri...@gmail.comwrote:

 Over the weekend there was some talk in IRC about why clojure-py
 didn't use Clojurescript as the basis for its compiler. The reasons I
 had, basically boiled down to this: Clojurescript is written in
 Clojure-JVM and as such requires that the JVM be installed, and also
 requires that all macros be Clojure-JVM and not ClojureScript. For
 Clojurescript this is fine. But for Clojure-Py this results in me
 writing a fair amount of translated code. Recently I've been
 thinking about how to change this.

 Much of the more recent code in Clojure is very cross platform. Stuff
 like reducers can simply be copied over, fixed up a bit, and it runs.
 If we could ever get to the point where we write Clojure in Clojure,
 by default, then we could support the CLR, PVM, gambit, js, lua, etc.
 all with a single file edit.

 Over the weekend I've been thinking over how to make this all
 possible, and I think we're very close. The GSOC projects  are working
 at making a plugable backend (code emmiters) for ClojureScript, so
 that part is being taken care of. All we really need now, is a
 cross-platform ClojureScript compiler in ClojureScript.  From there,
 porting to a new platform would be simple:

 1) generate a new backed as per the GSOC project
 2) compile the ClojureScript compiler using the new backend
 3) compile your code using native macros, etc.

 Platforms that do not have the ability to eval (gambit, JS, etc.) they
 could simply stick with writing Java macros. For the rest of the
 platforms (CLR, JVM, PVM, lua) they could then have native macros and
 be able to distribute only non-Java code.

 One of the original goals of Clojure-py was to be able to translate
 the entire compiler and runtime to RPython. However, to make this
 happen, certain things must be changed in the Python code. For
 instance, all primitives must be boxed. This means turning code like
 this:

 x = 1 + 2

 into this:

 x = W_Add(Int(1), Int(2))

 Under the current Clojure-py codebase this would be a bit hard to
 maintain. However, with Clojure-in-Clojure this is just a different
 backend.

 I see this all as being a major boon to anyone looking to port Clojure
 to a different platform. Hopefully at this point we could start
 looking at what it would take to port Clojure to LLVM and CUDA.

 Thoughts from the ClojureScript, clojure-gambit, GSOC people?

 Timothy Baldridge (halagri)

 --
 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: Faster application startup for rapid development

2012-05-14 Thread Stuart Sierra
Also discovered I can prefix `java -cp ...` with `rlwrap` to get back a 
nice REPL experience.
-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 beginner in search of peer-induced enlightenment

2012-05-14 Thread James
Hi David,-

thanks for the feedback. To jump in and start augmenting non-trivial
Clojure code sounds like a serious task. I think the prerequisite for
that would be to be able to read and write trivial Clojure code, which
is where I'm at right now!

But I'll definitely study the libraries you proposed. They give a good
sense of direction.

Cheers,
James


On May 14, 6:02 pm, David Nolen dnolen.li...@gmail.com wrote:
 James,

 Another way - I would recommend contributing to one of the Clojure contrib
 libraries or an open source Clojure project. It's a great way to
 familiarize yourself with non-trivial Clojure code, get feedback and offer
 something up to the community.

 You'll definitely get feedback from me if you contribute to any of these:

 - core.match
 - core.logic
 - test.benchmark
 - ClojureScript
 - mori,http://swannodette.github.com/mori/

 David







 On Mon, May 14, 2012 at 7:45 AM, James abbott...@gmail.com wrote:
  When a new technology (a programming language) comes out, initially
  there are very few people who are really proficient in it. One can
  learn by one's own, but tremendous learning acceleration can be gained
  if one pairs with more experienced devs than oneself.

  So I'd like to ask: is there any place in the world where I can pair
  with more experienced people on Clojure as a beginner? Put very
  shortly, I have: decent Ruby skills; some Rails experience; very good
  OO, TDD, and business modeling skills; a mastery of web standards, and
  experience with Responsive Web Design. I'm into web as platform,
  HTML5, apps, and that kind of stuff.

  I'm currently based in Denmark but am flexible with moving.

  Cheers,
  James
 http://jamesabbottdd.com/

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

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


Re: Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread Sean Corfield
On Mon, May 14, 2012 at 10:41 AM, James abbott...@gmail.com wrote:
 thanks for the feedback. To jump in and start augmenting non-trivial
 Clojure code sounds like a serious task. I think the prerequisite for
 that would be to be able to read and write trivial Clojure code, which
 is where I'm at right now!

 But I'll definitely study the libraries you proposed. They give a good
 sense of direction.

Welcome to Clojure, James! You'll find folks are pretty helpful both
here and in #clojure on IRC (freenode.net).

Just a friendly reminder that contributing to Clojure itself or the
new contrib libraries requires a signed Contributor's Agreement on
file per http://clojure.org/contributing and then patches can be
attached to JIRA tickets per http://clojure.org/patches
-- 
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


ANN: Lemur - A tool/DSL for launching hadoop jobs on elastic-mapreduce

2012-05-14 Thread mlimotte
Lemur is a tool to launch hadoop jobs locally or on EMR, based on a 
configuration file referred to as a jobdef. The jobdef file describes your 
EMR cluster, local environment, pre- and post-actions (aka hooks) and zero 
or more steps (jobs).   Lemur reads your jobdef, at the end of your jobdef 
you execute (fire! ...) to make things happen.  Lemur is implemented as an 
internal DSL.

What Lemur is Not: Lemur is NOT a replacement for the Ruby 
elastic-mapreduce cli. There is some overlap, but I did not attempt to 
reproduce functionality (like --list, --terminate, etc) that works 
perfectly well in that tool. Also, Lemur is not a job scheduler (a la 
Oozie, Quartz or Azkaban). You might decide to use one of those tools to 
trigger Lemur which knows how to run your job.

A simple jobdef:

(add-validators
  (val-opts :required :numeric :num-days))

(add-hooks
  (when-local-test)
(diff-test-data [RESULTS results]))

(defcluster marcs-cluster
  :num-instances 1
  :master-instance-type m1.large
  :my-root /Users/mlimotte/projects/lemur/tmp
  :upload [./marcs-input.txt :to ${data-uri}/input.txt]
  :test-uri ${my-root}/work
  :keypair my-keypair
  :jar-src-path ${my-root}/lemur-test-0.0.1-SNAPSHOT-standalone.jar)

(defstep marcs-step
  :main-class lemur_test.marcs
  :args.days #(:num-days %)
  :args.data-uri true)

(fire! marcs-cluster marcs-step) 

This tool was developed at The Climate Corporation (TCC).  TCC has chosen 
to release this project with an Apache 2.0 license.

Blog post: 
http://entxtech.blogspot.com/2012/05/lemur-declarative-launching-of-hadoop.html
Github Project: https://github.com/TheClimateCorporation/lemur

Marc Limotte

-- 
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: Bootstrapping Clojure-in-Clojure

2012-05-14 Thread Armando Blancas


 Much of the more recent code in Clojure is very cross platform. Stuff 
 like reducers can simply be copied over, fixed up a bit, and it runs. 

 I wonder how is the fork/join part carrier over for reducers.
 

-- 
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: Bootstrapping Clojure-in-Clojure

2012-05-14 Thread David Nolen
On Mon, May 14, 2012 at 2:32 PM, Armando Blancas abm221...@gmail.comwrote:

 Much of the more recent code in Clojure is very cross platform. Stuff
 like reducers can simply be copied over, fixed up a bit, and it runs.

 I wonder how is the fork/join part carrier over for reducers.


Sounds straightforward for any language that provides task level
parallelism natively or via a library.

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: how to get good at clojure?

2012-05-14 Thread Bill Allen
Sam, thanks for the pointer to quilt. Looks really cool. I'm starting to
imagine a project with quilt and overtone together!
Regards,
Bill
On May 11, 2012 3:34 PM, Sam Aaron samaa...@gmail.com wrote:

 In addition to following up on all the great suggestions above, I'd hack
 about with Quil; it's a lot of fun and you'll get instant feedback. You'll
 also very quickly run into the fun that is juggling pure fns, lazy
 sequences and orchestrating side effects (to sketch stuff).

 http://github.com/quil/quil

 --
 http://sam.aaron.name


 On Friday, 11 May 2012 at 18:26, Daniel Gagnon wrote:

 
 
  On Mon, May 7, 2012 at 8:48 PM, toan kidn...@gmail.com (mailto:
 kidn...@gmail.com) wrote:
   Hi folks,
  
   I've been trying to learn clojure for a while. I've read the clojure
   section of seven languages... and currently trying to get through
   joy of clojure. I've been practicing with the prompt a bit and
   trying to learn emacs that came with clojurebox.
 
 
  The clojure part of seven languages isn't very idiomatic.
 
  Try Programming Clojure 2n Edition by Stuart Halloway, I think it's the
 best learning book.
 
  And clojurebox is quite outdated give a try to lein and the clooj editor.
 
   I have 2 questions, 1. does anyone have advice on getting somewhat
   competent for a newb? (alternatively, how did you get good?)
 
 
  Code until it clicks, then progress gets much faster.
 
   2. if i
   have no interest in java, should a learn at least some fundamentals?
   would that be helpful?
 
 
  Try reading some javadoc and see if it makes sense to you. Learning Java
 isn't critical to start but eventually, you'll want to use Java libraries
 and then it's best to have some basics.
 
   --
   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%2bunsubscr...@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 (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


-- 
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 beginner in search of peer-induced enlightenment

2012-05-14 Thread Jason Jackson
This might not sound glamorous, but reading books, and reading great code, 
and code reviews is a great way to get up to speed. The explanations found 
in the Joy of Clojure, and other books have been highly edited and refined; 
if I ever paired up with someone, I doubt my ad-hoc verbal explanations 
would ever approach that degree of excellence. 


On Monday, 14 May 2012 10:10:14 UTC-4, James wrote:

 PS. My last post wasn't clearly formulated, so let me re-phrase that: 

 I think that paying clojure/core to pair up is a perfectly legit 
 solution if one wants to jump ahead of the curve. My point was that I 
 wish the sweeping the dojo model was more widespread (one does 
 whatever other work there is while learning a skill one currently 
 lacks). 

 / James 


 On May 14, 3:32 pm, James abbott...@gmail.com wrote: 
  Hi Jay,- 
  
  I agree, paying to sweep someone's dojo does sound a bit strong. 
  
  / James 
  
  On May 14, 3:24 pm, Jay Fields j...@jayfields.com wrote: 
  
  
  
  
  
  
  
   James, 
   For learning, I'd recommend 4clojure.com and compare your solutions 
 with 
   solutions submitted by other people. Also, if you have the cash, you 
 could 
   pay clojure/core to pair with you. Unfortunately, I've never heard of 
   anyone doing that kind of thing as a mutually beneficial situation - 
 (you 
   learn from them, you help them with their work) 
  
   Cheers, Jay 
  
   On Mon, May 14, 2012 at 7:45 AM, James abbott...@gmail.com wrote: 
When a new technology (a programming language) comes out, initially 
there are very few people who are really proficient in it. One can 
learn by one's own, but tremendous learning acceleration can be 
 gained 
if one pairs with more experienced devs than oneself. 
  
So I'd like to ask: is there any place in the world where I can pair 
with more experienced people on Clojure as a beginner? Put very 
shortly, I have: decent Ruby skills; some Rails experience; very 
 good 
OO, TDD, and business modeling skills; a mastery of web standards, 
 and 
experience with Responsive Web Design. I'm into web as platform, 
HTML5, apps, and that kind of stuff. 
  
I'm currently based in Denmark but am flexible with moving. 
  
Cheers, 
James 
   http://jamesabbottdd.com/ 
  
-- 
You received this message because you are subscribed to the Google 
Groups Clojure group. 
To post to this group, send email to clojure@googlegroups.com 
Note that posts from new members are moderated - please be patient 
 with 
your first post. 
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com 
For more options, visit this group at 
   http://groups.google.com/group/clojure?hl=en

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

Re: Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread Yan King Yin, 甄景贤
On Mon, May 14, 2012 at 7:45 PM, James abbott...@gmail.com wrote:

 When a new technology (a programming language) comes out, initially
 there are very few people who are really proficient in it. One can
 learn by one's own, but tremendous learning acceleration can be gained
 if one pairs with more experienced devs than oneself.

 So I'd like to ask: is there any place in the world where I can pair
 with more experienced people on Clojure as a beginner? Put very
 shortly, I have: decent Ruby skills; some Rails experience; very good
 OO, TDD, and business modeling skills; a mastery of web standards, and
 experience with Responsive Web Design. I'm into web as platform,
 HTML5, apps, and that kind of stuff.

 I'm currently based in Denmark but am flexible with moving.

 Cheers,
 James
 http://jamesabbottdd.com/


Not sure what exactly you're expecting... but I'm developing an opensource
A.I. project in Clojure, which will be capable of learning to answer
questions and converse in natural language.  I'm working with an informal
group of partners, but we need a CEO or business guy to manage the project
and commercialize it.  Also we're developing a web front-end for the logic
engine, probably using Javascript.  Just drop me a line if you're
interested to know more =)

YKY

-- 
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 beginner in search of peer-induced enlightenment

2012-05-14 Thread Chris Ford
Are there any Clojure dojos near where you live? We have a monthly one in
London, which is a great way for people of different experience levels to
come together.

Cheers,

Chris

On 14 May 2012 12:45, James abbott...@gmail.com wrote:

 When a new technology (a programming language) comes out, initially
 there are very few people who are really proficient in it. One can
 learn by one's own, but tremendous learning acceleration can be gained
 if one pairs with more experienced devs than oneself.

 So I'd like to ask: is there any place in the world where I can pair
 with more experienced people on Clojure as a beginner? Put very
 shortly, I have: decent Ruby skills; some Rails experience; very good
 OO, TDD, and business modeling skills; a mastery of web standards, and
 experience with Responsive Web Design. I'm into web as platform,
 HTML5, apps, and that kind of stuff.

 I'm currently based in Denmark but am flexible with moving.

 Cheers,
 James
 http://jamesabbottdd.com/

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

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

Troubles with truthiness

2012-05-14 Thread Jamie Brandon
I ran across this behaviour today:

shackles.examples= (import '[clojure.lang Seqable])
clojure.lang.Seqable
shackles.examples= (deftype Foo [] Seqable (seq [this] ()))
shackles.examples.Foo
shackles.examples= (empty? (Foo.))
false
shackles.examples= (deftype Bar [] Seqable (seq [this] nil))
shackles.examples.Bar
shackles.examples= (empty? (Bar.))
true
shackles.examples= (empty? ())
true

Now I understand why this happens - () is truthy but nil is falsey.
This seems related to the difference between next and rest. Is there
an underlying principle here?

-- 
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: Leiningen 2.0.0-preview4

2012-05-14 Thread Alan Shaw
Having another little problem, any help appreciated:




alan@shotwell /cygdrive/c/Workspaces/Clojure-lein
$ lein2 new startingclojure
Generating a project called startingclojure based on the 'default' template.
java.lang.IllegalArgumentException: No implementation of method:
:make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:495)
at clojure.java.io$fn__7795$G__7790__7802.invoke(io.clj:63)
at clojure.java.io$reader.doInvoke(io.clj:96)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at leiningen.new.templates$slurp_resource.invoke(templates.clj:29)
at leiningen.new.templates$renderer$fn__709.doInvoke(templates.clj:79)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at leiningen.new.default$default.invoke(default.clj:15)
at clojure.lang.Var.invoke(Var.java:401)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.core$apply.invoke(core.clj:602)
at leiningen.new$create.doInvoke(new.clj:54)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at leiningen.new$create.invoke(new.clj:47)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:600)
at leiningen.new$new.doInvoke(new.clj:101)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:405)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.core$apply.invoke(core.clj:602)
at leiningen.core.main$resolve_task$fn__699.doInvoke(main.clj:66)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:602)
at leiningen.core.main$apply_task.invoke(main.clj:88)
at leiningen.core.main$_main$fn__731.invoke(main.clj:140)
at leiningen.core.main$_main.doInvoke(main.clj:140)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:405)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.core$apply.invoke(core.clj:600)
at clojure.main$main_opt.invoke(main.clj:323)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:413)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)

alan@shotwell /cygdrive/c/Workspaces/Clojure-lein
$ lein2 version
Leiningen 2.0.0-preview3 on Java 1.6.0_31 Java HotSpot(TM) Client VM


On Sat, May 12, 2012 at 4:39 PM, John Gabriele jmg3...@gmail.com wrote:

 On May 12, 7:07 pm, John Gabriele jmg3...@gmail.com wrote:

 Whoops. Typo:
 
  Another important reason for having a good default README.md template
  specifically for libs is that, at some point, I'm guessing that
  clojars.org will extract and render them as html, and it will be nice
  if there's some conventions already in place.

 s/some conventions/some more conventions/

 :)

 Also, re

  Sure, that makes sense. Feel free to open an issue and/or pull request
  on the lein-newnew project for it.

 Great. Will look into that later tonight.

 Thanks,
 ---John

 --
 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: closure example doesn't need let?

2012-05-14 Thread n aipmoro
hi,
Just a couple of paragraphs further on in the book (p. 137):

In our definition of times-n, we created a local x using let and closed
over that instead of closing over the argument n directly. But this was
only to help focus the discussion on other parts of the function. In fact,
closures close over parameters of outer functions in exactly the same way
as they do over let locals. Thus times-n could be defined without any let
at all.

regards,
naipmoro

On Sat, May 12, 2012 at 12:20 PM, larry larrye2...@gmail.com wrote:


 I saw this example of a simple closure in Joy of Clojure and on some
 Clojure tutorial page.

 (defn adder[n]
   (let [x n]
  (fn[y] (+ y x

 Is the let necessary?  It seems redundant.
 I tried it like this and it seems to work fine.

 (defn adder[n]
(fn[y] (+ y n))



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

docstrings of if-let and when-let incorrect

2012-05-14 Thread Borkdude
The docstring of if-let is as follows:

bindings = binding-form test

If test is true, evaluates then with binding-form bound to the value of 
test, if not, yields else

I think it should be mentioned in the docs that if-let and when-let support 
only *one binding*, not multiple bindings (like for 
example https://www.refheap.com/paste/2700).
 
Kind regards,

Michiel

-- 
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: Leiningen 2.0.0-preview4

2012-05-14 Thread Alan Shaw
Hi,
In cygwin on win7 I get this:

_

$ lein2 upgrade
The script at /cygdrive/c/Users/alan/bin/lein2 will be upgraded to the
latest preview version.
Do you want to continue [Y/n]? Y

Upgrading...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 127 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0Warning: Failed to create the
file /tmp/lein-3060-upgrade: No such file or
Warning: directory
100 7230 100 7230 0 0 5452 0 0:00:01 0:00:01 --:--:-- 33165
curl: (23) Failed writing body (0 != 7230)

$ ls -ld /tmp
drwxrwxrwt+ 1 alan root 0 May 12 15:17 /tmp/

---

Not sure what to do...

-A


On Sat, May 12, 2012 at 1:41 PM, Phil Hagelberg p...@hagelb.org wrote:

 On Sat, May 12, 2012 at 11:06 AM, John Gabriele jmg3...@gmail.com wrote:
  After `lein self-install`, when I first ran `lein help` I get this
  output: https://www.refheap.com/paste/2697. Just a few questions:
 
  * What's the Clojure 1.3.0 jar required for if lein is using 1.4.0
 internally?

 Some of the dependencies for the plugin that provides the `new` task
 declare it, and there's currently no way to prevent these from being
 fetched. I believe this is also causing 1.3.0 to be active for the
 repl task. This is a known issue we hope to address in preview5.

  * Why is it grabbing the Clojure 1.2.1 pom? (though I noticed it does
  not grab the 1.2.1 jar)

 There's probably a version range declaration somewhere that's forcing
 it to examine a number of versions even though it doesn't use them. It
 has to build a full dependency graph before deciding which version
 declarations actually win.

  By the way, I like that you can now pass extra args to `lein new` to
  create a project of a specific type (such as plugin). What do you
  think of adding 2 more stock options: application and library?

 What would the difference between the two be? If it's just a matter of
 whether there's a :main function then it might be simpler just to have
 a commented-out line in project.clj. If there are other differences
 then maybe it would be justified. Note that you can publish your own
 templates to Clojars, just deploy one as name/lein-template and it
 will be used when someone runs `lein new name myproject`.

 -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

defstruct defrecord metadata

2012-05-14 Thread JDuPreez
Hi,

I'm new to Clojure. I've been unsuccessful in finding a clear answer or 
getting it to work (might just have done it incorrectly, since I'm still 
learning). I understand that you can add metadata to an object, 
with-meta, and to a variable or parameter, ^{:. However, I would like 
to apply metadata to defrecord and defstruct, so that the data type 
definitions are associated with the metadata. This will be the same as 
applying an annotation to a Java class.

Does Clojure support something similar? If so, please provide a simple 
example of how it will be applied to, and read from, a defrecord and 
defstruct. If Clojure doesn't, then that's okay as well, as I've found a 
relatively straight forward way to achieve the same result. I just want to 
make sure I'm not missing something before going ahead using my custom 
annotation mechanism.

Really appreciate the help. Thanks!

Jacques

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

How to use third-party libraries with Leiningen that are not found in Clojars or Maven

2012-05-14 Thread Mads Andreas Elvheim
I have a few issues which are all related. I'll do my best to explain them 
one by one.

I'd like to use the latest version of the jOGL library with Clojure 1.3 / 
Leiningen 1.7.1 / OpenJDK 1.6.

After getting the jars from joGL's website, how can I get the library 
exposed to leiningen and Clojure in the most convenient way? I see no 
obvious way to set extra classpaths for a leiningen project, but I might 
have missed something obvious. Also, leiningen happily ignores the *
$CLASSPATH* environment variable.

And besides repacking jOGL and make it available in Maven or Clojars, what 
is the best approach for distributing the extra jOGL dependency? jOGL is a 
JRI library, and I assume that's why the existing opengl/jogl 2.0-rc3 
package in Clojars appears to be broken. Roughly from what I've read 
elsewhere, Maven repos don't like platform-specific dependencies, so that 
probably leaves lein-localrepo out of the picture as well.

You'll have to excuse my ignorance. I'm both new to Clojure and Java, but 
any pointers and reading suggestions will humbly be taken with open arms. 
My background is C++ and various assembly dialects. I'd love to get OpenGL 
3.3 and Swing working in Clojure :-)

- Mads Elvheim / Madsy


-- 
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] C2: Clojure/ClojureScript data visualization

2012-05-14 Thread Kostas Pramatias
On Fri, May 11, 2012 at 9:04 PM, Kevin Lynagh ke...@keminglabs.com wrote:

 Announcing C2, a data visualization library inspired by D3.js
 C2 is not a charting library; there are no plotting functions like
 scatterplot or piechart .
 Instead, C2 is a collection of scales, map projections, and component
 templates (e.g., axes) that you can compose to build custom data
 graphics on a DOM (e.g., HTML or SVG).

 C2 is written in Clojure and can be used on the JVM in conjunction
 with the Hiccup HTML rendering library to generate markup.
 C2 can also be used within ClojureScript, where it includes

+ its own Hiccup compiler that acts directly on live DOM nodes
+ event wrappers for use with large datasets (via delegation)
+ DOM manipulation helpers (the usual suspects for manipulating
 styles/attributes, selecting, appending, and removing DOM nodes)

 To get started, just add it to your project.clj:

[com.keminglabs/c2 0.1.0]

 There is also a standalone uberjar with built-in web server if you
 don't have Leiningen around; see this 2-minute screencast:

http://www.youtube.com/watch?v=Urg79FmQnYs

 For more information, see

Homepage: http://keminglabs.com/c2/
Marginalia docs: http://keminglabs.com/c2/docs/
Github: https://github.com/lynaghk/c2/

 Some projects that pair well with C2:

 cljx, a Leiningen plugin that statically rewrites metadata-annotated
 Clojure code into platform specific code:

https://github.com/lynaghk/cljx

 Cassowary, a linear constraint solver accessible from ClojureScript:

https://github.com/lynaghk/cassowary-coffee

 Vomnibus, a collection of geographic data and color schemes:

https://github.com/lynaghk/vomnibus

 Further reading:

D3 paper: http://vis.stanford.edu/files/2011-D3-InfoVis.pdf
D3 examples: https://github.com/mbostock/d3/wiki/Gallery
Tick selection algorithm:
 http://graphics.stanford.edu/vis/publications/2010/labeling-preprint.pdf
Stephen Few: http://www.perceptualedge.com/library.php
Bret Victor on information software: http://worrydream.com/MagicInk/

 --

 i tried it and it works. thanks for this library

-- 
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: Bootstrapping Clojure-in-Clojure

2012-05-14 Thread Kevin Downey
http://www.lambdassociates.org/blog/klambda.htm suggests a possible
bootstrapping mechanism, some kind of reduced set of clojure
functionality ur-clojure that is designed to be easy to write and
interpreter for, and a compiler backend that generates ur-clojure,
after compiling the compiler+platform backend to ur-clojure you write
an ur-clojure interpreter on the platform in question, feed the
compiler+backend through the interpreted compiler+backend to compile
it for the platform you are bootstrapping, and then you are
bootstrapped.

You could do something similar, but maybe simpler, by taking the maps
output from the analysis phase of the compiler run over the compiler
and serliazing them as json (so they are easily readable on different
platforms) effectively substituting the maps output from the analysis
phase for ur-clojure.

On Mon, May 14, 2012 at 11:36 AM, David Nolen dnolen.li...@gmail.com wrote:
 On Mon, May 14, 2012 at 2:32 PM, Armando Blancas abm221...@gmail.com
 wrote:

 Much of the more recent code in Clojure is very cross platform. Stuff
 like reducers can simply be copied over, fixed up a bit, and it runs.

 I wonder how is the fork/join part carrier over for reducers.


 Sounds straightforward for any language that provides task level parallelism
 natively or via a library.

 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



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
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 beginner in search of peer-induced enlightenment

2012-05-14 Thread Sean Corfield
On Mon, May 14, 2012 at 4:47 AM, Chris Ford christophertf...@gmail.com wrote:
 Are there any Clojure dojos near where you live? We have a monthly one in
 London, which is a great way for people of different experience levels to
 come together.

FYI, the guy who used to run the London Clojure dojo - Toby Clemson -
is now based here in San Francisco and runs one every month:
http://www.meetup.com/The-Bay-Area-Clojure-User-Group/
-- 
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: How to use third-party libraries with Leiningen that are not found in Clojars or Maven

2012-05-14 Thread Sean Corfield
Check out lein-localrepo - a way to install arbitrary JARs in your
local Maven repo cache.

On Sat, May 12, 2012 at 9:36 AM, Mads Andreas Elvheim
mads.elvh...@gmail.com wrote:
 I have a few issues which are all related. I'll do my best to explain them
 one by one.

 I'd like to use the latest version of the jOGL library with Clojure 1.3 /
 Leiningen 1.7.1 / OpenJDK 1.6.

 After getting the jars from joGL's website, how can I get the library
 exposed to leiningen and Clojure in the most convenient way? I see no
 obvious way to set extra classpaths for a leiningen project, but I might
 have missed something obvious. Also, leiningen happily ignores the
 $CLASSPATH environment variable.

 And besides repacking jOGL and make it available in Maven or Clojars, what
 is the best approach for distributing the extra jOGL dependency? jOGL is a
 JRI library, and I assume that's why the existing opengl/jogl 2.0-rc3
 package in Clojars appears to be broken. Roughly from what I've read
 elsewhere, Maven repos don't like platform-specific dependencies, so that
 probably leaves lein-localrepo out of the picture as well.

 You'll have to excuse my ignorance. I'm both new to Clojure and Java, but
 any pointers and reading suggestions will humbly be taken with open arms. My
 background is C++ and various assembly dialects. I'd love to get OpenGL 3.3
 and Swing working in Clojure :-)

 - Mads Elvheim / Madsy

-- 
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: Leiningen 2.0.0-preview4

2012-05-14 Thread Phil Hagelberg
On Sat, May 12, 2012 at 3:22 PM, Alan Shaw noden...@gmail.com wrote:
 In cygwin on win7 I get this:

Could you open an issue on Github for this?

I don't know enough about Windows to say what's going on here, but if
it's on the issue tracker there's a better chance of getting it
figured out if someone more Windows-savvy can help out.

thanks,
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: How to use third-party libraries with Leiningen that are not found in Clojars or Maven

2012-05-14 Thread Mark Rathwell
Depending on who else you are wanting to share the dependency with,
you may find Phil Hagelberg's s3-wagon-private useful:

https://github.com/technomancy/s3-wagon-private


On Mon, May 14, 2012 at 4:23 PM, Sean Corfield seancorfi...@gmail.com wrote:
 Check out lein-localrepo - a way to install arbitrary JARs in your
 local Maven repo cache.

 On Sat, May 12, 2012 at 9:36 AM, Mads Andreas Elvheim
 mads.elvh...@gmail.com wrote:
 I have a few issues which are all related. I'll do my best to explain them
 one by one.

 I'd like to use the latest version of the jOGL library with Clojure 1.3 /
 Leiningen 1.7.1 / OpenJDK 1.6.

 After getting the jars from joGL's website, how can I get the library
 exposed to leiningen and Clojure in the most convenient way? I see no
 obvious way to set extra classpaths for a leiningen project, but I might
 have missed something obvious. Also, leiningen happily ignores the
 $CLASSPATH environment variable.

 And besides repacking jOGL and make it available in Maven or Clojars, what
 is the best approach for distributing the extra jOGL dependency? jOGL is a
 JRI library, and I assume that's why the existing opengl/jogl 2.0-rc3
 package in Clojars appears to be broken. Roughly from what I've read
 elsewhere, Maven repos don't like platform-specific dependencies, so that
 probably leaves lein-localrepo out of the picture as well.

 You'll have to excuse my ignorance. I'm both new to Clojure and Java, but
 any pointers and reading suggestions will humbly be taken with open arms. My
 background is C++ and various assembly dialects. I'd love to get OpenGL 3.3
 and Swing working in Clojure :-)

 - Mads Elvheim / Madsy

 --
 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: How to use third-party libraries with Leiningen that are not found in Clojars or Maven

2012-05-14 Thread Stuart Sierra
You can create a virtual repository in your project's source tree and add 
it to your project as an extra repository with the file: protocol. 
Technique described (for Maven) here:

https://devcenter.heroku.com/articles/local-maven-dependencies

-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: Troubles with truthiness

2012-05-14 Thread Stuart Sierra
The empty list () is an object, and objects are truthy. 

`seq` on any empty collection is defined to return nil. So your definition:

(deftype Foo [] Seqable (seq [this] ())) 

should return nil instead of the empty list.

`(next x)` is equivalent to `(seq (rest x))`

-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

defrecord serialization and *data-readers*

2012-05-14 Thread Kurt Harriger
When I first started my project I tried using defrecord and defprotocol for 
various data structurs and when I wanted an easy serialization function I 
used pr-str and read-string, this worked great!... until I wanted to do 
some refactoring and move some types to another namespace.  After changing 
the namespace name, I could no longer read the serialized data structures 
since the serialized data included namespace and record type 
#namespace.Record{:prop value   }.  Ideally, I would just be able to 
redefine the reader literal for #namespace.Record so that I could define a 
custom function or perhaps alias it to an equivalent record type in a 
different namespace via *data-readers*, but this didn't seem to work for 
me.  It appears that data-readers can't override the reader literals for 
record types and instead read-string throws a class not found exception.  I 
have since stopped using record types for serialization and saving 
everything as maps, but this has increased the complexity of the 
deserialization logic as I need to store the type information in fields and 
restore these types after deserialization.  I liked using record types, but 
I don't like not being able to rename these types later if I change my 
mind.  

It seems to me that I should perhaps be able to override the reader 
literals for record types? 

-- 
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: defs in Clojurescript REPL

2012-05-14 Thread Mark Engelberg
(def tree (function-that-produces-an-enormous-tree 2))

Want do that in Clojurescript, and you'll be treated to tons and tons of
nested tree data printed to the REPL.

Want to time something that's supposed to be lazy, to make sure it's really
lazy, and see how long it takes to produce the eager aspects?  In Clojure,
that's easy:

(time (def result (lazy-function 10)))

In Clojurescript, the REPL will produce the whole lazy sequence.  That's
bad.

So there are a couple examples of things that are harder to do when your
REPL prints the values that are attached to variables.  But again, the real
question here is, why does Clojurescript deviate on this point?  I know
that Clojurescript doesn't exactly match Clojure, but shouldn't all
deviations be done for a reason?

--Mark

On Mon, May 14, 2012 at 5:06 AM, David Nolen dnolen.li...@gmail.com wrote:

 Do you have a more specific example of why this is a problem?


 On Monday, May 14, 2012, Mark Engelberg wrote:

 In Clojure, when you def a variable, the REPL prints the name of the
 variable rather than the value.
 In Clojurescript, when you def a variable, the REPL prints the value
 assigned to the variable.

 This is problematic when working with lazy values.  Is there any
 particular reason the Clojurescript REPL is designed to behave in this way?

 Thanks,

 Mark

 --
 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: defs in Clojurescript REPL

2012-05-14 Thread David Nolen
On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.comwrote:

 (def tree (function-that-produces-an-enormous-tree 2))


Isn't doing this at the top level bad form?


 So there are a couple examples of things that are harder to do when your
 REPL prints the values that are attached to variables.  But again, the real
 question here is, why does Clojurescript deviate on this point?  I know
 that Clojurescript doesn't exactly match Clojure, but shouldn't all
 deviations be done for a reason?

 --Mark


There are a few good reasons to not reify things like vars and namespaces
in ClojureScript - one of these is Google Closure Compiler.

Also I don't see how this isn't solved by modifying some habits.

(defn test-tree [] (function-that-produces-an-enormous-tree 2))
(time (test-tree))

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: Faster application startup for rapid development

2012-05-14 Thread blais
On Friday, May 11, 2012 5:33:22 PM UTC-4, Stuart Sierra wrote:



 What other tricks do you have for speeding up your development cycle with 
 Clojure?


I have a similar situation, where I've had to restart a repl a *lot* for a 
particular program (several times a day, like 10-20 times and sometimes 
more).  Also, I've always found the startup time of Leiningen to be too 
long to be usable--I'm very, very impatient--so I stopped using it a while 
back for startup; most of the time is due to itself being written in 
Clojure, which is awesome, but one thing about Clojure/JVM that just isn't 
awesome is precisely its startup time. Using an ugly shell script worked 
fine for a while, but then I wanted some more niceties, basically to run a 
script with just a few directory arguments and have it figure it all out, 
hunt the jars anywhere in the path, use only the latest versions of two 
colliding jars for the same package, and find .clj files and corresponding 
roots to add to the classpath and start my VM.  So I wrote one; it also 
provides startup options for swank, the vanilla repl, nrepl, and to just 
run as a main program.

Basically I just clone all the projects I need in a single directory and 
then I run:

  streamlined --swank [DIR]

and it pretty much works.  You can still use lein deps on projects to 
fetch their dependencies (only once). You can also specify a number of 
directories, and add explicit classpaths with -c (I do this in a Makefile 
these days).  Also, -v or -vv will output lots of juicy info about what it 
does so you can debug issues very easily.

You can find the latest version here if that makes your life simpler (it's 
a single Python script):
http://furius.ca/pubcode/pub/conf/bin/streamlined.html


-- 
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: defs in Clojurescript REPL

2012-05-14 Thread Mark Engelberg
On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote:

 On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg 
 mark.engelb...@gmail.comwrote:

 (def tree (function-that-produces-an-enormous-tree 2))


 Isn't doing this at the top level bad form?


The purpose of a REPL is for interactive experimentation.  I want to give
names to the things I'm building so I can play with them in the REPL.
Nothing bad form about that.


 Also I don't see how this isn't solved by modifying some habits.

 (defn test-tree [] (function-that-produces-an-enormous-tree 2))
 (time (test-tree))


time prints out the value that is computed.  The above example would suffer
the same problem of printing out the tree at the REPL.  You could do
something like (time (do (test-tree) nil)) to suppress printing, but if you
want to do further interactive manipulations to the tree, you'd end up
recomputing it.  So then, you get into workarounds involving delay.  It
starts to get ugly, I think.

Clojure's ability to give names to things without printing the values is a
feature I use every day in my interactive explorations.

-- 
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: defs in Clojurescript REPL

2012-05-14 Thread kovas boguta
I think this is a pretty valid feature request.

The main question is, can this be done without having vars in clojurescript.

One way to do it is to surpress output somehow, under certain conditions.

Either as a token at the end of a repl input, or in the semantics of def itself.

I don't have an ideal specific solution here, but I've noticed this
problem as well and found it pretty annoying.

There should be a way to solve it that is a reasonable compromise.



On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg
mark.engelb...@gmail.com wrote:
 On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote:

 On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com
 wrote:

 (def tree (function-that-produces-an-enormous-tree 2))


 Isn't doing this at the top level bad form?


 The purpose of a REPL is for interactive experimentation.  I want to give
 names to the things I'm building so I can play with them in the REPL.
 Nothing bad form about that.


 Also I don't see how this isn't solved by modifying some habits.

 (defn test-tree [] (function-that-produces-an-enormous-tree 2))
 (time (test-tree))


 time prints out the value that is computed.  The above example would suffer
 the same problem of printing out the tree at the REPL.  You could do
 something like (time (do (test-tree) nil)) to suppress printing, but if you
 want to do further interactive manipulations to the tree, you'd end up
 recomputing it.  So then, you get into workarounds involving delay.  It
 starts to get ugly, I think.

 Clojure's ability to give names to things without printing the values is a
 feature I use every day in my interactive explorations.


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