This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-13
Channels
- # adventofcode (77)
- # beginners (132)
- # boot (11)
- # cider (40)
- # clara (10)
- # cljsjs (1)
- # cljsrn (4)
- # clojure (148)
- # clojure-android (1)
- # clojure-greece (5)
- # clojure-italy (5)
- # clojure-nl (7)
- # clojure-spec (57)
- # clojure-uk (9)
- # clojurescript (115)
- # core-matrix (1)
- # cursive (3)
- # data-science (1)
- # datomic (1)
- # duct (7)
- # emacs (20)
- # fulcro (29)
- # funcool (4)
- # graphql (31)
- # instaparse (15)
- # java (1)
- # jobs (6)
- # jobs-discuss (95)
- # leiningen (2)
- # off-topic (30)
- # om (4)
- # onyx (7)
- # pedestal (6)
- # quil (4)
- # re-frame (52)
- # reagent (59)
- # rum (1)
- # spacemacs (3)
- # specter (61)
- # test-check (3)
Hi @nathanmarz, now this might be a noob question, but how would I go about getting rid of the following warning when building my lein project (which has specter in the depenendency graph):
WARNING: any? already refers to: #'clojure.core/any? in namespace: com.rpl.specter.impl, being replaced by: #'com.rpl.specter.impl/any?
@mbjarland ah i'll need to release a new version that renames those functions
I'm using midje for testing which in turn pulls in marick/suchwow which in turn pulls in specter 0.13.0...ah ok
no, that's fine
you'll need to open an issue with midje to update its dependencies
looks like it's really outdated
would be glad to, though it might be worth waiting until you do your update before creating the ticket
just checked, that function no longer exists in specter codebase so there are no warnings with latest version
oh apparently I knew about and fixed this a long time ago: https://github.com/nathanmarz/specter/blob/master/CHANGES.md#0131
suchwow (which is the immediate dep of midje) has not changed since the 6.0.0 version which midje is using
so I would have to file a ticket with suchwow and once they update, file a ticket with midje?
@mbjarland yea, it's an annoying problem with the jvm
but yes, that would be the approach to use
it would probably be a lot faster for you to just fork the projects yourself in the meantime
there is an existing PR on suchwow: https://github.com/marick/suchwow/pull/9
@nathanmarz (select [ALL (selected? :p1 ALL :name (pred= "wow"))] data) => this expression check for "wow" word, what if i want to check multiple different words
for example: all contains "wow" or contains "good"
(or (pred= "wow") (pred= "good")) ?
@abdullahibra replace (pred= "wow")
with #{"wow" "good"}
great
what if i want to use custom function rather than match string? maybe regexp matcher for example
@abdullahibra you can insert any clojure function into a path
if it returns nil or false, it ceases navigation there
regexes are also natively supported, they navigate to every substring match
#{"wow" (fn [s] (re-find #"[g|G]ood" s))} this is right?
so (selected? #"aaa")
would act as a filter
no, sets are interpreted just like a function
(since sets are functions in clojure)
you would want either (fn [s] (or (= "wow" %) (re-find ...)))
or (selected? (multi-path (pred= "wow") #"[g|G]ood"))
multi-path
within a selected?
functions like an or
you may wish to look through https://github.com/nathanmarz/specter/wiki/List-of-Navigators
that's really cool
thanks man for this
for this data: [{:s1 "cool" :p1 [{:name "hello" :sen "good"} {:name "world", :sen "nothing"}]}, {:s2 "cool2" :p1 [{:name "wow", :sen "fine"} {:name "world",, :sen "none"}]}]
@nathanmarz helped me to extract all hash maps which match "wow" or regexp, and for multiple words i would like to do this: (selected? (apply multi-path [#"regexp1" #"regexp2"])) and what if i want to match two cases in the same time, so i want to catch the :name which has regexp and :sen which has also regexp
don't do (apply multi-path ...)
why ?
inefficient and unecessary
to match multiple cases just put multiple conditions consecutive in the path
what if i have big list of regexp?
what i would like to get any hash map which match any from regexp-list1 and regexp-list2 from two different paths
one path from :name and other from :sen
you can do the (apply multi-path some-list)
but there will be ways to optimize that if you have perf problems
(selected? (multi-path :key1 :key2) (multi-path (pred= "wow") #"some-regex"))
that would check that either :key1 or :key2 is either "wow" or matches that regex
i got this
but if i would like to match :name is "wow" AND :sen is "good"
so i don't get match for :name "wow" and :sen "nothing"
[#(= "wow" (:name %)) #(= "good" (:sen %))]
without multipath ?
multi-path
navigates to multiple paths
for "and", it's just multiple navigators in a row, for "or" it's (selected? (multi-path ...))
ah okay got this
these are just how those concepts emerge from navigation