Re: Improving visibility of clojure-doc.org

2013-03-12 Thread Cedric Greevey
If one of those is that Clojure documentation site that has a paywall, I
object unless the merged site has no paywall. Official and
officially-endorsed documentation for open source software should not be
behind a paywall.


On Tue, Mar 12, 2013 at 1:47 AM, kinleyd kinl...@gmail.com wrote:

 I also found clojure-doc.org accidentally, and was surprised it didn't
 show up in earlier searches, especially in the context of the high quality
 of the documentation.

 I think merging the two resources (clojuredocs and clojure-doc) would
 greatly help (I'd be happy to help in this effort), and getting high
 profile links pointed to it (particularly on clojure.org itself) would
 make all the difference in adding to its visibility, regardless of the
 frequency of the updates to the site itself.


 On Thursday, February 28, 2013 12:06:46 AM UTC+6, Michael Klishin wrote:

 Started in October 2012, http://clojure-doc.org is a pretty extensive
 community documentation effort. It covers Clojure, its ecosystem
 and tools and has two key goals:

  * We produce beginner-friendly content
  * It is dead easy to join and help

 Even though recently that hasn't been
 as much activity as in the past, it is not abandoned and continues
 to accumulate useful, beginner-friendly material.

 We constantly get praises from newcomers to Clojure who discover
 clojure-doc.org. Unfortunately, it does not appear even in top 10
 in Google for clojure docs or clojure documentation and
 many community members are not aware of it.

 In part it is less visible because we no longer actively post
 progress reports. Things have settled down and most of changes
 now are small edits and improvements all over the place. It is
 a bit pointless to post progress reports more often than
 once a month or so.

 So I'd like to start a discussion about what can be done about it.
 The community (we have 40 contributors) has worked very hard
 on clojure-doc.org and I'd like to see high profile resources
 (namly clojure.org and leiningen.org) link to it. What would
 it take to convince clojure.org maintainers to do so?

 There are still guides left ot be written (macros, gen-class),
 but overall, I'd say there is no better source of freely available,
 beginner-friendly, hackable (no Clojure CA, everything is developed
 on GitHub [1], content is in Markdown) documentation. All it needs
 is some linking and promotion love.

 One way to help would be to start a campaign such as Mozilla's
 Promote JS [docs]. Unfortunately, unlike Mozilla key contributors
 behind clojure-doc.org largely lack graphic and Web design skills,
 so replicating that campaing is probably not an option.

 Do you have any ideas about how we can make clojure-doc.org more
 visible? Do you know who can help with getting a link from clojure.org?
 Do you think clojure-doc.org is not good enough to be the blessed
 open source documentation resource? Please post your suggestions
 and concerns.

 Improving CDS visibility will benefit the entire community plus all the
 people who will join it in the future. Most of the work is already done,
 it just needs to be promoted better.

 Thanks you.


 1. https://github.com/**clojuredocs/cdshttps://github.com/clojuredocs/cds

 --
 MK

 http://github.com/**michaelklishin http://github.com/michaelklishin
 http://twitter.com/**michaelklishin http://twitter.com/michaelklishin

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Improving visibility of clojure-doc.org

2013-03-12 Thread Rich Morin
On Mar 11, 2013, at 23:20, Cedric Greevey wrote:
 If one of those is that Clojure documentation site that has a paywall,
 I object unless the merged site has no paywall. Official and officially-
 endorsed documentation for open source software should not be behind a
 paywall.

Neither site is behind a paywall (as you would have discovered had you
bothered to look :-/).  Clojure Atlas _is_ behind a (cheap) paywall; I
think it's well worth the money, but suit yourself...

-r

 -- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume r...@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Software system design, development, and documentation


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Improving visibility of clojure-doc.org

2013-03-12 Thread BJG145
It's quite confusing that http://clojure-doc.org and 
http://www.clojure-doc.org go to different pages.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Noobie question - sorry :)

2013-03-12 Thread edward
So I do not understand why calling

  (defn evolve []
(Thread/sleep 1000)
(print .)
(recur))

Never results in anything being printed until I press Ctrl-C at which point 
a bunch of . are printed.

However if I remove (Thread/sleep 1000) then it works as I would expect.

I thought (Thread/sleep 1000) would basically wait for a second (allowing 
other threads to run) and then continue but it *appears* to work as I would 
expect but it blocks output (both to the console and, I think, to the 
seesaw frame/canvas created separately).

Help?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get difference between two lists with java objects of same class

2013-03-12 Thread Michael Gardner
On Mar 11, 2013, at 17:09 , Ryan arekand...@gmail.com wrote:

 What if, i had two clojure lists, with hash-maps which have the same keys and 
 based on a specific key, i wanted to find the items from list-a which do not 
 exist in list-b. Would i go with the two functions you suggested or is there 
 something else I could use?

Assuming :id is the key you care about:

(filter (comp (complement (set (map :id list-b))) :id)
list-a)

user= (defn rand-seq [n] (repeatedly #(rand-int n)))
#'user/rand-seq
user= (def list-a (map (partial hash-map :id) (take 5 (rand-seq 10
#'user/list-a
user= list-a
({:id 8} {:id 4} {:id 5} {:id 1} {:id 6})
user= (def list-b (map (partial hash-map :id) (take 5 (rand-seq 10
#'user/list-b
user= list-b
({:id 9} {:id 6} {:id 3} {:id 6} {:id 3})
user= (filter (comp (complement (set (map :id list-b))) :id) list-a)
({:id 8} {:id 4} {:id 5} {:id 1})

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




Re: Noobie question - sorry :)

2013-03-12 Thread Laurent PETIT
2013/3/12 edw...@kenworthy.info

 So I do not understand why calling

   (defn evolve []
 (Thread/sleep 1000)
 (print .)
 (recur))

 Never results in anything being printed until I press Ctrl-C at which
 point a bunch of . are printed.

 However if I remove (Thread/sleep 1000) then it works as I would expect.

 I thought (Thread/sleep 1000) would basically wait for a second (allowing
 other threads to run) and then continue but it *appears* to work as I would
 expect but it blocks output (both to the console and, I think, to the
 seesaw frame/canvas created separately).


The output is buffered, try by adding a call to (flush) after each (print
.)

HTH,

-- 
Laurent

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Model-View-Controller in Clojure?

2013-03-12 Thread edward
OK took me a while to work my way through your code. I think a simpler 
version to illustrate the point would be:
  
(def current-live-cells (atom starting-live-cells))
  
(defn cells-changed
; called when current-live-cells changes
[k r o n]
(print cells-changed called.)
(repaint! (select fr [:#canvas])))

(add-watch current-live-cells :log cells-changed)





On Saturday, March 9, 2013 2:24:31 PM UTC, Jim foo.bar wrote:

 You need to store your model in a ref-type (atom,agent,or ref), and 
 attach a watcher on it (a fn which is responsible for updating the 
 view). Now, 'mutating' your model will trigger a View update...piece of 
 cake :) 

 example: 

 (def board-history 
 Log of the state of a game. 
 (atom [])) 

 (defn log-board 
 The logging function for the board ref. Will conj every new board-state 
 into a vector. 
 [dest k r old n] 
   (when-not (= n old) 
(swap! dest conj n))) 

 (def current-chessItems 
 This is list that keeps track of moving chess pieces. Is governed by an 
 atom and it changes after every move. 
   All changes are being logged to 'board-history'. Starts off as nil but 
 we can always get the initial board arrangement from core. 
   (- (atom nil) 
 (add-watch  :log (partial core/log-board core/board-history) 

 HTH, 

 Jim 

 ps: my example does not involve GUI, but you get the idea...it it 
 trivial to change the code so that it 'repaints' the canvas with the new 
 board instead of conjing it 


 On 09/03/13 14:11, edw...@kenworthy.info javascript: wrote: 
  So I understand that Clojure's data structures are immutable but I am 
  not clear how that works with MVC. 
  
  So I have a view that displays a model. Other processes change that 
  model and the View presents those changes. 
  
  However it's not clear to me how that would work with an immutable 
 model. 
  
  Obviously I can't pass the model into the View, have the view store a 
  reference to it and each time it's called on to render the model, do 
  so. The model is immutable. 
  
  So I could have a global variable which points to the model, and 
  whenever I 'change' the model I re-point it to the updated version. 
  Obviously the view would have to reference that global. This just 
  smells bad. And would get worse for each model and view you needed in 
  your application. 
  
  I suppose you could maintain some global map of models, but that 
  doesn't look nice either, it's not that much different from having a 
  pile of global models. 
  
  This must be a solved problem surely? Could someone point me to the 
  solution please? Swing or Quil based would be fine but I assume it 
  must be generally applicable. 
  -- 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient 
  with your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  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 unsubscribe from this group and stop receiving emails from it, send 
  an email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Model-View-Controller in Clojure?

2013-03-12 Thread edward
So having parsed your log-history example Jim (which I found tricky because 
of the confusion of the problem domain in your example with the 
implementation, logging history versus watching changes is a bit close, and 
the gratuitous use of the threading macro). I think a simpler example would 
be:

  (def current-live-cells (atom starting-live-cells))
  
  (defn cells-changed
; called when current-live-cells changes
[k r o n]
(print cells-changed called.))

  (add-watch current-live-cells :log cells-changed)

Not that i'm not grateful for your example, I had to learn about (partial) 
-what a useful function!- and the threading macros -yuch!-.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Noobie question - sorry :)

2013-03-12 Thread edward
Thank you.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Marko Topolnik
On Monday, March 11, 2013 11:51:17 PM UTC+1, Sean Corfield wrote:

 In addition to clj-time, I tend to use - with date-clj as well: 

 (- (today) 
 (subtract 30 :days)) 

 And I find something like this: 

 (- (- response :body :postalCodes) 
  (map to-location) (sort-by :city)) 

 much easier to read than: 

 (sort-by :city (map to-location (:postalCodes (:body response 


In Clojure 1.5 I would write

(as- response x (:body x) (:postalCodes x) (map to-location x) (sort-by 
:city x))

or, perhaps

(as- response x (- x :body :postalCodes) (- x (map to-location) 
(sort-by :city))

I *love *as-* *!

YMMV tho'... 


Ditto :)

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get difference between two lists with java objects of same class

2013-03-12 Thread Marko Topolnik


 Assuming :id is the key you care about: 

 (filter (comp (complement (set (map :id list-b))) :id)
 list-a)


This is almost exactly the same as the one from an earlier post here:

(remove (comp (into #{} (map key-fn list-b)) key-fn) list-a) 

I'd prefer *remove* to *filter + complement*, though.

-Marko

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get difference between two lists with java objects of same class

2013-03-12 Thread Marko Topolnik
On Monday, March 11, 2013 11:09:31 PM UTC+1, Ryan wrote:

 What if, i had two clojure lists, with hash-maps which have the same keys 
 and based on a specific key, i wanted to find the items from list-a which 
 do not exist in list-b. Would i go with the two functions you suggested or 
 is there something else I could use?


The only difference would be in the definition of the *key-fn. *With Java 
classes it would be #(.getId %) and with Clojure maps it would be just :id --- 
keywords are already functions!

-Marko

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Noobie question - sorry :)

2013-03-12 Thread Marko Topolnik
On Tuesday, March 12, 2013 8:59:47 AM UTC+1, edw...@kenworthy.info wrote:

 So I do not understand why calling

   (defn evolve []
 (Thread/sleep 1000)
 (print .)
 (recur))

 Never results in anything being printed until I press Ctrl-C at which 
 point a bunch of . are printed.

 However if I remove (Thread/sleep 1000) then it works as I would expect.


Actually it works the same in both cases: the dots are printed in chunks as 
large as the buffer size of the *out* writer. You just didn't have the 
patience to wait that many seconds :) Try with (Thread/sleep 1) and you'll 
see.

I thought (Thread/sleep 1000) would basically wait for a second (allowing 
 other threads to run) and then continue but it *appears* to work as I would 
 expect but it blocks output (both to the console and, I think, to the 
 seesaw frame/canvas created separately).


It does work exactly as you expected: it allows other threads to run. You 
must be very careful in knowing exactly *which* thread it makes sleep. As 
for the console output, the real reason is as explained above.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get difference between two lists with java objects of same class

2013-03-12 Thread Ryan
Thanks guys for your replies. I will re-read everything carefully and 
decide what to do :)

Ryan

On Tuesday, March 12, 2013 11:14:17 AM UTC+2, Marko Topolnik wrote:

 On Monday, March 11, 2013 11:09:31 PM UTC+1, Ryan wrote:

 What if, i had two clojure lists, with hash-maps which have the same keys 
 and based on a specific key, i wanted to find the items from list-a which 
 do not exist in list-b. Would i go with the two functions you suggested or 
 is there something else I could use?


 The only difference would be in the definition of the *key-fn. *With Java 
 classes it would be #(.getId %) and with Clojure maps it would be just :id 
 --- keywords are already functions!

 -Marko



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get difference between two lists with java objects of same class

2013-03-12 Thread Michael Gardner
On Mar 12, 2013, at 04:11 , Marko Topolnik marko.topol...@gmail.com wrote:

 This is almost exactly the same as the one from an earlier post here:
 
 (remove (comp (into #{} (map key-fn list-b)) key-fn) list-a) 
 
 I'd prefer remove to filter + complement, though.

Ah, I should have read the rest of the thread more carefully. I keep forgetting 
that 'remove exists.

I do prefer 'set and friends to 'into, though.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Laurent PETIT
2013/3/12 Marko Topolnik marko.topol...@gmail.com

 On Monday, March 11, 2013 11:51:17 PM UTC+1, Sean Corfield wrote:

 In addition to clj-time, I tend to use - with date-clj as well:

 (- (today)
 (subtract 30 :days))

 And I find something like this:

 (- (- response :body :postalCodes)
  (map to-location) (sort-by :city))

 much easier to read than:

 (sort-by :city (map to-location (:postalCodes (:body response


 In Clojure 1.5 I would write

 (as- response x (:body x) (:postalCodes x) (map to-location x) (sort-by
 :city x))

 or, perhaps

 (as- response x (- x :body :postalCodes) (- x (map to-location)
 (sort-by :city))


or perhaps

(- response :body :postalCodes (- (map to-location) (sort-by :city)))

:-)



 I *love *as-* *!

 YMMV tho'...


 Ditto :)

  --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Marko Topolnik
On Tuesday, March 12, 2013 10:54:35 AM UTC+1, Laurent PETIT wrote:


 or perhaps

 (- response :body :postalCodes (- (map to-location) (sort-by :city))) 

 :-)


Yes, jumping to - in the middle of - works; it fails the other way 
around. I was always frustrated by that asymmetry, hence my love for as- :)

-Marko

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Improving visibility of clojure-doc.org

2013-03-12 Thread Michael Klishin
2013/3/12 Cedric Greevey cgree...@gmail.com

 If one of those is that Clojure documentation site that has a paywall, I
 object unless the merged site has no paywall. Official and
 officially-endorsed documentation for open source software should not be
 behind a paywall.


Why don't you go to http://clojure-doc.org and see if it has a paywall.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Improving visibility of clojure-doc.org

2013-03-12 Thread Michael Klishin
2013/3/12 Robert Stuttaford robert.stuttaf...@gmail.com

 Has this effort started up yet? Is there a github url?

 I'd really love to see clojuredocs.org showing the 1.5 apis. Willing to
 help make that happen!


I think the repos are

https://github.com/dakrone/eisago
https://github.com/dakrone/cadastre
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Dave Kincaid
Before long Clojure will have as much ugly, arcane syntax as Scala. (I say 
that mostly tongue in cheek, btw). For me, a lot of the attractiveness of 
Lisp languages is the minimal syntax that they have. I'm not a fan of 
adding more to Clojure than is already there. I'm just one voice and a very 
new one to Clojure, so I doubt my opinion will sway anyone else. I do love 
Clojure and hope to be able to use it more in the future, but I'll probably 
stick to the very basic syntax and forgo all this fancy sugar.

Dave

On Tuesday, March 12, 2013 4:07:19 AM UTC-5, Marko Topolnik wrote:

 On Monday, March 11, 2013 11:51:17 PM UTC+1, Sean Corfield wrote:

 In addition to clj-time, I tend to use - with date-clj as well: 

 (- (today) 
 (subtract 30 :days)) 

 And I find something like this: 

 (- (- response :body :postalCodes) 
  (map to-location) (sort-by :city)) 

 much easier to read than: 

 (sort-by :city (map to-location (:postalCodes (:body response 


 In Clojure 1.5 I would write

 (as- response x (:body x) (:postalCodes x) (map to-location x) (sort-by 
 :city x))

 or, perhaps

 (as- response x (- x :body :postalCodes) (- x (map to-location) 
 (sort-by :city))

 I *love *as-* *!

 YMMV tho'... 


 Ditto :)



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Improving visibility of clojure-doc.org

2013-03-12 Thread Michael Klishin
2013/3/12 Devin Walters dev...@gmail.com

 I assume this has been discussed to death already, but isn't there some
 way to get clojure-doc and clojuredocs to live under the same umbrella?


We can host all relevant projects under the same GitHub org, that's a good
idea. Merging two resources into one
seems completely unnecessary to me. We can always have them link to each
other in the navigation bar but there's too much difference
in how each of them works (a Clojure analyzer + web app vs. a static site
in Markdown) to try to combine them into
a single code base.

We can also have reference.clojure-doc.org or api.clojure-doc.org that
redirects to clojuredocs.org.


 Another idea I'd like to throw out there:
 I have the domains getclojure.org/com. Since clojure-doc.org is all about
 getting clojure, it seems like it might be an appropriate home for
 clojure-doc. At the very least it would kill some of the ambiguity between
 clojuredocs and clojure-doc.



To me getclojure.org sounds like something you would download Clojure from.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Marko Topolnik
On Tuesday, March 12, 2013 1:22:20 PM UTC+1, Dave Kincaid wrote:

 Before long Clojure will have as much ugly, arcane syntax as Scala. (I say 
 that mostly tongue in cheek, btw).


Clojure is way behind Scala on this score :)
 

 For me, a lot of the attractiveness of Lisp languages is the minimal 
 syntax that they have. I'm not a fan of adding more to Clojure than is 
 already there. I'm just one voice and a very new one to Clojure, so I doubt 
 my opinion will sway anyone else. I do love Clojure and hope to be able to 
 use it more in the future, but I'll probably stick to the very basic syntax 
 and forgo all this fancy sugar.


One way this will backfire is that you'll get mad and frustrated each time 
you read anyone else's idiomatic Clojure code. There really isn't that much 
of it around and any LISP has its own bag of idiosyncrasies. Do you know 
the Common Lisp *loop* construct? Or its 
*map*http://www.lispworks.com/documentation/HyperSpec/Body/f_mapc_.htm
* menagerie? Now *that*'s what I call arcane, and what really did turn me 
off of CL.

-Marko

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Laurent PETIT
2013/3/12 Dave Kincaid kincaid.d...@gmail.com

 Before long Clojure will have as much ugly, arcane syntax as Scala. (I say
 that mostly tongue in cheek, btw). For me, a lot of the attractiveness of
 Lisp languages is the minimal syntax that they have. I'm not a fan of
 adding more to Clojure than is already there. I'm just one voice and a very
 new one to Clojure, so I doubt my opinion will sway anyone else. I do love
 Clojure and hope to be able to use it more in the future, but I'll probably
 stick to the very basic syntax and forgo all this fancy sugar.


I understand your concern. But be assured that the reputation of Clojure,
in contrast, say, with Scala, is that it's a NO language rather than a YES
language.

Rich always thinks way more than twice before adding operators, and that's
a good thing.

For instance, there's been the -? operator in clojure.core.incubator for 3
years (at least) before it has been standardized into some- in Clojure 1.5

Another example : pods would be a new kind of ref, in gestation for more
than 2 years. Not ready ? Not sure ? Won't include.

Cheers,

-- 
Laurent Petit

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();

Hi all,

I came back to a project of mine after a week or so and I'm facing a 
problem which I have no idea where it came from! This is the first time 
I'm seeing it on this project - everything worked just fine a week ago! 
The problem is this:


Consider some java class (opennlp-POS-tagger) with 3 .tag() 
overloads...signatures and bodies follow:


public *String[] tag(String[] sentence)* {
return this.tag(sentence, null); //this is essentially what I'm 
trying in my code

  }

  public *String[] tag(String[] sentence, Object[] additionaContext) *{
bestSequence = beam.bestSequence(sentence, additionaContext);
ListString t = bestSequence.getOutcomes();
return t.toArray(new String[t.size()]);
  }


  public *String[][] tag(int numTaggings, String[] sentence) *{
Sequence[] bestSequences = beam.bestSequences(numTaggings, 
sentence,null);

String[][] tags = new String[bestSequences.length][];
for (int si=0;sitags.length;si++) {
  ListString t = bestSequences[si].getOutcomes();
  tags[si] = t.toArray(new String[t.size()]);
}


Now, from my code I'm trying to do:

(.tag opennlp-pos (into-array  [New-York (NY) is the city 
that never sleeps .]) nil)


which gives me a IllegalArgumentException Unexpected param type, 
expected: int, given: [Ljava.lang.String; clojure.lang.Reflector.boxArg 
(Reflector.java:432)
Basically, it's trying to invoke the last overload ,whereas I'm trying 
to invoke the second one!!!


If I omit the 'nil' at the end , the correct method is invoked (the 
first which calls the second)...why can't Clojure find the second 
overload and goes for the 3rd?


any ideas?

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
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Paul Butcher
So this turned out to be pretty easy. I've implemented a function called 
foldable-seq that takes a lazy sequence and turns it into something that can 
be folded in parallel. I've checked an example program that uses it to count 
words in a Wikipedia XML dump into GitHub:

https://github.com/paulbutcher/foldable-seq

The code for foldable-seq is here:

https://github.com/paulbutcher/foldable-seq/blob/master/src/wordcount/reducers.clj#L60

On my 4-core MacBook Pro, I see a 40 second runtime without parallel-seq, 13 
seconds with.

--
paul.butcher-msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: p...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

On 11 Mar 2013, at 13:38, Paul Butcher p...@paulbutcher.com wrote:

 On 11 Mar 2013, at 11:00, Marko Topolnik marko.topol...@gmail.com wrote:
 
 The idea is to transform into a lazy sequence of eager chunks. That approach 
 should work.
 
 Exactly. Right - I guess I should put my money where my mouth is and see if I 
 can get it working...
 
 --
 paul.butcher-msgCount++
 
 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?
 
 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: p...@paulbutcher.com
 AIM: paulrabutcher
 Skype: paulrabutcher
 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Marko Topolnik
Nice going :) Is it really impossible to somehow do this from the outside, 
through the public API?

On Tuesday, March 12, 2013 2:34:43 PM UTC+1, Paul Butcher wrote:

 So this turned out to be pretty easy. I've implemented a function called 
 foldable-seq that takes a lazy sequence and turns it into something that 
 can be folded in parallel. I've checked an example program that uses it to 
 count words in a Wikipedia XML dump into GitHub:

 https://github.com/paulbutcher/foldable-seq

 The code for foldable-seq is here:


 https://github.com/paulbutcher/foldable-seq/blob/master/src/wordcount/reducers.clj#L60

 On my 4-core MacBook Pro, I see a 40 second runtime without parallel-seq, 
 13 seconds with.

 --
 paul.butcher-msgCount++

 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: pa...@paulbutcher.com javascript:
 AIM: paulrabutcher
 Skype: paulrabutcher
  
 On 11 Mar 2013, at 13:38, Paul Butcher pa...@paulbutcher.comjavascript: 
 wrote:

 On 11 Mar 2013, at 11:00, Marko Topolnik marko.t...@gmail.comjavascript: 
 wrote:

 The idea is to transform into a lazy sequence of eager chunks. That 
 approach should work.


 Exactly. Right - I guess I should put my money where my mouth is and see 
 if I can get it working...

 --
 paul.butcher-msgCount++

 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: pa...@paulbutcher.com javascript:
 AIM: paulrabutcher
 Skype: paulrabutcher
  



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Paul Butcher
On 12 Mar 2013, at 13:45, Marko Topolnik marko.topol...@gmail.com wrote:

 Nice going :) Is it really impossible to somehow do this from the outside, 
 through the public API?


I think that it *does* do it from the outside through the public API :-) I'm 
just reifying the (public) CollFold protocol.

I do copy a bunch of helper functions related to fork/join which are private 
within the reducers namespace (which isn't particularly nice). But I guess that 
this will go away when (if?) Clojure has a proper API to support fork/join. But 
I thought it better to do that than reinvent the wheel.

Or am I missing something?

--
paul.butcher-msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: p...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Adam Clements
I've had exactly this problem trying to use reducers over a large file that 
wouldn't fit in memory.

I tried iota, but had the issue that it was still scanning and memory 
mapping the entire file before it would start doing anything (pulling the 
whole thing through ram and taking a fair few minutes).

How would feeding a line-seq into this compare to iota? And how would that 
compare to a version of iota tweaked to work in a slightly less eager 
fashion?

Adam

On Tuesday, March 12, 2013 1:34:43 PM UTC, Paul Butcher wrote:

 So this turned out to be pretty easy. I've implemented a function called 
 foldable-seq that takes a lazy sequence and turns it into something that 
 can be folded in parallel. I've checked an example program that uses it to 
 count words in a Wikipedia XML dump into GitHub:

 https://github.com/paulbutcher/foldable-seq

 The code for foldable-seq is here:


 https://github.com/paulbutcher/foldable-seq/blob/master/src/wordcount/reducers.clj#L60

 On my 4-core MacBook Pro, I see a 40 second runtime without parallel-seq, 
 13 seconds with.

 --
 paul.butcher-msgCount++

 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: pa...@paulbutcher.com javascript:
 AIM: paulrabutcher
 Skype: paulrabutcher
  
 On 11 Mar 2013, at 13:38, Paul Butcher pa...@paulbutcher.comjavascript: 
 wrote:

 On 11 Mar 2013, at 11:00, Marko Topolnik marko.t...@gmail.comjavascript: 
 wrote:

 The idea is to transform into a lazy sequence of eager chunks. That 
 approach should work.


 Exactly. Right - I guess I should put my money where my mouth is and see 
 if I can get it working...

 --
 paul.butcher-msgCount++

 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: pa...@paulbutcher.com javascript:
 AIM: paulrabutcher
 Skype: paulrabutcher
  



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
Ok I investigated a bit further and I found some seriously weird 
stuff...I'm gonna need the help of a java expert here:


(pprint (.getMethods (.getClass opennlp-pos)))  ;;notice that the method 
I'm trying to call *doesn't exist according to this*


[#Method public static opennlp.tools.postag.POSModel 
opennlp.tools.postag.POSTaggerME.train(java.lang.String,opennlp.tools.util.ObjectStream,opennlp.tools.util.model.ModelType,opennlp.tools.postag.POSDictionary,opennlp.tools.dictionary.Dictionary,int,int) 
throws java.io.IOException,

 #Method public void opennlp.tools.postag.POSTaggerME.probs(double[]),
 #Method public double[] opennlp.tools.postag.POSTaggerME.probs(),
 #Method public int opennlp.tools.postag.POSTaggerME.getNumTags(),
 #Method public java.lang.String[] 
opennlp.tools.postag.POSTaggerME.getOrderedTags(java.util.List,java.util.List,int),
 #Method public java.lang.String[] 
opennlp.tools.postag.POSTaggerME.getOrderedTags(java.util.List,java.util.List,int,double[]),
 #Method public opennlp.tools.util.Sequence[] 
opennlp.tools.postag.POSTaggerME.topKSequences(java.util.List),
 #Method public opennlp.tools.util.Sequence[] 
opennlp.tools.postag.POSTaggerME.topKSequences(java.lang.String[]),
*#Method public java.lang.String[] 
opennlp.tools.postag.POSTaggerME.tag(java.lang.String[]),**
** #Method public java.lang.String 
opennlp.tools.postag.POSTaggerME.tag(java.lang.String),**
** #Method public java.util.List 
opennlp.tools.postag.POSTaggerME.tag(java.util.List),**
** #Method public java.lang.String[][] 
opennlp.tools.postag.POSTaggerME.tag(int,java.lang.String[]),*
 #Method public final void java.lang.Object.wait(long,int) throws 
java.lang.InterruptedException,
 #Method public final native void java.lang.Object.wait(long) throws 
java.lang.InterruptedException,
 #Method public final void java.lang.Object.wait() throws 
java.lang.InterruptedException,

 #Method public boolean java.lang.Object.equals(java.lang.Object),
 #Method public java.lang.String java.lang.Object.toString(),
 #Method public native int java.lang.Object.hashCode(),
 #Method public final native java.lang.Class java.lang.Object.getClass(),
 #Method public final native void java.lang.Object.notify(),
 #Method public final native void java.lang.Object.notifyAll()]
nil

but then this seems very strange so I went and decompiled the class file 
(actually the entire jar) and the method that takes 2 arrays as args 
does exist both in the interface and the concrete implementation 
(POSTagger  POSTaggerME respectively)


how on earth can that be? any ideas anyone? this seems utterly odd to me!

Jim


On 12/03/13 13:26, Jim - FooBar(); wrote:

Hi all,

I came back to a project of mine after a week or so and I'm facing a 
problem which I have no idea where it came from! This is the first 
time I'm seeing it on this project - everything worked just fine a 
week ago! The problem is this:


Consider some java class (opennlp-POS-tagger) with 3 .tag() 
overloads...signatures and bodies follow:


public *String[] tag(String[] sentence)* {
return this.tag(sentence, null); //this is essentially what I'm 
trying in my code

  }

  public *String[] tag(String[] sentence, Object[] additionaContext) *{
bestSequence = beam.bestSequence(sentence, additionaContext);
ListString t = bestSequence.getOutcomes();
return t.toArray(new String[t.size()]);
  }


  public *String[][] tag(int numTaggings, String[] sentence) *{
Sequence[] bestSequences = beam.bestSequences(numTaggings, 
sentence,null);

String[][] tags = new String[bestSequences.length][];
for (int si=0;sitags.length;si++) {
  ListString t = bestSequences[si].getOutcomes();
  tags[si] = t.toArray(new String[t.size()]);
}


Now, from my code I'm trying to do:

(.tag opennlp-pos (into-array  [New-York (NY) is the city 
that never sleeps .]) nil)


which gives me a IllegalArgumentException Unexpected param type, 
expected: int, given: [Ljava.lang.String; 
clojure.lang.Reflector.boxArg (Reflector.java:432)
Basically, it's trying to invoke the last overload ,whereas I'm trying 
to invoke the second one!!!


If I omit the 'nil' at the end , the correct method is invoked (the 
first which calls the second)...why can't Clojure find the second 
overload and goes for the 3rd?


any ideas?

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
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit 

Re: fold over a sequence

2013-03-12 Thread Marko Topolnik
On Tuesday, March 12, 2013 2:48:52 PM UTC+1, Paul Butcher wrote:

 On 12 Mar 2013, at 13:45, Marko Topolnik marko.t...@gmail.comjavascript: 
 wrote:

 Nice going :) Is it really impossible to somehow do this from the outside, 
 through the public API?


 I think that it *does* do it from the outside through the public API :-) 
 I'm just reifying the (public) CollFold protocol.

 I do copy a bunch of helper functions related to fork/join which are 
 private within the reducers namespace (which isn't particularly nice). But 
 I guess that this will go away when (if?) Clojure has a proper API to 
 support fork/join. But I thought it better to do that than reinvent the 
 wheel.


That's what I meant, succeed by relying on the way f/j is used by the 
reducers public API, without copy-pasting the internals and using them 
directly. So I guess the answer is no.

-Marko
 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Paul Butcher
On 12 Mar 2013, at 13:52, Marko Topolnik marko.topol...@gmail.com wrote:

 That's what I meant, succeed by relying on the way f/j is used by the 
 reducers public API, without copy-pasting the internals and using them 
 directly. So I guess the answer is no.

I don't believe that I could - the CollFold implementation effectively does a 
binary chop on the sequence which would force the whole sequence to be realised 
if I did the same. It's a sensible strategy for a fully realised data structure 
that already exists in memory, but not for a lazy sequence.

--
paul.butcher-msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: p...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Paul Butcher
On 12 Mar 2013, at 13:49, Adam Clements adam.cleme...@gmail.com wrote:

 How would feeding a line-seq into this compare to iota? And how would that 
 compare to a version of iota tweaked to work in a slightly less eager fashion?


It'll not suffer from the problem of having to drag the whole file into memory, 
but will incur the overhead of turning everything into JVM data structures that 
iota avoids. I don't imagine that it would be hard to modify iota to use a 
similar approach though. Although I imagine that Alan's better placed to have 
an opinion on that :-)

--
paul.butcher-msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: p...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




someClass.getMethods() misses 2 public methods! how is that even possible?

2013-03-12 Thread Jim - FooBar();
the title says it all...I'm left speechless! see my previous post for 
details (strange interop behaviour/issue)


thanks in advance for any insight...

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
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread Marko Topolnik
What explains the occurrence of these extra signatures that you don't 
mention above? It's hard to answer without having the full picture.

On Tuesday, March 12, 2013 2:52:19 PM UTC+1, Jim foo.bar wrote:

  Ok I investigated a bit further and I found some seriously weird 
 stuff...I'm gonna need the help of a java expert here:

 (pprint (.getMethods (.getClass opennlp-pos)))  ;;notice that the method 
 I'm trying to call *doesn't exist according to this*

 [..., 

 *#Method public java.lang.String[] 
 opennlp.tools.postag.POSTaggerME.tag(java.lang.String[]),**
 ** #Method public java.lang.String 
 opennlp.tools.postag.POSTaggerME.tag(java.lang.String),**
 ** #Method public java.util.List 
 opennlp.tools.postag.POSTaggerME.tag(java.util.List),**
 ** #Method public java.lang.String[][] 
 opennlp.tools.postag.POSTaggerME.tag(int,java.lang.String[]),*

... 

 ]
 nil

 but then this seems very strange so I went and decompiled the class file 
 (actually the entire jar) and the method that takes 2 arrays as args does 
 exist both in the interface and the concrete implementation (POSTagger  
 POSTaggerME respectively)

 how on earth can that be? any ideas anyone? this seems utterly odd to me!
  

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




Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();

On 12/03/13 14:31, Marko Topolnik wrote:
What explains the occurrence of these extra signatures that you don't 
mention above? It's hard to answer without having the full picture.


they are deprecated...there are 5 .tag() overloads in total. 2 of them 
are deprecated (the one accepting List and the one accepting 
String)...the other 3 are ok but I'm missing one (the one taking 2 
arrays)! I just discovered there is another one missing (the 
topKSequences taking 2 arrays)!!!


the full picture is that 2 separate overloads don't show when calling 
getMethods()/getDeclaredMethods() even though they are both public! 
Having decompiled the jar I can confirm that the 2 methods are indeed 
present! In fact I was using them a week ago! I'm at a loss here...any 
help will be greatly appreciated...


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
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Model-View-Controller in Clojure?

2013-03-12 Thread edward
Thanks all.

Just to close this off, this is my (now working!) code, still needs some 
re-factoring (especially given Jim's last note re not needing watches in 
seesaw). It's basically a gui wrapped around the implementation of Life 
from Clojure Programming, with a few functions to add gliders, guns etc in 
the repl.

(ns conways-life.core
  (:use seesaw.core
seesaw.graphics
seesaw.color))

; Conway's Life
(defn neighbours
[[x y]]
  (for [dx [-1 0 1] dy [-1 0 1] :when (not= 0 dx dy)]
  [(+ dx x) (+ dy y)]))

(defn step
Yields the next state of the world
  [cells]
  (set (for [[loc n] (frequencies (mapcat neighbours cells))
  :when (or (= n 3) (and (= n 2) (cells loc)))]
  loc)))

  (def starting-live-cells #{})
  (def current-live-cells (atom starting-live-cells))
  
  (defn paint [c g]  
(let [w (.getWidth c)
  h (.getHeight c)]
  (doseq [{:as cell} @current-live-cells]
(let [cell-x (* 10(cell 0))
  cell-y (* 10(cell 1))]
  (when (and ( cell-x w) ( cell-y h))
(draw g  
(ellipse  (mod cell-x w)
(mod cell-y h) 10 10)
  (style :background (color 255 255 255 255

  (defn cells-changed
; called when current-live-cells changes
[fr _ _ _ _]
(repaint! (select fr [:#canvas])))

(defn -main [ args]
  (life))  
  
(defn life []

  (native!)
  
  (def f (frame 
:title Conway's Life 
:width 500 :height 300
:content 
(border-panel :hgap 5 :vgap 5 :border 5
  ; Create the canvas with initial nil paint function, i.e. 
just canvas
  ; will be filled with it's background color and that's it.
  :center (canvas :id :canvas :background #DD :paint 
paint

  (add-watch current-live-cells :log (partial cells-changed f))

  (show! f)

  (def evolve-delay 100) ; delay in milliseconds
  
  (defn evolve []
(Thread/sleep evolve-delay)
(swap! current-live-cells step)
(recur)
)
  
  (future (evolve)))

(defn add-glider
  [x y cells]
  (conj cells [(+ x 2) y][(+ 2 x) (+ y 1)][(+ 2 x) (+ y 2)][(+ x 1)(+ y 
2)][x (+ y 1)]))

(defn add-blinker
  [x y cells]
  (conj cells [0 0][0 1][0 2]))

(defn add-gosper-gun
  [x y cells]
  (conj cells
[0 4][0 5]
[1 4][1 5]
[10 4][10 5][10 6]
[11 3][11 7]
[12 2][12 8]
[13 2][13 8]
[14 5]
[15 3][15 7]
[16 4][16 5][16 6]
[17 5]
[20 2][20 3][20 4]
[21 2][21 3][21 4]
[22 1][22 5]
[24 0][24 1][24 5][24 6]
[34 2][34 3]
[35 2][35 3]))

(defn reset []
  (swap! current-live-cells (fn [_] #{})))

(defn gosper-gun []
  (swap! current-live-cells (partial add-gosper-gun 0 0)))

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Model-View-Controller in Clojure?

2013-03-12 Thread Jim - FooBar();

On 12/03/13 14:43, edw...@kenworthy.info wrote:
Just to close this off, this is my (now working!) code, still needs 
some re-factoring (especially given Jim's last note re not needing 
watches in seesaw). It's basically a gui wrapped around the 
implementation of Life from Clojure Programming, with a few functions 
to add gliders, guns etc in the repl.




I only said that cos you can do something like this:

(def canvas The paintable canvas - our board
 (ssw/canvas
:paint draw-tiles
:id :canvas
:listen [:mouse-clicked (fn [^MouseEvent e] (when (and  (not 
(:block? @knobs))

(realized? curr-game))
(canva-react @curr-game e)))] ))

If your state transformation doesn't depend on user input then your 
watch-approach is fine... :)


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
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread David Powell
It looks like:

public String[] tag(String[] sentence, Object[] additionaContext);

wasn't originally present in the API, and was added in:

http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?r1=1245855r2=1294177

It sounds like you might have more than one version of the class on your
classpath perhaps, or at least aren't using the code you think you're using?




On Tue, Mar 12, 2013 at 2:38 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 On 12/03/13 14:31, Marko Topolnik wrote:

 What explains the occurrence of these extra signatures that you don't
 mention above? It's hard to answer without having the full picture.


 they are deprecated...there are 5 .tag() overloads in total. 2 of them are
 deprecated (the one accepting List and the one accepting String)...the
 other 3 are ok but I'm missing one (the one taking 2 arrays)! I just
 discovered there is another one missing (the topKSequences taking 2
 arrays)!!!

 the full picture is that 2 separate overloads don't show when calling
 getMethods()/**getDeclaredMethods() even though they are both public!
 Having decompiled the jar I can confirm that the 2 methods are indeed
 present! In fact I was using them a week ago! I'm at a loss here...any help
 will be greatly appreciated...

 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
that is a reasonable thought indeed but it is extremely unlikely that 
something like this is happening...the version of opennlp I'm using is 
my own home-brewed one which I've manually installed in my  local-repo 
for sometime now...in my project.clj the dependency looks like this: 
[experiment/experiment 1.5.3]


the source of that jar is still on my eclipse workspace which I can 
consult very quickly...in addition I threw the jar in the JD decompiler 
and after poking around I did find the methods...


however some other lib may be pulling in openNLP...give me 2 sec I'll 
get back to you...


Jim




On 12/03/13 14:49, David Powell wrote:

It looks like:

public String[] tag(String[] sentence, Object[] additionaContext);

wasn't originally present in the API, and was added in:

http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?r1=1245855r2=1294177

It sounds like you might have more than one version of the class on 
your classpath perhaps, or at least aren't using the code you think 
you're using?





On Tue, Mar 12, 2013 at 2:38 PM, Jim - FooBar(); jimpil1...@gmail.com 
mailto:jimpil1...@gmail.com wrote:


On 12/03/13 14:31, Marko Topolnik wrote:

What explains the occurrence of these extra signatures that
you don't mention above? It's hard to answer without having
the full picture.


they are deprecated...there are 5 .tag() overloads in total. 2 of
them are deprecated (the one accepting List and the one accepting
String)...the other 3 are ok but I'm missing one (the one taking 2
arrays)! I just discovered there is another one missing (the
topKSequences taking 2 arrays)!!!

the full picture is that 2 separate overloads don't show when
calling getMethods()/getDeclaredMethods() even though they are
both public! Having decompiled the jar I can confirm that the 2
methods are indeed present! In fact I was using them a week ago!
I'm at a loss here...any help will be greatly appreciated...

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
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 unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
mailto:clojure%2bunsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
--
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 unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
David you are a genious!!! thank you thank you very much!!! one of my 
dependencies was pulling in opennlp/tools 1.5.0 which is a 2 year old jar!!!


added :exclusions and now I'm back in the game

If you're in Manchester Uk I'm buying beer... :)

Jim


On 12/03/13 14:49, David Powell wrote:

It looks like:

public String[] tag(String[] sentence, Object[] additionaContext);

wasn't originally present in the API, and was added in:

http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?r1=1245855r2=1294177

It sounds like you might have more than one version of the class on 
your classpath perhaps, or at least aren't using the code you think 
you're using?





On Tue, Mar 12, 2013 at 2:38 PM, Jim - FooBar(); jimpil1...@gmail.com 
mailto:jimpil1...@gmail.com wrote:


On 12/03/13 14:31, Marko Topolnik wrote:

What explains the occurrence of these extra signatures that
you don't mention above? It's hard to answer without having
the full picture.


they are deprecated...there are 5 .tag() overloads in total. 2 of
them are deprecated (the one accepting List and the one accepting
String)...the other 3 are ok but I'm missing one (the one taking 2
arrays)! I just discovered there is another one missing (the
topKSequences taking 2 arrays)!!!

the full picture is that 2 separate overloads don't show when
calling getMethods()/getDeclaredMethods() even though they are
both public! Having decompiled the jar I can confirm that the 2
methods are indeed present! In fact I was using them a week ago!
I'm at a loss here...any help will be greatly appreciated...

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
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 unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
mailto:clojure%2bunsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
--
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 unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Alan Busby
On Tue, Mar 12, 2013 at 11:00 PM, Paul Butcher p...@paulbutcher.com wrote:

 On 12 Mar 2013, at 13:49, Adam Clements adam.cleme...@gmail.com wrote:

 How would feeding a line-seq into this compare to iota? And how would that
 compare to a version of iota tweaked to work in a slightly less eager
 fashion?


 It'll not suffer from the problem of having to drag the whole file into
 memory, but will incur the overhead of turning everything into JVM data
 structures that iota avoids. I don't imagine that it would be hard to
 modify iota to use a similar approach though. Although I imagine that
 Alan's better placed to have an opinion on that :-)


If you're dealing with a stream that you'll only read once, then Paul's
foldseq+line-seq should work much more effectively than Iota I'd think.
Iota generates an index of line numbers so (nth iota-vec 100) is O(1),
which is why it'll read through the entire file on loading. If you only
need to access each line once, then that initial indexing step is likely a
waste.

If Paul wouldn't mind I'd like to add a a similar seq function to Iota
that would allow for index-less processing like he did in foldable-seq.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Paul Butcher
On 12 Mar 2013, at 15:55, Alan Busby thebu...@thebusby.com wrote:

 If Paul wouldn't mind I'd like to add a a similar seq function to Iota that 
 would allow for index-less processing like he did in foldable-seq.

Paul would be delighted :-)

--
paul.butcher-msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: p...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Sean Corfield
On Tue, Mar 12, 2013 at 2:54 AM, Laurent PETIT laurent.pe...@gmail.com wrote:
 (- response :body :postalCodes (- (map to-location) (sort-by :city)))

Ah, nice... I'll bear that in mind!
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Sean Corfield
On Tue, Mar 12, 2013 at 2:07 AM, Marko Topolnik
marko.topol...@gmail.com wrote:
 In Clojure 1.5 I would write

Yes, well, we'll be on 1.5.1 soon. Since this is heavily used
production code, we've been waiting for a gold release and for the
memory leak to get fixed before moving to 1.5.x :)

 (as- response x (:body x) (:postalCodes x) (map to-location x) (sort-by
 :city x))

I like the new threading operators and I'm looking forward to using
them but I'm not sure this is better since you need some neutral
identifier that, in this expression, represents a map, a map, an array
and a sequence so the choice is either picking a good name for all of
those or something generic (most likely a punctuation symbol)...
Definitely YMMV.

I think cond- / some- will be more useful to us than as- but we'll
see how it goes once we move up to 1.5.x.
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Neale Swinnerton
I find the need to switch between - and - in a pipeline disturbs the
clarity of my code.

if designing from scratch should we favour being threadable with - or -
?

Is one more idiomatic than the other?



*Neale Swinnerton*
{t: @sw1nn https://twitter.com/#!/sw1nn, w: sw1nn.com }


On Tue, Mar 12, 2013 at 5:14 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Tue, Mar 12, 2013 at 2:54 AM, Laurent PETIT laurent.pe...@gmail.com
 wrote:
  (- response :body :postalCodes (- (map to-location) (sort-by :city)))

 Ah, nice... I'll bear that in mind!
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Convincing employer to go for Clojure

2013-03-12 Thread David Jacobs
All of the feedback here was really helpful. 

As a followup, I wanted to let you know that my company is The Minerva 
Project, and we've been given $25 million to build a university. After a 
lot of back and forth about which technology we wanted to use on the 
product side, we ended up settling on Clojure and have been really happy 
with the decision! For more info, check out a high-level blog post on why 
we chose Clojure (even though you know all this stuff): 
https://news.ycombinator.com/item?id=5363003. And feel free to find us for 
drinks and conversation at Clojure/West.

Look forward to seeing many of you there,
David

On Wednesday, January 9, 2013 11:49:42 AM UTC-8, Ben Mabey wrote:

 On 1/7/13 4:02 PM, David Jacobs wrote: 
  
  What other tips do you have for convincing an employer that Clojure 
  makes good business sense? (Of course I've already told them about 
  domain-tailored abstractions, containing complexity, the ease of data 
  manipulation with a functional language, etc.) 
  

 If your employer would put any stock in it you could mention that 
 ThoughtWork's Technology Radar[1] has now moved Clojure into the 
 adoption ring... meaning that they feel like the risks of the new 
 technology are now mitigated enough to make sense for widespread adoption. 

 -Ben 


 1. 

 http://www.thoughtworks.com/articles/technology-radar-october-2012#Languages-%26amp%3B-Frameworks
  


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Sean Corfield
On Tue, Mar 12, 2013 at 10:21 AM, Neale Swinnerton ne...@isismanor.com wrote:
 if designing from scratch should we favour being threadable with - or - ?

My understanding is that the two threading macros are there to support
two existing standard idioms in Clojure:
* functions operating on collections tend to have the collection in
the last argument slot (so you use -)
* other functions - where the first argument is usually the cascade
point so you use -

(I remember reading a better articulated explanation than that but
can't find the link easily - hopefully you get the idea)
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Moving ClojureScript to Clojure 1.5.0 data.json dependency

2013-03-12 Thread Stuart Sierra
No issue from me. Just make sure you get the right version of data.json: 
0.2.0 was a bad release. Use 0.2.1.

-S


On Friday, March 1, 2013 2:41:26 PM UTC-5, David Nolen wrote:

 Now that Clojure 1.5.0 is out the door I'd like to make ClojureScript 
 depend on it. This would allow me to merge in the source map branch which 
 is a work in progress but far enough along that the critical bits are there 
 and it would be nice to get community contributions towards wrapping it up.

 Merging in the source map work would require adding data.json as a 
 dependency.

 Anyone have issues with these changes?

 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Moving ClojureScript to Clojure 1.5.0 data.json dependency

2013-03-12 Thread David Nolen
Great!


On Tue, Mar 12, 2013 at 2:16 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:

 No issue from me. Just make sure you get the right version of data.json:
 0.2.0 was a bad release. Use 0.2.1.

 -S



 On Friday, March 1, 2013 2:41:26 PM UTC-5, David Nolen wrote:

 Now that Clojure 1.5.0 is out the door I'd like to make ClojureScript
 depend on it. This would allow me to merge in the source map branch which
 is a work in progress but far enough along that the critical bits are there
 and it would be nice to get community contributions towards wrapping it up.

 Merging in the source map work would require adding data.json as a
 dependency.

 Anyone have issues with these changes?

 David

  --
 You received this message because you are subscribed to the Google Groups
 Clojure Dev group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to clojure-...@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojure-dev?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Stuart Sierra
Hi Paul,

This might be an interesting contribution to clojure.core.reducers. I 
haven't looked at your code in detail, so I can't say for sure, but being 
able to do parallel fold over semi-lazy sequences would be very useful.

-S



On Tuesday, March 12, 2013 9:34:43 AM UTC-4, Paul Butcher wrote:

 So this turned out to be pretty easy. I've implemented a function called 
 foldable-seq that takes a lazy sequence and turns it into something that 
 can be folded in parallel. I've checked an example program that uses it to 
 count words in a Wikipedia XML dump into GitHub:

 https://github.com/paulbutcher/foldable-seq

 The code for foldable-seq is here:


 https://github.com/paulbutcher/foldable-seq/blob/master/src/wordcount/reducers.clj#L60

 On my 4-core MacBook Pro, I see a 40 second runtime without parallel-seq, 
 13 seconds with.

 --
 paul.butcher-msgCount++

 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: pa...@paulbutcher.com javascript:
 AIM: paulrabutcher
 Skype: paulrabutcher
  
 On 11 Mar 2013, at 13:38, Paul Butcher pa...@paulbutcher.comjavascript: 
 wrote:

 On 11 Mar 2013, at 11:00, Marko Topolnik marko.t...@gmail.comjavascript: 
 wrote:

 The idea is to transform into a lazy sequence of eager chunks. That 
 approach should work.


 Exactly. Right - I guess I should put my money where my mouth is and see 
 if I can get it working...

 --
 paul.butcher-msgCount++

 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: pa...@paulbutcher.com javascript:
 AIM: paulrabutcher
 Skype: paulrabutcher
  



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: nameclashes with java.lang

2013-03-12 Thread Stuart Sierra
Actually, simply creating a namespace imports all of java.lang. The `ns` 
macro is responsible only for referring clojure.core. That's been true 
since 1.0.

The only workaround right now is ns-unmap.

-S


On Wednesday, March 6, 2013 8:33:34 AM UTC-5, Jim foo.bar wrote:

 On 06/03/13 10:41, Phillip Lord wrote: 
  Is there no equivalent to :refer-clojure for java.lang? 

 I think java.lang is imported by the ns macro...if you don't use it then 
 you don't get java.lang.* 

 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: lazy seqs overflow the stack?

2013-03-12 Thread Stuart Sierra
Yes. `concat` in a loop is tricky: each additional concatenation creates a 
new lazy sequence object which points to the previous lazy sequence. If you 
get too many of those, trying to realize the lazy sequence will cause a 
stack overflow.

In general, I recommend using `concat` only in recursive functions that 
return lazy sequences, and never in a `loop` or `reduce`. If you want to 
accumulate a sequential result non-lazily, use `into` and a vector.

-S


On Saturday, March 2, 2013 2:38:24 PM UTC-5, Ben wrote:

 Try it and see: 

 (reduce (fn [acc _] (concat acc acc)) '() (range 1750)) 

 blows up with a stack overflow error. Changing the inner expression to 
 (doall (concat acc acc)) avoids the issue, but (obviously) also 
 requires giving up laziness. 

 This is admittedly fairly insanely nested, but I would have expected it to 
 work. 

 -- 
 Ben Wolfson 
 Human kind has used its intelligence to vary the flavour of drinks, 
 which may be sweet, aromatic, fermented or spirit-based. ... Family 
 and social life also offer numerous other occasions to consume drinks 
 for pleasure. [Larousse, Drink entry] 


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Gary Verhaegen
As I recall, Rich's explanation was basically that concrete types
(collections) go first and abstractions (mostly sequence) go last.
Hence (conj coll el), (cons el seq), (drop n seq),  (assoc coll ...),
etc. He also said that it was not a hard rule, so there might be
exceptions in the standard library.

There were also some back and forth about extensibility of some
functions, such as assoc being able to take multiple key value pairs
because the collection came first, which would not have been possible
if the collection was last (this has apparently been added after the
function's interface had been fixed, so it was not part of the
design).

I'd say the most important thing is that you be consistent with your
own data representations. If you are building a set of functions to
manipulate some given data abstraction, always put it in the same
place.

On 12 March 2013 18:29, Sean Corfield seancorfi...@gmail.com wrote:
 On Tue, Mar 12, 2013 at 10:21 AM, Neale Swinnerton ne...@isismanor.com 
 wrote:
 if designing from scratch should we favour being threadable with - or - ?

 My understanding is that the two threading macros are there to support
 two existing standard idioms in Clojure:
 * functions operating on collections tend to have the collection in
 the last argument slot (so you use -)
 * other functions - where the first argument is usually the cascade
 point so you use -

 (I remember reading a better articulated explanation than that but
 can't find the link easily - hopefully you get the idea)
 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Paul Butcher
On 12 Mar 2013, at 18:26, Stuart Sierra the.stuart.sie...@gmail.com wrote:

 This might be an interesting contribution to clojure.core.reducers. I haven't 
 looked at your code in detail, so I can't say for sure, but being able to do 
 parallel fold over semi-lazy sequences would be very useful.

I'd be delighted if this (or something like it) could make it into 
clojure.core.reducers, Stuart. What would I need to do to make this happen?

--
paul.butcher-msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: p...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




ANN Pantomime 1.7 is released

2013-03-12 Thread Michael Klishin
Pantomime [1] is a tiny Clojure library that deals with MIME types.

Release notes:
http://blog.clojurewerkz.org/blog/2013/03/12/pantomime-1-dot-7-0-is-released/

1. http://github.com/michaelklishin/pantomime
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




ANN Validateur 1.4 is released

2013-03-12 Thread Michael Klishin
Validateur is a functional validations library inspired by Ruby's
ActiveModel.

Release notes for 1.4:
http://blog.clojurewerkz.org/blog/2013/03/12/validateur-1-dot-4-0-is-released/

1. http://clojurevalidations.info
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN Validateur 1.4 is released

2013-03-12 Thread Jonathan Fischer Friberg
We recommend all users to upgrade to
1.7.0https://clojars.org/com.novemberain/validateur/versions/1.7.0
.

I'm guessing it should be 1.4.0?

Jonathan



On Tue, Mar 12, 2013 at 8:58 PM, Michael Klishin 
michael.s.klis...@gmail.com wrote:

 Validateur is a functional validations library inspired by Ruby's
 ActiveModel.

 Release notes for 1.4:

 http://blog.clojurewerkz.org/blog/2013/03/12/validateur-1-dot-4-0-is-released/

 1. http://clojurevalidations.info
 --
 MK

 http://github.com/michaelklishin
 http://twitter.com/michaelklishin

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN Validateur 1.4 is released

2013-03-12 Thread Michael Klishin
2013/3/13 Jonathan Fischer Friberg odysso...@gmail.com

 We recommend all users to upgrade to 
 1.7.0https://clojars.org/com.novemberain/validateur/versions/1.7.0
 .

 I'm guessing it should be 1.4.0?


Correct, thanks for spotting.
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Clojure HTML5 Game Development

2013-03-12 Thread Reginald Choudari
Any resources/people dedicated to game development using 
Clojure/Clojurescript?
I have made a couple games using HTML5/Javascript with the canvas element, 
and seeing that Clojurescript can replace Javascript coupled with Clojure 
hosting an HTTP web server, I was thinking of moving over to the Clojure 
way of coding things.. Any suggestions?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Java interop with dynamic proxies

2013-03-12 Thread Thomas
Hi All,

I have to interface with a Java project that is used in the following way:

Factory f = Factory.createInstance();
Fred fred = f.create( Fred.class);
fred.setName( Fred);

Where Fred is just an interface with some getters and setters, and I guess 
the dynamic proxy generates the right code behind the covers.

Any ideas how to do the equivalent in Clojure? (I figured out how to do the 
first line, but have tried various things for the second to no avail)

TIA
Thomas

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure HTML5 Game Development

2013-03-12 Thread Claudia Doppioslash
 I was thinking of moving over to the Clojureway of coding things.. Any
suggestions?

I'm looking into that myself.
The most promising approach I think is to use Gambit (
https://github.com/ibdknox/gambit ) from Chris Granger, he built
ChromaShift on it ( https://github.com/ibdknox/ChromaShift )

-- 
Claudia

+44 7563 242885
http://gplus.to/gattoclaudia
@doppioslash
http://stackoverflow.com/users/560848/doppioslash

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: fold over a sequence

2013-03-12 Thread Stuart Sierra
See clojure.org/contributing

it's all there.

On Tuesday, March 12, 2013, Paul Butcher wrote:

 On 12 Mar 2013, at 18:26, Stuart Sierra 
 the.stuart.sie...@gmail.comjavascript:_e({}, 'cvml', 
 'the.stuart.sie...@gmail.com');
 wrote:

 This might be an interesting contribution to clojure.core.reducers. I
 haven't looked at your code in detail, so I can't say for sure, but being
 able to do parallel fold over semi-lazy sequences would be very useful.


 I'd be delighted if this (or something like it) could make it into
 clojure.core.reducers, Stuart. What would I need to do to make this happen?

 --
 paul.butcher-msgCount++

 Snetterton, Castle Combe, Cadwell Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 MSN: p...@paulbutcher.com javascript:_e({}, 'cvml',
 'p...@paulbutcher.com');
 AIM: paulrabutcher
 Skype: paulrabutcher

  --
 --
 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 a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/8RKCjF00ukQ/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com javascript:_e({}, 'cvml',
 'clojure%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure HTML5 Game Development

2013-03-12 Thread Marco Munizaga
I'm thinking about writing an idiomatic wrapper for the gameclosure 
library, I'm going to call it gameclojurescript. It's good to see other 
people wanting to do this too!

On Tuesday, March 12, 2013 4:34:21 PM UTC-4, Reginald Choudari wrote:

 Any resources/people dedicated to game development using 
 Clojure/Clojurescript?
 I have made a couple games using HTML5/Javascript with the canvas element, 
 and seeing that Clojurescript can replace Javascript coupled with Clojure 
 hosting an HTTP web server, I was thinking of moving over to the Clojure 
 way of coding things.. Any suggestions?


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Java interop with dynamic proxies

2013-03-12 Thread Brian Goslinga
Do you want to know how to define Fred, or how to translate the above code 
snippet?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




ANN: Xenopath 0.1.0 (XPath for Clojure)

2013-03-12 Thread Jeremy Heiler
I've released 0.1.0 of my XPath library. My goal is to create a light
library that wraps Java's javax.xml.xpath and org.w3c.dom packages. It's
not feature complete, but it should be enough to get started with XPath.

Any feedback is appreciated!

https://github.com/jeremyheiler/xenopath

//Jeremy

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Java interop with dynamic proxies

2013-03-12 Thread Jonathan Fischer Friberg
I think you can simply use 'Fred' instead of 'Fred.class'.

Since, in the repl:

(class Integer)
;= java.lang.Class

I.e. just by using the name, we get a Class object, which should correspond
to .class in java.
In other words, you should be able to run:

(let [f (Factory/createInstance)
  fred (.create f Fred)]
  (.setName fred Fred))

Might be wrong though. :)

Jonathan


On Wed, Mar 13, 2013 at 12:08 AM, Brian Goslinga
brian.gosli...@gmail.comwrote:

 Do you want to know how to define Fred, or how to translate the above code
 snippet?

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Java interop: Can't call public method of non-public class

2013-03-12 Thread Shlomi Vaknin
hey, I have a similar problem, even when i type annotate with clojure 1.5 i
still get that error.. any suggestions?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Java interop: Can't call public method of non-public class

2013-03-12 Thread shlomivaknin
I meant to post this as a reply 
to https://groups.google.com/d/msg/clojure/jYfEKVH5GsQ/3Hq5hU0u6UQJ

In my case i am trying to get clojure working with netty 4, here is the 
code:

(def #^AbstractBootstrap b (ServerBootstrap.)) 
(.channel 
^AbstractBootstraphttps://github.com/netty/netty/blob/master/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java#L84b
 ^Class io.netty.channel.socket.nio.NioServerSocketChannel)  

which returns the error:
java.lang.IllegalArgumentException: Can't call public method of non-public 
class: public io.netty.bootstrap.AbstractBootstrap 
io.netty.bootstrap.AbstractBootstrap.channel(java.lang.Class)  
 at clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)  

why does it still use the reflector even though its fully annotated, and 
how do i get over that non-public class issue?..

On Wednesday, March 13, 2013 2:26:00 AM UTC+2, Shlomi Vaknin wrote:

 hey, I have a similar problem, even when i type annotate with clojure 1.5 
 i still get that error.. any suggestions?


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure HTML5 Game Development

2013-03-12 Thread George Oliver


On Tuesday, March 12, 2013 1:34:21 PM UTC-7, Reginald Choudari wrote:

 Any resources/people dedicated to game development using 
 Clojure/Clojurescript?
 I have made a couple games using HTML5/Javascript with the canvas element, 
 and seeing that Clojurescript can replace Javascript coupled with Clojure 
 hosting an HTTP web server, I was thinking of moving over to the Clojure 
 way of coding things.. Any suggestions?


There are some links here, http://lispgames.org/index.php/Clojurescript 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Java interop: Can't call public method of non-public class

2013-03-12 Thread Sean Corfield
On Tue, Mar 12, 2013 at 5:46 PM,  shlomivak...@gmail.com wrote:
 In my case i am trying to get clojure working with netty 4, here is the
 code:

 (def #^AbstractBootstrap b (ServerBootstrap.))
 (.channel ^AbstractBootstrap b ^Class
 io.netty.channel.socket.nio.NioServerSocketChannel)

 which returns the error:
 java.lang.IllegalArgumentException: Can't call public method of non-public
 class: public io.netty.bootstrap.AbstractBootstrap
 io.netty.bootstrap.AbstractBootstrap.channel(java.lang.Class)
  at clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)

I can't reproduce this (with Clojure 1.5.1, Netty 4.0.0.Alpha8):

user= (set! *warn-on-reflection* true)
true
user= (import '(io.netty.bootstrap AbstractBootstrap ServerBootstrap))
io.netty.bootstrap.ServerBootstrap
user= (def b (ServerBootstrap.))
#'user/b
user= (.channel ^AbstractBootstrap b ^Class
io.netty.channel.socket.nio.NioServerSocketChannel)
#ServerBootstrap ServerBootstrap(factory: NioServerSocketChannel.class)
user= *clojure-version*
{:major 1, :minor 5, :incremental 1, :qualifier nil}
user=


Can you provide more detail?
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the point of - ?

2013-03-12 Thread Brandon Bloom
One other thing to consider is partial application. The collection 
functions tend to put the most-likely-to-be-curried arguments first. For 
example:

(def sum (partial reduce + 0))

Compare to coll-reduce, which dispatches on the type of the first argument:

(require '[clojure.core.protocols :refer (coll-reduce)])
(def sum #(coll-reduce % + 0))

On Tuesday, March 12, 2013 1:29:31 PM UTC-4, Sean Corfield wrote:

 On Tue, Mar 12, 2013 at 10:21 AM, Neale Swinnerton 
 ne...@isismanor.comjavascript: 
 wrote: 
  if designing from scratch should we favour being threadable with - or 
 - ? 

 My understanding is that the two threading macros are there to support 
 two existing standard idioms in Clojure: 
 * functions operating on collections tend to have the collection in 
 the last argument slot (so you use -) 
 * other functions - where the first argument is usually the cascade 
 point so you use - 

 (I remember reading a better articulated explanation than that but 
 can't find the link easily - hopefully you get the idea) 
 -- 
 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Clojure 1.5.0 bug (Java interop: Compiler.load(new StringReader(str));)

2013-03-12 Thread Taegyoon Kim
A new error occurred in Clojure 1.5.0.
 
(Java interop: Compiler.load(new StringReader(str));)
 
# Code #
import java.io.IOException;
import java.io.StringReader;
import clojure.lang.Compiler;
import clojure.lang.RT;
import clojure.lang.Var;
public class Main {
public static void main(String[] args) throws IOException, 
ClassNotFoundException {
//clojure.main.main(args);

// Load the Clojure script -- as a side effect this initializes the 
runtime.
String str = (ns user) (defn foo [a b]   (str a \ \ b)) (def a 
3);
//RT.loadResourceScript(foo.clj);
Compiler.load(new StringReader(str));
// Get a reference to the foo function.
Var foo = RT.var(user, foo);
Var a = RT.var(user, a); // reference to the variable a
// Call it!
Object result = foo.invoke(Hi, there);
System.out.println(result);

System.out.println(a);
System.out.println(a.get());
}
}
 
Test code: 
*https://bitbucket.org/ktg/clojureembedtest*https://bitbucket.org/ktg/clojureembedtest(Eclipse
 project)

Reference: *
http://stackoverflow.com/questions/2181774/calling-clojure-from-java*http://stackoverflow.com/questions/2181774/calling-clojure-from-java
 
 
$ java -version
java version 1.7.0_15
OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.04.1)
OpenJDK Client VM (build 23.7-b01, mixed mode, sharing)
$ java -cp clojure-1.5.0.jar:. Main

Exception in thread main java.lang.ExceptionInInitializerError
at clojure.lang.Compiler.clinit(Compiler.java:47)
at Main.main(Main.java:16)
Caused by: java.lang.NullPointerException
at clojure.lang.RT.baseLoader(RT.java:2043)
at clojure.lang.RT.load(RT.java:417)
at clojure.lang.RT.load(RT.java:411)
at clojure.lang.RT.doInit(RT.java:447)
at clojure.lang.RT.clinit(RT.java:329)
... 2 more
$ java -cp clojure-1.4.0.jar:. Main

Hi there
#'user/a
3
 
 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure 1.5.0 bug (Java interop: Compiler.load(new StringReader(str));)

2013-03-12 Thread Andy Fingerhut
Yegor Bugayenko posted in a comment on ticket CLJ-1172 (
http://dev.clojure.org/jira/browse/CLJ-1172) that calling RT.init() before
Compiler.load() solved what looks like a similar problem for him.

Andy

On Tue, Mar 12, 2013 at 6:29 PM, Taegyoon Kim stelofl...@gmail.com wrote:

 A new error occurred in Clojure 1.5.0.

 (Java interop: Compiler.load(new StringReader(str));)

 # Code #
 import java.io.IOException;
 import java.io.StringReader;
 import clojure.lang.Compiler;
 import clojure.lang.RT;
 import clojure.lang.Var;
 public class Main {
 public static void main(String[] args) throws IOException,
 ClassNotFoundException {
 //clojure.main.main(args);

 // Load the Clojure script -- as a side effect this initializes
 the runtime.
 String str = (ns user) (defn foo [a b]   (str a \ \ b)) (def a
 3);
 //RT.loadResourceScript(foo.clj);
 Compiler.load(new StringReader(str));
 // Get a reference to the foo function.
 Var foo = RT.var(user, foo);
 Var a = RT.var(user, a); // reference to the variable a
 // Call it!
 Object result = foo.invoke(Hi, there);
 System.out.println(result);

 System.out.println(a);
 System.out.println(a.get());
 }
 }

 Test code: 
 *https://bitbucket.org/ktg/clojureembedtest*https://bitbucket.org/ktg/clojureembedtest(Eclipse
  project)

 Reference: *http://stackoverflow.com/questions/2181774/calling-
 clojure-from-java*http://stackoverflow.com/questions/2181774/calling-clojure-from-java


 $ java -version
 java version 1.7.0_15
 OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.04.1)
 OpenJDK Client VM (build 23.7-b01, mixed mode, sharing)
 $ java -cp clojure-1.5.0.jar:. Main

 Exception in thread main java.lang.**ExceptionInInitializerError
 at clojure.lang.Compiler.clinit**(Compiler.java:47)
 at Main.main(Main.java:16)
 Caused by: java.lang.NullPointerException
 at clojure.lang.RT.baseLoader(RT.**java:2043)
 at clojure.lang.RT.load(RT.java:**417)
 at clojure.lang.RT.load(RT.java:**411)
 at clojure.lang.RT.doInit(RT.**java:447)
 at clojure.lang.RT.clinit(RT.**java:329)
 ... 2 more
 $ java -cp clojure-1.4.0.jar:. Main

 Hi there
 #'user/a
 3



 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[ANN] Syme: for real-time collaborating over SSH

2013-03-12 Thread Phil Hagelberg

Hello folks.

I'd like to announce a side-project I've been working on:

https://syme.herokuapp.com

From the FAQ: (https://syme.herokuapp.com/faq)

# So what does Syme offer?

It sets up disposable EC2 nodes for collaborating on GitHub projects via
ssh and tmux.

* Enter the name of a GitHub repo. (Authorize Syme via GitHub if you
  haven't already.)
* Enter your AWS credentials and names of GitHub users to invite.
* SSH into the instance once it's booted using the command shown and
  launch tmux.
* Send the login info to the users you have invited.

If you develop using tools that can be operated from the command line,
Syme makes it easy to put up EC2 instances that can be used for
collaborative development. It handles setting up SSH public keys for all
collaborators, checking out the project, and loading up required
packages. So as long as you have a GitHub account and an Amazon Web
Services account, you can get started in just a couple clicks.

As someone who works as part of a distributed team, I built this to
reduce friction of remote collaboration. If you can easily spin up a
node to look at a codebase together, you're much more likely to work
together on things and get feedback live as you're coding. Of course,
it's possible to do this on your own machines, but then you have to deal
with setting up a user with limited access, plus you have to configure
port forwarding and NAT, which can be a real problem if you work on
public wifi or a mobile data connection. We also have used it at the
Seattle Clojure group meetings, where a disposable, untrusted instance
comes in very handy.

Syme is inspired by https://pair.io, a (now-defunct) similar service,
but its model is bring your own AWS credentials, which allows it to
punt on billing and other complicated bits. The result is a codebase
that clocks in at just under 500 lines. I feel like it's fairly
accessible, (compojure+hiccup, jdbc+postgres) and I would welcome
contributions. I have a list of planned features here:

https://github.com/technomancy/syme/issues

Please let me know what you think if you get a chance to use it.

-Phil

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




What causes the text that I print to the terminal to become mangled garbage?

2013-03-12 Thread larry google groups
I saw some functions here that measure CPU and thread usage: 

http://lifeisagraph.com/2011/04/24/debugging-clojure.html

That looked good, so I imported them into my app. I've done this before and 
not had a problem with it. 

For logging, I like to use the Timbre library: 

https://github.com/ptaoussanis/timbre

And then I thought I should call the thread-measuring function and hand its 
return value to timbre. And suddenly the info that I'm logging to the 
terminal became a mangled mess of strangely intermingled text. Can anyone 
suggest why this is happening? 

((applyapply
 str
  at the start of  persistrst-sessi
on -data-to-databaseop,t io ouarnt   cvtpaluhu eea =nsd'tt athrehtar 
teoeafrd 'deTlh eetaete-urol/do-pssteioanssiogns
,   eour c pu alnd thoreado usagke losoks l liikeke  this:t his
 : 
 option value='music'Music/option(debug/thread-top))
(debug/thread-top)
  )
[ at the[ start of  adeleoptteio-no vladlu-es='easlsl-ikoinndss,' 
Aolulr ki ndcsp/to pttihone ]s]ta
rt of  peu2013-Mar-12 23:03:21 -0400 MacBook-Pro.local DEBUG 
[kiosks-clojure.core] - in get-options-for-select-box:  [option v\
alue='dance'Dance/option option value='theater'Theater/option 
option value='music'Music/option option value='all-kinds'\
All kinds/option]
r sainstd- thsreesasdi ouns-adgaet al-oto2ok0-s1d 3l-iMkaer a-tt1ah2ib 
sa2:s3 e:[,03 31o:u42412 7-7r00 4 c \pLua wDarenesdnt crteohs\
yr-JeMaaavcdaB ouVosMka\ge  2l2o o#k-TPhrroe.aldo s clailk eD EtBhUiGs :[ 
k[i3o1s4k4Ts2h-7rce7la0od0j[uDrees.tcrooryeJ]ava
VM,05 ,\maiDne]st]ro[4y7Ja3i1vna6V0 0Mg0\e t\- 2o2p t#ioTnhsr-efaodrT 
-hTsrheerlaedc-t1-1b\ox:  19
#Thea[dr[[eDaeds tTrhoryeJada[vToaphrtVeiMoa,nd5- 
,1vm1aa,luien=]'d]a[n4c6e0'210D0a0n c\e/Tohprteiaodn-11\ 19 
#Thr5e,maadin] ]\
T[h3r0e8a9d4[0T0h0r e\ad-T1h1r,ead-12\ 20 #Thread Thread[Th
r  ead-12,5,main]][51,3m4a2i7n0]00] [3\0894000 \Thread-12\Tohread- 
1230\ # 2Th1 re#aTd hTrehared aTdh[rTehad[Tread-12,5,main]][\
1340 \hread-13,5,maiTnh]re]a[96 d\-13q\tp5 2211 
8#89pT0thi0or5ne-a1 dv1a 
 lTuSehe=rl'teehaceadtt[oerTr'hrTheeaadte-r13/,op5\
t,imonain]
]  [96\0 \q t1p15 2#18T8h9r0e0a5d- 1T1h rSeealde[cqtotrp052\18 
81910 0#5-T1h1r Seealde Tchtroera0d,[5q,tpm5a2i1n8]89]0[0854-9101\
 0S0e l\ectqort0p,55,main]][849000 \qtp52121889080859-01035 -A1c3ce 
pAtcocre0pt oSer0l ecSteClehcatnCnehalnConnenleCoctnnore@c0t.oo0r\
p.@t0i0o..n0 0:v.a3l00u.e00=0':1m3u\s0i0c0'1M\usic 1/3o pt# io1nT3h 
r#ea


At least some of this mangled text is coming from this function, which is 
called at startup and then runs in its own thread, repeating endlessly:

(defn persist-session-data-to-database []
  (timbre/spy :debug (apply str  at the start of 
 persist-session-data-to-database, our cpu and thread usage looks like 
this:  (debug/thread-top)))
  (try   
(let [documents-to-be-persisted (get-data-to-be-persisted)]
  (doseq [[k v] documents-to-be-persisted]
(monger/persist-document-to-database (add-key-to-document k v
(catch Exception e (debug/print-error-info e)))
  (timbre/spy :debug (apply str  at the end of 
 persist-session-data-to-database, our cpu and thread usage looks like 
this:  (debug/thread-top)))
  (. java.lang.Thread sleep 60)
  (persist-session-data-to-database))

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What causes the text that I print to the terminal to become mangled garbage?

2013-03-12 Thread Jason Lewis
tl;dr concurrency is hard

Jason Lewis

Email  jasonlewi...@gmail.com

Twitter@canweriotnow http://twitter.com/canweriotnow

Blog   http://decomplecting.org

About http://about.me/jason.lewis


On Tue, Mar 12, 2013 at 11:27 PM, Michael Klishin 
michael.s.klis...@gmail.com wrote:

 2013/3/13 larry google groups lawrencecloj...@gmail.com

 At least some of this mangled text is coming from this function, which is
 called at startup and then runs in its own thread


 If your app itself prints stuff to stdout/stderr, it is likely to be
 interleaved with the output from the spying thread.
 Thread execution order and time slicing is non-deterministic and nothing
 synchronizes writing to stdout/stderr
 to enforce ordering.
 --
 MK

 http://github.com/michaelklishin
 http://twitter.com/michaelklishin

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure 1.5.0 bug (Java interop: Compiler.load(new StringReader(str));)

2013-03-12 Thread Taegyoon Kim
But then(putting RT.init()),
 
Compiler.load() works, but Console (stderr?) says
 
No need to call RT.init() anymore
 
So I think this problem should be fixed.
 

2013년 3월 13일 수요일 오전 11시 32분 5초 UTC+9, Andy Fingerhut 님의 말:

 Yegor Bugayenko posted in a comment on ticket CLJ-1172 (
 http://dev.clojure.org/jira/browse/CLJ-1172) that calling RT.init() 
 before Compiler.load() solved what looks like a similar problem for him.

 Andy

 On Tue, Mar 12, 2013 at 6:29 PM, Taegyoon Kim stelo...@gmail.comjavascript:
  wrote:

 A new error occurred in Clojure 1.5.0.
  
 (Java interop: Compiler.load(new StringReader(str));)
  
 # Code #
 import java.io.IOException;
 import java.io.StringReader;
 import clojure.lang.Compiler;
 import clojure.lang.RT;
 import clojure.lang.Var;
 public class Main {
 public static void main(String[] args) throws IOException, 
 ClassNotFoundException {
 //clojure.main.main(args);
 
 // Load the Clojure script -- as a side effect this initializes 
 the runtime.
 String str = (ns user) (defn foo [a b]   (str a \ \ b)) (def a 
 3);
 //RT.loadResourceScript(foo.clj);
 Compiler.load(new StringReader(str));
 // Get a reference to the foo function.
 Var foo = RT.var(user, foo);
 Var a = RT.var(user, a); // reference to the variable a
 // Call it!
 Object result = foo.invoke(Hi, there);
 System.out.println(result);
 
 System.out.println(a);
 System.out.println(a.get());
 }
 }
  
 Test code: 
 *https://bitbucket.org/ktg/clojureembedtest*https://bitbucket.org/ktg/clojureembedtest(Eclipse
  project)

 Reference: *http://stackoverflow.com/questions/2181774/calling-
 clojure-from-java*http://stackoverflow.com/questions/2181774/calling-clojure-from-java
  
  
 $ java -version
 java version 1.7.0_15
 OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.04.1)
 OpenJDK Client VM (build 23.7-b01, mixed mode, sharing)
  $ java -cp clojure-1.5.0.jar:. Main

 Exception in thread main java.lang.**ExceptionInInitializerError
 at clojure.lang.Compiler.clinit**(Compiler.java:47)
 at Main.main(Main.java:16)
 Caused by: java.lang.NullPointerException
 at clojure.lang.RT.baseLoader(RT.**java:2043)
 at clojure.lang.RT.load(RT.java:**417)
 at clojure.lang.RT.load(RT.java:**411)
 at clojure.lang.RT.doInit(RT.**java:447)
 at clojure.lang.RT.clinit(RT.**java:329)
 ... 2 more
 $ java -cp clojure-1.4.0.jar:. Main

 Hi there
 #'user/a
 3
  
  

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




ClojureCLR - Question about the Debug 3.5 build configuration and System.Reflection.Assembly.IsDynamic property

2013-03-12 Thread FC
Hi,

I'm trying to build ClojureCLR from the latest clojure-clr-master.ZIP file 
I downloaded from GitHub. 

With Debug 3.5 as the build configuration I get a compilation error in 
Clojure\lib\RT.cs that System.Reflection.Assembly does not contain a 
definition for 'IsDynamic'.

Is this expected? When I use Debug 4.0 it builds fine.

Thank you.

-Fiel

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Redefinition of datatypes

2013-03-12 Thread Ambrose Bonnaire-Sergeant
core.typed dependencies are all in Central now.

Here's a reproducible example of this failure.

http://build.clojure.org/job/core.typed/3/console

Thanks,
Ambrose

On Sun, Feb 24, 2013 at 12:50 AM, Chas Emerick c...@cemerick.com wrote:

 On Feb 23, 2013, at 11:35 AM, Stuart Sierra wrote:

 Furthermore, according to the policy of the Maven Central 
 Repositoryhttp://search.maven.org/,
 we cannot deploy anything which depends on third-party repositories.
 Therefore we cannot deploy core.typed to the Central Repository unless all
 its dependencies are also deployed there.


 Straying further off-topic, but: FWIW, unless they've changed the
 verification of POMs being promoted recently, that's not so.  The official
 guide to OSS deployment only says it's strongly discouraged (
 https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide),
 and links to blog posts that indicate that Sonatype is (was?) planning on
 rewriting POMs to remove external repository definitions, but tons of
 artifacts in central still contain them, e.g.:


 http://repo1.maven.org/maven2/org/openid4java/openid4java-nodeps/0.9.6/openid4java-nodeps-0.9.6.pom

 (…which refers to a now-defunct Guice repository, thus highlighting the
 rationale for the proposed no-external-repositories policy.)

 Cheers,

 - Chas

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure 1.5.0 bug (Java interop: Compiler.load(new StringReader(str));)

2013-03-12 Thread Sean Corfield
Based on discussions I've seen on this list and clojure-dev, I think
you're using internal APIs that are not considered supported and
therefore subject to change at any time.

I asked about using clojure.lang.RT a while ago and was told to rely
on very little of the API, for example, so all I rely on is .var() and
calling .invoke() on the result of that. I would say the Compiler is
out of bounds and that you should instead use RT.var() and .invoke()
with basic Clojure functions to read and eval your string.

On Tue, Mar 12, 2013 at 6:29 PM, Taegyoon Kim stelofl...@gmail.com wrote:
 A new error occurred in Clojure 1.5.0.

 (Java interop: Compiler.load(new StringReader(str));)

 # Code #
 import java.io.IOException;
 import java.io.StringReader;
 import clojure.lang.Compiler;
 import clojure.lang.RT;
 import clojure.lang.Var;
 public class Main {
 public static void main(String[] args) throws IOException,
 ClassNotFoundException {
 //clojure.main.main(args);

 // Load the Clojure script -- as a side effect this initializes the
 runtime.
 String str = (ns user) (defn foo [a b]   (str a \ \ b)) (def a
 3);
 //RT.loadResourceScript(foo.clj);
 Compiler.load(new StringReader(str));
 // Get a reference to the foo function.
 Var foo = RT.var(user, foo);
 Var a = RT.var(user, a); // reference to the variable a
 // Call it!
 Object result = foo.invoke(Hi, there);
 System.out.println(result);

 System.out.println(a);
 System.out.println(a.get());
 }
 }

 Test code: https://bitbucket.org/ktg/clojureembedtest (Eclipse project)

 Reference:
 http://stackoverflow.com/questions/2181774/calling-clojure-from-java


 $ java -version
 java version 1.7.0_15
 OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.04.1)
 OpenJDK Client VM (build 23.7-b01, mixed mode, sharing)
 $ java -cp clojure-1.5.0.jar:. Main

 Exception in thread main java.lang.ExceptionInInitializerError
 at clojure.lang.Compiler.clinit(Compiler.java:47)
 at Main.main(Main.java:16)
 Caused by: java.lang.NullPointerException
 at clojure.lang.RT.baseLoader(RT.java:2043)
 at clojure.lang.RT.load(RT.java:417)
 at clojure.lang.RT.load(RT.java:411)
 at clojure.lang.RT.doInit(RT.java:447)
 at clojure.lang.RT.clinit(RT.java:329)
 ... 2 more
 $ java -cp clojure-1.4.0.jar:. Main

 Hi there
 #'user/a
 3



 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.





--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.