meander

Richie 2022-01-28T01:53:10.697389Z

@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/pull

noprompt 2022-01-31T17:54:29.374689Z

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.

Richie 2022-01-28T15:51:19.907889Z

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.

Ben Sless 2022-01-28T16:04:08.164639Z

I figured out both solutions eventually but the grouping had to be cut explicitly because star is greedy

Ben Sless 2022-01-28T16:04:15.041269Z

Turned out pretty ugly

Richie 2022-01-28T16:06:20.150909Z

I don’t think I understand. Are you talking about the solution with ..n! because … is greedy?

Richie 2022-01-28T16:07:06.261909Z

Eh, interesting problem anyway. Lmk if you find anything elegant.

noprompt 2022-01-28T19:44:24.856439Z

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.

noprompt 2022-01-28T19:45:55.393099Z

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.

noprompt 2022-01-28T19:48:23.443839Z

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.

noprompt 2022-01-28T19:48:53.391779Z

Hopefully Ben and I can make something happen before too long. 🙂

Richie 2022-01-28T19:51:16.526989Z

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.

Richie 2022-01-28T19:52:26.986279Z

I’m trying to learn how to make webapps with reagent. I’ve been learning datascript and reading about graph databases…

noprompt 2022-01-28T19:52:39.643729Z

Hmm... I wonder if we could make a recurring meeting or something.

noprompt 2022-01-28T19:53:23.193229Z

Cool, cool. All good stuff to learn. 🙂

noprompt 2022-01-28T19:58:21.025079Z

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.

Richie 2022-01-28T19:58:34.429089Z

I came from Scala.

noprompt 2022-01-28T19:58:40.679239Z

Ah, cool. 🙂

noprompt 2022-01-28T19:58:51.002649Z

I come from everywhere. 🙂

Richie 2022-01-28T19:59:08.414549Z

I was eyeing haskell for a while.

noprompt 2022-01-28T19:59:28.349229Z

Too many good ideas out there to be a "$language programmer".

noprompt 2022-01-28T20:00:03.052589Z

TBH I'd use Haskell more if it weren't for the whitespace sensitive syntax and lame non-whitespace sensitive syntax.

noprompt 2022-01-28T20:00:44.487559Z

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.

Richie 2022-01-28T20:01:27.291079Z

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.

noprompt 2022-01-28T20:02:33.218919Z

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.

noprompt 2022-01-28T20:03:08.264069Z

I think CT is interesting but I've gotten more out of AA (Abstract Algebra) and ST (Set Theory) than CT.

Richie 2022-01-28T20:03:21.490779Z

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.

noprompt 2022-01-28T20:03:45.291219Z

The cool thing about learning CT, AA, and ST is that many ideas are portable across languages.

noprompt 2022-01-28T20:03:52.549509Z

Monoid always comes to mind.

noprompt 2022-01-28T20:04:00.053069Z

Because, you know, they're everywhere.

Richie 2022-01-28T20:06:08.915209Z

Yea. I’ll recognize that “I’m sequencing” and realize I have a monad. I appreciate having a language for it.

Richie 2022-01-28T20:07:31.408539Z

I know what spj and ct are short for but I can’t think what aa or st mean.

noprompt 2022-01-28T20:07:54.144499Z

I also love things like Monoid means "I can divided and conquer".

noprompt 2022-01-28T20:08:19.834199Z

> AA (Abstract Algebra) and ST (Set Theory)

Richie 2022-01-28T20:08:25.030829Z

Ah.

noprompt 2022-01-28T20:09:26.485979Z

My brain might just be biased to those since I learned them first and pick up some CT stuff later

Ben Sless 2022-01-28T21:02:34.989289Z

A nice and concise example is someone wrote a HM inferencer over malli schemas

👍 1
Ben Sless 2022-01-28T21:03:17.234859Z

Are you a heretic? Is meander a pattern matching library? 😉

noprompt 2022-01-28T22:11:06.074709Z

Hehehe, I don't think I am a heretic. 😄 I subscribe to ideas that I think are good, like type inference, pattern matching, etc.

Ben Sless 2022-01-29T05:53:35.408919Z

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

Richie 2022-01-28T01:56:14.004149Z

I started my journey http://edn-query-language.org/ but I had trouble finding a library that did what I wanted.