This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-06
Channels
- # beginners (32)
- # boot (17)
- # cider (4)
- # clara (112)
- # cljs-dev (3)
- # cljsjs (2)
- # clojure (222)
- # clojure-germany (3)
- # clojure-greece (1)
- # clojure-italy (4)
- # clojure-losangeles (4)
- # clojure-russia (46)
- # clojure-spec (24)
- # clojure-uk (71)
- # clojurescript (78)
- # community-development (5)
- # component (88)
- # cursive (6)
- # datomic (7)
- # duct (5)
- # figwheel (2)
- # fulcro (21)
- # graphql (22)
- # leiningen (3)
- # luminus (9)
- # off-topic (1)
- # om (16)
- # onyx (46)
- # portkey (30)
- # re-frame (47)
- # reagent (5)
- # remote-jobs (1)
- # ring (12)
- # ring-swagger (13)
- # rum (1)
- # shadow-cljs (81)
- # spacemacs (1)
- # specter (33)
- # sql (2)
- # test-check (2)
- # vim (16)
- # yada (11)
is AFTER-ELEM
used in selections or is just primarily used with setval
? I want to make sure my koans cover possible use cases unless it doesn't make sense.
also, I watched the talk and was excited about specter keeping the collection type the same so I was surprised when I saw this (setval AFTER-ELEM 2 #{1 2}) => (1 2 2)
I tried to pass a k/v pair to AFTER-ELEM as two args and go a wrong number of args error
when I put the k/v pair as a map it just turned the original map into a vector, added it to a list and then added my k/v argument as a separate map in the list like this: (setval AFTER-ELEM {:friend "Mary"} {:name "Paul"}) => ([:name "Paul"] {:friend "Mary"})
so since the result isn't treated like a map you don't need k/v pair balance (setval AFTER-ELEM "Mary" {:name "Paul"}) => ([:name "Paul"] "Mary")
@gdeer81 AFTER-ELEM
is only intended for transformations
it doesn't make sense in the context of a set
to add a single element to a set most efficiently use NONE-ELEM
likewise, it doesn't make sense in the context of a map
for a map, just use keypath
cool, that's good
would be a good thing to add to the docstrings too
Does Specter have specs? I didn't think it did
I'm pretty new to specs but I'd be willing to help spec Specter if that's of interest
Yeah, took another look and pretty sure it doesn't, since it's on 1.8.0 and there's no files included
@nathanmarz (let [my-vec ^{:author "Gary"} [1 2 3]] (meta (select ALL-WITH-META my-vec)))
returns nil , am I doing something wrong or is this a bug?
@gdeer81 @nathanmarz I took a look, it looks like meta is preserved with a transform but not with the select implementation, you can see it in the code too
(let [my-num ^{:author "Gary"} [1]] (meta (transform ALL-WITH-META inc my-num)))
(defnav ^{:doc "Same as ALL, except maintains metadata on the structure."} ALL-WITH-META [] (select* [this structure next-fn] (n/all-select structure next-fn)) (transform* [this structure next-fn] (let [m (meta structure) res (n/all-transform structure next-fn)] (if (some? res) (with-meta res m) ))))
I think I can file a patch 🙂
there's no metadata to maintain on select, since it navigates into the subvalues
that nav purely exists for transforms, especially for codewalker
@nathanmarz Ah, looks like this one isn't in the docs either, I'll submit a pr for it
I'm going to stick to creating koans for the things documented in the wiki until I'm more attuned with the code
Sent in a PR, and a few related to a new issue I opened about undocumented vars: https://github.com/nathanmarz/specter-wiki/issues/17
Hi everyone, I made a screencast to introduce Specter to newcomers: https://www.youtube.com/watch?v=rh5J4vacG98
I've watched a bunch of your older videos, awesome to see one on Specter! Keep them coming! 🙂
This is awesome