Fork me on GitHub
#off-topic
<
2023-09-13
>
respatialized12:09:08

> Directed graphs are ubiquitous, so it's incredibly weird to me that not a single mainstream programming language has a built-in directed graph type. And it's even weirder that not a single mainstream programming language has them in the standard library. > Hillel Wayne, https://buttondown.email/hillelwayne/archive/if-you-work-on-a-big-language-id-like-to-talk/ What would Clojure look like if it had a data structure literal (and corresponding persistent data type) for digraphs?

👍 3
mmer12:09:15

Not all directed graphs are equal. We seem to have several types in implementation terms: RDF - Subject Predicate Object - is used to represent graphs not necessarily directed but the 'semantics' can imply that Something like neo4J and other graph databases, tend to had nodes with data associated with them and then edges to other nodes. RDF can represent this, but uses an edge for every data item. Then there is the issue of time or other meta data that is very useful when creating graph data. See XTDB for example. In effect expanding the triple to have extra values. So I can see why a language does not have a native support for graphs as they are diverse in nature and so why limit a language by supporting only a finite view of a graph.

❤️ 1
Martynas Maciulevičius13:09:34

> If you work on a big language, I'd like to talk If you work on a big language, I'd like to persuade you to make it even bigger because nobody will notice that in a big language

mmer13:09:59

I wonder if having access to common algorithms is more important - e.g. short route etc.

Martynas Maciulevičius13:09:59

I think the more important thing would be to ask: Why doesn't Clojure or others implement something like clojure.graph inside of the core of the language and instead rely on the libraries?

andy.fingerhut14:09:19

I've only thought about this briefly, but regarding the comment "not all directed graphs are equal", that is certainly true. But not all sequential lists are equal, either, and those are built into many languages. individidual nodes with pointers between them, things like Java ArrayList, and probably a few other implementations under the hood.

1
respatialized14:09:19

Yes, and libraries like Loom and https://github.com/Engelberg/ubergraph demonstrate that it is possible to have protocols that are polymorphic and implementation-independent, in a manner analogous to Clojure's sequential interfaces.

andy.fingerhut14:09:01

Given the number of languages that have added dictionary/map as a built-in thing, and sets, at least some form of directed graph doesn't sound completely crazy. Also, just because it is in the base language does not mean that it must serve all purposes for that data structure, but it should strive to implement the most common use cases. There are third-party library add-ons to Clojure for different variants of maps and sets, but not many people need them. It sounds to me more challenging to come up with the 80% coverage-of-use-cases directed graph default data structure, but probably possible.

2
Daniel Craig14:09:06

so.... What about Fico XPress Mosel? Isn't that a language that has graphs? Here's an example of a shortest path implementation in Mosel https://www.fico.com/fico-xpress-optimization/docs/latest/examples/mosel/Robust/GUID-3F98BEF4-3488-3F4E-A02F-A955EDA8FD5F.html

Daniel Craig14:09:05

And aren't matrices themselves a perfectly adequate representation of a directed graph for the majority of practical applications?

Daniel Craig14:09:20

I guess I overlooked the word 'mainstream' in your quote. Mosel is not mainstream

1
respatialized14:09:54

I've never heard of FICO XPress Mosel until now, but to me it makes perfect sense that an optimization language has more built-in support for graphs and graph algorithms. The question is really why they're not common in "general-purpose" languages, even though basically every general purpose language needs them at some point.

mmer14:09:25

Would the idea of a language supporting a concept mean that you would have a terser way of using the concept. That did not look vary terse 🙂

1
andy.fingerhut14:09:09

If by a matrix you mean some idea of a 2-d array with a column and row for each node, that is terrible for memory efficiency for sparse graphs, e.g. a number of edges that something like 3x to 4x the number of nodes, which is pretty common in a lot of directed graph applications.

1
respatialized14:09:00

you can do i,j,l triplet style for that but you give up a lot of the benefits of having a matrix representation that way - some matrix libraries have better support for sparse matrices but that's not guaranteed to be in any standard library

Daniel Craig14:09:16

I should have checked my tone before posting, great points

andy.fingerhut14:09:36

No worries. My first reaction was not far from yours, but then I started thinking of the useful data structures built into many high level languages today that aren't built into C, which basically only has arrays and pointers.

andy.fingerhut15:09:00

For years, I worked on C code bases, and a big code base would often have multiple different custom representations of linked lists, sometimes simply because there was no standard one built in, and it was easy to roll your own, but each with slightly different properties.

