This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-18
Channels
- # 100-days-of-code (10)
- # announcements (2)
- # aws (3)
- # beginners (120)
- # boot (6)
- # calva (6)
- # cider (22)
- # cljsrn (3)
- # clojure (145)
- # clojure-greece (1)
- # clojure-italy (7)
- # clojure-nl (24)
- # clojure-russia (90)
- # clojure-spec (21)
- # clojure-uk (80)
- # clojurescript (175)
- # core-async (1)
- # datomic (17)
- # emacs (8)
- # ethereum (5)
- # figwheel (1)
- # figwheel-main (140)
- # fulcro (137)
- # jobs (6)
- # jobs-discuss (3)
- # luminus (3)
- # mount (1)
- # nyc (3)
- # off-topic (39)
- # onyx (1)
- # pedestal (1)
- # re-frame (21)
- # reagent (13)
- # shadow-cljs (60)
- # spacemacs (25)
- # test-check (4)
- # tools-deps (14)
- # uncomplicate (3)
- # vim (18)
I am trying to compile my clojurescript project on my testing server, which runs debian jessie,
I just fixed it. Java 1.8 solved the issue. What is strange, is that I read that 1.6 should work also.
it depends on which version of clojure you are using, but if you are using a java library and it is compiled with a newer java version, then you will have to use that version
that error is from the jvm trying to load a class file that was generated by a newer version of javac
Thanks @hiredman. So the clojure dependency that leiningen gets is not linked to the java version installed then?
@hoertlehner No, Leiningen will use whatever your default version of Java is (although you can tell Leiningen to use a specific version of Java). It's up to you to ensure that you have the right version of Java installed (and tell Leiningen to use it, if it isn't your default).
See https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L282 :java-cmd
for how to tell Leiningen which Java command to use (and hence which version).
@seancorfield Many thanks!
is there a way to do machine-specific local overrides with deps.edn ? I want to provide a deps.edn for the repo that has some dependencies overridden for locally developed dependencies on a particular machine so I don't want those paths in the repo -- using ~/path/to/local/project
doesn't work in deps.edn
Hello! I'm always using libs for working with states in my projects and have this options in project.clj
:
:profiles {:repl {:dependencies [[org.clojure/tools.namespace "0.2.11"]]
:repl-options {:init-ns }
:injections [(require 'clojure.tools.namespace.repl)
(require ')]}}
How can I do the same with deps
?yeh that's what I'm doing
but the problem with that is you have a machine-specific path in your deps.edn which is why I'm asking how to do it without that
@octo221 I put these into my ~/.clojure/deps.edn
file, and then do clj -A:user/krei:user/pack:dev
ahah i guess you could add project-specific overrides in there yes
deps.edn
{:aliases {:test {:extra-deps {olical/cljs-test-runner {:mvn/version "2.1.0"}}
:extra-paths ["test"]}
:test-once {:main-opts ["-m" "cljs-test-runner.main"]}
:test-watch {:main-opts ["-m" "cljs-test-runner.main" "-w" "src"]}}}
Is it possible to include :test in :test-once and :test-watch?
I would like to run commands as clj -A:test-once
instead clj -A:test:test-once
.So what I am thinking is how to provide for developers all commands which they can use during developing. Documentation is not the best solution. Code should describe it.
So how to tell developers they can use clj -A:test:test-once
and clj -A:test:test-watch
with project? We can easy imagine there is 15 commands like this in project.
@kwladyka I've been using namespaces to suggest hierarchy. Similarly to you, but replace -
with /
Given that it's just data, you could use a tool to automatically update aliases based on a convention?
Read in the edn, merge :test
with all aliases starting with :test/
and spit it out (with pprint)
But the question on the end is how to show developers (also new guys in team) which commands they can use during developing. Imagine we can use 15 commands. Reading :aliases will be a mess. I feel it should be something more. I read one article about use make foo
(old good linux command make
) instead as knowledge base of all commands in project. First I thought it doesn’t make sense, but I see value of it.
I think an enhancement to list available aliases in clj would be interesting
but probably would not go as far as you want
I am thinking about something which let also add commands to compile third party code which is in different language, but library in cljs use this code. Run extra services for developing like fake servers. So it is not only about aliases. Well this commands could be set in deps.edn maybe, but there is no way to determine which commands make sens for developers. Like -A:test:test-once
make sense but not -A:test-once:test-watch
. -A:compile-solidity:build
make sene, but -A:compile-solidity:foo
not. It needs to be something which developers can set manually.
On the end it has to be out of the box. So it should be possible to use it in docker-compose run
or whatever.
Just I would like to use something better than documentations. There are always secret commands. I would like to describe developing process on local machine by code, not documentation.
But in very clear way, without extra lines which are not really developing process, but project configuration
like developer can open project and see, he can do actions:
- test-once
- test-watch
- compile-solidity
- ganache-cli
- ipfs
etc.
the best with short description and call foo test-once
, foo compile-solidity
etc. things to run commands not only with clj tools, but third party app, compilers etc.
make
in theory should satisfy this, but I feel it is not right tool for this job. I mean it is not purpose of this tool.
It is good direction, but still I feel it is not right tool by intention of this tool
we’re not interested in adding this kind of capability within clj, but these are fine things to add as external programs and in fact, some of them have already been done - https://github.com/clojure/tools.deps.alpha/wiki/Tools
Sure. It is more question to developers and share experience, than suggestion to implement in clj.
well that’s possible with a completion script and would be cool
First I wanted to try :aliases as knowledge base of commands. But I realise it is too complex, and there are things like clj -A:test:test-once
or clj -A:test:test-watch
with different combinations. Too much thinking about it. It is not clear. So I am not sure….
Maybe make test-once
, make test-watch
etc.
Thinking about make
like about knowledge base for project.
But I would like to not use make
probably. Not sure why. But I don’t have better idea.
If you're only trying to list aliases which have a :main-opts
, and use a naming convention to know about it's dependencies you could:
- read deps.edn
- get the aliases
- filter to those with main-opts
- automatically add the conventional other aliases.
no, I am talking about all commands. Also things to compile code in different language which is dependency for project etc.
I would like to make new developers coming to project comfortable, make things clear
@kwladyka if you're also merging in information from outside deps.edn, you'll need to factor that into any designs you consider.
yes and the question is what is the best practice about it. Documentation is far away from perfect.
Hello, guys! May you help me... I'm starting to use https://github.com/lancepantz/clj-yaml... and, different from the examples was showing, what I get after doing a "parse-string" is a #ordered/map
, instead of a "plain" clojure map. Am I doing something wrong?
@kwladyka I like the concept of the makefile. It's well-known and would allow more flexibility as a wrapper around the clj
tool. Exposing the uses of the tool could be done typically in the README.md file, and maybe a helpful command in the makefile like make help
New developers know about makefiles as well, and the only takeaway of not really being windows-compatible is already an issue with clj
anyways
@gleisonsilva there are more up to date forks fyi
in fact, i'm using circleci/clj-yaml
that is a fork of that one
that said ordered map behaves like a normal map, it's just ordered, it should be an impl detail for you
is kind a inconvenient
but I just found an function that turns it in a "more natural clojure map" -> https://github.com/hashobject/perun/blob/ca090ca77a3aac18b4ff0ac330febb88c26cab84/src/io/perun/yaml.clj
in this code, there is a norma-coll
function that is very handy
tks anyway, @mpenet
@benzap yes, I would like to have one place with all commands like run ganache-cli, compile Solidity, run tests, run ipfs and all stuff in one place. But I have never seen somebody to do it in makefile 🙂 I am not sure it is good idea or bad. makefile / doc / ?. I don’t have better idea how to do it at that moment.
An alternative approach would be to create components (or mounts) as services to start as part of the development cycle. These could then be stowed away as a separate set of libraries that could be included in the projects
You would have one point of entry, you would have a standard dev workflow that would need to be configured, but if need be, it can be changed by providing your own custom set of mounts
That is the thing which I would like to avoid. REPL should’t assume there is solidity compiler installed on machine. What if not? Then it will crash.
or maybe project tools during developing will be run as docker-compose up
to run ganache-cli, ipfs etc. I believe this things shouldn’t be implemented in clj
those things would need to be worked out in the mount component, and it would only be exposed as a dev dependency
An interesting method I saw was the use of an elisp script included with the project for opening each process as a separate buffer, but then people would be forced to use emacs for development
For my research project of my computer science studies I am currently developing a new static code analyzer for #clojure . The tool is to detect issues (bugs and code smells) of the program code and warn the developer before run time. Participate in my short survey to co-determine the upcoming features of the tool! https://goo.gl/forms/I1xne7cpIx7NuMT43
Daniel Compton says in the latest REPL "Make sure you're not drinking anything when you read Just JUXT #34. I won't spoil it for you here." – I read it and it seems to be a straightforward solution for 4Clojure problem. Am I missing something?
I was just thinking the same. Cool solution, but no drinking problems.
To me it seems wrong to have UI (Cljs) and Back-end (CLJ) in the same leiningen project. But without it I get problems with the session. Is it possible to run them on the same port even if its two different projects? - using leiningen.
how would two servers serve requests from the same port?
also why would they need to share a port? wouldn't the back end just serve up the html generated by the cljs project?
(plus the js generated of course)
Im getting problem with Session and Ring
problems*
What kind of session store are you using? If you have endpoints that are defined wrong it's easy to overwrite the session with empty data. I find it's easiest to debug this by using an atom as an in-memory session store and an add-watch
to show changes to the contents
using immutants session store atm. It works fine from Insomnia, gonna try the atom in-memory session store and see if I find anything.
the default session store impl is an atom, you might have to override and provide your own atom to access it directly
yeah its still an atom* i think
Figwheel runs on 3349 and my api on 3000 hmm. Might be some chrome issue I guess
I want to share a (ephemeral) atom
across instances, like faraday-atom
, but it has a "huge" (larger then 400kb) payload.
Are there other options?
there was a project, long ago in the before time, that made an atom like type stored in zookeeper, called avout
there is atoms@zookeeper
for clojure too, but not sure if is good to store "huge" data on it.
as we dont have postgres, I'm planning to make a new database on datomic and store it with no-history (maybe delete/recreate the database sometimes)
I sometimes wonder if it is intentional that sorted-set
does not take a collection like set
does. I fall into this whenever I try to use sorted sets: you have to use apply
.
I think sorted-set
is more like hash-set
in this regard. vec
and vector
are different from each other in a similar way.
Not sure if this is a great mnemonic, but the shorter names take collections: set
vec
. The longer names take varargs.
Yes, that is a good mnemonic
I don't claim to know all the rhymes and reasons, but I've found that the more I look, there are very few if any accidents in the clojure.core API design.
that would make sense if (apply sorted-set col)
produced the same result as (set col)
or if there were an equivalent short-hand for sorted-set
, but...
the only way I know of to get a sorted set from a collection without apply is into
. unless I'm missing something (very possible)
That is preferred way
see also PersistentQueue which can only be constructed via interop and doesn't print readably
(but it's a very useful datatype)
Hello 🙂 I could use someone’s brain on a little problem I have. I can’t quite figure out how to say it in English so I’ll start by giving an example. I want to write a function which has the following behaviour:
; Input:
#{(range 0 6), (range 3 8), (range 4 11)}
; Output:
#{[(range 0 3), #{(range 0 6)}], [[3], #{(range 0 6) (range 3 8)}], [(range 4 8), #{(range 3 8), (range 4 11)}], [(range 8 11), #{(range 4 11)}]}
Basically, I want to write a function which takes a bunch fo ranges and returns all the n-ary intersections of ranges, together with a list of the ranges overlapping that intersection
I could of course write this is a few “dumb” ways, but I am looking for an elegant solution
https://en.wikipedia.org/wiki/Segment_tree might be a good place to start
So if there are N ranges in the input, and all of them have non-empty intersections, the output should have 2^N-1 items in it, since every one of the 2^N possible subsets of the N ranges have an overlap?
(well, all except the empty subset with no ranges, hence the -1)
Although I would guess that if you want them all, then you are probably expecting that your inputs will typically not have that much overlap between them.
@hiredman oh thanks, but my problem won’t actually use range; I just used it to try to get a simple example to explain the problem
@andy.fingerhut correct. To give you some context, my input will be a collection of date ranges (think of “bookings” on an airbnb-like application)
but regardless of the computational complexity, I am wondering if there is a neat way to formulate a solution to this problem functionally.
One nice short bit of code would be (filter non-empty-intersection (all-subsets my-ranges))
, where non-empty-intersection
is a function you would write to take a set of ranges, and return true if they have a non-empty intersection, or false if their intersection is empty. all-subsets
takes your N ranges and returns all 2^N subsets of the input collection. The all-subsets
function is called subsets
in its implementation in the math.combinatorics Clojure library here: https://github.com/clojure/math.combinatorics
Such an implementation would be straightforward to write, I think, but would always take 2^N time, even if the number of non-empty subsets was much smaller, because it would call non-empty-intersection
on all 2^N subsets.
A potentially huge optimization on that would be a different version of all-subsets
that, whenever non-empty-intersection
returned false for a set of ranges, would skip generating any sets of ranges that included those ranges as a subset. I don't know of a version of subsets
that does that off the shelf.