Building on Michal's example, here is a "more minimal example" --
which also "fails" in Clojure:
(ns test
(:require [clojure.core.async :as async]))
(defmacro silly [obj pat1 body1 other]
`(case ~obj
~pat1 ~body1
~other))
(let []
(def out (java.io.StringWriter.))
(defn log
Hmmm, looks like I can replace
#(not (nil? %))
by
(complement nil?)
which seems more elegant.
Also, it looks like I don't need that (into [] ), which will keep the code
cleaner.
I think I could also get rid of the (or) by always adding "(last params)"
at the end of the sequence from which I
So here is a new attempt at the quantize function so that I no longer have
to deal with the "infinity" problem:
(defn quantize-2
[x params]
(let [f (partial (fn [a [b c]] (cond(<= a c) b)) x)]
(or
(first (filter #(not (nil? %)) (map f (into [](partition 2 params)
(last p
So here is a new attempt at the quantize function so that I no longer have
to deal with the "infinity" problem:
(defn quantize-2
[x params]
(let [f (partial (fn [a [b c]] (cond(<= a c) b)) x)]
(println (first (filter #(not (nil? %))(map f (into [](partition 2
params))
(or
thanks Michal for the fix.
On Mon, Feb 17, 2014 at 12:58 AM, Michał Marczyk
wrote:
> It is now, thanks for the report!
>
> Ticket with patch:
>
> http://dev.clojure.org/jira/browse/CLJS-765
>
>
> On 16 February 2014 17:48, Sunil S Nandihalli
> wrote:
> > Hi Everybody,
> >
> > I get the followin
So here is a new attempt at the quantize function so that I no longer have
to deal with the "infinity" problem:
(defn quantize-2
[x params]
(let [f (partial (fn [a [b c]] (cond(<= a c) b)) x)]
(or
(first (filter #(not (nil? %)) (map f (into [](partition 2 2 params)))
(las
Hi, Joerg.
When I have a sequence I want to split into sub-sequences, I use the
partition.* functions:
(->> your-seq (partition-by string?) (partition 2))
will get you very close to your solution.
A slightly lower-level technique if you need more control is to construct a
lazy sequence yourself
All good points Andy. Thanks. I'll continue working on it until I'm happy.
I am almost never happy with anonymous functions either. In this particular
case, though, the function is so simple that I felt it would be overkill to
externalize it into another function (unless I'm really going to use
Hi Michal,
Does this mean:
(a) the reported behavior is normal (and my bug report is invalid) or
(b) this error happens in both cljs + clojure ?
Thanks!
On Mon, Feb 17, 2014 at 4:33 PM, Michał Marczyk
wrote:
> Just to be clear, the above is a version of t x's bug-report modified
> to us
On Monday, February 17, 2014 6:43:18 PM UTC-5, Laurent Droin wrote:
>
>
> (def inf Long/MAX_VALUE)
> (defn quantize
> [x markers values]
> (let
> [f (partial (fn([%1 %2 %3] (cond (<= %1 %2) %3))) x)]
> (first (filter #(not (nil? %))(map f (conj markers inf) values)
>
>
The reason I
Just to be clear, the above is a version of t x's bug-report modified
to use a StringWriter instead of console.log.
Cheers,
Michał
On 18 February 2014 01:25, Michał Marczyk wrote:
> The same thing happens in Clojure:
>
> (defmacro silly [object pat1 body1 pat2 body2]
> `(case (:tag ~object)
>
The same thing happens in Clojure:
(defmacro silly [object pat1 body1 pat2 body2]
`(case (:tag ~object)
~pat1 ~body1
~body2))
(def out (java.io.StringWriter.))
(defn log [& args]
(doseq [arg args]
(.write out (str arg))
(.write out "\n")))
(defn init []
(silly {:tag :dog
Thanks for verifying!
@tbaldridge: can you enlighten us on if:
* I'm doing something stupid or
* this is an actual bug in cljs/core.async?
Thanks!
On Mon, Feb 17, 2014 at 2:10 PM, Manuel Paccagnella
wrote:
> Tested on Linux x64, Chromium 31.0.1650.63 and Firefox 26.0. Same behaviour
> that
All the good feedback here had me thinking a lot... Especially Andy who
pushed me towards more abstraction.
I loved the idea of functions that return functions and researching all
this led me to embrace "partials".
Here is my current implementation of "quantize". It came out of a lot of
trial a
so, each string(type) is used as a grouping-key, which prefixes every each
following string-in-a-vector as an argument to myfunc in the result list.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegr
Hi,
>From a for-function over some xml-input (filtered and mapped), I get this
list:
("ITEM2" ["ITEM1"] ["B"] "A" "ITEM1" ["C"])
Now what I want is:
((myfunc ITEM2 ITEM1) (myfunc ITEM2 B) (myfunc ITEM1 C))
that is.. every string can have 0 or more vectors as follow-up items
The String "A" has
Tested on Linux x64, Chromium 31.0.1650.63 and Firefox 26.0. Same behaviour
that you have seen. However, I haven't looked at the code yet.
Il giorno lunedì 17 febbraio 2014 20:34:22 UTC+1, t x ha scritto:
>
> Can anyone verify whether this bug is reproducible?
>
> On Mon, Feb 17, 2014 at 12:28 A
Glen,
I did start the implementation in Clojure, but had to move it under the
skin of PersistentHashMap to achieve what I needed, so it is now written in
Java and is part of PersistentHashMap... I don't think it would be
practical to make it an add-on - but it would be nice :-). I'll keep it in
Alex,
thanks for the suggestion - I'll look at collection-check and raise the
appropriate JIRA when I am happier with the code / idea.
Jules
On Monday, 17 February 2014 13:21:28 UTC, Alex Miller wrote:
>
> It is too late, but an enhancement jira would be appropriate. I would
> highly encourag
I've started doing some more serious testing and have not encountered any
problems so far. I was a bit worried about the interaction of splice and
transient/persistent!, but have not encountered any problems yet. I am
going to read through the code again to satisfy myself that there is no
issue
Can anyone verify whether this bug is reproducible?
On Mon, Feb 17, 2014 at 12:28 AM, t x wrote:
> Hi,
>
> repo: https://github.com/txrev319/bug-report
>
> I have a really weird bug where:
>
> * (my-macro ...) ==> everything works
>
> * (async/go (my-macro ...)) ==> something weird happen
Thanks for this!
On Monday, February 17, 2014 4:49:38 AM UTC-8, Andy- wrote:
>
> On Sunday, February 16, 2014 11:19:58 PM UTC-5, Bruno Kim Medeiros Cesar
> wrote:
>>
>> (BTW, Andy, how do you format your code so prettily?)
>>
> I usually just paste it into pygments.org and then paste it back into
Hi,
I'm fairly new to clojure as well, but I like this way, and I *think* it's
idiomatic:
Data structure:
[{:zone-max 100 :zone-key :hr-zone-1}
{:zone-max 120 :zone-key :hr-zone-2}
{:zone-max 140 :zone-key :hr-zone-3}
{:zone-max 160 :zone-key :hr-zone-4}
{:zone-max 333 :zone-key :hr-zone-5}
:eval-in can be overridden in your project.clj, just add:
:speclj-eval-in :subprocess
I agree that the default is rather odd - especially when the only reason
I'm aware of is "it's a bit faster"
Cheers
Glen
On Monday, 17 February 2014 12:09:13 UTC, Karsten Schmidt wrote:
>
> Hi all, am tryin
Is there a specific part of this implementation which means it needs to
live in core?
It would be cool to have this as a library that could be used with existing
versions of clojure (I have no idea if enough of the internals are exposed
to make this viable)
Glen
On Saturday, 15 February 2014
CLJ-700 is a bug, regardless of whether it is marked as alpha or not.
This ticket has a strange history of approval statuses (pre-dating my
involvement with jira) that caused it not to be included in 1.6 earlier.
Unfortunately, I think it is too big a change to consider at this point in
1.6 (d
Since transients are no longer marked as alpha, I want to take this (last?)
chance to raise an interface question concerning them:
Right now, we cannot distinguish whether a transient contains a key with a
nik value or if it doesn't contain the key, because contains? doesn't work
on transients.
Is
On Mon, Feb 17, 2014 at 3:43 AM, Ransom Williams wrote:
> First of all thanks to everyone working on clojure for making web
> development suck less. I recently sandboxed a clojure server application,
> and the tooling, documentation, and availability of libraries are all
> awesome.
>
> Anyway, I'
Hi t x and Jan,
what about performing the side effect part of the function adding a watch?
(They are no more in alpha with the upcoming 1.6.)
Cheers,
Luca
Il giorno lunedì 17 febbraio 2014 09:29:57 UTC+1, t x ha scritto:
>
> Hi Jan,
>
> Thanks for your explanations.
>
> I have no idea how
Wow, thanks Gianluco, Andy and Bruno. Lots of good feedback I am trying to
process. It's amazing how coming up with a satisfying "functional
programing" style function is a complex process when you've been doing
imperative programing all your life. It's really a whole different way of
thinking.
It is too late, but an enhancement jira would be appropriate. I would
highly encourage some generative tests in such a patch and perhaps looking
at https://github.com/ztellman/collection-check. With simple.check moving
into contrib as test.check, we expect to be able to use test.check within
Cl
On Sunday, February 16, 2014 11:19:58 PM UTC-5, Bruno Kim Medeiros Cesar
wrote:
>
> (BTW, Andy, how do you format your code so prettily?)
>
I usually just paste it into pygments.org and then paste it back into
google groups (which accepts the generated HTML).
Cheers
--
You received this messa
Oh I just saw that's a known issue with Speclj and its setting of `:eval-in
:leiningen`
https://github.com/slagyr/speclj/issues/78
I guess i will have to switch to another test framework then...
On 17 Feb 2014 12:09, "Karsten Schmidt" wrote:
> Hi all, am trying to test out the new hashing appro
Hi all, am trying to test out the new hashing approach for my datatypes in
1.6 but it seems that even though I'm referring to the latest beta in my
project.clj, Speclj is overriding that dependency with 1.5.1 and I can't
run my tests. How can I force it to honor my setting and use 1.6.0-beta1? I
gu
First of all thanks to everyone working on clojure for making web
development suck less. I recently sandboxed a clojure server application,
and the tooling, documentation, and availability of libraries are all
awesome.
Anyway, I'm starting in with a clojurescript client now and want to confirm
On Sunday, February 16, 2014 11:49:38 AM UTC+1, Mikera wrote:
>
> Wow - that's a pretty big win. I think we should try and get this into
> Clojure ASAP.
>
> Are we too late for 1.6?
>
Yeah, this is probably too late for 1.6 =/
Anyway, cool stuff you got going on here. I'm playing around with s
Hi Mark,
On Monday, February 17, 2014 12:05:24 AM UTC+1, puzzler wrote:
>
> I am unable to find a style file that supports clojure code in LaTeX. Can
> anyone point me in the right direction?
>
I always use Minted for this kind of stuff: See
https://code.google.com/p/minted/
It is available i
Sure.
1. Setup MELPA:
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/";))
2. Install `lispy` from MELPA:
M-x package-install lispy
3. Get `clojure-semantic` from git:
cd ~/git
git clon
Hi Jan,
Thanks for your explanations.
I have no idea how I managed to completely misunderstand
clojure/atom for the past few years -- I suspect it's because I never
use clojure/STM, and as a result, I've never had an atom roll back on
me.
I've decided to switch to agents.
Thanks again f
Hi,
repo: https://github.com/txrev319/bug-report
I have a really weird bug where:
* (my-macro ...) ==> everything works
* (async/go (my-macro ...)) ==> something weird happens
A minimal failure case is documented at:
https://github.com/txrev319/bug-report/blob/master/src/app.cljx
40 matches
Mail list logo