Fork me on GitHub
#beginners
<
2021-12-30
>
reactor04:12:23

Hello everyone, noob alert 😬 What is the best book for someone who has done object oriented programming all of his life till now and now has to work in a clojure project. I want understand all from its basic in easy terminology.

bg05:12:10

Brave Clojure is a great book for all types of beginners.

reactor05:12:17

Do you mean "Clojure for brave and true"?

Cora (she/her)05:12:27

Getting Clojure

1
Cora (she/her)05:12:39

by far the best one for getting up to speed, imo

1
bg06:12:35

I haven’t read Getting Clojure but Russ Olsen is an excellent author.

bg06:12:42

However, the “best book” for any topic depends on the reader. I would suggest reading a few and sticking to the one that resonates the most.

Ben Sless06:12:33

Besides books, the official docs in Clojure's website are very good, and there are some early talks by Rich which really help "getting it"

💯 1
grierson09:12:34

"Grokking Simplicity" by Eric Normand and "Data-Oriented Programming" by Yehonathan Sharvit, both do a great job of going over the fundamental functional concepts without being language specific. "Clojure for the brave and true" is still a great book for beginner Clojure.

practicalli-johnny10:12:45

https://practical.li/ has free books and videos to help learn and practice Clojure. Working through the 4Ever Clojure challenges is an excellent way to understand the core functions in Clojure. Try to get comfortable with REPL driven development approach, it will make learning Clojure a lot faster.

Nik11:12:05

Hey, I'm building dead simple slot booking system for 1 event. Scale is about ~100 people. I need advice for database and deployment options. I was considering firebase for db and heroku for deployment. The cheaper the price and effortless the usage the better.

emccue14:12:23

just use heroku and heroku postgres

1
emccue14:12:41

one platform, probably at free tier

Dmitrii Pisarenko14:12:53

Hi! I've created a simple Reagent project which I want to use in this way: 1. I have some data objects (a bunch of nested maps and lists) which I edit in my favorite text editor. 2. These data are then rendered using ClojureScript/Reagent. 3. The data won't be changed by the UI. There are three subdirectories in https://github.com/mentiflectax/hello-reagent/tree/master/src: 1. clj 2. cljc 3. cljs I assume that clj contains the server code, and cljs the client code (please correct me if I'm wrong). Question: Into which of these directories should I put my data object in order to be able to display it with Reagent in browser?

athomasoriginal15:12:12

Cljs sounds right. Unless you did want to share the data with front/back, in this case cljc.

jkrasnay15:12:02

It’s also OK to mix your clj/cljc/cljs files under a single source tree. The Clojure and ClojureScript compilers will just ignore the code for the other side. Organizing this way can sometimes simplify your use of shared code/data.

phronmophobic15:12:22

I would put the data either under resources or in its own directory.

1
rmxm20:12:28

trying to mock a function out with, with-redefs - seems that, when I run a future, my redefs no longer apply, docs says its redefined for all threads, but future that was spawned inside the block seems to ignore it

Darin Douglass20:12:54

are you blocking on that future? it’s likely your future doesn’t fully complete until after you dropped out of the with-redefs block

rmxm20:12:42

no dereferencing of the future

Darin Douglass20:12:07

notice the following results:

user> (defn foo [] 1)
 #'user/foo
 user> (with-redefs [foo (constantly 42)]
         (future
           (Thread/sleep 100)
           (prn (+ (foo) 1))))
 #<Future@49e738f5: :pending>2
 user> (with-redefs [foo (constantly 42)]
         @(future
           (Thread/sleep 100)
           (prn (+ (foo) 1))))
 43
 nil
 user>

rmxm20:12:53

(defn z [] 42)
(with-redefs [z (constantly 41)]
  (prn (z))
  (future (prn (z))))
> 41 > 42

Darin Douglass20:12:42

yep. when dealing with with-redefs you have to make sure all work is done before you drop out of the form. otherwise you’re going to run into what you’re seeing

rmxm21:12:01

what do you mean.... ohh so i leave the form and then the future gets created... i see

rmxm21:12:40

so if i dereference the future, should be alright?

Darin Douglass21:12:10

yes, that’s one way to do it; though i’d say try to not deal with concurrency + with-redefs because it can get hairy

Darin Douglass21:12:21

maye rethink why you need a future in the first place

rmxm21:12:57

its for one-off task, but the task has io inside, the problem only exists within tests

rmxm21:12:48

yes, that helped 🙂 thanks a lot @U02EA2T7FEH