Factorial (Was: Enhanced Primitive Support)

2010-06-20 Thread Mike Meyer
On Sun, 20 Jun 2010 13:27:01 -0400 David Nolen wrote: > On Sun, Jun 20, 2010 at 12:57 PM, Luke VanderHart > wrote: > > > anything that would mean I'd have to explain the intricacies of > > primitives, boxing, hinting and casting in an "Intro to Clojure" > > course. As much as humanely possible,

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Rob Lachlan" wrote: >Because the compiler is upset that it doesn't know what n is. r is a >long, but n is ???. The following works: > >(defn ^:static fact [^long n] > (loop [n n r 1] >(if (zero? n) > r > (recur (dec n) (* r n) > >Or see Dnolen's version above. But yeah, I

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Rob Lachlan" wrote: >Actually, Mike, your two functions work just fine. (Equal branch). >Mind you I checked that out over two hours ago, so this information >might be out of date. > >Rob > >On Jun 19, 6:59 pm, Mike Meyer > (defn count-in [value col] >

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 20:40:13 -0400 David Nolen wrote: > Mark and Mike you fail to address my deeper question. Maybe because you've failed to ask in your hurry to claim code is non-idiomatic or calling our example rhetoric. > I've been using > many different Clojure librarie

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 20:13:07 -0400 David Nolen wrote: > On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk > wrote: > > (defn fact [n] > > (loop [n n r 1] > >(if (zero? n) > > r > > (recur (dec n) (* r n) > > Huh? That doesn't look like it's going to work at all. > > 1) 1 is pr

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 22:27:05 +0100 Nicolas Oury wrote: > On Sat, Jun 19, 2010 at 10:15 PM, Mike Meyer wrote: > > Pretty much any time I really need integer speed, I also deal with > > numbers that can get much larger than 10^19th, because I tend to be > > doing combinat

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 20:20:48 +0100 Nicolas Oury wrote: > Not "ordinary" code. 10^19 is big. No, Aleph-2 is big. Any non-infinite number you can name in your lifetime is small ;-). Pretty much any time I really need integer speed, I also deal with numbers that can get much larger than 10^19th, b

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
While I generally favor correct over fast (worrying about fast before you're correct is a good sign that you're engaged in premature optimization), I'm still trying to figure out the tradeoffs here. Especially since most LISPs & other dynamic languages don't seem to run into this issue - or at leas

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 10:43:36 -0400 David Nolen wrote: > On Sat, Jun 19, 2010 at 5:13 AM, Mike Meyer < > mwm-keyword-googlegroups.620...@mired.org> wrote: > > > > > > Were those real world programs, or arithmetic benchmarks? Most real world > > programs I see

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 11:00:39 +0100 Nicolas Oury wrote: > There is a bit of arithmetic involved everywhere, and around 2-3 double > operations per function in the part choosing the instance of rule to apply. That still sounds arithmetic-heavy to me. In looking through my code, I find three differ

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Nicolas Oury" wrote: >I tried it on my program. Very few arithmetic, most of it with annotation. >10% Can we see the source? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- You received this message because you are subscribed to the Google Groups "Clojure" group. T

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Nicolas Oury" wrote: >On the other hand, having boxed by default is a very significant slowdown >(10% on the strange program I tried, that had already a lot of annotations, >probably 20% or more on most programs), that can never be addressed : you >can't write annotations on every single line o

Re: Non-tail recursion (Clojure way to hierarchies)

2010-06-15 Thread Mike Meyer
On Tue, 15 Jun 2010 03:24:08 -0700 (PDT) Quzanti wrote: > You can use recur to build a hierarchy. What do you mean by you can't > use it as it is not the last statement? Exactly that. recur in some sense terminates the current call, and hence is required to be the last statement in the call. >

Re: RFC: clj-ds Clojure data structure for Java (et al.)

2010-06-13 Thread Mike Anderson
On Jun 8, 1:34 pm, Krukow wrote: > I would like to hear the groups opinion before (and if) I release this > to the general public. > > http://github.com/krukow/clj-ds I really like this approach. Not sure if it's any use, but I created a data structure library of my own in Java which may have so

Re: Complex type in clojure

2010-06-08 Thread Mike Meyer
[context tossed due to top posting.] On Tue, 8 Jun 2010 14:12:52 -0700 (PDT) Jason Smith wrote: > Why not just treat is as a vector, do vector math operations on it, > and be done with it? 1+2j is equivalent to [1 2]. 1+2j represents a > 2-D vector, does it not? Not only does this handle imag

Re: Complex type in clojure

2010-06-08 Thread Mike Meyer
On Tue, 8 Jun 2010 10:27:28 -0700 (PDT) Steven Devijver wrote: > On 8 jun, 16:38, Mike Meyer 620...@mired.org> wrote: > > > > Why? It isn't supported for rationals or exponents. Or are you > > claiming that because we support "3/4" we should also support &

Re: Complex type in clojure

2010-06-08 Thread Mike Meyer
On Tue, 8 Jun 2010 06:33:25 -0700 (PDT) Steven Devijver wrote: > On 8 jun, 05:47, Daniel wrote: > > These notation arguments are compelling. > > > > I'm not convinced. The notation would only work for literals, and how > often would one write literal complex numbers? > > For non-literals the no

Re: Clojure on the tiobe index

2010-06-04 Thread Mike Meyer
On Fri, 4 Jun 2010 11:59:46 -0700 (PDT) BerlinBrown wrote: > I don't think tiobe is all accurate index of anything. But when you > look at the actual rankings, they seem to line up, especially for the > mainstream languages. > > I could see where Delphi ranks high on the list. "Go" is a little

Re: apply with constructors

2010-06-02 Thread Mike Meyer
On Wed, 2 Jun 2010 13:33:30 +0200 Konrad Hinsen wrote: > Constructors calls translate directly to Java constructor calls, meaning that > the number of arguments must be known at compile time. > > Assuming your constructor takes a fixed number of arguments, the easiest > solution to your proble

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2010-05-30 Thread Mike Meyer
On Mon, 31 May 2010 10:53:45 +0930 Antony Blakey wrote: > > On 31/05/2010, at 10:44 AM, Marc Spitzer wrote: > > also lets not forget about LD_LIBRARY_PATH issues, > No Mac or Windows user would encounter these. You forget that the Mac is a Unix box. It supports LD_LIBRARY_PATH. In an ideal wor

Re: do clojure and la(tex) have something in common ?

2010-05-27 Thread Mike Meyer
On Thu, 27 May 2010 09:47:58 -0400 Tim Daly wrote: > Bill Hart, from the Sage project, said: > "Another thing I've been enjoying lately is literate >programming. Amazingly it turns out to be faster to >write a literate program than an ordinary program >because debugging takes almost

Re: promoting contrib.string to clojure, feedback requested

2010-05-26 Thread Mike Meyer
On Wed, 26 May 2010 19:47:25 +0200 Peter Schuller wrote: > > chomp => rtrim > > (rtrim "foo\n") => "foo" is much more clear to me, plus it leaves the > > door open for trim and ltrim functions should the need arise. > > I like this. And in general I often fine the entire trio useful, and > adopt

Re: do clojure and la(tex) have something in common ?

2010-05-25 Thread Mike Meyer
On Mon, 24 May 2010 11:50:41 -0700 (PDT) faenvie wrote: > hello mike, > hello tim > > thank you for this detailed insights into your experience > and knowledge. > > lately i had to implement a generator for a big catalog of > products and i used docbook for it, but tha

Re: do clojure and la(tex) have something in common ?

2010-05-23 Thread Mike Meyer
On Sun, 23 May 2010 06:55:50 -0700 (PDT) faenvie wrote: > today i read this statement in a blog-post: > > "... remarkably (La)TeX is much better suited for composing and > distributing most types of documents than any other modern > word processor on the market that I am aware of. Just like > pr

Re: Clojure on Android

2010-05-20 Thread Mike Meyer
[Format recovered from top posting. > On Thu, May 20, 2010 at 3:21 PM, rob levy wrote: > > On Thu, May 20, 2010 at 12:37 PM, David Blubaugh < > > davidblubaugh2...@gmail.com> wrote: > >> Has anyone yet ported clojure to the android cellphones at this > >> time ?? I want to develop applications f

Re: convert this to loop/recur?

2010-05-17 Thread Mike Meyer
On Mon, 17 May 2010 14:36:23 -0700 (PDT) Base wrote: > Hi All - > > I am trying convert a function to use loop/recur and am getting the > dreded > > "java.lang.UnsupportedOperationException: Can only recur from tail > position (repl-1:414)" error > > (at least dreded for newbies...) The "tail

Re: Style preference: (:key map) or (map :key)?

2010-05-17 Thread Mike DeLaurentis
I don't know if it's more common or not, but I tend to use (:key map) most of the time, because it's a visual cue that I'm getting some key from a map. Whenever you see (:key something), you know that you're getting the :key field from something. When you see (something :key), you have to be more

Re: How do I run a script? This has me stumped.

2010-05-15 Thread Mike Meyer
On Sat, 15 May 2010 22:13:17 +0200 Peter Schuller wrote: > > Which leads to the question: what's in Blah.clj? In particular, > > there's nothing in clojure that automatically run things in the script > > file; you have to explicitly invoke the main function at the end of > > the script. If you don

Re: How do I run a script? This has me stumped.

2010-05-15 Thread Mike Meyer
On Sat, 15 May 2010 21:54:53 +0200 Peter Schuller wrote: > > I am running the following command line: > > > > c:\apps\jdk1.6.0\bin\java.exe -server -cp "C:\apps\clojure-1.2.0\\lib > > \clojure-1.2.0-master-SNAPSHOT.jar;C:\apps\clojure-1.2.0\\lib\clojure- > > contrib-1.2.0-SNAPSHOT.jar" clojure.ma

Re: Annoying auto-signature

2010-05-11 Thread Mike Meyer
[format recovered from top postgin.] > > > On May 7, 2:13 am, Mibu wrote: > > > Am I the only one driven mad by the new auto-appended signature to > > > every message in this group ("You received this message because you > > > are subscribed...")? It started on April 16th. Is there a way a > > >

Re: ClojureCLR and WPF Data Binding

2010-05-08 Thread Mike K
nks for being a pathfinder on this. 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 po

Re: last-var-wins: a simple way to ease upgrade pain

2010-05-06 Thread Mike Meyer
On Wed, 5 May 2010 23:22:06 -0700 gary ng wrote: > On Wed, May 5, 2010 at 10:34 PM, Meikel Brandmeyer wrote: > > I'm deeply suspicious of such a behaviour. Why would + on a > > date mean adding days? Why not hours? minutes? seconds? > > months? years? I would always prefer plus-days over such a

Re: Funcalls vs. lists (Was: Clojure Concurrency Screencast Available)

2010-05-02 Thread Mike Meyer
On Sun, 2 May 2010 14:52:17 -0700 (PDT) Jarkko Oranen wrote: > On May 2, 11:14 pm, Mike Meyer 620...@mired.org> wrote: > > On Sun, 02 May 2010 13:06:56 +1000 > > To get behavior similar to the vector constructs, you want to use > > list, which works like vector, except

Funcalls vs. lists (Was: Clojure Concurrency Screencast Available)

2010-05-02 Thread Mike Meyer
On Sun, 02 May 2010 13:06:56 +1000 Alex Osborne wrote: > e writes: > > Can you imagine how disruptive it would be at this point to do it the > > other way around?  If you were starting out today without any Lisp > > baggage, it seems TOTALLY obvious to me that lists would have been (1 > > 2 3), a

Re: Does clojure.contrib.io.slurp work with binary files?

2010-04-29 Thread Mike Mazur
o > go down to the lower level Java classes and build a byte array using > InputFileStream and .read()? That's what I did for a small project. I did actually find c.c.io.to-byte-array[1] useful. HTH, Mike [1] http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/c

Re: seq-contains? in practice

2010-04-29 Thread Mike K
eing more explicit here? Thanks, 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.

Re: Testing equality

2010-04-28 Thread Mike DeLaurentis
Depending on what you're trying to do with paths, you may want to construct File objects and then get the paths from them. For example, (let [home (File. "/Users/Bill") bashrc (File . home ".bashrc")] (.getPath bashrc)) I think that tends to be less cumbersome than stringing path compo

Re: Datatypes and Protocols update

2010-04-24 Thread Mike Meyer
On Sat, 24 Apr 2010 06:51:18 -0700 (PDT) MarkSwanson wrote: > >> You can no > >> longer take a generic approach to information processing. This results > >> in an explosion of needless specificity, and a dearth of reuse." > > > For this reason, I've always found appealing languages which let you

Re: Execute a string containing a form?

2010-04-22 Thread Mike Mazur
s. You need to read the string first: user=> (read-string "(+ 1 1)") (+ 1 1) user=> (eval (read-string "(+ 1 1)")) 2 Mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: Clojure Concurrency Screencast Available

2010-04-20 Thread Mike Meyer
On Tue, 20 Apr 2010 06:47:05 -0700 (PDT) Mark Hamstra wrote: > Craig, I'm not Craig, but he's not answered yet, so... > 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

Re: Getting started with labrepl...

2010-04-10 Thread Mike Mazur
Hi, On Sat, Apr 10, 2010 at 12:19, Douglas Philips wrote: >  Run lein deps: >  $ lein deps >  No project.clj found in this directory. You need to run `lein deps` from within the labrepl directory. If you clone the labrepl repo, project.clj will be there. HTH, Mike -- You rece

Re: How do I call Foo.class?

2010-04-10 Thread Mike Mazur
Hi, On Sat, Apr 10, 2010 at 04:31, dknesek wrote: > So to be clear - I should be able to use: > > (. getEnrty entry-url PortfolioEntry) Is that typo in your code? s/getEnrty/getEntry/ Mike -- You received this message because you are subscribed to the Google Groups "Clojure&q

"Introduction to Monads in Clojure" tech talk

2010-04-08 Thread Mike T. Miller
Adam Smyczek's "Introduction to Monads" video is now available. http://www.youtube.com/user/LinkedInTechTalks?feature=mhw5#p/u/0/ObR3qi4Guys I'll work on getting an HD version up Friday. -mike -- You received this message because you are subscribed to the Google Groups

Re: Can I GPL my Clojure project?

2010-03-29 Thread Mike Meyer
[Format recovered from top posting.] On Mon, 29 Mar 2010 17:36:42 -0400 Aaron Cohen wrote: > On Mon, Mar 29, 2010 at 5:24 PM, Phil Hagelberg wrote: > > On Sat, Mar 27, 2010 at 9:55 PM, Mike Meyer > > wrote: > >> 5) Can I distribute a jar file for my Clojure project und

java.lang.AbstractMethodError with lazy deftypes (lazytest)

2010-03-28 Thread Mike Mazur
oto (my-spec))) #'bound-variable.core-test/my-result Which works. Now my-result contains what I wanted. Is this what doto is for? Thanks, Mike [1] http://github.com/stuartsierra/lazytest -- You received this message because you are subscribed to the Google Groups "Clojure&

