[ANN] Eastwood, the Clojure lint tool, version 0.2.1 released

2014-12-22 Thread Andy Fingerhut
Eastwood, the Clojure lint tool, version 0.2.1 has been released.  See
install instructions and complete documentation at [1].

If you use Emacs+Cider or Eclipse+Counterclockwise development
environments, there are now add-ons that integrate Eastwood warnings,
thanks to the work of Peter Fraenkel, Laurent Petit, and other
contributors.  See [2].

Below are some of the changes since version 0.2.0.  A complete list is
at [3].

Go squash some bugs!

Jonas Enlund, Nicola Mometto, and Andy Fingerhut

[1] https://github.com/jonase/eastwood
[2] https://github.com/jonase/eastwood#editor-support
[3]
https://github.com/jonase/eastwood/blob/master/changes.md#changes-from-version-020-to-021



New linters, and new good warnings from existing linters:

* New linter :wrong-ns-form that warns about several kinds of wrong
  or suspicious :require or :use subforms inside ns forms.

* :suspicious-expression linter now warns about trivial uses of more
  clojure.core macros then before.

Fewer unwanted warnings, via logic enhancements or configuration
options:

* Several linters now have configuration options to disable their
  warnings based upon whether the warnings occur inside of a
  macroexpansion of a particular macro.  By default, Eastwood loads
  several config files worth of such disabling options for the linters
  :constant-test, :redefd-vars, :suspicious-expression, and
  :unused-ret-vals that prevent them from generating many unwanted
  warning messages, at least when certain macros are used, such as
  those in core.contracts, core.match, core.typed, Korma,
  Carmine, Timbre, Instaparse, and Schema.  Eastwood users may write
  their own config files to disable more warnings.

* The :wrong-arity linter now generates nearly no unwanted warnings
  when you use the java.jdbc and Hiccup libraries.  Those libraries
  modify the :arglists key in metadata of some of their functions
  and macros for documentation purposes, but in a way that fooled
  Eastwood into generating incorrect warnings.  Like the previous
  item, this is also configurable, and Eastwood users may extend these
  configurations for their own situations.

* The :unused-namespaces linter had several bugs causing it to
  report a namespace that was required or used as being unused,
  when in fact it was.

Other enhancements:

* When reflection or boxed math warnings are enabled and the Clojure
  compiler prints them during Eastwood's eval-ing of your code,
  Eastwood will recognize them and change their format to match that
  of Eastwood's own warnings, so that they may be stepped through in
  editors in the same way as other Eastwood warnings.

* New eastwood.lint/lint function intended for use by developers
  integrating Eastwood with editors and IDEs.

* When specifying lists of linters to use in Eastwood options, can now
  use the keyword :all as an abbreviation for all linters, or
  :default for all linters enabled by default.

-- 
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/d/optout.


Re: gemacl: Scientific computing application written in Clojure

2014-12-22 Thread Henrik Eneroth
Interesting read Jose, thanks!

It might be interesting to try a transducer on 

(defn dot-prod 
  "Returns the dot product of two vectors"
  [v1 v2]
  (reduce + (map * v1 v2)))

if you can get your hands on the 1.7 alpha and the time and inclination to 
do it. Transducers have shown to be faster than running functions in 
sequence. Although I don't know how likely they are to beat native arrays, 
probably not very much.


