Re: New Version of ClojureScript One

2012-01-31 Thread Craig Andera
> This is a problem with the current version of Leiningen. There are a > couple of ways to work around the problem. Here is one: > > Create a new Leiningen project. > > lein new delete-me > cd delete-me > > Open project.clj and change > > :dependencies [[org.clojure/clojure "1.3.0"]] > > to > > :de

Re: ClojureScript One - Getting Started with ClojureScript

2012-01-12 Thread Craig Andera
For anyone that wants to hear a bit more about Brenton's thinking around ClojureScript One, we just published a podcast interview with him on the Relevance blog. Have a listen if you feel so inclined! http://thinkrelevance.com/blog/2012/01/12/podcast-episode-003.html On Thu, Jan 12, 2012 at 2:35

Re: Creating a Clojure Record from a string

2011-08-23 Thread Craig Andera
> (Class/forName "java.lang.String") Oh, does that work in 1.3? Because (new (Class/forName "user.Foo")) was the first thing I tried (under 1.2) and it doesn't work. Perhaps unsurprisingly given that new is a special form. -- You received this message because you are subscribed to the Google Gro

Re: Creating a Clojure Record from a string

2011-08-23 Thread Craig Andera
> Given: > > test=>(defrecord Foo [A B]) > test=>(class (Foo. 1 2)) > test.Foo > > How do I: > > test=>(new "test.Foo" 1 2) > #:test.Foo{:A 1, :B 2} > > Currently I get " Unable to resolve classname: test/Foo". Check out http://stackoverflow.com/questions/3748559/clojure-creating-new-instance-fro

Re: Generating new exception classes in clojure

2011-08-22 Thread Craig Andera
> How can I catch a proxied Throwable class without catching everything?  I > suppose I could grab the class and go at it with reflection... I wrestled with this problem for a while, and got to "you can't do it". At least, not without AOT compilation of some sort. I did come up with a horrible, ho

Re: Miscellaneous noob questions

2010-06-18 Thread Craig Andera
> I'm a little confused over when to use a var vs. a ref vs. an agent > vs. an atom. For writing small (<200 lines) single-threaded programs > when do I want to use each one? In addition to the great answers you got here, you could have a look at my screencast series on vars, refs, agents, and ato

Re: Leiningen documentation review?

2010-06-17 Thread Craig Andera
> Mostly I'd like feedback on the tutorial: > http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md This sentence: "Libraries for the JVM are packaged up as .jar files, which are basically just .zip files with a little extra JVM-specific metadata that contain either .class files (byteco

Re: Leiningen documentation review?

2010-06-17 Thread Craig Andera
> But if you've got some time to look over the readme, that would be > great too: http://github.com/technomancy/leiningen/blob/master/README.md Unnecessary (and ironic! :)) repetition of the word "around" in this sentence: If you use Ant, you end up copying around a lot of the same tasks around b

Re: ICFP 2009 / ICFP 2010

2010-06-12 Thread Craig Andera
> There's one question that came up when I implemented this. Is there a > way to get the name of a clojure function, when all I have is the > function object? Is it stored alongside the function? I didn't see any > metadata or anything. Would I really have to reverse lookup the name > in some names

Re: let's all link to the "getting started" pages!

2010-06-02 Thread Craig Andera
Someone wrote an installer [1] that I've used successfully. [1] http://github.com/paulbatum/clojure-clr/downloads On Wed, Apr 7, 2010 at 4:37 PM, Sean Devlin wrote: > Anyone have instructions for CLR? > > On Apr 7, 2:50 pm, Meikel Brandmeyer wrote: >> Hi, >> >> On Wed, Apr 07, 2010 at 01:53:47P

Re: Function Size

2010-05-30 Thread Craig Andera
You can bind functions inside a let, which can help if you're just trying to make code less nested. The thread-first and thread-last macros help here too. But if you're looking for the equivalent of the "private" keyword (sort of) check out defn-. Note the dash at the end. On Sunday, May 30, 2010

Re: Announcing Clojure/core

2010-05-25 Thread Craig Andera
> I'm happy to announce Clojure/core, a joint endeavor between myself > and Relevance, Inc. Congratulations to everyone involved! Very exciting! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Is group-by lazy?

