How to submit clojure bug report?
I found a bug in Clojure core, and know its solution, question is how to submit a bug report? FYI here is the bug: => (.withMeta list {:a 1}) # This is reporducable in Clojure 1.2 and Clojure 1.3 This cause of this issue is in: svn/trunk/src/jvm/clojure/lang/PersistentList.java with the static method: public static IFn creator = new RestFn(0){ protected Object doInvoke(Object args) throws Exception{ if(args instanceof ArraySeq) { Object[] argsarray = (Object[]) ((ArraySeq) args).array; IPersistentList ret = EMPTY; for(int i = argsarray.length - 1; i >= 0; --i) ret = (IPersistentList) ret.cons(argsarray[i]); return ret; } LinkedList list = new LinkedList(); for(ISeq s = RT.seq(args); s != null; s = s.rest()) list.add(s.first()); return create(list); } }; The withMeta() method should be overriden from AFn where it is throwing the UnsupportedOperationException. This is being done with the EmptyList static class further down the file. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to submit clojure bug report?
Hi You should be able to submit bugs here: http://dev.clojure.org/jira This explains the process: http://clojure.org/patches /Kevin On Wed, Feb 29, 2012 at 11:12 AM, N8Dawgrr wrote: > I found a bug in Clojure core, and know its solution, question is how > to submit a bug report? > > FYI here is the bug: > > => (.withMeta list {:a 1}) > # (NO_SOURCE_FILE:0)> > > This is reporducable in Clojure 1.2 and Clojure 1.3 > > This cause of this issue is in: > > svn/trunk/src/jvm/clojure/lang/PersistentList.java > > with the static method: > > public static IFn creator = new RestFn(0){ > protected Object doInvoke(Object args) throws Exception{ > if(args instanceof ArraySeq) > { > Object[] argsarray = (Object[]) ((ArraySeq) > args).array; > IPersistentList ret = EMPTY; > for(int i = argsarray.length - 1; i >= 0; --i) > ret = (IPersistentList) > ret.cons(argsarray[i]); > return ret; > } > LinkedList list = new LinkedList(); > for(ISeq s = RT.seq(args); s != null; s = s.rest()) > list.add(s.first()); > return create(list); > } > }; > > The withMeta() method should be overriden from AFn where it is > throwing the UnsupportedOperationException. This is being done with > the EmptyList static class further down the file. > > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Google Summer of Code 2012 - any mentors?
Can someone confirm that Clojure/core has already sent an application GSoC participation? I am just wondering if core is already interested in this kind of event or the initiative currently comes only from mentors. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Question about this little method I wrote
Hi Mike, If I understood your aim correctly, and if you accept changing the output of (combinations [[1 2]]) to ((1) (2)) instead of (1 2), which I think makes more sense,then the reduce function does the job in one line for you. (defn combinations [items] (reduce #(for [l % i %2] (conj l i)) [[]] items)) the same, wordier and maybe clearer: (defn combinations [items] (reduce (fn [output item] (for [o output i item] (conj o i))) [[]] items)) and if you really need the output to be a list of lists instead of a list of vectors, maybe something like: (defn combinations [items] (map seq (reduce #(for [o % i %2] (conj o i)) [[]] items))) Btw, I learned an awful lot about compact ways of doing stuff in Clojure by doing the exercises (and checking others' solutions) on 4clojure.com, which I warmly recommend. Nico On Feb 27, 3:45 am, Mike Ledoux wrote: > So I recently decided to start learning Clojure. I installed Clojure > box and wrote this little method to compute all possible combinations > of input: > > (defn combinations [items] > (if (== (count items) 1) > (flatten items) > (for [frstitems (flatten (first items)) > tlitm (combinations (rest items))] > (flatten (list frstitems tlitm) > > so (combinations [[1 2] [1 2]]) > > returns > > ((1 1) (1 2) (2 1) (2 2)) > > Is there a way I can get rid of the if form? Having the if statement > duplicates what the for loop does when it creates frstitems. I tried > removing the if statement so the function looks like: > > (defn combinations [items] > (for [frstitems (flatten (first items)) > tlitm (combinations (rest items))] > (flatten (list frstitems tlitm > > but when I do this the function just returns an empty list. I tried > to figure out why using the REPL but did not discover the problem. > > Is what I'm asking possible and if so what would the function look > like? Thank you. > > So far Clojure is pretty cool! > > Mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Workflow and development tools for ClojureScript One
Hi Karl, My emacs setup is also based on live coding. For ClojureScript One hacking, I use lein swank and slime-connect - for clojure. And for cljs, I use inferior-lisp. When I'm in a cljs file, I just disable the slime-mode, so it uses the inferior-lisp. ./Vijay On Sunday, February 19, 2012 9:17:28 PM UTC+1, Krukow wrote: > > I was wondering what a good workflow for working with ClojureScript > One would be. > > For regular Clojure, I use Emacs with swank-clojure (using Sam's Live > coding emacs, which is great for Emacs beginners, > https://github.com/overtone/live-coding-emacs). That works quite well > for me, giving a good interactive experience and flow. > > For ClojureScript One, I tried the Emacs setup > > https://github.com/brentonashworth/one/wiki/Emacs > > but it is not working well for me, as described here: > > > https://groups.google.com/group/clojure/browse_frm/thread/43ad3661aa3292d0/73a2f29776d70694 > > https://github.com/brentonashworth/one/issues/116 > > Since this issue makes development impractical, some of you *must* be > using a better setup for Emacs and ClojureScript One. I wonder what > that is... :) > > Ideally, I want *one* (no pun intended) Emacs instance with two REPLs > (clj, cljs) giving a swank-clojure like experience, preferably in both > repls. > > Is anyone there? > > Thanks, > - Karl On Sunday, February 19, 2012 9:17:28 PM UTC+1, Krukow wrote: > > I was wondering what a good workflow for working with ClojureScript > One would be. > > For regular Clojure, I use Emacs with swank-clojure (using Sam's Live > coding emacs, which is great for Emacs beginners, > https://github.com/overtone/live-coding-emacs). That works quite well > for me, giving a good interactive experience and flow. > > For ClojureScript One, I tried the Emacs setup > > https://github.com/brentonashworth/one/wiki/Emacs > > but it is not working well for me, as described here: > > > https://groups.google.com/group/clojure/browse_frm/thread/43ad3661aa3292d0/73a2f29776d70694 > > https://github.com/brentonashworth/one/issues/116 > > Since this issue makes development impractical, some of you *must* be > using a better setup for Emacs and ClojureScript One. I wonder what > that is... :) > > Ideally, I want *one* (no pun intended) Emacs instance with two REPLs > (clj, cljs) giving a swank-clojure like experience, preferably in both > repls. > > Is anyone there? > > Thanks, > - Karl On Sunday, February 19, 2012 9:17:28 PM UTC+1, Krukow wrote: > > I was wondering what a good workflow for working with ClojureScript > One would be. > > For regular Clojure, I use Emacs with swank-clojure (using Sam's Live > coding emacs, which is great for Emacs beginners, > https://github.com/overtone/live-coding-emacs). That works quite well > for me, giving a good interactive experience and flow. > > For ClojureScript One, I tried the Emacs setup > > https://github.com/brentonashworth/one/wiki/Emacs > > but it is not working well for me, as described here: > > > https://groups.google.com/group/clojure/browse_frm/thread/43ad3661aa3292d0/73a2f29776d70694 > > https://github.com/brentonashworth/one/issues/116 > > Since this issue makes development impractical, some of you *must* be > using a better setup for Emacs and ClojureScript One. I wonder what > that is... :) > > Ideally, I want *one* (no pun intended) Emacs instance with two REPLs > (clj, cljs) giving a swank-clojure like experience, preferably in both > repls. > > Is anyone there? > > Thanks, > - Karl -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Parsing NMON data (CSV)
Use incanter. On Feb 27, 2012 2:29 PM, "meteorfox" wrote: > Thanks for the suggestion but I'm already using it to parse it, it's > really simple to use. > > What I really meant is, what could be a good library for making graphs > based on sampled data?. > > Suppose I have the following > > , , , > , , , > ... etc. > > > On Feb 27, 1:02 pm, David Santiago wrote: > > One library you could use is one I wrote called Clojure-CSV, which you > > can find athttp://github.com/davidsantiago/clojure-csv. If you have > > any questions, feel free to email me or message me on github. > > > >David > > > > On Sun, Feb 26, 2012 at 3:33 PM, meteorfox > > > > > > > > > > > > > > > > wrote: > > > Hi, > > > > > I'm interested in creating graphs for NMON data which is essentially a > > > csv file. Which library can you recommend for this kind of task? > > > > > Here's a brief sample of the data I need to parse in.. > > > > > AAA,progname,nmon_x86_64_fedora16 > > > AAA,command,./nmon_x86_64_fedora16 -f -s 30 -c 60 > > > AAA,version,14g > > > AAA,disks_per_line,150 > > > AAA,max_disks,256,set by -d option > > > AAA,disks,9, > > > AAA,host,sandybridge > > > AAA,user,meteorfox > > > AAA,OS,Linux,3.2.6-3.fc16.x86_64,#1 SMP Mon Feb 13 20:35:42 UTC > > > 2012,x86_64 > > > AAA,runname,sandybridge > > > AAA,time,22:18.50 > > > AAA,date,24-FEB-2012 > > > AAA,interval,30 > > > AAA,snapshots,60 > > > AAA,cpus,8 > > > AAA,proc_stat_variables,8 > > > AAA,note0, Warning - use the UNIX sort command to order this file > > > before loading into a spreadsheet > > > AAA,note1, The First Column is simply to get the output sorted in the > > > right order > > > AAA,note2, The T0001-T column is a snapshot number. To work out > > > the actual time; see the ZZZ section at the end > > > CPU001,CPU 1 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU002,CPU 2 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU003,CPU 3 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU004,CPU 4 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU005,CPU 5 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU006,CPU 6 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU007,CPU 7 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU008,CPU 8 sandybridge,User%,Sys%,Wait%,Idle% > > > CPU_ALL,CPU Total sandybridge,User%,Sys%,Wait%,Idle%,Busy,CPUs > > > > > > > > Thanks > > > Carlos Torres > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Clojure" group. > > > To post to this group, send email to clojure@googlegroups.com > > > Note that posts from new members are moderated - please be patient > with your first post. > > > To unsubscribe from this group, send email to > > > clojure+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/clojure?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Disable colored output
> mvn goalname -Dinsert.property.here=true I tried this and it didn't work. > AFAICT, the lazytest maven plugin launches tests in a separate JVM: So I think the only way to overcome this is to make the plugin understand new configuration option. On Feb 27, 3:17 pm, Rob Lally wrote: > I'm reasonably sure that with maven you can pass system properties using the > form > > mvn goalname -Dinsert.property.here=true > > R. > > On 27 Feb 2012, at 17:54, Vladimir Matveev wrote: > > > > > > > > > Thank you again, I will try to look harder for it. > > > On Feb 27, 5:46 pm, Stuart Sierra wrote: > >> Sorry, Vladimir, I don't have an answer for you right now. I'm sure there's > >> a way to set system properties in Maven, but I don't have the relevant > >> documentation at hand. > > >> -S > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: lazy-sequences and memory leaks
Hi Sunil, Might the problem lie within the function that consumes the seq-of-maps? There is a reduce in there that accumulates some data. I can't tell from the code whether that would amount to much, though. Regards, Caspar -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: cld 0.1.0 - Clojure Language Detection
Awesome! I'm seeing some inconsistency though. Does anyone know why a Bayesian classifier would produce such different results? Could it be because of the short input text? (lang/detect "My name is joe") ["af" {"af" "0.8571390166207665", "lt" "0.14285675907555712"}] (lang/detect "My name is joe") ["af" {"af" "0.857138268895934", "fi" "0.14285706394982348"}] (lang/detect "My name is joe") ["af" {"af" "0.7142834459768219", "hr" "0.14285657945126254", "lt" "0.14285645678764042"}] On Feb 28, 2:24 am, Lee Hinman wrote: > Hi all, > I'm pleased to announce the initial 0.1.0 release of cld (Clojure > Language Detection). CLD a tiny library wrapping language-detect[1] > that can be used to determine the language of a particular piece of > text very quickly. You should be able to use it from Clojars[2] with > the following: > > [cld "0.1.0"] > > Please give it a try and open any issues on the github repo[3] that > you find. Check out the readme for the full information and usage. > > Also soliciting better names for the project than 'cld' :) > > thanks, > Lee Hinman > > [1]:https://code.google.com/p/language-detection/ > [2]:http://clojars.org/cld > [2]:https://github.com/dakrone/cld -- 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
Can I use clojure's logo to write an article to a magazine?
Hi, I didn't find what license is owned by logo of Clojure and I would like to use it on a magazine article. I saw a conversation, not conclusive, in which Rich Hickey (or his brother) gives the permission for a guy but it wasnt clear about the current license that rule the logo. Do you have any ideas? Thanks in advance -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Google Summer of Code 2012 - any mentors?
On Tue, 2012-02-28 at 01:35 -0600, Devin Walters wrote: > One item that hasn't made the project ideas list that I've seen > numerous threads about is documentation. Does this fall within the > scope of GSoC? > > > It seems like there are a lot of opportunities to either organize, > revise, update, or generate documentation. > > > Some ideas: > - Clojure.org's Libraries section still talks about contrib like it's > first class. > - The Getting Started guide could always use more work. > - StackOverflow contains nuggets of wisdom that aren't anywhere in > official documentation. (It also contains a lot of bad answers, but > still…) > - I've heard it said on more than one occasion that xyz docstring is > out of date. > - This is one of the few communities where you can go back to 2008 and > read a transcript of a conversation between Chouser and Rich about why > map destructuring is the way it is. Some of these conversations hold > some deep wisdom about Why Things Are The Way They Are. > - This list contains truckloads of information that could be organized > for more efficient consumption. > - ClojureScript wouldn't be hurt by more documentation. > - Without making this a laundry list I'd just say: Producing and > organizing good documentation is hard labor, but it is also something > that I think benefits the entire community. Moreover, it might give > someone a chance to learn a ton about Clojure over the course of a > summer, and make it easier on everyone who decides to try out Clojure > in the future as a nice side effect. I'd like to suggest we add an > intentionally vague option to "Make Lots of Things Better" and list > some ideas for how one might go about doing that. I'd mentor someone willing to do work on the literate programming version. See http://daly.axiom-developer.org/clojure.pdf http://daly.axiom-developer.org/clojure.pamphlet (src) Even more interesting... It appears that the ePub standard allows embedded javascript. So ideally we would like to manipulate a canvas to show the ideas. For instance, I'd like to see a digital book that had a canvas element that showed the red-black-trie evolve, potentially interactively. Even more interesting... Write the generated javascript for the above ePub demonstration using ClojureScript I'd be willing to mentor any of those. > > > More ideas that might bear interesting and desirable fruit: > - Make an album with Overtone. (Kidding (but only a little bit (not > kidding at all, actually (I bet we'd get some passionate proposals > (and maybe even a record deal ;) I watched the overtone video shortly after finishing both the stanford machine learning course, the signals course and a genetics course. It would be possible to extract features from your favorite songs e.g ( http://www.ams.org/notices/200903/rtx090300356p.pdf ) using FFT signal processing. (signals) Use the overtone feature set to define the possible features. (overtone). It would be possible to rank the features of your favorite songs by listening to each song and constructing a "like" value for each song (e.g. hit the + key multiple times, or use a number to rate the song from 1 to 11 (ala spinal tap). (machine learning) Having ranked the songs, use the learning algorithm to predict the kinds of songs you like based on features. Use overtone to generate new songs with the most popular features (overtone). Use vector crossovers to generate new songs. (genetic programming). Rinse and repeat. Sort of a "sample" without samples :-) > - The sidebar on the left of the GSoC page lists an opening for a > Community Manager Internship. I think a lot of what I'm suggesting > falls under that umbrella. "creating/editing documentation, helping > migrate projects to newer versions of clojure, developing sample > applications such as solutions for the alioth benchmarks, answering > questions on IRC, administering/maintaing clojure.org, clojure.com, > assemble, confluence, mycroft, etc." > > > I guess what I'm saying is, at the end of the day: Let's add > documentation to the list, but also add some other obviously fun > projects and see what kind of proposals we receive. It doesn't mean we > need to accept them, it just shows (IMO) we're very open minded about > people who are passionate about building what /they/ care about, not > necessarily what we care about. If some musician in grad school > submitted a proposal to make an album exclusively with Overtone and > published the source that would be a boon to the Overtone project IMO. > If a sophomore in college wants to build some crazy parallelized Rube > Goldberg machine with Clojure then I think we should at least > entertain the idea of it. More than anything, I think we need to > present the people who *might* do something like that with the face of > a community that would genuinely appreciate it. I've met many of you > personally, so I hardly think that's a stretch for us. > > > This is getting really long so I apologi
[ANN] mcache 0.2.0 released
Last week I released mcache 0.1.0, a protocol-based clojure library for memcached. This latest change contains significant changes, summarized here: 1. Renamed the functions, and got rid of the "cache-" prefix 2. Removed increment and decrement functions from the protocol, as these seemed like gratuitous wrappers. 3. Added a core.cache/CacheProtocol implementation, in addition to the spymemcached client extension. 4. Rearranged namespaces 5. Updated the documentation 6. The library has been uploaded to clojars, hence now can be used from leiningen, etc. Thanks to Jim Crossly for the suggestion to look into CacheProtocol. Also, Jim, I hope you don't mind that I borrowed your naming scheme for the put functions. :-) I'm using this library in my own project, so I expect to continue maintaining and updating it going forward. I hope it proves useful to others. As before, any feedback is greatly appreciated. Thanks, -Dave -- 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
need hint for "A nil key " on 4clojure
"A nil key " http://www.4clojure.com/problem/134 l look it no Elementary.please give me some 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
Re: Bret Victor's live editable game in ClojureScript
Great work Chris but I think you missed exactly the most important point of Victor's talk. It's about being modeless! When you stop the game in order to change the speed you lose the dynamic aspect. In your case it takes ~ 2secs to "recompile & restart" but if you have a game with 10^6 LoC then it may take hours you see the result of the speed and color change! What Victor preaches and what clojure is about is being able change the program while it is running. So what is needed is a speed slider and a color palette somewhere on the bottom of the right screen where you can change the ball speed and color "on the fly" _while_ the ball is moving. This it the next - dynamic - dimension Cheers! Bost On Feb 27, 9:14 pm, Chris Granger wrote: > Hey folks, > > In reference to the previous thread on "Inventing On Principle", I > built a ClojureScript example of his live editable game :) > > http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/ > > Enjoy! > > Cheers, > Chris. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Call static java method specified at runtime
I have a java class with several static methods: package org.domain.test; public class My { static public void sBar(String x, String y) { System.out.println("sBar "+x+":"+y); } static public void sBaz(String x, String y) { System.out.println("sBaz "+x+":"+y); } } I'd like to execute these methods from clojure. The concrete method will be specified at runtime. test.clj: (ns test) (:import org.domain.test.My) ; this is what I need but it does not work: (defn foo [f x y] (. org.domain.test.My sBar x y) ;hard coded call of the java static method sBar ;(. org.domain.test.My f x y)) ;compiler error ;(map #(. org.domain.test.My % x y) [f]) ;compiler error ;(apply (. org.domain.test.My f x y));compiler error ;(. org.domain.test.My #(f) x y) ;compiler error ) ; this works but it's ugly: (defn bar [f x y] (let [s (str "(. org.domain.test.My " f " " ; method sBar or sBaz "\"" x "\" " ; String x "\"" y "\")")] ; String y (load-string s))) ; the actual call on the REPL is quite ugly and (I believe) also quite inefficient and error-prone: (bar "sBaz" "aaa" "bbb") Do you know how to write the foo function without using load-string? Thx in advance! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Bret Victor's live editable game in ClojureScript
Hey Laurent here in Germany we have a soviet-style censorship worse than during the cold war. Youtube says: Unfortunately, this video is not available in Germany because it may contain music for which GEMA has not granted the respective music rights. Sorry about that. (And I can't use web proxy from the computer I'm sitting at :( On Feb 28, 5:35 pm, Laurent PETIT wrote: > 2012/2/27 Chris Granger > > > Hey folks, > > > In reference to the previous thread on "Inventing On Principle", I > > built a ClojureScript example of his live editable game :) > > >http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/ > > Sorry Chris, I tried acting on this video, but I couldn't make the > characters climb higher than > initially:http://www.youtube.com/watch?v=nl5gluGjFis;-) -- 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
Cake with TextMate & RVM
Hi, I'm trying to get Cake to work with TextMate. I've installed both the TextMate bundle and Cake, but when trying to evaluate a script: (print (+2 2)) -^ Ctrl-X I get "env: cake: No such file or directory" I'm using RVM, so have spent some time studying this thread that discusses the error: http://groups.google.com/group/textmate-clojure/browse_thread/thread/7d42a13f50c98fdd ... and my take-away from it is that one needs to have clojure-contrib installed (which I have, via Homebrew), then create a project folder with 'cake new' and declare clojure-contrib as a dependency. I've tried this: (defproject foo "0.0.1-SNAPSHOT" :description "TODO: add summary of your project" :dependencies [[clojure "1.2.1", clojure-contrib "1.2.0"]]) (println(+ 1 2 3)) but still get the error. My .bash_profile contains the following: export CLASSPATH=$CLASSPATH:/usr/local/Cellar/clojure-contrib/1.2.0/ clojure-contrib.jar What am I doing wrong? Thanks beforehand, James -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Google Summer of Code 2012 - any mentors?
Another two ideas were added :) (Native Clojure and Code optimizer). Hoping readers will not mind for putting myself as mentor on one of them, but if there are better candidates, feel free to take it :) I did a little bit gcj + Clojure playing and I'm eager to see native Clojure without jvm. Although I did some exploring on possible optimization techniques, I'm leaving mentor section on Optimizer empty as there are probably more experienced colleagues in this field. Regards, Sanel On Feb 26, 6:19 pm, David Nolen wrote: > http://dev.clojure.org/display/community/Google+Summer+of+Code+2012 > > Please submit more project ideas :) > > David > > On Sun, Feb 26, 2012 at 6:15 AM, Alexander Yakushev > > > > > > > > wrote: > > So the application submiting procedure for organizations starts > > tomorrow but sadly there isn't any word about it at least on > > Confluence. There are willing mentors on the clojure-dev list and > > ideas to submit but as far as I understood from the GSOC site an > > organization must apply to host all these project ideas and > > subsequently assign mentors. > > > Here's how a mentoring organization should apply (may save some time): > > >http://www.google-melange.com/gsoc/document/show/gsoc_program/google/... > > . > > Here's an example of the idea list for GSOC: > >http://community.kde.org/GSoC/2011/Ideas > > > Hopefully we will see Clojure as a mentoring organization for the > > Clojure itself and third-party projects too. As you can see, there are > > students who would like to jump in the development and Clojure > > community could make use of them. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: need hint for "A nil key " on 4clojure
So, you need to give it a function which takes an key and a collection. (fn [k coll] ...) It should return true if two things are true. That the collection _contains_ the key, and the key is _nil_ Enjoy! /Kevin On Wed, Feb 29, 2012 at 7:15 AM, weiyongq wrote: > "A nil key " > http://www.4clojure.com/problem/134 > l look it no Elementary.please give me some 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 post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] mcache 0.2.0 released
Hi Dave, This is awesome! :) DHM writes: [...] > Thanks to Jim Crossly for the suggestion to look into CacheProtocol. > Also, Jim, I hope you don't mind that I borrowed your naming scheme > for the put functions. :-) Not at all. I love that within a coupla weeks we've introduced two distributed implementations of CacheProtocol. Great work! Jim -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] mcache 0.2.0 released
> 3. Added a core.cache/CacheProtocol implementation This is great news. Thank you for taking the time to do this. I would love to know how core.cache helped and hindered 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
Re: Call static java method specified at runtime
On Tue, Feb 28, 2012 at 10:40 AM, Bost wrote: > I have a java class with several static methods: > > package org.domain.test; > > public class My { > static public void sBar(String x, String y) > { System.out.println("sBar "+x+":"+y); } > static public void sBaz(String x, String y) > { System.out.println("sBaz "+x+":"+y); } > } > > I'd like to execute these methods from clojure. The concrete method > will be specified at runtime. > > test.clj: > (ns test) > (:import org.domain.test.My) > > ; this is what I need but it does not work: > (defn foo [f x y] > (. org.domain.test.My sBar x y) ;hard coded call of the > java static method sBar > ;(. org.domain.test.My f x y)) ;compiler error > ;(map #(. org.domain.test.My % x y) [f]) ;compiler error > ;(apply (. org.domain.test.My f x y)) ;compiler error > ;(. org.domain.test.My #(f) x y) ;compiler error > ) Static calls compile down to an "invokeStatic" at the bytecode level, which means you need the details available at compile time. That makes your only options "eval" or reflection. If you don't mind using undocumented implementation details, clojure has some nice reflection facilities included: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Reflector.java#L205 eval: (defn invoke-static [class f & args] (eval `(. ~class ~f ~@args))) (invoke-static org.domain.test.My 'sBar x y) Reflection: (clojure.lang.Reflector/invokeStatic org.domain.test.My "sBar" (into-array Object [x y])) --Aaron -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: need hint for "A nil key " on 4clojure
Most 4clojure exercises are meant for you to familiarize yourself with the clojure standard library. Usually you'll spend more time looking for the appropriate function on clojuredocs than actually coding the solution. Here's the section on collections: http://clojuredocs.org/quickref/Clojure%20Core#Collections+-+Sequences Roman. 2012/2/29 Kevin Ilchmann Jørgensen > So, you need to give it a function which takes an key and a collection. > > (fn [k coll] ...) > > It should return true if two things are true. That the collection > _contains_ the key, and the key is _nil_ > > Enjoy! > > /Kevin > > > On Wed, Feb 29, 2012 at 7:15 AM, weiyongq wrote: > > "A nil key " > > http://www.4clojure.com/problem/134 > > l look it no Elementary.please give me some 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 post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: cld 0.1.0 - Clojure Language Detection
On Tuesday, February 28, 2012 6:03:26 PM UTC-7, Robin Kraft wrote: > > Awesome! I'm seeing some inconsistency though. Does anyone know why a > Bayesian classifier would produce such different results? Could it be > because of the short input text? > > (lang/detect "My name is joe") > ["af" {"af" "0.8571390166207665", "lt" "0.14285675907555712"}] > > (lang/detect "My name is joe") > ["af" {"af" "0.857138268895934", "fi" "0.14285706394982348"}] > > (lang/detect "My name is joe") > ["af" {"af" "0.7142834459768219", "hr" "0.14285657945126254", "lt" > "0.14285645678764042"}] > Yes, language-detect does a fuzzy matching-letter-frequency-count (the non-scientific name for it) sort of algorithm in an attempt to quickly determine the language, so for shorter text, it has a higher chance of being incorrect (because there is less letter frequency to analyze). Give it a try with a longer input string. Additionally, you could adjust the :smoothing option for the string, or pass in a map of probabilities in as a :prior-map to coerce it one way or the other manually. - Lee -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: cld 0.1.0 - Clojure Language Detection
On 29 February 2012 17:48, Lee Hinman wrote: > On Tuesday, February 28, 2012 6:03:26 PM UTC-7, Robin Kraft wrote: >> >> Awesome! I'm seeing some inconsistency though. Does anyone know why a >> Bayesian classifier would produce such different results? Could it be >> because of the short input text? >> >> (lang/detect "My name is joe") >> ["af" {"af" "0.8571390166207665", "lt" "0.14285675907555712"}] As an aside, the above is indeed almost valid Afrikaans :) and would translate to "My names are joe". -- Michael Wood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: cld 0.1.0 - Clojure Language Detection
I'm more curious about why the output isn't even deterministic. The same input string produced three different results. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Google Summer of Code 2012 - any mentors?
Core has not submitted the application. The application process just opened Monday and goes until March 9th. There have been some leaders among Clojure/dev that have stepped up to organize things. Keep watching http://dev.clojure.org/display/community/Google+Summer+of+Code+2012 for more details. I said I would be more than happy to put my name on something that needs a single point of communication and submit the application if that's what's necessary. But honestly, with the community rallying behind this, I think things are moving along just fine. Having the community push this effort is more beneficial than having Core do it, except in the case that there is some part that is dependent on having an official organization like Core. On Wednesday, February 29, 2012 7:02:58 AM UTC-5, Alexander Yakushev wrote: > > Can someone confirm that Clojure/core has already sent an application GSoC > participation? I am just wondering if core is already interested in this > kind of event or the initiative currently comes only from mentors. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: cld 0.1.0 - Clojure Language Detection
> I'm more curious about why the output isn't even deterministic. The > same input string produced three different results. You can see in the FAQ (http://code.google.com/p/language-detection/wiki/FrequentlyAskedQuestion) that: "Langdetect uses random sampling for avoiding local noises(person name, place name and so on), so the language detections of the same document might differ for every time." U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
[ANN] fobos_clj 0.0.2 and TinyWordSegmenter 0.0.5
Hi all, I'm pleased to announce the 0.0.2 release of fobos_clj (Supervised machine learning classifier called 'FOBOS')[1]. You can use support vector machine or logistic regression with this library. The learned model file is quite small, so you can use this library in your own application. Using this library, I also implemented my word segmentation library 'TinyWordSegmenter'[2]. I attached the model file for Japanese word segmentation, but you can train your own model for Chinese or Korean. thanks, Yasuhisa Yoshida [1]: https://github.com/syou6162/fobos_clj [2]: https://github.com/TrainingCamp2012/TinyWordSegmenter -- 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
Specifying the error message on validation-error of a dynamic var?
Is there any way to specify the error message when using set- validator! with a dynamic var? In a situation like this: (binding [*my-var* -1] (foo)) I'd like to be able to throw a custom exception when they try to bind to a negative number. Using set-validator! like this, the Exception message is ignored: (set-validator! #'*d* (fn [x] (if (< x 4) (throw (Exception. "*my-var* can only be bound to a non-negative number")) true))) Instead the message you see at the REPL is: java.lang.IllegalStateException: Invalid reference state (NO_SOURCE_FILE:0) Is there a way to specify the error message on validation-error of a dynamic var? Thanks, Alex -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Question about this little method I wrote
There's contrib library that you might find interesting: https://github.com/clojure/math.combinatorics -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Specifying the error message on validation-error of a dynamic var?
TimMc on IRC helped me find this line in the source: https://github.com/clojure/clojure/blob/1.3.x/src/jvm/clojure/lang/ARef.java#L29 If I change my validator to throw a RuntimeException, then I get the behavior I want. Thanks Tim! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Cake with TextMate & RVM
Maybe it is that you haven't included the directory where the cake executable is in the text mate PATH. For instance, my PATH is defined as: /Users/jmgimeno/Local/cake/bin:/usr/bin because my cake executable is in /Users/jmgimeno/Local/cake and textmate needs /usr/bin for other things. To change it you can go to Texmate -> Preferences -> Advanced and select the Shell Variables tab. Hope this helps, Juan Manuel PS: FWIW the clojure bundle no longer needs contrib. El miércoles 29 de febrero de 2012 14:30:00 UTC+1, James escribió: > > Hi, I'm trying to get Cake to work with TextMate. I've installed both > the TextMate bundle and Cake, but when trying to evaluate a script: > > (print (+2 2)) > > -^ Ctrl-X > > I get "env: cake: No such file or directory" > > I'm using RVM, so have spent some time studying this thread that > discusses the error: > > > http://groups.google.com/group/textmate-clojure/browse_thread/thread/7d42a13f50c98fdd > > > ... and my take-away from it is that one needs to have clojure-contrib > installed (which I have, via Homebrew), then create a project folder > with 'cake new' and declare clojure-contrib as a dependency. I've > tried this: > > (defproject foo "0.0.1-SNAPSHOT" > :description "TODO: add summary of your project" > :dependencies [[clojure "1.2.1", clojure-contrib "1.2.0"]]) > > (println(+ 1 2 3)) > > but still get the error. My .bash_profile contains the following: > > export CLASSPATH=$CLASSPATH:/usr/local/Cellar/clojure-contrib/1.2.0/ > clojure-contrib.jar > > What am I doing wrong? > > Thanks beforehand, > James > > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Question about this little method I wrote
A similar version: (defn combinations [[x & xs]] (if xs (for [e x c (combinations xs)] (cons e c)) (map list x))) Juan Manuel El lunes 27 de febrero de 2012 15:23:30 UTC+1, Bill Caputo escribió: > > Here's a version that uses destructuring (but is otherwise the same) that > cleans it up a bit: > (defn combinations [[x & xs]] > (if xs > (for [frstitems x tlitm (combinations xs)] > (flatten (list frstitems tlitm))) > x)) > > On Feb 26, 2012, at 9:45 PM, Mike Ledoux wrote: > > > (defn combinations [items] > > (if (== (count items) 1) > > (flatten items) > > (for [frstitems (flatten (first items)) > > tlitm (combinations (rest items))] > > (flatten (list frstitems tlitm) > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] mcache 0.2.0 released
On Wednesday, February 29, 2012 6:03:32 AM UTC-8, Fogus wrote: > > > 3. Added a core.cache/CacheProtocol implementation > > This is great news. Thank you for taking the time to do this. I > would love to know how core.cache helped and hindered you. > I'd say integrating with CacheProtocol helped a lot, in that it led to a better understanding and appreciation of Clojure protocols, and caused me to think more carefully about what the mcache library's design goals should be. The lack of documentation and examples was a bit of a hindrance, as initially I had to spend some time just figuring out what core.cache does. I understand that these are in the works, however. On Wednesday, February 29, 2012 6:03:32 AM UTC-8, Fogus wrote: > > > 3. Added a core.cache/CacheProtocol implementation > > This is great news. Thank you for taking the time to do this. I > would love to know how core.cache helped and hindered 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
checking if a method is defined
Hi, The behaviour of resolve for named functions seems pretty clear to me: (resolve 'xyz) returns nil (when xyz has not been defined). and (defn xyz [x] 1) (resolve 'xyz) returns #'user/xyz (when xyz is defined) However if I try to define types: (defprotocol Named (fullName [Named])) (deftype Person [firstName lastName favoriteColor] Named (fullName [_] (str firstName " " lastName))) Why do the following return nil? (resolve '.fullName) or (resolve '.firstName) What should I be using to check that the symbol .firstName and .fullName are defined in the current scope? (I am trying to write compile-time code the filters/selects undefined symbols from a chunk of quoted code. I'd like this to work for both function symbols and method symbols.) I'm using clojure 1.3 Thanks, Frank -- 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
for behavior difference between clojure and clojurescript?
Hello, when I was trying to port a little clojure app to clojurescript I think I noticed a difference in behavior of the "for" macro. I am quite new to clojure and maybe you can tell me where my problem is or if my assumptions that there might be a problem could be correct. As far as I see it, the "for" macro works for clojurescript quite well but I am not sure if it is "supported". I am using a two dimensional "for" with a ":when" condition. I already tried to narrow the problem down but this was the closest I could get so far. It seems like some elements are missing in the output. (for [a [0 1] b [0 1] :when (not (= 0 a b))] [a b]) In clojurescript seems to result in: [[1 0] [1 1]] Wrapping to doall doesn't change a thing, but could lazyness be a problem? I put together a little project you could check out, please have a look: https://github.com/dedeibel/cljs-fortest Thank you, -- Benjamin Peter https://myminutes.wordpress.com/ http://twitter.com/BenjaminPtr -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojure in Python
Not sure how many people have seen this, looks interesting though: https://github.com/halgari/clojure-py -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: for behavior difference between clojure and clojurescript?
Hi, You should be using == for comparison between numbers. (for [a [0 1] b [0 1] :when (not (== 0 a b))] [a b]) has the same results between clojure and clojurescript. Cheers, Jordan On Wed, Feb 29, 2012 at 5:36 PM, Benjamin Peter wrote: > Hello, > > when I was trying to port a little clojure app to clojurescript I > think I noticed a difference in behavior of the "for" macro. > > I am quite new to clojure and maybe you can tell me where my problem > is or if my assumptions that there might be a problem could be > correct. > > As far as I see it, the "for" macro works for clojurescript quite well > but I am not sure if it is "supported". > > I am using a two dimensional "for" with a ":when" condition. I already > tried to narrow the problem down but this was the closest I could get > so far. It seems like some elements are missing in the output. > > (for [a [0 1] b [0 1] > :when (not (= 0 a b))] > [a b]) > > In clojurescript seems to result in: > > [[1 0] [1 1]] > > Wrapping to doall doesn't change a thing, but could lazyness be a > problem? > > I put together a little project you could check out, please have a > look: > > https://github.com/dedeibel/cljs-fortest > > > Thank you, > > -- > > Benjamin Peter > https://myminutes.wordpress.com/ > http://twitter.com/BenjaminPtr > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: for behavior difference between clojure and clojurescript?
On Feb 29, 2:36 pm, Benjamin Peter wrote: > Hello, > > when I was trying to port a little clojure app to clojurescript I > think I noticed a difference in behavior of the "for" macro. > > I am quite new to clojure and maybe you can tell me where my problem > is or if my assumptions that there might be a problem could be > correct. > > As far as I see it, the "for" macro works for clojurescript quite well > but I am not sure if it is "supported". > > I am using a two dimensional "for" with a ":when" condition. I already > tried to narrow the problem down but this was the closest I could get > so far. It seems like some elements are missing in the output. > > (for [a [0 1] b [0 1] > :when (not (= 0 a b))] > [a b]) > > In clojurescript seems to result in: > > [[1 0] [1 1]] > > Wrapping to doall doesn't change a thing, but could lazyness be a > problem? > > I put together a little project you could check out, please have a > look: > > https://github.com/dedeibel/cljs-fortest Isn't this a special case of cljs not having the right equality semantics for multiple args? I don't have a clojurescript repl handy, but I remember reading it only looks at the first two args, so (= 0 0 1) returns true, keeping that one out of your results. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: for behavior difference between clojure and clojurescript?
i had a cljs repl up and running...here's the comparison and the emitted JS ClojureScript:cljs.user> (= 0 0 0) true ; js => cljs.core._EQ_.call(null,0,0,0); ClojureScript:cljs.user> (= 0 0 1) true ; js => cljs.core._EQ_.call(null,0,0,1); ClojureScript:cljs.user> (== 0 0 1) false ; js => (function (){var and__3546__auto4873 = (0 === 0); if(cljs.core.truth_(and__3546__auto4873)) {return (0 === 1); } else {return and__3546__auto4873; } })(); ClojureScript:cljs.user> (== 0 0 0) true ; js => (function (){var and__3546__auto4879 = (0 === 0); if(cljs.core.truth_(and__3546__auto4879)) {return (0 === 0); } else {return and__3546__auto4879; } })(); So...looks like it's just = vs == (or even ===) Neale {t: @sw1nn, w: sw1nn.com} On Wed, Feb 29, 2012 at 11:26 PM, Alan Malloy wrote: > > On Feb 29, 2:36 pm, Benjamin Peter wrote: > > Hello, > > > > when I was trying to port a little clojure app to clojurescript I > > think I noticed a difference in behavior of the "for" macro. > > > > I am quite new to clojure and maybe you can tell me where my problem > > is or if my assumptions that there might be a problem could be > > correct. > > > > As far as I see it, the "for" macro works for clojurescript quite well > > but I am not sure if it is "supported". > > > > I am using a two dimensional "for" with a ":when" condition. I already > > tried to narrow the problem down but this was the closest I could get > > so far. It seems like some elements are missing in the output. > > > > (for [a [0 1] b [0 1] > > :when (not (= 0 a b))] > > [a b]) > > > > In clojurescript seems to result in: > > > > [[1 0] [1 1]] > > > > Wrapping to doall doesn't change a thing, but could lazyness be a > > problem? > > > > I put together a little project you could check out, please have a > > look: > > > > https://github.com/dedeibel/cljs-fortest > > Isn't this a special case of cljs not having the right equality > semantics for multiple args? I don't have a clojurescript repl handy, > but I remember reading it only looks at the first two args, so (= 0 0 > 1) returns true, keeping that one out of your results. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Python
> Not sure how many people have seen this, looks interesting though: > > https://github.com/halgari/clojure-py The core.clj file is probably the best way to get an idea of how clojure-py differs and is similar to clojure: https://github.com/halgari/clojure-py/blob/master/clojure/core.clj Currently we have about half of core.clj ported from JVM clojure to python clojure. Timothy (halgari) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Python
On Wed, Feb 29, 2012 at 3:42 PM, Timothy Baldridge wrote: > The core.clj file is probably the best way to get an idea of how > clojure-py differs and is similar to clojure: > https://github.com/halgari/clojure-py/blob/master/clojure/core.clj > > Currently we have about half of core.clj ported from JVM clojure to > python clojure. How is performance looking so far? I see some commits with notes about large relative improvements but I didn't see any benchmarks against JVM or other Clojure implementations... I would imagine startup time is pretty good? -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Python
> Currently we have about half of core.clj ported from JVM clojure to > python clojure. I know it's early, but have there been any thoughts/plans around interop and dependency management, possibly providing some sort of bridge between lein and pip/easy_install/virtualenv? And is performance the main drive here? On Wed, Feb 29, 2012 at 6:42 PM, Timothy Baldridge wrote: >> Not sure how many people have seen this, looks interesting though: >> >> https://github.com/halgari/clojure-py > > The core.clj file is probably the best way to get an idea of how > clojure-py differs and is similar to clojure: > https://github.com/halgari/clojure-py/blob/master/clojure/core.clj > > Currently we have about half of core.clj ported from JVM clojure to > python clojure. > > Timothy (halgari) > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Python
>>How is performance looking so far? On CPython...well about as good as CPython is comared to Java. On PyPy however, we're pretty close to Clojure. Currently on a factorial example, clojure-jvm runs in about 15 sec. On clojure-py it's about 24 sec. But there's always room for more optimization. > I know it's early, but have there been any thoughts/plans around > interop and dependency management, possibly providing some sort of > bridge between lein and pip/easy_install/virtualenv? And is > performance the main drive here? Well first of all, the real main drive, is that I don't know Java libs nearly as well as Python libs. Secondly, there's a lot of cruft (imo) in Clojure that doesn't need to exist in a dynamic VM. For instance, there's no reason to new up something with (Foo. 1 2). In python objects are functions, so (Foo 1 2) works just fine. We have an alpha version of a shim built for integrating clojure with python. So in a python program you can do this; import clojure import examples.factorial # where examples/factorial.clj exists somewhere in the search path Clojure-py functions are python functions, and deftypes are classes, so interop is actually really good so far. Timothy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: for behavior difference between clojure and clojurescript?
Yes it's a known issue. Right now, = only works for two args. For the time being this is for performance reasons, a decent = is critical. The way ClojureScript currently handles multiple arity fns is quite unfortunate from a performance perspective - it uses the JavaScript arguments object. This results in an order of magnitude slow down for function calls on V8 as well as JavaScriptCore. I think we need to resolve this first before fixing =. There's already an open ticket in JIRA for both issues. David On Wed, Feb 29, 2012 at 6:26 PM, Alan Malloy wrote: > On Feb 29, 2:36 pm, Benjamin Peter wrote: > > Hello, > > > > when I was trying to port a little clojure app to clojurescript I > > think I noticed a difference in behavior of the "for" macro. > > > > I am quite new to clojure and maybe you can tell me where my problem > > is or if my assumptions that there might be a problem could be > > correct. > > > > As far as I see it, the "for" macro works for clojurescript quite well > > but I am not sure if it is "supported". > > > > I am using a two dimensional "for" with a ":when" condition. I already > > tried to narrow the problem down but this was the closest I could get > > so far. It seems like some elements are missing in the output. > > > > (for [a [0 1] b [0 1] > > :when (not (= 0 a b))] > > [a b]) > > > > In clojurescript seems to result in: > > > > [[1 0] [1 1]] > > > > Wrapping to doall doesn't change a thing, but could lazyness be a > > problem? > > > > I put together a little project you could check out, please have a > > look: > > > > https://github.com/dedeibel/cljs-fortest > > Isn't this a special case of cljs not having the right equality > semantics for multiple args? I don't have a clojurescript repl handy, > but I remember reading it only looks at the first two args, so (= 0 0 > 1) returns true, keeping that one out of your results. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Bret Victor's live editable game in ClojureScript
Hi Bost, I think you may have actually missed the point in the video :) There's no pausing necessary - if I made the guy move on his own and changed his speed, you'd see it happen immediately. No modes here, aside from the projection exist. Likewise the only thing that gets recompiled is the code in the current scope, so it doesn't matter how large your project may be. Based on what I've heard so far, my implementation is actually more real than what Victor himself created and does everything except for the slider/color-picker in his demo. Cheers, Chris. On Feb 28, 8:13 am, Bost wrote: > Great work Chris but I think you missed exactly the most important > point of Victor's talk. > It's about being modeless! > > When you stop the game in order to change the speed you lose the > dynamic aspect. > In your case it takes ~ 2secs to "recompile & restart" but if you have > a game with 10^6 LoC then it may take hours you see the result of the > speed and color change! > > What Victor preaches and what clojure is about is being able change > the program while it is running. > So what is needed is a speed slider and a color palette somewhere on > the bottom of the right screen where you can change the ball speed and > color "on the fly" _while_ the ball is moving. > This it the next - dynamic - dimension > > Cheers! > > Bost > > On Feb 27, 9:14 pm, Chris Granger wrote: > > > > > > > > > Hey folks, > > > In reference to the previous thread on "Inventing On Principle", I > > built a ClojureScript example of his live editable game :) > > >http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/ > > > Enjoy! > > > Cheers, > > Chris. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojure 3.1 and Contrib(s)
Hello, I have clojure 1.2 and eclipse, with contrib, running together, but I don't understand how clojure 1.3 and eclipse integrate with the contributions. It seems like it's simplily a matter of getting a contrib from github and what? running it through lein and using the jar file? adding the source to the project source? Normally with a java project I would just compile the library and add it to the eclipse class path, but that does not seem to work. Can anyone point me to an explanation on how to add a contrib to a project when using eclipse? thanks, Lawrence -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit
I'm having the same issue on OSX with leiningen. Unfortunately, it appears the cake project has been taken down so I cannot use it to resolve the tools.jar problem. http://releases.clojure-cake.org/cake gives a 404 The error I'm getting when I do (use 'swank.cdt) can be seen here http://pastebin.com/Qr1usmDa On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: > > I am using maven directly to work with clojure and I had the problem > with the tools.jar, too. I resolved it by adding the following block > to my pom.xml: > > > > default-tools.jar > > > java.vendor > Sun Microsystems Inc. > > > > > com.sun > tools > 1.6.0 > system > ${java.home}/../lib/tools.jar > > > > > > After that it is still complaining: "warning: unabled to add tools.jar > to classpath. This may cause CDT initialization to fail." > But this does not seem to cause a problem. > > Just wanted to share this bit of information with you, > Christian On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: > > I am using maven directly to work with clojure and I had the problem > with the tools.jar, too. I resolved it by adding the following block > to my pom.xml: > > > > default-tools.jar > > > java.vendor > Sun Microsystems Inc. > > > > > com.sun > tools > 1.6.0 > system > ${java.home}/../lib/tools.jar > > > > > > After that it is still complaining: "warning: unabled to add tools.jar > to classpath. This may cause CDT initialization to fail." > But this does not seem to cause a problem. > > Just wanted to share this bit of information with you, > Christian On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: > > I am using maven directly to work with clojure and I had the problem > with the tools.jar, too. I resolved it by adding the following block > to my pom.xml: > > > > default-tools.jar > > > java.vendor > Sun Microsystems Inc. > > > > > com.sun > tools > 1.6.0 > system > ${java.home}/../lib/tools.jar > > > > > > After that it is still complaining: "warning: unabled to add tools.jar > to classpath. This may cause CDT initialization to fail." > But this does not seem to cause a problem. > > Just wanted to share this bit of information with you, > Christian On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: > > I am using maven directly to work with clojure and I had the problem > with the tools.jar, too. I resolved it by adding the following block > to my pom.xml: > > > > default-tools.jar > > > java.vendor > Sun Microsystems Inc. > > > > > com.sun > tools > 1.6.0 > system > ${java.home}/../lib/tools.jar > > > > > > After that it is still complaining: "warning: unabled to add tools.jar > to classpath. This may cause CDT initialization to fail." > But this does not seem to cause a problem. > > Just wanted to share this bit of information with you, > Christian On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: > > I am using maven directly to work with clojure and I had the problem > with the tools.jar, too. I resolved it by adding the following block > to my pom.xml: > > > > default-tools.jar > > > java.vendor > Sun Microsystems Inc. > > > > > com.sun > tools > 1.6.0 > system > ${java.home}/../lib/tools.jar > > > > > > After that it is still complaining: "warning: unabled to add tools.jar > to classpath. This may cause CDT initialization to fail." > But this does not seem to cause a problem. > > Just wanted to share this bit of information with you, > Christian On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: > > I am using maven directly to work with clojure and I had the problem > with the tools.jar, too. I resolved it by adding the following block > to my pom.xml: > > > > default-tools.jar > > > java.vendor > Sun Microsystems Inc. > > > > > com.sun > tools > 1.6.0 > system > ${java.home}/../lib/tools.jar > > > > > > After
Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit
I'm sorry, the context of the message was not included. It's a reply to a thread in April 2011. I have converted to Emacs and am using swank! Hooray! Now, I want to use swank-cdt but I have this problem. After installing swank-clojure 1.4.0 with lein, I run (use 'swank.cdt) in a repl and I get this error: http://pastebin.com/Qr1usmDa (Ignore line 1 about cake. I don't know how that got there.) If you search the mailing list for errors with core/swank-worker-thread-name It's basically recommended to switch to cake over leiningen but cake doesn't work anymore :( This is because OSX does not have tools.jar. Instead it has classes.jar. This has something to do with running the JRE instead of the JDK. Is there anything I can do on OSX Lion to resolve this issue? Thank you for your time & please excuse my sending this twice. I wanted to provide some context. On Wed, Feb 29, 2012 at 6:00 PM, sean neilan wrote: > I'm having the same issue on OSX with leiningen. > > Unfortunately, it appears the cake project has been taken down so I cannot > use it to resolve the tools.jar problem. > > http://releases.clojure-cake.org/cake gives a 404 > > The error I'm getting when I do (use 'swank.cdt) can be seen here > > http://pastebin.com/Qr1usmDa > On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: >> >> I am using maven directly to work with clojure and I had the problem >> with the tools.jar, too. I resolved it by adding the following block >> to my pom.xml: >> >> >> >> default-tools.jar >> >> >> java.vendor >> Sun Microsystems Inc. >> >> >> >> >> com.sun >> tools >> 1.6.0 >> system >> ${java.home}/../**lib/tools.jar >> >> >> >> >> >> After that it is still complaining: "warning: unabled to add tools.jar >> to classpath. This may cause CDT initialization to fail." >> But this does not seem to cause a problem. >> >> Just wanted to share this bit of information with you, >> Christian > > > On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: >> >> I am using maven directly to work with clojure and I had the problem >> with the tools.jar, too. I resolved it by adding the following block >> to my pom.xml: >> >> >> >> default-tools.jar >> >> >> java.vendor >> Sun Microsystems Inc. >> >> >> >> >> com.sun >> tools >> 1.6.0 >> system >> ${java.home}/../**lib/tools.jar >> >> >> >> >> >> After that it is still complaining: "warning: unabled to add tools.jar >> to classpath. This may cause CDT initialization to fail." >> But this does not seem to cause a problem. >> >> Just wanted to share this bit of information with you, >> Christian > > > On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: >> >> I am using maven directly to work with clojure and I had the problem >> with the tools.jar, too. I resolved it by adding the following block >> to my pom.xml: >> >> >> >> default-tools.jar >> >> >> java.vendor >> Sun Microsystems Inc. >> >> >> >> >> com.sun >> tools >> 1.6.0 >> system >> ${java.home}/../**lib/tools.jar >> >> >> >> >> >> After that it is still complaining: "warning: unabled to add tools.jar >> to classpath. This may cause CDT initialization to fail." >> But this does not seem to cause a problem. >> >> Just wanted to share this bit of information with you, >> Christian > > > On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: >> >> I am using maven directly to work with clojure and I had the problem >> with the tools.jar, too. I resolved it by adding the following block >> to my pom.xml: >> >> >> >> default-tools.jar >> >> >> java.vendor >> Sun Microsystems Inc. >> >> >> >> >> com.sun >> tools >> 1.6.0 >> system >> ${java.home}/../**lib/tools.jar >> >> >> >> >> >> After that it is still complaining: "warning: unabled to add tools.jar >> to classpath. This may cause CDT initialization to fail." >> But this does not seem to cause a problem. >> >> Just wanted to share this bit of information with you, >> Christian > > > On Saturday, April 30, 2011 4:59:55 AM UTC-5, Christian Schuhegger wrote: >> >> I am using maven directly to work with clojure and I had the problem >> with the tools.jar, too. I resolved it by adding the following block >> to my pom.xml: >> >> >> >> default-tools.jar >> >> >> java.vendor >> Sun Microsystems Inc. >> >> >> >>
Re: Clojure 3.1 and Contrib(s)
Using eclipse to edit files is OK but *don't use it manage your dependencies in Clojure.* You should use leiningen to manage additions to your project. After starting a project with lein new projectName you can edit the project.clj file in the folder that is created. You'll see something like this (defproject projectName "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.2.1"]]) To add libraries to the project, add values to the vector under dependencies such that each new library is in [] brackets and has [library-name "version"] So for instance, to add debug-repl (defproject projectName "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.2.1"] [org.clojars.gjahad/debug-repl "0.3.1"] ; library-name in this case is org.clojars.gjahad/debug-repl & version is "0.3.1" ]) To change it to clojure 1.3.0, change the version next to org.clojure/clojure to 1.3.0 (defproject projectName "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.3.0"]]) After changing org.clojure/clojure to 1.3.0, the rules are the same for adding dependencies. Clojure 1.3 doesn't actually use the contributions library anymore. Each contribution is now in it's own library. You can read this for info on what to include for different libraries. http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go On Wed, Feb 29, 2012 at 6:53 PM, Lawrence wrote: > Hello, > > I have clojure 1.2 and eclipse, with contrib, running together, but I > don't understand how clojure 1.3 and eclipse integrate with the > contributions. It seems like it's simplily a matter of getting a > contrib from github and what? running it through lein and using the > jar file? adding the source to the project source? > > Normally with a java project I would just compile the library and add > it to the eclipse class path, but that does not seem to work. > > Can anyone point me to an explanation on how to add a contrib to a > project when using eclipse? > > thanks, Lawrence > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 3.1 and Contrib(s)
You need to include individual jars in your eclipse project dependencies if you want to benefit from the integrated REPL of the ccw eclipse plugin. The next ccw major release will have leiningen and eclipse project class path synchronization using the dependencies listed in your project.clj file if it exists. Meanwhile, synch your project depencencies with lein's dependencies manually. When you create a clojure project using ccw, it will put in it the clojure 1.2 and the monolithic contrib in the project itself and on its classpath. Just remove them from the project classpath and folder, update your project.clj to add the necessary dependencies, run lein deps at the root of the project then update your eclipse project classpath from the lib folder by selecting all the jar files there. Of course if you change dependencies, you will have to resynch them in your eclipse project classpath but in does not occur often in a project lifetime. Sinçe eclipse will complain if a jar file is missing, it's easy to spot the moment when it will get out of synch. Luc > Using eclipse to edit files is OK but *don't use it manage your > dependencies in Clojure.* > > You should use leiningen to manage additions to your project. After > starting a project with > lein new projectName > you can edit the project.clj file in the folder that is created. > > You'll see something like this > (defproject projectName "1.0.0-SNAPSHOT" > :description "FIXME: write description" > :dependencies [[org.clojure/clojure "1.2.1"]]) > > To add libraries to the project, add values to the vector under > dependencies such that each new library is in [] brackets and has > [library-name "version"] > > So for instance, to add debug-repl > (defproject projectName "1.0.0-SNAPSHOT" > :description "FIXME: write description" > :dependencies [[org.clojure/clojure "1.2.1"] > [org.clojars.gjahad/debug-repl "0.3.1"] ; > library-name in this case is org.clojars.gjahad/debug-repl & version is > "0.3.1" > ]) > > To change it to clojure 1.3.0, change the version next to > org.clojure/clojure to 1.3.0 > (defproject projectName "1.0.0-SNAPSHOT" > :description "FIXME: write description" > :dependencies [[org.clojure/clojure "1.3.0"]]) > > After changing org.clojure/clojure to 1.3.0, the rules are the same for > adding dependencies. > > > Clojure 1.3 doesn't actually use the contributions library anymore. Each > contribution is now in it's own library. > You can read this for info on what to include for different libraries. > http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go > > On Wed, Feb 29, 2012 at 6:53 PM, Lawrence wrote: > > > Hello, > > > > I have clojure 1.2 and eclipse, with contrib, running together, but I > > don't understand how clojure 1.3 and eclipse integrate with the > > contributions. It seems like it's simplily a matter of getting a > > contrib from github and what? running it through lein and using the > > jar file? adding the source to the project source? > > > > Normally with a java project I would just compile the library and add > > it to the eclipse class path, but that does not seem to work. > > > > Can anyone point me to an explanation on how to add a contrib to a > > project when using eclipse? > > > > thanks, Lawrence > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Softaddicts sent by ibisMail! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit
I'm on OS X Lion and using: * Emacs 24.0.90 * clojure-mode 1.11.4 * lein 1.6.2 * swank-clojure 1.4.0 as a dev-dependency (and as a global plugin, if it matters) I start the REPL via M-x clojure-jack-in when viewing my project.clj file. When I do (use 'swank.cdt) I see the following: CDT ready Clearing CDT event requests and continuing. Swank CDT release 1.5.0a started nil user> And CDT works fine for me... I do not have tools.jar installed. Sean On Wed, Feb 29, 2012 at 5:05 PM, sean neilan wrote: > I'm sorry, the context of the message was not included. It's a reply to a > thread in April 2011. > > I have converted to Emacs and am using swank! Hooray! > > Now, I want to use swank-cdt but I have this problem. > After installing swank-clojure 1.4.0 with lein, I run (use 'swank.cdt) in a > repl and I get this error: > http://pastebin.com/Qr1usmDa > (Ignore line 1 about cake. I don't know how that got there.) > > If you search the mailing list for errors > with core/swank-worker-thread-name > It's basically recommended to switch to cake over leiningen but cake doesn't > work anymore :( > > This is because OSX does not have tools.jar. Instead it has classes.jar. > This has something to do with running the JRE instead of the JDK. > > Is there anything I can do on OSX Lion to resolve this issue? > > Thank you for your time & please excuse my sending this twice. I wanted to > provide some context. > > On Wed, Feb 29, 2012 at 6:00 PM, sean neilan wrote: >> >> I'm having the same issue on OSX with leiningen. >> >> Unfortunately, it appears the cake project has been taken down so I cannot >> use it to resolve the tools.jar problem. >> >> http://releases.clojure-cake.org/cake gives a 404 >> >> The error I'm getting when I do (use 'swank.cdt) can be seen here >> >> http://pastebin.com/Qr1usmDa -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit
Oh happy day. :) Adding swank-cdt to dev dependencies solved my problem. Thank you very much! Sent from my iPhone On Feb 29, 2012, at 7:50 PM, Sean Corfield wrote: > I'm on OS X Lion and using: > * Emacs 24.0.90 > * clojure-mode 1.11.4 > * lein 1.6.2 > * swank-clojure 1.4.0 as a dev-dependency (and as a global plugin, if > it matters) > > I start the REPL via M-x clojure-jack-in when viewing my project.clj > file. When I do (use 'swank.cdt) I see the following: > > CDT ready > Clearing CDT event requests and continuing. > Swank CDT release 1.5.0a started > nil > user> > > And CDT works fine for me... > > I do not have tools.jar installed. > > Sean > > On Wed, Feb 29, 2012 at 5:05 PM, sean neilan wrote: >> I'm sorry, the context of the message was not included. It's a reply to a >> thread in April 2011. >> >> I have converted to Emacs and am using swank! Hooray! >> >> Now, I want to use swank-cdt but I have this problem. >> After installing swank-clojure 1.4.0 with lein, I run (use 'swank.cdt) in a >> repl and I get this error: >> http://pastebin.com/Qr1usmDa >> (Ignore line 1 about cake. I don't know how that got there.) >> >> If you search the mailing list for errors >> with core/swank-worker-thread-name >> It's basically recommended to switch to cake over leiningen but cake doesn't >> work anymore :( >> >> This is because OSX does not have tools.jar. Instead it has classes.jar. >> This has something to do with running the JRE instead of the JDK. >> >> Is there anything I can do on OSX Lion to resolve this issue? >> >> Thank you for your time & please excuse my sending this twice. I wanted to >> provide some context. >> >> On Wed, Feb 29, 2012 at 6:00 PM, sean neilan wrote: >>> >>> I'm having the same issue on OSX with leiningen. >>> >>> Unfortunately, it appears the cake project has been taken down so I cannot >>> use it to resolve the tools.jar problem. >>> >>> http://releases.clojure-cake.org/cake gives a 404 >>> >>> The error I'm getting when I do (use 'swank.cdt) can be seen here >>> >>> http://pastebin.com/Qr1usmDa > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: checking if a method is defined
On Wed, Feb 29, 2012 at 5:12 PM, Frank Wilson wrote: > Hi, > > The behaviour of resolve for named functions seems pretty clear to me: > > (resolve 'xyz) > > returns nil (when xyz has not been defined). > > and > > (defn xyz [x] 1) > > (resolve 'xyz) > > returns #'user/xyz (when xyz is defined) > > However if I try to define types: > > (defprotocol Named > (fullName [Named])) > > > (deftype Person [firstName lastName favoriteColor] > Named > (fullName [_] (str firstName " " lastName))) > > Why do the following return nil? > > (resolve '.fullName) > > or > > (resolve '.firstName) > > > What should I be using to check that the symbol .firstName and > .fullName are defined in the current scope? > > (I am trying to write compile-time code the filters/selects undefined > symbols from a chunk of quoted code. > I'd like this to work for both function symbols and method symbols.) > > I'm using clojure 1.3 > > Thanks, > > Frank There isn't really any way to check if a method name like .foo is "defined". There may or may not be a Java class (including a deftype, defrecord, definterface, or defprotocol) with a .foo method, and any particular such class may or may not have a .foo method. You can check if a specific class or object has a .foo method though, using reflection. With an object, use (.getClass thingy) to get the class. Given a class, you can probe it using various methods of java.lang.Class to see if it has methods with particular names and/or signatures. -- 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
using contains? on transient collections
Hey everybody, I did the following (contains? (transient {:a 10}) :a) and it returns false while doing (:a (transient {:a 10})) returns 10 Is this expected behaviour. Using clojure-version 1.2.1 (I know it is old .. ) Thanks, Sunil. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: checking if a method is defined
> > What should I be using to check that the symbol .firstName and > .fullName are defined in the current scope? > "fullName" is easier because it gets interned in the current namespace: user=> (ns-interns 'user) {fullName #'user/fullName, ->Person #'user/->Person, Named #'user/Named} user=> (resolve 'fullName) ; no leading dot #'user/fullName For the fields in types you'll need reflection: user=> (use 'clojure.reflect) user=> (pprint (:members (reflect Person))) #{ ... some stuff deleted... {:name firstName, :type java.lang.Object, :declaring-class user.Person, :flags #{:public :final}} {:name lastName, :type java.lang.Object, :declaring-class user.Person, :flags #{:public :final}} ... some other stuff deleted... } -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: using contains? on transient collections
It is the expected behavior for everyone who has ever gotten burned by this bug :) Seriously though, this has come up several times over the last couple of years. I remain baffled that this has never been fixed (at least not as of 1.3). There are two ways this could potentially be fixed. On the one hand, transients could be made to implement more of the interfaces they are expected to implement. On the other hand, contains? could be modified to return a meaningful error rather than false when passed something that doesn't support that interface. Or better yet, both of these fixes would be a good thing. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: checking if a method is defined
Hi, as others said: to check that a protocol function exists you can use resolve as with every other function. If you wanted to know, whether a type participates in a protocol directly, you would check whether it implements the protocol's interface . user=> (defprotocol Foo (foo [this])) Foo user=> (defrecord Bar [] Foo (foo [this] :foobar)) user.Bar user=> (instance? user.Foo (Bar.)) true If you wanted to know whether the protocol is extended to this type in general you would use satisfies?. Sincerely Meikel Am Mittwoch, 29. Februar 2012 23:12:48 UTC+1 schrieb Frank: > > Hi, > > The behaviour of resolve for named functions seems pretty clear to me: > > (resolve 'xyz) > > returns nil (when xyz has not been defined). > > and > > (defn xyz [x] 1) > > (resolve 'xyz) > > returns #'user/xyz (when xyz is defined) > > However if I try to define types: > > (defprotocol Named > (fullName [Named])) > > > (deftype Person [firstName lastName favoriteColor] > Named > (fullName [_] (str firstName " " lastName))) > > Why do the following return nil? > > (resolve '.fullName) > > or > > (resolve '.firstName) > > > What should I be using to check that the symbol .firstName and > .fullName are defined in the current scope? > > (I am trying to write compile-time code the filters/selects undefined > symbols from a chunk of quoted code. > I'd like this to work for both function symbols and method symbols.) > > I'm using clojure 1.3 > > Thanks, > > Frank > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: using contains? on transient collections
Some related JIRA tickets, http://dev.clojure.org/jira/browse/CLJ-700 http://dev.clojure.org/jira/browse/CLJ-757 http://dev.clojure.org/jira/browse/CLJ-932 All have patches, although I don't personally know whether they are correct fixes. Andy On Feb 29, 2012, at 10:08 PM, Mark Engelberg wrote: > It is the expected behavior for everyone who has ever gotten burned by this > bug :) > > Seriously though, this has come up several times over the last couple of > years. I remain baffled that this has never been fixed (at least not as of > 1.3). There are two ways this could potentially be fixed. On the one hand, > transients could be made to implement more of the interfaces they are > expected to implement. On the other hand, contains? could be modified to > return a meaningful error rather than false when passed something that > doesn't support that interface. Or better yet, both of these fixes would be > a good thing. -- 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