Re: Can I GPL my Clojure project?

2010-03-27 Thread Mike Meyer
Ok, I'm not a copyright lawyer. I have spent a lot of time over the past three decades looking at licenses, and talking them over with lawyers, so I'd have no qualms acting on the advice below. But if you're serious about this, you need to talk to a real copyright lawyer. On Sat, 27 Mar 2010 18:44

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Mike K
> I would appreciate any feedback. According to the readme it requires bash or zsh. Any plans to support windows (without cygwin or other unix emulation)? I agree with Stuart that the user experience should be friendly on all supported platforms. Mike -- You received this message beca

Re: separating ui and content in clojure

2010-03-21 Thread Mike Meyer
[Context recovered from top-posting.] On Sun, 21 Mar 2010 10:31:58 -0700 Josh Stratton wrote: > On Sat, Mar 20, 2010 at 8:51 AM, Mike Meyer > wrote: > > On Sat, 20 Mar 2010 08:11:49 -0700 (PDT) > > strattonbrazil wrote: > > > >> I'd like to separate my

Re: separating ui and content in clojure

2010-03-20 Thread Mike Meyer
On Sat, 20 Mar 2010 08:11:49 -0700 (PDT) strattonbrazil wrote: > I'd like to separate my ui Swing/JOGL from the content, so my code is > relatively unaware of the UI around it. For example, I create a > global context that holds on my content. I then make a UI that when > the user does some int

