This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-28
Channels
- # announcements (4)
- # aws (2)
- # babashka (56)
- # beginners (43)
- # calva (70)
- # clj-kondo (25)
- # cljs-dev (29)
- # clojure (103)
- # clojure-dev (9)
- # clojure-europe (55)
- # clojure-gamedev (8)
- # clojure-nl (5)
- # clojure-norway (5)
- # clojure-uk (4)
- # clojured (1)
- # clojurescript (56)
- # copenhagen-clojurians (1)
- # core-async (2)
- # cursive (16)
- # datomic (5)
- # deps-new (18)
- # emacs (9)
- # events (3)
- # fulcro (45)
- # graphql (2)
- # gratitude (2)
- # kaocha (6)
- # lambdaisland (8)
- # lsp (72)
- # meander (41)
- # missionary (5)
- # nextjournal (52)
- # off-topic (2)
- # pathom (12)
- # pedestal (2)
- # practicalli (1)
- # re-frame (6)
- # reitit (5)
- # releases (1)
- # reveal (1)
- # specter (3)
- # sql (4)
- # tools-deps (22)
- # vim (8)
- # wasm (1)
- # xtdb (22)
@ben.sless Here’s something for inspiration. Hopefully you can take it from here.
(require '[juxt.pull.core :refer [pull]])
(pull {:x
[{:y
[{:z
[{:w ["a" "b"]}
{:w ["c" "d"]}]}
{:z
[{:w ["e" "f"]}
{:w ["g" "h"]}]}]}
{:y
[{:z
[{:w ["A" "B"]}
{:w ["C" "D"]}]}
{:z
[{:w ["E" "F"]}
{:w ["G" "H"]}]}]}]}
[{:x [{:y [{:z [:temp]}]}]}]
{:shadow {:temp println}})
prints
{:w [a b]}
{:w [c d]}
{:w [e f]}
{:w [g h]}
{:w [A B]}
{:w [C D]}
{:w [E F]}
{:w [G H]}
{:w [a b]}
{:w [c d]}
{:w [e f]}
{:w [g h]}
{:w [A B]}
{:w [C D]}
{:w [E F]}
{:w [G H]}
and returns
{:x [{:y
[{:z [{:temp nil} {:temp nil}]}
{:z [{:temp nil} {:temp nil}]}]}
{:y
[{:z [{:temp nil} {:temp nil}]}
{:z [{:temp nil} {:temp nil}]}]}]}
The problem that I faced is that the api doesn’t let me calculate the new value in place. I’m calculating the value that should fill in that location using the data at that location but it gets inserted unter a new key. i.e. :temp
“You can define attributes (values) not exists but calculated by the value of the map, they are shadow attributes:”
https://github.com/juxt/pullI started my journey http://edn-query-language.org/ but I had trouble finding a library that did what I wanted.
I also tried using m/$ with ?context but the ?context had everything and I didn’t know how to get just the path… I think that was the issue.
I figured out both solutions eventually but the grouping had to be cut explicitly because star is greedy
I don’t think I understand. Are you talking about the solution with ..n! because … is greedy?
I've mentioned it before but, yeah, ...
is broken on the RHS because it is greedy. It should be frugal as it is on the LHS. This will be "fixed" in the distant future.
In general, what is on epsilon and prior is, IMO, "wrong" since it does not have distinct operators for greediness/frugalness e.g. *
and *?
etc.
The zeta
branch does make the distinction and there are tests that demonstrate how it works. The zeta
branch was never able to get off the ground though because I had some struggles with the compiler and organization.
Please let me know if you make tickets or have a meetup. I’m content atm trying to learn what’s already there but I don’t want to miss out if you start moving forward with zeta development.
I’m trying to learn how to make webapps with reagent. I’ve been learning datascript and reading about graph databases…
As a proud heretic in this "community" I'd also recommend learning how type inference works and a bit about type theory at some point in your journey.
TBH I'd use Haskell more if it weren't for the whitespace sensitive syntax and lame non-whitespace sensitive syntax.
I actually used Haskell to inform how zeta
and beyond should work. The combination of data
and class
helped guide me a lot. I can't understate that.
I implied I know about type inference works but I don’t really. Category Theory for Programmers and Seven Sketches in Compositionality have been on my reading list for too long. I’ve not made much progress.
There's a paper out there by SPJ that teaches how to make a mini version of the HM style type checker in Haskell with code examples. I can't remember the title but was very helpful.
I think CT is interesting but I've gotten more out of AA (Abstract Algebra) and ST (Set Theory) than CT.
I am now obsessed with https://github.com/abo-abo/lispy style editing and I don’t know how I’d get it without parenthesis.
The cool thing about learning CT, AA, and ST is that many ideas are portable across languages.
Yea. I’ll recognize that “I’m sequencing” and realize I have a monad. I appreciate having a language for it.
My brain might just be biased to those since I learned them first and pick up some CT stuff later
Hehehe, I don't think I am a heretic. 😄 I subscribe to ideas that I think are good, like type inference, pattern matching, etc.
Type inference is cool, programming with types maybe less so, i.e. I want to know when I messed up with types but let me keep my open dynamic collections. Clj kondo just added map key type inference which is exciting and useful. Wrt pattern matching I can see where it falls apart (expression problem), can still be a very useful and powerful tool
My take on this is, of course, logic. I think types are awesome, I think dynamic typing is awesome, and I think there is a middle ground that says you can have the best of both worlds. I think that middle ground is terms, rules, patterns. I think it is possible to write programs which are type safe but "feel" dynamic. IMO the expression problem exists when types and functions are coupled to each other such that there is a behavior associated with misapplication e.g. type error at compile time/run time. I think rewrite rules are much better here because they aren't "applied to", "called on", or "sent messages to". The work strictly with data and only "fire" when the left recognizes the input. There's no need to blow up, like, at all.