Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-07 Thread Mikera
I'd suggest avoiding macros until you absolutely know that you need them. Usually they aren't necessary. Prefer writing pure functions (without side effects) - these are easier to reason about, easier to test, simpler to write correctly and easier to plug together / compose via higher order fun

Re: IDE feature

2013-08-07 Thread Lee Spector
On Aug 7, 2013, at 2:06 PM, Norman Richards wrote: > Structural editing, like paredit, is really the only sane way to do Clojure > code. I honestly thing anyone who manually balances parenthesis or edits > Clojure functions in a way that doesn't preserve the structural integrity of > your expr

Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-07 Thread Jace Bennett
Thanks to the community for a wondrous programming environment. I discovered SICP last year, and fell in love with the idea of lisp. But I've come to a point where I think I need practice on moderately sized projects before more reading will help. When starting on almost any moderately scoped effo

Re: Function as key of a map

2013-08-07 Thread Matching Socks
Consider clojure.core/frequencies -- -- 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 unsubsc

Re: Story

2013-08-07 Thread Tim Daly
> Recently, I discovered the "story" literate programming tool for Clojure, > which I prefer to marginalia: > https://github.com/jedahu/story > > ... (snip) ... > > I had never heard of "story", but ran across a mention of it while looking > through the issues on marginalia's github site, so I de

Re: core.async channel GUID

2013-08-07 Thread Brandon Bloom
You can emulate this relatively easily with a pair of serialize/deserialize functions which read/write to a global atom containing a map. On Wednesday, August 7, 2013 7:15:55 PM UTC-4, David Pollak wrote: > > Howdy, > > I'm working on bridging between core.async channels in the browser and on >

core.async channel GUID

2013-08-07 Thread David Pollak
Howdy, I'm working on bridging between core.async channels in the browser and on the server. It would be very useful to have a GUID associated with the channel so that when I serialize a message that contains a channel, I can send the GUID instead and on the other side, create a proxy channel so t

Re: Clojure Stored Procedure

2013-08-07 Thread ArturoH
+1 here. Has anyone been able to write stored procedures in Java? -- -- 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

Re: Wrong documentation of contains?

2013-08-07 Thread Armando Blancas
The keys docstring says it returns a sequence, and that's all you get: it'll do first and next, nothing special about it. The contains? docstring says it won't do a linear search, so that rules out the result of keys. (KeySeq just wraps a seq of entries to return the key field.) What's confusin

Re: [ANN] optparse-clj: Functional GNU-style command line options parsing

2013-08-07 Thread Laurent PETIT
Le mercredi 7 août 2013, guns a écrit : > On Wed 7 Aug 2013 at 05:35:41PM +0100, Wolodja Wentland wrote: > > > Do you have a particular reason why you didn't simply add this > > functionality to tools.cli ? > > I did think of sending this upstream, but the parser is not the only > point of differ

Re: Wrong documentation of contains?

2013-08-07 Thread Jonathan Fischer Friberg
No, it should be more explicit. "If called with a map..." "If called with a vector..." Jonathan On Wed, Aug 7, 2013 at 8:32 PM, Michael Gardner wrote: > Wouldn't changing "collection" to "associative collection" be enough? > Though maybe a note about its behavior on vectors would also be good.

Re: Wrong documentation of contains?

2013-08-07 Thread Michael Gardner
Wouldn't changing "collection" to "associative collection" be enough? Though maybe a note about its behavior on vectors would also be good. On Aug 7, 2013, at 11:15 , Mark Engelberg wrote: > Yes, the discussion about contains? has come up before, but there's a new > aspect to this particular i

Re: IDE feature

2013-08-07 Thread Norman Richards
On Wed, Aug 7, 2013 at 12:25 PM, Paul L. Snyder wrote: > If paredit is a hard sell (it was for me, the first three or four times > that I tried it), realizing that you can break the "balance" when needed > by > judicious use of kill and yank may be helpful during the transition to a > structural

Re: IDE feature

2013-08-07 Thread Paul L. Snyder
>> On Wed, 07 Aug 2013, Abraham wrote: >> >> Any IDE provides the feature found in DrRacket ,that is it auto completes >> the corresponding > > >> [ or ( . by pressing ) . Keep on pressing ) in DrRacket will >> autocomplete the square or round bracket. >> >> Clojure IDE feature shld be for

Re: filter with a sequence of maps not working

