This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-09
Channels
- # aws (51)
- # beginners (57)
- # calva (10)
- # chlorine-clover (7)
- # cider (20)
- # clj-kondo (55)
- # clojure (43)
- # clojure-europe (9)
- # clojure-italy (1)
- # clojure-nl (5)
- # clojure-spec (8)
- # clojure-uk (71)
- # clojurescript (33)
- # core-async (22)
- # cursive (20)
- # datomic (3)
- # emacs (8)
- # figwheel-main (8)
- # fulcro (13)
- # garden (2)
- # graalvm (60)
- # graphql (26)
- # jobs (6)
- # joker (6)
- # kaocha (2)
- # lambdaisland (5)
- # malli (36)
- # off-topic (9)
- # portkey (15)
- # re-frame (3)
- # reagent (25)
- # remote-jobs (4)
- # spacemacs (3)
- # sql (111)
- # tree-sitter (29)
- # uncomplicate (3)
- # xtdb (2)
Google confirms Microformats are still a recommended metadata format for content https://news.ycombinator.com/item?id=22521666
Morning.
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....
mornin'
morning
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
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
and what the meta
nature of the data bring
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
@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.
obvs the killer use-case is where you want to preserve equality semantics
yeah I suppose. I'm suspicious that comparator/equality is such an important part that I would usually want to control it explicitly
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
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.
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
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 http://www.gravizo.com/
fyi looking up asciidoc with clojure landed me there: https://github.com/Olical/blog
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 ;
?
@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
I'm not interested in evaluating Haskell as "which language is objectively the best" because I think this kind of categorising tools is stupid
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
> 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.