Morning
ProCloDo is on next Tuesday, if anyone fancies coming along and helping build the slowest developed Event Management system in History! š Sign up here: https://docs.google.com/forms/d/1SgT6dQksU3eDDJp37cX2dzcDRODEPF1-wDWEJJA2uL0/viewform Doors open 6pm, Review progress so far 6:30pm, coding 7pm.
morning
Ok if I ask some bidi questions here? Previously tried in #C03S1KBA2 but I feel like the ratio of bidi users is higher here :simple_smile:
Basically have a routing scheme like this
;; /DE/de/batterie
;; /DE/en/battery
;; /DE/de/batterie/gespeichert
;; /DE/en/battery/saved
i.e. it has i18n routes. Now the used segments depend on en
or de
in the second segment. Is there any bidi feature that comes to mind suited for this?martinklepsch: dyu mean pulling out the second segment as a parameter ?
@mccraigmccraig: Iām doing that, the problem is more: when using path-for
how do I make the third segment depend on the second
currently I have something like this:
(defn path-for [route opts]
"Small wrapper around Bidi's path-for to set
i18n route parameters depeding on language"
(->> (get i18n-routes (:lang opts))
(assoc opts :i18n-route)
(mapcat identity)
(apply bidi/path-for routes route)))
ah, gotcha... that's more advanced bidi usage than mine :simple_smile:
which is reasonably ok but I think it wont work well anymore as soon as I add additional segments (like the āsavedā) thing above..
lol - guess which clj* platform this is running on : (map inc "foo") ;=> ("f1" "o1" "o1")
mccraigmccraig: clj-clr ?
@gjnoonan: cljs - only in js does "f" + 1 => "f1"
scala> "f" + 1
res1: String = f1
@mccraigmccraig: the joys of JS!
@minimal: Scala should know betterā¦.or is that āis no betterā?
ha, that doesn't look entirely unreasonably now @minimal
i guess what surprised me was the combination of map working with single-character strings rather than chars and the arithmetic op
but if you are going to convert the args to + automatically then converting to a string makes more sense
@agile_geek: scala has implicits so you can recreate some js gotchas
@mccraigmccraig: chars in cljs are just strings right?
@minimal: oh how I love the āmagicā of implicits!
yeah, js doesn't have chars @minimal
and (+ "f" 1) ;-> "f1"
seems reasonable... (inc "f") ;-> "f1"
less so
another cljs difference I found today
(count (range))
1.7976931348623157e+308
haha wtf ?
range uses maxint for the default instead of iterating forever
lol - evaluating (range)
in my cljs repl made chrome a bit unhappy
how does it short-circuit tho ?
cljs.user=> (source range)
(defn range
"Returns a lazy seq of nums from start (inclusive) to end
(exclusive), by step, where start defaults to 0, step to 1,
and end to infinity."
([] (range 0 (.-MAX-VALUE js/Number) 1))
([end] (range 0 end 1))
([start end] (range start end 1))
([start end step] (Range. nil start end step nil)))
clojure no args version is ([] (iterate inc' 0))