Re: Sequential conditional transforms of an argument

2013-07-07 Thread Laurent PETIT
thank you all for your answer.

So to go back to my original concern, there does not seem to be a way
to do this as I intended by just combining the existing features in
core.

Cheers,

--
Laurent

2013/7/8 Yoshinori Kohyama :
> Hi Laurent,
>
> How about a macro like below?
>
>   (defmacro tt
> ([x] x)
> ([x ts tr & more] `(tt (if (~ts ~x) (~tr ~x) ~x) ~@more)))
>
> To use this,
>
>   (tt x test1 transform1 test2 transform2 test3 transform3)
>
> This doesn't work even number of arguments as you see.
>
> HTH,
> Y.Kohyama
>
> --
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Don't understand why this core.async code fails

2013-07-07 Thread vemv
As you can read here: 
http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io 
doing blocking IO in a go block should be avoided. So I was thinking that 
an alternative to non-blocking IO APIs is using agents and channels.

The following sample program intends to illustrate the technique:

(require '[clojure.core.async :as async :refer :all])
(import '[java.util.concurrent Executors])

(spit "bar" (apply str (shuffle (range 100

(def slurper (agent nil))

(def spitter (agent nil))

(def max-concurrency 1)

;; when a go block wants to slurp a file, it communicates it by writing to 
thins channel
(def slurping-request (chan max-concurrency))

;; where requested slurped content gets served
(def slurps (chan max-concurrency))

(def rw-pool (Executors/newFixedThreadPool max-concurrency))

(def serving
  (future
(while (!! slurps (seq (slurp "bar"))) 
_)

(go (while true
  (>! slurping-request :req)
  (let [old (http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Sequential conditional transforms of an argument

2013-07-07 Thread Yoshinori Kohyama
Hi Laurent,

How about a macro like below?

  (defmacro tt
([x] x)
([x ts tr & more] `(tt (if (~ts ~x) (~tr ~x) ~x) ~@more)))

To use this,

  (tt x test1 transform1 test2 transform2 test3 transform3)

This doesn't work even number of arguments as you see.

HTH,
Y.Kohyama

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ClojureScript browser REPL goes bonkers after it evals

2013-07-07 Thread James MacAulay
I was consistently experiencing this issue, and upgrading to leiningen 
2.2.0 fixed it for me. The root issue was in nrepl:

http://dev.clojure.org/jira/browse/NREPL-39

It was fixed in nrepl-0.2.3, which got into leiningen-2.2.0 via reply-0.2.0.


On Tuesday, 26 February 2013 07:55:01 UTC-5, David Nolen wrote:
>
> Feel free to open a ticket in JIRA. More details would be helpful and a 
> patch would be nice. Thanks!
>
> On Monday, February 25, 2013, Bobby Wang wrote:
>
>> Update: this seems to only happen if I start the CLJS REPL inside a CLJ 
>> REPL. If I start straight from the command line (ie. lein trampoline 
>> cljsbuild repl-listen) it's fine.
>>
>> On Monday, 25 February 2013 19:22:06 UTC-5, Bobby Wang wrote:
>>>
>>> Hi,
>>>
>>> Sometimes when I start the CLJS browser REPL and evaluate something like 
>>> js/alert, the alert runs fine, but after a few seconds it goes into an 
>>> infinite loop while repeatedly printing "*ClojureScript:cljs.user> 
>>> java.io.IOException: Write end dead*".
>>>
>>> The same thing happens on ClojureScript One, which I think uses older 
>>> dependencies.
>>>
>>> Any idea what might be wrong?
>>>
>>> My setup:
>>>
>>> * clojure 1.4.0
>>> * clojurescript 0.0-1586
>>> * lein-cljsbuild 0.3.0
>>> * Mac OS X 10.8.2
>>> * Java 1.6.0_41 that came with OS X
>>> * Also tried to install Oracle's Java 7, but it doesn't seem to work out 
>>> of box yet
>>>
>>> Much appreciated,
>>>
>>> Bobby
>>>
>>
>>  

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




