Re: *assert* and assert

2010-10-21 Thread Shantanu Kumar
On Oct 22, 10:59 am, Meikel Brandmeyer wrote: > Hi, > > On 22 Okt., 07:48, Shantanu Kumar wrote: > > > When I runs this using Clojure 1.2.0: > > > (binding [*assert* false] (assert false)) > > > I get > > > java.lang.AssertionError: Assert failed: false > > > Can somebody please help me underst

Re: *assert* and assert

2010-10-21 Thread Meikel Brandmeyer
Hi, On 22 Okt., 07:48, Shantanu Kumar wrote: > When I runs this using Clojure 1.2.0: > > (binding [*assert* false] (assert false)) > > I get > > java.lang.AssertionError: Assert failed: false > > Can somebody please help me understand how to use *assert* for > conditional assertions? The assert

*assert* and assert

2010-10-21 Thread Shantanu Kumar
When I runs this using Clojure 1.2.0: (binding [*assert* false] (assert false)) I get java.lang.AssertionError: Assert failed: false Can somebody please help me understand how to use *assert* for conditional assertions? Regards, Shantanu -- You received this message because you are subscribe

Re: Sandbar Dependencies Problem

2010-10-21 Thread Brenton
[sandbar "0.3.0-SNAPSHOT"] is all you need. That is the latest version and includes everything including the defform code you are looking for. On Oct 21, 5:25 am, nickikt wrote: > I can find  [sandbar.core "0.3.1"], [sandbar/sandbar-session "0.2.5"] > and other on clojars. I would rather work wi

Re: First function

2010-10-21 Thread Jürgen Hötzel
2010/10/21 Brody Berg : > (defn binary-search >    "Search sorted list for target using binary search technique" Binary search is only useful on indexed data types like Clojure Vectors. >    ([m_list target] >        (if (empty? m_list) >            false >            (binary-search m_list 0 (- (

Re: Need some help with static files and ring...

2010-10-21 Thread Luc
Hi, I do have the web-content key. I had to postpone work on this issue (I'm waiting for my flight right now to get the ClojureConj). They were too many items in the checklist before I could leave.. I'll resume on this either while in Raleigh or upon my return. Right now I feel a bit stunned by t

Re: First function

2010-10-21 Thread Alan
To expand on this: 1. It's better to use when (or when-not) if one branch of your if is just a false value. E.g. you could replace (if (empty? x) false (whatever)) with (when-not (empty? x)). However... 2. Don't use empty? if you can help it! The idiomatic way to test whether a collection has any

Re: Leiningen 1.3 question

2010-10-21 Thread Brendan Ribera
'lein deps' deletes the lib directiory whenever it runs, and this is the expected behavior. 'lein jar' runs deps first, so that's why lib is disappearing. This shouldn't be a problem if all of your dependencies are specified in project.clj; deps should just repopulate a fresh lib directory. If you

Re: Transient maps do not work?

2010-10-21 Thread andrei
Oh, I didn't understand this line before. Now I see my error, thank you. On Oct 21, 6:27 pm, Jürgen Hötzel wrote: > 2010/10/21 andrei : > > > > > > > (defn test [] > >  (let [transient-map (transient {})] > >      (doseq [i (range 100)] > >          (conj! transient-map {i (str i)} )) > >      (p

Re: Transient maps do not work?

2010-10-21 Thread Jürgen Hötzel
2010/10/21 andrei : > > (defn test [] >  (let [transient-map (transient {})] >      (doseq [i (range 100)] >          (conj! transient-map {i (str i)} )) >      (persistent! transient-map))) > > I expect that it will produce: > > { 0 "0", 1 "1", 2 "2", ..., 99 "99"} > > but it gives only > > {0 "0"

Leiningen 1.3 question

2010-10-21 Thread hsarvell
I'm trying to compile my project with Leiningen 1.3.1, the compile fails but that is another story. My main problem right now is that the lib folder disappears. I'd like to be able to do lein jar (or try) without it disappearing. My project.clj looks like this: (defproject project "0.1" :desc

Transient maps do not work?

2010-10-21 Thread andrei
(defn test [] (let [transient-map (transient {})] (doseq [i (range 100)] (conj! transient-map {i (str i)} )) (persistent! transient-map))) I expect that it will produce: { 0 "0", 1 "1", 2 "2", ..., 99 "99"} but it gives only {0 "0", 1 "1", ..., 7 "7"} i.e. only first 8

Re: First function

2010-10-21 Thread songoku
You should close the parenthesis all in one line: (defn binary-search "Search sorted list for target using binary search technique" ([m_list target] (if (empty? m_list) false (binary-search m_list 0 (- (count m_list) 1) target))) ([m_list m_left m_right

Re: Sandbar Dependencies Problem

2010-10-21 Thread nickikt
I can find [sandbar.core "0.3.1"], [sandbar/sandbar-session "0.2.5"] and other on clojars. I would rather work with the new versions (not start a poject with outdated dependencies). Witch of the jars do I need to do something like your defform example in the new version? On Oct 21, 2:23 am, Brent

Re: Improving Contrib

2010-10-21 Thread Stuart Halloway
As the start of this thread mentioned, we are moving to a new infrastructure around Confluence and JIRA, which should be (1) easier to use and in and of itself, and (2) allow a chance to improve documentation and streamline every aspect of contributing to Clojure. I am hoping we can roll onto JI

Re: Trying to Load An Alias from Another Namespace into The Current Namespace

2010-10-21 Thread Meikel Brandmeyer
Hi, you can't transfer aliases from one namespace to another. But as a workaround, you can create a file which contains the necessary commands: active-record/tables.clj: (require '[active-record.user :as user]) (require '[active-record.charge :as charge]) And then just load the file in the names

Re: First function

2010-10-21 Thread Michael Gardner
On Oct 21, 2010, at 3:28 AM, Brody Berg wrote: >(if (== (nth m_list m_left) target) Forgot to mention: you should use = instead of == unless you're sure you will only ever get numeric arguments *and* profiling tells you that = is a performance bottleneck. -- You received this

Re: First function

2010-10-21 Thread Michael Gardner
On Oct 21, 2010, at 3:28 AM, Brody Berg wrote: >(if (empty? m_list) >false >(binary-search m_list 0 (- (count m_list) 1) target)) Assuming that returning nil is OK in case of the target not being present, you can replace this with (when (seq m_list) (binary-search

First function

2010-10-21 Thread Brody Berg
Hey, Not sure if this is the right place for this - but I just wrote my first function in Clojure and wanted to make sure I am on the right track idiomatically and making full use of the language etc. I have been able to build/run and unit test this so that's all fine. Take a look at the below and

"meta" bytecode redundancy?

2010-10-21 Thread Arthur Edelstein
Hi Everyone, I have a question about an apparent redundancy in clojure's generated class files. Out of curiosity I was inspecting the core class files using the Java Decompiler JD-GUI. For example, here is the decompiled version of core$dec.class (the implementation of the dec function): package

Trying to Load An Alias from Another Namespace into The Current Namespace

2010-10-21 Thread Stefan Rohlfing
Dear Clojure group, The library clj-record requires to add a source file for every table in a given database. This can lead to a lot of files whose namespaces have to be imported wherever you want to work on the tables. In order to avoid having to write the whole namespace declaration every time