😱 1
andy.fingerhut15:09:07

I don't miss that.

respatialized15:09:02

Especially when they might each be doing their own allocations 😬

mmer15:09:34

One of the issues is that from a data view point the s,p,o triple of things like RDF force queries to perform joins between each row in the data structure and that is usually seen as a costly action, relational databases work best when you don't do joins !

mmer15:09:37

The way round that is indexes, and they tend to end up being implemented in different forms of hash maps.

andy.fingerhut15:09:53

From my own perspective, I've never used RDF, but I have used directed graphs for dozens of other things over years. Note that Clojure maps/sets/lists do not try to provide the fanciest all-singing all-dancing versions of those data structures, trying to cover all use cases. The directed graph I was thinking of (and maybe Hillel Wayne, but not sure), is an in-memory-only directed graph that might not support database-style queries built-in.

respatialized15:09:34

Datomic and other datalog DBs certainly prove that you can use indices to great effect to build well-performing systems with EAV(T) semantics

mmer15:09:35

Makes sense.

andy.fingerhut15:09:04

Note: I am not encouraging anyone to rush off and implement and evangelize such a thing, unless that strikes their fancy. Just noodling for a few minutes on the question.

OknoLombarda12:09:11

Greetings. I want to allow users of my app create custom CSS style sheets and share them between each other. I know almost nothing about CSS. Is it dangerous? Do I need to sanitize it? How do I do it? I tried to look for answers on the internet, but couldn't find any existing solutions for that, nor did I find any specifications of which properties are dangerous. Please, help

OknoLombarda13:09:06

Thanks, now I know it is dangerous. If anyone is aware of existing solutions for escaping CSS, I would much appreciate if you told me

sergey.shvets18:09:10

Look into how lit element does it. https://lit.dev/docs/components/styles/. They sanitize CSS with their template literal. I haven't look into how they implement it, but it shouldn't be too big as their library is tiny. Also, take a look into Constructable Stylesheets: https://web.dev/constructable-stylesheets/. Browsers now a way to pass stylesheets within shadow-dom that can be a great way for you to escape shared part from other styles so it doesn't mess with your main styles.

Chip13:09:21

I’m in search of a full-stack, solo developer support group (besides the local psych ward). Any leads would be appreciated.

Thomas Moerman13:09:20

Isn't that what this entire Slack is about? 😜

😅 3
Chip13:09:24

That’s how I’ve been treating it. These very skilled and talented people have been very kind and helpful. It’s the Quixote channeling that is hard.

Chip13:09:43

It’s tempting to create a full-stack channel.

Martynas Maciulevičius13:09:43

Will it be about technology or about channeling? Because I think that if it's not technology then the title won't be understandable :thinking_face:

truestory 1
Martynas Maciulevičius13:09:19

I think you could create channeling . But then again -- we already have #C0459PCHLTW

👀 1
Chip13:09:25

A channel would have to be about the tech. The social/mental/emotional impact would have to be a side effect.

Chip14:09:29

https://jamesdsteele.medium.com/channeling-don-quixote-the-intersection-of-idealism-and-pragmatism-in-business-49dc91fb8246 captures much of the expression. Thank you @U052A8RUT for sharing it. I hadn’t seen it. I’m not really worried about idealism shattering the pragmatics. I’m responding to some very difficult human needs that most consider intractable. I’m building what I’m building because it has to be built, https://clojurians.slack.com/archives/C0218CKTVEK/p1692842517062129. Maybe it’s reverse-Quixote. To the best I’m able to tell, I’m fighting real giants. Not surprisingly, my objectives often look like https://www.phrases.org.uk/meanings/tilting-at-windmills.html when seen by others. Ergo my search for support.

Omar14:09:06

I don't know of any support groups, but I pretty much fit that description. If you want to vent about anything or hear my struggles to potentially make you feel better, I'd be happy to chat ;)

gratitude 1
Chip14:09:26

Does forming a #full-stack channel make sense to you?

Omar14:09:02

If your intention is more emotional support which your original message somewhat implies, I don't think it's an apt channel name 😉

Omar14:09:38

What do you want to get out of it? Some help or technical discussions?

Chip16:09:38

I want both help and technical discussions. I see the latter as a type of the former. Your (@U0175247L06 and @U028ART884X) sensitivity to my emotional state is indeed appreciated — very appreciated — and the emotions arise out of the challenges of implementation. I want a place where I can work with other solo, Clojure/Script/Datomic, full-stack developers. I’ve created #C05SVE3P116. If I’m the only one there forever, I won’t have to change the name.

