trying to read table & write file

2012-10-10 Thread Brian Craft
I'm reading a table & dumping to stdout, like this:

  (sql/with-connection db
(dorun (map #(println %) (read-table

read-table is doing some gloss calls to parse some floats.

Then I try to write it to a file (adapting an example), like this:

(sql/with-connection db
  (with-open [myfile (io/writer "myfile")]
(doseq [row (read-table)]
  (.write myfile (format row)

and I get "Insufficient bytes to decode frame" from gloss. I didn't expect 
an error reading the table. What am I doing wrong?

-- 
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: pattern for coalescing similar adjacent items in list

2012-10-10 Thread Brian Craft
Cool, thanks!

On Wednesday, October 10, 2012 5:52:54 PM UTC-7, Sean Corfield wrote:
>
> partition-by will probably get you started - turning (a1 a2 a3 b1 b2 c1 c2 
> c3 c4) into ((a1 a2 a3) (b1 b2) (c1 c2 c3 c4)) - then map some function 
> over that?
>
> On Wed, Oct 10, 2012 at 5:22 PM, Brian Craft 
> > wrote:
>
>> I have a long list (or seq? result of calling map) something like (a1 a2 
>> a3 b1 b2 c1 c2 c3 c4)
>>
>> I need to replace adjacent items with related attributes with single 
>> elements, like
>>
>> (a b c)
>>
>> where 'a' is derived from a1 a2 a3, and so-forth.
>>
>> So, again, I'm not sure how to approach this in a functional way. Anyone 
>> have a suggestion?
>>
>>
>

-- 
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: pattern for coalescing similar adjacent items in list

2012-10-10 Thread Sean Corfield
partition-by will probably get you started - turning (a1 a2 a3 b1 b2 c1 c2
c3 c4) into ((a1 a2 a3) (b1 b2) (c1 c2 c3 c4)) - then map some function
over that?

On Wed, Oct 10, 2012 at 5:22 PM, Brian Craft  wrote:

> I have a long list (or seq? result of calling map) something like (a1 a2
> a3 b1 b2 c1 c2 c3 c4)
>
> I need to replace adjacent items with related attributes with single
> elements, like
>
> (a b c)
>
> where 'a' is derived from a1 a2 a3, and so-forth.
>
> So, again, I'm not sure how to approach this in a functional way. Anyone
> have a suggestion?
>
>

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

pattern for coalescing similar adjacent items in list

2012-10-10 Thread Brian Craft
I have a long list (or seq? result of calling map) something like (a1 a2 a3 
b1 b2 c1 c2 c3 c4)

I need to replace adjacent items with related attributes with single 
elements, like

(a b c)

where 'a' is derived from a1 a2 a3, and so-forth.

So, again, I'm not sure how to approach this in a functional way. Anyone 
have a suggestion?

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

2012-10-10 Thread ronen
Awesome! this is my gateway drug into Datomic

On Wednesday, October 10, 2012 4:27:37 PM UTC+2, Rich Hickey wrote:
>
> I released a little app today that imports Git repos into Datomic. My hope 
> is that it can be used as the underpinnings of some interesting Clojure 
> tooling. 
>
> More info here: 
>
> http://blog.datomic.com/2012/10/codeq.html 
>
> Rich 
>
>

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

2012-10-10 Thread Michael Klishin
2012/10/11 kovas boguta 

> Looks neat. Can I make a suggestion?
>
> For these cookbooks, it would be very help to know exactly which
> version of clojure (and any libraries used) were used. You can even
> just put the associated project.clj content at the top.
>
>
putting project.clj in them is completely unnecessary.

Add a new section: What Clojure Versions This Cookbook Covers?


>  That way one will have confidence that this is up-to-date info, and
> know exactly what to do to reproduce.
>

This is a good idea.
-- 
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

Re: math

2012-10-10 Thread kovas boguta
Looks neat. Can I make a suggestion?

For these cookbooks, it would be very help to know exactly which
version of clojure (and any libraries used) were used. You can even
just put the associated project.clj content at the top.

That way one will have confidence that this is up-to-date info, and
know exactly what to do to reproduce. And it will be obvious what
needs to be updated when future versions are released.



On Wed, Oct 10, 2012 at 6:37 PM, John Gabriele  wrote:
> On Tuesday, October 9, 2012 10:38:20 PM UTC-4, Brian Craft wrote:
>>
>> I need some basic math functions, e.g. floor. I see there are some in
>> contrib, but I'm unable to figure out the status of contrib. Seems like it's
>> deprecated, or in transition, or something?
>
>
> To help answer questions like this one, I added the beginnings of a math
> cookbook page to the CDS:
> http://clojure-doc.org/articles/cookbooks/math.html .
>
> If interested in adding to that or any other CDS page, see
> https://github.com/clojuredocs/cds#how-to-contribute .
>
> ---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 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: [OT] Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-10 Thread Michael Klishin
robermann79:

> I'm pretty sure you have already thought about it and it's me that missed 
> your considerations, but why we are not using a wiki-based tool, like 
> Wordpress, instead of forking a git branch?
>
>  
 * Developers prefer writing docs and code examples in their favorite 
editor and not a browser input field
 * Rapid feedback when writing and working on code examples locally in the 
REPL
 * Everybody and their grandma are on GitHub. Asking people to sign up for 
a yet another wiki-like system? Please.
 * Static HTML is as low maintenance as it gets when it comes to hosting 
content
 * Full control over how we want the site to be structured and what we want 
it to look like

there are more reasons but I hope this answers your question.

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

Re: [OT] Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-10 Thread John Gabriele

On Wednesday, October 10, 2012 6:38:31 PM UTC-4, robermann79 wrote:
>
> I'm pretty sure you have already thought about it and it's me that missed 
> your considerations, but why we are not using a wiki-based tool, like 
> Wordpress, instead of forking a git branch?
>
>
My original goals for CDS were to have it be a sort of organic “sundry 
bunch of docs” type of project: less formality than “official” 
documentation, but more boundaries than a wiki (i.e., “don’t go editing 
other people’s docs with wild abandon”). (I blogged about it at 
http://www.unexpected-vortices.com/blog/2012/clojure-docs-and-cds.html ). I 
went with md docs at github because:

  * most contributors would probably already be familiar with github,
  * it's easy to write markdown docs,
  * github allows users to click the "edit" button and edit right there in 
browser (it takes care of forking and helping you send the pull-request),
  * I wanted there to be an easily viewable "paper trail" of changes, and
  * you can view markdown pages right at github,

Really, that 3rd bullet point is key: since you can just cilck the edit 
button and edit right there, contributors don't even need to know anything 
about git to contribute. They just need to have an account at github. It 
becomes basically the same as editing a wiki. :)

Once Michael and others joined in, the goals changed just a bit. Now, CDS 
is more aimed at being high-quality technical docs with little duplication 
which are suitable for display at some future doc.clojure.org site area. 
But keeping a collection of markdown docs at github is still currently the 
best way to accomplish this, I think.

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

Re: ANN: codeq

2012-10-10 Thread Mark Derricutt
Mmmm codeq - the Clojure answer to the Smalltalk Image+Changes file…..

Interesting.   Take codeq as a running "image" at a repl.  for every operation, 
assignment, execution, record a change.  Rollback your repl, restart+replay the 
repl…. .

On 11/10/2012, at 3:27 AM, Rich Hickey  wrote:

> I released a little app today that imports Git repos into Datomic. My hope is 
> that it can be used as the underpinnings of some interesting Clojure tooling.

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


[OT] Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-10 Thread Roberto Mannai
I'm pretty sure you have already thought about it and it's me that missed
your considerations, but why we are not using a wiki-based tool, like
Wordpress, instead of forking a git branch?

On Mon, Oct 8, 2012 at 6:25 PM, Michael Klishin  wrote:

> ## Announcing clojure-doc.org
>
> I am starting a new thread because the existing one about CDS is now
> polluted by all kinds of off-topics.
>
> About a week ago, John Gabrielle announced CDS (Clojure Documentation
> Site): a new Clojure documentation resource
> for the Clojure community by the Clojure community.
>
> We are past dealing with all the plumbing and happy to announce that our
> work is now public at http://clojure-doc.org and
> you are welcome join the effort: we tried to make it as easy as possible.
>
>
> ## How It Works
>
> We have a repository on GitHub [1] that has Markdown files, toolchain
> setup instructions and several article
> stubs. The stubs help contributors pick a topic to write about and not
> worry too much about how to structure the document.
> They are training wheels for documentation writing, if you will.
>
> To contribute, for the repository [1], create a topic branch, make your
> changes and submit a pull request on GitHub. No
> contributor agreement process, no JIRA, no patches. Then an existing
> contributor will either merge your pull request or
> suggest changes.
>
> The toolchain currently requires Ruby *and* Python (for code
> highlighting). We decided that it's good enough for now.
> There are instructions about setting everything up in the README.
>
> There is no separate mailing list, so if you want to ask or suggest
> something, do it here.
>
>
> ## What We Have So Far
>
> Given that CDS is literally a few days old (after we migrated to the new
> toolchain and got to actual content), there is not
> much to show but a few tutorials and guides should give you an idea of
> what we want it to look like:
>
>  * http://clojure-doc.org/articles/tutorials/getting_started.html
>  * http://clojure-doc.org/articles/tutorials/introduction.html
>  * http://clojure-doc.org/articles/language/functions.html
>  * http://clojure-doc.org/articles/ecosystem/community.html
>  * http://clojure-doc.org/articles/ecosystem/libraries_directory.html
>
>
> ## What CDS Covers
>
> CDS' goal is to cover more than just the language. It is certainly
> cruicially important to have good tutorials and comprehensive
> guides on Clojure. But when using Clojure in real world projects, you will
> need to know about the JVM ecosystem, Leiningen,
> how to write tests, what libraries are out there, how to profile code, JVM
> tooling for ops, how to develop and distribute libraires,
> and much more.
>
> So there is group of articles about "the Ecosystem stuff": think
> Leiningen, popular libraries or how to use VisualVM to find
> hot spots and investigate concurrency hazards in your apps.
>
> This means that if you feel that documenting sequences is boring but
> excited about the ops side of software engineering, you
> can still contribute to CDS and enjoy the process.
>
>  When documenting various tools, sometimes it makes more sense to just
> link to existing documentation, which is what we
> do for Leiningen.
>
>
> ## Low-hanging Fruits
>
> There are currently several articles that already have their structure in
> place, what is left is writing the content and code
> examples. For example, you don't have to be a genius or a Clojure expert
> to write articles such as
>
>  * Books
>  * Java interop
>  * Collections and Sequences
>  * Namespaces (ok, you *have* to be a genius to explain the ns macro well
> but some people certainly can do that)
>
> If you want to start working on one of those articles or have existing
> content you've authored that can be ported,
> please let us know.
>
> Topics like Concurrency & Parallelism and Laziness will take more effort,
> this is why we did not bother with writing any
> initial structure for their articles.
>
>
> ## Call to Arms
>
> If your company uses Clojure or has interest in adopting it and has "open
> source Fridays", "hacker time" or something
> similar, consider contributing to CDS. This will literally benefit the
> entire Clojure community, all the current and future users.
>
> Not only every single Clojure user benefits from better documentation, it
> also gets outdated way slower than that hot new open source
> library you wanted to tinker with. In other words, it's one of the best
> ways to invest of your OSS time budget (if you ask me).
>
> No contribution is too small: feel free to suggest grammar improvements,
> better code examples, submit pull requests with just
> one new paragraph or even a couple of spelling corrections. Editing and
> proof-reading is also a great way to contribute.
>
> If you have design and/or frontend development skills, you are more than
> welcome to make CDS more legible, easy to navigate,
> and simply better looking.
>
> If you need examples of what's possible, here's what 2 pe

Re: math

2012-10-10 Thread John Gabriele
On Tuesday, October 9, 2012 10:38:20 PM UTC-4, Brian Craft wrote:
>
> I need some basic math functions, e.g. floor. I see there are some in 
> contrib, but I'm unable to figure out the status of contrib. Seems like 
> it's deprecated, or in transition, or something? 


To help answer questions like this one, I added the beginnings of a math 
cookbook page to the CDS: 
http://clojure-doc.org/articles/cookbooks/math.html .

If interested in adding to that or any other CDS page, see 
https://github.com/clojuredocs/cds#how-to-contribute .

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

Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-10 Thread Andrew Brehaut
On Tuesday, October 9, 2012 5:26:23 AM UTC+13, Michael Klishin wrote:
>
> …
>  * Do not copy content from blog posts unless you are the author
> …
>

I wrote a brief introduction to web development in clojure[1] last year. If 
anyone wants to use it as part of or a basis for an article about web dev 
for CDS, please feel free. Anyone doing so will need to update the content 
to ring 1.1 and clojure 1.4.

Regards,

Andrew Brehaut

[1] http://brehaut.net/blog/2011/ring_introduction

-- 
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-10 Thread Lee Hinman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andy,

On 10/10/12 1:30 PM, Andy Fingerhut wrote:
> Michael, thanks for the detailed response, and I appreciate the
> effort you are putting forth in the clojure-doc.org
>  site.
> 
> I do have some followup questions on clojuredocs.org 
> , since you gave some description of what
> you hope and/or expect to happen there.
> 
> On Oct 5, 2012, at 1:52 PM, Michael Klishin wrote:
> 
>> And then there is the API reference part. The goal is to rewrite 
>> clojuredocs.org  source parser to
>> produce JSON and migrate DB schema to support multiple versions.
>> Ideally, clojuredocs.org  will be
>> Clojure end to end. But this will take a while and the reference
>> part is not nearly as bad as it is with the guides and
>> tutorials.
> 
> *Whose* goal is it to make those changes to clojuredocs.org 
> ?

It's my goal, I have already have an extractor
(https://github.com/dakrone/lein-clojuredocs) that works for leiningen
projects as well as clojure's source. What is currently lacking is an
import workflow as well as some kind of frontend to transition the
existing examples to.

> Someone that is willing and able to write the code, has the time to
> do it, and is authorized to make changes to the clojuredocs.org 
>  site?

I also have access to the machine that clojuredocs.org is running on,
and the credentials for the MySQL database, having developed the
current API and helping Zach get it started.

> I ask not because I expect anyone to make these changes, but
> because you sound like you might know the answer, i.e. maybe you
> have been in communication with those people.

Feel free to ping me on irc (dakrone) if you want to talk more about
it, or jump into the #clojure-doc IRC room.

- - Lee Hinman

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (Darwin)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQdfGVAAoJEJ1kZdQ6zsrgbYEP/3GBOZWelF6GKziaolpFpoDz
q0rGitrkVyLBCwxtbChDj9KXyDu62rWtBLRbID3uBfxZRdWrAdDqo5NKCX9QrkQh
W7qQb6j8rlJEuwlJZVn7ZlwP7S2fxugTtLt0p7RUW1Mzr5vokfiLkjkawvPfE0vk
3T6B7a0BPznkNne2xtv1x/Urn2bB+faku6Kqs0xcvvRtzXC/jHhQ5nKzYr4xzh/m
Ge9xVXLkpef0USlKe26v8jt06aGJvz/xQC40Djzeb8X+II+8ryo/uOa/bFqEnfpR
lYkbyODkSKzzuJoY/zTlhtI+mcPYre6q8i+Kkgh7LUl6C8kmpBDD2NprS8O10ZI8
037goOnJDZLIjG/bvjtWEvlfAgttMhye34k5rBVxR742Q14WcLaS4mbn2QTF7b4h
+BFncDyMKyRp9aE3Xg3EcMmG9Jj7vopPJHQwdCJwXJKwc0QSZxQEn6lW/AYPOeXe
qnJx3sue1aIdWM3KqC4fvlt9OBrGWXav53ERGfL7uDhvx5j1nWW3N5wUm5D3l6cj
fHWbkJgKrSRjNHdckcL+s0uATF/NZAVBVeqy4C1T6zLKeayLRCzPaQmlt/GUmIMq
DifTLKTIMNFfGH+5VcHYsr4jiuxnOoIgvR7evKSxDmfIKb0yPNKry3QzINFEuA9J
1EVt3g7zVYCp/F7eIWnl
=Itve
-END PGP SIGNATURE-

-- 
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-10 Thread Michael Klishin
2012/10/10 Andy Fingerhut 

> *Whose* goal is it to make those changes to clojuredocs.org?
>
> Someone that is willing and able to write the code, has the time to do it,
> and is authorized to make changes to the clojuredocs.org site?
>
> I ask not because I expect anyone to make these changes, but because you
> sound like you might know the answer, i.e. maybe you have been in
> communication with those people.
>

About two weeks ago, after yet another heated discussion about the state of
Clojure documentation in #clojure on irc.freenode.net, a few people decided
to start working on CDS. As part of that discussion we had to ask ourselves
the question "what will we do about API reference and clojuredocs.org?". It
turns out, someone already has
a pretty good idea of what needs to be done and has contact to the original
author.

I focus on the guides part of things and not super up-to-date about the
state of clojuredocs.org revamp. It may
or may not start soon.

If anybody wants to join people behind CDS, #clojuredocs on freenode.

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

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

2012-10-10 Thread Andy Fingerhut
Michael, thanks for the detailed response, and I appreciate the effort you are 
putting forth in the clojure-doc.org site.

I do have some followup questions on clojuredocs.org, since you gave some 
description of what you hope and/or expect to happen there.

On Oct 5, 2012, at 1:52 PM, Michael Klishin wrote:

> And then there is the API reference part. The goal is to rewrite 
> clojuredocs.org source parser to produce
> JSON and migrate DB schema to support multiple versions. Ideally, 
> clojuredocs.org will be Clojure end to end.
> But this will take a while and the reference part is not nearly as bad as it 
> is with the guides and tutorials.

*Whose* goal is it to make those changes to clojuredocs.org?

Someone that is willing and able to write the code, has the time to do it, and 
is authorized to make changes to the clojuredocs.org site?

I ask not because I expect anyone to make these changes, but because you sound 
like you might know the answer, i.e. maybe you have been in communication with 
those people.

Thanks,
Andy

-- 
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: Interest in Scribble for Clojure?

2012-10-10 Thread Grant Rettke
On Wed, Oct 10, 2012 at 1:11 PM, Gary Johnson  wrote:
> A lot of scribble's features are geared towards providing tooling for
> Literate Programming,

I didn't read into Scribble like it's goal was LP, but I could have
missed that and not known enough about LP, too.

> and currently I'm way more than satisfied with
> org-babel.

Interesting. Thanks folks.

-- 
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: Interest in Scribble for Clojure?

2012-10-10 Thread Gary Johnson
A lot of scribble's features are geared towards providing tooling for 
Literate Programming, and currently I'm way more than satisfied with 
org-babel. This has been built into Emacs by defaut since IIRC version 23.2 
or so. Opening any file in org-mode (`M-x org-mode') immediately provides 
you with a full LP experience. You can "weave" your org file to a number of 
different output formats (HTML, PDF, and ODT being my favorites using `M-x 
org-export-as-*') with beautiful tables, figures, embedded images, properly 
formatted math (LaTeX!), and language-specific fontified code blocks. You 
can "tangle" your org file (i.e., automatically extract code blocks and 
rearrange them in a new source code only file(s)) to create an entire src/ 
directory with one command (`M-x org-babel-tangle'). And possible the 
coolest feature of all is that you can live evaluate any code block (by 
sending it to a Clojure REPL using nrepl or swank-clojure) by simply typing 
`C-c C-c' in any code block within the org file. This allows for the 
typical "write, test, modify, test" loop that Clojure programmers are used 
to. Just for the final coup de grace, you can use any number of different 
programming languages within the same org file and either tangle them out 
to their own files (.sh, .clj, .java, etc) for building up an entire system 
within org-mode, or you can live evaluate those blocks and have them 
automatically pass their results between blocks of different languages. So 
you could write some Clojure code to calculate the values in a tree 
in-memory, send that on to some python code that creates the graphviz code 
representation of the tree as a string, and have that chained right along 
to a dot code block that invokes graphviz to create the PDF image of your 
tree, which is then embedded dynamically into your org file when you weave 
it.

I made a simple example program to illustrate the basics of using org-babel 
as a github project that you can find here:

  http://github.com/lambdatronic/org-babel-example

The actual org-babel site can be found here:

  http://orgmode.org/worg/org-contrib/babel/index.html

Get Literate.
  ~Gary

On Wednesday, October 10, 2012 1:40:11 PM UTC-4, John Gabriele wrote:
>
> On Wednesday, October 10, 2012 11:32:22 AM UTC-4, Grant Rettke wrote:
>>
>> On Tue, Oct 9, 2012 at 1:00 PM, Michael Fogus  wrote: 
>> >> Any existing solutions or interest in something like this? 
>> > 
>> > There are no _public_ solutions as far as I know, 
>>
>> So everyone has their private custom approaches I guess? I'm curious 
>> if people would share them. 
>>
>>
> My guess is that most folks are just using Markdown:
>
>   * most readme's for Clojure projects on github are markdown,
>   * high-profile projects like Lein keep their docs in markdown,
>   * fwict, Marginalia turns markdown-formatted comments and docstrings 
> into html,
>   * there appears that autodoc may at some point [^1] support markdown in 
> docstring comments, and
>   * most folks already know and use it (sometimes without knowing it :) ).
>
> [^1]: see http://tomfaulhaber.github.com/autodoc/ "Things not 
> implemented" section
>
> ---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

Re: CDS tutorials

2012-10-10 Thread John Gabriele
 

> We will figure out how to reorganize things later.
>
>
His noir tut is multi-part and contains screenshots. I'd suggest it get its 
own directory under tutorials.

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

Re: Interest in Scribble for Clojure?

2012-10-10 Thread John Gabriele
On Wednesday, October 10, 2012 11:32:22 AM UTC-4, Grant Rettke wrote:
>
> On Tue, Oct 9, 2012 at 1:00 PM, Michael Fogus > 
> wrote: 
> >> Any existing solutions or interest in something like this? 
> > 
> > There are no _public_ solutions as far as I know, 
>
> So everyone has their private custom approaches I guess? I'm curious 
> if people would share them. 
>
>
My guess is that most folks are just using Markdown:

  * most readme's for Clojure projects on github are markdown,
  * high-profile projects like Lein keep their docs in markdown,
  * fwict, Marginalia turns markdown-formatted comments and docstrings into 
html,
  * there appears that autodoc may at some point [^1] support markdown in 
docstring comments, and
  * most folks already know and use it (sometimes without knowing it :) ).

[^1]: see http://tomfaulhaber.github.com/autodoc/ "Things not implemented" 
section

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

Re: CDS tutorials

2012-10-10 Thread Michael Klishin
2012/10/10 Dmitri 

> I saw the new ClojureDocs site and I'd like to contribute some tutorials
> I've made on setting up the environment and making web apps.
>
> I have a tutorial on using Eclipse and CounterClockwise at
> https://www.yogthos.net/blog/18-Setting+up+Eclipse+for+Clojure
> and I've got an extensive Noir tutorial here
> https://www.yogthos.net/blog/22-Noir+tutorial+-+part+1
>
> if they look useful I'd be glad to add them.
>

That's a good start. Please add them under the Tutorials section for now
(port the content over, no links for tutorials). We will figure out how to
reorganize things later.

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

Re: ANN: codeq

2012-10-10 Thread Rich Hickey

On Oct 10, 2012, at 11:02 AM, Meikel Brandmeyer (kotarak) wrote:

> Hi,
> 
> Am Mittwoch, 10. Oktober 2012 16:27:37 UTC+2 schrieb Rich Hickey:
> I released a little app today that imports Git repos into Datomic. My hope is 
> that it can be used as the underpinnings of some interesting Clojure tooling. 
> 
> More info here: 
> 
> http://blog.datomic.com/2012/10/codeq.html 
> 
> 
> Wow. o.O)
> 
> Could it be adapted to Mercurial also?
> 

I imagine so, but know less about Mercurial internals.


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


CDS tutorials

2012-10-10 Thread Dmitri
Hi,

I saw the new ClojureDocs site and I'd like to contribute some tutorials 
I've made on setting up the environment and making web apps.

I have a tutorial on using Eclipse and CounterClockwise at 
https://www.yogthos.net/blog/18-Setting+up+Eclipse+for+Clojure
and I've got an extensive Noir tutorial here 
https://www.yogthos.net/blog/22-Noir+tutorial+-+part+1

if they look useful I'd be glad to add them.

Cheers,
Dmitri

-- 
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: Interest in Scribble for Clojure?

2012-10-10 Thread Grant Rettke
On Tue, Oct 9, 2012 at 1:00 PM, Michael Fogus  wrote:
>> Any existing solutions or interest in something like this?
>
> There are no _public_ solutions as far as I know,

So everyone has their private custom approaches I guess? I'm curious
if people would share them.

> although I think it can be done fairly trivially (famous last words)

lol

> using the existing ClojureScript compiler.

Why?

>  I'd love to see it done as an open source project.

Agreed.

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

2012-10-10 Thread Rostislav Svoboda
Isn't it somehow related to the thread we had here few X ago: "Idea
around SCMs and Clojure"
https://groups.google.com/forum/?fromgroups=#!topic/clojure/9N15TA_mJKo

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

2012-10-10 Thread Jim foo.bar

On 10/10/12 15:27, Rich Hickey wrote:

I released a little app today that imports Git repos into Datomic. My hope is 
that it can be used as the underpinnings of some interesting Clojure tooling.

More info here:

http://blog.datomic.com/2012/10/codeq.html

Rich


Good stuff! :-)

Jim

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

2012-10-10 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Mittwoch, 10. Oktober 2012 16:27:37 UTC+2 schrieb Rich Hickey:
>
> I released a little app today that imports Git repos into Datomic. My hope 
> is that it can be used as the underpinnings of some interesting Clojure 
> tooling. 
>
> More info here: 
>
> http://blog.datomic.com/2012/10/codeq.html 
>
>
Wow. o.O)

Could it be adapted to Mercurial also?

Meikel 

-- 
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: Parallelising reduce-kv - r/fold into maps

2012-10-10 Thread Wolodja Wentland
On Tue, Oct 09, 2012 at 15:31 -0700, Jean Niklas L'orange wrote:
>On Tuesday, October 9, 2012 9:14:51 PM UTC+2, Wolodja Wentland wrote:
> 
>  --- snip ---
>  (reduce-kv
>   (fn [ret k v]
>    (assoc ret k (func-that-does-something-with v)))
>   some-map))
>  --- snip --
> 
>  I am using reducers in other places, but am not entirely sure how to
>  employ
>  them here. I would be grateful for any advice.
> 
>You could use merge as the combine function, and let (fn [ret [k
>v]] (assoc ret k (func-that-does-something-with v))) be the reducing
>function you pass to fold. Then it's at least parallelisable, though I'm
>unsure of its performance.

I played with the following implementation:

(defn update-vals
  [m f]
  (persistent!
(reduce-kv
  (fn [ret k v]
(assoc! ret k (f v)))
  (transient {})
  m)))

(defn pupdate-vals
  [m f]
  (r/fold
(r/monoid merge hash-map)
(fn [ret [k v]]
  (conj ret [k (f v)]))
(vec m)))

(defn foo
  [x]
  (Thread/sleep 0.2)
  (inc x))

but unfortunately update-vals still outperforms pupdate-vals even on large
maps. I am not sure what else I can do to speed up folding into maps
(as opposed to a single value), but I'll keep on experimenting.

user=> (def m (zipmap (range 10) (range 10)))
#'user/m
user=> (time (dotimes [_ 100] (pupdate-vals m inc)))
"Elapsed time: 8068.950282 msecs"
nil
user=> (time (dotimes [_ 100] (update-vals m inc)))
"Elapsed time: 1106.253256 msecs"
nil
user=> (time (dotimes [_ 100] (pupdate-vals m foo)))
"Elapsed time: 8890.445481 msecs"
nil
user=> (time (dotimes [_ 100] (update-vals m foo)))
"Elapsed time: 3954.917294 msecs"
-- 
Wolodja 

4096R/CAF14EFC
081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC


signature.asc
Description: Digital signature


Re: bug in clojure.lang.ASeq

2012-10-10 Thread Jim foo.bar

My previous post is not exactly true...From the java docs:

"Returns an unmodifiable view of the specified list. ... .Query 
operations on the returned list "read through" to the specified list and 
attempts to modify the returned list, whether direct or via its 
iterator, result in an UnsupportedOperationException."


Elements are NOT copied to the unmodified list.
So yes, it seems that Clojure lists are the culprit after all...I would 
use vectors until this is sorted. :-)


Jim

On 10/10/12 15:26, Jim foo.bar wrote:

Hmmm...It turns out this is not exclusive to Clojure...

user=> (java.util.Collections/unmodifiableList '(1 2 3 4 5))
#
user=> (def l *1)
#'user/l
user=> l
#
user=> (serialize! l  "TEST5")
nil
user=>  (.hashCode (deserialize! "TEST5.ser"))
0

Jim



On 10/10/12 15:16, Jim foo.bar wrote:

Lazy-seqs also seem to behave:

user=> (serialize! (map inc [1 2 3 4]) "TEST4")
nil
user=> (.hashCode (deserialize! "TEST4.ser"))
986115

Jim

On 10/10/12 15:14, Jim foo.bar wrote:

I can confirm I am seeing the behavior you describe under Clojure 1.4...

user=> (serialize! [1 2 3 4 5] "TEST")
nil
user=> (.hashCode (deserialize! "TEST.ser"))
29615266
user=> (serialize! ["a" "b" "c" "d"] "TEST2")
nil
user=> (.hashCode (deserialize! "TEST2.ser"))
3910595
user=> (serialize! '("a" "b" "c" "d") "TEST3")
nil
user=> (.hashCode (deserialize! "TEST3.ser"))
0

Can you not use vectors instead if lists? Vectors seem to behave...


(defn serialize!
"Serialize the object b on to the disk using Java serialization.
 Filename needs no extension - it will be appended (.ser)."
[b fname]
(with-open [oout (java.io.ObjectOutputStream.
 (java.io.FileOutputStream. (str fname ".ser")))]
 (.writeObject oout b)))

(defn deserialize!
"Deserializes the object in file f from the disk using Java 
serialization."

[fname]
(let [upb (promise)] ;waiting for the value shortly
  (with-open [oin (java.io.ObjectInputStream.
  (java.io.FileInputStream. fname))]
  (deliver upb (.readObject oin)))
   @upb))

Jim



On 10/10/12 14:55, N8Dawgrr wrote:
I don't think that's a realistic option for me. I have java objects 
embedded in the Clojure forms, and the graph is pretty big.


On Wednesday, October 10, 2012 2:02:45 PM UTC+1, Stuart Sierra wrote:

I would recommend serializing as strings via pr/read over Java
serialization, but this still sounds like a legitimate bug.
-S

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

2012-10-10 Thread Laurent PETIT
Exciting !

2012/10/10 Rich Hickey 

> I released a little app today that imports Git repos into Datomic. My hope
> is that it can be used as the underpinnings of some interesting Clojure
> tooling.
>
> More info here:
>
> http://blog.datomic.com/2012/10/codeq.html
>
> Rich
>
> --
> 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

ANN: codeq

2012-10-10 Thread Rich Hickey
I released a little app today that imports Git repos into Datomic. My hope is 
that it can be used as the underpinnings of some interesting Clojure tooling.

More info here:

http://blog.datomic.com/2012/10/codeq.html

Rich

-- 
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: bug in clojure.lang.ASeq

2012-10-10 Thread Jim foo.bar

Hmmm...It turns out this is not exclusive to Clojure...

user=> (java.util.Collections/unmodifiableList '(1 2 3 4 5))
#
user=> (def l *1)
#'user/l
user=> l
#
user=> (serialize! l  "TEST5")
nil
user=>  (.hashCode (deserialize! "TEST5.ser"))
0

Jim



On 10/10/12 15:16, Jim foo.bar wrote:

Lazy-seqs also seem to behave:

user=> (serialize! (map inc [1 2 3 4]) "TEST4")
nil
user=> (.hashCode (deserialize! "TEST4.ser"))
986115

Jim

On 10/10/12 15:14, Jim foo.bar wrote:

I can confirm I am seeing the behavior you describe under Clojure 1.4...

user=> (serialize! [1 2 3 4 5] "TEST")
nil
user=> (.hashCode (deserialize! "TEST.ser"))
29615266
user=> (serialize! ["a" "b" "c" "d"] "TEST2")
nil
user=> (.hashCode (deserialize! "TEST2.ser"))
3910595
user=> (serialize! '("a" "b" "c" "d") "TEST3")
nil
user=> (.hashCode (deserialize! "TEST3.ser"))
0

Can you not use vectors instead if lists? Vectors seem to behave...


(defn serialize!
"Serialize the object b on to the disk using Java serialization.
 Filename needs no extension - it will be appended (.ser)."
[b fname]
(with-open [oout (java.io.ObjectOutputStream.
 (java.io.FileOutputStream. (str fname ".ser")))]
 (.writeObject oout b)))

(defn deserialize!
"Deserializes the object in file f from the disk using Java 
serialization."

[fname]
(let [upb (promise)] ;waiting for the value shortly
  (with-open [oin (java.io.ObjectInputStream.
  (java.io.FileInputStream. fname))]
  (deliver upb (.readObject oin)))
   @upb))

Jim



On 10/10/12 14:55, N8Dawgrr wrote:
I don't think that's a realistic option for me. I have java objects 
embedded in the Clojure forms, and the graph is pretty big.


On Wednesday, October 10, 2012 2:02:45 PM UTC+1, Stuart Sierra wrote:

I would recommend serializing as strings via pr/read over Java
serialization, but this still sounds like a legitimate bug.
-S

--
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: Could be my favourite improvement in 1.4

2012-10-10 Thread Jonathan Fischer Friberg
On Thu, Jan 19, 2012 at 8:50 PM, Jeremy Heiler wrote:

> On Tue, Dec 20, 2011 at 2:05 AM, Alan Malloy  wrote:
> > I agree, this horrifies me. It isn't even as simple as "letting them
> > be whitespace", because presumably you want (read-string "{a: b}") to
> > result in (hash-map 'a 'b), but (read-string "{a :b}") to result in
> > (hash-map 'a :b). So you can't just say they're whitespace - you have
> > to recognize the context they're in to decide what they attach to, if
> > anything. The existing behavior is much cleaner.
>
> +2
>

+3


>
> --
> 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: bug in clojure.lang.ASeq

2012-10-10 Thread Jim foo.bar

Lazy-seqs also seem to behave:

user=> (serialize! (map inc [1 2 3 4]) "TEST4")
nil
user=> (.hashCode (deserialize! "TEST4.ser"))
986115

Jim

On 10/10/12 15:14, Jim foo.bar wrote:

I can confirm I am seeing the behavior you describe under Clojure 1.4...

user=> (serialize! [1 2 3 4 5] "TEST")
nil
user=> (.hashCode (deserialize! "TEST.ser"))
29615266
user=> (serialize! ["a" "b" "c" "d"] "TEST2")
nil
user=> (.hashCode (deserialize! "TEST2.ser"))
3910595
user=> (serialize! '("a" "b" "c" "d") "TEST3")
nil
user=> (.hashCode (deserialize! "TEST3.ser"))
0

Can you not use vectors instead if lists? Vectors seem to behave...


(defn serialize!
"Serialize the object b on to the disk using Java serialization.
 Filename needs no extension - it will be appended (.ser)."
[b fname]
(with-open [oout (java.io.ObjectOutputStream.
 (java.io.FileOutputStream. (str fname ".ser")))]
 (.writeObject oout b)))

(defn deserialize!
"Deserializes the object in file f from the disk using Java 
serialization."

[fname]
(let [upb (promise)] ;waiting for the value shortly
  (with-open [oin (java.io.ObjectInputStream.
  (java.io.FileInputStream. fname))]
  (deliver upb (.readObject oin)))
   @upb))

Jim



On 10/10/12 14:55, N8Dawgrr wrote:
I don't think that's a realistic option for me. I have java objects 
embedded in the Clojure forms, and the graph is pretty big.


On Wednesday, October 10, 2012 2:02:45 PM UTC+1, Stuart Sierra wrote:

I would recommend serializing as strings via pr/read over Java
serialization, but this still sounds like a legitimate bug.
-S

--
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: bug in clojure.lang.ASeq

2012-10-10 Thread Jim foo.bar

I can confirm I am seeing the behavior you describe under Clojure 1.4...

user=> (serialize! [1 2 3 4 5] "TEST")
nil
user=> (.hashCode (deserialize! "TEST.ser"))
29615266
user=> (serialize! ["a" "b" "c" "d"] "TEST2")
nil
user=> (.hashCode (deserialize! "TEST2.ser"))
3910595
user=> (serialize! '("a" "b" "c" "d") "TEST3")
nil
user=> (.hashCode (deserialize! "TEST3.ser"))
0

Can you not use vectors instead if lists? Vectors seem to behave...


(defn serialize!
"Serialize the object b on to the disk using Java serialization.
 Filename needs no extension - it will be appended (.ser)."
[b fname]
(with-open [oout (java.io.ObjectOutputStream.
 (java.io.FileOutputStream. (str fname ".ser")))]
 (.writeObject oout b)))

(defn deserialize!
"Deserializes the object in file f from the disk using Java serialization."
[fname]
(let [upb (promise)] ;waiting for the value shortly
  (with-open [oin (java.io.ObjectInputStream.
  (java.io.FileInputStream. fname))]
  (deliver upb (.readObject oin)))
   @upb))

Jim



On 10/10/12 14:55, N8Dawgrr wrote:
I don't think that's a realistic option for me. I have java objects 
embedded in the Clojure forms, and the graph is pretty big.


On Wednesday, October 10, 2012 2:02:45 PM UTC+1, Stuart Sierra wrote:

I would recommend serializing as strings via pr/read over Java
serialization, but this still sounds like a legitimate bug.
-S

--
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: bug in clojure.lang.ASeq

2012-10-10 Thread N8Dawgrr
I don't think that's a realistic option for me. I have java objects 
embedded in the Clojure forms, and the graph is pretty big.

On Wednesday, October 10, 2012 2:02:45 PM UTC+1, Stuart Sierra wrote:
>
> I would recommend serializing as strings via pr/read over Java 
> serialization, but this still sounds like a legitimate bug.
> -S
>
>  

-- 
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: understanding 'binding' use in clojure.java.jdbc

2012-10-10 Thread Stuart Sierra


On Tuesday, October 9, 2012 10:25:05 PM UTC-4, Sean Corfield wrote:
>
> This is why c.j.jdbc is getting an API overall that will expose functions 
> that accept the connection or the db-spec directly (and the old API will be 
> rewritten in terms of the new one for compatibility).


Excellent.
-S

-- 
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: bug in clojure.lang.ASeq

2012-10-10 Thread Stuart Sierra
I would recommend serializing as strings via pr/read over Java 
serialization, but this still sounds like a legitimate bug.
-S

 

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

2012-10-10 Thread Tom Clark
Probably the best way to get basic maths functions in Clojure is to
use java.lang.Math.

Cheers,
Tom

On Wed, Oct 10, 2012 at 3:38 PM, Brian Craft  wrote:
> I need some basic math functions, e.g. floor. I see there are some in
> contrib, but I'm unable to figure out the status of contrib. Seems like it's
> deprecated, or in transition, or something?
>
> --
> 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


ANN couchbase-clj 0.1.0

2012-10-10 Thread otabat
couchbase-clj is a Clojure client for Couchbase Server 2.0.

This library provides a thin layer of Clojure that simplifies the 
complicated Java interface.  

couchbase-clj 0.1.0 is the initial release.


GitHub
https://github.com/otabat/couchbase-clj

API Docs
http://otabat.github.com/couchbase-clj/

Clojars
https://clojars.org/couchbase-clj


Tatsuya Tsuda

-- 
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: Could be my favourite improvement in 1.4

2012-10-10 Thread Rik Diede
I'm glad this issue caught my eye. I disagree with this change as well, and 
I hope it will be reconsidered (see alternative solution below). 

I strongly agree with what is already said on the JIRA page by Joseph 
Smith. What syntaxes will we support? Do we add the latest and greatest 
from a few years from now as well? 

*Joseph 
Smith
: Clojure already has reader syntax for a map. If we support JSON, do we 
also support ruby map literals? Seems like this addition would only add 
confusion, imo, given colons are used in keywords and keywords are 
frequently used in maps - e.g., when de-serializing from XML, or even JSON.*


Also, about the point David Nolen makes:

*David 
Nolen:
 
Clojure is no longer a language hosted only on the JVM. Clojure is also 
hosted on the CLR, and JavaScript. In particular ClojureScript can't 
currently easily deal with JSON literals - an extremely common (though 
problematic) data format. By allowing colon whitespace in map literals - 
Clojure data structures can effectively become an extensible JSON superset 
- giving the succinctness of JSON and the expressiveness of XML.*

 
Judging from the 'State of Clojure' survey[1], not a whole lot are using 
the CLR or JavaScript as Clojure's host. Of course I encourage these 
"forks", as I would like to qualify them, and I like the balance between 
Clojure's pureness and practicality (as this is a practicality issue). But, 
I would not like to see (the original/basic/core?) Clojure to be "polluted" 
with syntax extensions for the sake of new hosts or currently popular data 
formats. Again, what do we add and what do we leave out? What (legacy) mess 
would this create for Clojure say 10-20 years from now? Why should I, as a 
developer, take syntaxes for formats/hosts I don't work with into account while 
using basic Clojure?

My proposal: keep Clojure clean, and use reader literals for these kind of 
things.

[1] 
http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/

-- 
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: understanding 'binding' use in clojure.java.jdbc

2012-10-10 Thread gaz jones
Yeah, you probably shouldn't rely on this but I think it will still
work. I have done something similar before when reading from 3
databases simultaneously (3 nested with-connection and
with-query-result calls) and I believe (connection) is only called
once when creating the prepared statement.

On Tue, Oct 9, 2012 at 9:24 PM, Sean Corfield  wrote:
> No, the inner with-connection binds *db* to db1 so db2 is no longer
> accessible.
>
> This is why c.j.jdbc is getting an API overall that will expose functions
> that accept the connection or the db-spec directly (and the old API will be
> rewritten in terms of the new one for compatibility).
>
> Sean
>
>
> On Tue, Oct 9, 2012 at 2:44 PM, gaz jones  wrote:
>>
>> Can you not simply:
>>
>> (jdbc/with-connection db2
>> (jdbc/with-query-results results
>>   query
>>   {:result-type :forward-only
>>:fetch-size 1000}
>>   (jdbc/with-connection db1
>>  ;; read and write?
>>)))
>>
>> ?
>
>
>
> --
> 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


bug in clojure.lang.ASeq

2012-10-10 Thread N8Dawgrr
Hi, stumbled on a nasty bug in Clojure. I'm transferring Clojure objects 
around using java serialization. When de-serializing a List 
(clojure.lang.ASeq) it has a hashCode of 0. This means lookups for the 
object in HashMaps PersistentHashMaps HashSets etc fail. The pre-serialized 
version of the object has a valid non-zero hashCode.

The reason for this is that the cached hashCode value is marked as 
transient and its default un-cached value is -1. E.g. if he hashCode is -1 
compute the hashCode. Of course when an Object is de-serialized any integer 
transient fields are set to 0.

This bug seems to be in all Clojure versions.

-- 
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: cronj - task scheduling

2012-10-10 Thread zcaudate

>
> okay... the readme is now updated =)

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

2012-10-10 Thread zcaudate
The apache commons library - http://commons.apache.org/math/ is really rock 
solid.


all the utilities can be found in:
http://commons.apache.org/math/apidocs/org/apache/commons/math3/util/FastMath.html

see 
http://stackoverflow.com/questions/12327120/finding-all-the-power-roots-in-clojure

for a complex example

On Wednesday, October 10, 2012 1:38:20 PM UTC+11, Brian Craft wrote:
>
> I need some basic math functions, e.g. floor. I see there are some in 
> contrib, but I'm unable to figure out the status of contrib. Seems like 
> it's deprecated, or in transition, or something? 

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