Re: C-c C-x keybindings for swank-cdt don't work

2012-01-27 Thread George Jahad
Sorry, the elisp got scrambled in the post.

Get it from here:
http://georgejahad.com/clojure/swank-cdt-helper.el



On Jan 27, 7:15 pm, George Jahad  wrote:
> Not sure why that is happening.  Can't reproduce it.  What is supposed
> to happen is that when swank-cdt is loaded, it should invoke the emacs
> lisp to define those keystrokes.
>
> Until I figure it out, try adding the following to your .emacs.  Let
> me know if that fixes it.
>
> g
>
> (progn (defun sldb-line-bp (&optional _) "Set breakpoint on current
> buffer line." (interactive) (slime-eval-async (list (quote swank:sldb-
> line-bp) (buffer-file-name) (line-number-at-pos (defun slime-force-
> continue (&optional _) "force swank server to continue" (interactive)
> (slime-dispatch-event (quote (:emacs-interrupt :cdt (defun slime-
> get-thing-at-point (&optional _) (interactive) (let ((thing (thing-at-
> point (quote sexp (set-text-properties 0 (length thing) nil thing)
> thing)) (defun slime-eval-last-frame (&optional _) "Eval thing at
> point in the context of the last frame viewed" (interactive) (slime-
> eval-with-transcript (list (quote swank:eval-last-frame) (slime-get-
> thing-at-point (define-prefix-command (quote cdt-map)) (define-key
> cdt-map (kbd "C-b") (quote sldb-line-bp)) (define-key cdt-map (kbd "C-
> g") (quote slime-force-continue)) (define-key cdt-map (kbd "C-p")
> (quote slime-eval-last-frame)) (eval-after-load (quote slime) (quote
> (progn (define-key slime-mode-map (kbd "C-c C-x") (quote cdt-map))
> (define-key sldb-mode-map (kbd "C-c C-x") (quote cdt-map) (eval-
> after-load (quote slime-repl) (quote (define-key slime-repl-mode-map
> (kbd "C-c C-x") (quote cdt-map (eval-after-load (quote cc-mode)
> (quote (define-key java-mode-map (kbd "C-c C-x") (quote cdt-map)
>
> On Jan 26, 10:06 pm, Gregg Williams  wrote:
>
> > Hi--After several attempts, I've gotten CDB working...sort of, and I'm
> > stuck.
>
> > Following the example onhttp://georgejahad.com/clojure/swank-cdt.html,
> > I execute the following:
>
> > (use 'clojure.set)
> > (use 'swank.cdt)
> > (set-bp clojure.set/difference)
>
> > which execute OK. When I execute:
>
> > user> (difference #{1 2} #{2 3})
> > CDT location is clojure/set.clj:53:0:/Users/gw/tech/clojurestuff/
> > cljprojects/infwb/lib/clojure-1.3.jar
>
> > the *sldb clojure/3* buffer appears, as does the source code for the
> > function `difference`, within the source file `set.clj`.
>
> > Using the `e` command, I can print the value of `s1` in the Emacs
> > minibuffer.
>
> > Here's my problem: when I attempt to use any of the C-c C-x commands
> > (e.g., C-c C-x C-p), the minibuffer complains that the command is not
> > defined.
>
> > Following George Jahad's suggestions 
> > onhttp://groups.google.com/group/clojure/browse_thread/thread/2295f4550...,
> > I find that `sldb-line-bp` is defined, but I can't find `cdt-map`.
>
> > Also, his suggestion of executing (swank.core.cdt-utils/init-emacs-
> > helper-functions) from the REPL doesn't make any difference--I still
> > get the same behavior reported above.
>
> > I'm using Emacs 24; could that be causing any problems?
>
> > I'm using Leiningen 1.6.2, I have lein-midje-1.0.8 loaded in `~/.lein/
> > plugins`, and my project.clj file is below.
>
> > Thanks for any suggestions you might have.
>
> > --- project.clj ---
>
> > (defproject infwb "1.0.0-SNAPSHOT"
> >   :description "an evolving, experimental workspace for manipulating
> > infocards"
> >   :main infwb.core
>
> >   :dependencies [[org.clojure/clojure "1.3"]
> >                  [org.clojure/clojure-contrib "[1.2.0,1.2.1]"]
> >                  [seesaw "1.2.0"]
> >                  [org.clojars.gw666/sxqj "beta2"]
> >                  [org.clojars.gw666/piccolo2dcore "1.3"]
> >                  [org.clojars.gw666/piccolo2dextras "1.3"]
> >                  [com.miglayout/miglayout "3.7.4"]
> >                  ]
> >   :dev-dependencies [[midje "1.3.1"]
> >                      [clojure-source "1.3.0"]
> >                      [swank-clojure "1.4.0-SNAPSHOT"]]
> >   :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"])
>
> > --- end ---

-- 
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: C-c C-x keybindings for swank-cdt don't work

2012-01-27 Thread George Jahad

Not sure why that is happening.  Can't reproduce it.  What is supposed
to happen is that when swank-cdt is loaded, it should invoke the emacs
lisp to define those keystrokes.

Until I figure it out, try adding the following to your .emacs.  Let
me know if that fixes it.

g

(progn (defun sldb-line-bp (&optional _) "Set breakpoint on current
buffer line." (interactive) (slime-eval-async (list (quote swank:sldb-
line-bp) (buffer-file-name) (line-number-at-pos (defun slime-force-
continue (&optional _) "force swank server to continue" (interactive)
(slime-dispatch-event (quote (:emacs-interrupt :cdt (defun slime-
get-thing-at-point (&optional _) (interactive) (let ((thing (thing-at-
point (quote sexp (set-text-properties 0 (length thing) nil thing)
thing)) (defun slime-eval-last-frame (&optional _) "Eval thing at
point in the context of the last frame viewed" (interactive) (slime-
eval-with-transcript (list (quote swank:eval-last-frame) (slime-get-
thing-at-point (define-prefix-command (quote cdt-map)) (define-key
cdt-map (kbd "C-b") (quote sldb-line-bp)) (define-key cdt-map (kbd "C-
g") (quote slime-force-continue)) (define-key cdt-map (kbd "C-p")
(quote slime-eval-last-frame)) (eval-after-load (quote slime) (quote
(progn (define-key slime-mode-map (kbd "C-c C-x") (quote cdt-map))
(define-key sldb-mode-map (kbd "C-c C-x") (quote cdt-map) (eval-
after-load (quote slime-repl) (quote (define-key slime-repl-mode-map
(kbd "C-c C-x") (quote cdt-map (eval-after-load (quote cc-mode)
(quote (define-key java-mode-map (kbd "C-c C-x") (quote cdt-map)

On Jan 26, 10:06 pm, Gregg Williams  wrote:
> Hi--After several attempts, I've gotten CDB working...sort of, and I'm
> stuck.
>
> Following the example onhttp://georgejahad.com/clojure/swank-cdt.html,
> I execute the following:
>
> (use 'clojure.set)
> (use 'swank.cdt)
> (set-bp clojure.set/difference)
>
> which execute OK. When I execute:
>
> user> (difference #{1 2} #{2 3})
> CDT location is clojure/set.clj:53:0:/Users/gw/tech/clojurestuff/
> cljprojects/infwb/lib/clojure-1.3.jar
>
> the *sldb clojure/3* buffer appears, as does the source code for the
> function `difference`, within the source file `set.clj`.
>
> Using the `e` command, I can print the value of `s1` in the Emacs
> minibuffer.
>
> Here's my problem: when I attempt to use any of the C-c C-x commands
> (e.g., C-c C-x C-p), the minibuffer complains that the command is not
> defined.
>
> Following George Jahad's suggestions 
> onhttp://groups.google.com/group/clojure/browse_thread/thread/2295f4550...,
> I find that `sldb-line-bp` is defined, but I can't find `cdt-map`.
>
> Also, his suggestion of executing (swank.core.cdt-utils/init-emacs-
> helper-functions) from the REPL doesn't make any difference--I still
> get the same behavior reported above.
>
> I'm using Emacs 24; could that be causing any problems?
>
> I'm using Leiningen 1.6.2, I have lein-midje-1.0.8 loaded in `~/.lein/
> plugins`, and my project.clj file is below.
>
> Thanks for any suggestions you might have.
>
> --- project.clj ---
>
> (defproject infwb "1.0.0-SNAPSHOT"
>   :description "an evolving, experimental workspace for manipulating
> infocards"
>   :main infwb.core
>
>   :dependencies [[org.clojure/clojure "1.3"]
>                  [org.clojure/clojure-contrib "[1.2.0,1.2.1]"]
>                  [seesaw "1.2.0"]
>                  [org.clojars.gw666/sxqj "beta2"]
>                  [org.clojars.gw666/piccolo2dcore "1.3"]
>                  [org.clojars.gw666/piccolo2dextras "1.3"]
>                  [com.miglayout/miglayout "3.7.4"]
>                  ]
>   :dev-dependencies [[midje "1.3.1"]
>                      [clojure-source "1.3.0"]
>                      [swank-clojure "1.4.0-SNAPSHOT"]]
>   :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"])
>
> --- end ---

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

2012-01-27 Thread Jay Fields
There's nothing wrong with getting deliberately loaded. 

Sent from my iPhone

On Jan 27, 2012, at 7:45 PM, Sean Corfield  wrote:

> On Fri, Jan 27, 2012 at 1:40 PM, Stuart Sierra
>  wrote:
>> *I* value most of these things, but I'm not going to try to speak for anyone
>> else. I've learned that lesson the hard way.
> 
> And I think the questions are deliberately loaded :)
> -- 
> 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

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

2012-01-27 Thread Sean Corfield
On Fri, Jan 27, 2012 at 1:40 PM, Stuart Sierra
 wrote:
> *I* value most of these things, but I'm not going to try to speak for anyone
> else. I've learned that lesson the hard way.

And I think the questions are deliberately loaded :)
-- 
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: language agnostic nrepl client test suite

2012-01-27 Thread Chas Emerick
Meikel has a solid bencode implementation that he's going to contribute; that's 
what I'm using in my reboot of nrepl.  I think the idea of having all of the 
test interactions stored as file — maybe keeping the ones involving nontextual 
data separate — is great, and should allow other nrepl client implementations 
to reuse the same source of data as nrepl itself.

Hopefully I'll have the start of things committed to github ~Monday.

- Chas

On Jan 23, 2012, at 6:26 PM, Martin DeMello wrote:

> It is often convenient to have an nrepl client in a non-jvm language -
> so far I've written one in ocaml and Meikel Brandmeyer has one in
> factor, that I know of. I'd like to get some ideas for a way to test
> client compliance in a language agnostic manner - this will be
> especially helpful when nrepl.next is rolled out.
> 
> One idea I had was to maintain a text file with a list of
> request/response pairs, where  was a string and 
> was the expected nrepl response encoded in a standard third-party
> format like json (though i'm not sure how well that copes with binary
> blobs) - clients could then submit the request to a running server,
> decode both the nrepl response and the testfile response, and compare
> the resulting in-memory data structures. As a bonus, the official
> clojure client test suite could use this too.
> 
> The other option would be to run all the requests against the server,
> collect the responses as literal strings, and decode those in the
> client. The advantage of this would be that it would not need a server
> running (always a good thing for tests); on the other hand it's easier
> to get out of sync, or miss testing network-related issues.
> 
> martin
> 
> -- 
> 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: Adding primitive type hints to anonymous functions

2012-01-27 Thread Tassilo Horn
Ben Mabey  writes:

> Should a ticket be created for this then?

Yes, please.  And add a link to this discussion.

Bye,
Tassilo

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


Re: Adding primitive type hints to anonymous functions

2012-01-27 Thread Ben Mabey

On 1/26/12 5:07 AM, Cedric Greevey wrote:

On Thu, Jan 26, 2012 at 5:54 AM, Tassilo Horn  wrote:

Cedric Greevey  writes:


On Thu, Jan 26, 2012 at 2:28 AM, Tassilo Horn  wrote:

At least, it seems that (fn ^double [^double x] (+ x 0.5)) compiles to a
class supporting primitive, unboxed calls.

Yes. That was my conclusion also. But apparently the only way to get
the compiler to emit such a call is by binding the fn to a global Var
with the appropriate hints and calling that.

Yeah, I know.  And now I can also see it in the Compiler's InvokeExpr
class.  In its constructor, there's some extra work in case of a VarExpr
where the signature :tag metadata is pulled out from the :arglists
metadata.

Why is the :arglists metadata added to the Var a function's bound to
instead of the function itself?

AFAICT, the compiler will need to know the call is definitely
primitive and the fn is definitely primitive-compatible at compile
time if it is to safely emit a primitive call. This is why I tried a
^Ifn$DD hint on the variable at one point.

When the fn comes from a non-dynamic Var the compiler can easily be
sure what primitive signatures it supports.

When the fn is potentially runtime-variable, it seems to me that a
hint on the local *should* suffice, and type inference from
assignments *should* be possible, as it is for locals assigned
primitive values. (If the hint was wrong, you'd get runtime
ClassCastExceptions such as my_ns.my_defn$fn_3072 cannot be cast to
clojure.lang.IFn$DD, much as you can get various CCEs with incorrect
(reference) type hints elsewhere.) However, this seems to be either
broken or not implemented yet.


Should a ticket be created for this then?

--
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 add a new type of collection?

2012-01-27 Thread Ben Mabey

On 1/27/12 9:11 AM, Walter van der Laan wrote:

Are you somehow required to use the Java library?

Otherwise you could also use a Clojure map as a sparse matrix.
This will be much easier to implement.

Using a clojure map to store a sparse matrix is not a good solution if 
you plan on doing any serious computation on it.  Reason being is that 
clojure's collections don't yet support primitive types (with the 
exception of vector, but most operations on it will result in boxing).


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

2012-01-27 Thread Jules
A healthy mix of course! There even has been some research on the
second point. It turned out that unit tests and code review (=~
thinking) catch largely disjoint sets of bugs.

Other than that, you need to randomize X over Y vs Y over X in order
to get sound results.

On Jan 27, 3:25 pm, a...@puredanger.com wrote:
> If you have trouble viewing or submitting this form, you can fill it out
> online:https://docs.google.com/spreadsheet/viewform?formkey=dFpleU1QbVRyLWVX...
>
> Clojure Community Values
>
> For no particular reason I got to thinking about things the Clojure
> community values in the style of the Agile manifesto, that is "we value ___
> over ___" with the caveat that we may find both valuable, but one more than
> the other. This survey is not serious, or important, or binding. Maybe the
> results will be useless but perhaps they will be interesting. Blatant
> commercial: if you want to discuss, why not check out Clojure/West in San
> Jose, Mar 16-17 (http://clojurewest.org), early bird registration ends hmmm
> today!
>
> In the Clojure community, we value... *
>
> Emphatic yes Yes No Actually, the opposite
>
> Code over ideas
>
> Thinking over tests
>
> Data over interfaces
>
> Values over variables
>
> Public over private
>
> Accessibility over encapsulation
>
> Simple over easy
>
> Eggs over easy
>
> Man, you totally screwed up. These are better: Add one per line. If they're
> good I'll add them to the list above.
>
> Powered by Google Docs Report Abuse - Terms of Service - Additional Terms

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

2012-01-27 Thread Stuart Sierra
I appreciate the intent, Alex, but I am reluctant to say what "we" value, 
since "we" on this list alone is nearly six thousand people.

*I* value most of these things, but I'm not going to try to speak for 
anyone else. I've learned that lesson the hard way.

-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: problems with if

2012-01-27 Thread Roman Perepelitsa
2012/1/26 raschedh 

> (if true "t" f)
>
> in a fresh REPL, I get the error
>
> [...] Unable to resolve symbol: f [...]
>
> In common lisp, for example:
>
> (if t "t" f)
> evaluates to "t".


Try (if t "t" blah) in common lisp, you'll get the same error.

Roman Perepelitsa.

-- 
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: problems with if

2012-01-27 Thread Roman Perepelitsa
2012/1/27 Roman Perepelitsa 

> Try (if t "t" blah) in common lisp, you'll get the same error.
>

I just tried it and it resolves to "t" in Common Lisp. Sorry about that :-/

Cedric's reply is the one you are looking for.

Roman Perepelitsa.

-- 
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: Clojure 1.4.0-alpha5 and ClojureScript 0.0-971

2012-01-27 Thread Stuart Sierra
Coming to a Maven repository near you within the next few hours.


Clojure release 1.4.0-alpha5
-

* CLJ-871 Instant reader literal

* CLJ-914 UUID reader literal

* Documentation for reader literals on clojure.core/*data-readers*

* Fix Ant build on JDK 1.7



ClojureScript release 0.0-971
---

* CLJS-136 reduce bug

* CLJS-135 apply bug

* CLJS-33 printable/comparable types

* CLJS-134, lib & externs from classpath

* release build on Hudson, triggered manually

* various bug fixes

-- 
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: (:require-macros ...) produces empty js file

2012-01-27 Thread philip k
Sure. I uploaded a minimal project here: 
http://dl.dropbox.com/u/30225560/macros.tar.gz

The build.sh script just sets up the classpath as I didn't want any
additional dependencies on lein etc. The global classpath is properly
set up with clojure on it, $CLOJURRESCRIPT_HOME is set up as well.

Here is what happens:

* no (:require-macros ...)

$ ./build.sh
/Users/phil/Projects/clojure-1.3.0:./src
WARNING: The form (. this toString) is no longer a property access.
Maybe you meant (. this -toString) instead?
WARNING: The form (. this toString) is no longer a property access.
Maybe you meant (. this -toString) instead?
WARNING: The form (. (js-keys hashobj) sort) is no longer a property
access. Maybe you meant (. (js-keys hashobj) -sort) instead?
WARNING: The form (. this toString) is no longer a property access.
Maybe you meant (. this -toString) instead?
WARNING: The form (. this toString) is no longer a property access.
Maybe you meant (. this -toString) instead?
WARNING: The form (. (js-keys hashobj) sort) is no longer a property
access. Maybe you meant (. (js-keys hashobj) -sort) instead?

$ ls -la out/base/
total 8
drwxr-xr-x  3 phil  staff  102 Jan 27 18:12 ./
drwxr-xr-x  5 phil  staff  170 Jan 27 18:12 ../
-rw-r--r--  1 phil  staff  185 Jan 27 18:12 core.js

(BTW what are those warnings? I haven't compiled directly from the cmd
line for a while now and don't remember them. Maybe they have
something to do with all this?) core.js is generated properly.

* now with (:require-macros ...)

$ ./build.sh
/Users/phil/Projects/clojure-1.3.0:./src
WARNING: The form (. this toString) is no longer a property access.
Maybe you meant (. this -toString) instead?
WARNING: The form (. this toString) is no longer a property access.
Maybe you meant (. this -toString) instead?
WARNING: The form (. (js-keys hashobj) sort) is no longer a property
access. Maybe you meant (. (js-keys hashobj) -sort) instead?
Exception in thread "main" java.lang.RuntimeException:
java.io.FileNotFoundException: Could not locate base/
macros__init.class or base/macros.clj on classpath:
   ... stacktrace

Now the plot thickens. base/macros.clj *should* be on the classpath
but the Clojure compiler can't find it. When I build again (with NO
modifications to ANYTHING whatsoever):

$ ./build.sh
/Users/phil/Projects/clojure-1.3.0:./src
$

It suddenly works! This is reproducible - invoking ./build.sh throws
an exception the first time and "succeeds" on the second when
(:require-macros ...) is included. By "succeeds" I mean the following:

$ ls -la out/base/
total 0
drwxr-xr-x  3 phil  staff  102 Jan 27 18:12 ./
drwxr-xr-x  5 phil  staff  170 Jan 27 18:12 ../
-rw-r--r--  1 phil  staff0 Jan 27 18:16 core.js

i.e. core.js is empty. Very strange.

On Jan 27, 5:16 pm, David Nolen  wrote:
> On Fri, Jan 27, 2012 at 1:26 AM, philip k  wrote:
> > Hi, I'm using cljs-watch to cross compile generic Clojure code into
> > both class files and js files using the latest master Clojurescript
> > checkout; this all works wonderfully until I try to add a (:require-
> > macros ...) directive as follows:
>
> > // in xyz.base.view
>
> > (ns xyz.base.view
> >  (:require ...
> >  (:require-macros [hs.base.macros :as monads]))
>
> > // in xyz.base.macros
>
> > (ns hs.base.macros)
>
> > in which case the compiled xyz/base/view.js file is empty (0 bytes)
> > and the Clojurescript compiler doesn't produce any errors. When I
> > remove the (:require-macros ...) directive the js file is generated as
> > expected.
>
> > Has anyone encountered a similar problem? Many thanks for any advice!
>
> Can you create a minimal test case with all the involved files and paste
> that somewhere? What is the hs.base.macros dependency?
>
> 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: New Version of ClojureScript One

2012-01-27 Thread Christofer Jennings
I get the error below when I run ClojureScript One's 'lein bootsrap'. Any ideas?

I'm pretty new to Clojure. This is my first time using Leiningen and first 
attempt at using ClojureScript. ... pretty hopeless :-) 

Mac OSX 10.7.2
Clojure 1.3.0
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

Exception in thread "main" java.lang.RuntimeException: 
java.lang.NoSuchMethodError: 
clojure.lang.KeywordLookupSite.(ILclojure/lang/Keyword;)V
at clojure.lang.Util.runtimeException(Util.java:165)
at clojure.lang.Compiler.eval(Compiler.java:6476)
at clojure.lang.Compiler.eval(Compiler.java:6431)
at clojure.core$eval.invoke(core.clj:2795)
at clojure.main$eval_opt.invoke(main.clj:296)
at clojure.main$initialize.invoke(main.clj:315)
at clojure.main$script_opt.invoke(main.clj:339)
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)
Caused by: java.lang.NoSuchMethodError: 
clojure.lang.KeywordLookupSite.(ILclojure/lang/Keyword;)V
at leiningen.util.paths$native_arch_path.(paths.clj:32)
at leiningen.util.paths__init.load(Unknown Source)
at leiningen.util.paths__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:2030)
at clojure.lang.RT.load(RT.java:417)
at clojure.lang.RT.load(RT.java:398)
at clojure.core$load$fn__4610.invoke(core.clj:5386)
at clojure.core$load.doInvoke(core.clj:5385)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5200)
at clojure.core$load_lib.doInvoke(core.clj:5237)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$load_libs.doInvoke(core.clj:5271)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$require.doInvoke(core.clj:5352)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at leiningen.core$loading__4414__auto__.invoke(core.clj:1)
at leiningen.core__init.load(Unknown Source)
at leiningen.core__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:2030)
at clojure.lang.RT.load(RT.java:417)
at clojure.lang.RT.load(RT.java:398)
at clojure.core$load$fn__4610.invoke(core.clj:5386)
at clojure.core$load.doInvoke(core.clj:5385)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5200)
at clojure.core$load_lib.doInvoke(core.clj:5237)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$load_libs.doInvoke(core.clj:5271)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:604)
at clojure.core$use.doInvoke(core.clj:5363)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval1.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6465)
... 11 more

Thanks for all the cool stuff!
,chris

On Jan 26, 2012, at 3:34 AM, Sam Aaron wrote:

> 
> On 25 Jan 2012, at 22:27, Brenton wrote:
> 
>> ClojureScript will continue to change rapidly. We are already
>> depending on a newer version than the one in Maven. Also, I don't
>> think that Domina has a release yet.
>> 
>> For times when we only need a source dependency and only at
>> development time, I like this approach to dependencies. I plan to
>> continue improving support for this in Leiningen and using it as much
>> as i can.
>> 
> 
> Sounds extremely sensible. 
> 
>> For more of the rationale, see 
>> https://github.com/brentonashworth/one/wiki/Dependencies.
> 
> Wow. Documentation like this makes me want to shout out with joy!
> 
>> You rock!
> 
> We all rock, and soon we'll all be rocking together at the Clojure/West 
> Overtone unjam... I can't wait :-)
> 
> Sam
> 
> ---
> http://sam.aaron.name
> 
> 
> -- 
> 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 r

Re: Why don't these two functions produce equivalent results?

2012-01-27 Thread Bill Robertson
Yes, I see that now. When I read "When applied to a transient map,
adds mapping of key(s) to val(s)" in the doc string, I understood that
to mean that it modified the existing map, and the (insufficient)
poking around that I did in the repl supported that. (actually did it
past 8 now - saw it fail in same way).

I guess under the hood its a essentially the same sort of persistent
data structure but with chunking (buffering) before it grows.

If I wanted to submit alternate wording for the doc string, how would
I do that? i.e. where is the process for contributing outlined?

e.g. "When applied to a transient map, adds mapping of key(s) to
val(s) in the resulting map."

Thanks
-Bill

On Jan 27, 4:13 pm, David Nolen  wrote:
> On Fri, Jan 27, 2012 at 3:08 PM, Bill Robertson
> wrote:
>
> > I have read (doc transient), (doc assoc!) and (doc persistent!), and I
> > don't see what I'm missing, which is why I came here for help.
>
> The documentation herehttp://clojure.org/transientssays:
>
> "Don't bash in place"
>
> Note that all the examples are done in a functional style - they actually
> use the value produced by each operation.
>
> 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: Why don't these two functions produce equivalent results?

2012-01-27 Thread Bill Robertson
I have read (doc transient), (doc assoc!) and (doc persistent!), and I
don't see what I'm missing, which is why I came here for help.

To my understanding, the first creates a transient collection, which
cannot be used in other threads, and cannot be used after converting
back to a persistent collection.

user=> (doc assoc!)
-
clojure.core/assoc!
([coll key val] [coll key val & kvs])
  Alpha - subject to change.
  When applied to a transient map, adds mapping of key(s) to
  val(s). When applied to a transient vector, sets the val at index.
  Note - index must be <= (count vector). Returns coll.

assoc!'s doc says that it adds mapping of keys to values when applied
to a map, which is what this code demonstrates.

user=> (def t (transient {}))
#'user/t
user=> (assoc! t 1 1)
#
user=> (assoc! t 2 2)
#
user=> (def p (persistent! t))
#'user/p
user=> p
{1 1, 2 2}

It says that it returns col. Does that imply that I'm supposed to hang
on to col?




On Jan 27, 3:50 pm, Kevin Downey  wrote:
> Please don't use transients unless you read and understand the
> documentation.
> On Jan 27, 2012 12:41 PM, "Bill Robertson" 
> wrote:
>
>
>
>
>
>
>
> > I don't understand why the two functions below (recurs and transi) do
> > not produce the same result. To the best of my understanding doseq
> > will consume an entire sequence as demonstrated here:
>
> > user=> (doseq [x (range 0 10)] (print x))
> > 0123456789nil
>
> > user=> *clojure-version*
> > {:major 1, :minor 3, :incremental 0, :qualifier nil}
>
> > user=> (defn recurs [dest src]
> >  (if-let [element (first src)]
> >    (recur (assoc dest element element) (rest src))
> >    dest))
> > #'user/recurs
> > user=> (count (recurs {} (range 0 2)))
> > 2
>
> > user=> (defn transi [dest src]
> >  (let [temp (transient dest)]
> >    (doseq [x src]
> >      (assoc! temp x x))
> >    (persistent! temp)))
> > #'user/transi
> > user=> (count (transi {} (range 0 2)))
> > 8
> > user=> (count (transi {} (range 0 20)))
> > 8
> > user=> (count (transi {} (range 0 8)))
> > 8
> > user=> (count (transi {} (range 0 7)))
> > 7
>
> > Any ideas about why the first function does not behave the same as the
> > second?
>
> > Thanks
>
> > --
> > 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: Why don't these two functions produce equivalent results?

2012-01-27 Thread David Nolen
On Fri, Jan 27, 2012 at 3:08 PM, Bill Robertson
wrote:

> I have read (doc transient), (doc assoc!) and (doc persistent!), and I
> don't see what I'm missing, which is why I came here for help.


The documentation here http://clojure.org/transients says:

"Don't bash in place"

Note that all the examples are done in a functional style - they actually
use the value produced by each operation.

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: Why don't these two functions produce equivalent results?

2012-01-27 Thread Bill Robertson
I have read (doc transient), (doc assoc!) and (doc persistent!), and I
don't see what I'm missing, which is why I came here for help.

To my understanding, the first creates a transient collection, which
cannot be used in other threads, and cannot be used after converting
back to a persistent collection.

user=> (doc assoc!)
-
clojure.core/assoc!
([coll key val] [coll key val & kvs])
  Alpha - subject to change.
  When applied to a transient map, adds mapping of key(s) to
  val(s). When applied to a transient vector, sets the val at index.
  Note - index must be <= (count vector). Returns coll.

assoc!'s doc says that it adds mapping of keys to values when applied
to a map, which is what this code demonstrates.

user=> (def t (transient {}))
#'user/t
user=> (assoc! t 1 1)
#
user=> (assoc! t 2 2)
#
user=> (def p (persistent! t))
#'user/p
user=> p
{1 1, 2 2}

It says that it returns col. Does that imply that I'm supposed to hang
on to col?




On Jan 27, 3:50 pm, Kevin Downey  wrote:
> Please don't use transients unless you read and understand the
> documentation.
> On Jan 27, 2012 12:41 PM, "Bill Robertson" 
> wrote:
>
>
>
>
>
>
>
> > I don't understand why the two functions below (recurs and transi) do
> > not produce the same result. To the best of my understanding doseq
> > will consume an entire sequence as demonstrated here:
>
> > user=> (doseq [x (range 0 10)] (print x))
> > 0123456789nil
>
> > user=> *clojure-version*
> > {:major 1, :minor 3, :incremental 0, :qualifier nil}
>
> > user=> (defn recurs [dest src]
> >  (if-let [element (first src)]
> >    (recur (assoc dest element element) (rest src))
> >    dest))
> > #'user/recurs
> > user=> (count (recurs {} (range 0 2)))
> > 2
>
> > user=> (defn transi [dest src]
> >  (let [temp (transient dest)]
> >    (doseq [x src]
> >      (assoc! temp x x))
> >    (persistent! temp)))
> > #'user/transi
> > user=> (count (transi {} (range 0 2)))
> > 8
> > user=> (count (transi {} (range 0 20)))
> > 8
> > user=> (count (transi {} (range 0 8)))
> > 8
> > user=> (count (transi {} (range 0 7)))
> > 7
>
> > Any ideas about why the first function does not behave the same as the
> > second?
>
> > Thanks
>
> > --
> > 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: Why don't these two functions produce equivalent results?

2012-01-27 Thread David Nolen
On Fri, Jan 27, 2012 at 2:41 PM, Bill Robertson
wrote:

> I don't understand why the two functions below (recurs and transi) do
> not produce the same result. To the best of my understanding doseq
> will consume an entire sequence as demonstrated here:
>
> user=> (doseq [x (range 0 10)] (print x))
> 0123456789nil
>
> user=> *clojure-version*
> {:major 1, :minor 3, :incremental 0, :qualifier nil}
>
> user=> (defn recurs [dest src]
>  (if-let [element (first src)]
>(recur (assoc dest element element) (rest src))
>dest))
> #'user/recurs
> user=> (count (recurs {} (range 0 2)))
> 2
>
> user=> (defn transi [dest src]
>  (let [temp (transient dest)]
>(doseq [x src]
>  (assoc! temp x x))
>(persistent! temp)))
> #'user/transi
> user=> (count (transi {} (range 0 2)))
> 8
> user=> (count (transi {} (range 0 20)))
> 8
> user=> (count (transi {} (range 0 8)))
> 8
> user=> (count (transi {} (range 0 7)))
> 7
>
> Any ideas about why the first function does not behave the same as the
> second?
>
> Thanks


You can not bash transients like that. They must be operated on in a
functional way.

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

CLJS: Checked Arithmetic?

2012-01-27 Thread David Nolen
In this branch
https://github.com/clojure/clojurescript/compare/master...checked-arithmetic,
I've implemented one possible approach to checked arithmetic for
ClojureScript. In Clojure this means checking for overflow. In JavaScript a
much more common source of error is type coercion from the arithmetic
operators as well as the introduction of Infinity and NaN.

These changes would prevent the production of NaN and Infinity at least
from within ClojureScript itself. Also operations like:

(+ 1 2 "3")

fail instead of producing

"33"

Of course such changes would impose a performance hit. You can currently
toggle the behavior with the following macro:

(set-unchecked-arithmetic! true)

This is useful when writing performance sensitive code.

Feedback, improvements appreciated.

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: Why don't these two functions produce equivalent results?

2012-01-27 Thread Kevin Downey
Please don't use transients unless you read and understand the
documentation.
On Jan 27, 2012 12:41 PM, "Bill Robertson" 
wrote:

> I don't understand why the two functions below (recurs and transi) do
> not produce the same result. To the best of my understanding doseq
> will consume an entire sequence as demonstrated here:
>
> user=> (doseq [x (range 0 10)] (print x))
> 0123456789nil
>
> user=> *clojure-version*
> {:major 1, :minor 3, :incremental 0, :qualifier nil}
>
> user=> (defn recurs [dest src]
>  (if-let [element (first src)]
>(recur (assoc dest element element) (rest src))
>dest))
> #'user/recurs
> user=> (count (recurs {} (range 0 2)))
> 2
>
> user=> (defn transi [dest src]
>  (let [temp (transient dest)]
>(doseq [x src]
>  (assoc! temp x x))
>(persistent! temp)))
> #'user/transi
> user=> (count (transi {} (range 0 2)))
> 8
> user=> (count (transi {} (range 0 20)))
> 8
> user=> (count (transi {} (range 0 8)))
> 8
> user=> (count (transi {} (range 0 7)))
> 7
>
> Any ideas about why the first function does not behave the same as the
> second?
>
> Thanks
>
> --
> 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

Why don't these two functions produce equivalent results?

2012-01-27 Thread Bill Robertson
I don't understand why the two functions below (recurs and transi) do
not produce the same result. To the best of my understanding doseq
will consume an entire sequence as demonstrated here:

user=> (doseq [x (range 0 10)] (print x))
0123456789nil

user=> *clojure-version*
{:major 1, :minor 3, :incremental 0, :qualifier nil}

user=> (defn recurs [dest src]
  (if-let [element (first src)]
(recur (assoc dest element element) (rest src))
dest))
#'user/recurs
user=> (count (recurs {} (range 0 2)))
2

user=> (defn transi [dest src]
  (let [temp (transient dest)]
(doseq [x src]
  (assoc! temp x x))
(persistent! temp)))
#'user/transi
user=> (count (transi {} (range 0 2)))
8
user=> (count (transi {} (range 0 20)))
8
user=> (count (transi {} (range 0 8)))
8
user=> (count (transi {} (range 0 7)))
7

Any ideas about why the first function does not behave the same as the
second?

Thanks

-- 
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 def, vars, and binding

2012-01-27 Thread Chris Perkins
You should be calling Thread.start in the clojure version, not Thread.run. 
 Your set-timeout is just blocking for a while and then running the 
passed-in function on the caller's thread.

- Chris

-- 
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: Avoiding reflection in vector-of

2012-01-27 Thread Michael Wood
On 25 January 2012 23:30, Bryce  wrote:
[...]
> ;All of these spend most of their time in reflection
> (apply vector-of :int (range 1000))
> (apply vector-of :int ^"[J>" (range 1000))
> (apply vector-of :int ^"[J>" (long-array (range 1000)))
> (apply vector-of :int ^{:tag 'longs} (long-array (range 1000)))

Just a guess.  Have you tried the following?

(apply vector-of :long ...)

-- 
Michael Wood 

-- 
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: (:require-macros ...) produces empty js file

2012-01-27 Thread David Nolen
On Fri, Jan 27, 2012 at 1:26 AM, philip k  wrote:

> Hi, I'm using cljs-watch to cross compile generic Clojure code into
> both class files and js files using the latest master Clojurescript
> checkout; this all works wonderfully until I try to add a (:require-
> macros ...) directive as follows:
>
> // in xyz.base.view
>
> (ns xyz.base.view
>  (:require ...
>  (:require-macros [hs.base.macros :as monads]))
>
> // in xyz.base.macros
>
> (ns hs.base.macros)
>
> in which case the compiled xyz/base/view.js file is empty (0 bytes)
> and the Clojurescript compiler doesn't produce any errors. When I
> remove the (:require-macros ...) directive the js file is generated as
> expected.
>
> Has anyone encountered a similar problem? Many thanks for any advice!


Can you create a minimal test case with all the involved files and paste
that somewhere? What is the hs.base.macros dependency?

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 add a new type of collection?

2012-01-27 Thread Walter van der Laan
Are you somehow required to use the Java library?

Otherwise you could also use a Clojure map as a sparse matrix.
This will be much easier to implement.

Walter

-- 
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: problems with if

2012-01-27 Thread Cedric Greevey
On Thu, Jan 26, 2012 at 5:16 PM, raschedh  wrote:
> Hello, world !
>
> Because that is my first post, I can not resist to say
> "Thank you !!!" for clojure. I like it at lot.
>
> When I type
>
> (if true "t" f)
>
> in a fresh REPL, I get the error
>
> [...] Unable to resolve symbol: f [...]

Unlike in Common Lisp, Clojure resolves symbols at compile time.

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


(:require-macros ...) produces empty js file

2012-01-27 Thread philip k
Hi, I'm using cljs-watch to cross compile generic Clojure code into
both class files and js files using the latest master Clojurescript
checkout; this all works wonderfully until I try to add a (:require-
macros ...) directive as follows:

// in xyz.base.view

(ns xyz.base.view
  (:require ...
  (:require-macros [hs.base.macros :as monads]))

// in xyz.base.macros

(ns hs.base.macros)

in which case the compiled xyz/base/view.js file is empty (0 bytes)
and the Clojurescript compiler doesn't produce any errors. When I
remove the (:require-macros ...) directive the js file is generated as
expected.

Has anyone encountered a similar problem? Many thanks for any advice!

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


ClojureScript def, vars, and binding

2012-01-27 Thread Brandon Bloom
The ClojureScript 
wikistates
 that "the user experience of [binding] is similar to that in 
Clojure" but my very first experiment produced wildly different results 
between platforms.

Here's a Clojure on the JVM session:

user=> (import java.lang.Thread)
java.lang.Thread
user=> (defn set-timeout [ms fn] (.run (Thread. #(do (Thread/sleep ms) 
(fn)
#'user/set-timeout
user=> (def x "top level")
#'user/x
user=> (binding [x "in binding"] (println x) (set-timeout 1000 #(println 
x)))
in binding
in binding
nil

And here's the analogous ClojureScript session:

ClojureScript:cljs.user> (def x "top level")
"top level"
ClojureScript:cljs.user> (binding [x "in binding"] (println x) 
(js/setTimeout #(println x) 1000))
in binding
21
top level

So ignoring the sequencing and nil vs timeout-id return values, the binding 
of 'x wasn't preserved in the asynchronous callback.

I raised this issue in #clojure and @dnolen said that "that's the behavior 
there's nothing much to fix", but that didn't sit right with me. This seems 
like either 'binding is bugged, or maybe I don't understand something about 
its intent.

On the topic of "Vars" proper, I understand their usefulness in 
repl-centric development, where you can redefine functions at runtime. The 
wiki also makes some mention of this, but I can't wrap my head around the 
context and jargon. I've run into this problem before in Javascript, where 
some level of indirection is necessary to support run-time redefinitions. 
You can't do `var fn = package.fn;` and dynamically redefine `fn` from 
`package` later because a copy of the reference is made. How does 
ClojureScript address this problem?

Cheers,
Brandon

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

problems with if

2012-01-27 Thread raschedh
Hello, world !

Because that is my first post, I can not resist to say
"Thank you !!!" for clojure. I like it at lot.

When I type

(if true "t" f)

in a fresh REPL, I get the error

[...] Unable to resolve symbol: f [...]

But my interpretation of the reference ( http://clojure.org/special_forms#if
) is,
that, in the above case, f should not have been evaluated at all.

In scheme (I use mit-scheme) and in common-lisp (I use clisp) I get
the
(expected) behaviour:

In common lisp, for example:

(if t "t" f)
evaluates to "t".

Only when I do

(if nil "t" f)

I get the (expected) error, that f has got no value.

So, why is Clojure trying to resolve the symbol f ?
What do I not understand ?

In happens in clojure 1.3.0 as well as in a fresh build from the git
repo.

Thanks four your help.

Heinz.

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


partial arity exception

2012-01-27 Thread jim theriot
I don't know how to submit a bug report, surely not as easy as just
mentioning it here -

Logically, and according to the descriptive part of the docstring, partial
should work with zero args, although according to the signature
specifrication part of the docstring, you would expect it to throw an arity
exeception (which it does):

((partial *) 6 7)
ArityException Wrong number of args (1) ...

You probably wouldn't explicitly decide to use partial this way, but the
usage might come about unintended in the expansion of a macro, e. g.
(partial ~fcn ~@arg-list)

Regards,
Jim

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

Re: Setting up Emacs to edit Clojure for Windows folks

2012-01-27 Thread Rick Hall
Cedric,

I agree that the other editors are simpler to set up, though probably
not by as wide a margin as your set of instructions might suggest.

If you just look at the bold headings in my post, the instructions
are:
1.  Install JDK
2.  Install Leiningen
3.  Install Emacs
4.  Install Clojure mode
5.  Install Swank plugin.

The post had a lot more typing than that, because it seemed like the
instructions I found each of the editors had at least 1 step that
assumed you already knew how to use the editor for other things.
(Except Clooj which isn't used for anything else).

There is a complexity in your response that is easy to go unnoticed.
In response to my description of how set up one editor, you suggested
3 others.  As someone who has spent so long developing with Microsoft
products, my ability to make such choices has atrophied.

Part of the purpose of my post was to make arbitrary choices.  As far
as I can tell it makes no difference whether you use curl or wget in
your Leiningen install, so I only mentioned curl and took away one
moving part.  My choice to copy and paste clojure-mode.el instead of
using Git was a crude one, but also an easy one to explain.

That philosophy is constricting to people who are used to having
choices, but comforting to those who aren't.

Rick

-- 
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: LCUG: 17th January 2012, Malcolm Sparks - Reflections on a real-world Clojure application

2012-01-27 Thread Kushal Pisavadia
For those asking, the talks from this event were recorded. You can view 
video recordings of each at this 
link: http://skillsmatter.com/event/java-jee/real-world-clojure

If you're confused on where to click, the videos are marked as "podcasts" 
by the venue host we use.

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

Avoiding reflection in vector-of

2012-01-27 Thread Bryce
I'm building a large vector of longs from a lazy seq, and trying to
use vector-of in order to reduce the storage requirements.  Although
there is no reflection warning (and I've turned on *warn-on-
reflection*), in my profiler I see that the majority of the time is
spent invoking clojure.lang.Reflector.getMethods() .  I assume that
behind the scenes, there is a reflection call occurring to verify that
I'm "really" passing in longs.  I've tried converting to a raw Java
array of longs first and type-hinting that with the class string (as
per http://dev.clojure.org/jira/browse/CLJ-851 ), but I still spend
most of my time in getMethods.  Am I right in thinking this is
suboptimal, and any idea of how I fix it?

;All of these spend most of their time in reflection
(apply vector-of :int (range 1000))
(apply vector-of :int ^"[J>" (range 1000))
(apply vector-of :int ^"[J>" (long-array (range 1000)))
(apply vector-of :int ^{:tag 'longs} (long-array (range 1000)))

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

2012-01-27 Thread Cedric Greevey
Bug report: there's no "don't know", "can't decide", or "they're
equal" type of option. And it won't let you leave any blank either.

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

2012-01-27 Thread alex
If you have trouble viewing or submitting this form, you can fill it out  
online:

https://docs.google.com/spreadsheet/viewform?formkey=dFpleU1QbVRyLWVXVElRMmJpQlpoYWc6MQ


Clojure Community Values


For no particular reason I got to thinking about things the Clojure  
community values in the style of the Agile manifesto, that is "we value ___  
over ___" with the caveat that we may find both valuable, but one more than  
the other. This survey is not serious, or important, or binding. Maybe the  
results will be useless but perhaps they will be interesting. Blatant  
commercial: if you want to discuss, why not check out Clojure/West in San  
Jose, Mar 16-17 (http://clojurewest.org), early bird registration ends hmmm  
today!



In the Clojure community, we value... *


Emphatic yes Yes No Actually, the opposite

Code over ideas

Thinking over tests

Data over interfaces

Values over variables

Public over private

Accessibility over encapsulation

Simple over easy

Eggs over easy


Man, you totally screwed up. These are better: Add one per line. If they're  
good I'll add them to the list above.




Powered by Google Docs Report Abuse - Terms of Service - Additional Terms


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