Re: Why is this Project Euler solution slow?

2013-10-01 Thread Wes Freeman
Any brute force solution will be relatively slow. The fast solutions
require a doing math to simplify.

Wes

On Tue, Oct 1, 2013 at 2:22 PM, David Chambers
wrote:

> Last night I attempted Project Euler #5in 
> Clojure. The problem is as follows:
>
> > # Smallest multiple
> >
> > 2520 is the smallest number that can be divided by each of the numbers
> > from 1 to 10 without any remainder.
> >
> > What is the smallest positive number that is evenly divisible by all of
> the
> > numbers from 1 to 20?
>
> Here's my solution:
>
> (defn divisible?
>   [numer denom]
>   (= 0 (mod numer denom)))
>
> (defn smallest-multiple
>   "Find the smallest positive number that is evenly divisible by all
>   of the numbers from 1 to n."
>   [n]
>   (let [s (range 1 (inc n))]
> (first (filter (fn [x] (every? (partial divisible? x) s))
>(rest (range))
>
> This gives the expected answer for *n* of 10, but takes a long time to
> solve *n* of 20. I'd like to understand what make this code slow. Am I
> doing something inefficiently? What steps might I take to rework this
> code to have it solve *n* of 20 within a minute?
>
> ---
>
> p.s. I'm new to Clojure. Don't hesitate to mention applicable Clojure
> idioms of which I may not be aware.
>
> --
> --
> 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.


Re: 'neostore' does not contain a store version, please ensure that the original database was shut down in a clean state.

2013-12-10 Thread Wes Freeman
Try starting it up with the neo4j-shell to see if it will go through its
recovery. Like so:
bin/neo4j-shell -path 

And then exiting properly with "exit".

You didn't say how you were importing, but if this happened during an
org.neo4j.unsafe.BatchInserter run, you might be out of luck--the point of
the unsafe package is that it doesn't do journaling, and can't recover from
fatal errors like that. You'd need to start over from the beginning.

Wes

On Tue, Dec 10, 2013 at 1:33 PM, Joseph Guhlin wrote:

> When is this happening, during the batch import or after for a query?
>
> It sounds like an incomplete shutdown. You need to make sure you issue a
> .shutdown to the db (batchinserter) and give it time to complete, it can
> take awhile.
>
> Make sure you have write permissions for the directory. And always start
> with a clean directory (delete any previous datastores) for a Batch Insert.
>
> If you are running it under lein you need to use ^:replace for :jvm-opts
> or it will slow things down considerably.
> Here is what I am using in my project.clj, they are based off of what
> Neo4j uses from the command line and some benchmarks. You may want to
> reduce the -Xms and -Xmx. What are you giving Neo4j for memory as well when
> you start it up? It uses it's own memory allocation and can exceed what you
> give the JVM, so you want to give Neo4j more and clojure less, and want
> both to be less than your total ram so you do not hit swap space (which
> will slow it down again too).
>
>   :jvm-opts ^:replace [
>  "-Xms6G"
>  "-Xmx8G"
>  "-XX:+UseConcMarkSweepGC"
>  "-XX:+UseBiasedLocking"
>  "-XX:+AggressiveOpts"
>  "-XX:+UseFastAccessorMethods"
>  "-XX:+UseCondCardMark"
>  ]
>
> --Joseph
>
> On Tuesday, December 10, 2013 4:00:09 AM UTC-6, Himakshi Mangal wrote:
>>
>> Hi,
>>
>> I was using clojure to upload the dbpedia datasets into neo4j.
>>
>> Unfortunately, my system hanged and i had to restart everything. Now, if
>> i start the execution of program again it shows this error:
>>
>> 'neostore' does not contain a store version, please ensure that the
>> original database was shut down in a clean state.
>>
>>
>> How can i solve this error so that i can start the uploading from the
>> point it stopped?
>>
>> Please help
>>
>  --
> --
> 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.


Re: 'neostore' does not contain a store version, please ensure that the original database was shut down in a clean state.

2013-12-11 Thread Wes Freeman
The alternatives to BatchInserter are to just use the normal Java API and
batch things up into large transactions--~10k things at a time is probably
a good first try. You'll probably get 1/4 to 1/2 of the speed of the batch
inserter, but it won't crash unrecoverably, as the journal file will be
written. Usually, if you have your records somewhere you can retrieve them
again, the risk of the unsafe aspect of BatchInserter are mitigated, and
the speed is worth it.

As a side note, you should probably not be running this sort of thing in an
IDE. Make sure you have configured enough RAM for the BatchInserter mmio
options--that is a key way to make performance a lot faster.

Wes

On Wed, Dec 11, 2013 at 12:07 AM, Himakshi Mangal  wrote:

> Hi wes,
>
> I tried with neo4j-shell but it gave me this error:
> Error starting org.neo4j.kernel.EmbeddedGraphDatabase,
> /home/himakshi/work/setup/neo4j-community-2.0.0-RC1/bin/../data/dbpedia.db
>
> Yes, I am using org.neo4j.unsafe.BatchInserter.
>
> If this causes the problem, can there be any alternate solution because i
> cannot afford to loose my db after 3-lakhs records are already processed.
>
>
>
>
> On Tuesday, December 10, 2013 3:30:09 PM UTC+5:30, Himakshi Mangal wrote:
>
>> Hi,
>>
>> I was using clojure to upload the dbpedia datasets into neo4j.
>>
>> Unfortunately, my system hanged and i had to restart everything. Now, if
>> i start the execution of program again it shows this error:
>>
>> 'neostore' does not contain a store version, please ensure that the
>> original database was shut down in a clean state.
>>
>>
>> How can i solve this error so that i can start the uploading from the
>> point it stopped?
>>
>> Please help
>>
>  --
> --
> 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.


Re: Call for volunteers to help moderate a ClojureScript Google group

2013-01-23 Thread Wes Freeman
This is great. Can you guys put [ClojureScript] in the email subject like
most google groups do? Wouldn't mind if they put [Clojure] in the clojure
emails, either.

Wes

On Thu, Jan 24, 2013 at 1:22 AM, kinleyd  wrote:

> I see a number of volunteers already; include me if you need any more.
>
> +1 to the proposal to have an independent ClojureScript group.
>
>
> On Thursday, January 24, 2013 8:42:22 AM UTC+6, solussd wrote:
>
>> I'll help!
>>
>> ---
>> Joseph Smith
>> j...@uwcreations.com
>> @solussd
>>
>>
>> On Jan 23, 2013, at 8:16 PM, Brandon Bloom  wrote:
>>
>> /me steps forward
>>
>> On Wednesday, January 23, 2013 10:53:34 AM UTC-8, Andy Fingerhut wrote:
>>>
>>> An interest was expressed by a few in having a separate ClojureScript
>>> mailing list.
>>>
>>> If it is a Google group, that requires moderating messages sent to the
>>> group, via manual approval.  I suspect early on there will be many people
>>> posting to the group for the first time that have long worked with
>>> ClojureScript, and you'll know them, and you can approve that and all
>>> future messages from them, but every time a new sender sends their first
>>> few messages to the group, a person needs to receive an email, click a
>>> link, read the message to verify it is on topic, and click a couple of
>>> buttons to approve it or reject it.
>>>
>>> Anyone interested in helping out with that?  It is easier if the load
>>> can be spread across multiple people.  If someone else approves a message,
>>> you still might get an email about a message needing approval, but the last
>>> couple of steps above are then unnecessary.
>>>
>>> Andy
>>>
>>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@**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 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 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




Re: Call for volunteers to help moderate a ClojureScript Google group

2013-01-25 Thread Wes Freeman
I don't tend to filter emails, but just like to go through my inbox and
judge based on topic and subject whether I'd like to take a closer look
before archiving. I'm in too many groups to want to go through filters one
at a time, and currently there a handful that don't have subject markers,
so unless something obviously Clojure-related is in the subject, I have to
dig deeper to know that it's actually about Clojure. If you guys don't want
to do it, I'm fine with continued suffering (I guess I'm a minority)--just
throwing the idea out there.

Thanks for doing it in the ClojureScript group, by the way. :)

Wes

On Thu, Jan 24, 2013 at 8:59 AM, Wolodja Wentland  wrote:

> On Thu, Jan 24, 2013 at 01:50 -0500, Wes Freeman wrote:
> > This is great. Can you guys put [ClojureScript] in the email subject
> like most
> > google groups do? Wouldn't mind if they put [Clojure] in the clojure
> emails,
> > either.
>
> Just curious: But why would you want that? I would happily live without
> that
> as it reduces line-noise and leaves more room for important information
> such
> as the actual subject. It is not necessary to filter mails (just filter on
> List-I[dD]) either, so I'd be curious why you would prefer it :)
> --
> Wolodja 
>
> 4096R/CAF14EFC
> 081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC
>

-- 
-- 
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




Re: Call for volunteers to help moderate a ClojureScript Google group

2013-01-25 Thread Wes Freeman
Thanks for educating me about tags--didn't know it would work like that.

On Fri, Jan 25, 2013 at 8:40 AM, Michael Wood  wrote:

> On 25 January 2013 13:47, Wes Freeman  wrote:
>
>> I don't tend to filter emails, but just like to go through my inbox and
>> judge based on topic and subject whether I'd like to take a closer look
>> before archiving. I'm in too many groups to want to go through filters one
>> at a time, and currently there a handful that don't have subject markers,
>> so unless something obviously Clojure-related is in the subject, I have to
>> dig deeper to know that it's actually about Clojure. If you guys don't want
>> to do it, I'm fine with continued suffering (I guess I'm a minority)--just
>> throwing the idea out there.
>>
>> Thanks for doing it in the ClojureScript group, by the way. :)
>>
>
> You have a gmail account.  You can set up filters to tag the e-mails.  It
> does not mean you have to "go through filters one at a time".  Your mail
> can still all be in your inbox and the tags will be to the left of the
> subject.
>
> Anybody who wants to separate the mail into separate folders (virtual or
> otherwise) can do so without cluttering the subject.  People who read mail
> on devices with small screens can get a bit extra space for the actual
> subject instead of having "[Clojurescript] " taking up large chunk of it.
>
> Anyway, I don't feel strongly enough about it to try to get the
> Clojurescript list changed.
>
>
>>  Wes
>>
>> On Thu, Jan 24, 2013 at 8:59 AM, Wolodja Wentland wrote:
>>
>>> On Thu, Jan 24, 2013 at 01:50 -0500, Wes Freeman wrote:
>>> > This is great. Can you guys put [ClojureScript] in the email subject
>>> like most
>>> > google groups do? Wouldn't mind if they put [Clojure] in the clojure
>>> emails,
>>> > either.
>>>
>>> Just curious: But why would you want that? I would happily live without
>>> that
>>> as it reduces line-noise and leaves more room for important information
>>> such
>>> as the actual subject. It is not necessary to filter mails (just filter
>>> on
>>> List-I[dD]) either, so I'd be curious why you would prefer it :)
>>> --
>>> Wolodja 
>>>
>>
> --
> Michael Wood 
>
> --
> --
> 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 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




