Fork me on GitHub
#beginners
<
2017-10-08
>
drewverlee00:10:16

@noisesmith @tbaldridge either of you going to clojure conj? I would like to buy you a round of something for helping me learn clojure and being such good people.

noisesmith00:10:58

I appreciate the sentiment but I won't be there, I did Clojure/West as my paid conference this year

tbaldridge00:10:03

I’ll be there 😀

drewverlee00:10:15

I’ll send you a message at the conj, i got a lot of joy from your clojure videos and would like to thank you in person. Would love to chat a bit about whatever.

Lucas Barbosa00:10:35

Can you guys recommend some nice open source Clojure projects? I want to read some code, especially tests

drewverlee00:10:30

Depends on what your going for, Onyx is a pretty big open source project. I can’t speak for its tests or readability but the authors are both brilliant and helpful.

Lucas Barbosa00:10:29

I will give it a shot! Thanks

Lucas Barbosa00:10:36

I was about to start doing that with compojure, which is something that I have been using while learning Clojure, but I’d like to hear some opinions in order to build a list of stuff to rea

noisesmith00:10:33

the flatland/useful utility library has good code that's readable in small chunks (since it's a utility library)

lovuikeng07:10:30

'funcool' is great reference https://funcool.github.io

athomasoriginal16:10:41

Question about a good way to approach this in Clojure; I was trying to port over a piece of JS that does something like this:

function handle-event = (e) => {
  let wall = false;
  
  if (somethingIsTrue) {
  
    htmlElements.foreach(() => {

      if (somethingElseIsTrue) {
        wall = !wall;
      }

      if (wallIsTrue) {
        // do stuff
      }
      
    }) 
    
  }
}
If I were to port this directly, I believe I run into issues like, I cannot reassign a lexically scoped value. For example,
(let [wall false]
   ;; somewhere here reassign wall)
I believe the above is not possible in Clojure or if it is, not idiomatic. One quick solution was to assign a lexically scoped atom which has a hasmap with a key of wall:
(let [hanlderState (atom {:wall false})]
   ;; somewhere here reassign wall)
Aside from the syntax being wrong in the above, I feel that this is an ugly solution. Which made me think that this is an example of code that should not be ported like this. Flags are very common in JS, but how would this be handled in a more Clojure way?

noisesmith17:10:56

you can use a vector or hash map to represent multiple accumulated states in one reduce

noisesmith17:10:35

(defn handle-event [e] (reduce (fn [wall element] .... (if some-condition wall (not wall))) false html-elements))

sb19:10:37

Hello, what do you think, why did I get 302.. and not logged-in?

sb19:10:12

I would like to create a little monitor app for me (personal) and that isn’t possible with the API.

sb19:10:44

Yes, I checked, but I didn’t get the answer.

noisesmith19:10:54

I linked directly to the answer

noisesmith19:10:11

:redirect-strategy :lax

sb19:10:00

Oh, thanks!!

sb19:10:03

Sorry!!

sb19:10:40

@noisesmith I added the :redirect-strategy :lax to the request but I get still 302.

noisesmith19:10:29

weird - according to the docs that should work

sb19:10:38

yes, I read that.

noisesmith19:10:43

another thing to notice from those docs about your request: > NOTE: The options :force-redirects and :follow-redirects (present in clj-http 2.x are no longer used). You can use :graceful to mostly emulate the old redirect behaviour.

sb19:10:12

I can`t fix it.. I don`t know what is the problem.

noisesmith19:10:30

it's saying that :force-redirects true doesn't do anything any more, but :redirect-strategy :graceful has a similar effect

sb19:10:33

I tried that too.

sb19:10:39

Many combinations..

sb19:10:06

I try with “https://www.linkedin.com/uas/login“.. I saw others use that.

sb20:10:16

I sent wrong params..

sb20:10:25

I do apologize.

rinaldi20:10:06

Is it normal to experience a delay when displaying logs for stuff I'm running in parallel through core.async? (in the REPL, while developing)

rinaldi20:10:31

The final output looks about right but it takes a while to show up on the REPL for me

athomasoriginal20:10:32

@noisesmith I see how you are using the reducer to accumulate states, as a next step, in your example, do we care if the reduce returns anything or are we simply using it as a way to record the state and operate on that inside of the reduce?

athomasoriginal20:10:44

e.g. have reduce return something like [false, false, true, true, true, false] and than reduce over this again, or more

(reduce (fn [wall element]
   ;; do something
   ;; do something else 
   (if some-condition 
       wall 
       (not wall))

sb20:10:35

How to solve with clj-http, if I used cookie-store.. but I got answer like “We’re sorry, there was a problem with your request. Please make sure you have cookies enabled and try again.” or “your browser not supported”

noisesmith21:10:41

@tkjone you can do either one, it depends on what you were attempting. In your original it didn't look like you were tracking all the states, just the most recent, so that's what I showed

noisesmith21:10:22

and no, I'd rarely reduce over the result of another reduce - if you have multiple things to operate on and care about more than one result, you can use a collection holding multiple values and that usually suffices

rinaldi22:10:09

By the way, I figured out that the REPL issue I was seeing with core.async is specific to Cider. Just tested with nREPL using Cursive and everything is fine.