Re: Using map on multiple collections.

2009-12-24 Thread Tom Hicks
A slight modification, which I think avoids counting each collection twice: (defn append-val [val & colls] (let [lengths (map count colls) maxlen (apply max lengths)] (map #(concat %1 (repeat (- maxlen %2) val)) colls lengths) ) ) On Dec 23, 10:30 am, kyle smith wrote: > It's a

Re: clojure clr build issue

2009-12-24 Thread Sriram P C
Help->About says Microsoft Visual Studio 2008 Version 9.0.30729.1 SP OS is Windows 7 Home Premium 6.1 There is a warning 'Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5"'.. I don't know if it has any

Re: let-binding overrides binding-binding

2009-12-24 Thread Tom Hicks
On Dec 24, 6:01 pm, Richard Newman wrote: > > but, I can't seem to do this with the 'inc' function: > > > user=> (binding [inc (fn [y] (+ 2 y))] (inc 44)) > > 45 > > > Why doesn't this work? > > Because inc is inlined, and thus isn't mentioned when your binding   > occurs. Thanks Richardthat'

Re: let-binding overrides binding-binding

2009-12-24 Thread Richard Newman
> but, I can't seem to do this with the 'inc' function: > > user=> (binding [inc (fn [y] (+ 2 y))] (inc 44)) > 45 > > Why doesn't this work? Because inc is inlined, and thus isn't mentioned when your binding occurs. (defn inc "Returns a number one greater than num." {:inline (fn [x] `(. c

Re: let-binding overrides binding-binding

2009-12-24 Thread Tom Hicks
On a related note, can someone explain the following... I can define a function 'p1': user=> (defn p1 [x] (+ 1 x)) #'user/p1 user=> (p1 44) 45 and then shadow it within the binding construct: user=> (binding [p1 (fn [y] (+ 2 y))] (p1 44)) 46 but, I can't seem to do this with the 'inc' function

Re: clojure clr build issue

2009-12-24 Thread dmiller
Wow, Google only gets nine hits on MSB3075. One, possibly relevant, solved by moving to admin privilege. One, yours. Others, not relevant. Thus ends my error-resolution attempt! >From the message, I'm assuming .net 3.5. What flavor of VS? -David On Dec 23, 9:21 pm, sriram p c wrote: > I wa

Re: Fixing Lisp

2009-12-24 Thread kaveh_shahbazian
Thanks to all! I think I should use another (more fun or irrelevant - based on one's eye-line!) example for custom "form separators"; something like this: (switch (choice) {my-choice (having-fun) } {(your-choice) (being-pragmatic) } {(their-choice) (lisp

Re: Fixing Lisp

2009-12-24 Thread Luc Prefontaine
Lisp syntax needs some fixing ? It's not April 1st yet or did I hibernate through winter suddenly ? I'll run to the window to see if my tulips are out :))) Luc Sent from my iPod On Dec 24, 2009, at 1:58 PM, kaveh_shahbazian wrote: > Well; this is a fun tradition after all and number o

Re: :pre and :post throwing Exception - is this a smell?

2009-12-24 Thread Daniel Werner
On Dec 24, 7:08 am, Mike Douglas wrote: > Previously: > "Caused by: java.lang.Exception: Assert failed: (= % x)" With your patch, assert does not include x in its message anymore in case s is not given. Also, as a non-native speaker I find the phrase "failed when" somewhat strange to my ears. Asi

Re: Sequence puzzle

2009-12-24 Thread samppi
That's great too; I think I'll use this instead, since it doesn't involve unpacking lists. Thanks a lot, both of you. On Dec 24, 11:39 am, Sean Devlin wrote: > We could define a fn called take-until > > (defn take-until >   [pred coll] >   (take-while (complement pred) coll)) > > And get the last

Re: Fixing Lisp

2009-12-24 Thread David Nolen
On Thu, Dec 24, 2009 at 12:58 PM, kaveh_shahbazian < kaveh.shahbaz...@gmail.com> wrote: > This has been done in Clojure to some extend for Vectors and Sets. > What if we could choose a custom separator in out macros? For example > `begin and `end? This way one can write code in more common flavors

Re: Fixing Lisp

2009-12-24 Thread Dan
> > So If I look ridiculous, I apologize in advance. > > Don't worry, you'd be in good company anyway :) Why don't you implement it and try it? It should be fairly easy to create a translator that would turn any of those proposals into regular clojure before compiling. Try it out for a while, see

