Fork me on GitHub

Google confirms Microformats are still a recommended metadata format for content


Good Morning!


Moaning! (I hate Mondays 😁)


Spent the weekend in bottomless frustration as my should-be-parallel code (fold) wasn't. Turns out I forgot to cast my sequence to a vector. Are types so bad....

😄 4

And mornin'

Ben Hammond09:03:40

Clojure metadata; the only times I've ever used it, I've gone back later and eliminated it. I haven't working on language tooling; where I appreciate that it is invaluable Has anyone found metadata useful in a non-tooling context

Ben Hammond09:03:57

I guess the clue is in the name 'meta'


one place so far @ben.hammond - in a cljs app, to decorate objects received over the wire from a clj backend with caching-related info

Ben Hammond09:03:08

and what the meta nature of the data bring

Ben Hammond09:03:19

rather than just assoc'ing the decorations


two things really: [1] schema is shared between front-end and back-end and putting client-only cache-info on lots of schemas seemed weird, and [2 i didn't want the cache-info getting sent to the backend and therefore having to be stripped somewhere before objects get saved to the db. both could be achieved through other means, but metadata was an easy solution

Wes Hall09:03:38

@ben.hammond I’ve used it a few times for very typical “metadata” stuff. Requesting user id, database response time. That kind of thing. I’ve also found myself abusing it one or twice and moved stuff back to regular data as you describe.


I think I’ve seen it used for aws meta data stuff


More or lesss what Wes said tho


Morning all


obvs the killer use-case is where you want to preserve equality semantics

💯 4
Ben Hammond09:03:32

yeah I suppose. I'm suspicious that comparator/equality is such an important part that I would usually want to control it explicitly

Ben Hammond09:03:45

rather than side-step with meta


it gets painful when you have nested objects with keys which you want to discount from equality, or if you need to use objects with sets or as keys in maps

👍 4
Ben Hammond09:03:37

yeah you have to abuse it in order to find outt what its not good for


I personally think metadata is a great clojure feature; though it’s certainly one that needs to be used with care, as by it’s very nature it’s hidden and somewhat opaque. Main use is definitely tooling; but it’s super useful in other contexts too. e.g. I’ve written a few DSLs over the years that would generate functions which would hold metadata on the forms for debugging/error messages etc — i.e. they would capture data at compile time; for runtime. Also integrant makes quite good use of it; for a similar purpose. Capturing and storing the configuration of the configured system; in particular the dependency information, so that it can shutdown the system in the right order. Other use cases are adding metadata to vars etc; for programmatically identifying code blocks etc… e.g. type hints, unit tests etc. Personally I’ve found those kind of usages, along with the tooling and language level to be the best ones. It makes implementing the sort of things that would be hard or time consuming to do in other languages a breeze.


I've used meta for some graph algo, can't remember the details but was super useful for hacking something out


Morn’, I’ve used metadata a bit for describing things about data, (which basically sounds like what it says on the tin). It’s been ok, there are some warts about the process I don’t like, but in general it seems to work fine for what I want it to do.


One of the problems using metadata is it’s quite easy to blow it away if you can’t see it or forget it might be there… e.g. if someone wrote code that works like {:new-key (:old-key m)} rather than using clojure.set/rename-keys etc.


Oh yea, that is definitely one of the issues =)…


That reminds me, have of the people using cryogen for blogging, anyone figured out any nice approaches for managing snippets? Do you create project at the bottom level and kick off a repl there then prototype stuff in? Do it entirely externally and then copy/paste snippets into the md file and tinker with klipse? Something else?


Snippets for articles are always taken from exernal projects (working and tested), with the full project code available in a GitHub repository and a link in the blog to that repository. Its ensures that people have all the details. I havent use klipse yet in cryogen.


you can load gists and libraries in klipse via data-gist-id and data-external-libs and other attributes


I've always taken code I developed elsewhere first, so I've not had a problem with testing it


I'd need to look at the code to see if the extra attributes are even supported 🙂


but yeah, in general I tend to write code or whatever externally, and then paste it into the post


another thing I've used was


similar problem: have to write code externally, then paste into the article


Thanks =)…


With asciidoc you can include segments of another file using tags.


fyi looking up asciidoc with clojure landed me there:


We use is a lot at JUXT

Wes Hall17:03:07

Haha! Just saw somebody on twitter (jokingly) describe a monad as, "the thing languages like Java use the semicolon operator to represent!".... Dear purists, I know, but that's quite funny.


