Re: Log SQL in clojure.contrib.sql
On 29 July 2010 15:17, ngocdaothanh ngocdaoth...@gmail.com wrote: I found: http://code.google.com/p/log4jdbc/ That looks useful - thanks! -- 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: Idea for personal Clojure project
As others have said, there isn't an algorithm that does this. Useful results depend on precise definitions of context and similarity. The waters get deep quickly. As a clojure exercise, though, there are lots of good starting points. For instance: get a set of words, create all pairs from the set, run a google search on each pair, extract the count of documents from the results, use the counts as a distance between the words as nodes, and throw that in a graph. Something like this would make an interesting topology, and could be enhanced by using a different corpus, and/or swapping in different distance measurements. Though as described it would not tell you anything interesting semantically. For a slightly more sophisticated framing of the problem, look at NLP programming assignments, like wordnet distance, e.g. http://www.cs.princeton.edu/courses/archive/spr07/cos226/assignments/wordnet.html Hope that helps. On Wed, Jul 28, 2010 at 4:58 PM, Daniel doubleagen...@gmail.com wrote: I want to write a clojure program that searches for similarities of words in the english language and places them in a graph, where the distance between nodes indicates their similarity. I don't mean syntactical similarity. Related contextual meaning is closer to the mark. For instance: fish and reel don't have much similarity, but in the context of fishing they do, so the distance in such a graph wouldn't be very large. I'm sure research has been done in this area (I suspect with no small portion belonging to google), so can anybody point me in the right direction? Thanks. -- 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
Rincanter problem
I can't get Rincanter to install. I get the message: Unable to resolve artifact: Missing: -- 1) org.incanter:incanter-full:jar:1.2.0-SNAPSHOT Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.incanter - DartifactId=incanter-full -Dversion=1.0-master-SNAPSHOT - Dpackaging=jar -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.incanter - DartifactId=incanter-full -Dversion=1.0-master-SNAPSHOT - Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] Path to dependency: 1) org.apache.maven:super-pom:jar:2.0 2) org.incanter:incanter-full:jar:1.0-master-SNAPSHOT -- 1 required artifact is missing. for artifact: org.apache.maven:super-pom:jar:2.0 from the specified remote repositories: clojure (http://build.clojure.org/releases), clojars (http://clojars.org/repo/), clojure-snapshots (http://build.clojure.org/snapshots), central (http://repo1.maven.org/maven2) -- 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: Dynamic defrecord
Hi Stu It is as simple as that. What I'm really working on is my own editor. The file in question is the lexer for various program types.The editor never knows what type of file will be loaded until it's loaded. At that point the proper lexer should be loaded and stored so that the next time a file of that type is loaded the lexer is already there.This problem is seen in many different programming tasks.There is no point in pre-loading a ruby lexer if the user never loads a ruby file, etc.Once loaded the lexer is never changed. I like slurp as the function name! Bill On Jul 28, 9:16 am, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Bill, Are your looking for something as simple as this: (defrecord Foo [x]) (defn load-a-record-at-runtime Loads a record value from a file [f] (Foo. (slurp f))) Or is there some subtlety here? Stu The confusion over type and instance was a sloppy example. Sorry. But in your solution I'm confused by one thing. You create and instance of Foo in the let and then assoc the new value of List1 to it. This has two problems. One is that the loaded data is not permanent. The other is that there is no way to add List2 to the MyFoo record. (I've decided to not use MyFoo at all. Instead I have a (def List1 (ref nil)) defined and then do a ref-set to it when the data is loaded. This seems much simpler and works. I then can do a def for List2, List3, etc.) It seem to me there should be some way to load a record at run time without breaking the immutability laws. Once the dynamic data is loaded, the record becomes immutable and will never be changed again. It's unrealistic to imagine that we always know at compile time what the values of a record will be. I'm not a compiler person so I have no idea how to do such a thing and no idea if it is possible. On Jul 27, 5:23 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Bill, There are several issues here: (1) A confusion of record and instance. You are asking for the :list1 field from foo, the record type, not from an instance of the type. (:list1 foo) s/b (:list1 MyFoo) (2) You are ignoring the return value of assoc. Remember, Clojure data structures are immutable. To actually assign something you need to hold on to the return value of the expression (or use a reference type if you really want an identity). (3) The capitalization choices facilitate confusion. You are using foo for a record/class name, where both Java and Clojure style would dictate Foo. Then you use MyFoo for a top-level def, where Clojure style would encourage my-foo. The following code demonstrates these ideas. ;; stubbed so example can be run (defn load-data-from-file [x] :stub) (defrecord Foo [list1 list2]) (defn get-data [path] (let [list1Data (load-data-from-file path) f (Foo. nil nil) f (assoc f :list1 list1Data)] (:list1 f))) (get-data fakepath) Regards, Stu Stuart Halloway Clojure/corehttp://clojure.com All the examples of defrecord I see seem simple enough and when I experiment in the REPL I get things to work as they should. However, when I move to 'real' code I can't get it to work at all. The problem at hand is simple enough - I want to create a record that hold records. For example I have (defrecord foo [list1, list2]) where list1 and list2 are defined records themselves. The issue is that the data in list1 and list2 is dynamic - it is loaded from a file at run time. So I do the following: (def MyFoo (foo. nil nil)) (defn get-data [path] (let [list1Data (load-data-from-file path)] ; fill in the record for list 1 (assoc MyFoo :list1 list1Data) ; assign the data record to the foo record (:list1 foo) )) As I say, if I do this non-dynamically in the REPL I get the proper result. In my program (using let) (:list1 foo) always remains nil. What am I doing wrong? And how can I get the fields of foo to take on the dynamic data. Bill -- 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
Re: Dynamic defrecord
Yes, but I don't want to load all the parts at once. I may have four records that will be part of MyFoo, but I only ever need one - maybe List3 in this case.That's why it's dynamic and why I have the problem in the first place. Bill On Jul 28, 12:40 pm, Armando Blancas armando_blan...@yahoo.com wrote: It seem to me there should be some way to load a record at run time without breaking the immutability laws. Once the dynamic data is loaded, the record becomes immutable and will never be changed again. Actually, that's how records work and is exactly the behavior of the initial (foo. nil nil), after which the record is loaded and immutable. If the loaded data must be bound to MyFoo: (def MyFoo (foo. (load-data-from-file f1) (load-data-from-file f2))) or you might consider making Myfoo a ref instead of each subrecords, seems simpler that way. -- 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: Feedback on Clojure web development post
Hello Mark, Your post was fantastic and very well-written. Thank-you for posting it! A few thoughts: - Perhaps adding dynamic graphs from Incanter to the project with might make a good follow-up post ? - Is there a reason why you preferred EC2 tools over the elastic- mapreduce executable or clojure calls of the java ( see http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2305categoryID=262) ? - What are your thoughts on clojure handling the initial EC2 set up and launching of the node instances as well? - Does it seem like creating a UI for editing and launching code for Apache Hive, Pig, or Cascalog seems within reach with this kind of set up ? Regards, ~Avram On Jul 24, 12:30 am, Mark McGranaghan mmcgr...@gmail.com wrote: Hi All, I recently posted to my blog on the process of developing and deploying a simple Clojure web application: http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applica... The purpose of this post is twofold. The first is to provide some documentation in the form of a complete, deployable Clojure web app and associated commentary and instructions. To that end I hope you find the post useful and that you feel free to ask any questions you may have. The second purpose is to elicit feedback from the community on how they would or have approached the problem of developing and deploying Clojure web applications. I'm particularly interested in the specifics of how people tie together and round out entire apps with e.g. logging and exception handling, how they develop apps locally, and how they deploy them to production. I think the most useful basis for discussing things like this is complete working examples of applications and associated instructions for how to deploy them. I doubt there are very many such open-source apps floating around, but if anyone has one to share I would love to see it. Even if you don't have a complete app to share, I would love to hear your comments and see your code snippets on the specific aspects of the development and deployment process that I covered (or perhaps omitted) in the post. - Mark -- 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: Idea for personal Clojure project
What you describe is not clojure specific, so... Check out the NLTK project. It is all in Python, and all of the big book are written for learning to use the tools in Python. However, it also contains a lot of talk about Natural Language Processing in general. http://www.nltk.org/book I, myself, am digging through the book and will need to implement some portions in Perl if I want to use the concepts for some of my own work projects. -- Savanni On Wed, 2010-07-28 at 13:58 -0700, Daniel wrote: I want to write a clojure program that searches for similarities of words in the english language and places them in a graph, where the distance between nodes indicates their similarity. I don't mean syntactical similarity. Related contextual meaning is closer to the mark. For instance: fish and reel don't have much similarity, but in the context of fishing they do, so the distance in such a graph wouldn't be very large. I'm sure research has been done in this area (I suspect with no small portion belonging to google), so can anybody point me in the right direction? Thanks. -- 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: fast development through clojure repl
On Tue, Jul 27, 2010 at 11:32 AM, Peter Schuller peter.schul...@infidyne.com wrote: I, however, have still been doing a more traditional write/save/execute debugging workflow without the REPL, which doesn't seem to get the real benefits of the REPL. From what I understand, when you take full advantage of the REPL, you can quickly tweak things in the code like if a function breaks, you can rewrite it and start again. Say for example a GUI is opened and a button press calls some clojure function. If there's a bug in that, I can redefine that function in the REPL and just click again on the button to continue without losing the state of the program when I recompile. Is this correct? I didn't see any mention of an editor choice in your message, I would recommend getting started with the Clojure plugin for your editor of choice (be it Vim, Emacs, Eclipse or anything else) based on the instructions here: http://www.assembla.com/wiki/show/clojure/Getting_Started , most of the editors there have some kind of interactive REPL that sounds like it would be helpful for you. There is something similar for vim (I'm sure a vim user will chime in). Vim's equivalent is VimClojure - http://kotka.de/projects/clojure/vimclojure.html The way I use VimClojure is spawn an in-editor REPL and have vimclojure eval the file, then I can use the methods defined in the file from within the editor's REPL, if I change a function VimClojure has keybindings to eval a form, which updates the definition of the method and I can try it from the REPL again without reloading anything. - Lee -- 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: Idea for personal Clojure project
On Wed, Jul 28, 2010 at 2:58 PM, Daniel doubleagen...@gmail.com wrote: I want to write a clojure program that searches for similarities of words in the english language and places them in a graph, where the distance between nodes indicates their similarity. I don't mean syntactical similarity. Related contextual meaning is closer to the mark. For instance: fish and reel don't have much similarity, but in the context of fishing they do, so the distance in such a graph wouldn't be very large. I'm sure research has been done in this area (I suspect with no small portion belonging to google), so can anybody point me in the right direction? Thanks. I've started some work with natural language processing and Clojure in my clojure-opennlp library - http://github.com/dakrone/clojure-opennlp , it may be useful to you, however it looks like you're interested more in semantic processing instead of grammatical/syntax processing, so I'm not sure if it entirely fits your need. Just thought I'd throw it in. - Lee -- 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
Is there an easier way to code this? Destructuring?
Hello folks, I'm working on some sample code and I have a feeling that there is an easier/more succinct way to code this. Any help or RTFM with a link is appreciated. Given: (def cookbook {:Coffee {:coffee 3, :sugar 1, :cream 1}, :Decaf-Coffee{:decaf 3, :sugar 1, :cream 1}, :Caffe-Late {:espresso 2, :steamed-milk 1}, :Caffe-Americano {:espresso 3}, :Caffe-Moca {:espresso 1, :coco 1, :steamed-milk 1, :cream 1}, :Cappuccino {:espresso 2, :steamed-milk 1, :foamed-milk 1} }) (def cost {:coffee0.75, :decaf 0.75, :sugar 0.25, :cream 0.25, :steamed-milk 0.35, :foamed-milk 0.35, :espresso 1.00, :cocoa 0.90, :whipped-cream 1.00 }) (def menu {:Coffee 1, :Decaf-Coffee2, :Caffe-Late 3, :Caffe-Americano 4, :Caffe-Moca 5, :Cappuccino 6 }) I'm trying to write a function to print out the menu listing the cost of each drink. It works (sort of) but I keep thinking there is an easier way. (defn print-menu [menu] (do (println Menu:) (doseq [[drink number] menu] (println (str number , (drink-name drink) , (reduce + (map (fn [map-entry] (* (cost (key map-entry) (val map- entry (cookbook drink Specifically this part: (map (fn [map-entry] (* (cost (key map-entry) (val map-entry (cookbook drink)) Is there a way I can get at the map key and value using destructuring without knowing what the key is ahead of time? Thanks, Daniel -- 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: Idea for personal Clojure project
I've done quite a lot of work in this area, although not in clojure. As Mark mentioned, wordnet is definitely a good place to start, but it's short on proper nouns, which reduces the utility of this when analyzing natural language. I ended up extending wordnet by data mining wikipedia dumps. The relationship between an article and it's category is essentially the same as a word and it's hypernym. The same is true of redirects and synonyms. The whole problem is more complex than it appears at first glance because of word senses. As an example, how related are shot and assassinated? Very, if by shot you mean the past tense of shoot, but not so much if you're referring to a shot of vodka. As far as I know word sense disambiguation is very much an unsolved problem. You'll also want to get a feel for Part of Speech, which is usually a precursor to wsd. It's an interesting problem to solve, and I enjoyed working on it. I don't have any papers handy, but search for deep parsing and semantic similarity in the context of natural language processing and you'll get a feel for stuff. -lance On Jul 28, 2:34 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Wordnet is the main existing thing that comes to mind as related to your idea. -- 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: Idea for personal Clojure project
I think there were some talks about this on the conference I went to recently. Keywords might be natural language processing. Linked is the abstracts of the conference, which you might find some use in. http://www.insna.org/PDF/Sunbelt/4_ProgramPDF.pdf One alternative I briefly considered is to use google's suggest feature. Two examples: say you want to know if 'reel' and 'fish' belong together, you can try http://google.com/complete/search?q=fishing+r If you want to know whether 'games' and 'cow' belong together, or 'games' and 'herring' http://google.com/complete/search?q=games+herring But it doesn't work that great. Wordnet seems like a decent start, but if you run into better databases for relations between words, let us know :-). For the more practical part. I found displaying large graphs well doable using a combination of java's processing library (Incanter has an extension for that), and a spring vertlets library called Toxiclib for finding a good way to display the network. Personally, I found that an algorithm that works well was one that first used constrained- springs (dampened springs) between nodes of the network, and once that had settled into relative peace, used mindistance-springs to get overlapping nodes separated from each other. http://processing.org/discourse/yabb2/YaBB.pl?num=1238682023 http://toxiclibs.org/ -- 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: Is there an easier way to code this? Destructuring?
Hi, Daniel Here's my variant https://gist.github.com/49c6ac95b7456a150df8 Note, that in cookbook :Caffe-Moca should contain :cocoa, not :coco And I your variant calculating drink cost works incorrectly. (* (cost (key map-entry) (val map-entry))) should be replaced by (* (cost (key map-entry)) (val map-entry)) Regards, Nikita Beloglazov On Thu, Jul 29, 2010 at 3:02 AM, Daniel Glauser danglau...@gmail.comwrote: Hello folks, I'm working on some sample code and I have a feeling that there is an easier/more succinct way to code this. Any help or RTFM with a link is appreciated. Given: (def cookbook {:Coffee {:coffee 3, :sugar 1, :cream 1}, :Decaf-Coffee{:decaf 3, :sugar 1, :cream 1}, :Caffe-Late {:espresso 2, :steamed-milk 1}, :Caffe-Americano {:espresso 3}, :Caffe-Moca {:espresso 1, :coco 1, :steamed-milk 1, :cream 1}, :Cappuccino {:espresso 2, :steamed-milk 1, :foamed-milk 1} }) (def cost {:coffee0.75, :decaf 0.75, :sugar 0.25, :cream 0.25, :steamed-milk 0.35, :foamed-milk 0.35, :espresso 1.00, :cocoa 0.90, :whipped-cream 1.00 }) (def menu {:Coffee 1, :Decaf-Coffee2, :Caffe-Late 3, :Caffe-Americano 4, :Caffe-Moca 5, :Cappuccino 6 }) I'm trying to write a function to print out the menu listing the cost of each drink. It works (sort of) but I keep thinking there is an easier way. (defn print-menu [menu] (do (println Menu:) (doseq [[drink number] menu] (println (str number , (drink-name drink) , (reduce + (map (fn [map-entry] (* (cost (key map-entry) (val map- entry (cookbook drink Specifically this part: (map (fn [map-entry] (* (cost (key map-entry) (val map-entry (cookbook drink)) Is there a way I can get at the map key and value using destructuring without knowing what the key is ahead of time? Thanks, Daniel -- 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.comclojure%2bunsubscr...@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: Is there an easier way to code this? Destructuring?
Hi, not really simplifying (in the sense of removing code), but (tentatively ?) de-obfuscating: (defn print-menu [menu] (do (println Menu:) (doseq [[drink number] menu] (println (str number , (drink-name drink) , (reduce (fn [acc-cost [ingredient quantity]] (+ acc-cost (* (cost ingredient) quantity))) (cookbook drink))) Note that I got rid of the intermediate map But I think that I would certainly divide it in more manageable pieces: (defn- drink-name [drink] (name drink)) (defn- drink-cost [drink] (reduce (fn [acc-cost [ingredient quantity]] (+ acc-cost (* (cost ingredient) quantity))) 0 (cookbook drink))) (defn print-menu [menu] (println Menu:) (doseq [[drink number] menu] (println (str number , (drink-name drink) , (drink-cost drink) HTH, -- Laurent 2010/7/29 Daniel Glauser danglau...@gmail.com Hello folks, I'm working on some sample code and I have a feeling that there is an easier/more succinct way to code this. Any help or RTFM with a link is appreciated. Given: (def cookbook {:Coffee {:coffee 3, :sugar 1, :cream 1}, :Decaf-Coffee{:decaf 3, :sugar 1, :cream 1}, :Caffe-Late {:espresso 2, :steamed-milk 1}, :Caffe-Americano {:espresso 3}, :Caffe-Moca {:espresso 1, :coco 1, :steamed-milk 1, :cream 1}, :Cappuccino {:espresso 2, :steamed-milk 1, :foamed-milk 1} }) (def cost {:coffee0.75, :decaf 0.75, :sugar 0.25, :cream 0.25, :steamed-milk 0.35, :foamed-milk 0.35, :espresso 1.00, :cocoa 0.90, :whipped-cream 1.00 }) (def menu {:Coffee 1, :Decaf-Coffee2, :Caffe-Late 3, :Caffe-Americano 4, :Caffe-Moca 5, :Cappuccino 6 }) I'm trying to write a function to print out the menu listing the cost of each drink. It works (sort of) but I keep thinking there is an easier way. (defn print-menu [menu] (do (println Menu:) (doseq [[drink number] menu] (println (str number , (drink-name drink) , (reduce + (map (fn [map-entry] (* (cost (key map-entry) (val map- entry (cookbook drink Specifically this part: (map (fn [map-entry] (* (cost (key map-entry) (val map-entry (cookbook drink)) Is there a way I can get at the map key and value using destructuring without knowing what the key is ahead of time? Thanks, Daniel -- 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.comclojure%2bunsubscr...@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: Idea for personal Clojure project
As others have said, this is a difficult problem, but a fascinating one too. I'm currently nibbling on building some grouping-by- similarity algorithms for Clojure, although I'm sticking to numerical criteria for similarity or distance. New developments in text analysis and the Learning by Reading approach to AI, as described at http://blog.steinberg.org/?p=11 e.g., are making data science an exciting place. If you make some headway, please do share with us. I for one would love to see where you go and contribute if possible. Cheers, Michael On Jul 28, 4:58 pm, Daniel doubleagen...@gmail.com wrote: I want to write a clojure program that searches for similarities of words in the english language and places them in a graph, where the distance between nodes indicates their similarity. I don't mean syntactical similarity. Related contextual meaning is closer to the mark. For instance: fish and reel don't have much similarity, but in the context of fishing they do, so the distance in such a graph wouldn't be very large. I'm sure research has been done in this area (I suspect with no small portion belonging to google), so can anybody point me in the right direction? Thanks. -- 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: Is there an easier way to code this? Destructuring?
I agree with Laurent's idea that you should pull this out as a separate function, but I think the most direct answer to your question is that you can bind the map entries in a destructuring as if they were two-element vectors. (map (fn [[ingr quant]] (* (cost ingr) quant)) (cookbook drink)) Joe On Jul 28, 8:02 pm, Daniel Glauser danglau...@gmail.com wrote: Hello folks, I'm working on some sample code and I have a feeling that there is an easier/more succinct way to code this. Any help or RTFM with a link is appreciated. Given: (def cookbook {:Coffee {:coffee 3, :sugar 1, :cream 1}, :Decaf-Coffee {:decaf 3, :sugar 1, :cream 1}, :Caffe-Late {:espresso 2, :steamed-milk 1}, :Caffe-Americano {:espresso 3}, :Caffe-Moca {:espresso 1, :coco 1, :steamed-milk 1, :cream 1}, :Cappuccino {:espresso 2, :steamed-milk 1, :foamed-milk 1} }) (def cost {:coffee 0.75, :decaf 0.75, :sugar 0.25, :cream 0.25, :steamed-milk 0.35, :foamed-milk 0.35, :espresso 1.00, :cocoa 0.90, :whipped-cream 1.00 }) (def menu {:Coffee 1, :Decaf-Coffee 2, :Caffe-Late 3, :Caffe-Americano 4, :Caffe-Moca 5, :Cappuccino 6 }) I'm trying to write a function to print out the menu listing the cost of each drink. It works (sort of) but I keep thinking there is an easier way. (defn print-menu [menu] (do (println Menu:) (doseq [[drink number] menu] (println (str number , (drink-name drink) , (reduce + (map (fn [map-entry] (* (cost (key map-entry) (val map- entry (cookbook drink Specifically this part: (map (fn [map-entry] (* (cost (key map-entry) (val map-entry (cookbook drink)) Is there a way I can get at the map key and value using destructuring without knowing what the key is ahead of time? Thanks, Daniel -- 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
Senior Software Engineer - Clojure
Looking for a Senior Software Engineer with experience working with Clojure to join a fantastic company in the Boston area. This person will be responsible for designing and developing next generation software for the purpose of delivering mobile content running on a large network of servers. If interested please call me at 617-951-1891. Relocation is offered for this position. -- 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: Idea for personal Clojure project
I think that a big part of the problem is that most approaches to word similarity (especially thesaurus-based approaches like Wordnet, but also the significantly better distributional approaches) use very impoverished representations of knowledge. As such, they are unable to make useful inferences because they lack the underlying representation of knowledge and experience that is necessary for the kind of similarity judgements that people are able to make. I am especially interested in how Gardenfors-style conceptual space modelling can improve the situation, in the context of other NLP techniques. The Cognitive Geography group at UCSB is doing some interesting work, including a Java library for conceptual space modeling. They plan to release it as free software, but it's not done yet. I got an early version of the code from them last year and played with it some in Clojure. I plan to do more with that and see what results I can get. Also, most of NLTK works in Jython*, and by extension in Jython running in Clojure ( which is why I started writing a convenience wrapper to make it easier to use python libraries: http://code.google.com/p/clojure-python/ ). *Actually getting NLTK to work in Jython is kind of problematic presently because you need to modify a few things to allow it to work. I think it's great that there's a Clojure NLP library in the works. If the Clojure NLP libs are better than NLTK then everyone in computational linguistics will switch to Clojure. :) On Thu, Jul 29, 2010 at 9:16 AM, Michael Harrison (goodmike) goodmike...@gmail.com wrote: As others have said, this is a difficult problem, but a fascinating one too. I'm currently nibbling on building some grouping-by- similarity algorithms for Clojure, although I'm sticking to numerical criteria for similarity or distance. New developments in text analysis and the Learning by Reading approach to AI, as described at http://blog.steinberg.org/?p=11 e.g., are making data science an exciting place. If you make some headway, please do share with us. I for one would love to see where you go and contribute if possible. Cheers, Michael On Jul 28, 4:58 pm, Daniel doubleagen...@gmail.com wrote: I want to write a clojure program that searches for similarities of words in the english language and places them in a graph, where the distance between nodes indicates their similarity. I don't mean syntactical similarity. Related contextual meaning is closer to the mark. For instance: fish and reel don't have much similarity, but in the context of fishing they do, so the distance in such a graph wouldn't be very large. I'm sure research has been done in this area (I suspect with no small portion belonging to google), so can anybody point me in the right direction? Thanks. -- 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.comclojure%2bunsubscr...@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: Idea for personal Clojure project
I think that a big part of the problem is that most approaches to word similarity (especially thesaurus-based approaches like Wordnet, but also the significantly better distributional approaches) use very impoverished representations of knowledge. As such, they are unable to make useful inferences because they lack the underlying representation of knowledge and experience that is necessary for the kind of similarity judgements that people are able to make. I am especially interested in how Gardenfors-style conceptual space modelling can improve the situation, in the context of other NLP techniques. The Cognitive Geography group at UCSB is doing some interesting work, including a Java library for conceptual space modeling. They plan to release it as free software, but it's not done yet. I got an early version of the code from them last year and played with it some in Clojure. I plan to do more with that and see what results I can get. Also, most of NLTK works in Jython*, and by extension in Jython running in Clojure ( which is why I started writing a convenience wrapper to make it easier to use python libraries: http://code.google.com/p/clojure-python/ ). *Actually getting NLTK to work in Jython is kind of problematic presently because you need to modify a few things to allow it to work. I think it's great that there's a Clojure NLP library in the works. If the Clojure NLP libs are better than NLTK then everyone in computational linguistics will switch to Clojure. :) On Thu, Jul 29, 2010 at 9:16 AM, Michael Harrison (goodmike) goodmike...@gmail.com wrote: As others have said, this is a difficult problem, but a fascinating one too. I'm currently nibbling on building some grouping-by- similarity algorithms for Clojure, although I'm sticking to numerical criteria for similarity or distance. New developments in text analysis and the Learning by Reading approach to AI, as described at http://blog.steinberg.org/?p=11 e.g., are making data science an exciting place. If you make some headway, please do share with us. I for one would love to see where you go and contribute if possible. Cheers, Michael On Jul 28, 4:58 pm, Daniel doubleagen...@gmail.com wrote: I want to write a clojure program that searches for similarities of words in the english language and places them in a graph, where the distance between nodes indicates their similarity. I don't mean syntactical similarity. Related contextual meaning is closer to the mark. For instance: fish and reel don't have much similarity, but in the context of fishing they do, so the distance in such a graph wouldn't be very large. I'm sure research has been done in this area (I suspect with no small portion belonging to google), so can anybody point me in the right direction? Thanks. -- 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.comclojure%2bunsubscr...@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: Feedback on Clojure web development post
On Jul 28, 2:23 pm, Avram aav...@me.com wrote: Hello Mark, Your post was fantastic and very well-written. Thank-you for posting it! Hi Avram, thanks for the feedback. A few thoughts: - Perhaps adding dynamic graphs from Incanter to the project with might make a good follow-up post ? There are several follow up posts planned, but I probably won't cover this since it is addressed here: http://data-sorcery.org/2009/11/29/incanter-webapp/ - Is there a reason why you preferred EC2 tools over the elastic- mapreduce executable or clojure calls of the java ( seehttp://developer.amazonwebservices.com/connect/entry.jspa?externalID=...) ? - What are your thoughts on clojure handling the initial EC2 set up and launching of the node instances as well? Programatic deployment via Clojure is definitely possible, but for this simple example the command line tools work well enough I think. - Does it seem like creating a UI for editing and launching code for Apache Hive, Pig, or Cascalog seems within reach with this kind of set up ? That's a rather harder problem (: I won't be working on it, but let us know if you end up doing something like that yourself. - Mark Regards, ~Avram On Jul 24, 12:30 am, Mark McGranaghan mmcgr...@gmail.com wrote: Hi All, I recently posted to my blog on the process of developing and deploying a simple Clojure web application: http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applica... The purpose of this post is twofold. The first is to provide some documentation in the form of a complete, deployable Clojure web app and associated commentary and instructions. To that end I hope you find the post useful and that you feel free to ask any questions you may have. The second purpose is to elicit feedback from the community on how they would or have approached the problem of developing and deploying Clojure web applications. I'm particularly interested in the specifics of how people tie together and round out entire apps with e.g. logging and exception handling, how they develop apps locally, and how they deploy them to production. I think the most useful basis for discussing things like this is complete working examples of applications and associated instructions for how to deploy them. I doubt there are very many such open-source apps floating around, but if anyone has one to share I would love to see it. Even if you don't have a complete app to share, I would love to hear your comments and see your code snippets on the specific aspects of the development and deployment process that I covered (or perhaps omitted) in the post. - Mark -- 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
Clojure servlet in tomcat - issues with -security option
Hi, I am creating a little servlet to use in with tomcat, but have issues with tomcat -security. I am a beginner in this field and have started with a bare metals servlet written in java that loads a tiny little *hello world script in clj. I use clojure.lang.RT.loadResourceScript to load the script from java, and then continue in clj. It worked fine under windows where i had downloaded tomcat and just started it from the command line. Now that i have moved to my production environment, ubuntu 9.10 with Tomcat6 I get errors SEVERE: Allocate exception for servlet CljServlet javax.servlet.UnavailableException: Error loading clj: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader) at CljServlet.init(CljServlet.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) tomcat is running with -security option and I think the issue has to do with the sandbox/java security manager that will not accept the things that clojure does (the example applications provided with tomcat works well enough) I think i have read of others using Tomcat, what do you others do? Do you ignore the -security option to tomcat, or have you created java security policies that handle clojure? Thanks regards Soren -- 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: Rincanter problem
Joel helped me figure it out: http://joelboehland.com/posts/all-your-datasets-r-belong-to-us.html#comment-65157543 On Jul 29, 6:55 am, Dave david.dreisigme...@gmail.com wrote: I can't get Rincanter to install. I get the message: Unable to resolve artifact: Missing: -- 1) org.incanter:incanter-full:jar:1.2.0-SNAPSHOT Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.incanter - DartifactId=incanter-full -Dversion=1.0-master-SNAPSHOT - Dpackaging=jar -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.incanter - DartifactId=incanter-full -Dversion=1.0-master-SNAPSHOT - Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] Path to dependency: 1) org.apache.maven:super-pom:jar:2.0 2) org.incanter:incanter-full:jar:1.0-master-SNAPSHOT -- 1 required artifact is missing. for artifact: org.apache.maven:super-pom:jar:2.0 from the specified remote repositories: clojure (http://build.clojure.org/releases), clojars (http://clojars.org/repo/), clojure-snapshots (http://build.clojure.org/snapshots), central (http://repo1.maven.org/maven2) -- 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: Idea for personal Clojure project
On Thu, 2010-07-29 at 10:11 -0400, rob levy wrote: Also, most of NLTK works in Jython*, and by extension in Jython running in Clojure ( which is why I started writing a convenience wrapper to make it easier to use python libraries: http://code.google.com/p/clojure-python/ ). *Actually getting NLTK to work in Jython is kind of problematic presently because you need to modify a few things to allow it to work. I think it's great that there's a Clojure NLP library in the works. If the Clojure NLP libs are better than NLTK then everyone in computational linguistics will switch to Clojure. :) I would totally jump on board with this. I am pretty much unknown in all of the open source communities, and I am not necessarily *good* at NLP, but it fascinates me, I study it on my own, and every now and then I try to hack an application that actually does something with it. And some recent projects at my office have given me an opportunity to start learning more of the theory behind machine learning in general. -- Savanni -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure servlet in tomcat - issues with -security option
Dynamic compilation and loading of java bytecode is not possible in sandbox mode. You may try to AOT-compile your clojure code and use gen-class to generate servlet instead of invoking clojure from java. See http://clojure.org/compilation -- Mikhail -- 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
VimClojure 2.2.0 snapshot missing?
Is there some reason the 2.2.0-SNAPSHOT's of vimclojure have vanished from Clojars? I have the 2.2.0 vim pieces in my .vim directory and the nailgun commands blow up when using the jar of nails from the 2.1.2 release :( Would be hesitant to spend half an hour to clean out the 2.2.0 snapshot of the vim files and install 2.1.2 if I didn't have to, since although I was able to manually install the snapshot, I'd prefer to let Lein do it's thing. -Kyle -- 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
defrecord and map equality?
Hi all, I noticed (with a very recent git pull) the following asymmetric behavior regarding = and records: (defrecord my-record [a]) (def r (new my-record 1)) (def s (new my-record 1)) (= r s);; true (= s r);; true (= r {:a 1}) ;; false (= {:a 1} r) ;; true Is this intentional? (I hope not) Also, what prompted this was my trying to do the following. In general, what kind of behavior should we expect to see when mixing records and other map types? (replace {{:a 1} (new my-record 2)} [(new my-record 1)]) Currently this produces [#:user.my-record{:a 1}], where I was hoping to get [#:user.my-record{:a 2}] -- 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
Leiningen and loading hooks
I discovered a problem in Leiningen 1.2.0 that I am debating how to fix in 1.2.1. The gist is that it searches the whole classpath for all namespaces matching leiningen.hooks.*, and this is very slow for large classpaths. It can add several seconds to the Leiningen boot time. I'm contemplating a fix to this that would require hooks to be declared in project.clj in order for them to be loaded. This is a good idea for reasons other than just boot time, but it is a breaking change. I'd like to gauge how many people would be affected by such a change. Auto-loading hooks is a pretty new feature, so if I can fix the performance issues with it before its use is widespread that might be nice. But if a lot of people are relying on implicit loading, then I will be more cautious. Please let me know. thanks, 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
Re: Leiningen and loading hooks
On Jul 30, 2010, at 6:07 , Phil Hagelberg wrote: I discovered a problem in Leiningen 1.2.0 that I am debating how to fix in 1.2.1. The gist is that it searches the whole classpath for all namespaces matching leiningen.hooks.*, and this is very slow for large classpaths. It can add several seconds to the Leiningen boot time. I'm contemplating a fix to this that would require hooks to be declared in project.clj in order for them to be loaded. This is a good idea for reasons other than just boot time, but it is a breaking change. I'd like to gauge how many people would be affected by such a change. Auto-loading hooks is a pretty new feature, so if I can fix the performance issues with it before its use is widespread that might be nice. But if a lot of people are relying on implicit loading, then I will be more cautious. Please let me know. My suggestion would be make a project.clj tag like :hook-cps which holds all classpathes checked for hooks and one :implict-hooks true that would turn back old behavior - that said I'm not 'hurt' by any chance since I've no project that uses them :P Regards, Heinz -- 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