2013-08-07 Thread Timo Mihaljov
On 07.08.2013 10:58, Tilak Thapa wrote: > (defn get-data > [& attrs] > (let [grps data] > (if (empty? attrs) > grps > (map #(select-keys % attrs) grps > > (filter #(= (% :id) 7) (get-data :id :b)) > > Why above expression works but same expression wrapped as function > (b

Re: [ANN] optparse-clj: Functional GNU-style command line options parsing

2013-08-07 Thread guns
On Wed 7 Aug 2013 at 05:35:41PM +0100, Wolodja Wentland wrote: > Do you have a particular reason why you didn't simply add this > functionality to tools.cli ? I did think of sending this upstream, but the parser is not the only point of difference with tools.cli. Given that both libraries are so

Re: Out of memory on spit

2013-08-07 Thread Moritz Ulrich
Just a guess: You put 500 (or so) actions to the internal agent queue and the agent isn't fast enough to keep up. The queue grows very fast and goes out of memory. On Wed, Aug 7, 2013 at 3:09 PM, Jérémie Campari wrote: > Hello ! > > I don't understand why my code raise an Out of memory except

Story

2013-08-07 Thread Mark Engelberg
Recently, I discovered the "story" literate programming tool for Clojure, which I prefer to marginalia: https://github.com/jedahu/story I had tried marginalia, but ran into the following problems: 1. Didn't really handle all markdown notations properly, so I had a lot of trouble getting the format

Re: IDE feature

2013-08-07 Thread Mark Engelberg
I don't think there's any IDE that does this out of the box, although I'm certain that if you're an elisp hacker, you could easily add this to emacs' clojure mode. I, too, miss that feature from DrRacket. -- -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: [ANN] optparse-clj: Functional GNU-style command line options parsing

2013-08-07 Thread Wolodja Wentland
On Wed, Aug 07, 2013 at 10:53 -0500, guns wrote: > I'd like to announce optparse-clj, a command line options parser that > supports GNU option parsing conventions: > The interface is modelled after clojure.tools.cli¹, but the parser is > more flexible: Yes! Thank you so much for developing this a

IDE feature

2013-08-07 Thread Abraham
Any IDE provides the feature found in DrRacket ,that is it auto completes the corresponding [ or ( . by pressing ) . Keep on pressing ) in DrRacket will autocomplete the square or round bracket. Clojure IDE feature shld be for completing { , [ , ( ... and so on. Thanks A -- -- You rec

Function as key of a map

2013-08-07 Thread Abraham
this is in reference to the followng article http://blog.safaribooksonline.com/2013/08/06/two-simple-clojure-tricks-with-values/ wherin it says any value ( function , vector , other data structure of clj) can be used as key for a hashed map. can anybody enlighten how is it useful if functi

filter with a sequence of maps not working

2013-08-07 Thread Tilak Thapa
I'm new to clojure. I've return an utility function to filter a sequence of map by some key but it's not working. Here is the sample code - (def data [{:id 1 :b 2} {:id 3 :b 4} {:id 5 :b 6} {:id 7 :b 8}]) In real app this is a sequence of maps read

Out of memory on spit

2013-08-07 Thread Jérémie Campari
Hello ! I don't understand why my code raise an Out of memory exception. I have an agent that call a function which append a line to the "test.log" file. The out of memory is on PersistentHashMap $ BitmapIndexedNode.assoc(PersistentHashMap.java:624). (use 'clojure.java.io) > > (def the-agen

Re: Wrong documentation of contains?

2013-08-07 Thread Mark Engelberg
Yes, the discussion about contains? has come up before, but there's a new aspect to this particular instance of the discussion that most of the posts seem to be ignoring. The original poster specifically pointed out that his sequence was constructed by calling the `keys` function on a map: (keys {

[ANN] optparse-clj: Functional GNU-style command line options parsing

2013-08-07 Thread guns
Hello, I'd like to announce optparse-clj, a command line options parser that supports GNU option parsing conventions: https://github.com/guns/optparse-clj [guns.cli/optparse "1.0.0"] The interface is modelled after clojure.tools.cli¹, but the parser is more flexible: * `-abc` expan

Re: PoC: Combining Wikidata and Clojure logic programming

2013-08-07 Thread Karsten Schmidt
That's also the exact same reason why I started this project in Clojure. Being able to have no dependencies apart from tiny core libs (tools.dependency, data.json) and use the REPL to play around with queries, quickly import & export datasets, visualize results and not having to deal with the compl

Re: Wrong documentation of contains?

2013-08-07 Thread Jim - FooBar();
aa the old 'why contains? doesn't work' discussion...even though it's been a while since it last came up on this list, it must be the single most popular questions :) Jim On 07/08/13 12:24, Goldritter wrote: In an program I used the result of keys as an argument for a function which ve

Marginalia needs a new home

2013-08-07 Thread Fogus
As I mentioned on my blog[1], I'm looking to transfer ownership of the Marginalia codebase to someone interested in taking it in new and exciting directions. I still value library documentation but I have long since become a mere user of my own software. That is, what Marginalia does right no

Re: PoC: Combining Wikidata and Clojure logic programming

2013-08-07 Thread Mingli Yuan
Thanks very much, David, Timothy and Karsten, I know some RDF store like Jena or Stardog, but the reason I want to take a try of Clojure logic programming is the simplicity: * setup for core.logic is very easy by lein * no server needed * and even from the concept level, Semantic Web is based on

Re: Wrong documentation of contains?

2013-08-07 Thread Jay Fields
I ran into a similar (in my opinion) issue the other day. I was working a vector and updating a value at a specific index. Ordering and performance were important, so it seemed like a good default choice. (-> [1 2 3] (update-in [1] inc)) Then the code changed a bit, I needed to filter some eleme

Re: Wrong documentation of contains?

2013-08-07 Thread Lee Spector
On Aug 7, 2013, at 8:22 AM, Jay Fields wrote: > contains? is possibly poorly named, contains-key? would probably have avoided > this entire issue. I'd put it more strongly -- contains? is definitely poorly named, inviting the assumption that it can be used where you really want "some" with a s

Re: Wrong documentation of contains?

2013-08-07 Thread Tassilo Horn
Jay Fields writes: > For a list, it seems like converting the list to a vectoc (via vec) > would be a reasonable solution, though I'm sure there's some side > effect that I haven't considered. Perf would be impacted, but this > doesn't seem like the kind of thing you'd want to do anyway, so havin

Re: Wrong documentation of contains?

2013-08-07 Thread Jay Fields
contains? is possibly poorly named, contains-key? would probably have avoided this entire issue. That said, I'd like to see contains? return false for things where it doesn't make sense, longs, keywords, etc. For a list, it seems like converting the list to a vectoc (via vec) would be a reasonable

Re: Wrong documentation of contains?

2013-08-07 Thread Jonathan Fischer Friberg
That's only obvious if you already know how it works. Jonathan On Wed, Aug 7, 2013 at 2:13 PM, Karsten Schmidt wrote: > The fact, that the docs refer to checking if a "key" is present in the > collection, should make it obvious which types are supported, no? Only > vectors, maps and sets have ke

Re: Wrong documentation of contains?

2013-08-07 Thread Karsten Schmidt
The fact, that the docs refer to checking if a "key" is present in the collection, should make it obvious which types are supported, no? Only vectors, maps and sets have keys. Lists and seqs do not. Of course it never hurts to be more explicit about it... On 7 Aug 2013 12:49, "Marcus Lindner" wrot

Re: Wrong documentation of contains?

2013-08-07 Thread Tassilo Horn
Marcus Lindner writes: > But the problem is, that this is not mentioned in the documentation of > contains? I found so far :(. Well, it kind of is: Only associative data structures (maps, sets, records, vectors) have keys, lists and seqs (such as APersistentMap$KeySeq) don't. I guess the confus

Re: PoC: Combining Wikidata and Clojure logic programming

2013-08-07 Thread Karsten Schmidt
Hi Mingli, FYI for the past 3 months I've been working almost fulltime on a lightweight, modular RDF Clojure toolkit, which I plan to opensource in the near future, once the core API has more solidified. The kit so far features: * core RDF datatype protocols (URIs, blank nodes, literals, containe

Re: Wrong documentation of contains?

2013-08-07 Thread Marcus Lindner
Thanks. But the problem is, that this is not mentioned in the documentation of contains? I found so far :(. I had such a problem a long time ago and remember now which type of "collection" can be used with contains?. But after a time I will forget this again and will refer to the documentation. (A

[proposal] simplified but extensible ns declaration

2013-08-07 Thread Phillip Lord
At the risk of continuing an already long thread on the namespace declaration, I want to present my proposal for changing the namespace declaration. Unlike Greg's proposal, it is not about changing the syntax, but fundamentally changes the nature of the declaration. One of the things about the

Re: Wrong documentation of contains?

2013-08-07 Thread Baishampayan Ghose
Hi, `contains?` only works with associative data-structures like maps & vectors. If you want to find out if a sequence contains a specific object then you need to use `some` paired with a set as a predicate. For example: (some #{3} '(1 2 3 4)) Hope this helps. ~BG On Wed, Aug 7, 2013 at 4:54

Wrong documentation of contains?

2013-08-07 Thread Goldritter
In an program I used the result of keys as an argument for a function which verifies whether an object is in a passed collection or not. The result I got was following Exception: IllegalArgumentException contains? not supported on type: clojure.lang.APersistentMap$KeySeq clojure.lang.RT.contains