This is awesome! I remember you mentioning this project last year at the
Madison Clojure Meetup, it's cool to see it in action.
This would make a pretty cool test framework for a new Clojure
implementation.
Timothy
On Thu, May 16, 2013 at 9:41 PM, Devin Walters wrote:
> There are some tweaks
>>how do you distinguish between accessing the class itself and creating a
new >>instance of it?
(Foo. 42)
vs
(instance? Foo 42)
Is that what you mean?
Timothy
On Thu, May 16, 2013 at 11:43 PM, Meikel Brandmeyer (kotarak)
wrote:
> Hi,
>
> how do you distinguish between accessing the class it
A few corrections:
Lists are single linked lists, so nth on them (as well as last) is O(n).
Get on lists is unsupported.
Cons on a vector is O(1) since cons converts things to seqs (O(1)) before
constructing the cons.
Count on everything but Cons and LazySeq is O(1). For those two it's O(n)
unti
You might also want to switch "cons" to "conj". This is a super ugly part
of the Java api that no one really ever sees. PersistentVector.cons is
actually called by clojure.core/conj. clojure.core/cons is something else
completely. When talking about how the java code performs it might be best
to sp
No, what I'm saying is that in each persistent collection there is a method
called "cons":
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L167
However, this is the function called by clojure.core/conj:
https://github.com/clojure/clojure/blob/master/src/
y are much more
useful in imperative languages than they are in functional languages like
Clojure.
Timothy Baldridge
On Tue, May 28, 2013 at 12:05 PM, Warren Lynn wrote:
>
> May I suggest that as useful as your strategies are, they cannot replace a
> debugger? Let's be clear about
+1 for both features, it really helps for major version upgrades on large
projects.
On Wed, May 29, 2013 at 8:35 PM, Brian Tatnall wrote:
> +1 Both of those features extremely helpful when adding new dependencies
> to any sizable project.
>
>
> On Wed, May 29, 2013 at 8:31 PM, Dave Kincaid wrot
No, you're not missing something. In the past I've turned down the idea of
using RPython due to the lack of threading support. But in the past year
major, major headway has been made (as you mentioned) so perhaps RPython
isn't as crazy of an idea after all.
As far as a GC goes, yes, RPython can us
There are two things I see that reduce the viability of ref-count GCs with
Clojure:
a) Clojure is insanely alloc heavy. Look at the source of the data
structures, merging two hash-maps (for instance) requires about 2-3
allocations per assoc, per kv in the merged map:
(merge map1 map2)
allocs = ~(
Not really true, most of my programs contain this function:
(defn debug [x]
(pprint x)
x)
Now I can do this:
(comp foo debug bar)
Also, with some reader literal magic, I could write something to let me do
this:
(myfunc foo #dbg bar)
On Thu, May 30, 2013 at 6:12 PM, David Jacobs wrote:
>> 1) testing recursive functions. I want to test what a recursion STEP
does, not the >> whole function. Can I mock 'recur'?
You shouldn't need to, pull the body of the loop out as as separate
function, then test that function.
>> 2) testing sequence, esp. lazy
For this, I often create a generat
>> You can certainly use with-redefs with any testing library/framework, or
you can pass dependencies into your production-code functions. I think
perhaps I'm missing the detail you're seeing on how using a particular test
framework encourages using global vars - can you elaborate?
You're right, m
ote:
>
> On Jun 10, 2013, at 9:20 AM, Timothy Baldridge
> wrote:
> > Midje on the other hand, is a massive pile of macros and DSLs that so
> complicate your code that advanced tests are insanely hard to debug. ...
> And I can't tell you how many dozens of hours I'v
One reason why Datomic works so well with core.logic is that it exposes raw
index data to the client. I am unaware of any other database that decouples
data storage from the query engine. If you can find one that does, I'm sure
someone could expose a core.logic interface to that DB as well.
But, i
Reading the LazySeq.java file should make this all clear, but yes, no race
conditions.
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L37
Synchronized methods basically lock the current instance of the object
while the method runs, so it is impossible for two thr
> ChunkedSeq, etc...) work under the hood, and thereby eventually figure it
> out, but it's probably a lot fewer man-hours of work for me to ask someone
> who's already intimately familiar with that codebase and for him to
> answer...
>
>
>
> On Mon, Jun 24, 2
l [first &
> rest] cells for (iterate inc 0), single chunks for (range), etc.? I'd
> appreciate a straight, direct, yes-or-no answer to that question.
>
>
> On Mon, Jun 24, 2013 at 11:03 PM, Timothy Baldridge
> wrote:
>
>> It corresponds to the execution of the La
It's my opinion that core.async shouldn't be used a concurrency mechanism,
or as a new programming paradigm. Instead, it should be used as a
communication method between sequential processes, and as a de-coupling
method between modules. Let's go back to Rich's original post on the
library:
"There
Use core.async
when other core language features won't work"
Timothy
On Mon, Jul 1, 2013 at 9:27 AM, Ben Wolfson wrote:
> On Mon, Jul 1, 2013 at 7:10 AM, Timothy Baldridge wrote:
>
>> It's my opinion that core.async shouldn't be used a concurrency
>> mec
These look great!
I would, however, avoid using go-as. In the JCSP example a style such as
this is prefered most of the time:
(defn inc-all
"increments every int received in the input channel"
([in]
(let [out (chan)]
(inc-all in out)
out))
([in out]
(go (while true
(>! ou
Go blocks are GC'd but not until they complete running. The problem is that
you're creating go blocks faster than they can run. Creating go blocks is
very cheap, taking/putting into channels is also cheap but not quite as
cheap. Therefore the outer loop will eventually allocate so many blocks
that
A few thoughts on ways to improve this code:
Using agents and go blocks in the same code is a bit odd. If you need a
queue plus a process, just do something like this:
(defn faux-agent [c]
(go (loop []
(when-let [msg (! req-chan :req)
do something like this:
(>! req-chan [file-nam
Eh, you're right, there is however, a blocking version of go, called thread:
So perhaps something like this?
(thread
(while true
(let [[filename response-chan] (!! response-chan (slurp filename)
Or perhaps I'm missing something.
Timothy
On Mon, Jul 8, 2013 at 10:09 AM, vemv wrote:
The thing that should be mentioned, is that we're talking about some pretty
insane performance optimizations for a dynamic language. Let's take
something like Python for example. All ints are boxed, all the time. If you
want to optimize your code, you drop to C (or Cython) so you end up
re-writing
It's interesting to note that blocking go blocks can actually be GC'd. For
example, run this in a repl:
(loop [] (let [c (chan)]
(go (>! c 42)))
(recur))
On my box the CPU and memory spikes, but after I CTRL+C and kill the loop,
the GC kicks in and collects all the channels and gos
In the latest copy of core.async (taken from github master), I get this
error:
(go
(try
(go (throw (Exception.)))
(catch Exception ex
(println "catched"
xception in thread "async-dispatch-2" java.lang.Error: java.lang.Exception
at
java.util.concurr
It appears that you cannot call close! within a go block and so
> to signal the end of input to a channel you have to use another channel
> upon which the receiver can alt!.
>
>
That's shouldn't be true. What problems did you run into with this?
And yes, channels and go's are automatically GC'd w
ow).
This means that entire chains of gos and channels can be reclaimed by the
GC if neither end of the chain is anchored in a GC root.
Timothy
On Wed, Jul 17, 2013 at 8:17 AM, Laurent PETIT wrote:
> 2013/7/17 Timothy Baldridge :
> > It appears that you cannot call close! withi
After a channel is closed, any gets ( wrote:
> The problem I am having is in the function at line 41 of
> https://github.com/nodename/async-plgd/blob/master/src/hoare/coroutines.clj.
> Any insight into this is appreciated.
>
> -A
>
>
>
> On Wed, Jul 17, 2013 at 7:23 AM,
someone besides myself.
Timothy Baldridge
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
Yes, channels are GC'd and so are any gos that are connected to them (who
are not also being held by some other reference).
Timothy
On Thu, Jul 18, 2013 at 9:42 AM, Alice wrote:
> https://github.com/clojure/core.async/blob/master/examples/ex-async.clj
> https://github.com/clojure/core.async/bl
ded agents). This allows for back-pressure, where
slow producers can block faster consumers. So perhaps the best way to think
about channels is a bounded mutable queue of promises
Hopefully this helps a bit,
Timothy Baldridge
On Thu, Jul 18, 2013 at 10:54 PM, julius wrote:
> It brother me to
at 7:03 AM, Cedric Greevey wrote:
> On Fri, Jul 19, 2013 at 8:25 AM, Timothy Baldridge
> wrote:
>
>> channels - allow multiple producers to provide data to multiple consumers
>> on a one-to-one basis. That is to say, a single value put into a channel
>> can on
I think the problem is in your service function, notice how you are reading
data from a channel then writing data to that same channel, within the same
process? Try fixing that and see where it gets you.
Timothy
On Tue, Jul 23, 2013 at 11:25 PM, Alan Shaw wrote:
> Hi,
> I hope I can get a ligh
Take a look at your code again, service is reading a value from a,
modifying it, and sticking it back into a. You also have a "put" process
putting values into a, and fan-in taking values from a. So what is keeping
values from flowing from your "put" process directly to fan-in, skipping
service com
I think the first hint to an answer is found in your question. You are
dealing with complex data, simplify the data, and querying the data is much
simpler.
For instance, if you have a tree, you could flatten the tree into a hash
map like this:
{parent-id {:children [child-id1 child-id2]}
child-i
Eh...use the right tool for the job...
On Wed, Jul 24, 2013 at 2:00 PM, Cedric Greevey wrote:
> On Wed, Jul 24, 2013 at 3:27 PM, Timothy Baldridge
> wrote:
>
>> However, to be honest, this is where I reach for Datomic. It has a wicked
>> fast query engine (datalog), you
+1 to Charlie. If I ever went back to Python development I would plop down
whatever the going rate is for PyCharm (InteliJ Python IDE), that thing is
an awesome piece of tech. There are very few times I've been utterly blown
away by an idea all the standard features of Python (testing, debugging,
c
es the light
will go on, and it'll all make sense.
Pretty printing (via the debug function) the output of
parse-to-state-machine will also help you make sense of what's being
constructed.
I hope this helps.
Timothy Baldridge
On Fri, Jul 26, 2013 at 8:51 AM, john wrote:
> Hi,
>
I recommend using invokeLater to send a fn to Swing to do the rendering.
http://docs.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#invokeLater(java.lang.Runnable)
If you need Swing to notify the go channel when the rendering is complete,
you can do something like this:
(go
(let
Code? It's hard to debug if we can't see what's going on.
On Wed, Jul 31, 2013 at 9:00 AM, Michael Drogalis wrote:
> Problem:
>
> I have a ref representing a queue of people in line.
> I add a watch to the ref to print out the contents of the queue whenever
> it changes.
> Naturally, and expecte
.
Timothy Baldridge
On Wed, Jul 31, 2013 at 9:43 AM, Michael Drogalis wrote:
> I can precisely exemplify the behavior here:
>
> https://gist.github.com/MichaelDrogalis/6123177
>
>
> On Wednesday, July 31, 2013 11:13:17 AM UTC-4, Michael Drogalis wrote:
>>
>> Aaron:
You might want to consider switching to agents (or something else) I don't
think it's possible to do what you want with refs.
Timothy Baldridge
On Wed, Jul 31, 2013 at 10:08 AM, Mike Drogalis wrote:
> Thanks for the link. :) I understand that the behavior I'm seeing is
>
rs are notified outside of a ref transaction deadlocking is
impossible. Inside a transaction you'd have a instant deadlock.
Timothy Baldridge
On Wed, Jul 31, 2013 at 10:47 AM, Mike Drogalis wrote:
> I'll play around with agents for this when I get some more free time.
>
&g
Why not use wrote:
> It doesn't produce a compile time error but I think it's not the correct
> code because the transaction can be committed while insert-async! is still
> executing.
>
> On Thursday, August 1, 2013 2:46:29 AM UTC+9, Sean Corfield wrote:
>
>> On Wed, Jul 31, 2013 at 10:29 AM, Ali
DB work is a IO operation, and IO shouldn't be done inside a go block (go
blocks use limited thread pools).
So what about something like this?
(defn handle-db [chan]
(thread
(while true
(let [[data result] (! result :done)
Now spin up a few of these:
(def db-chan (let [c (chan 4)
The position of core.async is to not specify how exceptions should be done
(instead leaving it up to the user). So if that method works well for you,
write some macros and use it!
Other methods may be the use of supervisor channels. In this model, go
blocks that die would enqueue the exception int
gt;
>> On Wed, Jul 31, 2013 at 1:12 PM, Mike Drogalis wrote:
>>
>>> Good reasoning; that makes a lot of sense -- even if intuitively it
>>> doesn't follow through.
>>>
>>> I'll do some more thinking about my concurrency needs and come back with
>&
em into a new queue. So adding element A, then B results in line
> [A, B], whereas
> adding element B, then A results in line [B, A], which aren't equal.
>
> Maybe I'm misunderstanding my problem, perhaps it is communitive. I just
> don't see it though.
>
>
>
inced that the CSP style works well in this context, and
that instead we should perhaps model these systems after unreliable message
passing, as that's really all that you are promised by the network protocol
anyways.
Timothy Baldridge
On Thu, Aug 1, 2013 at 9:32 AM, wrote:
> With
RPC ties a local process (and all the memory its currently using) to a
remote process. It glosses over the fact that that the link between these
two processes is quite unreliable. In his thesis, Joe Armstrong also points
that this system is not only susceptible to hardware/network failure, it's
als
Then you can do this:
`(async/>! c 42)
Timothy Baldridge
On Mon, Aug 5, 2013 at 5:52 AM, Tassilo Horn wrote:
> Alice writes:
>
> > I didn't know that macros can do that!
>
> Then you might want to have a look at `macroexpand-1` and `macroexpand`
> f
Right, so if syntax quote fully qualifies unqualified symbols with the
current namespace, what good is user/>! to core.async? It has no clue that
you want that to be a put and not something else. So yes, either async/>!
or a fully qualified symbol is what you want here.
Timothy Baldridge
This works fine on my box:
foo=> (ns foo (require [clojure.core.async :refer [go !!]]))
nil
foo=> (defmacro foo
#_=> [c]
#_=> `(
foo=> (let [c (chan)]
#_=> (go (prn (foo c)))
#_=> (>!! c :hi))
:hi
nil
foo=>
Timothy Baldridge
On Mon, Aug 5, 2013 at
This looks a re-implementation of many of the goals of Datomic. Perhaps you
can use Datomic as a datastore, and then use Datomic's datalog, or a custom
query engine (such as core.logic
https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/datomic.clj)
to do your quer
you from using your own import function, they are pluggable after all:
(ns foo
(:println "Hello World"))
Hello World
=> nil
So you could easily write something like this:
(ns foo
(:simple-ns/simple
[clojure.core match logic async]))
Timothy Baldridge
On Mon, Aug 5, 2
[ring.util.response :only (file-response)])
> (:require [one.reload :as reload]
> [one.middleware :as middleware]
> [net.cgrand.enlive-html :as html])
> (:import (org.apache.maven.artifact.resolver ArtifactResolver)
>(java.io File
>
>
> -
would the
semantics be clearer in this approach?
Timothy Baldridge
On Tue, Aug 6, 2013 at 8:51 AM, Greg wrote:
> Folks, I feel this thread has gotten derailed by the discussion of
> implicit imports.
>
> This thread is not about that. It's not about asterisks, or :use,
>> (ns foo
>> [require [clojure.string :as c]])
>> I've never seen that before. What does it do?
It's exactly the same as a normal require. Ns allows vectors/seqs
symbols/keywords to be used interchangeably. Some people use (:require)
others use (require), ns just uses ns/namespace to get the d
s {:dostuff {:doc nil, :arglists
> ([this]), :name dostuff}}, :var #'baz/g, :method-map {:dostuff :dostuff},
> :method-builders {#'baz/dostuff # baz$eval300$fn__301@7c2aa00c>}}
> baz=> (defn g [] "a")
> #'baz/g
> baz=> g
> #
>
> And
re and I are already confused here:
> >
> > baz=> (defprotocol g (dostuff [this]))
> > g
> > baz=> g
> > {:on-interface baz.g, :on baz.g, :sigs {:dostuff {:doc nil, :arglists
> ([this]), :name dostuff}}, :var #'baz/g, :method-map {:dostuff :dostuff},
>
Yep, this is bug, please submit a bug report through JIRA, and I'll try to
get it fixed ASAP.
Timothy
On Thu, Aug 8, 2013 at 9:22 AM, David Nolen wrote:
> You can report issues here: http://dev.clojure.org/jira/browse/ASYNC
>
>
>
> On Thu, Aug 8, 2013 at 7:02 AM, Kemar wrote:
>
>> Hi there,
>
And also note that protocol functions and multimethods also don't need
forward declarations as they are polymorphic and the interface is defined
ahead of time. So mutually recursive multimethods don't need to use declare
at all.
Timothy Baldridge
On Fri, Aug 16, 2013 at 10:53 AM, Stu
I'm just going to throw this out there, but I almost always consider using
#() instead of (fn []) to be bad practice. Like all syntactic sugar, it has
its place, but I reach for fn more often then not, because it allows me to
name the arguments and track in my mind the data with which I am working.
will
just clog up, keeping other reducers from running properly.
Timothy Baldridge
On Sun, Aug 25, 2013 at 8:43 PM, Alan Busby wrote:
> Here is something similar pulled from bagotricks "1.5.2", using Java's
> linked blocking queue;
>
> https://github.com/thebusby/bagotr
Although this also ties up a thread for every reduce. Not exactly efficient
IMO.
Timothy
On Sun, Aug 25, 2013 at 11:50 PM, Alan Busby wrote:
>
> On Mon, Aug 26, 2013 at 1:37 PM, Timothy Baldridge
> wrote:
>
>> Since reducers use fork-join pools,
>
>
> Reducers us
The reason for not allowing nils isn't a complex one, and basically boils
down to the following:
a) to avoid race conditions, we need a single value to signal "the channel
is closed". As mentioned, nil is the obvious choice for this as it matches
lazy seqs and fits well with the rest of clojure:
ion, false, 0, :tick, or some
other "ground value".
It's these Rx style programming methods that make people think they need
this feature.
Timothy
On Tue, Aug 27, 2013 at 8:51 AM, Mike Anderson wrote:
> On 27 August 2013 20:45, Timothy Baldridge wrote:
>
>> The reason
for the lowest level primitives. I'd
> provide ways to get in to or out of the stream subsystem for interop with
> channels, but the public interface would take IStream objects.
>
>
> On Tue, Aug 27, 2013 at 10:58 AM, Timothy Baldridge
> wrote:
>
>> All your arguments c
What you are describing is a pub sub type system. This could be built on
top of core.async, but it doesn't have to change the core library at all.
But yes, you are mis-understanding the main use-case for a library like
core.async. The library was created to allow for the building of systems
that c
As David said, binding preservation works with Clojure, not with
ClojureScript. That being said, while I can see a use for bindings in
Clojure (thread-local redef), I fail to see a use-case for binding in
ClojureScript. Seems like code could/should be structured in a better way.
On Thu, Sep 5, 20
;
> David
>
>
> On Thu, Sep 5, 2013 at 1:03 PM, Timothy Baldridge wrote:
>
>> That can easily be done thusly:
>>
>> (defn do-stuff [ctx c]
>>(go (loop []
>> (let [v (> (swap! ctx process v)
>>
.
>
>
> On Thu, Sep 5, 2013 at 11:30 AM, Timothy Baldridge
> wrote:
>
>> As David said, binding preservation works with Clojure, not with
>> ClojureScript. That being said, while I can see a use for bindings in
>> Clojure (thread-local redef), I fail to see a u
He's talking about puts and alts. You can actually do multiple puts at once
inside an alts! and only one of them will be used. Yes I haven't seen them
used either, I'm sure there's a use case, I haven't found it yet though.
Timothy
On Sun, Sep 8, 2013 at 9:35 PM, Sean Corfield wrote:
> We're us
ork left to be done (vs. handing out jobs in
> round-robin fashion, or pre-dividing the work among the CPUs).
>
>
> On Mon, Sep 9, 2013 at 1:32 AM, Sean Corfield wrote:
>
>> Ah, I missed the 'put' part of it. No, haven't used that aspect yet.
>>
>> On Sun,
It's worth noting that the restrictions to IFn do not apply to definterface
and deftype. Not that solves all (or any) of your problems, I've used
definterface before to lock down the actual types used.
Timothy
On Mon, Sep 9, 2013 at 11:03 AM, Jozef Wagner wrote:
> You can typehing ints for loca
Also, how much of this is a limit of the OpenGL library you are using? The
raw OpenGL API supports glVertex3d and glVertex3f. Is the double version
not supported by your java interface library?
Timothy
On Mon, Sep 9, 2013 at 11:07 AM, Timothy Baldridge wrote:
> It's worth noting
This Clojure/West talk deals with many of these concepts.
http://www.infoq.com/presentations/Clojure-Large-scale-patterns-techniques
Timothy
On Tue, Sep 10, 2013 at 6:35 AM, Philipp Meier wrote:
>
>
> Am Dienstag, 10. September 2013 12:58:46 UTC+2 schrieb Luc:
>
>> I agree more or less, I hat
cheap. Not so in
>> your case, as you mentioned you have concerns about memory size and
>> performance of certain primitives.
>>
>> My conclusion is that you'd probably be best looking at the HipHop
>> library, and figuring out how you can adapt their ideas to your
kely to change soon.
TL;DR - The reason you haven't heard back is because no one has a good
answer as to how to fix it, or if it even needs to be fixed. That's not the
answer anyone likes to hear, but I'm afraid that's the truth. Anyone else
on this list can feel free to
le-**
>>>> numerical-**computation-in-**clojure<http://blog.getprismatic.com/blog/2013/7/10/introducing-hiphip-array-fast-and-flexible-numerical-computation-in-clojure>
>>>> ).
>>>>
>>>> 4) Writing small functional libraries in Java that in
high level stuff in Clojure. The
nice thing is, lein has very nice features for just this use case:
http://stackoverflow.com/questions/7511789/clojure-lein-how-do-i-include-a-java-file-in-my-project
So you can write your java code, stick it in a folder, and then it'll be
compiled by lien on
t;> functions
>>>>>> you want. Primitive hinted functions currently implement Java interfaces,
>>>>>> implementing every combination of float, double, object, short, int,
>>>>>> long,
>>>>>> and byte for
Before coming to Clojure I did 2 years of work on WPF/Silverlight apps, and
let me say what those platforms offer blows the web stuff out of the water.
Yes it's not cross-platform, but the ability to describe a layout with data
is unparalleled in the web world. I could sit down, and have a UI to a
The logic of extends? is much simpler, so try that. IIRC it's something
like "extends? returns true if any method on the protocol is implemented by
x", "satisfies? returns true if all methods of a protocol are implemented
by x".
The docs don't seem to give much help here, so play with it in the re
Since the data you are handing to the datomic query engine is un-indexed,
portions of the query will effectively be O(n). However if you do as Jan
suggests and put the data into Datomic the data will automatically indexed
several ways. Then when you query against the datomic db, the engine will
pic
Most of the time, if you are using a component like system, you'll also
want some level of polymorphism as well. This is what the defrecord
approach enables, it not only provides dependency injection, but also
provides a type that calls to that component can dispatch against. In
testing it's then q
When I first came to Clojure (from C# of all things), I had questions like
this too. But over time I've become convinced that it was something I
worried to much about. The guiding rule for code organization should be
this: does it slow you down from the complexity? Are there so many files,
that you
deref is used to pull the value out of an atom, ref, or atom (or other
reference type).
(= (deref a) 0) gives --> true
Also there is a shorthand operator:
(= @a 0)
Timothy
On Thu, Feb 12, 2015 at 12:27 PM, Newbie wrote:
> I am trying to compare atom values with numbers. For e.g. -
>
> (def
Oh, it's much worse than anyone has mentioned yet. The whole (def primes
...) bit is also a problem. What you are saying to the compiler is "create
a var named primes and assign it this lazy-seq...", and then while defining
that lazy seq you are creating closures that use "primes". That sort of
cir
True, that works, but he wants to remove based on element position, not
element value.
Timothy
On Tue, Feb 17, 2015 at 12:28 PM, Ivan L wrote:
> this works
>
> => (filter #(not= (mod % 5) 0) (range 22))
> (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21)
>
>
> On Tuesday, February 17, 2015 at 2:21:2
Tweak as needed:
(keep-indexed
(fn [i v]
(if (= 0 (mod i 5))
nil
v))
(range 30))
On Tue, Feb 17, 2015 at 12:21 PM, Cecil Westerhof
wrote:
> What is the best way to remove all elements which position (counting from
>
hof" wrote:
>
>> 2015-02-17 20:26 GMT+01:00 Timothy Baldridge :
>>
>>> Tweak as needed:
>>>
>>> (keep-indexed
>>> (fn [i v]
>>> (if (= 0 (mod i 5))
>>> nil
>>>
The number of threads is meant to be semi-tolerant to usage of blocking IO
in go blocks. You can't be certain that some go block won't call a function
that calls a function in some library that blocks for just a few
milliseconds. So we tried to make it high enough to be tolerant of mis-use,
but lo
In short, it doesn't. And I think the fact that Clojure is as fast as it is
is testament to how little of an impact many of these optimizations have.
But also, don't assume that Clojure doesn't get many of these optimizations
for free from the JVM. Auto-caching is a weird one, I think most people
Except that doesn't work, since the var is de-reffed when handed to the
defmulti. You can var quote it, and that should work:
(defmulti create-fact #'create-fact-dispatch)
Timothy
On Mon, Feb 23, 2015 at 8:44 AM, Francis Avila wrote:
> You can work around this by using a symbol for the dispa
I normally either do something like this:
(apply str (concat ["a" "b"]
(map name :c :d)
["e" "f"]))
Or use java's StringBuilder, it's a mutable black box, but appending is
pretty efficient, and doesn't involve the creation of a ton of seqs l
The whole "SSD fails after X number of writes" thing is pretty much a myth
now that most drives implement pretty aggressive write leveling. These
modern drives introduce a mapping layer between the physical disk locations
and the location written to by the OS. This means that writing to "KB 4242"
o
/criterium
Timothy Baldridge
On Wed, Mar 11, 2015 at 9:38 AM, Brent Millare
wrote:
> Doing some simple microbenchmarks, I found something unexpected:
>
> (time
> (let [v (volatile! 1)]
>(dotimes [x 1]
> (vreset! v @v
> "Elapsed time: 1016.992146 m
;
> atom: "Elapsed time: 866.203579 msecs"
> volatile: "Elapsed time: 787.462185 msecs"
> AtomicLong: "Elapsed time: 603.721207 msecs"
> AtomicReference: "Elapsed time: 603.716769 msecs"
> atom: "Elapsed time: 866.207913 msecs"
1 - 100 of 834 matches
Mail list logo