Hi:
Inet.data is a Clojure library for modeling various Internet-related
conceptual entities as data. It is intended to support applications
which are *about* the modeled entities versus *interfacing* with them.
It presently contains types and associated APIs for representing IP
addresses, IP ne
David Nolen writes:
> Should core.logic support specific versions of Lein? Ideally Lein 2
> would support Lein 1.X files.
My understanding is that the reason the new version is lein 2.0 instead
of 1.8 is because it does break backwards compatibility.
However, if this is the only problem, it's f
Daniel Silén writes:
> If I rebind a var's value it receives the new value - but it shouldn't,
> because it is in another thread, right?!
Clojure 1.3 introduced a feature known as "binding conveyance," which
causes the functions passed in for futures and agent actions to be
wrapped so as to cap
David Greenberg writes:
> I can easily generate a map from signatures to implementations, but I
> need to generate the class with all the overloads.
>
> Is there any way to do this? Should I resign myself to writing out a
> .java file, and compiling that?
In my experience just writing a stub Jav
Brian Marick writes:
> Which raises the question: *is* concurrency actually a strong selling
> point for functional languages?
It definitely was/is for me. I'd avoided threads for most of my
career-to-date because in imperative languages any thread could mutate
any value to be anything at any p
"Vinay D.E" writes:
> I am a newbie and was doing some exercises when I ran across something that
> I don't understand.
> I am trying to count the number of elements in an array less than 100.
>
> My first attempt didn't work. The counter returns 0
>
> (let [a (atom 0)
> i (take-while (fn[
Warren Lynn writes:
> I have a hard time understanding why there is a need to retry when
> doing "swap!" on an atom. Why does not Clojure just lock the atom
> up-front and do the update?
This is just my two cents, but I think the/one big reason is that
Clojure atoms just *are* non-locking STM-ba
Stuart Sierra writes:
> Clojure doesn't currently support generating Java classes dynamically,
> but you could hack the compiler to allow it.
And if you don't feel like doing it yourself, check out shady and
`shady.gen-class/gen-class`:
https://github.com/llasram/shady/blob/master/src/shady
octopusgrabbus writes:
> Is there any reason to compile a Clojure library with :aot?
Here's all the reasons I know of for doing AOT-compilation:
- The code produces JVM classes with `clojure.core/gen-class`, which
only produces any results when compiling.
- The code needs to expose a J
Hi all:
Shady is intended to be a collection of JVM interop facilities. Right
now it contains two useful pieces of functionality for producing iterop
classes: a version of `gen-class` supporting dynamic redefinition like
`deftype`; and a `defclass` macro providing a `deftype`-like interface
to th
"Marshall T. Vandegrift" writes:
> So, is this entirely expected behavior? Or am I missing something
> which would make initializing the defining namespace happen as part of
> a static initializer for the AOTed `deftype` class?
To answer my own question, the Clojure w
Hi,
I'm trying to define some bits of Hadoop glue using `deftype` from
Clojure. I'm using Leiningen to produce an AOT-complied JAR of the
generated classes. At runtime, Hadoop uses reflection to load classes
specified by name in (non-code) configuration. Hadoop is able to locate
and instantiate
Alan Malloy writes:
> Stuff like this always worries me. It may happen to work now, but I
> doubt if that's a guarantee. extend-protocol's contract is that you
> give it a Symbol, which it resolves into a Class. It surely isn't
> expecting a Class as an argument, because you can't enter that as a
Peter Taoussanis writes:
> Thanks- that explains it: dropping to extend works as expected.
Another option I've been making use of for exactly this situation is to
use the #= reader macro to evaluate the Class/forName at read-time.
Something like:
(extend-protocol MyProtocol
java.lang.Inte
Stephen Compall writes:
> And may be anyway further generalized:
>
> (defmacro <<- [& forms]
> `(->> ~@(reverse forms)))
>
> (<<- (let [x (foo) y (bar)])
> (when y)
> (let [ ])
> (do ))
Another alternative,
(require '[clojure.algo.monads :as m])
(m/domonad m/maybe-m
Konrad Hinsen writes:
> That may be a minority, but an implementation based on Common Lisp
> could also open the way to an integration with the world of C, via a
> Common Lisp implementation with a decent C interface.
Integrating the JVM with C via JNA [1] is pretty straightforward. I've
been d
Tassilo Horn writes:
> I'm facing the same issue. I have this macro for java interop:
>
> (defmacro with-traversal-context
> [[g tc] & body]
> `(let [old-tc# (.getTraversalContext ^Graph ~g)]
> (try
>(.setTraversalContext ^Graph ~g ^TraversalContext ~tc)
>~@body
>
Tim Robinson writes:
> => (defn oops! []
> (let [x1 (atom (hash-map))
> v1 (filter
> #(let [xv1 (@data %)]
>(if (= xv1 "v1")
>(swap! x1 assoc :k1 "other")))
>(keys @data))
> rxv (rese
Alan Malloy writes:
> It seems to me that it would be nice to have macros automatically
> include, on their result forms, the metadata from their input
> &form. Of course, macros may wish to add metadata as well, so the two
> maps should probably be merged. However, there are certainly some
> pro
Stefan Kamphausen writes:
> Chunked seqs are supposed to realize more elements than you
> consume. That's for performance reasons. But since you will only ever
> apply side-effect-free functions to seqs, that will make no
> difference, no?
Sorry, yes, I'm talking about within the code of `pmap'
Hi:
I found what I think might be considered a bug, but I'm not certain.
The doc-string for `pmap' just says that the passed-in function is
applied "in parallel," but the code as-written is pretty clearly
intended to keep only (+ 2 #CPUS) future-wrapped function applications
realized at a time. I
Dusan writes:
> (symbol(str "(str (:" % " " vv "))"))
This expression is the (immediate) problem child. You are producing a
symbol which contains literal space and parenthesis characters embedded
in it. When you print out the macro-expansion, it looks fine, but the
actual forms generated conta
Guofeng Zhang writes:
> I do not understand why "`'~v" has be to used this way. If I used
> "`~v" instead (that is, remove the quote), it still works. So my
> question is, why "~v" needs to be first quoted and then syntax-quoted?
I'm not the most experienced Clojure programmer, but I'll have a g
Stuart Sierra writes:
> I was a little worried about this when the exception behavior for fns was
> changed. I think it's solvable, but don't know right now what the solution
> is.
I'm not incredibly experienced with Java, but would using a Java
construct which tricks the language into allowin
Alessio Stalla writes:
> The key point is that in Lisp "code" does not mean "text" [1]. Code is
> made of data structures - lists, symbols, vectors, numbers, ... - and
> macros are just functions that operate on those data structures.
Hmm, interesting. One of the things that's drawn me to learn
André Thieme writes:
> Please try this minimal example in your REPL:
> (defn f [x] (fn [] x)) ; the closure factory
> (def foo (f 0)) ; a useful instance
> (defmacro bar [] `(let [a# ~foo]))
> and then call (bar)
I'm new to Clojure and don't have much experience with Lisps in general,
but trying
26 matches
Mail list logo