Re: Random elements

2009-02-11 Thread Phlex
Jason Wolfe wrote: Not yet, but perhaps soon. Code is here: http://code.google.com/p/clojure-contrib/issues/detail?id=8 -Jason Would you consider changing the names of these 2 functions ? random-permutation - shuffle random-element - one-of Shorter names are a trademark of clojure.

Re: Shouldn't all defs have a - version?

2009-03-23 Thread Phlex
On 23/03/2009 9:03, Mark Engelberg wrote: defn- is pretty useful. But wouldn't it be equally useful to have def-, defmulti-, defmacro-, etc.? I'm aware that it is possible to add the private tag to the metadata of the var, but in many code samples I've seen, people routinely get this wrong

Re: parallel iteration

2009-03-24 Thread Phlex
On 24/03/2009 1:06, pmf wrote: On Mar 24, 12:01 am, Rowdy Rednoserowdy.redn...@gmx.net wrote: Hi group, say I have 2 sequences (def seq-a '(a1 a2 a3)) (def seq-b '(b1 b2 b3)) and want to iterate over them in parallel, like this (par-doseq [a seq-a b seq-b] (prn a b)) which

Re: parallel iteration

2009-03-24 Thread Phlex
On 24/03/2009 15:10, Rowdy Rednose wrote: Thanks guys, these solutions look much better already. But do I always have to have these 2 steps * merge collection * split collection It feels a bit inefficient, I don't know if it actually is, though. Allright let's see what we can do : make a

Re: parallel iteration

2009-03-24 Thread Phlex
(defn par-doseq-fn [fn seqs] (loop [rests seqs] (when (every? identity (map seq rests)) (apply fn (map first rests)) (recur (map rest rests) It should of course be like this : (defn par-doseq-fn [fn seqs] (loop [rests seqs] (when (every? seq

Re: parallel iteration

2009-03-24 Thread Phlex
(defn par-doseq-fn [fn seqs] (loop [rests seqs] (when (every? identity (map seq rests)) (apply fn (map first rests)) (recur (map rest rests) It should of course be like this : (defn par-doseq-fn [fn seqs] (loop [rests seqs] (when

Re: Concerned about Clojure's license choice.

2008-11-02 Thread Phlex
James Reeves wrote: On Nov 2, 6:50 pm, Phlex [EMAIL PROTECTED] wrote: is a program I am doing using clojure considered as a derivative work ? http://www.linuxjournal.com/article/6366 Thank you, Sacha --~--~-~--~~~---~--~~ You received

prog1

2008-11-08 Thread Phlex
Hello, I was missing the prog1 macro from common lisp, so here it is. (defmacro prog1 [ body] (prog1 forms*) Evaluates all the forms, returning the result of the first form `(let [result# ~(first body)] ~@(rest body) result#)) user (prog1 a b c) a user (prog1) nil user (prog1 a)

Re: prog1

2008-11-08 Thread Phlex
Robert Pfeiffer wrote: Hello, Is there a benefit in implementing this as a macro instead of a function? The function version would be very simple: (defn returning [returnval body] returnval) Well no, the forms are evaluated. It's usefull for side effects. user (def *bleh* (ref

Re: prog1

2008-11-08 Thread Phlex
André Thieme wrote: On 8 Nov., 17:47, Phlex [EMAIL PROTECTED] wrote: Robert Pfeiffer wrote: Is there a benefit in implementing this as a macro instead of a function? The function version would be very simple: (defn returning [returnval body] returnval) Well

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

2009-01-25 Thread Phlex
How about compiling a closure tree ? ;; very basic example follows (defn make+ [param1 param2] (fn [environement] (+ (param1 environement) (param2 environement (defn make* [param1 param2] (fn [environement] (* (param1 environement) (param2 environement (defn make-variable

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

2009-01-25 Thread Phlex
Phlex wrote: How about compiling a closure tree ? ;; very basic example follows (defn make+ [param1 param2] (fn [environement] (+ (param1 environement) (param2 environement (defn make* [param1 param2] (fn [environement] (* (param1 environement) (param2 environement

(async/map identity []) blocks

2014-02-01 Thread Phlex
async/map is supposed to close its output channel when one of the channels in the collection signals that it is closed. I had assumed that it would do the same when the collection is empty, but it blocks (i witnessed that on clojurescript) Now it's easy to work around that but not very nice to

Re: Proposal: Promote clojure.contrib.def to a core lib

2009-08-20 Thread Phlex
On 14/08/2009 19:53, Jarkko Oranen wrote: I'm not sure whether defonce is useful enough that it should be moved to core, so I'll abstain. I use defonce and defonce- quite a lot. I'm all for inclusion of c.c.def in core. Sacha --~--~-~--~~~---~--~~

Re: roll call of production use?

2009-11-23 Thread Phlex
i'd be interested to hear who has successfully used clojure in production. Hello, 1- We have this license server, used to control the use of a professional software (this one written using delphi). This was tested with thousands of simutaneous connections, and has been working with no

Re: roll call of production use?

2009-11-23 Thread Phlex
1- We have this license server, used to control the use of a professional software (this one written using delphi). What are the ethics of using an open source product like Clojure to implement DRM restrictions for some other product? Seems there might be something a bit iffy

Re: Another newbie question

2011-11-06 Thread Phlex
On 6/11/2011 12:56, pron wrote: E.g., one developer may add a keyword to a map for one purpose, and another, use the same keyword for a different purpose. With classes, all data manipulation for a single type is located in one place, so such clashes can easily be prevented, let alone the fact

Re: call to idiomatic loop works as stand alone but not when wrapped in my function

2011-04-16 Thread Phlex
n 15/04/2011 01:21, Avram wrote: Yes, I am missing a way to turn the [ filenames] into something like name1 name2 … You also missed Joost's answer =) Use apply for this : user (+ 1 2 3) 6 user (apply + (list 1 2 3)) 6 So in your case : (apply read-files-into-memory fnames) hth, Sacha

Re: resultset-seq

2011-05-04 Thread Phlex
On 3/05/2011 23:58, Allen Johnson wrote: IMHO c.j.j/resultset-seq should perform something like the following: ;; i want my columns as strings exactly how they are in the db (resultset-seq rs) (resultset-seq rs identity) ;; i want my columns as lower-case keywords (resultset-seq rs (comp

algo.monad state-m fetch-val bug and efficiency issue

2012-09-07 Thread Phlex
I've been using the state monad in algo.monad, and found what i think is a bug in the fetch-val function. There is also an efficiency issue with this function. I was unable to contact a maintainer of this library on irc (though i didn't try very hard), So here is a gist with problem statement

Re: algo.monad state-m fetch-val bug and efficiency issue

2012-09-08 Thread Phlex
You sir are nitpicking on me ! On 9/09/2012 02:05, Stephen Compall wrote: https://gist.github.com/3667614 -(key s))) ;; only works for keyword keys +(key s))) ;; works for arbitrary functions You of course are right, the key parameter could be a function and this might be useful in

Re: algo.monad state-m fetch-val bug and efficiency issue

2012-09-10 Thread Phlex
On 10/09/2012 08:59, Konrad Hinsen wrote: The maintainer is me, and I am indeed not in IRC. Thanks for your suggestions, which I have applied to the source code repository. Konrad. Thanks you. Sacha -- You received this message because you are subscribed to the Google Groups Clojure

Re: A Design (Simplification) Problem

2013-11-13 Thread Phlex
Instead of making changes to your data structure, then creating an event, you could : -create a modification command as a data structure {:type :move :character-id 12 :move-to {some coords..}} -apply it to your data structure (each and every modification to the data structure would have to be