, then
this will happen every time.
Instead of using a single channel, have the handler accept a in channel and
an out channel. Then put hello into the input and alts!! will take from
the output.
Also, (put! c hello) is exactly like (go (! c hello)) but it is much
faster.
Timothy Baldridge
On Tue, Nov
Anyone can create an account on JIRA and create a ticket.
Timothy
On Sun, Nov 24, 2013 at 2:19 PM, Cedric Greevey cgree...@gmail.com wrote:
On Sun, Nov 24, 2013 at 3:36 PM, Tim Visher tim.vis...@gmail.com wrote:
Sounds like a bug to me. You could open a ticket to get further
discussion
, write a bug report, and do us all a favor.
Timothy
On Sun, Nov 24, 2013 at 3:10 PM, Cedric Greevey cgree...@gmail.com wrote:
Not everyone wants to go to that much trouble just to tell everyone what
he already told everyone via this list.
On Sun, Nov 24, 2013 at 4:56 PM, Timothy Baldridge
This is all good advice. Also notice that these examples don't really match
real life use cases of core.async. Here you only have two threads, where
the execution time is dominated by message passing. In most situations
you'll have dozens (or hundreds) of gos, with actual work being done in
each
There's several ways the performance of this code can be improved.
Firstly, these are exactly the same (samantically), but the latter is much
faster: (go (! c v)) and (put! c v). Use put! whenever possible.
Secondly, the function event uses !! (blocking take), but it's used
inside a go later on.
How do you know where the nil is coming from? Channels never accept nil, so
any nil you get from a take is due to the channel bing closed. And yes,
returning nil from a go causes the go's channel to close without a put.
Timothy
On Sat, Dec 14, 2013 at 4:35 PM, Brandon Bloom
I won't go so far as to tell you which is better as that often comes down
to a matter of taste. However, I will explain the technical differences. In
this case I'll use my (somewhat limited) knowledge of C# Rx. Scala/Java's
Rx may be different.
Rx is based on a direct call. We could write a
You learn something new every day. As this always been the way that Rx
worked (the locking part)? I haven't used Rx for several years, so I may be
off in my assumptions.
Timothy
On Thu, Dec 19, 2013 at 9:41 AM, Matthew Podwysocki
matthew.podwyso...@gmail.com wrote:
You can easily do
+1 for Stuart's component lib. I've been using it a lot in my day job and
it works quite well. It also serves as a reminder not to throw global
config values into vars. Building code that works well with the library
makes it less natural to put random state values in globals.
Timothy
On Fri,
Not mentioned in Cedric's post are two other important things:
Protocols can be extended to existing types. For example:
(defprotocol IType
(type-as-string [x]))
(extend-protocol IType
String
(type-as-string [x] string)
Integer
(type-as-string [x] integer))
= (type-as-string 42)
kiuhn...@gmail.com wrote:
On Sunday, December 29, 2013 11:30:16 PM UTC+1, Cedric Greevey wrote:
On Sun, Dec 29, 2013 at 4:11 PM, Timothy Baldridge
tbald...@gmail.comwrote:
Not mentioned in Cedric's post are two other important things:
Protocols can be extended to existing types
If the Expression Problem consists in extending classes then non-OOP
languages must be excluded because they don't have classes.
No offense intended, but that is an incredibly wrong statement. Let's look
up the official definition of the expression problem (via wikipedia): The
goal is to define
, 2013 11:30:16 PM UTC+1, Cedric Greevey wrote:
On Sun, Dec 29, 2013 at 4:11 PM, Timothy Baldridge
tbald...@gmail.comwrote:
Not mentioned in Cedric's post are two other important things:
Protocols can be extended to existing types.
These are important for the Expression Problem
http-kit is great, and here's an example of using it with core.async to
manage the callbacks:
https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj#L361
Timothy
On Tue, Dec 31, 2013 at 7:10 AM, Mikera mike.r.anderson...@gmail.comwrote:
I'd
A few other things that might help:
1) you can use (put! c val) from inside any function. Sometimes if you want
to fire and forget a send, that might be the best option
2) you can wrap the code inside the sub fns inside another go. This isn't
as slow as you might think
3) think about using
clojure.zip needs to be rewritten IMO. It's written in more of a scheme
style using vectors. Since then protocols have come out and there's no
reason why this can't make use of those. And yes, at the same time new
functions could probably be added.
I've threatened to re-write this lib several
Using a def inside a defn really shouldn't be done. Perhaps move the params
to a let outside of the s/defn? Or change the def to a let?
Timothy Baldridge
On Fri, Jan 3, 2014 at 4:18 PM, Timothy Washington twash...@gmail.comwrote:
Hey Jason,
You were exactly right (which is pretty impressive
Sure, anyone can go and write an emitter using these tools, but this
doesn't solve the issues of a good type system, GC, JIT, etc. These tools
make it easier to make any Clojure implementation self hosting, but those
impls still need a good foundation to build on, and that's the hard part.
Like normal clojure code, gos don't support a recur that jumps out through
a try. However, the go macro should be patched to bring that to the
attention of the user.
Timothy
On Tue, Jan 7, 2014 at 2:22 PM, Luc Prefontaine lprefonta...@softaddicts.ca
wrote:
Just got your email, I remember
That's actually a major issue for those wanting to use Clojure to work on a
RPi or similar low end system. These systems are also so memory
constrained, that last I checked, the CLJS compiler wouldn't run too well
on them either. Now that doesn't stop people from using Node.js to run CLJS
code
everything, hands down with respect to startup
times...
Jim
On 08/01/14 15:46, Timothy Baldridge wrote:
That's actually a major issue for those wanting to use Clojure to work on
a RPi or similar low end system. These systems are also so memory
constrained, that last I checked, the CLJS compiler
Just be aware, that Erlang VM doesn't even come close to the performance of
the JVM. For example, Erjang (Erlang on the JVM) runs up to 6000% faster
than stock Erlang: http://codemesh.io/slides/kresten-krab-thorup.pdf
So it's a trade-off like most things. The JVM takes a bit more memory from
the
they seem to be at
first. (and take that number with a big grain of salt).
Just some points to ponder.
Timothy Baldridge
On Mon, Jan 13, 2014 at 6:05 PM, t x txrev...@gmail.com wrote:
Hi Stephen,
I now understand what you meant. Thanks writing a minimal test case.
On Mon, Jan 13, 2014 at 3:34
It's a known problem (putting into a closed channel), and one we have a
possible solution for (it's in one of the branches of core.async). I'll
bring it up this Friday and see if we can't make some progress on the code.
Timothy
On Tue, Jan 14, 2014 at 10:43 AM, Ghadi Shayban gshay...@gmail.com
, we
just haven't seen a good use case for that yet.
Hope this helps,
Timothy Baldridge
On Wed, Jan 15, 2014 at 3:45 PM, t x txrev...@gmail.com wrote:
Hi,
Let c be a channel that is neither dropping nor slidding.
Now, furthermore, let c be full.
Lastly, suppose (async/put! c
Those interfaces are also broken into ReadPort, WritePort and Channel. Each
protocol defines (in order), read, write, and close!. So you can check on
or all of those for only the ops you need.
Note however, anything under clojure.core.async.impl is subject to change
without notice in future
perhaps something like:
(zipmap (range)
(for [octave (range 8)
key [C C# D D# ...]]
(keyword (str key octave
Timothy
On Fri, Jan 17, 2014 at 9:21 AM, Kashyap CK ckkash...@gmail.com wrote:
Hi,
I am exploring javax.sound.midi using
a large codebase using protocols instead of
multimethods, I've regretted it. Data all the things...as the saying
goes.
Timothy Baldridge
On Sun, Jan 19, 2014 at 2:55 PM, James Reeves ja...@booleanknot.com wrote:
On 19 January 2014 19:55, Brian Craft craft.br...@gmail.com wrote:
http
in.
Hope this helps,
Timothy Baldridge
On Sun, Jan 19, 2014 at 7:52 PM, gvim gvi...@gmail.com wrote:
Is it likely that a typical Clojure development environment:
- LightTable instarepl
- Luminus web app running within `lein ring server`
will consume significantly more battery power
That works just fine on my box, infact, core.async's test code includes
checking that dynamic vars actually work.
Timothy
On Sun, Jan 19, 2014 at 10:11 PM, t x txrev...@gmail.com wrote:
Hi,
Consider this piece of code:
(binding [*foo* 20]
(async/!!
(async/go
(+ 1 2 *foo*
-SNAPSHOT you will need to update all calls to put!.
I'm sorry about this, but there's really no other way to get these changes
into the api.
Please let me know about any bugs you find in the current 0.1.0-SNAPSHOT.
Thanks,
Timothy Baldridge
--
--
You received this message because you
the core.async source and doing lein install from the
directory.
I just sent an email to this mailing list that explains these changes and
the updated semantics.
I hope this helps,
Timothy Baldridge
On Thu, Jan 23, 2014 at 5:53 AM, Meikel Brandmeyer (kotarak)
m...@kotka.dewrote:
Hi
the code state defined by this commit: ?
https://github.com/clojure/core.async/commit/76b25bf91c670b0c3542ed9cb687ff29fb2183a7
(I tried 0.1.0-SNAPSHOT but it appears not updated yet.)
On Thu, Jan 23, 2014 at 6:07 AM, Timothy Baldridge
tbaldri...@gmail.comwrote:
t x, these change you suggest
.
I think it's a good change (even tho' it breaks any code that uses put!
and expects it to throw an exception).
Sean
On Jan 23, 2014, at 6:05 AM, Timothy Baldridge tbaldri...@gmail.com
wrote:
I'm looking for some feedback on recent changes Rich and I have made to
core.async:
I merged
Umwat?
On Jan 23, 2014 7:17 PM, Cedric Greevey cgree...@gmail.com wrote:
[meta, but about something apparently triggered by the message, from this
thread, that I'm quoting]
Why did reading this post cause gmail to go bonkers? I saw this thread had
new articles since earlier today,
of some sort, or was it just a
prank, or even a known software bug somewhere?)
On Thu, Jan 23, 2014 at 9:20 PM, Timothy Baldridge
tbaldri...@gmail.comwrote:
Umwat?
On Jan 23, 2014 7:17 PM, Cedric Greevey cgree...@gmail.com wrote:
[meta, but about something apparently triggered
What's the performance of this code like? I'd be interested in seeing how
performance on Clojure data structures compares. In my experiments with
reference counting and highly polymorphic code, getting much faster than
languages like Python was quite hard. Without a more dedicated optimizer
that
MBP = Mac Book Pro
MBA = Mac Book Air
On Sat, Jan 25, 2014 at 9:12 PM, greybird m...@greybird.com wrote:
In case it helps, I've also seen this CPU eating problem. I'm using:
REPL-y 0.1.9 Clojure 1.5.1. I don't know what you guys mean by MBP and MBA.
--mark
--
--
You received this
It's not true. All memory has to be kept active at all times. Now you may
experience less battery usage due to the GC having to run more often, but
that's not exactly a memory usage problem.
Not to mention that the OS will almost always use all free ram for disk
caches and the like.
On Sat,
The key thing to remember in all questions of core.async GC is that there
is no global blocked gos queue. Instead, the blocked gos are attached
directly to the channel. When the channel is GC'd all attached gos are GC'd
as well.
So in this case, it's actually even simpler.the go never blocks.
To quote Jozef it can happen all in one thread. This is somewhat true,
there are some rare situations where this can happen, but it is fairly
rare.
Many times putting a value into a channel will mean that the callback on
the other end of the channel needs to be dispatched. In that case Mauricio
A quick thought...there really isn't much of a difference between a failing
network connection and a (chan (dropping-buffer 1024))
Both may (or may not) drop information that you put into them, but also,
both can be expected to work normally as long as certain conditions hold.
Namely, the net
the input and output data structures to drive how processing is
handled.
http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
And as the article states, reducers use(s) regular data structures, not
'parallel collections' or other OO malarkey
Timothy
Gos work with bindings on CLJ, CLJs biding support is different enough
that it doesn't currently work with gos.
Timothy
On Sun, Feb 9, 2014 at 7:33 AM, t x txrev...@gmail.com wrote:
Hi,
## Consider this block of code:
(defn init [] ;; called from window.onload
(def ^:dynamic *dvar*)
+1 to everything Dom Kiva-Meyer said.
On Fri, Feb 14, 2014 at 2:13 PM, Andrey Antukh n...@niwi.be wrote:
Awesome! Thanks!
2014-02-14 21:47 GMT+01:00 Daniel doubleagen...@gmail.com:
Thanks to everyone involved!
On Friday, February 14, 2014 1:04:09 PM UTC-6, Alex Miller wrote:
Clojure
I'm unable to decipher from these examples exactly what is expected and
what is going on. Can someone write me a concise 1 paragraph description of
the problem. Something like:
When a case is emitted from a macro into the body of a go, . happens
I think it's probably something related to how
When a macro expands to case inside of a go-block, it appears that
the _ELSE_ clause of the case is always run. (Even after a previous
clause has matched.)
Thanks, I'll get a test in the project for this, it'll probably be fixed in
the next alpha release. Until then, cond or condp might work?
Firstly, I think you over estimate the cost of an if. Ifs are very very
fast, especially if you are doing identical? checks (like a case is doing).
A simple pointer comparison such as (keyword-identical? :foo :foo) is going
to be way faster than a hashmap lookup.
Secondly, ifs are very JIT
Clojure IMO is not truly dynamic, at least not to the extent of
Python/Ruby. I like to refer to Clojure as a dynamic enough language.
For example, once defined, types cannot be modified by adding new members
(deftype that is). If you want to add a new field to a deftype in Clojure,
you have to
Yes, this pattern is pretty common. Create the timeout first, then do some
work, then take from the timeout to wait for the remaining time. Looks good
to me.
Timothy
On Wed, Feb 19, 2014 at 10:27 AM, Kris Jenkins krisajenk...@gmail.comwrote:
Hey folks,
Can someone sanity check this for me,
How are you running these tests? The correct way to benchmark such things
is via a real benchmark framework (such as criterium) then compile your
clojure app to a jar (perhaps via lein uberjar) and finally run it via a
bare java invocation: java -jar my.jar.
Lein for example sometimes uses
You can take the CSP out of core.async, but then it really isn't the same
thing. Your version with promises still allows for async, but in the
process removes most of the benefits of CSP.
Timothy Baldridge
On Tue, Mar 11, 2014 at 12:29 PM, Ben Mabey b...@benmabey.com wrote:
I've also ran
I think this should work:
(.bullet js/$ arg1 arg2)
Although this might not work with advanced compilation. In that case you
may need to provide extra info to the CLJS compiler to keep .bullet from
getting renamed.
Timothy
On Wed, Mar 12, 2014 at 11:14 AM, t x txrev...@gmail.com wrote:
Hi,
This case study from Roomkey.com is a awesome starting place for a
conversation:
http://www.colinsteele.org/post/23103789647/against-the-grain-aws-clojure-startup
http://www.colinsteele.org/post/27929539434/60-000-growth-in-7-months-using-clojure-and-aws
Timothy
On Wed, Mar 12, 2014 at 6:47
Instead (! channel) (! channel val) you do (! (take! channel)) (!
(put channel val)).
That would make channels even slower, not to mention that it would probably
completely break interaction with alts!.
I'm not saying it absolutely couldn't be done, I just don't see a need for
it. core.async is
I talked to Martin after a CodeMesh, and had a wonderful discussion with
him about performance from his side of the issue. From his side I mean
super high performance. You have to get a bit of background on some of his
work (at least the work he talks about), much of what he does is high
Don't use private vars. Instead move the macro to a sub namespace called
internals or impl or something like that and make it public. Prefer
trusting your users instead of limiting them.
my $0.02
Timothy
On Mon, Mar 17, 2014 at 11:33 AM, Yoav Rubin yoavru...@gmail.com wrote:
I'm familiar
The problem is in the way lisp compilers work. Example:
The public macro gets analyzed first and runs, and emits the code required
to call the private macro. Then the compiler analyzes the output of the
first macro and discovers that the code now calls a new macro. It analyzes
this code and finds
large code sizes as the minification provided by google closure is a
major boon to performance.
Just some thoughts
Timothy Baldridge
On Tue, Mar 18, 2014 at 12:42 AM, Max Kreminski maxkremin...@gmail.comwrote:
Hello all,
I'm applying to GSoC this year, and I'm interested in taking
Not to mention that this isn't local mutation. You are handing the atom to
a closure that then gets wrapped by lazy-seq and returned. So the atom may
actually sit around for some time.
On Thu, Mar 20, 2014 at 2:26 PM, James Reeves ja...@booleanknot.com wrote:
There are a few reasons to reject
are you using lein cljsbuild auto ? That's what I use, and I get about
1-3 sec recompile times for stuff that uses core.async.
Timothy
On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:
Hi,
* I'm already using:
:incremental true
:compiler { :optimizations :none }
*
This is a caused by an interesting interaction of two things: 1) channels
can have no more than 1024 pending takes at a time. and 2) (timeout)
caches it's return value for a given ms + window size of time. At the
moment, window is about 5-10ms.
This error message is normally the result of a bug.
The question is replace them with what? I remember with not so fond
memories the days of using IEnumerable in C#, there was no immutability and
no caching. So if you created a massive chain of data and iterated over it
twice you would have to execute the entire chain of functions twice. With
I don't know of anything built-in, but this should do the trick:
(defn remove-first [f [head tail]]
(if (f head)
tail
(cons head (lazy-seq (remove-first f tail)
Timothy
On Wed, Apr 2, 2014 at 1:44 PM, Christopher Howard cmhowa...@alaska.eduwrote:
Is there some like remove,
This is not modifying the value it's creating a new scope with a new
version of x. The binding above is shorthand for:
(let [x 3]
(let [x 42]
(println x))
(println x))
;; prints:
42
3
Timothy
On Fri, Apr 4, 2014 at 10:23 AM, Plínio Balduino pbaldu...@gmail.comwrote:
Hi there
I
is shadowing
the first, there's no way to access the first value, right?
Plínio
On Fri, Apr 4, 2014 at 1:26 PM, Timothy Baldridge tbaldri...@gmail.comwrote:
This is not modifying the value it's creating a new scope with a new
version of x. The binding above is shorthand for:
(let [x 3]
(let
I find Haskell syntax completely unreadable. Just saying
On Apr 5, 2014 11:36 AM, Travis Wellman twell...@gmail.com wrote:
When I started learning Haskell after a year or more of Clojure, the
syntax was refreshing, and I found myself wishing I could write Clojure
with Haskell syntax.
This is a interesting side-effect of the way that map is implemented.
Internally map is not actually using channels, but is using the channel
protocols. It's creating something that looks like a ReadPort, but before
handing values to callbacks it applies a function to the value. So map
doesn't
But yes, we should probably at least put a note in the docs for map
stating returning nil from the mapping function can result in undefined
behavior. Or add an assert somewhere perhaps.
Timothy
On Mon, Apr 7, 2014 at 9:36 AM, James Reeves ja...@booleanknot.com wrote:
This looks like a bug to
That's the case with clojure.core.map as well, don't consume the lazy seq
the side effects aren't run...in short, map is not for side effects.
On Mon, Apr 7, 2014 at 11:32 AM, Alejandro Ciniglio skiae...@gmail.comwrote:
Yeah, that seems to be the best practice that's promoted as well. Another
that constantly tries to read from the output channel?
On Apr 7, 2014, 1:39 PM, Timothy Baldridge wrote:
That's the case with clojure.core.map as well, don't consume the lazy
seq the side effects aren't run...in short, map is not for side effects.
On Mon, Apr 7, 2014 at 11:32 AM, Alejandro
What is going to fulfill a promise? How will you know when a promise is
fulfilled. In a single threaded VM like JS you're stuck with callbacks.
Nothing short of full program transformation will give you any better
experience than core.async.
A good way to look at it is this...if you do this in
, Apr 9, 2014 at 9:39 AM, t x txrev...@gmail.com wrote:
I believe
https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7
suffices.
However, it's currently Firefox only and no Chrome.
On Tue, Apr 8, 2014 at 8:51 PM, Timothy Baldridge tbaldri...@gmail.com
wrote:
What
.
On Wed, Apr 9, 2014 at 9:39 AM, t x txrev...@gmail.com wrote:
I believe
https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7
suffices.
However, it's currently Firefox only and no Chrome.
On Tue, Apr 8, 2014 at 8:51 PM, Timothy Baldridge tbaldri...@gmail.com
Some would also argue that any parallelism system is going to slow down
code as trivial as this. Never underestimate the power of properly
optimized single threaded code :-).
But yes, futures are the way to go if you want to execute a given
expression on a different thread.
On Thu, Apr 10, 2014
When people say killer app what they mean is silver bullet. The problem
with silver bullets, is while they are quite exceptional at killing
vampires, they are often somewhat subpar when it comes to dispatching other
monsters of the night, such as ogres. Or at least so I've been told by my
friends.
I have dozen colleagues that can't foster clojure because they want a
language with tools that fits every day.
Can you explain this statement? I'm not sure I understand. I haven't
touched any language but Clojure for every day work in months (years?). I
can write a game in Clojure, I can write
But something or some things that mostly pushes people to use the
language.
If that's the case, then building cool stuff is probably the correct
answer. And in that case, this probably applies quite well to Clojure:
http://paulgraham.com/avg.html
On Sat, Apr 19, 2014 at 3:24 PM, Paulo Suzart
wrote:
Yes.
That's the point. You are taking about a bunch of wrappers. They are not
bad, but will not make these people to move their asses from java. Even if
they can introduce clojure in their tools set.
Thanks
On 19 Apr 2014 18:09, Timothy Baldridge tbaldri...@gmail.com wrote:
I have
On Mon, Jun 21, 2010 at 6:46 AM, Julian juliangam...@gmail.com wrote:
Rich Hickey made reference in one of his videos to a language that
could convert between all different kinds of units and dimensions.
Does anybody recall what that was?
google is thy friend:
BTW...his documentation is just awesome...read the section on
Superman is a slacker for a good laugh.
Timothy
On Mon, Jun 21, 2010 at 6:46 AM, Julian juliangam...@gmail.com wrote:
Rich Hickey made reference in one of his videos to a language that
could convert between all different kinds of
in countless situations.
So has anyone tried this? If not, I may just give it a whirl, and
others would be welcome to help.
Timothy Baldridge
--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs
at 3:26 PM, Daniel Werner
daniel.d.wer...@googlemail.com wrote:
On Jun 22, 7:57 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
system it uses. Has anyone tried marrying the two system systems to
create a truly persistent data primitive where any updates to a map
is written to the disk
1. a string/text type
*cough * Erlang *cough *
Tim
--
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.
a good or bad example of this?
On Jun 27, 1:11 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
1. a string/text type
*cough * Erlang *cough *
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure
You could take a look at ClojureCLR, I'm not sure if it runs on RT though.
That being said, Metro has a JS API, so why not write Metro apps in
ClojureScript?
Timothy
On Tue, Jan 22, 2013 at 10:55 AM, MC Andre andrew.penneba...@gmail.comwrote:
What's the state of iOS and Windows RT support for
The important question to ask yourself (and I'll cover this in my talk), is
why do you want native Clojure?
A native implementation of Clojure will fail to deliver on several fronts:
Interop with systems - Java has one of the biggest ecosystems on the planet
Performance - The JVM JIT and GC are
have you hit with Clojure/ClojureScript that you think could be
resolved with a native Clojure implementation?
Timothy Baldridge
On Sun, Jan 27, 2013 at 4:32 PM, Paul deGrandis paul.degran...@gmail.comwrote:
Additionally, you might also consider ClojureScript itself. With a little
work you
Parens actually don't complect, they have a very very clear meaning. They
organize functions and arguments. Let's take one line from your example:
filter smaller xs
Sois that the python equivalent to which of these?
filter(smaller(xs))
filter(smaller, xs)
filter(smaller(), xs())
Hi Thanks for the super fast response, Still a little confused. If coll is
set to nil before reduce is called, then what is reduce called with?
Remember, the JVM is a stack machine (before the JIT is run). So the code
produced is something like this:
push coll
push nil
pop-into coll
call-fn
Some swear by monads, others (like myself) tend to swear at them. I would
suggest breaking the code apart a bit more. From the looks of it, you're
writing something like a game. The first 4 clauses could be redone as
something like this:
(def dirs
{:left [-10 0]
:up [0 -10]
:right [0 10]
For that, look up Executors in Java. They'll have exactly what you are
looking for. Create a new fixed sized executor:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Executors.html
They expect Runnable objects, but clojure Fns implement Runnable, so you
can simply pass the
This sort of pattern is used quite a lot in clojure (even in core):
(let [data (if (string? data) (read-string data) data)
data (if (string? (first data)) (first data) (next data))
data (if (string? (first data)) (first data) (next data))]
data)
Throwing exceptions on overridden
Can you explain a bit more? What do you find difficult about Leinigen?
Thanks,
Timothy
On Thu, Feb 14, 2013 at 11:42 AM, BJG145 benmagicf...@gmail.com wrote:
Having studied Lisp decades ago I like the look of Clojure a lot. But as a
complete newbie when it comes to modern software
-compilation. And the compilation speed isn't
anything to boast about (from what I've heard).
Timothy Baldridge
On Wed, Feb 27, 2013 at 10:03 AM, Marko Topolnik
marko.topol...@gmail.comwrote:
On Wednesday, February 27, 2013 5:17:16 PM UTC+1, Luc wrote:
There's no magic. You cannot win on all fronts
/PHP, etc.
Timothy
On Wed, Feb 27, 2013 at 10:13 AM, Timothy Baldridge tbaldri...@gmail.comwrote:
Luc makes a good point. And that's one thing that I love about Clojure. It
is possible to have (more or less) the same language on different platforms
with different trade-offs, with little effort
The question should probably be asked: is there a benefit in a given
situation to having the let be outside the scope of the defn? I would argue
that most times it is not, and putting the let outside the function
clutters the code and makes it harder to see the functions defined in the
namespace.
+1 to what Michael said. Once the videos do start rolling in, InfoQ will
have at least one Clojure video on the front page for months on end. I once
said to a friend after Clojure/West last year,InfoQ? Oh! You mean the
Clojure Channel.
On Mon, Mar 25, 2013 at 10:19 AM, Michael Klishin
(first | first coll) ; (first (first coll))
(count | first | second coll) ; (count (first (second coll)))
(nth % 2 | first coll) ; (nth (first coll) 2)
How is this better than the threading macro?
(- coll first first)
(- coll second first count)
(- coll first (nth 2))
Timothy Baldridge
, but if I wanted more performance it seems like this library would cause
me some problems.
Besides that, I love the idea of an auto generated lib.
Timothy Baldridge
On Tue, Mar 26, 2013 at 12:18 PM, Michael Cohen mcohe...@gmail.com wrote:
Thanks for the comments. I've made the suggested changes
1 - 100 of 815 matches
Mail list logo