Re: How to validate date (YYYYMMDD) using clojure

2018-03-12 Thread John Jacobsen
Have a look at clj-time: https://github.com/clj-time/clj-time
In particular the clj-time.format namespace.
Cheers!
John

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Good Clojure Projects for the Classroom?

2017-02-06 Thread John Jacobsen
I run a Clojure study group at work and we generally work 4Clojure problems 
if nobody has a topic they want to present on.

Today, however, we had a great time looking at some "open data" that's out 
there, specifically about the City of Chicago[1]. I challenged everyone to 
come up with one or more "questions" to ask the based on the data available 
and to find the answers using Clojure. We had a great time, beginners 
paired with more experienced developers.

There are many similar data sets. One nice thing about this sort of project 
is you can size it very small or large depending on the skill level and the 
time available. You'd want to introduce them to a few libraries, like 
clj-http for REST API calls and Cheshire for JSON parsing. Maybe even 
Incanter or similar for data analysis (rabbit hole warning).

Best of luck,
John J.

[1] https://data.cityofchicago.org/

On Monday, February 6, 2017 at 5:03:46 PM UTC-6, Eddie wrote:
>
> Recently I began teaching a college level course that uses Clojure. We 
> have made it through the lectures on the lisp syntax, the data types, 
> collections, and immutability. Now I would like to ask the students to 
> apply their new Clojure knowledge to a small project. (Something that could 
> be completed in about week if worked on for an hour a day). 
>
> Does anyone know of any good resources for such projects? Any ideas are 
> much appreciated!
>

-- 
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: Clojure infrastructure update

2016-11-19 Thread John Jacobsen
Great news, Alex.  

One question not on your list: are there any plans to put JIRA behind 
HTTPS?  I went to change my password recently and noticed my 
username/password would be sent in the clear.
>
>
Thanks for all the work you do for the community.

John J.

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


Question about how lazy sequences are held/released/garbage collected

2016-04-01 Thread John Jacobsen
The problem of correctly handling large lazy sequences so they don't blow 
up in memory came up at work this week.

I thought I would try to explain the following simple case to our Monday 
afternoon study group, and I realized I don't understand it 100%:

(def n 1e8)

(let [s1 (range n)
  s2 (map identity s1)]
  (count s2))

;;=> 1


(let [s1 (range n)
  s2 (map identity s1)]
  (count s1))

;;=> GC overhead limit exceeded

For the first case, I get that in consuming s2, elements of both s1 and s2 
are consumed and garbage-collected; and that in the second case, clearly s1 
can't be released as it's consumed because s2 might still need it (even 
though we never realize s2).  My question is, as s1 is consumed in the 
second case, how does it "know" that s2 still holds a reference to it, and 
that it therefore should keep the realized values? What is the relevant 
difference between these two examples? And where in the Clojure/core code 
are the relevant details? 

Thanks in advance!
John

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to to watch changed files and run tests again automatic

2015-04-11 Thread John Jacobsen
If you're used to Rspec, have a look at Speclj.[1]  It's somewhat 
Rspec-like.  Its -a option does the same as lein midje :autotest, and works 
better for some situations.

In my experience, the different testing frameworks each have their warts 
and nice features -- it's worth trying more than one.

[1] https://github.com/slagyr/speclj


On Thursday, April 9, 2015 at 8:55:36 AM UTC-5, Denis L wrote:
>
> I use Rspec/Guard to watch changed files and automatic run test for for 
> Ruby/Rails application.
> How can I repeat similar scenario for Clojure-app?
>

-- 
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: Clojure Style Guide

2014-12-20 Thread John Jacobsen
Great to see this discussion on the mailing list, rather than just comments 
to PRs on GitHub.  And a big thanks to Bozhidar for shepherding the current 
style guide.

I came to Clojure from Python which has a strict standard (PEP-8) and a 
linting tool which enforces a standard -- it's been my experience that this 
provides a net benefit to code quality (and not just in terms of 
aesthetics).  While I also don't agree with everything currently in the 
style guide, it does some good in our shop by providing a default to refer 
to which eliminates some wasted discussion time.

