Fork me on GitHub
#clojure
<
2019-08-12
>
ahungry00:08:46

What's a good alternative to luminus (ideally that has a lein template) that is perhaps more light weight? I'm noticing on a brand new luminus project, just a lein test takes 30 seconds to execute the stub test

Silenced Ego01:08:42

@m131 shadow-cljs

seancorfield01:08:30

@m131 Depends what you mean by "alternative to luminus"... If you want something lightweight, you could start with lein new compojure lightapp

seancorfield01:08:50

(I tend to recommend folks start with bare bones Ring, Compojure, and gradually add the libraries they need as they understand each piece... Luminus has a lot of moving parts to understand)

ahungry01:08:49

thanks all - I'll give them a look

murtaza5205:08:54

what is the difference between s/map-of and s/every-kv, both have similar usages ? The doc string for map-of says - Unlike 'every-kv', map-of will exhaustively conform every value. What does this mean, will not every spec apply exhaustively anyways ?

seancorfield05:08:33

@murtaza52 What is s/reduce-kv? Did you paste the wrong function there.

murtaza5205:08:15

@seancorfield thanks, have edited the question

seancorfield05:08:37

Ah, you mean s/every-kv? OK, that's like s/every which says "Note that 'every' does not do exhaustive checking, rather it samples coll-check-limit elements. Nor (as a result) does it do any conforming of elements."

seancorfield05:08:19

So every and every-kv check a sample of elements (useful for large collections where you want a sanity check, but don't need all the values conformed), whereas map-of and coll-of will both check the entire collection and conform all the values. That might not work for very large (or even infinite) collections.

seancorfield05:08:38

@murtaza52 If you're working with very large/infinite collections, the overhead of validating and conforming every single element is going to be really large.

murtaza5205:08:27

@seancorfield thanks, that explains it.

David Pham05:08:54

@seancorfield would you recommend to start a new project with next.jdbc or go with the standard version?

jaihindhreddy05:08:30

next.jdbc is the standard thing now. Less baggage, more performance.

seancorfield05:08:53

next.jdbc is the "next" version of clojure.java.jdbc so I'd recommend using it instead of c.j.j at this point.

David Pham05:08:16

Ok! Thanks :)

seancorfield05:08:28

c.j.j will continue to get bug fix updates but that's about it. next.jdbc is where all my effort is focused now.

seancorfield05:08:42

And feel free to ask in #sql if you have any Qs.

David Pham05:08:09

Thanks a lot for your help.

seancorfield05:08:34

I'm traveling a bit over the next week so be patient if I'm slow to answer. Hmm, 07:36 where you are? Europe?

seancorfield05:08:54

If so, I'll actually be on your timezone next week ๐Ÿ™‚

Lennart Buit05:08:05

7:36 is UTC+2 (amsterdam, berlin, paris, โ€ฆ CEST)

seancorfield05:08:57

Ah, I'll be in the UK so... close...

Silenced Ego07:08:27

In spacemacs, does anyone know the correct way to cancel a leader/space-bar command? Esc is kinda working but it also displays a message SPC ESC is undefined

jumar07:08:55

there's also standard C-g but it has the same effect. However, I would just ignore that message ๐Ÿ™‚

Iwo Herka08:08:06

Is there any consensus on how .edn should be formatted? Does any style-guide exists perhaps?

andy.fingerhut08:08:33

If a person is not going to be examining it, then one big long line is reasonable.

andy.fingerhut08:08:07

If a person is going to be reading it, there are various pretty-printers that can be used, although they might not produce exactly the format you want, e.g. clojure.pprint/pprint, fipp, and a few others.

andy.fingerhut08:08:55

You must be cautious with the pretty printers to avoid using options that many of them have to eliminate part of the data, e.g. when a vector or list is very long, or the nesting of data goes more than N levels deep.

๐Ÿ’ฏ 1
Iwo Herka08:08:48

