Fork me on GitHub
#beginners
<
2016-12-14
>
agile_geek07:12:56

@roelofw another way of keeping the solutions and their test cases would be to have a (lein) project of them with the solutions in the src namespaces and the tests in the test namespaces written as clojure.test assertions. i.e. (deftest check-solution1 (is (= .....)) ...)

roelofw07:12:51

but thanks for the tip

Aron10:12:38

how do i break up a large clojurescript file into smaller ones?

Aron12:12:54

@pawel.kapala thanks, i got help in #clojurescript since then šŸ™‚

gregnwosu13:12:27

hello im scheduling a task using schejulure, however as it returns a future , my application returns the future and quits how can i get my application to wait indefinitely?

gregnwosu13:12:48

i would prefer to avoid infinite loops

rauh13:12:51

@gregnwosu A normal future will wait until the tasks are finished. The lib you use doesn't use them. I looks like you can't use that library for that kind of behaviour

gregnwosu13:12:18

it must work somehow , theres no point in a scheduling library that returns a future and exits

dominicm14:12:55

@gregnwosu @(promise) blocks the current thread forever.

dominicm14:12:38

That library operates independently of the lifetime of the main thread. It doesn't concern itself with the complex daemon/non-daemon split. There is defining behaviour for this somewhere in the JVM

gregnwosu14:12:15

can you say that again , perhaps in simpler language for less intelligent people such as myself

dominicm14:12:24

The JVM is a bit confusing in how it does threads. The search term you need is about daemon threads vs non-daemon threads, stack overflow probably has a good discussion on the two

dhruv115:12:21

@val_waeselynck thank you. iā€™ll have a look soon

fabrao15:12:33

Hello all, I have to confess, I'm reduce addicted. I left map, doseq or other thing to process map, array or something else. What is the impact using reduce instead of map or doseq?

donaldball16:12:59

reduce is eager, while map is lazy

donaldball16:12:14

reduce returns a result, while doseq is for side effects only

fabrao16:12:04

so, map is better?

donaldball16:12:10

When Iā€™m not sure the right seq traversing form to use, Iā€™ll reach for reduce or reduce-kv first

donaldball16:12:16

ĀÆ\(惄)/ĀÆ

donaldball16:12:28

Depends on if you want laziness or not

fabrao16:12:59

well, I want performance

poooogles16:12:08

don't we all šŸ˜†

donaldball16:12:54

The reduce forms are a good first stop, though nowadays applying a transducer might be better. Reducers might be a good next step if your fold doesnā€™t care about order.

poooogles16:12:32

might be of interest for you

fabrao16:12:28

thanks dude

mlev16:12:28

For a Ring app, I had the following ns declaration: `(ns ring-app.core (:require [ring.adapter.jetty :as jetty] [ring.util.http-response :as response] [ring.middleware.reload :refer [wrap-reload]] [ring.middleware.format :refer [wrap-restful-format]]))`

mlev16:12:40

Nevermind, I needed to restart the application with lein run to get it working properly.

gdeer8116:12:43

@mlev I know that feeling. I had the same thing happen to me last night.

mlev16:12:43

@gdeer81 , thanks šŸ™‚ The Web Dev with Clojure book adds dependencies to many projects incrementally to teach different web dev techniques, so I'll probably be using lein run and cider-restart a few more times...

mlev16:12:41

Great book so far.

gdeer8116:12:00

@mlev yeah my issue was kind of weird because I added ring mock to my dependencies so I could write my tests and when I refreshed my browser it was complaining it couldn't find ring mock. I was like "okay my main app doesn't use mocks but I'll go ahead and restart my server and see if that fixes it" and of course it did

agile_geek16:12:52

@gdeer81 I guess you know if you're using leiningen you can just add your test dependencies to the :dev profile and therefore not have them on the main app's classpath?

gdeer8116:12:06

@agile_geek I swear that's what I did. :profiles {:dev {:dependencies [[ring/ring-mock "0.3.0"]]}}

gdeer8116:12:49

then again, I probably was in dev mode

agile_geek16:12:25

Also if you are using CIDER and clj-refactor (which I think comes bundled with latest versions of CIDER) you can hot reload dependencies into a running server

gdeer8117:12:39

the good thing about my dicey workflow is that it breaks around the time I need to step away from the computer anyway.

gdeer8118:12:58

Design opinion request: Jack and Jill have a collection of maps and they want to give them to you. You want to remember the source so do you give Jack and Jill a key in your map or store their maps in a list with the keywords changed to name/keyword?

gdeer8118:12:15

Or break the maps into datoms stored in a set and have a poor man's datomic?

gdeer8118:12:08

Then I can use core.logic and swat this fly with a sledgehammer

jjfine18:12:15

might be helpful to write the code that will use those maps first

gdeer8118:12:10

Yeah I think my code will be more general with nested maps

mlev19:12:24

Does it have to do with the fact that the CIDER repl is not defaulting to the APPNAME.core> prompt, so perhaps its in the wrong namespace?

mlev19:12:08

Curiously, though, it does produce "Hello, World" when I put (selmer.parser/render "Hello, {{name}}" {:name "World"}) in the repl...

mlev19:12:57

In case anyone is interested, it turns out it was a namespace issue: With @dpsutton 's help, I ran the following from within the APPNAME.core.clj file: C-u C-c M-z and it autoloaded the correct namespace into the repl. Then running (selmer/render "Hello, {{name}}" {:name "World"}) from the repl worked perfectly.

dhruv120:12:12

how do i fix this issue? Failed context type: Required context 'muiTheme' was not specified in 'RadioButton'

dhruv120:12:00

here is what my code looks like `

dhruv120:12:25

[radio-button {:value          "sadder"
                  :label          "sad"
                  :class-name     ā€œcol-xs-4ā€}]

dhruv120:12:43

(def radio-button (reagent/adapt-react-class (aget js/MaterialUI ā€œRadioButtonā€)))