Re: copying structures

2010-03-30 Thread Jarkko Oranen
> The def was for legibility (or I was going for legibility). Speaking > of redefing, is there a way to block a redef so I or someone else > doesn't monkey-patch a function? You can set a validator on the Var to prevent accidents. However, someone who really wants to redefine a function can just

unmapping all namespaces in repl

2010-03-30 Thread Istvan Devai
Hi, How can I easily unmap all namespaces in a repl or swank? (so I can continue working as if I have just started up the REPL, no matter what I've "use"-d previously) Istvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: unmapping all namespaces in repl

2010-03-30 Thread Adrian Cuthbertson
On Tue, Mar 30, 2010 at 10:36 AM, Istvan Devai wrote: > Hi, > > How can I easily unmap all namespaces in a repl or swank? (so I can continue > working as if I have just started up the REPL, no matter what I've "use"-d > previously) > > Istvan I posted a bit of a lengthy exposition on this topic l

Getting started with open source Clojure projects

2010-03-30 Thread Daniel
If this is a dumb question, let me apologize in advance. The thing is, I've been trying to learn Clojure in my spare time, and, following the advice of several Clojure blogs, started by reading Halloway's book and playing around a bit at the REPL, which is all well and good, but now I'm ready to ta

Re: Getting started with open source Clojure projects

2010-03-30 Thread Mark J. Reed
On Mon, Mar 29, 2010 at 11:39 PM, Daniel wrote: > Is there a less cumbersome way to get a load of files on the classpath > than manually editing the .clojure file? Well, I have a ~/lib/clojure directory and a clj script that automatically puts that directory and all .jar's in it on the classpath.

Re: intuitive stack trace

2010-03-30 Thread Stuart Sierra
On Mar 29, 2:23 pm, strattonbrazil wrote: > I do something wrong, I have to read through the stack which sometimes > just says there's an error at line 0, which doesn't help me much. One problem is that the compiler can't keep track of line numbers in the REPL (or SLIME). If you load your code f

Re: unmapping all namespaces in repl

2010-03-30 Thread Stuart Sierra
On Mar 30, 4:36 am, Istvan Devai wrote: > How can I easily unmap all namespaces in a repl or swank? The following will give you a fresh "user" namespace: (in-ns 'clojure.core) (remove-ns 'user) (ns user) -SS -- You received this message because you are subscribed to the Google Groups "Clojure

Re: Getting started with open source Clojure projects

2010-03-30 Thread Alex Osborne
Daniel writes: > Am I going about this the wrong way? Is there an easier way to explore > existing open-source projects? I Try this for any leiningen project (check for the existence of a project.clj file). I'm assuming you're using a unixy operating system. First and once-off, install leining

RE: Getting started with open source Clojure projects

2010-03-30 Thread Kevin
> So here are my questions: > > Am I going about this the wrong way? Is there an easier way > to explore existing open-source projects? I Is there a less > cumbersome way to get a load of files on the classpath than > manually editing the .clojure file? How do I tell the REPL > where to find r

Re: Getting started with open source Clojure projects

2010-03-30 Thread Stuart Sierra
Take a look at the dependency management tools. Most open-source Clojure projects use either Maven and Leiningen. Both use the same dependency model and provide similar capabilities for starting a REPL with the classpath configured automatically. -SS On Mar 29, 11:39 pm, Daniel wrote: > If t

regular expression sequence

2010-03-30 Thread Glen Rubin
I am having trouble with the re-seq regular expression form. I am not an expert on regex, so this is probably part of my problem. I have a k12 text file, basically it is hex broken up by '|' . I would like to grab all the hex between two hex numbers (sample text below). For example, I might wa

Re: Getting started with open source Clojure projects

2010-03-30 Thread Meikel Brandmeyer
Hi, On Mar 30, 3:45 pm, Stuart Sierra wrote: > Take a look at the dependency management tools.  Most open-source > Clojure projects use either Maven and Leiningen.  Both use the same > dependency model and provide similar capabilities for starting a REPL > with the classpath configured automatic

Re: regular expression sequence

2010-03-30 Thread Meikel Brandmeyer
Hi, you have to escape the |. user=> (re-seq #"49\|00\|([0-9a-f|]+)\|a4\|ff" "a5|a5|49|23|49|00|12| fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff|ae") (["49|00|12|fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff" "12|fc|5e|a4|ff|a7|49|00| ee|d3"]) However this will be greedy... Sincerely Meikel -- You received this messa

ANN: clj-tagsoup

2010-03-30 Thread Daniel Janus
Hi all, I would like to announce clj-tagsoup, a simple cl-html-parse workalike for Clojure. A quick example: (parse "http://example.com";) => [:html {} [:head {} [:title {} "Example Web Page"]] [:body {} [:p {} "You ha

Remapping Class Imports

2010-03-30 Thread aria42
Hi, Is it possible to remap the name of a class or package import? Ideally I'd like to say something like (import [[java.util :as ju] ArrayList List]) and then use (ju.ArrayList.) to refer to the class. I recall reading Rich doesn't like auto-imports of all classes in a package or of renaming cla

Re: regular expression sequence

2010-03-30 Thread Glen Rubin
The result is a little bit strange still, since I am getting dupliates. First, it returns the string I want 49|00|12 12|a9|a4|ff but then it also returns the same string without the first and last 4 characters, e.g. 12|12|a9| Also, how come I don't need to escape the | inside the pare

Re: regular expression sequence

2010-03-30 Thread Mark J. Reed
Parentheses capture - anything that matches a parenthesized portion of a regular expression is returned as part of the result of the match: user=> (re-seq #"a(.)c" "abc") (["abc" "b"]) If you don't want that behavior, you can use the special non-capturing syntax, (?:...): user=> (re-seq #"a(?:.)

Re: regular expression sequence

2010-03-30 Thread Mark J. Reed
Addendum: I highly recommend Jeffrey Friedl's book _Mastering_Regular_Expressions_ if you want to learn how to use regexes well. There are also a number of introductions/tutorials online, but I'm not familiar enough with them to recommend any. On Tue, Mar 30, 2010 at 12:50 PM, Mark J. Reed wrote

towards definitive "getting started" assistance

2010-03-30 Thread Stuart Halloway
The labrepl now has much better "getting started" instructions, thanks to everyone who pitched in. But this begs the question: Why hide the getting started instructions in a single project? So, I am working to create definitive instructions for getting started with Clojure in a variety of e

RFC: Improvements in Clojure error message "No matching ctor for ..."

2010-03-30 Thread MarkSwanson
I think Clojure should provide more information when certain error conditions occur. Example: (when-not (= (Integer. (:userid json)) (Integer. (:userid a-user))) NOTE: (:userid a-user) is always some sort of number. (:userid json) is always a String. After testing (Integer. (:userid a-user)) _so

Re: towards definitive "getting started" assistance

2010-03-30 Thread Wilson MacGyver
Hi, I wrote an blog post on how to use clojure in gradle. That may be of use as part of the "getting started" http://m.3wa.com/?p=464 Thanks, On Tue, Mar 30, 2010 at 1:12 PM, Stuart Halloway wrote: > The labrepl now has much better "getting started" instructions, thanks to > everyone who pitc

Re: regular expression sequence

2010-03-30 Thread Glen Rubin
thx that works great! i guess I can also just leave out the parenthesis all together. but, what if i wanted just the portion inside?? the duplicate I wanted to get rid of? also any way to return the sequence without all those bars or do i have to use a seperate regex and or filter? On Mar 30,

Re: regular expression sequence

2010-03-30 Thread Mark J. Reed
Leaving out the parentheses changes the meaning because they group as well as capture. #"a(b|c)d" matches either "abd" or "acd". #"ab|cd" matches either "ab" or "cd". On Tuesday, March 30, 2010, Glen Rubin wrote: > thx that works great!  i guess I can also just leave out the > parenthesis all t

Re: towards definitive "getting started" assistance

2010-03-30 Thread David Nolen
Just a thought. Would it be more effective to create a GitHub page for this? Assembla is cool for ticketing but it's kinda ugly and unfriendly. For example I think something like this: http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html is much friendlier and the kind of base-lev

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-30 Thread Brent Millare
Thanks, that was insightful. To recap, subclassloader is a optimization to reduce the startup time of launching a new clojure instance from leiningen. In addition, I learned that computing the classpath was conducted in clojure code. I see now that the bash script is just a bootstrapping tool to ge

labrepl issues & feedback from the Dundee Clojure Dojo

2010-03-30 Thread Rick Moynihan
Hi all, Today we hosted the second weekly Clojure workshop at my office in Dundee, Scotland. Prior to the event I thought we'd use labrepl as a convenient way to deliver some simple tutorial/exercises along with a working Clojure environment. The event was reasonably successful but there were so

Re: intuitive stack trace

2010-03-30 Thread Rick Moynihan
On 30 March 2010 14:37, Stuart Sierra wrote: > On Mar 29, 2:23 pm, strattonbrazil wrote: >> I do something wrong, I have to read through the stack which sometimes >> just says there's an error at line 0, which doesn't help me much. > > One problem is that the compiler can't keep track of line num

Re: Getting started with open source Clojure projects

2010-03-30 Thread Matt
If you're not stuck on using Compojure, you can try Conjure which will includes all of the dependencies in the jar. To start a hello world app: 1. Download conjure.jar from: http://github.com/macourtney/Conjure/downloads 2. java -jar conjure.jar hello_world 3. cd hello_world 4. ./run.sh script/se