Re: ANN Introducing Clochure: a better Clojure

2013-04-01 Thread Wes Freeman
This is great!

I couldn't find the contributor agreement, though...

Wes

-- 
-- 
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: Some feedback on clojurescript

2012-09-18 Thread Wes Freeman
Glad I'm not the only one!

A separate mailing list for ClojureScript would be great. Also, enabling
the label [Clojure] for all subjects of emails would be great (this must be
a setting in google groups, because most of the larger groups have it
enabled), as I filter through a great deal of email I don't care about, and
I actually would like to read the latest emails from the Clojure list.

Thanks,
Wes

On Sun, Sep 16, 2012 at 8:32 PM, Irakli Gozalishvili wrote:

>  Hi Folks,
>
> I'm still new to clojurescript, but I thought I would share with you some
> of the annoyances that person
> person coming from JS (like myself) will likely run into:
>
> http://jeditoolkit.com/2012/09/16/coljurescript-feedback.html
>
>
> Regards
> --
> Irakli Gozalishvili
> Web: http://www.jeditoolkit.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 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

Re: Clojure : a good start for non-programmers?

2012-09-25 Thread Wes Freeman
Yes (definitely not brainfuck), but I would recommend not starting with
something with ugly syntax like C, C++, Perl, or PHP (and many others, I'm
sure) these days. Something friendlier and dynamic like Clojure is an
excellent idea. Two alternatives I'd give a non-programmer are Python and
Ruby.

