Some time ago I dug into primitive type hints and how the Clojure compiler
uses them.
When the compiler finds primitive type hints on a function, say (defn f
[^long n] ...), the generated class for that function implements a
primitive interface, IFn$LO in this case,
and generates appropriate
You might want to consider adding it to
https://github.com/bbatsov/clojure-style-guide :-)
--
--
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
I replied to this a long time ago and in the original case - I did not see
huge value in the suggestion. But recently I wanted to do exactly what
Murtaza suggests.
There are a couple of reasons why I think this capability would be useful.
(And rereading Murtaza's email - I think this is what
see this commit for main changes to hiccup
https://github.com/davesann/hiccup/commit/e8c06d884eb22a2cdd007f880a9dd5e1c13669a4
On Thursday, 25 April 2013 18:55:52 UTC+10, Dave Sann wrote:
I replied to this a long time ago and in the original case - I did not see
huge value in the suggestion.
What are your thoughts on slpKanren? Could it be used as a base for
probabilistic programming in core.logic?
https://github.com/webyrd/slpKanren
- Martin
Den onsdagen den 24:e april 2013 kl. 17:34:05 UTC+2 skrev David Nolen:
This is great, thanks for the thoughts, gist links!
On Wed, Apr
one other thought.
It is possible just to manipulate the hiccup data as suggested by Walter
above. This may be better because it is independent. But I wonder about
performance costs of processing the structures twice (expand and then
render) rather than once (render).
Dave
--
--
You
Wow! That's awesome. It's even faster! Thanks.
(defn foo1 [^long l cb] (cb l))
(defn foo2 [^long l cb] (invoke-primitive O [L] cb l))
(time
(dotimes [n 100]
(foo1 n (fn [l] nil
(time
(dotimes [n 100]
(foo2 n (fn [^long l] nil
Elapsed time: 7.622627 msecs
Elapsed
The reason foo2 is faster is that foo1 is passing a primitive long
value to cb, which caused boxing. Without that, the performance seems
to be exactly the same, which it should be!
On Apr 25, 6:50 pm, Alice dofflt...@gmail.com wrote:
Wow! That's awesome. It's even faster! Thanks.
(defn foo1
the conceptional differences between collection and sequences are confusing
quite a bit.
A nice wrap up by Tim McCormack can be found here:
http://www.brainonfire.net/files/seqs-and-colls/main.html
(via Sean Corfield)
-fb
Am Sonntag, 31. März 2013 14:58:15 UTC+2 schrieb Alice:
On
On Thu, Apr 25, 2013 at 5:29 AM, Martin Forsgren
martin.forsg...@gmail.comwrote:
What are your thoughts on slpKanren? Could it be used as a base for
probabilistic programming in core.logic?
https://github.com/webyrd/slpKanren
- Martin
It's definitely worth taking a look at and assessing.
I've actually taken a stab at porting slpKanren; I think there was
something I wanted to tweak, so I'll take another look at the code, do
the tweaking (if any) and post it sometime soon. (I'm a bit overloaded
this week, so it might take longer than it otherwise would...)
Probabilistic programming
+100. Thx a lot!
On 25 April 2013 13:45, fb friedrich.boe...@gmail.com wrote:
the conceptional differences between collection and sequences are confusing
quite a bit.
A nice wrap up by Tim McCormack can be found here:
http://www.brainonfire.net/files/seqs-and-colls/main.html
(via Sean
Hi Murtaza,
the simple way to go is have something like
(def rules1 [...])
(def rules2 [...])
(spit rules.css
(css (concat rules1 rules2)))
I am not sure about my good use of the library here but I think the idea is
there. When you develop with the repo
you can just eval the (spit ...)
I create many small methods in java without worrying about the
performance since it's usually the target of inline optimization. For
example,
public class Foo {
public static long inc(long l) {
return ++l;
}
public static long f1() {
long l = 0;
for (int i=0; i 10;
primitive hinted fns will get inlined. You can also play the same kinds of
games that Clojure does with definterface+deftype and fns that declare
:inline metadata.
If you don't want to learn the subtleties of Clojure performance tuning
then you can always write your performance critical bits in
Primitive hinted funtions seem to be not an exception.
(defn my-inc ^long [^long l] (inc l))
(defn f1 [^long l] (inc l))
(defn f2 [^long l] (my-inc l))
(time (dotimes [n 1] (f1 1)))
(time (dotimes [n 1] (f1 1)))
(time (dotimes [n 1] (f1 1)))
(time (dotimes [n 1]
jvm.tools.analyzer is a nice tool for exploration in this area.
I don't personally know all the subtleties here, but after some playing I
managed to emit an unboxing function.
I could tell from the AST.
https://gist.github.com/frenchy64/5459989
Thanks,
Ambrose
On Thu, Apr 25, 2013 at 9:44 PM,
Three repetitions is not nearly enough to get a feel for how hotspot
optimizes functions when it detects they're in a tight loop. I don't know
how javac works, but Clojure doesn't optimize much for cases where hotspot
can do a much better job over time.
-Phil
--
--
You received this message
If that's a problem, you could try https://github.com/hugoduncan/criterium
On Thu, Apr 25, 2013 at 5:38 PM, Phil Hagelberg p...@hagelb.org wrote:
Three repetitions is not nearly enough to get a feel for how hotspot
optimizes functions when it detects they're in a tight loop. I don't know
how
You have to be very careful with microbenchmarks like this. I recommend
writing less trivial benchmarks. For example
http://github.com/clojure/test.benchmark/blob/master/src/main/clojure/alioth/spectral_norm.clj
This code demonstrates performance on par with plain Java. There are many
other
Found this blog post written by fogus:
To provide this level of flexibility Clojure establishes a level of
indirection. Specifically, all function lookups through a Var occur,
at the lowest level, through an atomic volatile. This happens every
time that a function bound using the def/defn special
Which is out of date.
On Thu, Apr 25, 2013 at 12:47 PM, Alice dofflt...@gmail.com wrote:
Found this blog post written by fogus:
To provide this level of flexibility Clojure establishes a level of
indirection. Specifically, all function lookups through a Var occur,
at the lowest level,
Care to elaborate which part is out of date?
On Apr 26, 1:48 am, David Nolen dnolen.li...@gmail.com wrote:
Which is out of date.
On Thu, Apr 25, 2013 at 12:47 PM, Alice dofflt...@gmail.com wrote:
Found this blog post written by fogus:
To provide this level of flexibility Clojure
2013/4/25 David Nolen dnolen.li...@gmail.com
+ :inline metadata
Which is not documented anywhere and might as well not exist for regular
Clojure users.
--
MK
http://github.com/michaelklishin
http://twitter.com/michaelklishin
--
--
You received this message because you are subscribed to
(doc definline)
On Thu, Apr 25, 2013 at 1:17 PM, Michael Klishin
michael.s.klis...@gmail.com wrote:
2013/4/25 David Nolen dnolen.li...@gmail.com
+ :inline metadata
Which is not documented anywhere and might as well not exist for regular
Clojure users.
--
MK
2013/4/25 David Nolen dnolen.li...@gmail.com
(doc definline)
Macro
Experimental - like defmacro, except defines a named function whose
body is the expansion, calls to which may be expanded inline as if
it were a macro. Cannot be used with variadic () args.
If you think this is useful to
user= (apropos inline)
(definline)
user= (doc inline)
..
2013/4/25 David Nolen dnolen.li...@gmail.com
(doc definline)
Macro
Experimental - like defmacro, except defines a named function whose
body is the expansion, calls to which may be expanded inline as if
it were a macro.
2013/4/25 Softaddicts lprefonta...@softaddicts.ca
user= (apropos inline)
(definline)
Yeah, yeah. It all starts with (apropos apropos), right?
I knew it.
--
MK
http://github.com/michaelklishin
http://twitter.com/michaelklishin
--
--
You received this message because you are subscribed to
You asked a simple question, you got a plain answer.
Now if you are still grunting there's not much I can do about that.
I do agree that the doc string could be a bit more descriptive.
But what does it mean to be understandable by normal users ?
I am still trying to size what is a normal Lisp
2013/4/25 Softaddicts lprefonta...@softaddicts.ca
Inlining is a concept that existed for more than 40 years in many
programming
languages. It's not anything new.
The OP probably know what inlining is because, hm, the subject has that
word.
Then she is recommended to use something that only
You could come up with definline yourself by thinking about what inlining
is and wrapping things in macros, it seems to me the real problem definline
solves is to also be able to use the output as a function, which is more
about keeping convenience than performance gains.
I think the people who
Well you looked quite outraged that it could not be found easily. I
demonstrated
that doc strings can be easily searched.
Of course my answer comes in total antagonism with your usual position about
the
bad state of the existing documentation which is incomplete, wrong, ... and so
forth.
2013/4/25 Softaddicts lprefonta...@softaddicts.ca
Of course my answer comes in total antagonism with your usual position
about the
bad state of the existing documentation which is incomplete, wrong, ...
and so forth.
Your reaction does not suprise me, your behavior is quite predictable.
May I suggest you an upgrade ?
http://www.ehow.com/how_6949396_record-78-vinyl-records-cd.html
2013/4/25 Softaddicts lprefonta...@softaddicts.ca
Of course my answer comes in total antagonism with your usual position
about the
bad state of the existing documentation which is incomplete,
Good vinyls are considered higher quality by audiophiles, because there are
less stages in between the mastering and amplification. There is more
potential of better performance.
It can be considered a real-world case of inlining.
On Thu, Apr 25, 2013 at 3:16 PM, Softaddicts
2013/4/25 Softaddicts lprefonta...@softaddicts.ca
May I suggest you an upgrade ?
http://www.ehow.com/how_6949396_record-78-vinyl-records-cd.html
Ah, a batch of fresh preaching from Mr. Defend Clojure/core At All Costs.
Best Canadian export since Wayne Gretzky!
--
MK
There seems to be some rule that given sufficient time and enough
participants, all threads deteriorate into an argument about the current
state of clojure documentation and a huge post from Tim Daly regarding
literate programming in 3...2...1...
On Thu, Apr 25, 2013 at 2:23 PM, Gary Trakhman
Hi list,
I was searching for an easy way to combined nested maps, e.g. as in
(combine {:foo {:bar baz}} {:foo {:x y}})
= {:foo {:bar baz, :x y}}
I would expect that there is some core map operation to do this, but
neither merge nor unify work as they simply return {:foo {:x y}}, and I
don't
On Apr 25, 2013, at 15:41 , Joachim De Beule joachim.de.be...@gmail.com wrote:
I was searching for an easy way to combined nested maps, e.g. as in
(combine {:foo {:bar baz}} {:foo {:x y}})
= {:foo {:bar baz, :x y}}
user= (merge-with merge {:foo {:bar baz}} {:foo {:x y}})
{:foo {:x y, :bar
Seems you want a cross between update-in and merge. Maybe something like
this?
(defn combine
Merge maps, recursively merging nested maps whose keys collide.
([] {})
([m] m)
([m1 m2]
(reduce (fn [m1 [k2 v2]]
(if-let [v1 (get m1 k2)]
(if (and (map? v1)
It was fun to try a naive implementation
(defn combine [m1 m2]
(let [mm1 (transient m1)]
(do
(doseq [k (keys m2)]
(if (contains? m1 k)
(assoc! mm1 k (conj (mm1 k) (m2 k)))
(assoc! mm1 k (m2 k
(persistent! mm1
On 25/04/13 16:29, Cedric
Here's a way to do it from the Pedestal demo source
codehttps://github.com/pedestal/demo/blob/17eeac7a5e50d31eb81901de465f3f1d863f2f01/hammock-cafe/src/hammock_cafe/config.clj#L37
:
(defn deep-merge
Recursively merges maps. If keys are not maps, the last value wins.
[ vals]
(if (every?
Looks like a featurec bug, please file a ticket
http://dev.clojure.org/jira/browse/LOGIC
Thanks!
David
On Thu, Apr 25, 2013 at 5:53 PM, Martin Forsgren
martin.forsg...@gmail.comwrote:
Hi!
I noticed something strange when using featurec with a nested feature map(I'm
using core.logic
Murtaza,
Thanks for having a look at the library. I'll try to answer you questions
as best as I can.
*How does Garden compare to other pre processors such as sass and less?*
*
*
There are some similarities with Garden and other CSS preprocessors. I've
tried to bring over the ones I found most
One interesting thing you could do, given both Garden and
ClojureScript, is package CSS frameworks like Twitter Bootstrap or
Zurb Foundation as a Clojure library. I am sorely tempted to give this
a try.
On Thu, Apr 25, 2013 at 6:12 PM, Joel Holdbrooks cjholdbro...@gmail.com wrote:
Murtaza,
It's funny you should bring that up! I've actually been working on
extracting the grid system from Bootstrap and modular scale from
Foundation. But it's mostly been tinkering.
* I am sorely tempted to give this a try.*
Please do! If I come up with something I'll be sure to share a Gist.
On
...0? :-)
Tim Daly
--
--
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.
To unsubscribe from this
Hi,
I thought I'd share a github issues app/bot I wrote to make my life easier
as an author and hopefully my users:
https://github.com/cldwalker/gh-active-issues#readme
The app does two main things:
* It lists issues the maintainer considers active. See my list at
48 matches
Mail list logo