Fixing Lisp

2009-12-24 Thread kaveh_shahbazian
Well; this is a fun tradition after all and number of participants is huge! (All failed of-course :) ) Is short idea is: Having the choice of custom separators. This has been done in Clojure to some extend for Vectors and Sets. What if we could choose a custom separator in out macros? For example

Re: Sequence puzzle

2009-12-24 Thread Sean Devlin
We could define a fn called take-until (defn take-until [pred coll] (take-while (complement pred) coll)) And get the last entry of that user=>(last (take-until odd? [2 4 6 8 9 10 11])) 8 It's based on take-while, so it's lazy. Sean On Dec 24, 1:34 pm, Chouser wrote: > On Thu, Dec 24, 200

Re: Sequence puzzle

2009-12-24 Thread samppi
Excellent, thank you very much! On Dec 24, 11:34 am, Chouser wrote: > On Thu, Dec 24, 2009 at 1:24 PM, samppi wrote: > > I'm having trouble with figuring out something. First, to get the > > first element of a sequence so that (pred element) is false, you do > > (first (drop-while pred sequence)

Re: Sequence puzzle

2009-12-24 Thread Chouser
On Thu, Dec 24, 2009 at 1:24 PM, samppi wrote: > I'm having trouble with figuring out something. First, to get the > first element of a sequence so that (pred element) is false, you do > (first (drop-while pred sequence)). This is lazy, and stops > immediately when the element is found. > > Now, I

Sequence puzzle

2009-12-24 Thread samppi
I'm having trouble with figuring out something. First, to get the first element of a sequence so that (pred element) is false, you do (first (drop-while pred sequence)). This is lazy, and stops immediately when the element is found. Now, I want to get the element *right before* the element returne

Re: Clojure and c++ and a bit more

2009-12-24 Thread atucker
I am also curious about this. Apologies, possibly naive question ahead :) My background is in C++. By choosing to work with immutable values (i.e. with a lot of consts), I found that I was able to avoid most of explicit memory management, pointers etc. Exceptions were: (a) when interfacing wit

Re: Does clojure have same problem as groovy "private fields and private methods are not private"

2009-12-24 Thread AlexK
Clojure solves this problem in a very simple way: Not at all. Two Reasons: There is no way to create a class with private members in clojure. 'private members' exist because of lexical scoping and don't require special constructs like 'private' etc. (javascript has 'private members' too because of

Re: list of open source clojure projects to contribute?

2009-12-24 Thread Meikel Brandmeyer
Hi, Am 23.12.2009 um 18:59 schrieb Phil Hagelberg: >> http://www.google.com/search?hl=en&q=site:github.com+clojure > > Also noteworthy: all Clojure projects on Github sorted by most recent > activity: > > http://github.com/languages/Clojure/updated > > That weeds out inactive projects. Then y

clojure clr build issue

2009-12-24 Thread sriram p c
I was trying to build clojure clr. As given in the instructions, I have unloaded the Tests project. During compilation of the Coljure.Compile project, I see the following error on the "Output" window C:\sriram\work\clojure\clojure-clr\Clojure\Clojure.Compile\bin\Debug \Clojure.Compile.exe clojure

Re: Clojure newbie question regarding compile time type checking.

2009-12-24 Thread Daniel Werner
On Dec 13, 5:24 am, ajay gopalakrishnan wrote: > It tried the following in REPL and got no error. Personally, I feel that I > should get an error because calling square on strings is wrong in both > cases. > > Is there a way out of this in Clojure? I hope you don't mind me bumping this old thread