This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-13
Channels
- # beginners (14)
- # boot (108)
- # carry (6)
- # cider (28)
- # cljs-dev (107)
- # cljsrn (32)
- # clojars (4)
- # clojure (62)
- # clojure-austin (15)
- # clojure-berlin (1)
- # clojure-brasil (3)
- # clojure-chicago (1)
- # clojure-dev (9)
- # clojure-greece (2)
- # clojure-italy (4)
- # clojure-nl (1)
- # clojure-poland (2)
- # clojure-portugal (1)
- # clojure-russia (24)
- # clojure-spec (63)
- # clojure-uk (30)
- # clojurescript (123)
- # cursive (13)
- # data-science (1)
- # datascript (1)
- # datomic (27)
- # devcards (11)
- # dirac (1)
- # emacs (5)
- # events (4)
- # hoplon (27)
- # jobs (3)
- # juxt (3)
- # leiningen (11)
- # off-topic (18)
- # om (46)
- # om-next (7)
- # onyx (50)
- # pedestal (6)
- # portland-or (8)
- # proton (16)
- # re-frame (38)
- # reagent (21)
- # ring-swagger (14)
- # specter (46)
- # untangled (116)
- # vim (46)
- # yada (22)
Is there some sort of problem with specter + Datomic tempids? I get this very strange error:
(rs/declarepath MapWalker)
(rs/providepath MapWalker
(rs/stay-then-continue
rs/MAP-VALS
(rs/walker map?)
MapWalker))
(rs/transform [MapWalker :db/id]
(fn [id]
(d/tempid :db.part/user))
{:db/id 1
:foo [{:db/id 2}]})
=> java.lang.UnsupportedOperationException: Can't create empty: datomic.db.DbId
I suspect the error is a red herring..I can do this without an error:
(rs/transform [MapWalker :db/id]
(fn [id]
(d/tempid :db.part/user)
id)
{:db/id 1
:foo [{:db/id 2}]})
=> {:db/id 1, :foo [#:db{:id 2}]}
@kenny it probably has something to do with clojure.walk interacting with that datomic type
i think you can avoid that situation by doing continue-then-stay
instead of stay-then-continue
when you do stay-then-continue
, it first updates :db/id on the top-level map. then it does the rest of the path (`MAP-VALS (walker ...) MapWalker`)
when you do continue-then-stay
, it does the walk of the submaps first, so at no point does the walk ever go over the datomic types that you produced
no problem!
noob question here: How do I select the values that come before elements that satisfy a given predicate. For example if I had [1 "a" 22 3 5 2 "b" 10]
and wanted to select values that occur before strings to get [1 2]
. Is this something that is possible?
gave 0.13 another shot, and still having the same issue like 5 weeks ago:
https://gist.github.com/darwin/10e6748467e0a13a8f7573c1ae99e4a6
it is calling this function, compiled under :advanced
mode with :pseudo-names
true
https://github.com/binaryage/dirac/blob/6c0c2bc8348eb296174cc72331c031e096af1bda/src/implant/dirac/implant/automation/reps.cljs#L62
@jlutteringer you could do [(continuous-subseqs (complement string?)) FIRST]
@darwin can you remind me what was causing the issue before?
also, does it still fail under 0.13.1-SNAPSHOT?
we didn’t go deeper into it, I decided to wait if anyone else hits similar issue, downgraded to 0.12 again
does it work under non-advanced compilation?
can you also wrap that line in (with-inline-debug ...)
?
that will print some debugging info that might be useful
0.13.1-SNAPSHOT is broken for me as well, trying to compile it under :whitespace mode and with-inline-debug, unfortunately switching to :none mode would be much more work due to chrome extension packaging restrictions
ah, I’m going in the same footsteps, :whitespace mode is broken due to this parinfer issue: https://github.com/shaunlebron/parinfer/issues/120 and I cannot upgrade because it wasn’t yet published on cljsjs
I’m going to use parinfer directly as foreign-lib, but it will take me some time until I figure it out
looking at the error more closely, the issue is happening inside of multi-path, so wrapping the providepath in with-inline-debug would be helpful as well
@jlutteringer just realized you asked something completely different, for that use case I would recommend using zipper navigators or making a custom navigator
I was able to get very close tweaking your example (specter/select [(specter/continuous-subseqs (complement string?)) specter/LAST] [1 "a" 22 3 5 2 "b" 10])
gives me [1 2 10]
now I just need to figure out how to drop the last element
well, if the last element of sequence is a string you wouldn't want to drop it
ah, right
kk, I’ll give zippers a shot, thanks so much for the help!
specter integrates zippers in specter/zipper.cljc
(select
[z/VECTOR-ZIP
z/DOWN
z/NEXT-WALK
(selected? z/NODE string?)
z/LEFT
z/NODE]
[1 2 "a" 3 "b" 4])
;; => [2 3]
you’re the man, thank you so much
getting close to get :whitespace working, now hitting http://dev.clojure.org/jira/browse/CLJS-1547
@nathanmarz finally got a screenshot for you: https://dl.dropboxusercontent.com/u/559047/specter-dirac-whitespace.png
this is output I got from the inline-debug: https://gist.github.com/darwin/1b2d5f75a9348ba2b9dcad241c1e2fb6