Fork me on GitHub
Daniel Shriki06:05:52

Hi channel! I’m trying to implement feature flags on my project, I saw some cool for some inspiration, but I saw they are fetching the flags inside a middleware, means additional get request to all flags in every request - and I’m not sure why, it sounds not efficient. what do you think? is somebody has an idea? feels like I’m missing something


I'm not familiar with the library but it looks quite generic. It's probably not directly concerned in how exactly you fetch the flags. If that's expensive, then perhaps you want some caching? (caching them just for a few seconds might be enough).

Yogesvara Das11:05:40

I'm using re-frame. Is there a correct way to dispatch events in succession? To my knowledge dispatch enqueues events and dispatch-sync doesn't seem to be the correct tool for this.

Yogesvara Das13:05:52

I had not seen that part of the effect api

Yogesvara Das13:05:14

it works when I put it in the :fx instead of multiple re-frame/dispatch calls in a callback

👍 1

There's also a #re-frame channel if you have any other questions!

👍 1

Does using a fully qualified symbol mean I don't have to require the namespace the symbol is in to use it?

Alex Miller (Clojure team)14:05:51

yes, but you still have to ensure the namespace that defines that var has been loaded


@U064X3EF3 it could be loaded by having been previously required in some other place, right? Are there some other ways that could happen?

Alex Miller (Clojure team)14:05:52

yes, and no, respectively

Alex Miller (Clojure team)14:05:41

something has to load the namespace before the vars exist to find them

Alex Miller (Clojure team)14:05:24

but once it is loaded, you can always use a fq name to refer to it. shorter names via aliases are a per-namespace naming convenience


I see. Aliases are just an entry in ns-aliases which is part of the ns-map. Thanks!

Alex Miller (Clojure team)16:05:45

aliases are about letting you type less :)

gratitude-thank-you 1

This returning Null , where am I doing wrong! I am trying to filer the data where index is 1 2 3

(def data [{:name "john" :address "NY" :index 0}
           {:name "David" :address "LO" :index 1}
           {:name "Anand" :address "PA" :index 2}
           {:name  "Popeye" :address "CA" :index 3}
           {:name "Tina" :address "RS" :index 4}])

(println (filter #(= (get % :index) (range 1 3)) data))


You're taking the index, e.g. 1 and comparing it to '(1 2 3). That's why they don't match. You can do (filter #(#{1 2 3} (:index %)) data)


basically #{1 2 3} is dynamic


You can use some instead


filter is an operation on collections. Write a predicate function valid-index? that takes a single map as input and returns logical true or false. Then all you have to do is (filter valid-index? data) You're trying to solve two problems at the same time.

👍 1

also reminder that sets #{1 2 3} can be used as functions that tell you if the argument is in it:

(#{ 1 2 3} 0) => nil
(#{1 2 3} 1) => 1


which is great for these kinds of filters