is it accurate though - i have sometimes thought of them as generalising the binding-form init-expr relationship in a clojure let, but i don't get how they are equivalent to a java ; ?

Wes Hall19:03:46

@U0524B4UW It's not accurate at all. At the very very loosest level, in the sense of "do this, then do this, then do this", there is the most tenuous of associations, but this, combined with the idea of describing ; as an "operator", made me laugh 🙂


ha, i guess in haskell, with it's pervasive laziness, you don't really get any guarantees that anything will happen in any particular order, unless you sequence operations with a monad, so maybe that's what they are trying to get at


The semi-colon thing is quite a common trope I’ve heard mentioned a few times. Here it’s just framed in a humorous antagonistic way but I’ve seen it meant sincerely too. I think it can also be quite an effective lie on the way to understanding monads, in that: 1. It points to the semi-colon as being a bit like an operator; which is a perspective most people won’t have considered. 2. It points to the monad as being like the thing between the steps; the thing that bind’s them together. 3. It illustrates that things can be composed/sequenced together. 4. You can then point to other things which can in principle being composed in the same way… error’s, state, maybe etc. Obviously it’s at best only a half truth; and doesn’t point to the laws that govern their use.


It’s certainly a much better analogy than monads are like 🌯 😁


you take a chicken burrito, you bind the ecosystem, now you have a beef burrito - you are bind, the ecosystem is a monadic function, just another monoid in the category of endofunctors 🐓🌯->:man-facepalming::partly_sunny_rain:🚜->🐮🌯


i think this points exactly to what annoys me about monads, thanks for the mental shortcut 😄


care to elaborate on what annoys you about them?


From where I'm sitting, they're an extremely elaborate way to achieve something other languages do out of the box.


(Possibly the fault of the source I used to learn Haskell; I'm at the stage where I can write something that works, but I don't see the benefits of the components that make the language the way it is)


Some languages grab you, some don't. The more I write Haskell, the more it feels like sitting on something extremely prickly and itchy: the discomfort is not great, but so annoying you want to run away screaming. The things I do like about it are pattern matching and a more expressive type system. At some point I'm gonna try ocaml, but at the moment I have other things to do.


@U82DUDVMH To some degree that’s fair — however it also kind of misses point in that: 1. They provide an abstraction across things those other languages treat as different, and kind of unknowingly did. 2. Haskell was designed to be pure wrt side effects; lazily evaluated, and strongly typed. Early versions wouldn’t even let you make side effects at all. Given that Haskell was and still is really a CS research project, it was an unsolved problem for a long time on how to “fire the missiles” or do anything other than make your cpu hotter. Monads provided a novel solution to the problem of doing useful things when you’ve purposefully tied your hands behind your back with the constraints of laziness, strong types, and purity; along with being an elegant abstraction applicable to other things too. Haskell’s motto is avoid success at all costs… I think they’re kind of failing to deliver on that promise; but it perhaps describes why you don’t like it 🙂


i haven't written any real haskell - but i have found the monad pattern useful for structuring some code in clojure and it keeps popping up as a way of thinking about some problems


I think Ocaml is a little more pragmatic and are more willing to consider the costs of their principles than in Haskell.


Yeah monads can definitely be useful outside of haskell


Personal tastes can't be fair.


It does not apply as a category.


I'm not interested in evaluating Haskell as "which language is objectively the best" because I think this kind of categorising tools is stupid

👍 4

I strongly appreciate what monads do for Haskell


Haskell certainly doesn’t consider itself objectively the best… Some of their vocal users do; but the designers definitely don’t.


I also appreciate purity as a way of thinking about your functions, helping you split the problem into subproblems, and keeping things easy to mentally digest


Haskell has been amazing as a language research project


I also appreciate the problem with concurrency, and having to instruct your program that "this instruction comes after that, but for everything else it's a free-for-all"


yep 🙂 and monads are great in terms of formally explaining / defining language structure


rather than defining grammar by fiat


I found the ; analogy funny and apt, and that's about it 🙂


> I also appreciate the problem with concurrency I think that’s an area Haskell hoped to make a meaningful improvement on; and has to some degree failed to do so. They hoped that laziness/purity and the rich type information etc would allow smart compilers to parallelise work automatically; but they then found that whilst it’s ridiculously easy to apply any evaluation ordering; it’s impossibly hard to automate the parallelisation of code and make it faster. Hopefully one day they’ll solve this one; but it seems progress has been a lot slower than expected.

👍 4