Fork me on GitHub
#beginners
<
2019-05-05
>
Ivan Koz00:05:59

from docs to < and <=

; <= Returns non-nil if nums are in monotonically increasing order, otherwise false.
;  < Returns non-nil if nums are in monotonically non-decreasing order, otherwise false.
Is there any difference between increasing and non-decreasing? Looks like synonyms to me.

Mno01:05:02

increasing has to increase and non-decreasing does not in the case of it being the same number (so [1 1 1 1 2 3 4] is non decreasing but it isn’t always increasing)

Ivan Koz02:05:39

@hobosarefriends oh now i understand the meaning

Mno02:05:06

no probs!

dpsutton04:05:47

And note you had the doc strings backwards

skykanin15:05:54

when mapping over a hash-map what does the mapping function get as an argument?

Ivan Koz15:05:46

@nicholas.jaunsen a vector pair of key and value

Ivan Koz15:05:45

you can imagine a map as a sequence of map entries (key-value pairs)

ok20:05:38

why destructuring has :as if you can already access the full arg?

(let [range-vec (vec (range 10))
      [a b c & more :as all] range-vec]
        (println (= all range-vec)))
and they are equal.

upgradingdave20:05:50

@twaima I think because it lets you consolidate lines like this:

(let [[a b c & more :as range-vec] (vec (range 10))]
        (println (= all range-vec)))

👍 4
✔️ 4