Re: Streams work

2009-01-23 Thread Konrad Hinsen
On 22.01.2009, at 19:50, Rich Hickey wrote: Does that mean that calling seq on a stream converts the stream into a seq for all practical purposes? That sounds a bit dangerous considering that so many operations in Clojure call seq implicitly. One can easily have a seq steal a stream and not

A nil puzzle

2009-01-23 Thread Mark Engelberg
The power set of a set S is defined as the set of all subsets of S. Here is one possible implementation of a powerset function. To stay true to the spirit of the above definition, I've written it in a way that manipulates the sets in set form as much as possible (not quite an easy task since

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread lpetit
Interesting. Are u sure joda-time is so widely in usage among java developers ? Anyway, as far as I remember, one of the benefits of clojure running on an existing VM (the JVM) is to leverage all the existing APIs. Since the date/time support would be in clojure-contrib (and not clojure-core),

dot and nums in keywords

2009-01-23 Thread Parth Malwankar
Hello, As per the docs for keywords ( http://clojure.org/reader ), keywords cannot contain '.'. They cannot contain '.' or name classes. However, the following works on the repl: user= :.. :.. user= (keyword? :..) true Are '.'s allowed and the docs need updating? Or should we see an

Re: A nil puzzle

2009-01-23 Thread Konrad Hinsen
On 23.01.2009, at 09:35, Mark Engelberg wrote: Now, here's the puzzle. Let's say you want to convert this idea over to working with lists, or perhaps sequences in general. Should (powerset '(1 2 3)) print as: (() (1) (2) (3) (1 2) (1 3) (2 3) (1 2 3)) or (nil (1) (2) (3) (1 2) (1 3) (2

Re: Agent as a processing queue

2009-01-23 Thread Timothy Pratley
On Jan 23, 11:24 am, e evier...@gmail.com wrote: wow.  I wonder if I could use this for the quicksort I was talking about. Interesting question. I can't think of an elegant way to implement an agent based parallel quicksort because await cannot be used recursively. So I implemented a version

Re: Streams work

2009-01-23 Thread Christophe Grand
Rich Hickey a écrit : Again, I don't see the enormous side effect. Steams form a safe, stateful pipeline, you'll generally only call seq on the end of the pipe. If you ask for a seq on a stream you are asking for a (lazy) reification. That reification and ownership is what makes the

Re: Streams work

2009-01-23 Thread Christophe Grand
Christophe Grand a écrit : I relaxed the constraint saying that a stream ensures that /*every call to seq on a stream will return the same seq to be */a stream ensures that /*every call to seq on a stream will return the same seq as long as the stream state doesn't change.*/ /*What did I

Re: Streams work

2009-01-23 Thread Christophe Grand
Christophe Grand a écrit : I relaxed the constraint saying that a stream ensures that every call to seq on a stream will return the same seq to be a stream ensures that every call to seq on a stream will return the same seq as long as the stream state doesn't change. Well currently it's

Re: dot and nums in keywords

2009-01-23 Thread Christophe Grand
Parth Malwankar a écrit : Hello, As per the docs for keywords ( http://clojure.org/reader ), keywords cannot contain '.'. They cannot contain '.' or name classes. http://groups.google.com/group/clojure/msg/eac27b0bd6f823f7 Rich Hickey: As far as '.', that restriction has been relaxed.

Re: what when (some identity maps) mean?

2009-01-23 Thread Stuart Halloway
I don't think the function passed to some should be called a predicate, since it is not constrained to true/false. The docstring agrees with you, however. Stuart Hi, It means that some of the maps can be nil, but at least one of them has to be non-nil. some requires a predicate, but

Re: A nil puzzle

2009-01-23 Thread MikeM
The power set function for lists should use () as the empty set. If you use nil, then it seems that you would have (powerset nil) = (nil) but this is wrong, since the only subset of an empty set is the empty set. You could try to fix this by making (powerset nil) = nil but then your

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread AndrewC.
On Jan 23, 8:41 am, lpetit laurent.pe...@gmail.com wrote: Interesting. Are u sure joda-time is so widely in usage among java developers ? I use it and so do all my friends :) I believe there are moves afoot to get it included in the JDK sooner or later. https://jsr-310.dev.java.net/

why does this work?

2009-01-23 Thread zoglma...@gmail.com
This is just something contrived I was playing around with and I know it is silly. I just have a couple of questions about it. (defn create-a [firstName lastName] (defn getFirstName [] firstName) (defn getLastName [] lastName) (fn [operator operands] (apply operator operands))) (def

Re: Agent as a processing queue

2009-01-23 Thread e
Thanks. I really appreciate seeing that example. There are more answers there than even the original question . . . like how easily you time the performance and how easily you make random lists of values. . . .also the use of remove in that code you grabbed to avoid having two filters is totally

Re: why does this work?

2009-01-23 Thread Achim Passen
Hi Kurt, Am 23.01.2009 um 05:23 schrieb zoglma...@gmail.com: (defn create-a [firstName lastName] (defn getFirstName [] firstName) (defn getLastName [] lastName) (fn [operator operands] (apply operator operands))) It's important to note that, regardless of the lexical context,

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread Mark Volkmann
On Fri, Jan 23, 2009 at 5:30 AM, AndrewC. mr.bl...@gmail.com wrote: On Jan 23, 8:41 am, lpetit laurent.pe...@gmail.com wrote: Interesting. Are u sure joda-time is so widely in usage among java developers ? I use it and so do all my friends :) I believe there are moves afoot to get it

Re: A nil puzzle

2009-01-23 Thread lpetit
+1. #{} is the empty set, () is the empty list, {} is the empty map. Cheers, -- Laurent On 23 jan, 10:17, Konrad Hinsen konrad.hin...@laposte.net wrote: On 23.01.2009, at 09:35, Mark Engelberg wrote: Now, here's the puzzle.  Let's say you want to convert this idea over to working with

Re: Basic about setting upp Clojure and editor enviroment

2009-01-23 Thread Peter Wolf
Or try the IntelliJ plugin, if you like that IDE http://code.google.com/p/clojure-intellij-plugin/ It works fine on Windows and Linux. We are currently fixing the Mac. P Matt Clark wrote: If you're not already an emacs user, I found it can be quite the learning curve getting into it. So

Re: Calling Clojure from Java (again)

2009-01-23 Thread lpetit
Hi, On 23 jan, 01:43, Peter Wolf opus...@gmail.com wrote: Hi Laurent, 1) Does Eclipse use the server for resolving references? Currently, the only resolved references are those that come from a clojure environment launched by the user. So yes. When time comes to resolve references for the

Re: Calling Clojure from Java (again)

2009-01-23 Thread lpetit
On 23 jan, 03:00, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Jan 22, 6:51 pm, Peter Wolf opus...@gmail.com wrote: However, if there is only one Clojure image used for references and the like, what happens if someone calls an infinite loop, or infinite recursion, in a file.  Does

Re: why does this work?

2009-01-23 Thread zoglma...@gmail.com
Hi Achim, I think I understand now. It's important to note that, regardless of the lexical context, def(n)   creates global/top-level definitions (contrary to scheme, i believe). (defn create-a [firstName lastName] (defn getFirstName [] firstName) (defn getLastName [] lastName) (fn

Re: Streams work

2009-01-23 Thread Rich Hickey
On Jan 23, 3:31 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 22.01.2009, at 19:50, Rich Hickey wrote: Does that mean that calling seq on a stream converts the stream into a seq for all practical purposes? That sounds a bit dangerous considering that so many operations in

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 7:20 AM, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Fri, Jan 23, 2009 at 5:30 AM, AndrewC. mr.bl...@gmail.com wrote: On Jan 23, 8:41 am, lpetit laurent.pe...@gmail.com wrote: Interesting. Are u sure joda-time is so widely in usage among java developers ? I

evalOnlyDefs

2009-01-23 Thread Peter Wolf
Looking for opinions from Clojure internals Wizards... I am thinking about safe loading for IDEs (see other thread). IDEs need a way to load and resolve code, without calling script code that might be in the file. I was looking the code called by load-file and load. Here is Compiler.eval()

Re: why does this work?

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 7:56 AM, zoglma...@gmail.com zoglma...@gmail.com wrote: It's important to note that, regardless of the lexical context, def(n) creates global/top-level definitions (contrary to scheme, i believe). (defn create-a [firstName lastName] (defn getFirstName [] firstName)

Re: Streams work

2009-01-23 Thread Rich Hickey
On Jan 23, 4:53 am, Christophe Grand christo...@cgrand.net wrote: Christophe Grand a écrit : I relaxed the constraint saying that a stream ensures that /*every call to seq on a stream will return the same seq to be */a stream ensures that /*every call to seq on a stream will return the

Re: Streams work

2009-01-23 Thread Rich Hickey
On Jan 22, 11:17 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 22.01.2009, at 16:27, Rich Hickey wrote: Now it works - fine. But what happened to the seq that now owns the stream? Nothing refers to it, so it should be gone. No, the stream must refer to it, in order to keep its

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread Mark Volkmann
On Fri, Jan 23, 2009 at 7:12 AM, Chouser chou...@gmail.com wrote: On Fri, Jan 23, 2009 at 7:20 AM, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Fri, Jan 23, 2009 at 5:30 AM, AndrewC. mr.bl...@gmail.com wrote: On Jan 23, 8:41 am, lpetit laurent.pe...@gmail.com wrote: Interesting. Are

Re: Streams work

2009-01-23 Thread Christophe Grand
Rich Hickey a écrit : I think you lose the game overall. I'm sorry if I sounded provocative, I was trying to better understand the model you propose with streams. Thanks for your answer: it made thinks clearer to me. With what you are proposing: (if (seq astream) (do-something-with

Re: function that takes primitives?

2009-01-23 Thread Rich Hickey
On Jan 22, 6:16 pm, Korny Sietsma ko...@sietsma.com wrote: Hi folks, Is there any way to make a function that takes primitive parameters? It seems you can't, but I might be missing something. I have the following code (a start to playing with mandelbrot sets): (defn step [x0, y0, xn, yn]

Joda Time library

2009-01-23 Thread Mark Volkmann
Since we've been discussing using the Joda Time library from Clojure ... if anyone is interested in a quick intro. to the Joda Time library, I have a PDF of some slides I put together for a recent project at http://www.ociweb.com/mark/programming/JodaTime.pdf. -- R. Mark Volkmann Object

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread Mark McGranaghan
Joda Time is also a good fit for Clojure because all features in the library have a functional implementation, whereas the current built-in Java classes tend to use non-functional/non-threadsafe mechanisms. - Mark M. On Fri, Jan 23, 2009 at 9:14 AM, Mark Volkmann r.mark.volkm...@gmail.com

Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Zak Wilson
I'm trying my hand at genetic programming. (Full post about why and how, with code coming soon - I promise.) My current technique uses a genetic algorithm to generate a list of symbols, numbers and other lists of the same form. The head is the name of any of several functions. I'm trying to

Re: Joda Time library

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 9:41 AM, Mark Volkmann r.mark.volkm...@gmail.com wrote: Since we've been discussing using the Joda Time library from Clojure ... if anyone is interested in a quick intro. to the Joda Time library, I have a PDF of some slides I put together for a recent project at

Re: A nil puzzle

2009-01-23 Thread Stephen C. Gilardi
There was a recent suggestion here: http://groups.google.com/group/clojure/msg/32d323e15f8ce624 about the proper value of: (clojure.contrib.lazy-seqs/combinations) (and perhaps by extension (clojure.contrib.lazy-seqs/combinations '()) (or any number of empty seq arguments))

Re: why does this work?

2009-01-23 Thread zoglma...@gmail.com
Thanks Chouser, No, I really didn't have any intentions with this example. I was merely exploring around. In hindsight it is also obvious why this works. (defn foo[] (defn bar [x] (* x 2)) nil) (foo) (bar 2)--- returns 4 I just didn't realize initially what was going on... that defn

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Stuart Sierra
Hi Zak, I think this is a reasonable use of eval, since you're evaluating an expression that is generated at run-time. The alternatives are messy. -Stuart Sierra On Jan 23, 10:20 am, Zak Wilson zak.wil...@gmail.com wrote: I'm trying my hand at genetic programming. (Full post about why and

Re: evalOnlyDefs

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 8:38 AM, Peter Wolf wrote: Looking for opinions from Clojure internals Wizards... I can think of only one Clojure internals Wizard, but I have some thoughts. I am thinking about safe loading for IDEs (see other thread). IDEs need a way to load and resolve code,

Embed Clojure in OSGi Bundles

2009-01-23 Thread gaetan
Hi everybody, I am working in a software company specialized in Eclipse based product development (and member of the Eclipse Fundation). We are very interesting in clojure features and we plan to use it in some of our products. I am currently working on clojure integration in OSGi Bundles in

Re: evalOnlyDefs

2009-01-23 Thread Konrad Hinsen
On Jan 23, 2009, at 17:15, Stephen C. Gilardi wrote: I recently changed my user.clj file to be purely full of definitions. I think it fits well with the require/use model that reloading ought to only affect what's available to call after the load, not actually do (in the Clojure

Re: Embed Clojure in OSGi Bundles

2009-01-23 Thread Laurent PETIT
Hello Gaetan, I'm one of the core developers of clojuredev, an open source project whose goal is to provide clojure support for the Eclipse IDE. What you say below is interesting, please see what I have noted inline -- 2009/1/23 gaetan gaetan.mor...@gmail.com Hi everybody, I am working in a

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Konrad Hinsen
On Jan 23, 2009, at 16:20, Zak Wilson wrote: that appear in these lists and evaluate them as code. My current technique looks like this: (def a) (def b) (defn try-rule [r val-a val-b] (binding [a val-a b val-b] (eval r))) and an example call looks like:

IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-23 Thread Peter Wolf
For those who like IntelliJ, a new version of the plugin is available. This one has numerous fixes, but is mostly interesting because the Debugger and Profiler work (or at least JProfiler). The Debugger and Profiler currently treat Clojure as compiled Java, and don't know how to go from

Re: IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-23 Thread Laurent PETIT
Hello, Could you place some screenshots in a wiki page ? I'm too lazy to install IntelliJ yet, but maybe with some appealing screenshots I could change my mind ;-) Thanks, -- Laurent 2009/1/23 Peter Wolf opus...@gmail.com For those who like IntelliJ, a new version of the plugin is

Installing SLIME and friends

2009-01-23 Thread Phil Hagelberg
So I've noticed one of the most common questions in #clojure from beginners is how to install SLIME. Working with SLIME can be messy work[1], so I've written some functionality to help out with that. If you check out my installer branch of clojure-mode[2] you can see the clojure-install command

Re: Streams work

2009-01-23 Thread e
people who love doing stream processing would attack an extra allocation. On Fri, Jan 23, 2009 at 12:09 PM, Konrad Hinsen konrad.hin...@laposte.netwrote: On Jan 23, 2009, at 14:04, Rich Hickey wrote: Then why not make a pipeline using lazy sequences right from the start? I don't see

Re: A nil puzzle

2009-01-23 Thread Jason Wolfe
On Jan 23, 7:34 am, Stephen C. Gilardi squee...@mac.com wrote: There was a recent suggestion here:        http://groups.google.com/group/clojure/msg/32d323e15f8ce624 about the proper value of:         (clojure.contrib.lazy-seqs/combinations) (and perhaps by extension

newbie Q: what's wrong with this?

2009-01-23 Thread wubbie
Hi, I got the following and don't know what's wrong with it. thanks in advance. user= (defn sum [ more ] ((fn [total other] (if other (recur (+ total (first other)) (rest(other))) total)) 0 more)) #'user/sum user= (sum [1 2 3 4]) java.lang.ClassCastException:

Re: Another socket repl

2009-01-23 Thread Phil Hagelberg
Craig McDaniel craig...@gmail.com writes: I wonder if it wouldn't be a good idea to move the call to binding fromsocket-replinto accept-fn. It seems like a reasonable default to rebind *in* and *out* for the duration of the accepting function; the example uses this as does my application.

Re: (clojure.contrib.lazy-seqs/combinations) should return [[]], not nil?

2009-01-23 Thread Jason Wolfe
Just to clarify: I dont' care what the type of the output is. I guess (seq [[]]) would actually be more consistent with the existing function. The point is that the output of 0-arg combinations should be a seq containing an empty vector (or whatever other types, I don't care), not an empty seq.

Re: newbie Q: what's wrong with this?

2009-01-23 Thread wubbie
Thanks Jason. Anyway I'd like to have (sum) returns 0 so I used [ more]. Is there any way to specify 0 or more args? -sun On Jan 23, 12:49 pm, Jason Wolfe jawo...@berkeley.edu wrote: Two mistakes: First, if you want sum to take a vector, you should remove the from the arglist. Second,

Re: evalOnlyDefs

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 11:52 AM, Konrad Hinsen wrote: Some questions this raises: - Should libs be restricted to definitions (and lib support things like ns and (some kind of) load-resource) only? - Should the appearance of an ns form automatically make that restriction enforced for the rest of

Re: (clojure.contrib.lazy-seqs/combinations) should return [[]], not nil?

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 12:53 PM, Jason Wolfe wrote: Just to clarify: I dont' care what the type of the output is. I guess (seq [[]]) would actually be more consistent with the existing function. The point is that the output of 0-arg combinations should be a seq containing an empty vector (or

Re: Basic about setting upp Clojure and editor enviroment

2009-01-23 Thread anderspe
Thanks for clojure-dev that was exaktly what i was looking for. I have first a problem get it running, the reason was i download EasyEclipse-JavaDesktop on Vista it have problem both with clojure-dev and internal update, and still i dide't install it in Program Files I removed it and download

Re: (clojure.contrib.lazy-seqs/combinations) should return [[]], not nil?

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 1:11 PM, Stephen C. Gilardi wrote: I'd be interested in hearing from Chouser before making the change. He added combinations to lazy-seqs. I think it's quite cool that simply removing the when accomplishes this. --Steve smime.p7s Description: S/MIME cryptographic

Re: Embed Clojure in OSGi Bundles

2009-01-23 Thread Gaetan Morice
Hello Laurent, thank you for your interest. 2009/1/23 Laurent PETIT laurent.pe...@gmail.com Hello Gaetan, I'm one of the core developers of clojuredev, an open source project whose goal is to provide clojure support for the Eclipse IDE. What you say below is interesting, please see what I

bug? tree-seq assumes the root is a branch

2009-01-23 Thread Christophe Grand
tree-seq assumes the root is a branch: user= (tree-seq (constantly false) seq [1 2 3]) ([1 2 3] 1 2 3) ; I expected ([1 2 3]) Is this a bug? Christophe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure

Re: bug? tree-seq assumes the root is a branch

2009-01-23 Thread Christophe Grand
Christophe Grand a écrit : tree-seq assumes the root is a branch: user= (tree-seq (constantly false) seq [1 2 3]) ([1 2 3] 1 2 3) ; I expected ([1 2 3]) Is this a bug? I know it's documented but I don't understand why. --~--~-~--~~~---~--~~ You received

Re: newbie Q: what's wrong with this?

2009-01-23 Thread vthakr
Hi Wubble, Looking at the code you have above I thought I might point out that rather than create an anonymous function inside of sum and then call it immediately after finishing its description, you could just use the loop/recur construct which is much more idiomatic clojure code. If you decide

Regarding (.keySet {:a :map})

2009-01-23 Thread Christian Vest Hansen
I type this expression in the REPL (trunk 1228): user= (let [s (.keySet {:a 1})] [(set? s) (ifn? s)]) [false false] But I expected it to return [true true]. Is this an oversight, or is there a good reason for this behavior? -- Venlig hilsen / Kind regards, Christian Vest Hansen.

Printing Strings in Lists

2009-01-23 Thread Kevin Albrecht
Below are two operations that print (1 2 3 4). How can I do something similar to print (1 2 3 4) to standard out? (println '(1 2 3 4)) - (1 2 3 4) (def x 1 2 3) (println `(~x 4)) - (1 2 3 4) --Kevin Albrecht --~--~-~--~~~---~--~~ You received this message

Re: newbie Q: what's wrong with this?

2009-01-23 Thread Paul Mooser
Clojure supports functions with multiple arities (http://clojure.org/ functional_programming). Assuming you don't actually care if you call the function with a vector, you can do something like this: (defn sum ([] 0) ([acc r] (if (nil? r) acc (recur (+ acc (first r))

Re: Possible feature: consider aliases when reading namespace-qualified keywords.

2009-01-23 Thread Jason Wolfe
On Jan 19, 4:29 pm, Jason Wolfe jawo...@berkeley.edu wrote: I've been doing some OO-type Clojure programming, and have run into the following (quite minor) annoyance: I've defined a struct with a :class of ::Foo in namespace my.long.namespace.foo. In another namespace

Re: Printing Strings in Lists

2009-01-23 Thread Kevin Downey
prn On Fri, Jan 23, 2009 at 11:00 AM, Kevin Albrecht onlya...@gmail.com wrote: Below are two operations that print (1 2 3 4). How can I do something similar to print (1 2 3 4) to standard out? (println '(1 2 3 4)) - (1 2 3 4) (def x 1 2 3) (println `(~x 4)) - (1 2 3 4) --Kevin

reader macros

2009-01-23 Thread Mark Volkmann
Are all of these considered reader macros? ; (comment) @ (deref) ^ (get metadata) #^ (add metadata) ' (quote) #... (regex) ` (syntax quote) ~ (unquote) ~@ (unquote splicing) #' (var quote) #{...} (set) #(...) (anonymous function) Is it correct that these are not considered reader macros? \

Re: Printing Strings in Lists

2009-01-23 Thread Kevin Albrecht
Ah, exactly what I was looking for, thanks. On Jan 23, 11:15 am, Kevin Downey redc...@gmail.com wrote: prn On Fri, Jan 23, 2009 at 11:00 AM, Kevin Albrecht onlya...@gmail.com wrote: Below are two operations that print (1 2 3 4).  How can I do something similar to print (1 2 3 4) to

Re: Streams work

2009-01-23 Thread chris
I work for NVIDIA doing 3d graphics engines and editor platforms on both PC and embedded platforms. Konrad, the extra memory allocation is often the difference between something fitting inside a cache line on a CPU and hitting main ram. Last time I looked, I believe the difference is a factor of

Re: Basic about setting upp Clojure and editor enviroment

2009-01-23 Thread Laurent PETIT
2009/1/23 anderspe anders.u.pers...@gmail.com Thanks for clojure-dev that was exaktly what i was looking for. I have first a problem get it running, the reason was i download EasyEclipse-JavaDesktop on Vista it have problem both with clojure-dev and internal update, and still i dide't

Re: Embed Clojure in OSGi Bundles

2009-01-23 Thread Laurent PETIT
OK, I understand better now, I think. Did you experience the problems you have exposed ? Or is it an anticipation of problems ? If so, can you expose the tests data, so that one can also experiment with them ? 2009/1/23 Gaetan Morice gaetan.mor...@gmail.com Hello Laurent, thank you for your

Not nil and 'true' with conditional functions

2009-01-23 Thread BerlinBrown
Here is some code, my question relates to '(not (nil?...': (if (not (nil? (regex-search-keyword (regex-get-text) line))) (add-select-style styles-vec all-bold) (add-select-style styles-vec light))) Could I have done the following or is (not (nil? ... a better approach.

Re: Not nil and 'true' with conditional functions

2009-01-23 Thread Vincent Foley
The only two false values in Clojure are false and nil. Everything else is logically true. If your function returns nil/false or a result, you don't need (not (nil? (...))) On Jan 23, 2:59 pm, BerlinBrown berlin.br...@gmail.com wrote: Here is some code, my question relates to '(not (nil?...':

Re: Not nil and 'true' with conditional functions

2009-01-23 Thread wubbie
Is every function supposed to return something? Of course, except for pure side-effects. -sun On Jan 23, 3:02 pm, Vincent Foley vfo...@gmail.com wrote: The only two false values in Clojure are false and nil.  Everything else is logically true.  If your function returns nil/false or a

Re: Proposal: smarter set operations that take size into account for speed

2009-01-23 Thread Jason Wolfe
OK, if these are not wanted in core right now, will anyone sign off for adding them to clojure.contrib? I can't say I like the idea of having two sets of functions that do exactly the same thing, but ... sometimes you just don't want things to run ~1000 times slower than they should. -Jason

Re: IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-23 Thread Francesco Bellomi
I installed it and it works really well, -- thanks to the authors for their work. btw, I installed it directly on my mac, without building it. Francesco On Jan 23, 6:08 pm, Peter Wolf opus...@gmail.com wrote: For those who like IntelliJ, a new version of the plugin is available.   This one

contains

2009-01-23 Thread Mark Volkmann
This must be something I learned months ago and then forgot ... embarassing! What's the easiest way to determine if a sequence contains a given value? I thought there would be something like this: (include? [2 4 7] 4) - true That doesn't exist. I know I can do this: (some #{4} [2 4 7]) Having to

Re: contains

2009-01-23 Thread Justin Johnson
On Fri, Jan 23, 2009 at 2:32 PM, Mark Volkmann r.mark.volkm...@gmail.comwrote: This must be something I learned months ago and then forgot ... embarassing! What's the easiest way to determine if a sequence contains a given value? I thought there would be something like this: (include? [2 4

Re: contains

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 3:39 PM, Justin Johnson ajustinjohn...@gmail.com wrote: On Fri, Jan 23, 2009 at 2:32 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: This must be something I learned months ago and then forgot ... embarassing! What's the easiest way to determine if a sequence

Re: contains

2009-01-23 Thread Mark Volkmann
On Fri, Jan 23, 2009 at 2:39 PM, Justin Johnson ajustinjohn...@gmail.com wrote: On Fri, Jan 23, 2009 at 2:32 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: This must be something I learned months ago and then forgot ... embarassing! What's the easiest way to determine if a sequence

Re: License of/permission for Clojure's logo

2009-01-23 Thread Jason Riedy
And Rich Hickey writes: You can use the logo on the wikipedia article on Clojure, but only if you spell my name correctly :) May I use the logo for the identi.ca group? ( http://identi.ca/group/clj ) Jason --~--~-~--~~~---~--~~ You received this message

Re: contains

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 3:47 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: (contains? aeiou letter) but that doesn't work either. user= (some (set aeiou) dn'tndthsstinkngvwls) \i Or, if you must, user= (clojure.contrib.seq-utils/includes? aeiou \o) true --Chouser

Re: contains

2009-01-23 Thread Mark Volkmann
On Fri, Jan 23, 2009 at 2:45 PM, Chouser chou...@gmail.com wrote: On Fri, Jan 23, 2009 at 3:39 PM, Justin Johnson ajustinjohn...@gmail.com wrote: On Fri, Jan 23, 2009 at 2:32 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: This must be something I learned months ago and then forgot ...

Re: Proposal: smarter set operations that take size into account for speed

2009-01-23 Thread Mark Engelberg
On Fri, Jan 23, 2009 at 12:23 PM, Jason Wolfe jawo...@berkeley.edu wrote: OK, if these are not wanted in core right now, will anyone sign off for adding them to clojure.contrib? Well, *I* want these changes you've proposed in the core, but of course, I'm not in charge. I guess the real

Re: reader macros

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 2:17 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: Are all of these considered reader macros? [snip] Is it correct that these are not considered reader macros? I don't see any distinction made in the code:

Re: Proposal: smarter set operations that take size into account for speed

2009-01-23 Thread Cosmin Stejerean
On Fri, Jan 23, 2009 at 2:52 PM, Mark Engelberg mark.engelb...@gmail.comwrote: On Fri, Jan 23, 2009 at 12:23 PM, Jason Wolfe jawo...@berkeley.edu wrote: OK, if these are not wanted in core right now, will anyone sign off for adding them to clojure.contrib? Well, *I* want these

Re: function that takes primitives?

2009-01-23 Thread Albert Cardona
Currently, there is no way to write a function that takes/returns primitives, all of the signatures are Object based. And please keep them so! Turtles all the way down solves many, many problems. For performance, whoever in need, just cache the int/float/double/etc. values locally.

Re: contains

2009-01-23 Thread Mark Volkmann
On Fri, Jan 23, 2009 at 2:51 PM, Chouser chou...@gmail.com wrote: On Fri, Jan 23, 2009 at 3:47 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: (contains? aeiou letter) but that doesn't work either. user= (some (set aeiou) dn'tndthsstinkngvwls) \i Why does this work (some (set

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Zak Wilson
It does seem like a legitimate use for eval, at least at first glance. The biggest problem is that using eval this way is really slow when each rule is being tested on hundreds of inputs. Interesting alternative, Konrad. I can probably take advantage of the fact that all of the functions I'm

Re: contains

2009-01-23 Thread Stuart Halloway
Hi Mark, set takes a single argument, a coll, and #{} is a literal form that can have a variable number of args. To make them equivalent: (set aeiou) - #{\a \e \i \o \u} #{(seq aeiou)} - #{(\a \e \i \o \u)} Stuart On Fri, Jan 23, 2009 at 2:51 PM, Chouser chou...@gmail.com wrote: On

Re: contains

2009-01-23 Thread wwmorgan
#{aeiou} is the set containing the String aeiou. You want #{\a \e \i \o \u} On Jan 23, 4:04 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Fri, Jan 23, 2009 at 2:51 PM, Chouser chou...@gmail.com wrote: On Fri, Jan 23, 2009 at 3:47 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote:

Re: IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-23 Thread Peter Wolf
You are more than welcome. Enjoy! I am interested that it works on your Mac. Others have reported problems (but not with this particular JAR). What version of Mac and IntelliJ are you using? Peter Francesco Bellomi wrote: I installed it and it works really well, -- thanks to the

Re: evalOnlyDefs

2009-01-23 Thread Konrad Hinsen
On 23.01.2009, at 19:04, Stephen C. Gilardi wrote: is something that ultimately invokes def. On the way to invoking def, one could also allow compiling code, but not running it, deferring initializers until some kind of load time. Macros present a problem with this strategy, of course,

Re: contains

2009-01-23 Thread Mark Volkmann
I'm trying to implement pig latin using only what's in core in the simplest way possible. Does anyone see a simpler way? I'm not happy with using three functions (some, set and str) to determine if a letter is a vowel. (defn pig-latin [word] (let [first-letter (first word)] (if (some (set

Re: contains

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 4:04 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: Why does this work (some (set aeiou) e) but this doesn't (some #{aeiou} e) I thought (set ...) was equivalent to #{...}. (hash-set ...) is equivalent to #{...} 'set' takes a single collection as an

Re: reader macros

2009-01-23 Thread Mark Volkmann
On Fri, Jan 23, 2009 at 3:00 PM, Chouser chou...@gmail.com wrote: On Fri, Jan 23, 2009 at 2:17 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: Are all of these considered reader macros? [snip] Is it correct that these are not considered reader macros? I don't see any distinction made

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Kevin Downey
instead of using binding and eval, you can generate a (fn ) form, eval it, keep the result function stuffed away somewhere and apply it instead of calling eval all the time On Fri, Jan 23, 2009 at 1:10 PM, Zak Wilson zak.wil...@gmail.com wrote: It does seem like a legitimate use for eval, at

Re: Proposal: smarter set operations that take size into account for speed

2009-01-23 Thread Jason Wolfe
On Fri, Jan 23, 2009 at 12:23 PM, Jason Wolfe jawo...@berkeley.edu wrote: OK, if these are not wanted in core right now, will anyone sign off for adding them to clojure.contrib? Well, *I* want these changes you've proposed in the core, but of course, I'm not in charge. Thanks. I

Re: Possible feature: consider aliases when reading namespace-qualified keywords.

2009-01-23 Thread David Nolen
Nice :) On Fri, Jan 23, 2009 at 2:10 PM, Jason Wolfe jawo...@berkeley.edu wrote: On Jan 19, 4:29 pm, Jason Wolfe jawo...@berkeley.edu wrote: I've been doing some OO-type Clojure programming, and have run into the following (quite minor) annoyance: I've defined a struct with a :class of

Re: Not nil and 'true' with conditional functions

2009-01-23 Thread Jason Wolfe
Every clojure function returns a value. Even if it is only used for side effects, it still has to return something (probably nil). -Jason On Jan 23, 12:17 pm, wubbie sunj...@gmail.com wrote: Is every function supposed to return something? Of course, except for pure side-effects. -sun On

Simple lisp like idiom in clojure, call function and keep the result

2009-01-23 Thread BerlinBrown
What is an idiom to call a function and also retain the result. For example, I see myself doing this a lot, but it seems to more code than would be needed. (let [a (some-func)] (when a (println (a dosomething - I wish I could avoid having to use the 'let' in this case I guess

  1   2   >