ANN: codn, clojure source code as EDN data

2013-07-07 Thread kovas boguta
Codn parses clojure source code into pure EDN structures.

github: https://github.com/kovasb/codn
clojars: [codn/codn "0.1.0-SNAPSHOT"]

The main use case I have in mind is doing source code analysis, but there
are others.

The clojure reader (and clojure.tools.reader) interpret reader macros, thus
returning structures that are not literally present in the source. Also,
the semantics of reader macros, constructor literals and the like are bound
to the environment, which has implications both for safety and
reproducibility.

Codn will parse source code into pure EDN data that literally represents
what was present in the source:

(require '[codn.parser.core :as p])

(p/parse-string "`a")
=> {:head :syntax-quote, :body [{:head :symbol, :value a}]}

There is also a read-codn function for reading the codn representation into
live clojure datastructures.

See the readme for more details. This is heavily WIP.

Comments welcome.

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Overflowing (count ...)

2013-07-07 Thread John Jacobsen
Was unsure whether to post to clojure or clojure-dev, but here goes.

I was surprised to learn today that count silently overflows to negative 
numbers:

jenome.core> (time (count (range (*' 1000 1000 1000 3
"Elapsed time: 375225.663 msecs"
-1294967296
jenome.core> 

I can easily get around this with my own (non-overflowing) count function, 
but would it make sense for count throw an ArithmeticException on overflow, 
with *unchecked-math* set to false (as it is in my case)?

Curiously,
John

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




ANN: conditions 0.1.0, a simple resumable exceptions library

2013-07-07 Thread Ben Wolfson
Hello all,

I'm releasing a small library for using resumable exceptions, aka
conditions, in Clojure. Resumable exceptions allow the decision about what
kind of response to take to an exception to be made in a separate place
(higher up the call stack) from where the actual response itself is taken
(generally right at the place where the exception was raised). To use in a
leiningen project:

[bwo/conditions "0.1.0"]

Code:

https://github.com/bwo/conditions/

The test suite contains a translation of this example illustrating
conditions in CL :

(defn reciprocal-of [v]
  (c/rtry (if (== v 0) (slingshot/throw+ {:type :zerodivisionerror}) (/ 1 v))
  (c/resume-with [:type :return-zero] _ 0)
  (c/resume-with [:type :return-value] {v :value} v)
  (c/resume-with [:type :recalc-with] {v :value} (reciprocal-of v

(defn determine-infinity []
  (c/rtry (let [result (reciprocal-of 0)]
(println "Value:" result)
result)
(c/resume-with [:type :continue] _ -1)))

(defn restarter [n]
  (c/handle (determine-infinity)
(c/catch [:type :zerodivisionerror] _ (c/resume {:type
:recalc-with :value n}

(defn aborter []
  (c/handle (determine-infinity)
(c/catch [:type :zerodivisionerror] _ (c/abort 0


Evaluating "(restarter 5)" prints "1/5" and evaluates to 1/5; evaluating
"(aborter)" doesn't print anything ("abort" jumps to the handler) and
evaluates to 0.

The README and docstrings in core.clj are fairly extensive; comments on any
aspect are welcome.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




core.async & ring middleware vs pedestal interceptors

2013-07-07 Thread bernardH
Dear clojurians,

Like many others here, I'm thrilled by the new core.async and wondering
about all the goodies that we will be able to reap from it.  Thinking
about how it decouples the abstracts "threads" of execution with the
concrete implementation thread(s) especially in the context of
non-blocking network io[*], it reminded me of transactors in pedestal.

A (the) barrier to entry for using pedestal is that it departs for the
established ring simplicity with interceptors. Tim Ewald convincingly
argues that this was unavoidable in order to scale to the a number of
connections that exceeds the number of available (OS) threads, as can be
the case with long polling ans Server Sent Events. And this is also
restated in the pedestal interceptor docs [***]

However, I was wondering if such goal could not be met now with
core.async and ring middlewares working on channels ?
Would the performance hit be too large ? []
Would it be still not flexible enough ?

Cheers,

B.


[*] 
http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io/
[**] http://thinkrelevance.com/blog/2013/03/18/pedestal-podcast-episode-027 
@ 15'
[***] http://pedestal.io/documentation/service-interceptors/
[] 
http://programming-puzzler.blogspot.fr/2013/07/stackless-clojure-with-coreasync_7.html

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Contrib libs where the name starts with "core."

2013-07-07 Thread John Gabriele
Thanks, Jeremy, and thanks also for the additional info. :)

On Sunday, July 7, 2013 12:12:05 PM UTC-4, Jeremy Heiler wrote:
>
> The "core" contribs are basically language extensions that don't need to 
> be shipped in the Clojure jar. In some case, they're better off being on 
> their own because then their release cycles are independent from the core 
> language. The other prefixes are used when it makes sense to use something 
> more specific. For example, the "java" prefix is for libraries that wrap 
> existing Java libraries, "tools" is for libraries for Clojure tooling, and 
> "data" is for working with various data formats and structures.
>  
> On July 7, 2013 at 4:34:47 AM, John Gabriele (jmg...@gmail.com) 
> wrote:
>
> Why do some of the contrib library names begin with "core."? What's the 
> difference between these and the other contrib libs (ex. java.jdbc or 
> tools.reader)?
>
>

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Most idiomatic way to split a string into sentences by punctuation?

2013-07-07 Thread Cedric Greevey
On Sun, Jul 7, 2013 at 12:29 PM, Denis Papathanasiou <
denis.papathanas...@gmail.com> wrote:

>
>
> On Sunday, July 7, 2013 6:06:06 AM UTC-4, Jim foo.bar wrote:
>>
>>  I'm not sure I follow what you mean...both regexes posted here preserve
>> the punctuation...here is mine (ignore the names - it is in fact the same
>> regex):
>>
>
> You're right; I was actually referring to the suggestions Lars had made.
>
>>
>> [snip]
>>
>>
>> Similar thing happens with Lars's simpler regex...just use 're-seq'
>> instead of 'split'
>>
>
> That wasn't my experience:
>
> #'user/sentences
> user=> (nth sentences 0)
> "THE country of the ancient Mexicans, or Aztecs as they were called,
> formed but a very small part of the extensive territories comprehended in
> the modern republic of Mexico"
> user=> (nth sentences 1)
> " Its boundaries cannot be defined with certainty"
> user=> (nth sentences 2)
> " They were much enlarged in the latter days of the empire, when they may
> be considered as reaching from about the eighteenth degree north to the
> twenty-first on the Atlantic"
>
> Actually, I also thought of a way to do it with the simple example
> suggested by Lars w/o using the nlp package (this only works b/c there are
> no pipe characters in the text file I'm processing):
>

[snip]

Some people, when confronted with a problem, think “I know, I'll use
regular expressions.”  Now they have two problems. :)

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Most idiomatic way to split a string into sentences by punctuation?

2013-07-07 Thread Denis Papathanasiou


On Sunday, July 7, 2013 6:06:06 AM UTC-4, Jim foo.bar wrote:
>
>  I'm not sure I follow what you mean...both regexes posted here preserve 
> the punctuation...here is mine (ignore the names - it is in fact the same 
> regex):
>

You're right; I was actually referring to the suggestions Lars had made. 

>
> [snip]
>
> Similar thing happens with Lars's simpler regex...just use 're-seq' 
> instead of 'split'
>

That wasn't my experience:

#'user/sentences
user=> (nth sentences 0)
"THE country of the ancient Mexicans, or Aztecs as they were called, 
formed but a very small part of the extensive territories comprehended in 
the modern republic of Mexico"
user=> (nth sentences 1)
" Its boundaries cannot be defined with certainty"
user=> (nth sentences 2)
" They were much enlarged in the latter days of the empire, when they may 
be considered as reaching from about the eighteenth degree north to the 
twenty-first on the Atlantic"
 
Actually, I also thought of a way to do it with the simple example 
suggested by Lars w/o using the nlp package (this only works b/c there are 
no pipe characters in the text file I'm processing):

user=> (def sentences (clojure.string/split(clojure.string/replace my-text 
#"([.?!;])\s{1}" "$1|||") #"\|\|\|"))
#'user/sentences
user=> (nth sentences 0)
"THE country of the ancient Mexicans, or Aztecs as they were called, 
formed but a very small part of the extensive territories comprehended in 
the modern republic of Mexico."
user=> (nth sentences 1)
"Its boundaries cannot be defined with certainty."
user=> (nth sentences 2)
"They were much enlarged in the latter days of the empire, when they may be 
considered as reaching from about the eighteenth degree north to the 
twenty-first on the Atlantic;"
user=> (nth sentences 3)
"and from the fourteenth to the nineteenth, including a very narrow strip, 
on the Pacific."

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Contrib libs where the name starts with "core."

2013-07-07 Thread Jeremy Heiler
The "core" contribs are basically language extensions that don't need to be 
shipped in the Clojure jar. In some case, they're better off being on their own 
because then their release cycles are independent from the core language. The 
other prefixes are used when it makes sense to use something more specific. For 
example, the "java" prefix is for libraries that wrap existing Java libraries, 
"tools" is for libraries for Clojure tooling, and "data" is for working with 
various data formats and structures.

On July 7, 2013 at 4:34:47 AM, John Gabriele (jmg3...@gmail.com) wrote:

Why do some of the contrib library names begin with "core."? What's the 
difference between these and the other contrib libs (ex. java.jdbc or 
tools.reader)?

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: New CSS library - Garden

2013-07-07 Thread Steven Degutis
>
> The beautiful thing about programming stylesheets in Clojure is that we
> can come up with whatever abstractions/techniques we like without being
> tied down by syntax. There's a lot of potential there for some interesting
> ideas.


In the past I've been bitten hard because the
wrongabstractions were settled on too early.
So I try to always
take 
painsto make sure I
either don't use any abstractions, or make absolutely sure
they'll last a very long time without going past their expiration date too
quickly. So while I'm sure we'll need some more abstractions, I think it's
important to let them evolve naturally rather than jumping to them too
quickly and without enough data.

Some people are definitely looking for this. If you come up with something,
> even a simple gist, please share it. I'm still loading/compiling
> stylesheets manually. :P

(def home-style
  {:css (css garden-code)
   :path (format "/css/home-%s.css" (md5 compiled-css))
   :route (GET path [] (valid-request-with compiled-css))})

Then, in my hiccup I just use (:path home-style), and in my routes I have
(:route home-style). This makes the html file smaller, and lets CDNs and
browsers cache the css with full confidence since it's content-hashed. Plus
this way it's compiled only once, before any routes are requested.

Oh, I don't know if you saw this gist but there's also some interest in
> ideas surrounding grid systems.


Neat, thanks. I may have to borrow ideas from that.

-Steven


On Sat, Jul 6, 2013 at 11:40 PM, Joel Holdbrooks wrote:

> Cool. I'm glad you like the library. Thanks for sharing your kind words
> and thoughts. :)
>
> *"I admit it's weird that it just vector-izes its arguments, and does
> nothing else."*
>
> In that case I don't think you need a macro, just alias *rule* to *vector* and
> you'll achieve the same end.
>
> *"I think it should be part of the garden lib..."*
>
> I don't think there would be any harm in adding this as an alias;  I tend
> to do a similar thing aliasing *styles* to list.
>
> *"And abstracting really feels like it shouldn't be used to solve the
> problem of indentation."*
>
> That's definitely *not* the only reason why *defrule* was added but it
> could be used to address* that problem *which is why I brought it up. The
> beautiful thing about programming stylesheets in Clojure is that we can
> come up with whatever abstractions/techniques we like without being tied
> down by syntax. There's a lot of potential there for some interesting ideas.
>
> *"I've been experimenting with some ways of integrating it with compojure
> for some Rails4-like "asset-pipelining"..."*
>
> Some people are definitely looking for this. If you come up with
> something, even a simple gist, please share it. I'm still loading/compiling
> stylesheets manually. :P
>
> Oh, I don't know if you saw *this 
> gist* but
> there's also some interest in ideas surrounding grid systems.
>
> Thanks,
>
> Joel
>
> On Jul 6, 2013, at 7:41 PM, Steven Degutis  wrote:
>
> Right, I understand how defrule works. But I actually do have 27 [i.e.
> O(n)] distinct rules, so it's not a feasible solution.
>
> Because when I write CSS, I only style domain-specific class names (.cart,
> .license), never mentioning the elements they just so happen to use at the
> moment (h1, p, a). This lets me change the implementation quickly and
> easily. And it makes it easier to write for other devices/sizes.
>
> So really I only use defrule for the pseudo-selectors you just linked to
> (hover, active, nth-child). Besides that I really have no use for it.
>
> And abstracting really feels like it shouldn't be used to solve the
> problem of indentation. Besides, like Dan Neumann mentioned in that Github
> Issue, abstracting anything in my stylesheet too early can lead to wrong
> abstractions that are difficult to revert. So right now I define an entire
> section (header, footer, cart) as one big nested vector, nothing extracted.
> Sure, I'll probably clean it up later, but only after I have more pages and
> can see more patterns emerging clearly.
>
> Although, I have abstracted one thing which I hope will turn out useful:
>
> (def clearfix
>   [:&
>[:&:after {:clear "both"}]
>[:&:before
> :&:after {:display "table" :content "''"}]])
>
> Then you can embed it as a rule anywhere that you need to clear some
> floats:
>
> [:.some-container-with-floats clearfix]
>
> But as for indentation, so far I'm liking the "rule" macro more and more.
> I admit it's weird that it just vector-izes its arguments, and does nothing
> else. But the fact that it's a function call fixes the indentation problem
> wonderfully.
>
> I think it should be part of the garden lib, really. Although lately I've
> renamed it to "%" so my eyes aren't drawn to the wrong thing when I'm
> skimming my rules. It was "!" for a while but t

Re: Most idiomatic way to split a string into sentences by punctuation?

2013-07-07 Thread Jim - FooBar();
I'm not sure I follow what you mean...both regexes posted here preserve 
the punctuation...here is mine (ignore the names - it is in fact the 
same regex):


hotel_nlp.concretions.artefacts=> (pprint (hotel_nlp.protocols/run reg-seg

/"Statistics is closely related to probability theory, with which it is 
often grouped. The difference is, roughly, that probability theory 
starts from the given parameters of a total population to deduce 
probabilities that pertain to samples. Statistical inference, however, 
moves in the opposite direction---inductively inferring from samples to 
the parameters of a larger or total population!"/))


["Statistics is closely related to probability theory, with which it is 
often grouped."
"The difference is, roughly, that probability theory starts from the 
given parameters of a total population to deduce probabilities that 
pertain to samples."
"Statistical inference, however, moves in the opposite 
direction---inductively inferring from samples to the parameters of a 
larger or total population!"]


Similar thing happens with Lars's simpler regex...just use 're-seq' 
instead of 'split'


Jim

On 06/07/13 22:05, Denis Papathanasiou wrote:



On Saturday, July 6, 2013 1:54:49 PM UTC-4, Jim foo.bar wrote:

I use this regex usually it's been a while since I last used it so
I odn't remember how it performs...


#"(?<=[.!?]|[.!?][\\'\"])(?Thanks, though as I replied to Lars, I did want to preserve the actual 
terminating punctuation, whatever it was, so that why I'd looked into 
using partition-by.


Also, sorry for the double post (I didn't realize this group was 
moderated, so when I didn't see the first post appear, I re-submitted 
it a little while later).

--
--
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Contrib libs where the name starts with "core."

2013-07-07 Thread John Gabriele
Why do some of the contrib library names begin with "core."? What's the 
difference between these and the other contrib libs (ex. java.jdbc or 
tools.reader)?

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.async

2013-07-07 Thread Devin Walters
Interesting post. Thanks Cedric.

'(Devin Walters)

On Jul 6, 2013, at 6:59 PM, Cedric Greevey  wrote:

> The obvious approach is to use a future or other thread as an intermediary 
> between the blocking I/O read and a channel, then use !< on the channel in a 
> go; something like:
> 
> (go
>   (let [c (chan)]
> (future (>!! c (my-blocking-io-read some-stream)))
> (let [thingy (!< c)
>   (do-something-with thingy
> 
> The channel can then be used in alts! and what-not as well, if you want to 
> react to any of several possible "next things", only one of which is the I/O 
> read completing and returning a value.
> 
> This *does* suggest making a small async.io library that provides a 
> nonblocking read operation that returns a channel, and maybe other related 
> facilities, such as a line-chan that pops line after line from the input I/O 
> source when read from, byte-chan (for binary files), edn-chan (top level edn 
> forms read from input), etc.
> 
> 
> 
> On Sat, Jul 6, 2013 at 3:23 PM, dennis zhuang  wrote:
>> It's so cool,great job!
>> But i don't find any way to do io blocking operations such as socket.read in 
>> 'go'.
>> Is there a roadmap to make alts! working with java NIO selector that waits 
>> on socket channels?
>> Then we can read/write data with socket/file channel in go without blocking.
>> Thanks,it's really awesome!
>> 
>> 
>> 
>> 
>> 2013/7/1 David Pollak 
>>> Thanks!
>>> 
>>> 
>>> On Mon, Jul 1, 2013 at 8:13 AM, Sean Corfield  
>>> wrote:
 On Sun, Jun 30, 2013 at 4:42 PM, David Pollak  wrote:
 > Looking forward to it
 > being published (even as SNAPSHOT) in a Maven repo.
 
 It's accessible like this:
 
 (defproject async "0.1.0-SNAPSHOT"
   :description "FIXME: write description"
   :url "http://example.com/FIXME";
   :license {:name "Eclipse Public License"
 :url "http://www.eclipse.org/legal/epl-v10.html"}
   :repositories {"sonatype-oss-public"
 "https://oss.sonatype.org/content/groups/public/"}
   :dependencies [[org.clojure/clojure "1.5.1"]
  [org.clojure/core.async "0.1.0-SNAPSHOT"]])
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 
 "Perfection is the enemy of the good."
 -- Gustave Flaubert, French realist novelist (1821-1880)
 
 --
 --
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups 
 "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
>>> 
>>> -- 
>>> -- 
>>> 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 group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> --- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>> 
>> 
>> 
>> -- 
>> 庄晓丹 
>> Email:killme2...@gmail.com xzhu...@avos.com
>> Site:   http://fnil.net
>> Twitter:  @killme2008
>> 
>> 
>> -- 
>> -- 
>> 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 group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To

[ANN] Instaparse 1.2.0

2013-07-07 Thread Mark Engelberg
Instaparse  is an easy-to-use,
feature-rich parser library.  The big idea behind instaparse is to make it
simple to convert grammars to parsers without needing to know the
idiosyncrasies of LL1, LALR, and other esoteric grammar restrictions
imposed by most parser generators.

Here are the highlights of the new 1.2.0 release:

1. Several significant performance improvements.

2. Two new functions, `span` and `visualize` which allow you to better
understand the structure of your parse tree.
https://github.com/Engelberg/instaparse/#understanding-the-tree

3. A new optional keyword argument to `parse` and `parses` that allows you
to reveal hidden information, primarily for debugging purposes.
https://github.com/Engelberg/instaparse/#revealing-hidden-information


I've received a few questions from instaparse users who wanted to know if I
had any performance tips.  Since version 1.2.0 is primarily a
performance-oriented release, it seemed fitting to include, as part of the
release, a list of performance tips as well as an expanded essay about
instaparse's performance and what I'm striving for.

https://github.com/Engelberg/instaparse/blob/master/docs/Performance.md


Thanks to everyone who provided feature requests on the github site, and
especially to those who tracked along with the 1.2.0-SNAPSHOT releases and
provided feedback for this new release.

-- 
-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.