Clojure gets a bonus for not being object-oriented, in my opinion (you
don't even have to learn what that means--except for java interop, ha).

The syntax for Clojure/Lisp can be hard for some newbies, due to the
massive parentheses trails, but with proper editor assistance, you can
surpass that. http://xkcd.com/297/

I recommend "The Joy of Clojure", although it might be rough for a newbie
after a couple of chapters, it's still excellent. You can always go back to
it, if it gets too difficult to follow.

There's also http://www.4clojure.com/ , and the clojure koans that can get
you some hands on practice.

Good luck!

Wes

On Wed, Sep 26, 2012 at 1:14 AM, Dennis Haupt  wrote:

> basically anything except brainfuck is a good idea :)
>
> Am 26.09.2012 06:45, schrieb Leonardo Borges:
> > Hi Gregorius!
> >
> > I think Clojure is a great way to start to learn to program! Clojure
> > is a flavour of lisp and so is Scheme - which has been used for
> > decades to teach programming to MIT undergrads.
> >
> > In terms of resources on learning functional programming I think The
> > Little Lisper is a terrific book:
> > http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992
> >
> > And if yearn for more advanced things later on, SICP - the actual text
> > book used at MIT - can be found for free online here:
> > http://mitpress.mit.edu/sicp/
> >
> > Both books use scheme but I believe you should be able translate the
> > examples to Clojure without too much effort.
> >
> > just my 2c.
> >
> > Best of luck!
> >
> > Leonardo Borges
> > www.leonardoborges.com
> >
> >
> > On Mon, Sep 24, 2012 at 4:11 PM, Gregorius R.  wrote:
> >> Hello Clojurists!
> >>
> >> I'm a person in middle age (you know, too old to rock'n'roll, to young
> to
> >> die) and would like to programm but starting with functional
> programming.
> >> Regarding this i have some questions:
> >>
> >> is clojure a good start to learn programming?
> >> which (prerfer free online) is a good tut to start?
> >> am i to old for this stuff?
> >>
> >> thnx in advance for all responses
> >> Greg
> >>
> >> --
> >> 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 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 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

