Clojurians
#beginners
<
2016-01-25
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

tmtwd02:01:43

(defn query-stores [product stores]
  (let 
    [futures (doall  (for [store stores]
                       (future (query store product))))]
  (map deref futures)))
if calling deref on futures means that it blocks, why call future on this process at all? isn’t the point of future so the task will be non-blocking?

donaldball02:01:23

It would appear to be used to achieve concurrency here, though it’s not the cleanest way of achieving the desired result, probably.

donaldball02:01:34

for returns a lazy seq of futures. map also returns a lazy seq, so whoever begins to realize the result will probably cause chunks of 16 futures to be executed concurrently.

donaldball02:01:04

Oh, sorry, missed the doall, that fixes the chunking problem

udit08:01:22

Hey guys I am trying to write a Slack integration using Clojure. However I am running into problems while creating a websocket client. I tried using gniazdo but that doesnt work with the ring webapp. Any suggestions?

surreal.analysis13:01:28

@udit: I've found http-kit to be the simplest to get up and running with

surreal.analysis13:01:33

And it's ring compatible

udit13:01:18

@surreal.analysis: Thanks! I did go though the http-kit library, but it doesnt seem to have support for creating a websocket client, right?

udit14:01:34

@surreal.analysis: Thanks a bunch!

surreal.analysis14:01:57

You're welcome! There are a few other options under websockets here: http://www.clojure-toolbox.com/ but http-kit should be sufficient / lightweight

jeff.engebretsen17:01:20

I like that. It gets away from the thought that 'I can't ever change this' to 'I can't override what's already there'

martinklepsch18:01:56

@ghadi: that observation originates from a ClojureBridge event btw simple_smile

ghadi18:01:16

oh fantastic

martinklepsch18:01:43

funny to see it's made its way around the world hehe

slester19:01:43

Yay for ClojureBridge!

gowder20:01:43

Hi everyone, Can I ask y'all's advice? I'm trying to learn Clojure, and thinking I'm at the point where I should do a couple small projects in it rather than just stick with books. I'm mostly a data person, and my best/main language is Python, but I also have a few little projects I'm trying to start that mostly involve vast amounts of string manipulation, regex, etc. (for example, I'm kicking around various kinds of academic citation parsers). I don't know Java. Does anyone have any tips for which of these projects, either data science-y stuff or messy stuff with strings, would be the best match for moving small projects to clojure? How good is incanter/is there something better? Thanks!

jonahbenton20:01:31

hey @gowder, welcome. The clojure repl is pretty good for messy work with strings, and does not require any familiarity with Java. Some people use a repl workflow with python- if you do, there are many similarities- but if not, definitely worth getting a feel for it, especially if you're constructing a processing pipeline. If you have text that adheres to a context free grammar, the Instaparse project https://github.com/Engelberg/instaparse is pretty unique and amazing, and Antlr is available e.g. https://github.com/aphyr/clj-antlr when necessary.

jonahbenton20:01:34

there is a lot of interesting work in the data + visualization space. incanter is an older project that has a base of active users, but a new notebook-like tool has seen more recent activity: http://gorilla-repl.org/. http://thi.ng labs has been innovating in this space for several years and has a bunch of open source libraries to share: https://medium.com/@thi.ng/workshop-report-building-linked-data-heatmaps-with-clojurescript-thi-ng-102e0581225c#.xirs9i4ip. another interesting new effort is metabase: http://www.metabase.com/

gowder22:01:27

Thank you @jonahbenton! That's a great set of leads.

gowder23:01:38

Wow, instaparse looks really awesome.