This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-16
Channels
- # announcements (7)
- # aws (9)
- # babashka (31)
- # beginners (28)
- # calva (14)
- # clj-kondo (29)
- # cljs-dev (23)
- # cljsrn (16)
- # clojure (21)
- # clojure-france (1)
- # clojure-nl (2)
- # clojure-spec (20)
- # clojure-sweden (4)
- # clojure-uk (6)
- # clojurescript (62)
- # community-development (5)
- # conjure (81)
- # cursive (14)
- # datomic (5)
- # defnpodcast (2)
- # docker (1)
- # figwheel-main (11)
- # fulcro (17)
- # graalvm (5)
- # jobs-discuss (5)
- # kaocha (1)
- # off-topic (54)
- # pathom (1)
- # pedestal (1)
- # quil (1)
- # re-frame (34)
- # shadow-cljs (34)
- # tools-deps (39)
- # uncomplicate (2)
Hello Clojurians, do all of the :aliases
function calls in deps.clj
have to dispatch through -main
via :main-opts
, or is it possible to add a function in the namespace and call that function directly. I see that it is possible using lein
something like;
{:aliases {"migrate" ["run" "-m" "investtrack.scripts.migration/migrate"]
"rollback" ["run" "-m" "investtrack.scripts.migration/rollback"]}}
Can something like that be done in deps.clj
:aliases
map? Or you just have to live with dispatching via a -main
function?You can pass the name of a clj file to just load it and run the top level or use -e to evaluate an arbitrary expression
The latter can be combined with requiring-reslolve to do what you want
clj -e “((requiring-resolve ‘some-ns/some-fn) some-args)”
You can put that in an alias but if you do, replace the spaces with commas in the expression (commas are white space but won’t get messed up by bash word splitting)
Hey all 👋 Begun learning Clojure last week……Starting off with the Brave book and a few 4clojure problems…..Wanting to contribute to #athens in a few weeks
any troubles let us know, athens seems like a really cool project
Awesome, thanks Adrian 🙂
Be careful if you use the Emacs setup it definites, it's quite out of date now. https://docs.cider.mx/cider/index.html is an up to date guide for Clojure in Emacs. If you want a curated Emacs setup, then try https://practicalli.github.io/spacemacs/ Or there are several other editors you can use https://practicalli.github.io/clojure/development-tools/
Thanks @U05254DQM! I am currently using Cursive and have my VS Code set up with Calva
I need to utilize an InputStream to .read a number bytes, a fixed (large) number of times, to a clojure vector. I'm aware of a number of ways to do this, but I'm curious if there's a particular idiom and/or a method with the least overhead. I've been benchmarking various solutions and it's driving me crazy.
A clojure vector is not the most natural place to put individual bytes because of boxing. Depending on what is being done a nio bytebuffer or netty bytebuf can be very nice if mutable. There are some specialized versions of clojure vectors that avoid boxing
I have used various bytebuffer things a fair bit, and sometimes even used bitsets or byte arraya wrapped in bigintegers
You can also use randomaccessfile to memory map files, where those memory mapped views act like bytebuffers
(actually you need a filechannel to map, which you can get a few places not just a randomaccessfile)
The jvm has some small number of built in types (called primitives) that are not reference types, and everything else is a reference type. So any kind of generic code will usually deal in reference types, which means the primitives need to get boxed (turned into instances of a reference type).