Hi,
I'm observing an incredibly weird bug in my program where this happens on
the REPL
(use 'myapp.some.stuff)
(def x (->Record 1))
(type x) ; => myapp.some.stuff.Record
(instance? myapp.some.stuff.Record x) ; => false
(instance? (type x) x) ; => true
Somewhere the namespace gets reloaded, and
Hi,
I tried replacing a closure with a dynamically built and evaluated
metafunction but discovered that it was actually slower.
Here's a minimal example:
(defn f1 [x](fn [y ] (=x y )))
(defn f2 [x] (eval `(fn [y#] (= ~x y#
(defn f3 [x] (eval `(fn [y#] (= ~@[x] y#
(use 'c
It gets even weirder. I tried this hoping it would create a closure like f1
does:
(defn f4 [x] (eval `(let [[x#] ~@[[x]]]
(fn [y#]
(= x# y#)
And indeed using no.disassemble in my test cases f1 and f4 always create
the same bytecode: a clojure.la
Hi Atamert,
Here's a gist with the example code:
https://gist.github.com/neapel/4e502a14e3738b709672
I tried replacing a closure with a dynamically built and evaluated
>> metafunction but discovered that it was actually slower.
>>
>
> If evaluating code during run is slower than AOT compiling i
On Thursday, July 3, 2014 5:19:56 PM UTC+1, adrian...@mail.yu.edu wrote:
>
> You're going down a rabbit hole here. Evaluating forms at runtime will
> always result in a slower execution time than a function that doesn't
> evaluate a form at runtime.
>
I thought that was the whole point of Clo
On Thursday, July 3, 2014 6:15:32 PM UTC+1, adrian...@mail.yu.edu wrote:
> I'm not sure I understand what you're saying here. :( Your example is
> simply benchmarking the same bit of code in each form. Why would evaluating
> one explicitly affect that benchmark? Your original example called eval
On Thursday, July 3, 2014 7:27:24 PM UTC+1, adrian...@mail.yu.edu wrote:
> "No I'm benchmarking the functions returned by f1-4."
>
> Where did I say different?
>
I understood "Your original example called eval in the body of the
functions that you're benchmarking" as meaning I was running some
Hi Atamert,
I'm not an expert but I believe REPL does compile the forms you enter to
> bytecode. It compiles an fn form into a JVM class that implements IFn. It
> also compiles a quoted form (such as `(fn ...) ) but this time it takes the
> form of a list (as in (list ...) ), IOW it's still dat
Hi,
I'm using clojure.zip to edit a tree by visiting each location using
zip/next, possibly using zip/replace to alter the tree.
There are cases where I replace a part of the tree with another tree that
will/must not be visited, but I couldn't find a good way to skip nodes,
since
(zip/next (zip
ter if you're interested.
>
> Alex
>
>
> On Monday, May 5, 2014 6:01:04 PM UTC-5, Pascal Germroth wrote:
>>
>> Hi,
>>
>> I'm using clojure.zip to edit a tree by visiting each location using
>> zip/next, possibly using zip/replace to alter the tree
Hi,
I'm trying to attach metadata to some values (not the vars holding them).
I thought ^{x} y was the same as (with-meta y {x}), but while it works for
f2/f4, f1's metadata is nowhere to be found, while f3 works as expected:
(def f1 "doc" ^{:x 1} (partial inc))
(meta f1) ; nil, unexpected
(meta
Hi,
Say I'm getting an "ArityException Wrong number of args (2) passed to:
myparser/fn--106751" exception.
Unfortunately the code is quite heavy on the higher order side, so the
stack trace doesn't reveal anything useful, especially since the exception
is thrown by the `apply` before, so I'm no
On 10 May 2014, at 18:36, Ambrose Bonnaire-Sergeant
wrote:
> Have you tried naming the anonymous functions that might be culprits?
>
> (fn trace-me [..] ...)
Yes, that turned out to be the quickest way, naming everything with a vim
command:
:%s/fn \[/\="fn TRACE-" . line(".") . " ["/g
Fixing
13 matches
Mail list logo