Re: Long post with some questions about getting started...

2010-03-19 Thread Mike Meyer
On Fri, 19 Mar 2010 18:26:24 -0700 Terje Norderhaug wrote: > > > > *) InterLISP and some others were more like SmallTalk, or MS BASIC, in > >that you edited code at the REPL and saved the entire > >workspace. That did add power - I've never seen a file-based LISP > >whose error handler

Re: Long post with some questions about getting started...

2010-03-19 Thread Mike Meyer
On Fri, 19 Mar 2010 07:21:50 -0700 (PDT) Sean Devlin wrote: > > I'm having an interesting (to me) question around a using REPL.  Once > > it's shut down, where does this code go?  I feel like I'm in the old > > TRS-80 volatile coding days where you write some code, and if you shut > > down you've

Re: Clojure discuss

2010-03-14 Thread Mike Mazur
Hi, On Mon, Mar 15, 2010 at 07:21, Ulrich VACHON wrote: > Very interesting interview of Stuart Halloway about Clojure by Sadek > Drobi available on QCon website. Did you forget the link? http://www.infoq.com/interviews/stuart_holloway_clojure Mike -- You received this message becau

REPL, refs and casting

2010-03-10 Thread Mike Erickson
g at this for two days and can't figure it out. 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 y

What's an idiomatic translation of this CL data structure?