I see. Thanks for the heads-up ๐Ÿ™‚

Santiago10:08:48

any examples of usng google drive with clojue? found the google-apps-clj library but seems to be unmaintained

murtaza5210:08:04

On running the following code - (r/foldcat (r/mapcat prepare-event events)) 1) When (count events) ->100, the above code returns a data of type of java.util.ArrayList 2) When (count events) ->1000, the above code returns a data of type of and the above behavior is breaking my code, why would it return different types depending on if the data was parallelized or not using the r/cat combine fn ? Shouldnโ€™t it always return realized data ?

jahson10:08:04

@murtaza52 How it is breaking your code?

Benny kach11:08:04

Hi, i have a problem that im struggling to solve. Any help will be much appreciated. I want to navigate inside a map. The map has :content key that its value might be a collection of string (that i want to extract), or a collection, this collection may contain maps with :content key as well that i want to iterate on each one of these maps (probably recursively) and extract the :content value (when its a collection of strings and not a map).

Benny kach11:08:33

i tried to use specter but its API is kinda hard to understood

Benny kach11:08:00

clojure.walk might be handy as well but my attempts were unsuccessful

valerauko11:08:47

I can't seem to catch exceptions within a map. Is this expected behavior?

user=> (try (map #(/ % 0) [1]) (catch Exception e "what"))
Error printing return value (ArithmeticException) at clojure.lang.Numbers/divide (Numbers.java:188).
Divide by zero

valerauko11:08:05

Without the map it works "normally"

user=> (try (/ 1 0) (catch Exception e "foo"))
"foo"

valerauko11:08:49

I've confirmed this happens on 1.8 and 1.10...

hiredman11:08:24

Map is lazy

valerauko11:08:51

indeed. makes sense.

murtaza5211:08:42

@jahson Initially when I wrote the code I tested it with a small dataset, and the code worked. However when I tested it with a larger dataset, it started throwing an error, bcoz the above snippet was returning an object while the expectation was a seq.

murtaza5211:08:10

@bennyk you can map your fn over the hash-map, and then recursively call the fn based on the value of the :content key.

jahson13:08:04

@murtaza52 Yeah, I'm trying to understand what is causing that error because according to https://clojure.org/reference/reducers > To produce an output collection, use clojure.core/into to choose the collection type or the provided r/foldcat to produce a collection that is reducible, foldable, seqable, and counted.

murtaza5216:08:02

In a clojure.core.spec is there a way to define relationship between two keys ? I have a hash-map which contains 2 dates, and I want to specify the relationship between them.

murtaza5216:08:53

It is needed for generating test data, as my logic fails when the relation ship between doesnt hold true.

benoit16:08:52

@murtaza52 You can "attach" any predicate on a s/keys with a s/and but you will have to write your own generators to ensure the property.

murtaza5217:08:24

@me1740 thanks, that worked

David Pham18:08:52

@seancorfield I am from Zurich :) I wish I will be able attend a Clojure conference soon to meet everyone. I have never been happier working while working with a language, itโ€™s tools and community:)

clj 4
cider 1
alpox20:08:01

@neo2551 hi! You are the first Swiss I hear about who uses Clojure! :)

David Pham21:08:22

@alpox it is a big honor :) but I think many use it, the issue are companies here are not extremely risk seeking for IT

David Pham21:08:43

I think 3/4 companies in the list who advertise using Clojure are in Switzerland

alpox21:08:54

I must have missed that! I guess I should lay my eyes on them when looking for a job ๐Ÿ™‚ I'm from Andelfingen btw. (Kanton Zรผrich)

David Pham21:08:12

I sneaked Clojure in mine: they wanted me to build a web app with R Shiny/Python Dash, and I said NO WAY (been burned before by R Shiny)

David Pham21:08:36

So I got a white card to use CLJS

alpox21:08:41

@neo2551 way to go! ๐Ÿ™‚

David Pham21:08:58