2010-05-25 Thread Craig Andera
> I've noticed that there is group-by in clojure 1.2. However it uses > reduce and conj. > Doesn't it consume all sequence at once? Yes. But then, it would have to: - clojure.contrib.seq/group-by ([f coll]) Returns a sorted map of the elements of coll keyed by the result

Re: code review:replace-first

2010-05-08 Thread Craig Andera
> Hi,there! > > I need a function that replaces a first found element of list. > like that, > >>(replace-first :a :b [:c :c :a :c :a] > [:c :c :b :c :a] >       ~~ > ;replace first :a to :b An interesting problem for a Sunday morning when I ought to be cleaning the house. :) Here are my (admittedl

Re: labrepl updated

2010-05-08 Thread Craig Andera
> Changed my mind and fixed this on the Clojure side [1]. Now you should be > able to bind *err* to any old Writer you like. > > Stu > > [1] > http://github.com/richhickey/clojure/tree/c4eb5719b0f30ea4c113e6e98a1c171c43a01abe Just checked this out. Working fine now. Thanks! I'll let you know if I

Re: labrepl updated

2010-05-06 Thread Craig Andera
So if someone produces a fork of incanter that doesn't have the warning (or David fixes up Incanter), then the problem goes away? Because the other place I see the warnings coming out of is swank itself. On Thu, May 6, 2010 at 9:33 AM, Stuart Halloway wrote: > This is another variant of the "Swan

Re: labrepl updated

2010-05-06 Thread Craig Andera
Update: Using the latest labrepl commit (fa89411ae "use private compojure snapshot"), I'm now able to pull in incanter and use it (albeit with tons of warnings about group-by and flatten from both incanter and swank)...but only if I use script/repl via inferior-lisp. I still can't get swank to work

Re: labrepl updated

2010-05-05 Thread Craig Andera
> I have updated the labrepl [1] to use the latest clojure 1.2 and contrib 1.2 > snapshots. Also, most of the dependencies are now frozen to specific > snapshot timestamps (the project.clj file may be of interest to people living > on the development edge). > > After a "lein clean;  lein deps" ever

Re: Clojure Concurrency Screencast Available

2010-04-20 Thread Craig Andera
> > I enjoyed you presentations, but I have a bit of a tangent question. > > I'm still new to slime, so it's not a comfortable environment for me > > yet.  What I am wondering is how exactly, when operating with the > > split code and repl buffers, you are getting code buffer expressions > > to eva

Re: Clojure Concurrency Screencast Available

2010-04-16 Thread Craig Andera
One final update: all six parts are now available, including the "mobile" downloads for offline viewing. http://link.pluralsight.com/clojure On Tue, Apr 13, 2010 at 9:40 AM, Craig Andera wrote: > Glad you've enjoyed them! > > 2010/4/13 Pelayo Ramón > > I have seen

Re: Clojure Concurrency Screencast Available

2010-04-13 Thread Craig Andera
Glad you've enjoyed them! 2010/4/13 Pelayo Ramón > I have seen the first 2, and as a clojure noobie I have to say that > they are great. Thanks a lot. > > On Tue, Apr 13, 2010 at 3:10 PM, Craig Andera > wrote: > > If you mean "downloading and viewing on

Re: Clojure Concurrency Screencast Available

2010-04-13 Thread Craig Andera
contact me off-list and I'll hook you up with the right people for that conversation. On Tue, Apr 13, 2010 at 4:30 AM, Hasan Hasan wrote: > Hi, > > Is downloading and copying the videos free? > > > On Tue, Apr 13, 2010 at 1:10 AM, Craig Andera wrote: > >> That&#x

Re: Clojure Concurrency Screencast Available

2010-04-12 Thread Craig Andera
y/blogs/craig/archive/2008/10/07/typing-speed-mode-emacs-minor-mode.aspx> [2] (load "/path/to//typing-speed.el") (add-hook 'text-mode-hook 'turn-on-typing-speed-mode) On Mon, Apr 12, 2010 at 10:52 AM, Baishampayan Ghose wrote: > Craig Andera wrote: > >> I've re

Re: Clojure Concurrency Screencast Available

2010-04-10 Thread Craig Andera
Mobile downloads are available now. Sorry about the delay. The refs module is also up, so that's five of six. Part six by mid next week. On Sat, Apr 10, 2010 at 9:26 AM, Craig Andera wrote: > Right, good point: I should have seen that coming given the target > audience. :) > > W

Re: Clojure Concurrency Screencast Available

2010-04-10 Thread Craig Andera
Right, good point: I should have seen that coming given the target audience. :) Within a few hours, a "mobile download" link will appear with wmvs and mp4s in a variety of resolutions so you can watch these offline on the device of your choosing. The conversion lags the rest of the process a littl

