[ANN] Another one implementation of JSR 223 (Java Scripting API) for Clojure
Here is a link: https://github.com/overshinin/clojure-jsr223 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help with async operations
Hi Rangel, thanks! works perfectly! понедельник, 18 мая 2015 г., 4:07:53 UTC+6 пользователь Rangel Spasov написал: You can checkout the new pipeline stuff, I think it fits what you're looking for nicely: https://gist.github.com/raspasov/7c9d8f2872d6065b2145 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Help with async operations
Hi Atamert, воскресенье, 17 мая 2015 г., 19:35:57 UTC+6 пользователь Atamert Ölçgen написал: I’m new to Clojure async operations (while have a good understanding of other things) and want to get a bit of advice. Atoms agents still confuse me. What I’m implementing is a small REST webservice with custom in-memory database. Database is indexed by unique key, basically it’s a map (I’ll denote it as MAP). There are two basic operations: *PUT /api/…/KEY.* Initiate an update for given KEY. The HTTP response should be returned immediately, and the processing should be done asynchronously. The processing consists of downloading a data file from web and doing some data crunching, the result should go into MAP. *GET /api/…/KEY.* Use (get MAP KEY) and request params to generate response synchronously. The tricky part (well, for me :) is that parallel PUT requests should be possible. The downloading and processing can and should go in parallel, independently, whereas updating the MAP should come synchronized, one-after-the-other. How would you implement this? While this can be done with atoms agents, perhaps you should check out core.async or Lamina first. Neither atoms nor agents can be updated in a parallel manner. Only one update runs on a single atom/agent at a given time. If you really need parallelism and the updates affect small parts of MAP, perhaps you can model it using refs, but then it's not one big map anymore. (Still you can't update a single ref in more than one thread at the same time.) You probably also want to control how the files are downloaded and processed, so that there's not duplication of effort. So an event driven solution seems to fit this problem. In fact, I don't use the MAP as a whole, each read/update operation is scoped by KEY. So a map of refs sounds good. Speaking of event driven solution and core.async. I came up with the following scheme: [PUT request handler] processing queue channel Download/process update queue channel [updating the MAP]. *[updating the MAP]* is basically a (go ...) block which does synchronous updates. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Help with async operations
Hi, I’m new to Clojure async operations (while have a good understanding of other things) and want to get a bit of advice. Atoms agents still confuse me. What I’m implementing is a small REST webservice with custom in-memory database. Database is indexed by unique key, basically it’s a map (I’ll denote it as MAP). There are two basic operations: *PUT /api/…/KEY.* Initiate an update for given KEY. The HTTP response should be returned immediately, and the processing should be done asynchronously. The processing consists of downloading a data file from web and doing some data crunching, the result should go into MAP. *GET /api/…/KEY.* Use (get MAP KEY) and request params to generate response synchronously. The tricky part (well, for me :) is that parallel PUT requests should be possible. The downloading and processing can and should go in parallel, independently, whereas updating the MAP should come synchronized, one-after-the-other. How would you implement this? -- Oleg. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Compile multiple files in Emacs (interactive development)
Hello Guys! Does somebody knows better way to compile all files of my project in proper order in emacs after i've changed my working directory to project base and after command 'M-x slime'? I'm developing compojure application and now i have to reload all my project files (about 10) in emacs and click C-c C-k to compile every of them. It's boring, especially if my project will grow. Is there a better solution? Cheers, Oleg -- 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: State of Clojure web development
1) Sure. I'm preparing financial and operational data analyzer now for corporate usage. Some kind of BI/EPM application for specific needs. 2) Usually bleeding-edge or latest releases of following libraries: - Compojure (thanks James for your great work) - Hiccup - Ring - Oyako (thanks Brian for your ideas) - scriptjure (want to replace my js with this generator) 3) Interactive development, fresh and fun to work with, hiccup-style html generation. 4) Debugging in emacs with breakpoints and steps, better documentation on some libraries, add record validation support in oyako. I think that we need better persistency solution, as for me oyako could be great base for it. 5) Thank you guys, for your work on making clojure better - Oleg On 24 июн, 01:23, James Reeves weavejes...@googlemail.com wrote: Hello there! Chas Emerick's recent State of Clojure survey [http://bit.ly/dtdAwb] indicated that a significant proportion of Clojure users are beginning to use Clojure for web development. A recent Hacker News posting [http://bit.ly/91Bu5J] seems to corroborate these results, with several Clojure-based web applications already out in the wild. As one of the main developers of Ring and Compojure, I'd be very interested to hear more about how people are using Clojure to build web apps. To this end, I have a few questions I'd like to quiz Clojure web developers about: 1. Have you written, or are you writing, a web application that uses Clojure? What does it do? 2. Which libraries or frameworks are you using? Which versions? 3. What made you choose Clojure to develop web applications in? What are the strengths of Clojure web development? 4. What do you think are the current weaknesses of web development in Clojure? What could be improved? 5. Anything else you want to comment on? Please reply to this thread with your answers, and thank you very much in advance for your time. I really appreciate any feedback you can provide. - James -- 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: Conjure / Compojure Docs etc
Dear John! I think that a lot of interesting about Compojure most used clojure web development library you can find there: http://weavejester.github.com/compojure/ See also http://github.com/briancarper/cow-blog this beautiful project from Brian Carper, which shows many interesting clojure and compojure development tricks. - Oleg On 28 июн, 00:56, john.holland jbholl...@gmail.com wrote: I've seen a lot of mentions of Compojure on the group. I found the documentation a little lacking. Am I missing something obvious? Also, Conjure (sort of Rails done in Clojure) seems very nice, is well documented, etc. But I don't see any mention of it. Is there any reason for it not to be popular? -- 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
Map vs For
I will show example based on hiccup library: For version: [:ol (for [x coll] [:li x])] Map version: [:ol (map (fn [x] [:li x]) coll)] What's the difference between them? What is better for performance? Cheers, Oleg -- 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: Non-tail recursion (Clojure way to hierarchies)
I've looked at tree-seq and can say that is not suitable for non-tail children tasks. For example how can i attach subtotal row to bottom of each level. Any ideas? On 13 июн, 16:35, Andrzej ndrwr...@googlemail.com wrote: On Sun, Jun 13, 2010 at 7:35 PM, Oleg oleg.richa...@gmail.com wrote: Currently i'm just calling function, but there is a danger of StackOverflow. I can't use recur, because it's not last statement. As i can understand recur is good to build long sequences, but in my case i'm building hierarchy. Two potential solutions: 1. Build a lazy hierarchy, i.e. instead of returning a nested structure, return a function that produces it. It might be better to use a built-in function tree-seq though (check the implementation of file-seq and xml-seq). 2. If everything else fails use a trampolinehttp://groups.google.com/group/clojure/browse_frm/thread/6257cbc4454b... Cheers, Andrzej -- 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
Non-tail recursion (Clojure way to hierarchies)
Hello Guys! Here is the task: Assume that we have function called `fetch-from-source`, which used to fetch vector of maps from the data source. I want to make iteration on every fetched row (element of vector) and ask `fetch-from-source` again to add 'children' key to that row. And so on, until given depth. So i want to use map function on collection from some function `expand- groups`, which will call the same function `expand-groups` on every collection element to assign children on it. Keep in mind, that the map function is not last in my function, because i have to append one more row to mapped collection. Currently i'm just calling function, but there is a danger of StackOverflow. I can't use recur, because it's not last statement. As i can understand recur is good to build long sequences, but in my case i'm building hierarchy. What do you think guys? Is there are clojure-rish way to solve that problem? Cheers, Oleg -- 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: Non-tail recursion (Clojure way to hierarchies)
Thank you, but could you provide me a little code snippet which will iterate through collection and assoc children key for each row. On 13 июн, 16:35, Andrzej ndrwr...@googlemail.com wrote: On Sun, Jun 13, 2010 at 7:35 PM, Oleg oleg.richa...@gmail.com wrote: Currently i'm just calling function, but there is a danger of StackOverflow. I can't use recur, because it's not last statement. As i can understand recur is good to build long sequences, but in my case i'm building hierarchy. Two potential solutions: 1. Build a lazy hierarchy, i.e. instead of returning a nested structure, return a function that produces it. It might be better to use a built-in function tree-seq though (check the implementation of file-seq and xml-seq). 2. If everything else fails use a trampolinehttp://groups.google.com/group/clojure/browse_frm/thread/6257cbc4454b... Cheers, Andrzej -- 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: M-X slime
Hello! Thank you. It was just not fully downloaded clojure 1.2 I've asked lein to update all deps again and now it works. On 28 май, 04:10, Joost jo...@zeekat.nl wrote: On May 27, 8:24 pm, Oleg oleg.richa...@gmail.com wrote: Hello Guys! Yes, i know that i can run lein swank in my project directory and then use M-X + slime-connect in emacs. But all the time with clojure 1.1.0 i used this procedure: M-X cd to project directory and them just M-X slime (classpath is set relative to current emacs dir, so it finds swank-clojure.jar in lib directory). I feel myself very comfortable with that sequence and don't want to change it. Can somebody help me to make my M-X + slime works again, because i don't want to have additional step with lein swank in console. As far as I know, as long as you've got some command that starts a REPL and has the swank code in its path, you can use it as swank- clojure-binary. I did a blog post about that some months ago:http://joost.zeekat.nl/2009/12/03/choosing-your-clojure-startup-scrip... -- 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
Elegant way to replace a few words in string
Hello Guys! I have a string for example Foo12 Bar130 Qoo20 and map like this {Foo XF Bar XB Qoo XQ}. I want get: XF12 XB130 XQ20 I want to replace words in string based on map association. What is the elegant way to do it? Sure, i can use loop and recur to make string enter the next replacement, but is there another way to do it better? Cheers, Oleg -- 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
M-X slime
Hello Guys! Yes, i know that i can run lein swank in my project directory and then use M-X + slime-connect in emacs. But all the time with clojure 1.1.0 i used this procedure: M-X cd to project directory and them just M-X slime (classpath is set relative to current emacs dir, so it finds swank-clojure.jar in lib directory). I feel myself very comfortable with that sequence and don't want to change it. Can somebody help me to make my M-X + slime works again, because i don't want to have additional step with lein swank in console. -- 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: Processing list more elegantly
On 28 дек, 05:36, Conrad drc...@gmail.com wrote: I've been writing Clojure code today and have noticed the same pattern show up multiple times, but can't find an elegant way to code it in idiomatic Clojure. I feel like I'm missing an obvious solution... anyone else see something I don't? Thanks in advance! The problem boils down to the following minimal example: Suppose you want to write a function left-total which takes a list of number and returns pairs of said numbers, along with the total of numbers to the left: = (left-total [3 5 10 1 2 7]) ([3 0] [5 3] [10 8] [1 18] [2 19] [7 21]) what about: (defn left-total [s] (reverse (reduce (fn [y x] (cons (list x (reduce + (first y))) y)) () s))) user (left-total [3 5 10 1 2 7]) ((3 0) (5 3) (10 8) (1 18) (2 19) (7 21)) -- 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