Hi,
On Feb 9, 12:13 am, aria42 wrote:
> Is it possible to have default implementations associated with
> functions in a protocol? This is most useful when some protocol
> functions are defined in terms of other. For instance,
>
> (defprotocol Span
> (start [self])
> (stop [self])
> (span-
Hi,
maybe I don't understand the problem. Why can't the system provide
some kind of local repository? The package system (deb, rpm, ports,
whatever) just installs the dependencies there. A wrapper script reads
in the dependencies and adds them to the classpath on program start.
Nothing is download
>
> IMHO Ruby (and probably python) do this better than Clojure, though
> I'm not sure if we'll ever be able to find a solution we can all agree
> on.
>
Groovy has a very decent solution to the classpath issue for scripts.
Details can be found at http://groovy.codehaus.org/Grape . It might be
wort
On Feb 8, 2010, at 6:13 PM, aria42 wrote:
> Is it possible to have default implementations associated with
> functions in a protocol? This is most useful when some protocol
> functions are defined in terms of other. For instance,
>
> (defprotocol Span
> (start [self])
> (stop [self])
> (span-l
That seems like what I'm after, thanks. I assume this would be pretty
reliable across all platforms running the JVM.
By the way, I did google the Java API with various keywords but never
cam across this object property.
Thanks
On Feb 9, 11:33 am, Timothy Pratley wrote:
> On 9 February 2010 11:2
On 9 February 2010 11:29, Wardrop wrote:
> I'm wondering if there's anyway in Clojure, that one can detect the
> number of available processoring threads
(.availableProcessors (Runtime/getRuntime)) might be what you are after?
--
You received this message because you are subscribed to the Googl
I'm wondering if there's anyway in Clojure, that one can detect the
number of available processoring threads (ie. 4 core cpu with
hyperthreading would equal 8 available threads). This will allow me to
have a scalable processing app which can run on a single core CPU, or
250 core processor, without
Look at clojure-contrib. In the 1.1 release, use duck-streams and
java-utils. In the latest github sources, it's all in
clojure.contrib.io.
-SS
On Feb 8, 5:43 pm, Vadim Shender wrote:
> Hi.
>
> Is there any clojure third-party library functionally similar to python's
> os.path? Using java.io.F
On Feb 8, 6:13 pm, aria42 wrote:
> (defprotocol Span
> (start [self])
> (stop [self])
> (span-length [self]))
>
> Now I know I can just make span-length a function on Span as opposed
> to part of the protocol. Is that what one should do?
Yes.
-SS
--
You received this message because you
On 5 February 2010 18:47, Peter Schuller wrote:
>> I've been wondering about this. The classpath issue seems like a
>> major thorn in the side of the JVM, especially for Clojure and other
>
> It seems to be that there are two problems here.
>
> One problem is that there needs to be a convention f
Is it possible to have default implementations associated with
functions in a protocol? This is most useful when some protocol
functions are defined in terms of other. For instance,
(defprotocol Span
(start [self])
(stop [self])
(span-length [self]))
Now I know I can just make span-length a
Hi.
Is there any clojure third-party library functionally similar to python's
os.path? Using java.io.File is not so convenient as os.path.
Regards
Vadim Shender
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cl
I've posted it at least once on this list!
On Mon, Feb 8, 2010 at 9:35 AM, Konrad Hinsen
wrote:
> On 08.02.2010, at 15:10, Howard Lewis Ship wrote:
>
>> Just a last minute reminder ...
>>
>> I'll be presenting "Clojure: Towards the Essence of Programming" on
>> Monday Feb 8th at 19:00, in Paris.
letfn is exactly what I was looking for.
Thank you.
On Feb 8, 12:15 pm, Michał Marczyk wrote:
> Use let:
>
> (defn foo [...]
> (let [helper (fn [...] ...)]
> (helper ...)))
>
> or letfn:
>
> (defn foo [...]
> (letfn [(helper [...] ...)]
> (helper ...)))
>
> The latter allows you to i
don't use def inside functions, ever. in scheme define is lexically scoped,
so you do that sort of thing. clojure is not scheme. if you want a lexically
scoped function use a lexical scoping construct like let or letfn.
On Mon, Feb 8, 2010 at 12:12 PM, Brenton wrote:
> What is the Clojure best p
Use let:
(defn foo [...]
(let [helper (fn [...] ...)]
(helper ...)))
or letfn:
(defn foo [...]
(letfn [(helper [...] ...)]
(helper ...)))
The latter allows you to introduce mutually recursive functions.
Sincerely,
Michał
--
You received this message because you are subscribed to
What is the Clojure best practice, if there is one, for writing a
function like this:
(defn integral [integrand initial-value dt]
(def --integral (cons initial-value
(lazy-seq (add-streams (scale-
streams integrand dt)
--integral
--integral)
integrand
On 8 February 2010 20:11, John R. Williams wrote:
> ;; macro-fail.clj
> (defmacro broken [] (/ 0 0))
> (broken)
> [ ... ]
> As you can see, line 3, where the macro is used, appears nowhere in
> the stack trace.
That's because execution never reaches this point, because the (/ 0 0)
bit gets execut
The Clojure compiler is not very helpful when it comes to debugging
exceptions that occur while macros are being expanded. As an example,
consider this code:
;; macro-fail.clj
(defmacro broken [] (/ 0 0))
(broken)
Here's the stack trace I get when I compile this file:
Exception in thread "main"
You can also capture the binding. This looks a little ugly, but it
works: it grabs the binding eagerly, and returns a closure that
dynamically binds it when the function is invoked.
(binding [*v* 2]
(map (let [v *v*]
(fn [n]
(binding [*v* v]
(f n
On Sat, Feb 6, 2010 at 2:08 AM, Timothy Pratley
wrote:
> Good point, I've updated the ticket patch to check options are valid
> also, so the behavior is now:
that is very cool, thank you!
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to th
>> In short, I think that the Java and Clojure way of packaging software
>> make life much easier for programmers, package maintainers, and
>> administrators, not harder. Making applications self-contained helps
>
> I have no experience with this yet, but one reason for looking into the JVM
> has
On 08.02.2010, at 15:10, Howard Lewis Ship wrote:
> Just a last minute reminder ...
>
> I'll be presenting "Clojure: Towards the Essence of Programming" on
> Monday Feb 8th at 19:00, in Paris. The event will be held at Zenika,
If I had known this earlier, I might have been able to come :-(
Konr
On 07.02.2010, at 03:25, Constantine Vetoshev wrote:
> I stopped using Python and Ruby and Perl partly because the packaging
> situation for all those languages is a horrible mess. For example, if
I agree. It's not just packaging, even providing sufficiently general
installation scripts is a dif
Hello all,
I am playing with the idea of a little library for dependency injection.
The idea is to declare injectable values as metadata-to-function map.
I started with a sketch of what the client code may look like.
Please let me know what you think.
Thank you,
Boris
Dependency declaration cod
I've got no clue, so I would just do the experiment. If it works out
well, tell us why. If it's a disaster, tell us what didn't work.
Sean
On Feb 7, 3:57 pm, James Reeves wrote:
> Hi folks,
>
> Would those more knowledgable about Clojure care to weigh in on
> whether it be a good idea to creat
James Reeves writes:
> Would those more knowledgable about Clojure care to weigh in on
> whether it be a good idea to create a custom class inheriting from
> IDeref?
That's how promise is implemented, but that's supposed to be an internal
detail.
--
Steven E. Harris
--
You received this mess
The problem is that map returns a lazy seq, and the lazy seq is
evaluated outside of the binding by the REPL. If you add a doall
inside the binding, it behaves as you expect.
user=> (binding [*v* 2] (doall (map f [1 1 1])))
(3 3 3)
Sean
On Feb 8, 5:47 am, Alex wrote:
> Hi,
>
> I have a questio
The talk will be in English or French?
On Mon, Feb 8, 2010 at 2:13 PM, Laurent PETIT wrote:
> I wish I could be present !
>
> I wish you the best,
>
> regards,
>
> --
> Laurent
>
> 2010/2/8 Howard Lewis Ship :
> > Just a last minute reminder ...
> >
> > I'll be presenting "Clojure: Towards the Es
Hi,
I have a question about the scope of "binding" of a var.
Let's say I have the following var:
(def *v* 1)
And I define a function that uses it:
(defn f [n] (+ *v* n))
"binding" behaves as expected, establishing a thread-local binding to
a new value in its scope:
user=> (bindin
Sure, I was going to add it last night, but brain had shut down for
the night.
The program I'm working on is a Communicating Sequential Processes
toolbox, so you can write a process and collect the traces (along with
other tools that simplify expressions and such). I've written a
traces function
2010/2/8 Sean Devlin :
> Perhaps I have an incomplete grasp of the problem domain, but wouldn't
> a map stored in a ref let you do this?
I don't understand.
>
> On Feb 8, 9:12 am, Laurent PETIT wrote:
>> 2010/2/8 Chouser :
>>
>>
>>
>> > On Mon, Feb 8, 2010 at 5:29 AM, Laurent PETIT
>> > wrote:
Perhaps I have an incomplete grasp of the problem domain, but wouldn't
a map stored in a ref let you do this?
On Feb 8, 9:12 am, Laurent PETIT wrote:
> 2010/2/8 Chouser :
>
>
>
> > On Mon, Feb 8, 2010 at 5:29 AM, Laurent PETIT
> > wrote:
> >> Hello,
>
> >> Did anybody create a functionally equi
I wish I could be present !
I wish you the best,
regards,
--
Laurent
2010/2/8 Howard Lewis Ship :
> Just a last minute reminder ...
>
> I'll be presenting "Clojure: Towards the Essence of Programming" on
> Monday Feb 8th at 19:00, in Paris. The event will be held at Zenika,
> SkillsMatter's pa
2010/2/8 Chouser :
> On Mon, Feb 8, 2010 at 5:29 AM, Laurent PETIT wrote:
>> Hello,
>>
>> Did anybody create a functionally equivalent clojure version of
>> so-called Groovy Builders ?
>> ( http://groovy.codehaus.org/Builders )
>>
>> Not that it should be too difficult to come up with an equivalen
Just a last minute reminder ...
I'll be presenting "Clojure: Towards the Essence of Programming" on
Monday Feb 8th at 19:00, in Paris. The event will be held at Zenika,
SkillsMatter's partner in France. You must register for the talk ahead
of time.
http://skillsmatter.com/event/java-jee/clojure-t
2010/2/8 Meikel Brandmeyer :
> Hi,
>
> On Feb 8, 2:06 pm, Roman Roelofsen
> wrote:
>
>> Ah, that makes sense, thanks! Is using (gensym) the common solution
>> here? So far I thought that (gensym) is more a internal function that
>> I normally never need to call directly.
>
> In such a case using g
Hi,
On Feb 8, 2:06 pm, Roman Roelofsen
wrote:
> Ah, that makes sense, thanks! Is using (gensym) the common solution
> here? So far I thought that (gensym) is more a internal function that
> I normally never need to call directly.
In such a case using gensym is the normal solution. When you don'
On Mon, Feb 8, 2010 at 5:29 AM, Laurent PETIT wrote:
> Hello,
>
> Did anybody create a functionally equivalent clojure version of
> so-called Groovy Builders ?
> ( http://groovy.codehaus.org/Builders )
>
> Not that it should be too difficult to come up with an equivalent, and
> also not that it wo
Do you have a specific example, some code you could paste?
On Feb 7, 11:53 pm, Tim Snyder wrote:
> Is there a straight-forward way to get parallelization when using list
> comprehension?
> The form of "for" syntax is much preferable to the closest I could
> come up with using pmap. I also was ha
> It doesn't work because the scope of lname# is limited to the `().
> However lname is used in a ~@() which leaves the `() and enters the
> enclosing environment (in this case the macros). There the lname# is
> not valid.
Ah, that makes sense, thanks! Is using (gensym) the common solution
here? S
> I don't see a compelling reason for such a macro. At least not in this
> simple case.
I agree. As I said, the purpose of this macro was purely for learning
and understanding macros ;-)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this
Hi,
On Feb 8, 12:14 pm, Michael Wood wrote:
> user=> (doto (java.util.ArrayList.)
> (.add "1")
> (.add "2"))
> #
Oops. Yes. You need doto instead of ->. Sorry, my mistake.
> > Is it possible to create the macro without the (gensym) call? I wasn't
> > able to use something like lname#.
>
> Sorr
On 8 February 2010 12:45, Roman Roelofsen
wrote:
> Hi,
>
> just for practicing Clojure's macros I wrote the following
> create-java-list macro.
>
> (defmacro create-java-list
> [& forms]
> (let [prefixfn (fn [obj form] (cons (symbol ".") (cons obj form)))
> lname (gensym)]
> `(let [~ln
Hi,
On Feb 8, 11:45 am, Roman Roelofsen
wrote:
> just for practicing Clojure's macros I wrote the following
> create-java-list macro.
>
> (defmacro create-java-list
> [& forms]
> (let [prefixfn (fn [obj form] (cons (symbol ".") (cons obj form)))
> lname (gensym)]
> `(let [~lname
Hi,
just for practicing Clojure's macros I wrote the following
create-java-list macro.
(defmacro create-java-list
[& forms]
(let [prefixfn (fn [obj form] (cons (symbol ".") (cons obj form)))
lname (gensym)]
`(let [~lname (java.util.ArrayList.)]
~@(map (partial prefixfn lnam
And I've found groovy builders not so well documented, very "magical"
(as in "dark magic") where I think this should not be that way.
So there is even room to make this simpler for the users, I guess, by
correctly implementing a somewhat "verbose" purely functional (and
macros-free) DSL, from whom
Hello,
Did anybody create a functionally equivalent clojure version of
so-called Groovy Builders ?
( http://groovy.codehaus.org/Builders )
Not that it should be too difficult to come up with an equivalent, and
also not that it would seem to you that it is interesting to do so
given the power of c
On Feb 5, 12:33 am, Stuart Sierra wrote:
> Clojure can certainly do these things; clojure-contrib contains many
> file and io-related utilities. But remember that Clojure, like any
> Java program, takes more time to start up than "scripting" languages
> like Perl/Bash/Ruby/Python, so it may be le
On Feb 8, 3:22 am, Stuart Halloway wrote:
> IMO Anything that implements IDeref should adhere to Clojure's vision
> for identity, e.g. reads need to be thread safe, cheap, require no
> coordination, and block no one.
Dereferencing futures or undelivered promises block the dereferencing
thread
50 matches
Mail list logo