2010-03-09 Thread Mike K
rminals. Above I used lists vs vectors. If this were a non-toy app where I was optimizing for performance, would it make more sense to use vectors everywhere? If so, what would be a good succinct way to differentiate the two rule types? Could I add meta-data to the vector literals somehow? Or per

Help with Vimclojure & cojure-1.2.0-SNAPSHOT

2010-03-09 Thread Mike Mazur
rabbit hole of dependencies and build systems... I'm new to the whole Java ecosystem, so take it easy on me :P Thanks much! Mike [1] http://github.com/stuartsierra/lazytest [2] http://bitbucket.org/kotarak/vimclojure/ [3] http://www.gradle.org/ -- You received this message because you a

Re: Help with Vimclojure & cojure-1.2.0-SNAPSHOT

2010-03-09 Thread Mike Mazur
Hi, On Tue, Mar 9, 2010 at 22:55, Meikel Brandmeyer wrote: > On Mar 9, 3:49 pm, Mike Mazur wrote: > >> I tried to compile Vimclojure with clojure-1.2.0-SNAPSHOT, but the >> latest release fails to compile with a NoSuchMethodError. > > Can you be more specific on the

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

2010-03-07 Thread Mike K
Is anyone familiar with running Maven (and possibly Polygot Maven) on Windows? Does it pretty much work as expected? The learning curve for Maven looks steeper than for Leiningen, but if it makes up for it with better documentation and being better-behaved, then it may be worth it. Mike

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

