This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-17
Channels
- # announcements (11)
- # beginners (29)
- # calva (2)
- # clara (12)
- # cljsjs (1)
- # cljsrn (7)
- # clojure (39)
- # clojure-europe (6)
- # clojure-nl (7)
- # clojure-spec (6)
- # clojure-sweden (1)
- # clojure-uk (15)
- # clojuredesign-podcast (6)
- # code-reviews (2)
- # conjure (29)
- # cursive (3)
- # datomic (13)
- # duct (15)
- # emacs (1)
- # figwheel-main (2)
- # fulcro (7)
- # graalvm (16)
- # lambdaisland (4)
- # luminus (1)
- # meander (15)
- # observability (15)
- # off-topic (27)
- # parinfer (7)
- # pathom (2)
- # reitit (2)
- # rum (11)
- # shadow-cljs (57)
- # spacemacs (6)
- # sql (56)
- # tools-deps (36)
- # xtdb (3)
I guess this is the source of my confusion. Why does the code following not return (1 2 3 4 5)
, but instead throw an error?
(m/search {:a [1 2 3 4 5]}
{:a [?x ...]}
?x)
;; => actual
Zero or more patterns may not have references to unbound logic variables.
If I break my case down an actual usage example, this is what I have as input data:
[{:context-tag :one-to-five
:a [1 2 3 4 5]}
{:context-tag :nine-to-five
:a [9 8 7 6 5]}]
and what I'm trying to get is this:
[[:one-to-five 1]
[:one-to-five 2]
[:one-to-five 3]
[:one-to-five 4]
[:one-to-five 5]
[:nine-to-five 9]
[:nine-to-five 8]
[:nine-to-five 7]
[:nine-to-five 6]
[:nine-to-five 5]]
@jatkin Thanks for giving an input and output case. I am sadly busy right now, but if someone else doesn't help you before then I can post an example tonight.
@jatkin once you figure it out, would you mind adding your cases as examples to https://github.com/noprompt/meander/pull/125
👍 3
AH-HA!
(m/search {:context-tag :one-to-five
:k [:aa :bb :cc :dd :ee]}
{:context-tag ?context
:k [_ ... ?k . _ ...]}
[?context ?k])
; =>
([:one-to-five :aa] [:one-to-five :bb] [:one-to-five :cc] [:one-to-five :dd] [:one-to-five :ee])
The docstring of scan
was immensely helpful. But, if I might ask, why does this work but the other cases do not?