So far the PR process on the style guide repo seems to have worked, more or 
less -- those in the community who care about these things can weigh in, 
and there at least can be a discussion before the PR is merged.  Perhaps 
more process or formality will become appropriate later as the community 
grows.

Regarding indentation metadata or editor customizations: I've seen 
Cursive/IntelliJ accept directives for indenting specific forms (usually, 
macros) and I'd like to be able to do that with clojure-mode in Emacs.

John

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Session 0.1.3 - A live-coding environment for Clojure

2014-03-24 Thread John Jacobsen
As a refugee (spy?) from the Python community, it's very exciting to see 
something similar to iPython Notebook, but based on / supporting the 
Clojure ecosystem.  iPN has been making shockwaves in the Python world and 
in scientific computing in general for some time.

Having only watched the video and skimmed the blog post so far, my first 
thought is that it would be nice to see support for rendering Markdown and 
math formulae (TeX), like iPN has.  Any thoughts about how this might be 
accomplished?

Really looking forward to playing with this and seeing it grow.

John

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure / polyglot position at OpinionLab in Chicago

2014-02-26 Thread John Jacobsen
On Monday, February 24, 2014 8:46:58 PM UTC-6, Devin Walters (devn) wrote:
>
> It seems like this comes up with many of the job posts. Perhaps we should 
> have some guidelines around what details should be provided in the average 
> job post to cut down on some of the noise that follows.
>

That might be helpful; I was a little unsure what would be appropriate.  

In any event, I am really encouraged by the number of Clojure positions 
> that are popping up. 
>

Me too!  Though I'm not a recruiter or even a manager, as a passionate 
Clojurian, I like to see what jobs are being posted for this (still 
relatively small) community -- no matter what physical location.

John

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Clojure / polyglot position at OpinionLab in Chicago

2014-02-24 Thread John Jacobsen
>  Lots of people on this list are not based in Chicago or US. Will remote 
candidates be considered?

I checked; apparently not, sorry to say.


On Monday, February 24, 2014 1:28:10 PM UTC-6, Michael Klishin wrote:
>
>
> 2014-02-24 22:47 GMT+04:00 John Jacobsen 
> >:
>
>> Though I'm fairly new here I'm happy to answer questions or forward them 
>> to the appropriate place.
>
>
> Lots of people on this list are not based in Chicago or US. Will remote 
> candidates be considered?
>
>
> -- 
> 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 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.


Clojure / polyglot position at OpinionLab in Chicago

2014-02-24 Thread John Jacobsen
Hi everyone,

Two weeks ago I joined OpinionLab in Chicago as a Clojure developer.  We 
are seeking more developers who have both a broad skill set and a passion 
for Clojure.

http://www.opinionlab.com/functional-software-developer/

OpinionLab is using Rails on the front-end and Clojure / Storm on the 
back-end to collect and process customer feedback for a wide variety of 
large companies and organizations. Though I'm fairly new here I'm happy to 
answer questions or forward them to the appropriate place.

Cheers,
John

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Reading single characters...?

2013-09-22 Thread John Jacobsen
The JLine story is indeed confusing.  I 
believe https://github.com/jline/jline2 is the current one you want ([jline 
"2.11"] in your project.clj deps).  See the forthcoming Clojure Cookbook 
recipe.
 
 If that recipe (or its trivial extension to echo repeated 
characters) indeed does not work correctly for you, now would be an 
excellent time to let people know so there is a chance to correct it before 
it goes to print!  

John

