This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-09
Channels
- # aleph (4)
- # arachne (3)
- # beginners (41)
- # boot (300)
- # cider (17)
- # cljs-dev (37)
- # cljsjs (4)
- # cljsrn (5)
- # clojure (249)
- # clojure-boston (3)
- # clojure-czech (4)
- # clojure-dev (14)
- # clojure-greece (183)
- # clojure-nl (2)
- # clojure-russia (11)
- # clojure-spec (135)
- # clojure-uk (37)
- # clojurescript (56)
- # community-development (8)
- # cursive (22)
- # data-science (4)
- # datomic (150)
- # devcards (6)
- # emacs (5)
- # euroclojure (8)
- # funcool (18)
- # hoplon (29)
- # immutant (1)
- # jobs (1)
- # lambdaisland (3)
- # lein-figwheel (7)
- # leiningen (18)
- # mount (1)
- # om (81)
- # onyx (95)
- # planck (50)
- # proton (6)
- # re-frame (62)
- # reagent (2)
- # ring (1)
- # robots (1)
- # spacemacs (2)
- # specter (88)
- # test-check (32)
- # untangled (23)
- # yada (1)
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: http://volrath.github.io/clojurescript-pong-3d/, which is copied from this tutorial: http://buildnewgames.com/webgl-threejs/ but ported to cljs. Here's the current code and possible plans for the future: https://github.com/volrath/clojurescript-pong-3d 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 http://4clojure.com 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:
(fn[lst]
(dotimes [x (count lst)]
logic here? ))
Where lst
is something like '(1 3 14 2 9 3 5)
What if I wanted to sum odd numbers only?
e.g. 1 + 3 +9 + 3 + 5
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 🙂
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?
I'm testing this out on https://www.hackerrank.com/
Been using println
through all the previous tests and this is the first time nil
is displaying
Nevermind
Took the println
part out and just used (fn[lst] (apply + (filter odd? lst)))
Thanks Cory
is there a quick function for returning filtered items from a lazy-seq with their original index?
@dmbennett: check out keep-indexed
@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)]
index)