2010-03-07 Thread Mike K
uggling with this issue, see the following thread. http://groups.google.com/group/clojure/browse_frm/thread/c4d00ba0f1614c49/3b4e04ef9fb0c8bf?lnk=gst&q=elpa+windows#3b4e04ef9fb0c8bf I ended the thread with a plea to Phil update the docs wrt this issue, but no movement on that front yet. M

Re: Default value for structure

2010-03-06 Thread Mike Mazur
truct-map st (:a 1 :b 2)). I didn't know how to fix this myself, but nteon on the IRC helped out and pointed me to apply. So, this definition now works for me: (defn my-struct-map [s & inits] (let [sm (apply struct-map s inits)] (if (= nil (sm :b)) (assoc sm :b 0.0) sm

Re: Data manipulation question

2010-03-05 Thread Mike Meyer
animals] (map (fn [{:keys [animal sound number-of-feet]}] (map #(hash-map :animal %1 :sound %2 :number-of-feet %3) (split animal #"\s") (split sound #"\s") (split number-of-feet #"\s"))) animals)) which

Re: clojure slides

2010-03-03 Thread Mike Mazur
Hi, On Thu, Mar 4, 2010 at 11:58, Wilson MacGyver wrote: > Looks like I'll be doing a talk on clojure next week at the local java > user group. > > Any recommendations on slides I can steal? :) There are some presentations in our google group file section[1]. Look for PDF

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread Mike Meyer
On Wed, 3 Mar 2010 14:20:56 -0800 (PST) Armando Blancas wrote: > > > On Mar 2, 8:34 pm, Sophie wrote: > > Do I design a single "World" ref whose state changes with time to > > different worlds, so adding a new Applicant or even adding a new Skill > > to an existing Applicant results in a new W

Re: objects, interfaces and library design

2010-03-03 Thread Mike Meyer
On Wed, 3 Mar 2010 09:47:09 -0800 (PST) cageface wrote: > I've been reading through the examples of "OO" in clojure using multi- > methods and they certainly seem very flexible and powerful. I'm > wondering, however, how people handle interface & library design. If > people can implement "objects

Re: ClojureCLR and swank-clojure: port to .NET or using IKVM?

2010-03-01 Thread Mike K
it may be useful to coordinate with him. Let me know if I can help in some way! 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 m

Milters?

2010-03-01 Thread Mike Meyer
Anyone doing milters in clojure? Are they reasonable to do on the JVM? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: difference between if/when

2010-02-28 Thread Mike Meyer
On Sun, 28 Feb 2010 14:18:50 -0800 Richard Newman wrote: > This is an interesting point, though -- does "unless" communicate > something slightly different to* "when not", despite being > functionally identical? And is the distinction important enough to > justify a move towards a confusing

Re: Extract tested stuff from REPL, can i ?

2010-02-27 Thread Mike Meyer
On Sat, 27 Feb 2010 03:42:04 -0800 (PST) uap12 wrote: > Hi! > I have installed ClojureBox with Emacs. > I test to write stuff, direct in the REPL, so is there som easy way of > get the function defined out, > i know i should write them in a src-file first but i would be nice > when just testing t

ClojureCLR status?

2010-02-25 Thread Mike K
have cutting edge things like protocols, reify, etc? Thanks, 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

Re: let and nesting

2010-02-25 Thread Mike Meyer
On Thu, 25 Feb 2010 16:28:05 -0800 (PST) kuniklo wrote: > One of my least favorite things about common lisp was the degree of > nesting it required for sequential variable definitions. For common > code like this: > > (let (a vala) > (b valb) > ... do something with a & b... > (le

Re: Map with multiple keys?

2010-02-23 Thread Mike Meyer
On Tue, 23 Feb 2010 16:09:29 -0800 (PST) Base wrote: > Hi All - > > So this may be an extraordinary dumb question (even for me...) but is > there such a thing as a map with compound keys? > > For example lets say that I have a data set that looks like > > CatGender item-Id'

Re: Common Lisp's append

2010-02-21 Thread Mike K
Thanks, I ended up using Allegro via Lispbox here. http://www.gigamonkeys.com/lispbox/#download 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 n

Re: Common Lisp's append

2010-02-21 Thread Mike K
v2)) true (recur (conj v1 (first v2)) (rest v2) (defn append [& vecs] (reduce join-vecs [] vecs)) user> (append '[a] '[] '[b [c]] '[d]) [a b [c] d] Is there a better / more idiomatic / more efficient way? Thanks, Mike P.S. I recently got the MEAP of &q

Map transmogrification functions?

2010-02-21 Thread Mike Meyer
In working through a recent project, I realized that Clojure has a nice collection of functions for working with maps. However, it doesn't seem to have analogues of some of the important sequence tools (filter and map most noticeably, probably others). Given that map will take a map as a collectio

Re: STM with deeper structure

2010-02-20 Thread Mike Meyer
On Sat, 20 Feb 2010 17:27:34 -0800 (PST) "sailormoo...@gmail.com" wrote: > Hi : > > Say, I have a (def *a (ref {:b [{:c 5}]})) . > I want to add 1 to the :c inside, how would I write? > (Note: the value 5 is in (:b 0 :c), while 0 is the array index) > > (dosync (alter *a __ )) ; ple

Common Lisp's append

2010-02-18 Thread Mike K
finition closer to the CL semantics? (use '[clojure.contrib.seq-utils :only (flatten)]) (defn append2 [& parts] (flatten (list parts))) (append2 '((a) b c) '(d e f) '() '(g)) -> (a b c d e f g) Finally, can anyone recommend a good free common lisp implementatio

Re: Question about how I got run?

2010-02-16 Thread Mike Meyer
On Tue, 16 Feb 2010 02:35:03 +0100 Michał Marczyk wrote: > On 16 February 2010 02:12, Mike Meyer > wrote: > > To bad. It's really handy, especially as it starts trickling into > > system modules. You get one file that provides the simple command line > > usage plus

Re: Question about how I got run?

2010-02-16 Thread Mike Meyer
On Tue, 16 Feb 2010 11:13:28 -0800 (PST) Daniel Werner wrote: > On Feb 16, 2:12 am, Mike Meyer 620...@mired.org> wrote: > > Wouldn't be hard to do, either. Just bind *script-name* (or some such) > > to the path in script-opt, and let the client decide if it's the sa

Re: Question about how I got run?

2010-02-15 Thread Mike Meyer
On Sun, 14 Feb 2010 22:32:45 -0800 (PST) ataggart wrote: > On Feb 14, 6:47 pm, Mike Meyer 620...@mired.org> wrote: > > So, the next question - possibly another name-space question. > > > > Is there any way to tell if inside a .clj file if it was invoked as a > &

Question about how I got run?

2010-02-14 Thread Mike Meyer
So, the next question - possibly another name-space question. Is there any way to tell if inside a .clj file if it was invoked as a script by clojure.main, vs. being loaded for use elsewhere? What I'd like to do is make my unit tests usable in two modes: While working on a bug, I'd like to be abl

A couple of namespace questions

2010-02-13 Thread Mike Meyer
I've got two questions about namespaces; one is pretty clojure-specific, the other possibly more related to java's classpath stuff. First, is there either a way to use names that exist in clojure.core? I.e., if wanted variable called map, can I get it somehow? If not, is there an idiom for such na

ClojureCLR under slime / emacs?

2010-02-13 Thread Mike K
Does anyone have ClojureCLR running under emacs via slime? Failing that, can anyone give me some pointers as to how I might hacking swank-clojure.el (or whatever) to get this to work? Mike -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Re: Prepping clojure for packaging (was: Re: Clojure for system administration)

2010-02-06 Thread Mike Meyer
On Sat, 6 Feb 2010 18:25:47 -0800 (PST) Constantine Vetoshev wrote: > On Feb 6, 1:06 pm, Peter Schuller wrote: > > But the practical issue > > remains that if I want to write some software that I want sysadmins in > > various situations to want to use effortlessly (in my case, a backup > > tool)

Re: compiled namespaces referencing each other

2010-02-06 Thread Mike Jarmy
OK, thanks guys On Sat, Feb 6, 2010 at 12:04 AM, ataggart wrote: > Circular references mean your namespace design is broken. > > -- > 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

compiled namespaces referencing each other

2010-02-05 Thread Mike Jarmy
at even during compilation, the order that functions are definied in a source file matter. That makes sense to me when a clj file is run as a script, but when clojure code is getting compiled, why should it matter which order things are defined in? Is this behavior related somehow to my compilation

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
@Richard: Yes, I think that makes sense. I am running into dependency problems when I try to split up the namespace -- my split-up files have a hard time refering to each other. So I think that file-per-namespace is the answer. @Sean: yes I will probably compile the app to a jar at some point. T

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
7;foo) (load "foo-util") (defn aaa [arg] (print (format "hello from aaa: %s\n" arg)) (util "FOO-A")) ;; foo-util.clj (in-ns 'foo) (defn util [arg] (print (format "hello from util: %s\n" arg))) On Fri, Feb 5, 2010 at 5:26 PM, Mike Jarmy wr

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
. I would say that the documentation does a good job on the lispy parts of clojure, but not so good of a job explaining namespaces, code organization, etc. On Fri, Feb 5, 2010 at 5:09 PM, Greg wrote: > Mike, I'd say this is not your fault. I'm a clojure newbie too and the answer &g

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
That yields ".;lib/clojure.jar", just as we'd expect. I also tried, "java -cp foo.clj;foo-util.clj;lib/clojure.jar clojure.main foo.clj", but that gave the same error. All of these classpaths work when I comment out the calls to "(require 'foo-util)" and "(frob)" -- which you would expect, since

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
you classpath.  If you're just getting started, I'd suggest using > Netbeans/Enclojure, as it handles the classpath stuff for you, and you > can focus on learning Clojure. > > On Feb 5, 3:41 pm, Mike Jarmy wrote: >> winXP, java 1.6 >> >> On Fri, Feb 5, 2010 at

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
winXP, java 1.6 On Fri, Feb 5, 2010 at 3:31 PM, Sean Devlin wrote: > What development environment are you using? > > On Feb 5, 1:57 pm, Mike Jarmy wrote: >> I'm writing a clojure program which is getting sort of large, so I'd >> like to split it up into separ

newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
I'm writing a clojure program which is getting sort of large, so I'd like to split it up into separate source files. However, I'm having trouble figuring out how to tell the files about each other's existence. I'd like all the source files to be in the same namespace. Can someone straighten me o

Re: Clojure Conference Poll

2010-02-03 Thread Mike T. Miller
So, Amit, any updates? Bear in mind that ICFP is Sept. 27-29 this year. -mike On Jan 28, 4:40 pm, Amit Rathore wrote: > The JavaOne alignment will probably work. The last time, we had a > special Bay Area Clojure meetup following it, and it was our biggest > ever (around 80 people).

Re: clojure.contrib compile fail

2010-01-30 Thread Mike Mazur
further information: > >    http://paste.lisp.org/display/94135 The automated build is also broken: http://build.clojure.org/job/clojure-contrib/lastFailedBuild/console Mike -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Question: Clojure & concurrency in large-scale problems.

2010-01-28 Thread Mike Meyer
On Thu, 28 Jan 2010 14:56:05 -0800 (PST) Francis Lavoie wrote: > I found that blog post that make a comparison between python and > clojure. > http://www.bestinclass.dk/index.php/2009/10/python-vs-clojure-evolving/ Note that the author has several of his facts wrong about Python, and looks at no

Re: apply macro to 'argument' list?

2010-01-28 Thread Mike Meyer
On Thu, 28 Jan 2010 15:08:18 -0800 Raoul Duke wrote: > > You can sometimes avoid the use of a macro by using alternative evaluation > > strategies, whether that's provided by odd calling semantics, by pervasive > > laziness (e.g., one can implement `if` in Haskell using a function), or by > > man

Re: clojure.contrib.test-contrib.test-jmx build error

2010-01-27 Thread Mike Hinchey
I've reported this problem before with openjdk, but sun's jdk works. -Mike On Wed, Jan 27, 2010 at 8:38 AM, Michał Marczyk wrote: > I've been getting this unpleasant error building clojure.contrib recently: > > http://paste.lisp.org/display/94000 > > I wonder if t

Re: Full Disclojure - I Need Topics!

2010-01-26 Thread Mike Meyer
On Sun, 24 Jan 2010 23:11:50 -0800 (PST) mac wrote: > > On 25 Jan, 06:50, Mark Engelberg wrote: > > Debugging techniques, including: > > * How to make sense of Clojure's stack traces. > > * How to use Java debugging and profiling tools with Clojure. > > +1 for this. I haven't had the energy to

Re: defn

2010-01-25 Thread Mike DeLaurentis
ith 1 argument, then the body of the function is: > > (factorial n 1) > > But if it is called with 2 arguments then the body of the function > is: > > (if (= n 0) acc > (recur (dec n) (* acc n))) > > Is this a standard feature of lisp? Sorry I am very noob

Re: defn

2010-01-25 Thread Mike DeLaurentis
That's defining a function factorial that can be called with either one or two arguments. When called with one argument, it immediately calls itself with two arguments. So the (factorial n 1) call provides acc with an initial value of 1. The ([n] and ([n acc] lines are the declarations of the pa

Re: Debugging in Clojure

2010-01-22 Thread Mike Meyer
On Fri, 22 Jan 2010 17:25:39 -0800 ajay gopalakrishnan wrote: > I dont mind using println. The problem is that needs to be inside a do or > when ... and that is not really part of my code. When the time comes to > remove the prints, i need to remove all these do blocks too. I can leave > them as

<    2   3   4   5   6   7   8   9   >