On Sunday, September 22, 2013 7:30:29 AM UTC-5, juan.facorro wrote:
>
> According to the JLine 's source code 
> (v1.0) in 
> UnixTerminal.java,
>  
> echo is disabled with the command *stty -echo* which disables all echoing 
> in the console (just tried it in a terminal since I wasn't familiar with 
> this command).  
>
> There are two projects for JLine in github , JLine 
> and JLine2. The latter seems to be actively mantained, but after digging a 
> little I found the same command is used when disabling echo in Unix 
> terminals, see 
> hereand
>  
> here
> .
>
> I don't know of a way you could go around that, but maybe someone can help 
> or suggest an alternative.
>
> HTH,
>
> J   
>
> On Saturday, September 21, 2013 12:49:29 AM UTC+8, Simon Brooke wrote:
>>
>> I've discovered some interesting behaviour - not necessarily a bug, and 
>> (if it is a bug) not necessarily a bug in Clojure.
>>
>> Essentially, to emulate a 1970s user interface, I want to read single key 
>> strokes from the console. I've found two recipes online, both using the 
>> JLine java package:
>>
>>
>> http://stackoverflow.com/questions/13435541/reading-unbuffered-keyboard-input-in-clojure
>>
>> http://stackoverflow.com/questions/3225025/single-character-console-input-in-java-clojure
>>
>> One of these recipes uses Terminal.getTerminal(), the other uses new 
>> ConsoleReader(). What happens in my context (Debian on 64 bit Intel) is 
>> that as soon as an instance of either class is instantiated, echoing to the 
>> console ceases. If you do (obviously, with the jline jar on the classpath):
>>
>> (import 'jline.Terminal)
>> (def term (Terminal/getTerminal))
>> (.initializeTerminal term)
>> (.enableEcho term)
>>
>>
>> (or the equivalent things with a ConsoleReader), every keystroke is 
>> echoed twice. But if you do
>>
>> user=> ((..ddiissaabblleeEEcchhoo  tteerrmm))
>> ^Jnil
>>
>> one single further character gets echoed and then nothing more, unless 
>> you type (blindly) (.enableEcho term), when the double-echoing behaviour 
>> resumes. This is consistent - on my Debian box - with Clojure 1.2, Clojure 
>> 1.3, and Clojure 1.5.1, all using jline 1.0. I haven't yet compiled up a 
>> little Java app to find out what happens without Clojure, and I haven't 
>> tried compiling a little command-line Clojure app, because I want to be 
>> able to read single characters in the context of the REPL, so if, as I 
>> hypothesise, jline is fighting with the REPL, proving whether it works 
>> outwith the context of the REPL doesn't really help me.
>>
>> Has anyone else seen this behaviour? Is there any solution?
>>
>>

-- 
-- 
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: Current state of the art in Web deployment?

2013-08-18 Thread John Jacobsen
Many thanks to everyone who replied about deploying a Web server to production. 
 Specific replies:

On Aug 17, 2013, at 6:51 PM, Mark Mandel  wrote:

> 
> On Sun, Aug 18, 2013 at 6:52 AM, John Jacobsen  wrote:
>> After some prototyping and development, we are now getting to the stage 
>> where "lein run" and a Jetty server running from -main aren't going to cut 
>> it.
> 
> At the risk of asking a dumb question, but being quite new to Clojure, I 
> don't mind - why do you say they won't cut it?

On Aug 18, 2013, at 9:25 AM, Norman Richards  wrote:

> Other than that, mechanically our deploy is not significantly different from 
> a lein ring server, so maybe you can explain what your concerns with that are?

My main concern was just the need to ssh into the server and run leiningen in 
the background, as opposed to setting up a "real" server which starts at boot 
time.  I'm OK w/ wrapping 'lein ring server-headless' with Apache/Nginx, if 
there are no known issues w/ that approach.


On Aug 17, 2013, at 4:52 PM, Ray Miller  wrote:

> One option is simply to write an upstart script that invokes 'lein
> ring server-headless' and sit an apache or nginx proxy in front of it.
> That's how my website is currently running. Alternatively, you could
> deploy your application as a war to tomcat or jetty.
> 
> The upstart configuration, which is installed to /etc/init/cms.conf,
> can be found here: https://gist.github.com/ray1729/6258845

That's very helpful -- can you be a little more specific about what you mean by 
"sit an apache or nginx proxy in front of it"?  It looks like your example is 
self-contained (need Clojure/lein + upstart, and that's it).

Thanks again everyone.

John



-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Current state of the art in Web deployment?

2013-08-17 Thread John Jacobsen
Hi folks,

I'm starting work on a Clojure Web app and would like to get a sense for 
the current "standard" (if any) for deploying to production.  In my case, I 
have an AWS Ubuntu instance, set up via Vagrant and Puppet, which mirrors 
some developer VMs.  Datomic, leiningen etc. are running everywhere happily.

After some prototyping and development, we are now getting to the stage 
where "lein run" and a Jetty server running from -main aren't going to cut 
it.  I would like to get a sense for what people do now -- the story 
painted by Google / StackOverflow seems all over the place.  Let's assume 
Heroku and Google App Engine are out of the picture, and that we are 
non-expert in terms of traditional Java approaches for Web apps (I'm coming 
mostly from a Python/Django background).

So, what do all y'all do?  What is a good lightweight but robust way to get 
a fairly simple Compojure/Ring app backed by Datomic facing the outside 
world?  Not too worried about massive scalability at this point; simplicity 
will be a plus (am worried that e.g. Immutant / JBoss are too heavyweight).

Not too active on this list so if my question can be improved, I'm happy to 
hear that as well.

Thanks, awesome Clojure community!!

John

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] Leiningen 2.3.0 released

2013-08-09 Thread John Jacobsen
That worked for now, thanks!  

On Friday, August 9, 2013 10:58:30 PM UTC-5, Phil Hagelberg wrote:
>
> On Friday, August 9, 2013 6:32:06 PM UTC-7, John Jacobsen wrote:
> > please advise?  Thanks!
>
> Hm; looks like self-install is getting invoked too soon. Not sure why it 
> was working for me earlier.
>
> Try setting `export HTTP_CLIENT="wget -O"` for now.
>
> -Phil
>

-- 
-- 
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: [ANN] Leiningen 2.3.0 released

2013-08-09 Thread John Jacobsen
Hi Phil, all, 

I'm still seeing the error which (I think) others have been reporting here:

vagrant@precise32:/tmp$ lein upgrade
Downloading Leiningen to 
/home/vagrant/.lein/self-installs/leiningen-2.3.0-standalone.jar now...
/home/vagrant/bin/lein: line 57: 
/home/vagrant/.lein/self-installs/leiningen-2.3.0-standalone.jar.pending: 
No such file or directory
/home/vagrant/bin/lein: line 63: download_failed_message: command not found
vagrant@precise32:/tmp$ 

please advise?  Thanks!

John


On Friday, August 9, 2013 3:17:58 PM UTC-5, Phil Hagelberg wrote:
>
> Hey everyone; sorry for the chaos around this release. The upload process 
> is now fully automated[1] to reduce manual error, and I'm going to make 
> sure a few other people have access to the S3 bucket so if something like 
> this happens again it can be fixed when I'm not around.
>
> There's been one bug found in this release[2] that you might want to be 
> aware of if you produce regular jars with AOT. (uberjars are not affected) 
> The issue comments contain a workaround, but we'll be cutting a 2.3.1 
> release in a few days.
>
> -Phil
>
> [1] -  
> https://github.com/technomancy/leiningen/commit/9d93cdd19eaf2cd5f73242bc75c3115181326287
>
> [2] - https://github.com/technomancy/leiningen/issues/1283
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Overflowing (count ...)

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

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

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

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

Curiously,
John

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Time complexity of operations on collections

2013-05-23 Thread John Jacobsen
Exactly what I was looking for, thanks!!!

John

On Thursday, May 23, 2013 7:06:39 PM UTC-5, Matthew wrote:
>
> http://www.innoq.com/blog/st/2010/04/clojure_performance_guarantees.html
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Time complexity of operations on collections

2013-05-22 Thread John Jacobsen
Updated draft of table in more readable form 
here: http://bit.ly/big-o-clojure

Thanks to Timothy for corrections/additions!  Will keep updating as other 
replies come in.

-- 
-- 
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: Time complexity of operations on collections

2013-05-22 Thread John Jacobsen
I am indeed confused.  I have both cons and conj operations in my table. 
 Are you saying (conj coll item) and (cons item coll) are implemented the 
same way under the hood?  That wasn't my understanding.  Can you clarify?

On Wednesday, May 22, 2013 10:05:22 AM UTC-5, tbc++ wrote:
>
> You might also want to switch "cons" to "conj". This is a super ugly part 
> of the Java api that no one really ever sees. PersistentVector.cons is 
> actually called by clojure.core/conj. clojure.core/cons is something else 
> completely. When talking about how the java code performs it might be best 
> to specify which one you mean. 
>
> Yes it's confusing, I'm sure there is a historical reason for it. 
>
> Timothy
>
>
> On Wed, May 22, 2013 at 8:24 AM, John Jacobsen 
> 
> > wrote:
>
>> I should probably also have added sorted-map to the table, though the 
>> complexity for each operation is less clear to me. 
>>
>> -- 
>> -- 
>> 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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

-- 
-- 
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: Time complexity of operations on collections

2013-05-22 Thread John Jacobsen
I should probably also have added sorted-map to the table, though the 
complexity for each operation is less clear to me.

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




Time complexity of operations on collections

2013-05-22 Thread John Jacobsen
I'm studying for an interview and thought it might be nice to know the time 
complexity of primitive operations on collections in Clojure.  A quick 
googling didn't turn up a definitive resource.  I would be happy to put one 
together.  What I had in mind was something like:

Collections: strings, sets, maps, Java arrays, lists, vectors
Operations: peek, pop, conj, cons, assoc/dissoc, get, nth, count

What I have in mind is to fill out this table with the appropriate average 
big-O (my *guesses* from googling/experimenting/thinking are entered, and 
may be completely wrong!; sorry for any formatting problems due to varying 
type styles, perhaps I should have used s-expressions :-) - should be OK 
with fixed width font):