Clojure Concurrency Screencast Available

2010-04-09 Thread Craig Andera
I've recorded a screencast on Clojure concurrency primitives. It's available at http://link.pluralsight.com/clojure. Thought some here might find it useful. It's in six parts, the first four of which are up now. The last two will be up by the middle of next week. Feedback welcome! -- You received

Re: filter1 interesting?

2009-03-14 Thread Craig Andera
What about overloading first to accept a predicate? (first even? (iterate inc 1)) => 2 On Sat, Mar 14, 2009 at 8:58 AM, e wrote: > >> >> Christophe Grand suggest (seek ...), which I personally like. >> > IMHO > seek is pretty good for a number of reasons: short, implies first result. > Minor ob

Re: Clojure documentation for offline use?

2009-02-18 Thread Craig Andera
If you're just looking for the API documentation, then you could use this file [1]. If you're looking for the rest of the stuff on the site, then I'm not sure. [1] http://clojure.googlegroups.com/web/clj-libs%20(3).html On Wed, Feb 18, 2009 at 11:18 AM, Oliver wrote: > > Hi, > > I'm wondering i

Re: Clojure on CLR/DLR

2009-02-17 Thread Craig Andera
> As far as I understood, the rules are that it should be derived from Clojure > and sports either an N or a CLR. So I suggest Conjure > > It looks like clojure, sounds pleasing, and sounds lispish (conj). And Lisp > to me sounds like magic (in the Arthur C. Clarke meaning that it is a > techno

Re: Clojure on CLR/DLR

2009-02-17 Thread Craig Andera
> I'm up for suggestions on the name. The obvious ones: > > - Clojure.net > - ClojureCLR > - IronClojure (paralleling IronPython/IronRuby, unless MS has Iron > trademarked.) > - CLjR (too cute) > > Perhaps Rich will have a preference. He'll have to live with it > longer than anyone and has

Re: A Clojure documentation browser

2009-02-16 Thread Craig Andera
> I think a problem with the current layout is that once you jump to one > of the library sections you have to manually scroll back up to the > index. There are a few different ways this could be solved. > > a) You could just add a "top" link to each library section banner. > > b) Only show the c

Re: A Clojure documentation browser

2009-02-14 Thread Craig Andera
> clojure-contrib/build.xml is where the change I talked about would go. If > you're up for giving it a try, that'd be great. I plan to look at it this > weekend unless someone beats me to it. If I did give it a shot, it likely wouldn't be until late next week, so knock yourself out. :) --~--~--

Re: A Clojure documentation browser

2009-02-14 Thread Craig Andera
> Github is fine. Once I see your name on clojure.org/contributing, I'll > commit this to clojure.contrib. For changes going forward, once you're happy > with some update on github, just let me know and I'll pull it into contrib. > For bug reporting, I recommend you add a section to the comments a

Re: A Clojure documentation browser

2009-02-13 Thread Craig Andera
> Please consider whether or not you'd like to send in a Contributor Agreement > to enable that. If you hurry you could become the first registered Clojure > contributor whose last name begins with A. :-) (clojure.org/contributing) OK, I've added the things I want to add, and sent in the agreemen

Re: A Clojure documentation browser

