Fork me on GitHub
#beginners
<
2016-09-22
>
johnnyillinois04:09:08

Anyone using ring + embedded jetty? I am looking for a clean way to use the same environment variables to configure both ring and jetty

vinnyataide15:09:26

I think that if you use async operations all the way yada will fit you best

vinnyataide15:09:43

since it uses aleph that's async

rusua16:09:45

I'm learning core.async, and I have one question, just got to the documentation on alt! macro...

(alt!
  [c t] ([val ch] (foo ch val))
  x ([v] v)
  [[out val]] :wrote
  :default 42)
What does the x ([v] v) mean? Does it mean that we are binding the [value channel] to v and just returning v as a vector [value channel]? how's that different from, for instance, the first example (where we bind and later execute (foo ...)? Thanks! my first question in Clojurians... :)

mss20:09:23

when using map, is there a way to return nothing from an iteration, opposed to a nil?

mss20:09:28

so in the following code:

mss20:09:35

(map #(try
          (if (= % 1)
            (throw (Exception. "exception!"))
            %)
          (catch Exception e
            (log/error e "ERROR!")))
     [3 2 1])

mss20:09:52

the result would be (3 2) as opposed to (3 2 1)

bolivier20:09:05

You don’t want to use map for that

bolivier20:09:22

map is for when the cardinality of the sequence isn’t going to change

bolivier20:09:30

you want either filter or reduce

bolivier20:09:44

I’m relatively new to clojure still, so I’m not totally confident in those function names 😜

mss20:09:56

ah interesting didn’t realize that was an implicit assumption using map

adamkowalski20:09:02

Can anybody recommend an editor which works well for clojure as well as php and javascript? I am currently using emacs which is great for clojure but a little less so for php and js in my opinion.

bolivier20:09:36

ymmv, but emacs is fantastic for js

adamkowalski20:09:38

I was thinking about trying atom again with the proto repl, but Im curious if things have changed since last time I looked around

bolivier20:09:42

I use it professionally with js2-mode

bolivier20:09:57

only person in my office, but it’s 10x better than intellij for it imo

bolivier20:09:20

js2-mode has a minor mode called js2-jsx-mode that works with react, if that’s what you’re doing (it’s what I do)

adamkowalski20:09:24

did you set it up to work well with eslint, es6, and jsx

bolivier20:09:44

what major mode are you using for js?

bolivier20:09:52

(I can’t speak to what works well with php)

madstap20:09:22

@mss The result of your snippet will be (3 2 nil). Take a look a keep which is like map, but discards nil results.

madstap20:09:39

(keep #(try
         (if (= % 1)
           (throw (Exception. "exception!"))
           %)
         (catch Exception e
           (println e "ERROR!")))
      [3 2 1])
;;=> (3 2)

mss20:09:03

thanks for the tip @madstap