On Sunday, December 21, 2014 7:10:41 PM UTC+1, Jose M. Perez Sanchez wrote:
>
>
> Regarding the speed optimizations, execution time for a given model was 
> reduced from 2735 seconds to 70 seconds, over several versions by doing 
> several optimizations.
>
> The same calculation implemented in C# takes 12 seconds using the same 
> computer and OS. Maybe the Clojure code can still be improved, but for the 
> time being I'm happy with the Clojure version being six times slower, since 
> the new software has many advantages.
>
> For these tests the model was the circle with radius 1 using the "diffmr1" 
> tracker, the simulation was run using 1 particles and 1 total 
> random walk steps.
>
> These modifications in the critical parts of the code accounted for most 
> of the improvement:
>
> - Avoid reflection by using type hints.
> - Use Java arrays.
> - In some cases call Java arithmetic functions directly instead of Clojure 
> ones.
> - Avoid using partial functions in the critical parts of the code.
>
> Avoiding lazyness did not help much. Regarding the use of Java arrays, 
> there are many small functions performing typical vector operations on 
> arrays, such as the following example:
>
> Using Clojure types:
>
> (defn dot-prod 
>   "Returns the dot product of two vectors"
>   [v1 v2]
>   (reduce + (map * v1 v2)))
>
> Using Java arrays:
>
> (defn dot-prod-j
>   "Returns the dot product of two arrays of doubles"
>   [^doubles v1 ^doubles v2]
>   (areduce v1 i ret 0.0
>(+ ret (* (aget v1 i)
>  (aget v2 i)
>
>
> This gives a general idea of which optimizations helped the most. These 
> changes are not in the public repository, since previous commits have been 
> omitted because the code code was not ready for publication (different 
> license disclaimer, contained email addresses, etc.). If anyone is 
> interested in the diffs and the execution times over several optimizations, 
> please contact me.
>
> Kind regards,
>
> Jose.
>
>
> On Sunday, December 21, 2014 3:38:35 AM UTC-5, Jose M. Perez Sanchez wrote:
>>
>>
>> Hi everyone:
>>
>> Sorry that it has taken so long. I've just released the software in 
>> GitHub under the EPL. It can be found at:
>>
>> https://github.com/iosephus/gema
>>
>>
>> Kind regards,
>>
>> Jose.
>>
>>

-- 
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/d/optout.


Re: Author a Book on Clojure - Packt Publishing

2014-12-22 Thread Jan-Paul Bultmann
Just my 50 cent.

I was asked to do a technical review on a Clojure podcasts by packtpub once.

The "storyboard" they send me consisted of a word file containing a huge table 
with text and source code.

Why would anybody send a technical reviewer source code in a word document, yet 
alone in a table column that has a width of 50 characters which causes it to 
line-wrap everywhere?!

It feels to me that this publisher is just a book mill that goes for quantity 
and not quality.
I couldn't make it thought a single book I bought from them because reading 
them felt like a waste of time.

Of course things might have changed by now and your mileage may vary.
I'm just thinking that if somebody takes the time of writing a book on Clojure,
it should at least be worthwhile.

All the best, Jan

> On 20 Dec 2014, at 09:07, Tushar Gupta  wrote:
> 
> I am Tushar Gupta, an Acquisition Editor at Packt Publishing. We specialise 
> in publishing books, eBooks, video tutorials and articles for IT developers, 
> administrators and users. 
> We are currently planning to develop a book on Clojure Data structures and 
> Algorithms. 
> 
> We are looking for an expert to author this book and share their knowledge 
> and skills with our readers.
> 
> For more information you can mail me on tush...@packtpub.com.
> 
> Looking forward to have some legit responses. :)
> 
> -- 
> Regards,
> Tushar Gupta
> Acquisition Editor
> Packt Publishing 
> www.packtpub.com 
> Skype: packt.tusharg 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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/d/optout 
> .

-- 
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/d/optout.


Re: gemacl: Scientific computing application written in Clojure

2014-12-22 Thread Mikera
For most array operations (e.g. dot products on vectors), I strongly 
recommend trying out the recent core.matrix implementations. We've put a 
lot of effort into fast implementations and a nice clean Clojure API so I'd 
love to see them used where it makes sense!

For example vectorz-clj can be over 100x faster than a naive map / reduce 
implementation:

(let [a (vec (range 1))
   b (vec (range 1))]
(time (dotimes [i 100] (reduce + (map * a b)
"Elapsed time: 364.590211 msecs"

(let [a (array :vectorz (range 1))
  b (array :vectorz (range 1))]
(time (dotimes [i 100] (dot a b
"Elapsed time: 3.358484 msecs"

On Monday, 22 December 2014 17:31:41 UTC+8, Henrik Eneroth wrote:
>
> Interesting read Jose, thanks!
>
> It might be interesting to try a transducer on 
>
> (defn dot-prod 
>   "Returns the dot product of two vectors"
>   [v1 v2]
>   (reduce + (map * v1 v2)))
>
> if you can get your hands on the 1.7 alpha and the time and inclination to 
> do it. Transducers have shown to be faster than running functions in 
> sequence. Although I don't know how likely they are to beat native arrays, 
> probably not very much.
>
>
> On Sunday, December 21, 2014 7:10:41 PM UTC+1, Jose M. Perez Sanchez wrote:
>>
>>
>> Regarding the speed optimizations, execution time for a given model was 
>> reduced from 2735 seconds to 70 seconds, over several versions by doing 
>> several optimizations.
>>
>> The same calculation implemented in C# takes 12 seconds using the same 
>> computer and OS. Maybe the Clojure code can still be improved, but for the 
>> time being I'm happy with the Clojure version being six times slower, since 
>> the new software has many advantages.
>>
>> For these tests the model was the circle with radius 1 using the 
>> "diffmr1" tracker, the simulation was run using 1 particles and 1 
>> total random walk steps.
>>
>> These modifications in the critical parts of the code accounted for most 
>> of the improvement:
>>
>> - Avoid reflection by using type hints.
>> - Use Java arrays.
>> - In some cases call Java arithmetic functions directly instead of 
>> Clojure ones.
>> - Avoid using partial functions in the critical parts of the code.
>>
>> Avoiding lazyness did not help much. Regarding the use of Java arrays, 
>> there are many small functions performing typical vector operations on 
>> arrays, such as the following example:
>>
>> Using Clojure types:
>>
>> (defn dot-prod 
>>   "Returns the dot product of two vectors"
>>   [v1 v2]
>>   (reduce + (map * v1 v2)))
>>
>> Using Java arrays:
>>
>> (defn dot-prod-j
>>   "Returns the dot product of two arrays of doubles"
>>   [^doubles v1 ^doubles v2]
>>   (areduce v1 i ret 0.0
>>(+ ret (* (aget v1 i)
>>  (aget v2 i)
>>
>>
>> This gives a general idea of which optimizations helped the most. These 
>> changes are not in the public repository, since previous commits have been 
>> omitted because the code code was not ready for publication (different 
>> license disclaimer, contained email addresses, etc.). If anyone is 
>> interested in the diffs and the execution times over several optimizations, 
>> please contact me.
>>
>> Kind regards,
>>
>> Jose.
>>
>>
>> On Sunday, December 21, 2014 3:38:35 AM UTC-5, Jose M. Perez Sanchez 
>> wrote:
>>>
>>>
>>> Hi everyone:
>>>
>>> Sorry that it has taken so long. I've just released the software in 
>>> GitHub under the EPL. It can be found at:
>>>
>>> https://github.com/iosephus/gema
>>>
>>>
>>> Kind regards,
>>>
>>> Jose.
>>>
>>>

-- 
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/d/optout.


Re: CIDER 0.8.2 released!

2014-12-22 Thread Sun Ning
Good Job, Bozhidar! I've already updated from MELPA. Everything works 
like a charm.





On 12/21/2014 08:39 PM, Bruce Durling wrote:

Thanks!

cheers,
Bruce

On Sun, Dec 21, 2014 at 10:54 AM, Bozhidar Batsov  wrote:

Ladies and gentlemen, I’m happy to inform you that CIDER 0.8.2 is out! It’s
a bugfix-only release (which means you totally want to use it). Have a look
at the release notes
(https://github.com/clojure-emacs/cider/releases/tag/v0.8.2) for all the
gory details.

This will be the final release in the 0.8.x series (unless some terrible
regression doesn’t pop up). There are no concrete plans for 0.9 yet, but I
hope it will introduce some (or ideally all) of the following:

* better cljs support

* comint-based REPL buffers

* boot support

* better handling of multiple nREPL connections

* and whatever else we manage to fit in :-)

Please, report bugs and submit suggestions for improvements here
https://github.com/clojure-emacs/cider/issues. If you like clojure-mode,
CIDER and inf-clojure you can support their development via Gratipay
https://gratipay.com/bbatsov/

P.S. In related news - squiggly-clojure
(https://github.com/clojure-emacs/squiggly-clojure), a flycheck extension
for CIDER is now an official clojure-emacs project.

--

Cheers,
Bozhidar

--
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/d/optout.


--
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/d/optout.


Re: Author a Book on Clojure - Packt Publishing

2014-12-22 Thread Michael Klishin
On 22 December 2014 at 13:39:12, Jan-Paul Bultmann 
(janpaulbultm...@googlemail.com) wrote:
> It feels to me that this publisher is just a book mill that goes  
> for quantity and not quality.
> I couldn't make it thought a single book I bought from them because  
> reading them felt like a waste of time.
>  
> Of course things might have changed by now and your mileage may  
> vary.
> I'm just thinking that if somebody takes the time of writing a  
> book on Clojure,
> it should at least be worthwhile.

I have recently reviewed a book for them (on a popular open source database).
The process was sane. All code was sent to me in tarballs. The book also ended 
up
being solid, and would likely be one of the best books on the subject available
by the time it is out.

So I guess it's like a box of chocolate. 
--  
@michaelklishin, github.com/michaelklishin

-- 
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/d/optout.


Re: CIDER 0.8.2 released!

2014-12-22 Thread Shahrdad Shadab
Great Job Bozhidar! Thanks for the quality software.

On Mon, Dec 22, 2014 at 8:38 AM, Sun Ning  wrote:

> Good Job, Bozhidar! I've already updated from MELPA. Everything works like
> a charm.
>
>
>
>
>
> On 12/21/2014 08:39 PM, Bruce Durling wrote:
>
>> Thanks!
>>
>> cheers,
>> Bruce
>>
>> On Sun, Dec 21, 2014 at 10:54 AM, Bozhidar Batsov 
>> wrote:
>>
>>> Ladies and gentlemen, I’m happy to inform you that CIDER 0.8.2 is out!
>>> It’s
>>> a bugfix-only release (which means you totally want to use it). Have a
>>> look
>>> at the release notes
>>> (https://github.com/clojure-emacs/cider/releases/tag/v0.8.2) for all the
>>> gory details.
>>>
>>> This will be the final release in the 0.8.x series (unless some terrible
>>> regression doesn’t pop up). There are no concrete plans for 0.9 yet, but
>>> I
>>> hope it will introduce some (or ideally all) of the following:
>>>
>>> * better cljs support
>>>
>>> * comint-based REPL buffers
>>>
>>> * boot support
>>>
>>> * better handling of multiple nREPL connections
>>>
>>> * and whatever else we manage to fit in :-)
>>>
>>> Please, report bugs and submit suggestions for improvements here
>>> https://github.com/clojure-emacs/cider/issues. If you like clojure-mode,
>>> CIDER and inf-clojure you can support their development via Gratipay
>>> https://gratipay.com/bbatsov/
>>>
>>> P.S. In related news - squiggly-clojure
>>> (https://github.com/clojure-emacs/squiggly-clojure), a flycheck
>>> extension
>>> for CIDER is now an official clojure-emacs project.
>>>
>>> --
>>>
>>> Cheers,
>>> Bozhidar
>>>
>>> --
>>> 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/d/optout.
>>>
>>
> --
> 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/d/optout.
>



-- 
Software Architect & Computer Scientist

-- 
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/d/optout.


Re: Better update function

2014-12-22 Thread Juvenn Woo
Dear Steve,  

I’m new in clojure as well, but if we try to break up your one function into 
two, we’d have the following:

(defn update1
  "Given a two-level nested vector of maps, two keys for each map, and
  an update function. Apply the function in the inner map, and returns
  nested structure."
  [vect [k1 k2] f]
  (map
(fn [m] (update-in m [k1] update2 k2 f))
vect))

(defn update2
  "Given a vector of maps, a key for the map, and an update function.
  Apply the function to value of the key."
  [vect k f]
  (map
(fn [item] (update-in item [k] f))
vect))

which seems easier to follow than one, though YMMV.


Best,
--  
jv
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Monday, December 22, 2014 at 12:34 PM, Steve Ashton wrote:

> I'm trying to figure out if there is a better / more concise / more generic 
> way to write an update function. The data I have is a vector of maps 
> containing vectors of maps.  
> For example:
> [{:values [{:y 1 :x 4}{:y 2 :x 7}]}{:values [{:y 5 :x 8}]}]
>  
> The goal is to update all the :y values or all the :x values according to a 
> passed-in function. As a concrete example, I'd like to invert the sign of all 
> the :y values.
>  
> So here's the working function which I've come up with:
>  
> (defn update-nested-fields  
> "Updates a vector of maps containing vectors of maps"
> [col [k1 k2] f]
> (map (fn [outer-map]  
> (update-in outer-map  
> [k1]  
> (fn [inner-col]  
> (map
> (fn [inner-map]  
> (update-in inner-map [k2] f))  
> inner-col  
> col))
>  
>  
> ;; invert the :y values
> (update-nested-fields  
> [{:values [{:y 1 :x 4}{:y 2 :x 7}]}{:values [{:y 5 :x 8}]}]
> [:values :y]
> (partial * -1))
>  
>  
>  
> As you can see, at a simple level it is: (map (update-in (map (update-in f))).
>  
> I'm really wondering if I'm missing an obvious simplification. I've tried to 
> decide if a threading macro would help, but I don't see how, since the outer 
> collection is provided to the outermost map function, rather than the 
> inner-most function.  
>  
>  
>  
>  
>  
>  
>  
> --  
> 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 
> (mailto: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 
> (mailto: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 
> (mailto:clojure+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/d/optout.



-- 
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/d/optout.


New Functional Programming Job Opportunities

2014-12-22 Thread Functional Jobs
Here are some functional programming job opportunities that were posted

recently:



Functional Software Developer at OpinionLab

http://functionaljobs.com/jobs/8763-functional-software-developer-at-opinionlab



Cheers,

Sean Murphy

FunctionalJobs.com


-- 
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/d/optout.


Re: Contrats to Cursive!!!

2014-12-22 Thread Alan Moore
+1 for Colin and Cursive!

Alan

-- 
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/d/optout.


Re: CIDER 0.8.2 released!

2014-12-22 Thread J Irving
Thanks Bozhidar, for the A+ tools and frequent updates. I use the fruits of
your labour daily, and your absurd pace of development more than satisfies
my pathological need to constantly upgrade.

(I would also observe that most appreciation is silent, unlike the other
thing :))

On Mon, Dec 22, 2014 at 10:40 AM, Shahrdad Shadab 
wrote:
>
> Great Job Bozhidar! Thanks for the quality software.
>
> On Mon, Dec 22, 2014 at 8:38 AM, Sun Ning  wrote:
>
>> Good Job, Bozhidar! I've already updated from MELPA. Everything works
>> like a charm.
>>
>>
>>
>>
>>
>> On 12/21/2014 08:39 PM, Bruce Durling wrote:
>>
>>> Thanks!
>>>
>>> cheers,
>>> Bruce
>>>
>>> On Sun, Dec 21, 2014 at 10:54 AM, Bozhidar Batsov 
>>> wrote:
>>>
 Ladies and gentlemen, I’m happy to inform you that CIDER 0.8.2 is out!
 It’s
 a bugfix-only release (which means you totally want to use it). Have a
 look
 at the release notes
 (https://github.com/clojure-emacs/cider/releases/tag/v0.8.2) for all
 the
 gory details.

 This will be the final release in the 0.8.x series (unless some terrible
 regression doesn’t pop up). There are no concrete plans for 0.9 yet,
 but I
 hope it will introduce some (or ideally all) of the following:

 * better cljs support

 * comint-based REPL buffers

 * boot support

 * better handling of multiple nREPL connections

 * and whatever else we manage to fit in :-)

 Please, report bugs and submit suggestions for improvements here
 https://github.com/clojure-emacs/cider/issues. If you like
 clojure-mode,
 CIDER and inf-clojure you can support their development via Gratipay
 https://gratipay.com/bbatsov/

 P.S. In related news - squiggly-clojure
 (https://github.com/clojure-emacs/squiggly-clojure), a flycheck
 extension
 for CIDER is now an official clojure-emacs project.

 --

 Cheers,
 Bozhidar

 --
 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/d/optout.

>>>
>> --
>> 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/d/optout.
>>
>
>
>
> --
> Software Architect & Computer Scientist
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: New Functional Programming Job Opportunities

2014-12-22 Thread John Jacobsen
By the way, I have worked at OpinionLab since last February, and my coding 
has been nearly 100% Clojure since then.  If you like Chicago, it's a nice 
place to work, and I'm happy to answer questions off-list about it.

On Monday, December 22, 2014 11:00:28 AM UTC-6, Sean Murphy wrote:
>
> Here are some functional programming job opportunities that were posted 
> recently: 
>
> Functional Software Developer at OpinionLab 
>
> http://functionaljobs.com/jobs/8763-functional-software-developer-at-opinionlab
>  
>
> Cheers, 
> Sean Murphy 
> FunctionalJobs.com 
>
>

-- 
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/d/optout.


Re: gemacl: Scientific computing application written in Clojure

2014-12-22 Thread Christopher Small
I'll second the use of core.matrix. It's a wonderful, idiomatic, fast 
library, and I hope to see folks continue to rally around it.


On Monday, December 22, 2014 3:47:59 AM UTC-7, Mikera wrote:
>
> For most array operations (e.g. dot products on vectors), I strongly 
> recommend trying out the recent core.matrix implementations. We've put a 
> lot of effort into fast implementations and a nice clean Clojure API so I'd 
> love to see them used where it makes sense!
>
> For example vectorz-clj can be over 100x faster than a naive map / reduce 
> implementation:
>
> (let [a (vec (range 1))
>b (vec (range 1))]
> (time (dotimes [i 100] (reduce + (map * a b)
> "Elapsed time: 364.590211 msecs"
>
> (let [a (array :vectorz (range 1))
>   b (array :vectorz (range 1))]
> (time (dotimes [i 100] (dot a b
> "Elapsed time: 3.358484 msecs"
>
> On Monday, 22 December 2014 17:31:41 UTC+8, Henrik Eneroth wrote:
>>
>> Interesting read Jose, thanks!
>>
>> It might be interesting to try a transducer on 
>>
>> (defn dot-prod 
>>   "Returns the dot product of two vectors"
>>   [v1 v2]
>>   (reduce + (map * v1 v2)))
>>
>> if you can get your hands on the 1.7 alpha and the time and inclination 
>> to do it. Transducers have shown to be faster than running functions in 
>> sequence. Although I don't know how likely they are to beat native arrays, 
>> probably not very much.
>>
>>
>> On Sunday, December 21, 2014 7:10:41 PM UTC+1, Jose M. Perez Sanchez 
>> wrote:
>>>
>>>
>>> Regarding the speed optimizations, execution time for a given model was 
>>> reduced from 2735 seconds to 70 seconds, over several versions by doing 
>>> several optimizations.
>>>
>>> The same calculation implemented in C# takes 12 seconds using the same 
>>> computer and OS. Maybe the Clojure code can still be improved, but for the 
>>> time being I'm happy with the Clojure version being six times slower, since 
>>> the new software has many advantages.
>>>
>>> For these tests the model was the circle with radius 1 using the 
>>> "diffmr1" tracker, the simulation was run using 1 particles and 1 
>>> total random walk steps.
>>>
>>> These modifications in the critical parts of the code accounted for most 
>>> of the improvement:
>>>
>>> - Avoid reflection by using type hints.
>>> - Use Java arrays.
>>> - In some cases call Java arithmetic functions directly instead of 
>>> Clojure ones.
>>> - Avoid using partial functions in the critical parts of the code.
>>>
>>> Avoiding lazyness did not help much. Regarding the use of Java arrays, 
>>> there are many small functions performing typical vector operations on 
>>> arrays, such as the following example:
>>>
>>> Using Clojure types:
>>>
>>> (defn dot-prod 
>>>   "Returns the dot product of two vectors"
>>>   [v1 v2]
>>>   (reduce + (map * v1 v2)))
>>>
>>> Using Java arrays:
>>>
>>> (defn dot-prod-j
>>>   "Returns the dot product of two arrays of doubles"
>>>   [^doubles v1 ^doubles v2]
>>>   (areduce v1 i ret 0.0
>>>(+ ret (* (aget v1 i)
>>>  (aget v2 i)
>>>
>>>
>>> This gives a general idea of which optimizations helped the most. These 
>>> changes are not in the public repository, since previous commits have been 
>>> omitted because the code code was not ready for publication (different 
>>> license disclaimer, contained email addresses, etc.). If anyone is 
>>> interested in the diffs and the execution times over several optimizations, 
>>> please contact me.
>>>
>>> Kind regards,
>>>
>>> Jose.
>>>
>>>
>>> On Sunday, December 21, 2014 3:38:35 AM UTC-5, Jose M. Perez Sanchez 
>>> wrote:


 Hi everyone:

 Sorry that it has taken so long. I've just released the software in 
 GitHub under the EPL. It can be found at:

 https://github.com/iosephus/gema


 Kind regards,

 Jose.



-- 
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/d/optout.


Re: ANN: ClojureScript 0.0-2505

2014-12-22 Thread David Nolen
Just pushed out 0.0-2511. The only change is a new compiler flag
:cache-analysis. When set to true the compiler will cache the EDN
analysis data for each ClojureScript file to disk. When coupled with
the lein fast trampoline feature and AOTed ClojureScript you can see
some significant gains for cold start up times.

David

On Sun, Dec 21, 2014 at 1:12 PM, David Nolen  wrote:
> ClojureScript, the Clojure compiler that emits JavaScript source code.
>
> README and source code: https://github.com/clojure/clojurescript
>
> New release version: 0.0-2505
>
> Leiningen dependency information:
>
> [org.clojure/clojurescript "0.0-2505"]
>
> This release fixes an issue with cljs.test and improves Node.js
> support.
>
> ### Changes
> * Stop generating random files for IJavaScript Strings
> * added :source-map-timestamp build flag to get cache busting source
>   map urls
> * Enhancements to bootstrap script
> * Stop warning about deps.cljs usage
>
> ### Fixes
> * Fix Node.js source mapping regression introduced by commit 254e548
> * CLJS-914: thrown-with-msg? is unable to get message of exception
> * CLJS-915: On empty call, List and PersistentQueue do not retain
>   meta, sorted-set/sorted map do not retain comparator

-- 
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/d/optout.


Re: [ClojureScript] Browserless ClojureScript

2014-12-22 Thread Ivan L
Great job!

-- 
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/d/optout.


How can I remove the nils in the result?

2014-12-22 Thread Pauli
Hi, all:

I'm tring to solve such a problem: Given a string consisting of "1" and 
"0", find all the locations of "1", and print them in the format of 
intervals.

For example: "00101110101110" => 3, 5-7, 9, 11-13

Here is my solution:

(defn bar [x]
  (letfn [(foo [mystr]
(->>
  (map-indexed vector mystr)
  (filter #(= (second %) \1))
  (map (comp inc first))
  (partition-all 2 1)
  (filter #(= 2 (count %)]
(let [y (map #(if (> (- (second %) (first %)) 1) (print (first %) ", " 
(second %) "-")) (foo x))]
  (print (ffirst y) "-" y (last (last (foo x)))


With the code above, I got many nils in the result:

(bar "00101110101110") => 3 , 5 -nil - (nil nil 7 , 9 -nil 9 , 11 -nil nil 
nil nil) 13

How can I remove them?

And, is there any way to make my code more concise?



-- 
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/d/optout.


Re: How can I remove the nils in the result?

2014-12-22 Thread Ben Wolfson
This is a little more concise:

(->> "00101110101110"
   (map-indexed vector)
   (partition-by second)
   (filter #(= (second (first %)) \1))
   (map (comp (fn [[f & tail]]
  (if rest (str f "-" (last tail)) (str f)))
  (partial map first

On Mon, Dec 22, 2014 at 8:09 PM, Pauli  wrote:

> Hi, all:
>
> I'm tring to solve such a problem: Given a string consisting of "1" and
> "0", find all the locations of "1", and print them in the format of
> intervals.
>
> For example: "00101110101110" => 3, 5-7, 9, 11-13
>
> Here is my solution:
>
> (defn bar [x]
>   (letfn [(foo [mystr]
> (->>
>   (map-indexed vector mystr)
>   (filter #(= (second %) \1))
>   (map (comp inc first))
>   (partition-all 2 1)
>   (filter #(= 2 (count %)]
> (let [y (map #(if (> (- (second %) (first %)) 1) (print (first %) ", " 
> (second %) "-")) (foo x))]
>   (print (ffirst y) "-" y (last (last (foo x)))
>
>
> With the code above, I got many nils in the result:
>
> (bar "00101110101110") => 3 , 5 -nil - (nil nil 7 , 9 -nil 9 , 11 -nil
> nil nil nil) 13
>
> How can I remove them?
>
> And, is there any way to make my code more concise?
>
>
>
>  --
> 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/d/optout.
>



-- 
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/d/optout.


Re: How can I remove the nils in the result?

2014-12-22 Thread Ben Wolfson
(it's also zero-indexed, unlike yours, but that isn't a big change)

On Mon, Dec 22, 2014 at 9:17 PM, Ben Wolfson  wrote:

> This is a little more concise:
>
> (->> "00101110101110"
>(map-indexed vector)
>(partition-by second)
>(filter #(= (second (first %)) \1))
>(map (comp (fn [[f & tail]]
>   (if rest (str f "-" (last tail)) (str f)))
>   (partial map first
>
> On Mon, Dec 22, 2014 at 8:09 PM, Pauli  wrote:
>
>> Hi, all:
>>
>> I'm tring to solve such a problem: Given a string consisting of "1" and
>> "0", find all the locations of "1", and print them in the format of
>> intervals.
>>
>> For example: "00101110101110" => 3, 5-7, 9, 11-13
>>
>> Here is my solution:
>>
>> (defn bar [x]
>>   (letfn [(foo [mystr]
>> (->>
>>   (map-indexed vector mystr)
>>   (filter #(= (second %) \1))
>>   (map (comp inc first))
>>   (partition-all 2 1)
>>   (filter #(= 2 (count %)]
>> (let [y (map #(if (> (- (second %) (first %)) 1) (print (first %) ", " 
>> (second %) "-")) (foo x))]
>>   (print (ffirst y) "-" y (last (last (foo x)))
>>
>>
>> With the code above, I got many nils in the result:
>>
>> (bar "00101110101110") => 3 , 5 -nil - (nil nil 7 , 9 -nil 9 , 11 -nil
>> nil nil nil) 13
>>
>> How can I remove them?
>>
>> And, is there any way to make my code more concise?
>>
>>
>>
>>  --
>> 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/d/optout.
>>
>
>
>
> --
> 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]
>
>


-- 
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/d/optout.


Re: gemacl: Scientific computing application written in Clojure

2014-12-22 Thread Jose M. Perez Sanchez

Thank you very much for your replies. I will definitely take a look at 
core.matrix. I really hate the fact that I had to use Java arrays to make 
it fast. I'll take a look at transducers as well.

Kind regards,

Jose.

On Monday, December 22, 2014 7:09:27 PM UTC-5, Christopher Small wrote:
>
> I'll second the use of core.matrix. It's a wonderful, idiomatic, fast 
> library, and I hope to see folks continue to rally around it.
>
>
> On Monday, December 22, 2014 3:47:59 AM UTC-7, Mikera wrote:
>>
>> For most array operations (e.g. dot products on vectors), I strongly 
>> recommend trying out the recent core.matrix implementations. We've put a 
>> lot of effort into fast implementations and a nice clean Clojure API so I'd 
>> love to see them used where it makes sense!
>>
>> For example vectorz-clj can be over 100x faster than a naive map / reduce 
>> implementation:
>>
>> (let [a (vec (range 1))
>>b (vec (range 1))]
>> (time (dotimes [i 100] (reduce + (map * a b)
>> "Elapsed time: 364.590211 msecs"
>>
>> (let [a (array :vectorz (range 1))
>>   b (array :vectorz (range 1))]
>> (time (dotimes [i 100] (dot a b
>> "Elapsed time: 3.358484 msecs"
>>
>> On Monday, 22 December 2014 17:31:41 UTC+8, Henrik Eneroth wrote:
>>>
>>> Interesting read Jose, thanks!
>>>
>>> It might be interesting to try a transducer on 
>>>
>>> (defn dot-prod 
>>>   "Returns the dot product of two vectors"
>>>   [v1 v2]
>>>   (reduce + (map * v1 v2)))
>>>
>>> if you can get your hands on the 1.7 alpha and the time and inclination 
>>> to do it. Transducers have shown to be faster than running functions in 
>>> sequence. Although I don't know how likely they are to beat native arrays, 
>>> probably not very much.
>>>
>>

-- 
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/d/optout.


Re: How can I remove the nils in the result?

2014-12-22 Thread Tim
Another option (though Bens does look nicer!) 

(loop [xs (->> "00101110101110"
(map vector (iterate inc 1))
(filter #(= (last %) \1))
(map first))
  it nil]
  (let [steps (partition 2 1 xs)
[i o] (split-with in-step steps)]
(cond (every? empty? steps)
(str it (first xs))
  (empty? i)
(recur (rest xs)(str it (first xs) ","))
   :else (recur (last (split-at (count i) xs)) (str it (ffirst i) "-")


>

-- 
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/d/optout.


Re: How can I remove the nils in the result?

2014-12-22 Thread Tim
whoops...

   (defn in-step [xs]
 (let [[x1 x2] xs]
   (= (- x2 x1) 1)))

On Monday, December 22, 2014 11:38:49 PM UTC-8, Tim wrote:
>
> Another option (though Bens does look nicer!) 
>
> (loop [xs (->> "00101110101110"
> (map vector (iterate inc 1))
> (filter #(= (last %) \1))
> (map first))
>   it nil]
>   (let [steps (partition 2 1 xs)
> [i o] (split-with in-step steps)]
> (cond (every? empty? steps)
> (str it (first xs))
>   (empty? i)
> (recur (rest xs)(str it (first xs) ","))
>:else (recur (last (split-at (count i) xs)) (str it (ffirst i) "-")
>
>
>>

-- 
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/d/optout.