2009-02-12 Thread Craig Andera
> Nice work! Thanks. > Two things related to 'strcat'. > > 1) This is already implemented as clojure.core/str (and is more > efficient than concat'ing) > 2) This function is never called :) Yeah, that code was cut and pasted from some older work I did. It was removed when I started using prxml.

Re: A Clojure documentation browser

2009-02-11 Thread Craig Andera
As I mentioned previously, I'm going to see if I can get time this week to set it up to go through clojure.contrib.prxml. If I don't run into any issues, that will remove the dependency on the javax stuff I'm importing. It will have the additional benefit of cutting the code in half. I'll update h

Re: A Clojure documentation browser

2009-02-11 Thread Craig Andera
> I like it a lot. I think it would be very cool if such an HTML file covering > clojure-rooted and clojure-contrib-rooted namespaces were to become an > output of building clojure-contrib. I like that idea a lot. > Please consider whether or not you'd like to send in a Contributor Agreement > t

Re: A Clojure documentation browser

2009-02-10 Thread Craig Andera
> When I was writing it, > it sure seemed like I was missing a call to resolve somewhere, but > when it worked for some symbols, I got a) excited, and b) confused. :) Yep, that was basically it: I was calling get-source on the symbol that named the member, but I wasn't bothering to namespace-qual

Re: A Clojure documentation browser

2009-02-10 Thread Craig Andera
> I see that "show source" links are missing on your page for some > functions -- does this indicate a failure of repl-utils/get-source? I think so. But I'm willing to believe that the error is elsewhere. It's just hard for me to see where it could be. > These seem to work fine for me: > > user=

A Clojure documentation browser

2009-02-10 Thread Craig Andera
One of the challenges with learning any new platform is learning the libraries. As a way to improve both that an my knowledge of Clojure itself, I whipped together doc-browse, a Clojure library that will spit out an HTML page that contains documentation for a set of Clojure libs. You can see an ex

Re: Multimethod Reflection Question

2009-02-06 Thread Craig Andera
> (methods multifn) > > Returns a hash-map where the keys are vectors if the dispatch values of the > multimethods were vectors, weird and cool :) > How does one check for the existence of a key in a hash-map if the key is > vector? I tried several things and nothing obvious seemed to work. Vecto

Re: Clojure's code has moved to Google Code

2008-12-18 Thread Craig Andera
Does it makes sense to subscribe this group to those? I.e. to have commit messages appear here. I've done it both ways on my own projects, and I'm of split mind about it. On Wed, Dec 17, 2008 at 9:33 AM, Rich Hickey wrote: > > > > On Dec 17, 8:22 am, Rich Hickey wrote: >> I've moved Clojure's s

Re: randomize a collection?

2008-12-01 Thread Craig Andera
Not sure if there's a built-in one, but I had a lot of fun coming up with this one: (defn shuffle [coll] (map second (sort (map (fn [x] [(rand) x]) coll Now I'm looking forward to hearing how I could have done it better...the real fun on this list, since Clojure has so many ways to amaze!

Re: slime+clojure problem

2008-12-01 Thread Craig Andera
You should double-check: I had the same problem, and it was related to not having an up-to-date implementation of Clojure. Be aware that you probably need to run "ant clean jar" on the Clojure sources after getting them from SVN. On Mon, Dec 1, 2008 at 1:05 PM, Peter Eddy <[EMAIL PROTECTED]> wrot

Re: categorizing functions

2008-11-25 Thread Craig Andera
This is a reasonable idea, and I would find it useful as well. However, it might be easier (and more appropriate) to make tagging a feature of the documentation website that has come up here. On Tue, Nov 25, 2008 at 11:38 AM, Mark Volkmann <[EMAIL PROTECTED]> wrote: > > Sometimes it can be time c

Re: one way to write a factorial function

2008-11-23 Thread Craig Andera
Clever! Help me understand why this isn't written (defn factorial [n] (apply * (range 1 (+ n 1))) instead. That is, I don't get the purpose of the for statement. On Sun, Nov 23, 2008 at 4:08 PM, prhlava <[EMAIL PROTECTED]> wrote: > > > Hello folks, > > While learning, it occured to me that f

Re: Clojure HTML Documentation

2008-11-21 Thread Craig Andera
Very nice! As it turns out, I've been heavily involved in writing the documentation infrastructure that MSDN uses for the last few years, so I have some sympathy for this problem space. :) A few things I'd like to see: * I'd like to see the URL for the page change when navigating to a new topic.

Re: mutability

