This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-31
Channels
- # announcements (3)
- # beginners (139)
- # boot (28)
- # cider (40)
- # cljdoc (1)
- # cljs-dev (30)
- # clojure (61)
- # clojure-conj (1)
- # clojure-dev (113)
- # clojure-germany (4)
- # clojure-italy (29)
- # clojure-nl (3)
- # clojure-russia (2)
- # clojure-spec (38)
- # clojure-uk (53)
- # clojurescript (188)
- # core-async (4)
- # css (2)
- # cursive (7)
- # data-science (5)
- # datomic (14)
- # emacs (1)
- # figwheel-main (192)
- # fulcro (37)
- # jobs-discuss (1)
- # mount (4)
- # off-topic (47)
- # pedestal (7)
- # portkey (14)
- # re-frame (4)
- # reagent (22)
- # reitit (2)
- # remote-jobs (1)
- # ring (6)
- # shadow-cljs (65)
- # spacemacs (7)
- # specter (6)
- # yada (8)
buongiorno! domanda ultra nabba
come faccio un "while not empty" ?
Su che tipo di collection? perche' quello che descrivi si fa solo se hai side effects di solito
soltiamente in clojure/linguaggi FP quando hai una domanda del genere significa che stai ancora pensando in imperativo
ho una funzione che mi genera una stringa
ma a volte questa stringa è vuota per varie ragioni
quindi voglio invocare la funzione fino a che non mi ritorna una stringa non vuota
grazie
(repeadetly f)
== invoca la funzione in continuazione
(first (drop while empty? <>))
== ritornandomi il primo valore non vuoto
clojure è così semanticamente potente <3
TIL not-empty
Ma argh, empty?
vs not-empty
Dovrebbe essere not-empty?
Oh nice, non avevo notato
Ritiro il mio sdegno