Re: how do we go about promoting new clojure libraries?

2012-09-26 Thread Wes Freeman
For what it's worth, I've organically discovered several of Clojurewerkz's
projects just via google search, so I think Michael's methods work,
although there is indeed a fair amount of effort involved in maintaining
the promotion.

I like the https://twitter.com/nodenpm for node.js npm package updates.
It's high noise, but I sometimes discover something that looks interesting.
Clojars could do something similar--I'd follow.

Wes

On Wed, Sep 26, 2012 at 3:52 PM, Michael Klishin <
michael.s.klis...@gmail.com> wrote:

> zcaudate:
>
> is there some sort of categorised list/wiki that we can add to for new
>> libraries?
>
>
> There are clojuresphere.com, clojure-toolbox.com and some groups of
> people have their
> own sites for their stuff: clojurewerkz.org, http://flatland.org.
>
> If you want to make your library more visible, post release announcements
> to the mailing list,
> create a blog for announcements, get it added to planet.clojure.in and
> maybe have a twitter
> account for folks who prefer twitter to rss aggregators.
>
> Simply putting your library's name on a wiki somewhere does not make it
> visible, unfortunately.
> Periodically "making noise" with announcements makes people notice it and,
> hopefully, recall
> it later when they need your library.
>
> MK
>
> --
> 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 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

Re: Questions regarding do form

2012-09-27 Thread Wes Freeman
Thanks for mentioning doto--hadn't seen that before. Particularly, I think
some of my unit tests can be made significantly more readable with that.