I am in Zรผrich :) if you work there we can definitely meet :)

David Pham21:08:18

The companies using Clojure are

alpox21:08:26

@neo2551 Thanks! I save these gladly to the side and consider them in my job search ๐Ÿ™‚

David Pham21:08:06

Hahah good luck :) I wished we could become a hub like London

David Pham21:08:40

Clojure needs a push to make it first class language for data analysis as well

alpox21:08:58

Thanks ๐Ÿ™‚ It would be dream-like to find a job with clojure. Its so much nicer to work with than say JavaScript which I did for the last year. (Any more) I would also welcome if more used Clojure for things like ML, DataScience and similar to compete a bit with python ๐Ÿ™‚

chrisulloa21:08:35

are you guys volunteering to make data science libraries for clojure?

David Pham21:08:43

I think we will have to reuse python

David Pham21:08:59

I think I might invest some time with the libpython-clj

alpox21:08:19

@christian.gonzalez I maybe would, if I had more experience in that field (And with clojure) ๐Ÿ˜„

๐Ÿ˜ 1
David Pham21:08:40

This is a wrapper around pandas

chrisulloa21:08:23

there have been discussions on here about whether clojure actually needs a dataframe library like pandas

David Pham21:08:34

I want to do some benchmarks to see the performance and if the price is not to high letโ€™s check for other wrapper like scikit

chrisulloa21:08:47

given how easy it is to filter/transform/etc. hashmaps as rows

David Pham21:08:01

I like pandas for its time series functionality

David Pham21:08:27

And also it is slow to perform operations on sequences of maps

David Pham21:08:41

Like x+y on data frame

chrisulloa21:08:08

yeah i guess it doesnโ€™t have to be maps

chrisulloa21:08:33

but thatโ€™s a good point

alpox21:08:52

I heard about Neanderthal and wondered if this or some other library in Clojure can compete/replace Numpy in Clojure?

David Pham21:08:08

I tried to reimplement time series with ordered maps, but the issue is you can almost never get to add matriciels

chrisulloa21:08:31

neanderthal is supposed good for matrix operations like that, was going to mention that too

David Pham21:08:43

Replace Numpy yes, for sur (especially with the ClojureCuda)

chrisulloa21:08:00

you can even use cuda with neanderthal

David Pham21:08:02

But matrix operations is only a really small part of the problem

alpox21:08:22

Sounds great! (Well not for my AMD-Graphics tho) ๐Ÿ˜„

David Pham21:08:41

(Nรฉandertal also supports OpenCL)

๐Ÿ˜ 1
David Pham21:08:00

I wondered if you could port this into Clojure)

alpox21:08:22

Maybe I gotta play around with neanderthal a bit sometime

David Pham21:08:23

Neanderthal relies on JCuda for porting the cuda libraries

David Pham21:08:47

So you have access to the standard package but not these ones.

David Pham21:08:51

Moreover, dragan (the author of Neanderthal) mentioned he could port cuDNN (cuda for Neural nets) into Clojure.

David Pham21:08:41

It would be great, but then do you also get all the supporting tools like tensorboard, or what not from MXNet/Pytorch/TF

alpox21:08:33

I see the landscape in the datascience field is growing in clojure ๐Ÿ˜„ I'm happy to hear that!

David Pham21:08:03

I think there would be a utility of cuDNN bindings in Clojure but more realistically we would might start as a symbiotic language

David Pham21:08:27

Maybe with less interop than with JVM and JS

David Pham21:08:39

But at least a way to reuse python libraries.

David Pham21:08:09

For the data science field, we would need a community effort to have monopolistic framework (yes framework) that would centralize all the effort, this is what the data science channel is trying to achieve

David Pham21:08:19

But this is only my honest opinion :)

alpox21:08:30

I wish them the best luck with it ๐Ÿ™‚ I got stuck in the webdev field until now - maybe I find a way into DataScience some day. With a bit of luck ๐Ÿ™‚