2008-11-20 Thread Craig Andera
I must be missing something. Even if you have to make every modification inside a dosync using the syntax that you originally provided, why not write a function that captures that and be done with it? Or, if you have to, a macro? That is, it seems like the complaint is "too much repeated code", bu

Re: POLL: Domain name for project hosting site.

2008-11-17 Thread Craig Andera
Despite the fact that I suggested clojury and openjure in the first place, I think I like clojr, forj, projecture, and clojects, in that order. Decisive - that's me! > On Mon, Nov 17, 2008 at 3:08 PM, J. McConnell <[EMAIL PROTECTED]> wrote: >> >> I'm liking projecture >> >> On Mon, Nov 17, 2008

Re: Filter repeats

2008-11-16 Thread Craig Andera
One way I could think of to do this would be to build a map with each unique item as a key and the count as its value. Then it would be trivial to pull out the keys with the count as a specified value. I started writing this, but my SLIME is royally screwed up right now after the upgrade to Clojur

Re: Newbie: Optional parameters without multiple definitions

2008-11-15 Thread Craig Andera
If you're cool with passing a map instead of plain parameters, you could use destructuring to do this: (defn test1 [{x :x, y :y, :or {:y 3}}] [x y]) (test1 {:x 2}) => [2 3] Another thing you could do would be to use variable arity and handle the absence of the other parameters in the me

Re: Newbie question: Sequences from a function

2008-11-15 Thread Craig Andera
One way to lazily produce f(n) over an infinite number of integers is using map to apply your function to an infinite (lazy) series of integers: (map (fn [x] (* x 3)) (iterate inc 0)) => (0 3 6 9 ...) Although you'd be wise to use take when evaluating this in the REPL. If you want to instead pr

Re: length of a list

2008-11-15 Thread Craig Andera
Unless I'm missing something: (count '("CCC" "COC" "C(=O)C")) => 3 Or better yet: (count ["CCC" "COC" "C(=O)C"]) => 3 On Fri, Nov 14, 2008 at 11:46 PM, Rajarshi <[EMAIL PROTECTED]> wrote: > > Hi, I've been learning Lisp using SBCL, but my complaint has been it > was difficult for me to link it

Re: Concerned about Clojure's license choice.

2008-11-05 Thread Craig Andera
> I don't renounce ownership rights at all, not even for intellectual > property. I just think "free" software licenses are useless at best > and counterproductive at worst when applied to projects that are > supposed to be free. Free software needs a license if it's going to be adopted by organi

Re: Debugging with JSwat

2008-10-29 Thread Craig Andera
As a follow-on to this, it turns out that debugging works *only* when I pull the files in via require; neither slime-load-file nor slime-eval-buffer nor load-file result in breakpoints getting hit. On Fri, Oct 24, 2008 at 1:27 PM, Craig Andera <[EMAIL PROTECTED]> wrote: >>> I

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
>> It's very likely/nearly certain I'm still doing something wrong - I >> appreciate the help. Indeed it was me: everything started working as soon as I made sure my .clj files were in CLASSPATH the way require describes they should be. I'm sure it doesn't help that I'm a Java n00b in addition to

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
> No, that's not enough. You didn't specify the port that you want to > connect to JSwat on. add "address=" (or something similar) to this > to specify which port you want to use. In my blog example, I'm using > "": > -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address= >

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
> Are you doing all of the following: > > 1. Specify the appropriate debug options when you start Clojure (see > step #4 in my blog post) Yep. Here's the full command line: c:\WINDOWS\system32\java.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n -cp "C:/bin/clojure/clojure/svn/cloju

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
[Tried sending this before. Never appears to have shown up. Trying again after mucking with my Google account some.] On Tue, Oct 21, 2008 at 11:11 AM, Allen Rohner <[EMAIL PROTECTED]> wrote: > >> I wonder if this doesn't have something to do with the fact that I'm >> doing everything via the REPL

Debugging with JSwat

2008-10-20 Thread Craig Andera
I'm a total Clojure beginner, not to mention a C# guy with little Java experience, but as I suspect I'm not alone I'll go ahead and ask what's probably a dumb question. :) I'm writing some simple code, and I've hit the point where having a debugger would be helpful. Once I convinced clojure-swank