Stef Coetzee16:09:37

Hi! I'm interested in implementing data validation for work in Python, but Pydantic seems heavy handed. Can anyone possibly recommend packages like Spec or Malli but in Pythonland?

eggsyntax16:09:37

I've been doing some python lately for ML stuff, and did a brief search for things along those lines, but didn't find anything that seemed very appealing. Didn't encounter dataspec though, will definitely check that out!

🙌 1
Ingy döt Net18:09:21

@U03CPPKDXBL wondering what you think is heavy-handed about it. I've only read about pydantic but it seemed pretty great.

Stef Coetzee18:09:03

I've grown to much prefer functions and data over classes and objects. I'm wont to overthink and the tight coupling associated with classes feels like too much of a commitment. It felt like I was fighting Pydantic (as I was avoiding object properties and class hierarchies) instead of just outlining the expected interface. (I realize what I'm after isn't idiomatic Python.)

sheluchin21:09:30

I've been using a lot of Pydantic lately and I think it's great. Pydantic v2 leans towards functional validators quite a bit so that appeals to my desire for fn patterns.

🙌 1
Stef Coetzee11:09:02

Separately: are there communities for Python that you've found to be kind and helpful like Clojurians?

sheluchin13:09:23

https://glom.readthedocs.io/en/latest/index.html is another project you might want to check out. It's the closest thing to Spec that I know in Python, although not quite the same. As for Python communities, #python on Libera IRC network is pretty good https://libera.chat/

🙏 1
gratitude 1
Vincent23:09:42

Attn musicians 🎵 anyone available for helping us pilot test a new online music sharing community we've been building in #C7Q9GSHFV electric clojure

eggsyntax23:09:15

ie sharing original music? Sure -- don't have much time to put into it at all, but I happen to have just finished a piece, so I could certainly hop on and share it & listen to a few others 🙂

Vincent17:09:07

Building a music discovery flood together, so it can be your own music, or just music you really like, with a bias for fresh/recent. Fantastic, I am finishing up the "sharing" functionality and can post you a link soon

👍 1
Raghav14:09:21

👋 Happy to check it out

😸 1
Vincent20:09:21

Hey eggsyntax and Raghav! 🎶 Right now, I've got only paid accounts up and running, but with one, you can submit tracks to the Premuse page, and eventually they will make it to the Front Page and to our snazzy newsletter, The Remuseletter. 🎉 https://remuse.co/create-account — would be where to sign up, the price nudges up 33 cents with each new sign-up (33rpms per record). It’s at $13.09 as of today, new sign-up this morning, a new music editor joined the team. If you can support our endeavor it would mean a lot, as it demonstrates that there is a real need and appreciation for our product. I do plan on eventually adding in free accounts that will be able to chat but not submit songs. You can sign up for the newsletter (totally free and awesome) @ http://letter.remuse.co 🎵 The promise is simple: musicians and bands can submit their own tracks and have them featured on the http://remuse.co website, and also in the newsletter. this will give bands and musicians more listeners. we have an annual subscription model so you can promote lots of your music at any interval you feel comfortable with. earlier community joiners get a lot of value for a small investment. Today the core product is available and while it's not perfect, if you work with me on it, we can turn it into the product that it needs to be. The vision: an online place for fresh track discover and music describing/praising/reviewing with a bias for recency but all music all genres fair game. In my mind it is what things like "Rolling Stone" ought to be in the 22nd and a half century. We also plan to stay independently owned, as a source of music discovery and a place to share inspiration with artists. Our target market is actually up-and-coming bands who desire more exposure and listeners, and for listener enthusiasts who love to share great music. We have a rating system in those circles on the album art, you can click "doubleplus" "plus" or "minus" to cast your vote for tracks on the homepage. These buttons roughly translate to the numbers 99, 71, and 33. When votes are tallied the numbers are averaged and the average is displayed. Look forward to jamming and brainstorming with you all! :the_horns: 🎸

eggsyntax16:09:52

Hi, Vincent, thanks, but this isn't actually an investment that I want to make currently. Was happy to try it out just to help someone else doing something in the Clojure community, but not currently wanting a paid service for music sharing.

Vincent21:09:39

@U077BEWNQ understood. For now, it is mostly aimed at bands who want to get more exposure (we publish things through the site, newsletter). Soon am adding "listener" accounts and those would be free and you will eventually be able to link your spotify or applemusic.

👍 1