workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
I have a question, if I have a project based on clj cli, how can I build a jar from that?
2017-12-30T04:49:09.000012
Jodie
clojurians
clojure
I wondered if I needed to collect up the classpath, and add each one to the fat jar.
2017-12-30T04:56:40.000059
Jodie
clojurians
clojure
are you looking for lein uberjar, or am I misunderstanding the question?
2017-12-30T04:59:28.000015
Berry
clojurians
clojure
<@Berry> clj cli, I'm looking to replicate that
2017-12-30T05:08:32.000016
Jodie
clojurians
clojure
hmm ok, so I have a java.util.Iterable&lt;Map&lt;String, Object&gt;&gt; representing a huge file and I know i can treat this as a clojure seq, and I have done so succesfully, for example by using `take` and processing the item.
2017-12-30T06:18:45.000091
Sam
clojurians
clojure
think of the file as a big csv file (except it's json)
2017-12-30T06:19:03.000061
Sam
clojurians
clojure
I can't load all of the file's contents in memory, so i have to take slices.
2017-12-30T06:20:29.000066
Sam
clojurians
clojure
<https://dzone.com/articles/java-8-how-to-create-executable-fatjar-without-ide> This might be my answer, or at least in abstract form.
2017-12-30T06:20:57.000024
Jodie
clojurians
clojure
How would one take `n` items from the `seq` until it is empty?
2017-12-30T06:21:07.000067
Sam
clojurians
clojure
I think leiningen can do this for you
2017-12-30T06:22:10.000009
Sam
clojurians
clojure
See <https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#uberjar>
2017-12-30T06:23:40.000031
Sam
clojurians
clojure
Or, I should say 'returns no more items'
2017-12-30T06:26:07.000015
Sam
clojurians
clojure
I'm not using leiningen though :slightly_smiling_face: I'm trying to do it without leiningen.
2017-12-30T06:29:17.000042
Jodie
clojurians
clojure
<@Sam> I think `partition-all` is lazy, so you could use that.
2017-12-30T06:29:59.000007
Jodie
clojurians
clojure
You don't want to use a build tool?
2017-12-30T06:31:59.000062
Sam
clojurians
clojure
<@Jodie> i'll check that out
2017-12-30T06:32:33.000038
Sam
clojurians
clojure
and cljs doesn't support it :confused:
2017-12-30T06:41:47.000013
Lorraine
clojurians
clojure
then there is no hope :slightly_smiling_face:
2017-12-30T06:48:56.000012
Sam
clojurians
clojure
Hello All! I have a very frustrating problem, because it should be obvious, but I cannot pass. How can i set a scheduler (exactly hara.scheduler) to a smaller period than 1 second. "/1 * * * * * *" means 1 second, but "/0.5 * * * * * *" doesn't work. Even if i set the "truncate" parameter to :millisecond, cannot use milliseconds. The documentation also silent about the topic. Do not I understand the capabilities of a scheduler? O.o Happy New Year to our glorious Community!
2017-12-30T08:49:38.000005
Rey
clojurians
clojure
<@Rey> if you want to run something subsecond it may make sense to look into <https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newScheduledThreadPool-int-> and then `scheduleAtFixedRate` <https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html>
2017-12-30T09:40:41.000070
Dona
clojurians
clojure
clojure's functions are java.lang.Runnable
2017-12-30T09:42:40.000013
Dona
clojurians
clojure
so you can just pass a function to `scheduleAtFixedRate`
2017-12-30T09:42:54.000043
Dona
clojurians
clojure
I can also use core.async, but i really wanted to use a real clojure scheduler, but cannot understand why I am not able to schedule something with milliseconds. Thanks anyway. :slightly_smiling_face:
2017-12-30T09:44:45.000020
Rey
clojurians
clojure
At first I just want to execute a function periodically, it is a few lines with core.async.
2017-12-30T09:45:59.000008
Rey
clojurians
clojure
<@Rey> there’s this wrapper over the Java executor service stuff too <https://github.com/overtone/at-at>
2017-12-30T09:48:38.000072
Shamika
clojurians
clojure
Yes, there are several clojure scheduler. i did my research and choosed hara.scheduler
2017-12-30T09:49:45.000047
Rey
clojurians
clojure
re STM, it depends of the application type. most of us write server-side web backends, STM is almost inherently unsuitable for that (b/c you want servers to scale horizontally, and STM is per-server) but that
2017-12-30T09:50:05.000002
Kristy
clojurians
clojure
's not the only type of application out there!
2017-12-30T09:50:27.000003
Kristy
clojurians
clojure
STM seems a good fit for simulations, desktop apps, games maybe
2017-12-30T09:50:55.000011
Kristy
clojurians
clojure
<@Jodie> I think you could trace what Leiningen does, my first guess would be to figure out how to get the list of jars and copy their contents into a new zip/jar <https://github.com/technomancy/leiningen/blob/master/src/leiningen/uberjar.clj>
2017-12-30T10:07:33.000028
Brande
clojurians
clojure
That's what I've started to look at <@Brande>. It's all quite roundabout, I'm surprised there's no library to go from classpath-&gt;jar.
2017-12-30T10:08:29.000005
Jodie
clojurians
clojure
Yes, and there are a lot of options on that route. In portkey (<https://github.com/portkey-cloud/portkey>) Cristophe Grand did a tree-shaker that packages the minimum needed deps starting from a var :)
2017-12-30T10:44:25.000046
Brande
clojurians
clojure
assume I have the following data structure: ``` [{:delim ["┌─" :F]} {:align \─} {:delim [:F "─┬─"]} {:align \─} {:delim ["─┬─"]} {:align \─} {:delim ["─┐"]}] ``` what would be the most idiomatic / concise way of counting the number of `:F`s? I do a: ``` (count (keep (comp #(some #{:F} %) :delim) data-structure)) ``` now, but I have the distinct feeling I’m missing some more direct route
2017-12-30T10:47:42.000047
Joette
clojurians
clojure
and nathan, I assume specter can do this more succinctly but I’m trying to avoid dependencies in this particular scenario
2017-12-30T10:49:23.000027
Joette
clojurians
clojure
thinking that such a deployment package creation from inside the repl could be quite awesome (like push the thing into AWS/Lambda, or into a container)
2017-12-30T10:49:48.000038
Brande
clojurians
clojure
<@Brande> if this is something of interest to you, I've just got a jar that contains clojure &amp; a helloworld.clj built, and I don't think it will be difficult to hook in tools.deps.alpha to this system.
2017-12-30T10:52:58.000111
Jodie
clojurians
clojure
<@Joette> it's trivial with <#C0FVDQLQ5|specter> `(count (select (walker #{:F}) data))` `(walker afn)` will recursively "walk" in your data, search by something that satisfies `afn`. `walker` is a "navigator", then you need to say "what to do with this data" In this case, I use `select`, that just return a list of "what navigator find". But you can use `(setval navigator :new-value data)` to REPLACE "what navigator find", for example.
2017-12-30T11:08:24.000050
Jutta
clojurians
clojure
<@Joette> best way with specter is `(count (select [ALL :delim ALL (pred= :F)] data))`
2017-12-30T12:32:14.000058
Owen
clojurians
clojure
`walker` is not appropriate for this use case, as it traverses parts of the data structure you don't care about (which reduces performance and can cause bugs)
2017-12-30T12:32:59.000066
Owen
clojurians
clojure
he explicitely said he's not looking for a specter solution, I'd say what he has is not bad in pure clojure
2017-12-30T12:34:15.000047
Kareen
clojurians
clojure
the highest performance way with specter is something like `(transduce (map (constantly 1)) + (traverse [ALL :delim ALL (pred= :F)] data))`, which doesn't materialize any intermediate data structure
2017-12-30T12:34:17.000124
Owen
clojurians
clojure
<@Kareen> if I see bad specter guidance, gotta correct it ;)
2017-12-30T12:36:25.000056
Owen
clojurians
clojure
<@Kareen> <@Owen> and <@Jutta> thank you. If I end up pulling in specter I know what to do now. Indidentally: `(count (select [ALL :delim ALL (pred= :F)] data))` is not that much terser (not at all in fact, though arguably easier to grok) than my original pure-clojure: `(count (keep (comp #(some #{:F} %) :delim) data))` so I guess I’ll consider the clojure version decent (as a side note, the fact that you can use specter as a reference point for terseness I think speaks to the beauty of specter)
2017-12-30T13:41:21.000018
Joette
clojurians
clojure
^ are the two comments not contradictory?
2017-12-30T14:27:03.000062
Danielle
clojurians
clojure
I think <@Jodie> meant that it would be better to have STM in cljs than in clojure :slightly_smiling_face:
2017-12-30T14:28:57.000061
Lorraine
clojurians
clojure
and sad but true it's not supported there
2017-12-30T14:29:35.000037
Lorraine
clojurians
clojure
manifold is also worth trying
2017-12-30T14:30:37.000001
Lorraine
clojurians
clojure
ls
2017-12-30T16:03:39.000038
Arica
clojurians
clojure
is there an official clojure grammar somewhere? somethng detailed enough to write an actual production clojure parser from it ?
2017-12-30T18:04:50.000039
Berry
clojurians
clojure
<@Berry> nope
2017-12-30T18:05:11.000084
Sandy
clojurians
clojure
EDN is close, but there are differences
2017-12-30T18:05:25.000095
Sandy
clojurians
clojure
tools.reader is a Clojure implementation of a reader that can read Clojure source code. Many tools that analyze Clojure source code use it.
2017-12-30T18:47:04.000008
Micha
clojurians
clojure
It isn't a grammar, but an implementation in code of a reader. Unlike the one in clojure.core (implemented in Java), it is implemented in Clojure. Not sure if that makes it any more useful for your purposes.
2017-12-30T18:47:51.000003
Micha
clojurians
clojure
Yeah. I've written a bunch of clojure-like grammars and own most of the git-blame for the clojure.g4 you'll find around. Don't go down that road unless you have a good reason to, tools.reader and the ecosystem around it (rewrite-clj etc.) is very good.
2017-12-30T18:49:38.000019
Charity
clojurians
clojure
Getting a Clojure-like grammar right is surprisingly hard :confused:
2017-12-30T18:50:34.000022
Charity
clojurians
clojure
Just a side note: The most official docs for Clojure syntax on <http://clojure.org|clojure.org> do not allow symbols that the Clojure reader allows in symbols. For example, on this page: <https://clojure.org/reference/reader> you will find no mention that the character '=' is allowed in symbols, but it is allowed by the implementation. Clojure is in many ways defined by its implementation, not some English spec.
2017-12-30T18:52:02.000055
Micha
clojurians
clojure
Yup. To the point that there's some reader behavior such as `:` being legal inside of keywords that Alex has said is unintended but won't be removed for compatibility.
2017-12-30T18:53:22.000018
Charity
clojurians
clojure
clojure.g4 ?
2017-12-30T18:55:02.000098
Micha
clojurians
clojure
There's an antlr-grammars repo around which contains what purport to be grammars for a variety of languages and data formats. I did a bunch of work on the clojure grammar in that repo at one point.
2017-12-30T18:56:31.000043
Charity
clojurians
clojure
`.g4` is the antlr4 file extension
2017-12-30T18:56:53.000041
Charity
clojurians
clojure
I found it via a quick Google search after asking: <https://github.com/antlr/grammars-v4>
2017-12-30T18:57:11.000059
Micha
clojurians
clojure
the parser for my Ox language is written in antlr4 using a derivative of the clojure.g4 grammar and I know <https://github.com/venantius/glow> uses an unattributed copy of clojure.g4 as well.
2017-12-30T18:58:29.000032
Charity
clojurians
clojure
As a newcomer to Emacs, am I better off with a vanilla installation + recommended packages (CIDER etc), or Spacemacs in evil mode with the Clojure layer? Is learning Emacs for the first time in evil mode doing myself a disservice?
2017-12-30T19:18:21.000033
Zola
clojurians
clojure
For what it's worth I'm coming from Cursive.
2017-12-30T19:19:03.000020
Zola
clojurians
clojure
Depends on whether you're already used to modal editing / vim mode elsewhere. I personally run emacs with CIDER and my own custom config without evil or any of the total conversion suites but I also know a bunch of people that love them.
2017-12-30T19:19:49.000033
Charity
clojurians
clojure
Spacemacs and doom-emacs are both awesome, although spacemacs is probably the best supported of them all.
2017-12-30T19:20:16.000069
Charity
clojurians
clojure
Also depends on how much time you want to spend wrangling vs learning your environment.
2017-12-30T19:20:29.000066
Charity
clojurians
clojure
i'd suggest go for spacemacs -- the out of box experience is a little better. I don't use EVIL (the vim layer) and i have a pretty good experience with spacemacs
2017-12-30T19:21:23.000059
Danielle
clojurians
clojure
Thanks for the input. I started in evil mode and immediately found myself googling for commands, but the resulting Vim keybindings didn't seem to line up with how Spacemacs works (even with taking into account SPC).
2017-12-30T19:22:38.000002
Zola
clojurians
clojure
For instance, to save a buffer, how does SPC f s map to vim?
2017-12-30T19:23:38.000068
Zola
clojurians
clojure
In vi wouldn’t it be `: w` ?
2017-12-30T19:24:45.000001
Kyung
clojurians
clojure
Yeah, that was my confusion. Is Spacemacs providing its own shortcuts or something?
2017-12-30T19:25:30.000073
Zola
clojurians
clojure
yes, space introduces nested prefixes
2017-12-30T19:26:11.000053
Margaret
clojurians
clojure
(I realise these are dumb questions but will ultimately help me understand which mode to invest in)
2017-12-30T19:26:14.000036
Zola
clojurians
clojure
so that every command is a series of single keypresses until you hit a leaf of the tree of shortcuts
2017-12-30T19:26:33.000039
Margaret
clojurians
clojure
you can do something similar with vim via leader keys, the difference is that with spacemacs it's not juxt space + some-key, it's space, some-key, another,.... final
2017-12-30T19:27:10.000051
Margaret
clojurians
clojure
Ahhh, okay, thanks!
2017-12-30T19:27:36.000037
Zola
clojurians
clojure
fwiw I ended up deciding after decades of usage emacs is too fiddly and I was spending too much time messing with elisp and I just switched to vim
2017-12-30T19:28:12.000108
Margaret
clojurians
clojure
I'm not much for integrating smart functionality into my editor though, I find it becomes difficult to know what's really happening if something breaks when there's so many tool layers
2017-12-30T19:29:01.000001
Margaret
clojurians
clojure
I totally get that. Atom + protorepl is another option I've considered for lightweight development. Cursive is fantastic but IntelliJ is heavy handed.
2017-12-30T19:31:14.000073
Zola
clojurians
clojure
So I'm sure I'm just overlooking something here, but is there a common function equivalent to the threading macro which will feed the result of function n to n+1 in a ~list~ collection?
2017-12-30T19:45:54.000067
Vilma
clojurians
clojure
I switched from Emacs/CIDER to Atom/ProtoREPL a year ago and have been very happy. I was an Emacs user about twenty years ago before I went off to the land of IDEs <@Zola>
2017-12-30T19:46:12.000050
Daniell
clojurians
clojure
<@Vilma> `(apply comp [f1 f2 f3 f4])` ?
2017-12-30T19:46:51.000018
Daniell
clojurians
clojure
I was thinking about using comp, I think it works but I was wondering if there was something more threading-macro-ish for familiarity's sakes. I think I may actually have just asked for too much ergonomics from clojure
2017-12-30T19:48:35.000044
Vilma
clojurians
clojure
thanks for the pointer, I'll give that way an implementation and see how it goes
2017-12-30T19:49:51.000009
Vilma
clojurians
clojure
write a macro?
2017-12-30T19:50:15.000002
Joanne
clojurians
clojure
I'm also dynamically building the chains of functions so it'll be `(apply comp (reverse func-path))` which I guess isn't too bad.
2017-12-30T19:51:12.000032
Vilma
clojurians
clojure
Couldn't you just build the chains in the reverse order in the first place?
2017-12-30T19:51:55.000070
Daniell
clojurians
clojure
I want it to be able to be used at run time. I already wrote a macro that was a pain in the ass and I don't think this one will get much performance gain for the maintainability.
2017-12-30T19:52:00.000057
Vilma
clojurians
clojure
The chains are made by shortest path calls on loom graphs. I guess I could just switch the start and finish but that'd just move the reverse call from one place to another.
2017-12-30T19:53:14.000006
Vilma
clojurians
clojure
It's not really a big issue, just that I'm worried I'm overlooking some issue with regards to the behavioral differences between `-&gt;&gt;` and `comp`
2017-12-30T19:55:28.000028
Vilma
clojurians
clojure
It's a hobby library so I'd prefer to waste the time and solve the generic case if possible.
2017-12-30T19:56:45.000048
Vilma
clojurians
clojure
I think the comp idea works. Is there an agreed upon way to write a marco way and a function way of doing things for varied kinds of desired efficiencies?
2017-12-30T20:22:17.000071
Vilma
clojurians
clojure
what's the equivalent of `[org.omcljs/om "1.0.0-beta1" :exclusions [cljsjs/react cljsjs/react-dom]]` for `deps.edn`?
2017-12-30T22:45:21.000066
Bernice
clojurians
clojure
does anyone else find `deps.edn`/`clj tools` a breath of fresh air? lein + boot have both been madness to me the past two days
2017-12-30T23:18:48.000020
Bernice
clojurians
clojure
thank you to everyone who worked on the clj (CLI) tools
2017-12-30T23:19:13.000024
Bernice
clojurians
clojure
no, you're not the only one :slightly_smiling_face:
2017-12-30T23:19:49.000027
Sandy
clojurians
clojure
and IIRC, :exclusions are something that hasn't yet been added to deps code
2017-12-30T23:20:08.000076
Sandy
clojurians
clojure
and it's about to get better, the git stuff being worked on in `master` will make it even better. I never really liked using maven artifacts anyways.
2017-12-30T23:26:31.000014
Sandy
clojurians
clojure
can tools.reader get me line number and column number for expresiosns / symbols / strings / numbers ?
2017-12-30T23:36:49.000004
Berry