workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
As a sub-routine, doesn’t it bother anyone ?
2017-12-09T11:43:43.000046
Olen
clojurians
clojure
Done and done! <https://ajpierce.github.io/posts/ethereum-blockchain-clojure/>
2017-12-09T12:50:45.000137
Alexander
clojurians
clojure
Thanks again for the help! :slightly_smiling_face:
2017-12-09T12:50:51.000111
Alexander
clojurians
clojure
does anybody know of any nice documentation around creating a custom implementation of Spec/Specize from clojure.spec.alpha? I can find one gist in all the web of someone that's attempted it.
2017-12-09T13:06:49.000119
Twyla
clojurians
clojure
it’s not documented because we don’t want to encourage you to do that
2017-12-09T14:33:19.000033
Sonny
clojurians
clojure
in general, you should either be plugging predicates into the specs (use any predicate you like) or combining the things that are provided, which cover the possible data structures appropriately
2017-12-09T14:34:03.000112
Sonny
clojurians
clojure
while I expect the spec api to stay pretty similar, the internals of spec are going to change, so whatever you write is almost certain to be broken. when we consider spec final, there may be more docs at that time on how to create custom spec types.
2017-12-09T14:35:05.000084
Sonny
clojurians
clojure
What's with those new cli tools released with clojure 1.9? What Gap are they trying to fill?
2017-12-09T15:05:36.000080
Vernice
clojurians
clojure
Have you read <https://clojure.org/guides/deps_and_cli> and <https://clojure.org/reference/deps_and_cli> ? They try to answer this question.
2017-12-09T15:07:50.000056
Sonny
clojurians
clojure
<@Sonny> skimmed :simple_smile: . But, are they trying to replace lein/boot?
2017-12-09T15:10:57.000107
Vernice
clojurians
clojure
No
2017-12-09T15:11:08.000081
Sonny
clojurians
clojure
They do not build or deploy artifacts
2017-12-09T15:11:24.000050
Sonny
clojurians
clojure
They are for building classpaths and launching Clojure programs
2017-12-09T15:12:32.000012
Sonny
clojurians
clojure
Thanks <@Sonny> . I'll read it through.
2017-12-09T15:12:42.000069
Vernice
clojurians
clojure
<@Olen> The answer to your earlier question -- about the difference in behavior of `(list? (cons stuff))` in clj and cljs -- is basically due to how the `Cons` type is defined on both sides. In clj, `(list? thing)` asks if `thing` implements `IPersistentList`. clj `Cons` is `java.lang.Cons`, which does not implement that interface, or inherit from anything that does; that's why it returns false on the clj side. In cljs, `(list? thing)` asks if `thing` "implements" (`satisfies?`) `IList`. cljs `Cons` is explicitly defined to implement that interface, so it returns true.
2017-12-09T17:06:33.000045
Clifton
clojurians
clojure
<@Olen> see <https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Cons.java#L17> for the definition on the clj side
2017-12-09T17:08:19.000085
Clifton
clojurians
clojure
<@Olen> <https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L3180> for the cljs
2017-12-09T17:10:14.000045
Clifton
clojurians
clojure
<@Clifton> good explanation. That brings up something I’ve wondered - why `java.lang.Cons` doesn’t impl `IPersistentList`
2017-12-09T17:21:22.000057
Petronila
clojurians
clojure
<@Petronila> because IPersistentList is counted and that demands O(1) counting. Cons cells can be lazy and are O(n) counted.
2017-12-09T17:33:53.000010
Sandy
clojurians
clojure
<@Sandy> where in `public interface IPersistentList extends Sequential, IPersistentStack` are they counted?
2017-12-09T17:35:02.000052
Petronila
clojurians
clojure
I know it has the `IPersistentCollection.count()`
2017-12-09T17:35:16.000048
Petronila
clojurians
clojure
that's it
2017-12-09T17:35:32.000072
Sandy
clojurians
clojure
however, I didn’t think that was the same as `clojure.lang.Counted`
2017-12-09T17:35:53.000060
Petronila
clojurians
clojure
I didn’t know it had any sort of stipulation that is
2017-12-09T17:36:04.000027
Petronila
clojurians
clojure
yeah all the interfaces are O(1), Clojure papers over that with `count` in clojure.core
2017-12-09T17:37:17.000087
Sandy
clojurians
clojure
Either way, I guess I’m getting the general idea that a `Cons` can be some unbounded lazy thing, where a “list” is expected to not be, I guess
2017-12-09T17:37:31.000073
Petronila
clojurians
clojure
exactly
2017-12-09T17:37:43.000074
Sandy
clojurians
clojure
all that is a bit cleaner in ClojureScript
2017-12-09T17:38:11.000094
Sandy
clojurians
clojure
sideffect of reimplementing the lib
2017-12-09T17:38:17.000111
Sandy
clojurians
clojure
sure
2017-12-09T17:39:03.000053
Petronila
clojurians
clojure
Well, good to know. Thanks for the insight
2017-12-09T17:39:17.000063
Petronila
clojurians
clojure
<@Clifton> I looked the documentations before but your message is so clear and it helped me to clear some questions on my mind. If you know any tricks like that. Please mesaage me, I am documenting these tricks.
2017-12-09T17:51:07.000041
Olen
clojurians
clojure
Is there a standard way of storing a Directed Acyclic Graph in an Entity-Attribute-Value store ?
2017-12-09T23:26:54.000049
Berry
clojurians
clojure
an adjacency list would be a simple way to do it
2017-12-09T23:27:53.000059
Margaret
clojurians
clojure
do you store the child list as a single vector, and when you add/del one child, overwrite the entire vector ?
2017-12-09T23:29:35.000028
Berry
clojurians
clojure
that's an implementation decision, the totally denormalized version would be to make each child relation a separate entry
2017-12-09T23:30:31.000001
Margaret
clojurians
clojure
I think
2017-12-09T23:30:38.000070
Margaret
clojurians
clojure
hello every one, I'm starting to learn clojure (my first real functional language) after doing some functional JS
2017-12-09T23:35:30.000031
Cleopatra
clojurians
clojure
do you recomend any sql abstractions to use in my project with postgres?
2017-12-09T23:36:12.000007
Cleopatra
clojurians
clojure
I saw korma, but looks like it is abandoned, and I didn't like the yesql and hugsql approach
2017-12-09T23:37:07.000083
Cleopatra
clojurians
clojure
<@Cleopatra> I'd recommend HoneySQL which lets you compose query fragments, on top of `clojure.java.jdbc` which is the Clojure Contrib library for JDBC operations.
2017-12-10T00:06:19.000031
Daniell
clojurians
clojure
Also <@Cleopatra> since you're new to Clojure and interested in SQL, I'll recommend the <#C053AK3F9|beginners> and <#C1Q164V29|sql> channels.
2017-12-10T00:07:18.000027
Daniell
clojurians
clojure
Is there a clojure tool that will take a codebase, and show me all defns / defs taht are not used? It can assume I'm not doing something weird via string-&gt;symbol-&gt;resolve-in-ns
2017-12-10T00:13:46.000055
Berry
clojurians
clojure
Yagni.
2017-12-10T00:14:33.000009
Daniell
clojurians
clojure
<https://github.com/venantius/yagni>
2017-12-10T00:15:00.000061
Daniell
clojurians
clojure
is boot-check the closest for boot ?
2017-12-10T00:15:01.000047
Berry
clojurians
clojure
yagn ieems to depend on lein
2017-12-10T00:15:09.000013
Berry
clojurians
clojure
$ boot check/with-yagni latest report from yagni.... [You Rock!]
2017-12-10T00:15:37.000005
Berry
clojurians
clojure
Yes, `boot-check` runs Yagni
2017-12-10T00:15:37.000067
Daniell
clojurians
clojure
Gorilla REPL crashes every time when I use it on my Mac.
2017-12-10T02:22:24.000053
Lawerence
clojurians
clojure
Does anyone else have the same problem?
2017-12-10T02:22:34.000024
Lawerence
clojurians
clojure
<@Lawerence> Use `:plugins [[lein-gorilla "0.4.0"]]` instead of `:plugins [lein-gorilla "0.4.0"]`
2017-12-10T02:47:30.000009
Heriberto
clojurians
clojure
How do people feel about doing things like http requests inside of `dosync`, for example?
2017-12-10T03:20:51.000015
Martina
clojurians
clojure
I find myself in a situation where I am receiving many (kafka) messages asynchronously, any of which triggers a particular http call. But I only want to make that call once.
2017-12-10T03:21:46.000061
Martina
clojurians
clojure
So, I receive the message, `dosync` to assoc something under a key and trigger a request *only if that key doesn’t exist yet*
2017-12-10T03:23:53.000070
Martina
clojurians
clojure
Can I do this without triggering a request inside the dosync?
2017-12-10T03:24:08.000002
Martina
clojurians
clojure
Ah, `dosync` may retry anyway, so that doesn’t work
2017-12-10T03:34:42.000006
Martina
clojurians
clojure
Hmmm, how do I avoid the race condition here: `deref` to see if key exists, if not `dosync` to add key and then (at some point) trigger request
2017-12-10T03:38:22.000028
Martina
clojurians
clojure
Multiple threads could `deref` and see the missing key, both add the key and trigger request, unless those are somehow a single transaction
2017-12-10T03:39:31.000024
Martina
clojurians
clojure
I guess in a single `dosync` it can check the key and add it in, no need for a separate `deref`
2017-12-10T03:40:36.000063
Martina
clojurians
clojure
the question is when the request is triggered to guarantee it only happens once
2017-12-10T03:41:03.000030
Martina
clojurians
clojure
Maybe this is finally a use case for agents
2017-12-10T03:44:14.000006
Martina
clojurians
clojure
Ah that is actually a quite elegant solution
2017-12-10T03:55:45.000019
Martina
clojurians
clojure
I finally understand what agents are for
2017-12-10T03:56:16.000022
Martina
clojurians
clojure
generic question. Say I’m building a library and in the default namespace I need an instance of a parser. I will need this parser for every call into the library. I could have a `(def parser ...)` directly in the main namespace of the library, but for some fuzzy reason this makes me feel slightly dirty and I would feel more pure with lets say a memoized function returning the parser. Opinions? Is it ok and good style to just `(def ` things or is it indeed somehow better to keep things in functions? One difference I see is that the def gets potentially ’unnecessarily` evaluated on load. The user of my lib might elect to not call any functions in my namespace etc...
2017-12-10T03:59:58.000048
Joette
clojurians
clojure
<@Joette> Could use <https://github.com/stuartsierra/component> to avoid re-defining global variables on load.
2017-12-10T04:05:15.000032
Heriberto
clojurians
clojure
That's what was recommended to me instead of global atoms
2017-12-10T04:05:44.000031
Heriberto
clojurians
clojure
cloc dumps ttl lines, ttl white space, ttl comments is there some other tool that will dump ttl + also summaries for each file ?
2017-12-10T05:14:53.000072
Berry
clojurians
clojure
i.e. I want a table of four columns: file name, comments, whitespace, line-count // though two clumns of just filename and line-count is fine, if it's better than wc -l
2017-12-10T05:15:25.000058
Berry
clojurians
clojure
I do that. The repl starts and works for some time and then it stops working. Now I don’t seem to have that problem.
2017-12-10T07:22:51.000073
Lawerence
clojurians
clojure
`cloc --by-file`?
2017-12-10T07:27:35.000034
Noella
clojurians
clojure
or use <https://github.com/Aaronepower/tokei>, much much faster
2017-12-10T07:27:57.000070
Noella
clojurians
clojure
`tokei -f` gets you a per-file summary
2017-12-10T07:28:12.000053
Noella
clojurians
clojure
Good Morning Everybody :slightly_smiling_face:
2017-12-10T12:10:26.000007
Magda
clojurians
clojure
<@Noella>: `cloc --by-file` is awesome; thanks!
2017-12-10T13:33:07.000118
Berry
clojurians
clojure
besides fn -&gt; `\lambda` is there a standard set of "prettify these clojure keyword" setup ?
2017-12-10T14:21:55.000014
Berry
clojurians
clojure
some setups also prettify `#{}`
2017-12-10T14:23:07.000053
Kristy
clojurians
clojure
Sorry guys but I still cannot understand what those cmd line tool just released <https://clojure.org/reference/deps_and_cli> here are for. What gap did I have that they are trying to fill?
2017-12-10T14:27:50.000014
Vernice
clojurians
clojure
they are for people who have never tried clojure and want something minimal to fire it up
2017-12-10T14:28:28.000051
Margaret
clojurians
clojure
<@Sonny> pointed me to <https://clojure.org/guides/deps_and_cli>. But if I have leiningen, what do i need those for?
2017-12-10T14:29:26.000015
Vernice
clojurians
clojure
you don't, and it's not for you
2017-12-10T14:29:37.000061
Margaret
clojurians
clojure
it's for people who haven't used clojure and want a simple way to fire up a clojure repl. Or people who want something ligher weight / more targetted than lein or boot for running a repl.
2017-12-10T14:30:22.000012
Margaret
clojurians
clojure
I also get the impression that they provide an official solution from the clojure team for launching a clojure repl. Previously it was sufficiently simple to not matter.
2017-12-10T14:30:41.000071
Jodie
clojurians
clojure
in the past we could use clojure.jar for that, clojure.jar no longer runs standalone because of clojure.spec.alpha
2017-12-10T14:30:49.000083
Margaret
clojurians
clojure
Like people have a python repl
2017-12-10T14:31:43.000059
Vernice
clojurians
clojure
right, python just runs as a standalone command
2017-12-10T14:31:55.000135
Margaret
clojurians
clojure
dumb question: why does clojure.spec.alpha prevent clojure.jar from being standalone ?
2017-12-10T14:32:42.000001
Berry
clojurians
clojure
because it's not part of clojure.core, it's a separate artifact
2017-12-10T14:33:01.000096
Margaret
clojurians
clojure
so you need to construct a classpath with at least three artifacts to make it work iirc
2017-12-10T14:33:17.000069
Margaret
clojurians
clojure
you can't just 'stuff it in the *.jar" ? I thought jars were just zips/tar files and you could throw stuff into it
2017-12-10T14:34:03.000093
Berry
clojurians
clojure
<@Berry> That leads to a classpath conflicts.
2017-12-10T14:34:27.000003
Jodie
clojurians
clojure
And tools.deps.alpha?
2017-12-10T14:34:33.000077
Vernice
clojurians
clojure
deps.alpha knows how to resolve deps, that is why it is there
2017-12-10T14:34:51.000117
Margaret
clojurians
clojure
it helps construct a classpath and download jars that you might need
2017-12-10T14:35:07.000065
Margaret
clojurians
clojure
Isn't that what mvn is for?
2017-12-10T14:35:17.000137
Vernice
clojurians
clojure
but unlike lein or boot it isn't for packaging or deploying and doesn't have tooling for plugins
2017-12-10T14:35:30.000103
Margaret
clojurians
clojure
yes, you could use mvn for that, but then you need an mvn command for running clojure
2017-12-10T14:35:51.000067
Margaret
clojurians
clojure
and mvn is also a packaging and plugin and deployment tool like leiningen or boot are
2017-12-10T14:36:18.000013
Margaret
clojurians
clojure
Thanks <@Margaret> I was afraid I am missing something here.
2017-12-10T14:37:02.000022
Vernice
clojurians
clojure
is there a builtin for (magic [f1 f2 f3 f4] [x1 x2 x3 x4]) =&gt; [(f1 x1) (f2 x2) (f3 x3) (f4 x4)] }
2017-12-10T14:40:56.000116
Berry