Fork me on GitHub
#clojure
<
2018-01-05
>
ErhardtMundt00:01:58

for the records: I solved using wrap-content-type

qqq07:01:57

I'm looking at https://clojuredocs.org/clojure.core/comp in h = (comp a b c d e f g) is the idea that: a b c d e f, are all called as 1 arg input, 1 arg output g, h are both N arg input, 1 arg output ?

gklijs07:01:38

still

((comp - #(+ %1 %2))2 3)
gives -5

gklijs07:01:54

so the last one seems to allow multiple arguments

Vaagn Khachatryan07:01:42

yep, the last one in the chain can be a multiple-arg function

nicoschneider11:01:57

hi everyone, i have a question regarding app auto-updates, plugins/modules and the like. i’m working on a web application code base for a client, several projects will be based on it, and i’d like to add auto-updates and a plugin/module system to it. i’ve heard about OSGi but i’m not sure it’s a good fit for either me or clojure. any pointers/advice?

yogidevbear12:01:03

I think @U04V70XH6 may have some valuable insights into OSGi and whether it's okay or whether it has particular pitfalls. He should be online in a few hours time.

nicoschneider12:01:40

Thanks! In particular, I wonder about the warnings I read when googling this concerning the “classloader interference” and the “large impacts” on my “application architecture”

yogidevbear12:01:25

The CFML (ColdFusion) community have an open source server called Lucee which was rebuilt in the latest major release to make use of OSGi and it caused some edge case issues when trying to deal with certain aspects of Clojure from within a CFML project so it may be completely irrelevant to your questions, but Sean understood the issue in better detail than I could explain it.

nicoschneider12:01:35

I’ll try to find it, thanks again. I hope this Sean you mention has a minute or two to spare 🙂

yogidevbear12:01:18

He is generally very generous with his time 🙂

lilactown15:01:52

hey all, I’m trying to figure out a good API for defining AWS Lambda functions

gonewest81818:01:31

btw there is #aws-lambda for questions along these lines

lilactown15:01:02

the java8 host expects that there’s a class that implements com.amazonaws.services.lambda.runtime.RequestStreamHandler which has a single handleRequest method

lilactown15:01:58

my dream is to expose a single fn that one can just do

(deflambda my-fn [request] "Hello")
and it would generate the class. but I’m guessing that a function won’t suffice, since in order to gen-class the correct class, it needs to be known at compile time?

hansw15:01:25

I think you need to implement that Java interface with reify

hansw15:01:02

But on second read of your question I think you already knew that 🙂

lilactown15:01:23

:thinking_face: I’m not familiar with reify, but from the example it looks like there’s some ceremony involved to load and invoke the Clojure namespace

gonewest81818:01:14

I’ve heard about portkey also, but never tried it. https://github.com/portkey-cloud/portkey

schmee15:01:26

looks very similar to what you’re trying to do, if you don’t want to use the lib directly you could probably at least get some good ideas from it 🙂

lilactown15:01:43

ahhh that is doing exactly what I want 😅

lilactown15:01:21

yeah, I see. they’re using a macro to generate the gen-class. was hoping to avoid macros but c’est la vie

lilactown15:01:19

I’m a clojure newbie so I figured I should stave off the urge at least for a bit 😛

schmee15:01:18

don’t! macros are great and you should absolute learn how to use them

schmee15:01:27

but it’s equally important to learn when not to use them 😄

lilactown15:01:37

one thing that is interesting… I looked at lambada yesterday and dismissed it because it hasn’t been updated in ~2 years. but looking at the code, it looks still valid

lilactown15:01:08

coming from other mainstream languages, anything that hasn’t been updated in a year is invalid 😛

schmee16:01:16

yes, that is something you have to adjust to when using clojure

schmee16:01:37

Clojure and Java take backwards compatibility very serious, unlike some other mainstream languages

schmee16:01:44

hence, there is less churn in Github repos and things that worked a couple of years ago tend to still work

nicoschneider16:01:55

is there a version of (satisfies? P x) that requires an implementation of all methods from P by x?

schmee16:01:13

wait, can you partially implement a protocol?

ghadi16:01:24

you can, but it’s undocumented (and generally signals a design issue)

schmee16:01:59

whoa, had no idea

schmee16:01:12

is that a bug?

ghadi16:01:16

stay oblivious

ghadi16:01:02

I don’t think it’s a bug

schmee16:01:47

one of the few places where Java gets it right and Clojure gets it wrong…

vemv16:01:59

perhaps Rich wanted us to avoid implementing methods which body consists of (throw (NotImplementedException.)), which happens ocassionally in Java et al

nicoschneider16:01:48

I think the reasoning is largely the “open vs. close” debate, like in spec when it comes to validation (open maps)

nicoschneider16:01:45

Should be achievable with reflection although I’d like to avoid any hacky business, hence my question 🙂

schmee16:01:46

ahh right, to avoid breaking existing implementations if you add new methods to the protocol

vemv17:01:23

one could argue that that's what (semantic) versioning exists for, but then again Rich opposes that

vemv17:01:54

don't particularly agree/disagree, time will tell if these ideas really triumph?

mjo324_5619:01:00

@noisesmith I 3 days ago I asked you a couple of beginner questions about serving json. I did not understand your suggestions at all then. I do now. After reflecting about it (and after reading the docs of ring) I finally understand everything, my problems are gone and I became a better person. Thank you so much!

sveri20:01:38

I just read the announcement about git deps. I have heard of it first when go used that as dependency mechanism and have always been sceptical about that. I think this introduces some risks like, what if I refer to a certain branch that gets deleted, or a tag / version. Or maybe someone deletes its repo or maybe moves it. I guess there are some more risks about dependencies vanishing. Does someone know if this is a problem in the go world? Of course I could clone every repo I use as a dependency, but do I want that? Surely not.

hiredman20:01:13

the feature isn't there yet as far as I know, just something interest has been expressed in, so it is hard to critique it

hiredman20:01:56

in general maven works pretty well, but some artifacts still get deleted or a given version is overwritten by a different jar from time to time

hiredman20:01:14

as a result most organizations of any size actually run a caching proxy maven server of some kind

hiredman20:01:53

(so something for git would help deal with the similar issues there)

mpenet20:01:12

Worst case you can just fork repos and control this, it s way easier than publishing on maven

hiredman20:01:42

(if you are part of a large organization that is not running some kind of caching proxy maven server you should look in to it)

bronsa20:01:00

the feature is just out

hiredman20:01:16

oh, look at that

sveri20:01:19

@hiredman I am and we do run our on artifactory. I am talking more about myself when I do my side projects and dont have my own artifactory available.

hiredman20:01:58

it looks like the write up says it checks out the repo so it sounds like you will have a back of ever repo+branch you depend on

hiredman20:01:42

the write up doesn't talk about transitive deps for git

hiredman20:01:21

but it looks like maybe it supports deps.edn, project.clj, or pom.xml

hiredman20:01:42

(which can't have been easy to support)

sveri20:01:31

most build tools do cache 🙂 @alexmiller I am pretty sure you discussed the disadvantages and wonder what your conclucions were? Also, how are transitive versions, that are different, resolved?

hiredman20:01:04

there is a #tools-deps channel too

Alex Miller (Clojure team)21:01:03

@hiredman it currently supports only deps.edn but is designed to support others as they are available. I have spent some time on pom and as expected it’s truly awful to use the apis for this. so it’s not done yet. lein is kind of a pain as there is no api to just read a project.clj and get its deps other than naively reading it as if it were data (which certainly won’t always work)

Alex Miller (Clojure team)21:01:04

@sveri it’s git - commits have a relationship. if multiple revs are applicable, the “most descendant” one will be used. if there is no lineage relationship, then this is an unresolvable conflict and your classpath can’t be computed (and you’ll get an error). note that this relationship can even work across forks, because git is awesome. :)

Alex Miller (Clojure team)21:01:21

additionally, most maven artifacts contain the git url + rev when they were created so you can also compare versions between maven and git deps, but I have not actually added that yet

sveri21:01:39

@alexmiller Thanks, I did not know that this even works across forks. Interesting.

pyr22:01:38

I have a dependency free library on github and while trying to pull it with the new deps.edn feature I'm getting the following error:

pyr22:01:59

> Error building classpath. Manifest type :lein not loaded when finding deps

pyr22:01:27

I pushed a pom.xml generated by lein pom but to no avail

pyr22:01:39

pulling data.csv just as in the example works

bronsa22:01:02

that's because ATM you can only load libraries that have a deps.edn

pyr22:01:01

I was looking for the file which enabled this, thanks (should've been obvious)

Alex Miller (Clojure team)22:01:17

you can get around this in the dep by forcing a deps manifest

Alex Miller (Clojure team)22:01:32

{:git/url .. :rev … :deps/manifest :deps}

Alex Miller (Clojure team)22:01:49

it should be tolerant of the deps.edn file being absent

Alex Miller (Clojure team)22:01:03

and treat it as an empty deps.edn

Alex Miller (Clojure team)22:01:35

or of course by adding an empty deps.edn to the dependent project

Alex Miller (Clojure team)22:01:27

by default it tries to autodetect the manifest type and it finds the project.clj but doesn’t have a reader for it (yet)

Alex Miller (Clojure team)22:01:17

I should probably change that to just not auto detect those types yet

michaeldrogalis22:01:43

@alexmiller The deps.edn changes are great -- thanks to you/Rich & the rest of Cognitect. I've been doing some crazy things with lein-voom and scripted repo downloading to achieve the same effect for keeping Onyx and it's ~20 sub-projects all tested against each other. This obliterates so much terrible plumbing.

pre23:01:54

deps.edn is a game changer, thanks @alexmiller

Alex Miller (Clojure team)23:01:55

I most like that it’s decoupled from clojure so we can release stuff all the time :)