Collection   getnth   cons  conj  assoc   pop  peek  count
List "1"?   "1"?   1 1  X  11 1
Vector   "1""1"?   n 1 "1"?11 1
Set  "1"X "1""1"X  XX 1?
Map  "1"X  1 "1"?  "1"?XX 1?
String1 1  n X  X  XX 1
Java Array1 1  n X  X  XX 1

Where O("1") is really O(log_{32}(n)), "effectively constant time" as 
opposed to "true" O(1).  X obviously means you can't do the operation on 
that type.  Some operations involve casting e.g. a string to a seq; I 
assume O(n) in that case (?).

(It's probably obvious to everyone else, but it's cool that there are so 
few 'n's in the table.)

Any corrections, operations to add, data structures to add?  I imagine 
between all the readers of the list, correcting this table will be trivial. 
 I am happy to post the resulting table on my blog or anywhere else.

Thanks!
John

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure - Python Style suggestion

2013-02-05 Thread John Jacobsen
Having written Python code professionally for about 7 years and taken to 
Clojure as a serious hobby for a year and a half, I have thought a lot 
about the differences between the two languages.

While parens provide simple and powerful homoiconicity (and they have a 
somewhat pleasing aesthetic -- let's face it, if you feel strongly 
otherwise you'll just steer clear of any Lisp), they do introduce some 
visual noise while reading code.  Readability matters to me quite a bit 
(but not as much as simplicity), and Python still seems more readable to 
me.  I have seen others express this opinion on this list.

A simple workaround I've considered, but haven't gotten around to doing 
anything about in e.g. Emacs, is to simply tone down the parens visually in 
the editor.  Hierarchy of color, size, contrast, etc. matters a lot in 
perception, and by making the parens slightly less obvious visually one's 
eye would be drawn to the actual functions more, "parsing" the parentheses 
only when several symbols exist on the same line.  Similar to what 
colorizing parentheses does - the color tells you more, if you pay 
attention to it.

Despite a passion for Clojure I do keep an eye on other languages and I am 
curious about e.g. template Haskell and Julia, both of which do the 
homoiconicity thing without all the parens.

When I program in Python I sure do miss other features of Clojure - speed, 
immutable data structures, and especially macros.

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