Re: ClojureScript One in Eclipse

2012-02-20 Thread turcio
On Feb 20, 11:05 am, Chas Emerick c...@cemerick.com wrote:
 Yes, I just cloned and started ClojureScript One using ccw.  I was able to 
 get the dev server up and running, and click around in all the tabs without 
 any exceptions.

 You didn't say whether you did this or not, but in addition to the 
 directories specified in :extra-classpath-dirs, you need to add the 
 :source-path, as well as all of the jars in lib/.

All the following were added to the buildpath of newly created CCW
Clojure project:
lib/*.jar
lib/dev/*.jar
:source-path entry from project.clj
:extra-classpath-dirs entries from project.clj
classpath folder (generated by CCW)

Then on freshly cloned, lein bootstrapped, eclipsed project I do: Run
as-Clojure application. At this point all the namespaces are loaded
(sometimes they are not, so I need to do some magic cleaning/closing
opening of project/removing run configuration).

No luck with all of this - (one.sample.repl/dev-server) opens website
but 'development' and 'production' tab produce previously mentioned
exception and error web page. If I enter http://localhost:8080/development
once again I'm getting nice empty page with no exception, and no
application either.

I even tried it on freshly dowloaded Eclipse and CCW. Clojure builder
is turned on (just read your comments on CCW list about the autobuild
feature).

Chas, have you been able to run ClojureScript One in exactly the same
manner?

Daniel

-- 
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 One in Eclipse

2012-02-20 Thread turcio
I created a run configuration where I added /src/one/sample/repl.clj
to 'Evaluate Clojure source file(s)' list. The namespaces are loaded
every time now. The development and production tabs produce exception
at first attempt. On the second attempt everything works as expected
except the JavaScript error occurs - probably ClojureScript repl
issue.

I still need to spend more time and polish my configuration though.

Cheers,
Daniel

On Feb 20, 9:05 pm, turcio tur...@gmail.com wrote:
 On Feb 20, 11:05 am, Chas Emerick c...@cemerick.com wrote:

  Yes, I just cloned and started ClojureScript One using ccw.  I was able to 
  get the dev server up and running, and click around in all the tabs without 
  any exceptions.

  You didn't say whether you did this or not, but in addition to the 
  directories specified in :extra-classpath-dirs, you need to add the 
  :source-path, as well as all of the jars in lib/.

 All the following were added to the buildpath of newly created CCW
 Clojure project:
 lib/*.jar
 lib/dev/*.jar
 :source-path entry from project.clj
 :extra-classpath-dirs entries from project.clj
 classpath folder (generated by CCW)

 Then on freshly cloned, lein bootstrapped, eclipsed project I do: Run
 as-Clojure application. At this point all the namespaces are loaded
 (sometimes they are not, so I need to do some magic cleaning/closing
 opening of project/removing run configuration).

 No luck with all of this - (one.sample.repl/dev-server) opens website
 but 'development' and 'production' tab produce previously mentioned
 exception and error web page. If I enterhttp://localhost:8080/development
 once again I'm getting nice empty page with no exception, and no
 application either.

 I even tried it on freshly dowloaded Eclipse and CCW. Clojure builder
 is turned on (just read your comments on CCW list about the autobuild
 feature).

 Chas, have you been able to run ClojureScript One in exactly the same
 manner?

 Daniel

-- 
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 One in Eclipse

2012-02-19 Thread turcio
Actually, has anybody succeeded to run ClojureScript One from Eclipse?

Daniel


On Feb 17, 12:14 pm, turcio tur...@gmail.com wrote:
 Hi,
 I'm trying to run ClojureScript One using CCW plugin in Eclipse. I
 created a new project and imported all the source code into it. Then I
 added folders to the build path that reflect the following
 configuration from project.clj:

 :git-dependencies [[https://github.com/clojure/clojurescript.git;
 886d8dc81812962d30a741d6d05ce9d90975160f]
                      [https://github.com/levand/domina.git;
 8933b2d12c44832c9bfaecf457a1bc5db251a774]]
   :extra-classpath-dirs [.lein-git-deps/clojurescript/src/clj
                          .lein-git-deps/clojurescript/src/cljs
                          .lein-git-deps/domina/src/cljs
                          src/app/cljs
                          src/app/cljs-macros
                          src/lib/clj
                          src/lib/cljs
                          templates]

 I also executed lein bootstrap and added libraries to the build path
 in Eclipse.

 Now I'm running the app by right clicking on project folder, then Run
 as-Clojure application. In repl I execute: (in-ns 'one.sample.repl)
 (dev-server)). The browser shows up the homepage, but when I click on
 Development tab the exception listed below occurs. Some files
 ClojureScript fiiles are generated but not all. Also empty out
 directory is created in the root folder.

 Any ideas?

 Thanks,
 Daniel

 *** 
 *

 2012-02-17 12:06:17.393:WARN::/development
 java.lang.AssertionError: Assert failed: Can't recur here|frame
         at cljs.compiler$fn__877.invoke(compiler.clj:762)
         at clojure.lang.MultiFn.invoke(MultiFn.java:177)
         at cljs.compiler$analyze_seq.invoke(compiler.clj:1033)
         at cljs.compiler$analyze.invoke(compiler.clj:1086)
         at cljs.compiler$analyze.invoke(compiler.clj:1079)
         at cljs.compiler$fn__801.invoke(compiler.clj:606)
         at clojure.lang.MultiFn.invoke(MultiFn.java:177)
         at cljs.compiler$analyze_seq.invoke(compiler.clj:1033)
         at cljs.compiler$analyze.invoke(compiler.clj:1086)
         at cljs.compiler$analyze.invoke(compiler.clj:1079)
         at cljs.compiler$parse_invoke$fn__1014.invoke(compiler.clj:979)
         at clojure.core$map$fn__3811.invoke(core.clj:2432)
         at clojure.lang.LazySeq.sval(LazySeq.java:42)
         at clojure.lang.LazySeq.seq(LazySeq.java:60)
         at clojure.lang.Cons.next(Cons.java:39)
         at clojure.lang.PersistentVector.create(PersistentVector.java:50)
         at
 clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:
 31)
         at clojure.core$vec.invoke(core.clj:345)
         at cljs.compiler$parse_invoke.invoke(compiler.clj:979)
         at cljs.compiler$analyze_seq.invoke(compiler.clj:1034)
         at cljs.compiler$analyze.invoke(compiler.clj:1086)
         at cljs.compiler$analyze.invoke(compiler.clj:1079)
         at cljs.compiler$fn__801.invoke(compiler.clj:607)
         at clojure.lang.MultiFn.invoke(MultiFn.java:177)
         at cljs.compiler$analyze_seq.invoke(compiler.clj:1033)
         at cljs.compiler$analyze.invoke(compiler.clj:1086)
         at cljs.compiler$analyze.invoke(compiler.clj:1079)
         at cljs.compiler$parse_invoke$fn__1014.invoke(compiler.clj:979)
         at clojure.core$map$fn__3811.invoke(core.clj:2432)
         at clojure.lang.LazySeq.sval(LazySeq.java:42)
         at clojure.lang.LazySeq.seq(LazySeq.java:60)
         at clojure.lang.RT.seq(RT.java:466)
         at
 clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:
 31)
         at clojure.core$vec.invoke(core.clj:345)
         at cljs.compiler$parse_invoke.invoke(compiler.clj:979)
         at cljs.compiler$analyze_seq.invoke(compiler.clj:1034)
         at cljs.compiler$analyze.invoke(compiler.clj:1086)
         at cljs.compiler$analyze.invoke(compiler.clj:1079)
         at cljs.compiler$parse_invoke$fn__1014.invoke(compiler.clj:979)
         at clojure.core$map$fn__3811.invoke(core.clj:2432)
         at clojure.lang.LazySeq.sval(LazySeq.java:42)
         at clojure.lang.LazySeq.seq(LazySeq.java:60)
         at clojure.lang.Cons.next(Cons.java:39)
         at clojure.lang.PersistentVector.create(PersistentVector.java:50)
         at
 clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:
 31)
         at clojure.core$vec.invoke(core.clj:345)
         at cljs.compiler$parse_invoke.invoke(compiler.clj:979)
         at cljs.compiler$analyze_seq.invoke(compiler.clj:1034)
         at cljs.compiler$analyze.invoke(compiler.clj:1086)
         at cljs.compiler$analyze.invoke(compiler.clj:1079)
         at cljs.compiler$analyze_file.invoke(compiler.clj:1105)
         at cljs.compiler$compile_file_STAR_.invoke(compiler.clj:1136)
         at cljs.compiler$compile_file.invoke(compiler.clj:1184

ClojureScript One in Eclipse

2012-02-17 Thread turcio
Hi,
I'm trying to run ClojureScript One using CCW plugin in Eclipse. I
created a new project and imported all the source code into it. Then I
added folders to the build path that reflect the following
configuration from project.clj:

:git-dependencies [[https://github.com/clojure/clojurescript.git;
886d8dc81812962d30a741d6d05ce9d90975160f]
 [https://github.com/levand/domina.git;
8933b2d12c44832c9bfaecf457a1bc5db251a774]]
  :extra-classpath-dirs [.lein-git-deps/clojurescript/src/clj
 .lein-git-deps/clojurescript/src/cljs
 .lein-git-deps/domina/src/cljs
 src/app/cljs
 src/app/cljs-macros
 src/lib/clj
 src/lib/cljs
 templates]

I also executed lein bootstrap and added libraries to the build path
in Eclipse.

Now I'm running the app by right clicking on project folder, then Run
as-Clojure application. In repl I execute: (in-ns 'one.sample.repl)
(dev-server)). The browser shows up the homepage, but when I click on
Development tab the exception listed below occurs. Some files
ClojureScript fiiles are generated but not all. Also empty out
directory is created in the root folder.

Any ideas?

Thanks,
Daniel



2012-02-17 12:06:17.393:WARN::/development
java.lang.AssertionError: Assert failed: Can't recur here|frame
at cljs.compiler$fn__877.invoke(compiler.clj:762)
at clojure.lang.MultiFn.invoke(MultiFn.java:177)
at cljs.compiler$analyze_seq.invoke(compiler.clj:1033)
at cljs.compiler$analyze.invoke(compiler.clj:1086)
at cljs.compiler$analyze.invoke(compiler.clj:1079)
at cljs.compiler$fn__801.invoke(compiler.clj:606)
at clojure.lang.MultiFn.invoke(MultiFn.java:177)
at cljs.compiler$analyze_seq.invoke(compiler.clj:1033)
at cljs.compiler$analyze.invoke(compiler.clj:1086)
at cljs.compiler$analyze.invoke(compiler.clj:1079)
at cljs.compiler$parse_invoke$fn__1014.invoke(compiler.clj:979)
at clojure.core$map$fn__3811.invoke(core.clj:2432)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.PersistentVector.create(PersistentVector.java:50)
at
clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:
31)
at clojure.core$vec.invoke(core.clj:345)
at cljs.compiler$parse_invoke.invoke(compiler.clj:979)
at cljs.compiler$analyze_seq.invoke(compiler.clj:1034)
at cljs.compiler$analyze.invoke(compiler.clj:1086)
at cljs.compiler$analyze.invoke(compiler.clj:1079)
at cljs.compiler$fn__801.invoke(compiler.clj:607)
at clojure.lang.MultiFn.invoke(MultiFn.java:177)
at cljs.compiler$analyze_seq.invoke(compiler.clj:1033)
at cljs.compiler$analyze.invoke(compiler.clj:1086)
at cljs.compiler$analyze.invoke(compiler.clj:1079)
at cljs.compiler$parse_invoke$fn__1014.invoke(compiler.clj:979)
at clojure.core$map$fn__3811.invoke(core.clj:2432)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:466)
at
clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:
31)
at clojure.core$vec.invoke(core.clj:345)
at cljs.compiler$parse_invoke.invoke(compiler.clj:979)
at cljs.compiler$analyze_seq.invoke(compiler.clj:1034)
at cljs.compiler$analyze.invoke(compiler.clj:1086)
at cljs.compiler$analyze.invoke(compiler.clj:1079)
at cljs.compiler$parse_invoke$fn__1014.invoke(compiler.clj:979)
at clojure.core$map$fn__3811.invoke(core.clj:2432)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.PersistentVector.create(PersistentVector.java:50)
at
clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:
31)
at clojure.core$vec.invoke(core.clj:345)
at cljs.compiler$parse_invoke.invoke(compiler.clj:979)
at cljs.compiler$analyze_seq.invoke(compiler.clj:1034)
at cljs.compiler$analyze.invoke(compiler.clj:1086)
at cljs.compiler$analyze.invoke(compiler.clj:1079)
at cljs.compiler$analyze_file.invoke(compiler.clj:1105)
at cljs.compiler$compile_file_STAR_.invoke(compiler.clj:1136)
at cljs.compiler$compile_file.invoke(compiler.clj:1184)
at cljs.compiler$compile_root.invoke(compiler.clj:1244)
at cljs.closure$compile_dir.invoke(closure.clj:304)
at cljs.closure$fn__1377.invoke(closure.clj:336)
at 

Re: Stream closed...

2011-08-13 Thread turcio
I'm really fresh to clojure way of doing things and your answers will
definitely help. Thank you!

Cheers,
Daniel


On 13 Sie, 06:46, Sean Corfield seancorfi...@gmail.com wrote:
 Yeah, I got the impression the OP was trying to create a new file with
 double the contents of the old one - the (str file-path 2) piece - but yours
 is certainly a slick way to double the original file!









 On Fri, Aug 12, 2011 at 8:47 PM, Dave Ray dave...@gmail.com wrote:
  Even shorter:

  (defn duplicate-file-data [file-path] (spit file-path (slurp
  file-path) :append true))

  Dave

  On Fri, Aug 12, 2011 at 11:16 PM, Sean Corfield seancorfi...@gmail.com
  wrote:
   I think you also want to reorganize the code so you get the line-seq and
   then the line-count outside the for loop. And bear in mind that (inc
   line-count) just returns line-count + 1 - it does not update line-count
   which is what I'm guessing you're expecting?
   Or you could just use slurp and spit:
   (defn duplicate-file-data [file-path] (let [content (slurp file-path)]
  (spit
   (str file-path 2) (str content content

   On Fri, Aug 12, 2011 at 8:05 PM, Sean Corfield seancorfi...@gmail.com
   wrote:

   (for ...) generates a lazy sequence so it isn't realized until after the
   value is returned from the function. You need to wrap (for ...) with
  (doall
   ...) to realize the sequence inside (with-open ...)

   On Fri, Aug 12, 2011 at 4:47 PM, turcio tur...@gmail.com wrote:

   Hi,
   I'm trying to write a function which creates file twice as big
   compared to the original file by simply duplicating its content.

   It looks like in the for loop I can't even read the first line
   although I'm using with-open. Can you tell me what am I doing wrong?

   (defn duplicate-file-data [file-path]
    (with-open [reader (clojure.java.io/reader file-path)
                writer (clojure.java.io/writer (str file-path 2) :append
   true)]
                                 (for [line (line-seq reader)
                                       :let [line-count (count(line-seq
   reader))
                                             curr-line 0]
                                       :when ( curr-line line-count)]
                                   ((.write writer (str line))
                                            (.newLine writer)
                                            (inc curr-line))
                                   )))


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


Stream closed...

2011-08-12 Thread turcio
Hi,
I'm trying to write a function which creates file twice as big
compared to the original file by simply duplicating its content.

It looks like in the for loop I can't even read the first line
although I'm using with-open. Can you tell me what am I doing wrong?

(defn duplicate-file-data [file-path]
  (with-open [reader (clojure.java.io/reader file-path)
  writer (clojure.java.io/writer (str file-path 2) :append
true)]
   (for [line (line-seq reader)
 :let [line-count (count(line-seq
reader))
   curr-line 0]
 :when ( curr-line line-count)]
 ((.write writer (str line))
  (.newLine writer)
  (inc curr-line))
 )))


--
Thanks
Daniel

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