Fork me on GitHub

Hello, guys 🙂


Could someone give me a hint where I can find interview questions on jun-mid position ?


(Senior's will fit too, though. Not mind to scary myself a little bit)


Hi guys, I spent some time over last weekend building my first little project in ClojureScript, with the motivation of trying out as much things as a could. I built a Pong game in 3D using three.js:, which is copied from this tutorial: but ported to cljs. Here's the current code and possible plans for the future: I know this is a big thing to ask, but if anyone have the time to check out the code and give me a quick, short review, it would be highly appreciated. I'm looking for big picture stuff: comments on code organization, best practices, possible bad habits I'll be having, more functional approaches to solve things, etc. Anyway, feel free to play the game a little bit and have fun with it, although right now the opponent is way easy to beat 🙂


@brownmoose3q: Not sure what you’re looking for… are you assuming companies that hire Clojure devs have standard "quiz" type tech questions about Clojure? I doubt that’s true.


A lot of companies now realize that "tech quizzes" don’t really work in interviews.


When we hire at World Singles, we don’t have a "tech quiz". Instead we generally work from a mind map that covers a broad set of areas that we want to get a candidate talking about. We want to hear what gets them excited about projects, what they dislike about projects, how they work on a day-to-day basis (their design, test, code workflows). We ask about what they like and dislike about their current technology stack and if/why they’d want to use a different stack.


If you want to show someone you can solve Clojure problems, do puzzles and get a ranking there 🙂


I'm trying to wrap my head around something with the immutable nature of stored values. What is the best approach for something like looping over items in a list and adding them up within function, e.g:

  (dotimes [x (count lst)]
    logic here? ))


Where lst is something like '(1 3 14 2 9 3 5)


(apply + '(1 3 14 2 9 3 5))


map is also a good way to apply a function to every member of a list


depending on the use case


What if I wanted to sum odd numbers only?


e.g. 1 + 3 +9 + 3 + 5


(apply + (filter odd? numbers))


The general pattern of iterating over a list (like in an imperative for loop) usually comes down to map filter and reduce and mixing them up together in a functional language


+ is a kind of reduce in this case, you can think of it as iterating over the list and making a new thing by applying a function to some final value (the sum so far) and some current value (the item we’re looking at right now). reduce is used on a list when you want to change the shape of a structure (in this case, from a list of numbers to just one number). map is used when you want to keep items in the same kind of structure, but want to change each one (like if you wanted to turn a list of user ids into a list of usernames, maybe). filter is used when you want to keep only some of the items in that structure (like if you want a new list with only odd numbers).


I'm starting to love FP and Clojure 🙂


🙂 it is pretty sweet, for sure


So I'm testing this (fn[lst] (println (apply + (filter odd? lst)))) and it outputs a number (the correct number) followed by a nil


Any idea why/where the nil is coming from?


println actually is returning nil


Been using println through all the previous tests and this is the first time nil is displaying


Took the println part out and just used (fn[lst] (apply + (filter odd? lst)))


Cool, that’ll do it.


No problem, have fun on your Clojure journey!


is there a quick function for returning filtered items from a lazy-seq with their original index?


or just the index values?


@dmbennett: check out keep-indexed


i wonder if i’ll ever stop being surprised by the depth of the core functions


@dmbennett: or, perhaps, map-indexed


both of those take an index, but don’t return the index position. I just want to return the index position


@dmbennett i think what dorab is suggesting is something along these lines

(map first (filter (fn [[_ x]] (odd? x)) (map-indexed vector '(1 2 3 4 5))))


There is usually a better way than the ones I think of, but that’s how I would try 🙂


@dmbennett a for comprehension is probably better in this case actually

(for [[index item] (map-indexed vector '(1 2 3 4 5))
      :when (odd? item)]