clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
2020-09-12T01:15:35.276700Z

bind is in some Clojure library somewhere? I don't know what the #{a} m part is supposed to do, but it doesn't quite look like legal Clojure destructuring syntax.

👍 1
emccue 2020-09-12T01:45:18.277100Z

i just made that as a macro specifically so that would work as destructuring syntax

emccue 2020-09-12T01:45:30.277400Z

it just expands to {:keys [a]}

2020-09-12T08:26:44.288300Z

Hi all, I work at a rather large company that has very restrictive rules about open source which unfortunately makes it impossible for me (and my colleagues) to use Clojure in production. For some reason the legal departement has decided that it is not ok to distribute software to customers that contain components licensed under EPL 1.0. I am not smart and/or interested enough to understand the implications of the license but I trust Rich more than I trust the knowledge of software in our legal department so I am not arguing any change in license for Clojure. What I am wondering is if there is anyone that has been in a situation like mine and if so what I can do about it, are there any arguments that I can bring to the legals or is there some other way to tackle this? I have reached the point at which I really don’t want to continue programming using (in my view) inferior tools and if I cannot start using Clojure I might have to look around for another job. @alexmiller does Cognitect have any strategy to help or give guidance in cases like these?

practicalli-john 2020-09-23T09:50:51.020200Z

@amorokh Do you have to ship the Clojure library along with your product? Can the product simply download the clojure library as part of the install on the clients site? Then you can use what ever license you like for your own product (which I assume you do anyway). If you are not distributing Clojure then its license is not an issue. Licensing is another reason to build services rather than installed products.

2020-09-24T18:07:46.062500Z

@jr0cket Thanks for your response! However, I am not in the position of deciding how our products are delivered so unfortunately downloading the Clojure library is not an option since we are delivering docker containers running in a very restricted environment (i.e. not internet connection). I realize that distributing the library makes the license an issue (apparently), however, legal seems to think that EDL (Eclipse Distribution License) is ok and I would really like to understand the difference here. Unfortunately I have not yet received any feedback from legal about their reasoning regarding EPL.

dominicm 2020-09-12T08:54:33.288700Z

The EPL was chosen due to it being enterprise friendly! Seems like a mistake has been made.

2020-09-12T09:05:59.291700Z

Yes, that’s exactly the point, however I think that for me trying to argue with legal is a dead end, so I am looking for advice

wegi 2020-09-12T11:25:00.294100Z

Is it intended that s/keys always checks all keys, even when they are not explicitly mentioned in :req or :opt? Example: (s/def some-spec (s/keys :req [:foo/bar :bar/baz])) Now somewhere else a spec for :example/key is defined. Then if :example/key is present in a map that is checked against some-spec it is checked as well.

mpenet 2020-09-12T11:38:59.294400Z

Yes

mpenet 2020-09-12T11:40:26.295200Z

The docstring is quite explicit about that

wegi 2020-09-12T11:50:29.295700Z

Thank you, I found must have overlooked that explicit part.

alexmiller 2020-09-12T12:12:48.296800Z

I don’t think either I or Cognitect is in a position to give legal guidance. What are their objections?

2020-09-12T13:29:37.300100Z

I don’t know, in this big company the distance between different parts of the company is very large and the desicions regarding OSS has been defined globally but I will try to get some more detailed information

emccue 2020-09-12T17:42:17.300600Z

If I had to guess the policy was set based on the assumption that programmers are not experts enough to evaluate the licenses that code is released under and maybe legal aren't "experts enough to make sure that the code is all under the right license"

emccue 2020-09-12T17:42:52.300800Z

So if you want to make some headway, my best guess is that you should talk to legal and help them work out an approval process that works on a case by case basis.

emccue 2020-09-12T17:50:45.301200Z

Plus, you definitely use open source software already to some degree if you use any programming language

emccue 2020-09-12T17:51:03.301400Z

so they had to have done their legal due diligence at least once

2020-09-12T18:31:08.301600Z

Yes we sure do use open software, however so far nothing licensed under EPL 1.0 so the issue as I see it is that our lawyers have a different understanding of that particular license than the rest of the world

zackteo 2020-09-12T21:34:00.304700Z

Hi guys, to preface this, the qn i'm asking is a coding task I need to complete to register to an event. I think I could have worked it out with Python but they listed Clojure as one of the languages so I wanted to give it a shot ... Given an array of integers, return the smallest set of indices of numbers such that they add up to a target number. You may not use the same element twice.            Examples:            [1,2,6,3,17,82,23,234] -> 26            Solution [3,6]              [1,2,6,3,17,82,23,234] -> 40            Solution [4,6]              [1,2,6,3,17,82,23,234] -> 23            Solution [6] So thus far only have the backbone of what I would want to do. So far have done sorting and filtering out the numbers that would be too high

(defn foo
  ([ls target] (let [new-ls (filter #(> target %)
                                    (sort ls))]
                 (foo (butlast new-ls) target (last new-ls))))
  ([ls target sum] 
   
    (list ls target sum)))
I was thinking a naive way to solve this would be to iterate through the remaining elements from the back. In the case of 1 2 3 4 5, would 5. So there's a path where you try 4+5, 3+5, 2+5, 1+5. And if it exceeds the target you ignore it. if it is lower, and there are still elements before that you iterate through those. I'm not really sure how I can express this with maps and perhaps making use of multi arity functions for recursion I just realised that I still need to make sure the solution is the smallest set possible .... Anyone has any thoughts or is Clojure not too great for such tasks?

2020-09-12T23:16:53.307700Z

Sounds like you got to work out an algorithm for it first. Nothing Clojure can do before that 😝

zackteo 2020-09-12T23:56:20.309700Z

Right I thought that naive way was kinda an algorithm but I think you got me to find something. Shall try working with that first! :)