This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-11
Channels
- # announcements (3)
- # aws (3)
- # babashka (79)
- # beginners (105)
- # calva (10)
- # chlorine-clover (22)
- # clj-kondo (12)
- # cljs-dev (39)
- # clojure (52)
- # clojure-europe (1)
- # clojure-spec (15)
- # clojure-uk (12)
- # clojurescript (47)
- # conjure (93)
- # data-science (1)
- # datomic (10)
- # emacs (6)
- # figwheel-main (14)
- # fulcro (30)
- # instaparse (3)
- # kaocha (2)
- # lambdaisland (3)
- # malli (2)
- # meander (6)
- # off-topic (27)
- # pathom (14)
- # perun (1)
- # reagent (15)
- # shadow-cljs (69)
- # slack-help (2)
- # spacemacs (5)
- # test-check (23)
- # vim (9)
to expand all... macros?
seems is the case: https://github.com/clojure/clojure/blob/30a36cbe0ef936e57ddba238b7fa6d58ee1cbdce/src/jvm/clojure/lang/Compiler.java#L7716
and the impression I get is indeed, a form (like (macro-blah a b c)
at some point reaches the analyze
function in Compiler.java
(Line 6748), and that particular form will match the case
else if(form instanceof ISeq)
return analyzeSeq(context, (ISeq) form, name);
, call analyzeSeq,
analyzeSeq
will early on call macroexpand1
on it (and every form like this -- or ISeq specifically -- it looks like, so function calls and I suppose 'actual' lists and what not too), here
try
{
Object me = macroepand1(form);
if(me != form)
return analyze(context, me, name);
andI suppose if that indeed results in something new, it knows its a macro, and starts analyzing the new expanded form instead
as always, don't take this as 100% accurate -- this is my impression from looking at it recently, but its easy to get something off that way, its always best to investigate it yourself of course
hmm I want to look at again now, as I haven't seen the function you posted strangely oh nvm smh yes I have
I wonder, it looks like it calls macroexpand once in the beginning, and then calls it again (or rather, macroexpand1) during analysis / the part I posted, that's something I'm curious to look at more
Does anyone know, by chance, what happened to clojure.contrib.dataflow? Seems like it's been deprecated for ages now, is there any modern replacement?
Many of the 60+ "old contrib" libraries never migrated out of the monolith when it was deprecated as part of the Clojure 1.3 release process -- due to having no maintainers willing to continue work on them. Here's a fairly accurate map of what did migrate and what their new names became: https://clojure.org/community/contrib_history
If you wanted to revive dataflow and maintain it, you could talk to Alex Miller and see if Clojure/core would be happy to migrate it to a new repo under Contrib, or else you could fork it outside Contrib and work on it (retaining the copyright and license!).
@UTQEPUEH4 FWIW a creator of javelin made a clojure version in a PR that hasn't been merged. I have used it before and it works https://github.com/hoplon/javelin/pull/40
In Clojure, what is the idiomatic way to build multiple indices over the same data? Suppose I have a set of records and I want to look them up using different keys. If the values change, they should immediately/eventually reflect across all keys. Kind of like a database. Currently, I am just mapping/filtering over the set of things at runtime.
It doesn't filter anything, it builds an index. You then do the filtering based on that index.
You can e.g. use an atom
to update both the underlying structures and the indices in the same swap!
are you talking about https://github.com/tonsky/datascript ?
if so, yes. it will build indices internally
It does. But the last time I checked it (2-3 years ago), it was ~10 times slower than a regular map lookup. So I just build maps manually for the fields that I'm interested in, that's it.
> EAVT, AEVT and AVET indexes
Building an index, keeping it up to date, and looking stuff up (if it's just an equality lookup) are all very simple operations that require barely any lines of code.
I will do that then. Was actually wondering if there is a common idiom using atom, ref etc. that I can use.
Just store your index right where you store your data, and then update them together, at all times. That's it. Whatever you use to be able to update your data you will now use for the index as well simply because the index is right there in the same data structure as the data.
If you last looked at datascript several years ago I would not be surprised if performance has improved. The underlying sorted set used for indices in datascript has been pulled as a separate project as well
https://git.sr.ht/~hiredman/dset/tree/master/src/com/manigfeald/dset.clj is an example of using the sorted set from datascript outside of datascript
@U0NCTKEV8 Thanks, perhaps it has improved. But I would be incredibly surprised to find that it got comparable to the regular hash maps. After all, that's what I was needing all this time - I have never had any need for comparisons, just strict equality.
The tagline of Datascript is "What if creating a database would be as cheap as creating a Hashmap?". I am willing to give it a shot.
I want to be able to read/write round trip a (sorted-set-by my-comparator
. I could make my own type backed by the sorted set, but I'd rather not have to re-implement all the protocols/methods it extends to use all the clojure core functions. This seems like it'd be doable in cljs with the IPrintWriter
protocol + specify!
http://clj.Am I missing a good way to do this in clj?
Anyone else have problems with https://github.com/hypirion/clj-xchart not rendering when running a chart? Currently on MacOS High Sierra with OpenJDK 11. Getting no errors, get back the Swing JFrame, but nothing is showing