Wes

On Thu, Sep 27, 2012 at 11:40 AM, Russell Whitaker <
russell.whita...@gmail.com> wrote:

> On Thu, Sep 27, 2012 at 8:26 AM, arekanderu  wrote:
> > Thank you Meikel for your so helpful replies.
> >
>
> Thanks also from a lurker, to whom these facts were a useful surprise:
> I'd wondered
> the same myself.
>
> Cheers, R
>
> >
> > On Thursday, September 27, 2012 4:19:44 PM UTC+3, Meikel Brandmeyer
> > (kotarak) wrote:
> >>
> >> Hi,
> >>
> >> Am Donnerstag, 27. September 2012 12:16:41 UTC+2 schrieb arekanderu:
> >>
> >>> I am new to clojure and I have two questions about do and the way it
> >>> should be used.
> >>>
> >>> Question 1: Which of the following two functions is more idiomatic and
> >>> why? Both functions produce the same result.
> >>>
> >>> 
> >>> (defn my-fn [java-object]
> >>>   (. java-object firstFunc)
> >>>   (. java-object secondFunc)
> >>>   (. java-object thirdFunc)
> >>>   java-object)
> >>> 
> >>
> >>
> >> The first because defn includes an implicit do. So the second example is
> >> actually (do (do ...)).
> >>
> >> In this case you could also use doto:
> >>
> >> (defn my-fn
> >>   [pojo]
> >>   (doto pojo
> >> .firstFunc
> >> .secondFunc
> >> .thirdFunc))
> >>
> >>
> >>>
> >>> Question 2: Again, which one is more idiomatic and why? Both functions
> >>> produce the same result.
> >>>
> >>> 
> >>> (defn my-fn [java-object bar]
> >>>   (let [bar-bar (. java-object getSomething)
> >>> _   (if (not (is-bar? bar))
> >>>   (. java-object (setSomething bar-bar)))]
> >>> java-object))
> >>> 
> >>>
> >>> 
> >>> (defn my-fn [java-object bar]
> >>>   (let [bar-bar (. java-object getSomething)]
> >>> (do
> >>>   (if (not (is-bar? bar))
> >>> (. java-object (setSomething bar-bar)))
> >>>  java-object)))
> >>> 
> >>
> >>
> >> The third:
> >>
> >> (defn my-fn
> >>   [pojo bar]
> >>   (let [bar-bar (.getSomething pojo)]
> >> (when-not (is-bar? bar)
> >>   (.setSomething pojo bar-bar))
> >> pojo)))
> >>
> >> let also (just like defn) includes an implicit do for the body.
> >>
> >> Hope this helps.
> >>
> >> Kind regards
> >> Meikel
> >>
>
> --
> Russell Whitaker
> http://twitter.com/OrthoNormalRuss / http://orthonormalruss.blogspot.com/
> http://www.linkedin.com/pub/russell-whitaker/0/b86/329
>
> --
> 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 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

Re: ANN: a Clojure docs site, and github organization

2012-10-04 Thread Wes Freeman
I think the goals are sufficiently different.

2012/10/5 Bronsa 
>
>> Wouldn't it be better for readevalprintlove and clojuredocs to join
>> forces from the beginning?
>
>

-- 
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

Re: apply: increase performance by 60% for fixed length

2012-10-07 Thread Wes Freeman
What version of clojure are you guys using, just to understand this a
little better? I think apply was given a boost in 1.3 or 1.4--I'm a
relative newbie, myself.

Wes

On Sun, Oct 7, 2012 at 10:56 PM, Ben Wolfson  wrote:

> On Sun, Oct 7, 2012 at 3:53 PM, Alan Malloy  wrote:
> > This is nonsense. If s is fixed-size at compile-time, you would never use
> > apply to begin with. Why bother with (applyn 10 + [1 2 3 4 5 6 7 8 9 10
> ])
> > when you could just write (+ 1 2 3 4 5 6 7 8 9 10)?
>
> Why bother to write (+ 1 2 3 4 5 6 7 8 9 10) when you could just write 55?
>
> In order to write (+ 1 2 3 4 5 6 7 ...) you need more than just the
> length of the list, you need to know its contents as well.
>
> (let [s (take 10 (infinite-stream-of-random-integers))] (applyn 10 + s))
>
> will work right---you know the length of s---but you're not going to
> be able to just directly apply +.
>
> I'm skeptical for a different reason:
>
> user=> (let[t(fn[](apply   + '(1 2 3 4 5 6 7 8 9 10)))]
> (time(dotimes [_ 100] (t
> "Elapsed time: 1736.91518 msecs"
> nil
> user=> (let[t(fn[](applyn 10 + '(1 2 3 4 5 6 7 8 9 10)))]
> (time(dotimes [_ 100] (t
> "Elapsed time: 2375.503756 msecs"
> nil
>
> --
> 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 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

Re: unexpected NaN behavior

2012-10-09 Thread Wes Freeman
Possibly a simpler example:

user=> (def x Float/NaN)
#'user/x
user=> (= x x)
true

I'm not sure whether true or false makes more sense, personally.

Wes

On Tue, Oct 9, 2012 at 4:38 PM, Brian Craft  wrote:

> Can someone explain the last result here?
>
> > [1 2 3 Float/NaN]
> [1 2 3 NaN]
> > (= Float/NaN Float/NaN)
> false
> (#(= Float/NaN Float/NaN))
> false
> ; all is good so far, but...
> (filter #(= % %) [1 2 3 Float/NaN 4])
> (1 2 3 NaN 4)
>
> Now I'm lost. What just happened?
>
> --
> 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 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

Re: unexpected NaN behavior

2012-10-09 Thread Wes Freeman
Float/NaN must be instantiating something?

user=> (def y Float/NaN)
#'user/y
user=> (= x y)
false

On Tue, Oct 9, 2012 at 4:48 PM, Wes Freeman  wrote:

> Possibly a simpler example:
>
> user=> (def x Float/NaN)
> #'user/x
> user=> (= x x)
> true
>
> I'm not sure whether true or false makes more sense, personally.
>
> Wes
>
> On Tue, Oct 9, 2012 at 4:38 PM, Brian Craft  wrote:
>
>> Can someone explain the last result here?
>>
>> > [1 2 3 Float/NaN]
>> [1 2 3 NaN]
>> > (= Float/NaN Float/NaN)
>> false
>> (#(= Float/NaN Float/NaN))
>> false
>> ; all is good so far, but...
>> (filter #(= % %) [1 2 3 Float/NaN 4])
>> (1 2 3 NaN 4)
>>
>> Now I'm lost. What just happened?
>>
>> --
>> 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 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

Re: unexpected NaN behavior

2012-10-09 Thread Wes Freeman
I guess it really does do the same thing in Scala:

scala> val f = Float.NaN
f: Float = NaN

scala> f == f
res4: Boolean = false

scala> f.equals(f)
res5: Boolean = true

I guess you really should use == in Clojure, when doing numerical equality.
It even does dynamic typed comparisons better than =. Such as:

user=> (= (/ 100M 100M) 1)
false
user=> (== (/ 100M 100M) 1)
true

Thanks for clearing that up, Aaron.

Wes

On Tue, Oct 9, 2012 at 5:27 PM, Aaron Cohen  wrote:

> On Tue, Oct 9, 2012 at 5:20 PM, David Nolen 
> wrote:
> > On Tue, Oct 9, 2012 at 4:38 PM, Brian Craft 
> wrote:
> >> Can someone explain the last result here?
> >>
> >>> [1 2 3 Float/NaN]
> >> [1 2 3 NaN]
> >>> (= Float/NaN Float/NaN)
> >> false
>
> This is a primitive comparison and follows IEEE floating point
> semantics. NaN must not equal NaN.
>
> >> ; all is good so far, but...
> >> (filter #(= % %) [1 2 3 Float/NaN 4])
> >> (1 2 3 NaN 4)
>
> This is an Object comparison, and in Java this follows the contract
> for equals and hashCode. Thus, an object must be equal to itself (for
> HashMap to work).
>
> See:
> http://stackoverflow.com/questions/1408569/why-does-double-nan-equal-itself-when-wrapped-in-a-double-instance
>
> and in particular:
>
> http://docs.oracle.com/javase/6/docs/api/java/lang/Double.html#equals(java.lang.Object)
>
>
>
>
> >>
> >> Now I'm lost. What just happened?
> >
> > The behavior is strange, I've simplified it a bit to the following:
> >
> >> ((fn [x] (= x x)) Float/NaN)
> > true
> >> ((fn [x y] (= x y)) Float/NaN Float/NaN)
> > false
> >
> > This is using Clojure 1.4.0
> >
> > --
> > 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 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 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

Re: CDS progress report, week 1

2012-10-15 Thread Wes Freeman
I've been watching the repo. Thanks for all the effort on this, guys.

Wes

On Mon, Oct 15, 2012 at 12:07 PM, Michael Klishin <
michael.s.klis...@gmail.com> wrote:

> ## TL;DR
>
> The Clojure documentation project [1] started off quite actively. With
> several new guides and a dozen of contributors,
> the resource is already quite useful to newcomers to the language. We
> believe this is directly related
> to our straightforward contribution process.
>
>
> ## CDS Progress Report
>
> A week ago we announced the new Clojure Documentation Site [1] (a.k.a.
> CDS) effort. The level of activity
> in the first week exceeded our expectations and we thought it may be a
> good idea to publish periodic reports
> (every week or two) to give the Clojure community a better idea of what
> CDS shapes up to be and what it has to offer.
>
> So lets start. This is a report for the week ending October 14th, 2012.
>
>
> ## In a Gist
>
> In the first week of CDS, we have added
>
>  * 2 new tutorials and 6 new and 2 expanded guides
>  * About 4,000 lines of changes in the content directory (does not include
> CSS or toolchain-related changes)
>  * 14 merged pull requests
>  * 13 contributors
>  * About 1,400 unique visitors
>  * About 6,000 page views with average visit duration of 2 minutes and 10
> seconds
>
> In addition, we have ironed out first issues in the contribution process
> and set up an IRC channel (`#clojure-doc` on `irc.freenode.net`) when
> contributors coordinate their work.
>
>
> ## New Content
>
> New tutorials:
>
>  * Emacs for Clojure development:
> http://clojure-doc.org/articles/tutorials/emacs.html
>  * Eclipse and Counterclockwise for Clojure development:
> http://clojure-doc.org/articles/tutorials/eclipse.html
>
>
> New guides:
>
>  * clojure.core Overview:
> http://clojure-doc.org/articles/language/core_overview.html
>  * Interoperability with Java:
> http://clojure-doc.org/articles/language/interop.html
>  * Namespaces: http://clojure-doc.org/articles/language/namespaces.html
>  * Polymorphism: Protocols and Multimethods:
> http://clojure-doc.org/articles/language/polymorphism.html
>  * Collections and Sequences:
> http://clojure-doc.org/articles/language/collections_and_sequences.html
>  * Clojure Glossary:
> http://clojure-doc.org/articles/language/glossary.html
>
> ## Updates
>
> Improved guides:
>
>  * Functions: http://clojure-doc.org/articles/language/functions.html
>  * Curated Clojure Library Directory:
> http://clojure-doc.org/articles/ecosystem/libraries_directory.html
>
>
>  ## Thank You, Contributors
>
> CDS would not be possible without the following people who make Clojure
> community a better place:
>
>  * Gareth Jones
>  * John Gabriele
>  * Claudio Perez Gamayo
>  * gsnewmark
>  * Phil Hagelberg
>  * Lee Hinman
>  * Michael Klishin
>  * Julson Lim
>  * Jake McCrary
>  * Max Penet
>  * Oleksandr Petrov
>  * Robert Randolph
>  * Yogthos
>
>
> 1. http://clojure-doc.org
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.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 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

Re: [ANN] Clojars Releases repository

2012-11-19 Thread Wes Freeman
+1 on the checksum validation error and ReasonPhrase:Forbidden on the pom.
Using leiningen preview10. I updated my version number to not have
SNAPSHOT, so maybe that's why it's not working, compared to Sean's?

Regardless of the current bug, thanks for working on this functionality,
Phil (and whoever else contributed to it). It felt like clojars (along with
leiningen) was a great convenience, but was a bit weak on the security
side, being too open--and this closes that gap significantly.

Quick OSX/Homebrew tutorial (this is what I did):
brew install gpg
gpg --gen-key
# the following command is sufficient if you've just installed gpg and only
have one key, otherwise you should probably already know how to figure out
which key you want
gpg --export -a
(copy the resulting text into your clojars profile)
lein deploy clojars

Not too hard, right? (Admittedly, gpg is one of those homebrew recipes that
requires symlinking some stuff in /usr/local/share/locale/ to finish
linking; my usual work around is to "chown root:wheel" the homebrew
executable to "sudo brew link gpg", and then reset it.)

Wes

On Tue, Nov 20, 2012 at 12:22 AM, Peter Taoussanis wrote:

> I'd caution anyone against trying to redeploy their libraries right now
> since there seems to be some serious unresolved issues. I just tried a
> redeploy myself and am also getting the "ReasonPhrase:Forbidden" error.
>
> Unfortunately this seems to leave the repo in a bad state, since
> dependency pull requests now come back with a "Checksum validation failed".
>
> > I still seem to be able to pull the library into a project and Clojars
> says it has been promoted (after my first successful try - with a different
> key / user ID).
>
> Sean, are you sure it's working if the dependency isn't already in your
> .m2 cache?
>
> - Peter Taoussanis
>
> --
> 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 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

Re: [ANN] Clojars Releases repository

2012-11-20 Thread Wes Freeman
On Monday, November 19, 2012 12:53:32 PM UTC-5, Phil Hagelberg wrote:

>
> If you turn off :sign-releases inside your :repositories entry when 
> deploying libraries everything will work for you as before. But your 
> libraries won't qualify for the Releases repo in this case. So once your 
> users upgrade to Leiningen 2.0.0 they will have to include a separate 
> :repositories entry for the classic repo to indicate that they are OK 
> with pulling in dependencies that don't meet the higher standards of the 
> new repo. 
>

Can you give some example syntax for :repositories and ":sign-releases 
false" specifically for clojars? I was hoping to test deploy without 
signing and then try again with signing, to see if that fixes my project.

Thanks,
Wes

-- 
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

Re: [ANN] Clojars Releases repository

2012-11-20 Thread Wes Freeman
Ok, if you do a signed deploy, you can scp the pom and jar over to get it
working, directly after.

Like:
scp pom.xml target/clojurithms-0.1.0.jar cloj...@clojars.org:
/repo/clojurithms/clojurithms/0.1.0/

On Tue, Nov 20, 2012 at 7:10 PM, Wes Freeman  wrote:

> On Monday, November 19, 2012 12:53:32 PM UTC-5, Phil Hagelberg wrote:
>
>>
>> If you turn off :sign-releases inside your :repositories entry when
>> deploying libraries everything will work for you as before. But your
>> libraries won't qualify for the Releases repo in this case. So once your
>> users upgrade to Leiningen 2.0.0 they will have to include a separate
>> :repositories entry for the classic repo to indicate that they are OK
>> with pulling in dependencies that don't meet the higher standards of the
>> new repo.
>>
>
> Can you give some example syntax for :repositories and ":sign-releases
> false" specifically for clojars? I was hoping to test deploy without
> signing and then try again with signing, to see if that fixes my project.
>
> Thanks,
> Wes
>
> --
> 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 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

Re: [ANN] modern-cljs - tutorial 8 and CLJS patch

2012-11-27 Thread Wes Freeman
On Tue, Nov 27, 2012 at 3:09 PM, Michael Klishin <
michael.s.klis...@gmail.com> wrote:
>
> This is fantastic. I think this may be the most valuable source of
> information about CLJS
> on the Web.
>
> We will figure out a way to add ClojureScript content to
> http://clojure-doc.org, this has to be easier
> to discover.
>

+1

-- 
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