sum(n) = n*(n+1)/2
-
Base case: Is it true for
sum(0)
?sum(0) = 0(0+1)/2 = 0
Namespace owlet.firebase
serves to integrate a Firebase database into our re-frame web application. We need to talk to Firebase without dropping into evil JS interop — so you shouldn't use .set
! But more generally, we must preserve the integrity of our application's re-frame data flow.
In the description below, I've tried to be entirely consistent in my use of names; i.e. the scope of any name is this entire document. So when you see
your-value
orthe-db-ref
, you can count on those names indicating the same entities when they appear later in the document. Also, "ref" or "reference" refers to an instance of [firebase.database.Reference](https://firebase.google.com/docs/reference/js/firebase.database.Refe
;; Let's say you have a map recording the number of siblings for each individual: | |
(def num-sibs {:jack 0, :jill 2, :jane 0, :spot 7}) | |
;; Say you want to find the number of only children. We can use ->> | |
(->> num-sibs | |
(map val) | |
(filter zero?) | |
count) |