Fork me on GitHub

Is there anything like Phoenix Liveview in Clojure yet?


While technically possible of course, it'd surprise me if there was an ambitious impl in Clojure I think Liveview assumes/promotes a tight integration between frontend and backend; you can do that in Rails or Phoenix (which dominate their respective languages), but not so much in Clojure where there's no dominant framework (or technique, approach, libraries, etc)


@uliashkevich That looks really interesting. Is it an IntelliJ plugin that requires Cursive?


is there a go-to library for creating graph visualisations in clojure? I've found a few (dorothy, rhizome) that are unmaintained, and the graph data libraries (loom, ubergraph) seem to support creating visualisations but I can't see how to add friendly labels on nodes rather than having the keywords on them, label edges etc)


Dorothy works perfectly.


more general & not specific for graph vis. but Quil is basically a clojure wrapper for processing


hot to specify project github url in Clojars?


... ok it was just a typo 🙂 tags <url> and <scm><url> in pom.xml - that was the answer.


Hey! Does anyone know of a way to search the archives over at ?


I did a site: google search, but it doesn't match recent additions.


i also used site: at various search engines. perhaps you are already aware of this, but for some of the channels, recent content can be searched via zulipchat.

👍 4

if I have lists that can be in the form ((:a :b :c) (:d :e :f) (:g :h :i)) or (((:a :b :c) (:d :e :f)) (:g :h :i)), how do I get them all into the first form?


(although the extra nesting can be anywhere in the list, not just on the first two elements)


basically, I want to flatten, but keep the lists at the lowest level instead of getting (:a :b :c :d :e :f)


apply concat might be helpful

(apply concat
         '(((:a :b :c) (:d :e :f)) ((:g :h :i))))
  ;; => ((:a ::c) (:d :e :f) (:g :h :i))


But it sounds like your problem might not be well specified. Is there any reason you've got such differences in your input format? If you want to cover loads of different cases, you're treading territory closer to parsers.


oh, it's becuase I'm writing something hacky, honestly. I did it with (partition 3 (flatten list)) (as they're always 3 elements)


This is possibly more of a JVM thing than a Clojure thing, but maybe someone knows the answer... Given a deps.edn like this:

{:paths ["resources"]}
If I start a Clojure REPL when resources doesn’t exist, then create resources/test.txt and try to get a hold of it with ( "test.txt"), I get nil. However, if I restart the REPL and run ( "test.txt"), I get the resource. It appears that resources must exist before I start the REPL, but test.txt doesn't. That is, if resources already exists, I can create test.txt after starting the REPL and successfully get a hold of it. Does anyone know if there's some way to avoid having to create the resources directory prior to starting a REPL?


@flowthing create resources/.gitkeep and track in VCS?


That's a good idea, I didn't know about .gitkeep. Thanks!

👍 4

It's nothing special about the file name, just a convention. Git doesn't track folders, only files. And the dot makes it hidden 🙂


Ah, I see. Anyway, that should work, as long as nobody deletes the directory (in my actual case, it's not actually the resources directory I'm working with, it's a more transient thing).

👍 4

Then Git creates the resources folder on git clone


Is there a way to require some namespaces globally for a project? It'd be nice to have some commonly used helper fn/macros available everywhere in my project without manually requiring them in every new namespace


~/.lein/profiles.clj for lein or ~/.clojure/deps.edn for deps.edn to set global configurations

👍 4

I would hate to have to maintain code that didn’t have all its dependencies listed in the :requires portion of the ns declaration.

👆 12

Unless it's not a dependency but something like


What is the difference between having a transducer placed on a channel or using the transducer when you take from the channel?


transducers placed on the channel are run when the value is put into the channel


one thing to watch out for is transducers that can produce nil since nil isn't allowed on channels.

👍 4

if you're using a filtering transducer on a buffered channel, you can avoid filling the buffer with stuff that will be filtered out, since they are dropped before being put into the buffer

Alex Miller (Clojure team)15:02:50

transducers placed on the channel may be run when the value is put into the channel, or may be run when consumed

👍 4

Ok it looks like I want to use pipeline I’m doing reads from S3 as part of my transducer. So do I want pipeline-blocking?

Alex Miller (Clojure team)15:02:08

depends how you're doing the s3 reads - either pipeline-blocking or I believe aws-api allows you to be async, in which case you could probably use pipeline-async


I’m recursively fetching from S3 to process >400,000 json files. Since it only returns 1000 objects at a time I was planning on putting each 1000 onto a channel. From which I would have parallel processing done with a transducer and then all collected at the end (from the out channel?) for the final collection.


Hi, a simple question: how much work is to port Clojure to another runtime, for example, to generate Ruby code / bytecode (or something like this)? Where do I even start? It could be a "very simple, very slow" port in the beginning, I'm just trying to see if it's worth the effort, or if it's better to go to a "clojure-like language"


Implementing the special forms gives you a lot. But, if you look at Clojure core, you'll see that one of the special form is the interop one. And then you'll see that a lot of the core library uses interop. And that some things are fully exposed as Java, like the persistent data-structures.


Those are the parts that take some time to rebuild. Either you'd need to re-implement a lot of it in pure Clojure (which I think ClojureScript did a bit of), or you'd need to figure out how to expose the same functionality using the new runtime. And some runtimes might not offer as much, so it could be more or less work


But its doable


Just time consuming


I'm thinking about implementing a "Clojure in Clojure" for now: to port most things to Clojure as possible, then check what's the minimum necessary to implement on the "host language"


That be nice. I think nornally its IO and system calls that absolutely need to be implemented in host language or using the special form interop


I’m very new to this language, but from the little I read I think you would need to implement all of clojure’s special forms. AFAIU the rest of the clojure language is built on top of those special forms.


there's a couple examples of this.


joker, lumo, planck.


lumo and planck are simply REPLs which give access to self-hosted ClojureScript


actually, that's a bad example. joker's an interpreter


it's not directly writing out Go MIR assembly


but the steps would be largely similar, instead you'd convert to Go ASM instructions and potentially use the toolchain in that example.


no matter what though, you're going to need all of the parts of a compiler. and are great approachable resources to learn these topics. 🙂


it's not just about the special forms, clojure embraces the host platform and interops with it for a lot of its stdlib

👍 12

yep. interacting with the linker in those runtimes is a big step.


there's some other resources with as well that you might find valuable in this approach. they're writing a lot of the lifting power for writing compilers and interpreters for WebAssembly and WASI.


so there's a lot of these plumbing tools if you want to practice by going to that particular platform.


as @bronsa mentioned though, potentially way more work being native to that platform and it's tooling than writing a standalone compiler/interpreter/linker/etc. 🙂


I was also thinking about poking around trying to make an implementation in Truffle


Would be interesting to do voor Sci. I heard that it could theoretically reach the speed of normal Clojure via Truffle


I'm also wondering if it would help create native libraries. Right now you preferably compile everything together to make the code loading fast enough

Eduardo Mata19:02:59

Is this a proper way to convert time for Central Time? using java-time

(as-> time t
    (time/local-date-time "yyyy-MM-dd HH:mm:ss" t)
    (time/zoned-date-time t "US/Central")
    (time/with-zone-same-instant t "UTC")
    (time/format (time/formatter :iso-offset-date-time) t))


Not sure if a library would be overkill, but I've been having a good experience with for time stuff.

Eduardo Mata19:02:22

An example is, I have a dataset where the records have a created-time somewhere in Mountain Time in Colorado. I have to convert the created Time to US/Central, however, I saw this approach to apply zone same instant to UTC