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 [
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]
>
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 c
Tim Martin wrote:
> Hi all,
> ...
>
The JDialog contructor takes a parameter that will tell it to be a modal
window.
(ns cara.gui.dialog-test
(:import [javax.swing JDialog JTextField JButton AbstractAction]))
(defn- create-and-show [data-ref]
(let [dialog (new JDialog (@data-ref :owner)
Jason Wolfe wrote:
> You're right, they should probably live in seq_utils.clj instead.
> I'll post an issue to move them.
>
> If anyone has strong feelings about names, now would be a good time to
> air them. My inclination is to leave the names as they are now; while
> "shuffle" is the na
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
On 24/03/2009 1:06, pmf wrote:
> On Mar 24, 12:01 am, Rowdy Rednose 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))
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 :
m
> (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?
>> (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 se
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
--~--~-~--~~~---~--~---
> 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 hicc
> 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 if
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 do
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
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,
Sa
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 keyw
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
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 so
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" gro
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 t
You're not playing with decimal values but rather with floating point
numbers.
user> (type 0.1)
java.lang.Double
Floating point numbers have well known rounding errors when converting
to decimal.
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
you might want to use actual decim
[EMAIL PROTECTED] wrote:
> The biggest problem I see with this license is that it is
> not
> compatible with the GPL.
I would hate to see clojure adopting the GPL.
About the CPL (clojure's license) : is a program I am doing using
clojure considered as a derivative work ?
Sacha
--~--~-
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/art
Chouser wrote:
> On Mon, Nov 3, 2008 at 9:13 AM, Chanwoo Yoo <[EMAIL PROTECTED]> wrote:
>
> Another option is ~'foo which would
> explicitly capture "foo" from the context where the macro is expanded.
>
> --Chouser
>
>
Nice ! I couldn't find this in the documentation.
Thanks,
Sacha
--
David Nolen wrote:
> (defmacro foobar []
> `'(+ a b))
>
> (let
> [a 5
> b 6]
> (eval (foobar)))
>
>
>
-You should almost never have to use eval.
-Don't use macros when a function will do
Thanks to the answer of chooser a bit earlier :
cara.trie> (defmacro foobar [] `(+ ~'a ~'b)
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
us
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
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:
>&g
29 matches
Mail list logo