Fork me on GitHub

It very well might make sense for one or more third-party REPLs to have code to try to avoid consuming some part of the input after an error occurs. The potentially tricky part is determining where in the input to start consuming input again.


does pREPL run into the same problem? I don't know what pREPL solves that nREPL doesn't (I've only taken a cursory look) but I thought part of its intent was a more structure input/output to avoid such confusion


nevermind, I should really just answer this myself by digging into it


prepl is still going to have the same underlying issue which is that if reading code hits a parse error, the unread code is essentially unknowable, so it can only start to read again at the point where the parse error caused reading to leave off...


As Andy said above, the hard part of this problem is determining what unread input to throw away before parsing should resume. You could probably come up with some heuristics but pretty much any strategy you pick is going to be "wrong" in some situations...


@seancorfield gotcha, thanks. I could see a way of structuring the inputs to make it possible by allowing the inclusion of, basically, instructions/hints on this, but it would be a lot to include for that kind of thing without adding a lot of overhead


Not really super clear from looking at the docs


how would I implement a time based cache using core.cache


(looks like memoize is what i want - ignore me)


(core.memoize, not regular ol memoize


i need a clojure.core.memoize/ttl that will clear expired on a hit


ill just hack it


Should I use clj or clojure? Today I saw: Please install rlwrap for command editing or use "clojure" instead. So there is a difference.


oh I see, clj is wrapper on clojure with rlwrap


hmm what is preferred way to download deps only? like lein deps? For example I want deps for clj -A:test:test-once, but I don’t want to run it. I need it to prepare docker mages.


I am afraid there is no such option 😕 ?


clj -Sforce < /dev/null

👍 8

So for example clj -Sforce -A:test:test-once?


or does it download deps also for aliases?


no you have to specify the alias


so I have to run clj -Sforce ... with all aliases


~/L/M/c/s/P/f/master    clj -Sforce -A:test:test-once                                                                    3789ms  Tue Dec 18 13:05:41 2018
WARNING: var: form-validator.core/show-all is not public at line 147 /Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/form-validator/master/test/form_validator/core_test.cljs

Testing form-validator.core-test

Ran 3 tests containing 20 assertions.
0 failures, 0 errors.
hmm it actually run tests


Am I doing something wrong? It looks like it doesn’t work like only download deps


clj -Stree -A:test:test-once - maybe this one


not sure if it download when I don’t have this deps on computer


I will try soon


I want to run clojure for a few deps.edn only to download dependecies. So I have foo.edn, bar.edn etc. How to run clojure with custom named deps.edn?


I am thinking about -Sdeps, but it want string instead of file name

Alex Miller (Clojure team)13:12:12

There is no option for that


thanks, it saves me a lot of time 🙂

Alex Miller (Clojure team)13:12:24

If you want to just download deps, you can use -Spath to just build the classpath without starting Clojure


What about the best way to download deps? clojure -Spath -A:fig ? -Stree ? Something different?

Alex Miller (Clojure team)13:12:21

Either -Spath or -Stree will download without starting Clojure


Heya, not sure if this is a dumb question - in cljs, (keyword :a :b) gives :a/b where as in Clojure you get an error. Would it be a breaking change for Clojure for it to behave the same way?

Alex Miller (Clojure team)15:12:37

no, that doesn’t make much sense to me

Alex Miller (Clojure team)15:12:18

I don’t get how you go from :a as name a into a qualifier in :a/b - that seems quite weird to me

Alex Miller (Clojure team)15:12:46

I’d say it’s bad that cljs behaves this way :)


Ah ok, so if anything, it's more likely to be removed from cljs


Ah yeah, looks like the commit that did in cljs this was making keyword more restrictive; it was accepting more previously which was resulting in different hashcodes


What would be the "cljc" way to parse an instant from a string?


i'd just (Date. your-string) (not tested)

👍 4
Dustin Getz15:12:31


👍 12

Wasn't there a way to type hint directly on a Java interop form? e.g. (^ .println err "foo")

Alex Miller (Clojure team)15:12:39

you want the hint on the object (err)


OK, that's the only way?

Alex Miller (Clojure team)15:12:21

only way to do what? back up…


heh... In this case it was supposed to be *err*, and so I have to introduce a let just to type hint, and I swear I remembered there was a way to do that without the let, but I'm thinking maybe just ghost memory?

Alex Miller (Clojure team)15:12:38

(.println ^ *err* "foo") ?

Alex Miller (Clojure team)15:12:01

maybe you misunderstood what I was suggesting above…


ayup.. Thank you :)


{github-kwladyka/form-validator {:git/url "" :sha ""}} - Can I set it to always pull the last commit? Without sha? Probably wouldn’t work. I need it for testing purpose in cicd.


ok, thx again 🙂

Alex Miller (Clojure team)15:12:05

the intent is that a release points to a concrete commit so we don’t have support for tracking branches etc (which would also break cp caching, etc)

Alex Miller (Clojure team)15:12:50

the underlying tools.gitlibs library does support this (has broader intent), so it’s pretty easy to write a line or two of code that would tell you what the latest sha is


sure, just looking the right ways to do things


the simplest ways 🙂


One silly question: How do I suppress error logging when testing a case of error? I have several "SEVERE:" in my test outputs that are really bothering me.


are these things being printed out to the REPL or are you running your tests cases from the command line?


There are logging libraries that let you configure which level you'd like to print at: If you are running from the command line, then could use grep to exclude certain things from being output (might be able to do this with a REPL as well, but I've never tried it).


Not a total answer, but a random gist for logback in particular

emccue19:12:11 uses whatever slf4j thing you have behind the scenes i think


so you should search for how to configure that


(logback, log4j, whatever)


I really like logging to a file during test runs


the log file is there if you need to investigate a test failure, but you don't end up with logging in your test run


for example has a logback.xml in the tests directory which sets up logging for running tests


I came from elixir and when executing lein test I would like to not print logs from some few tests (like "@tag capture_log: true" in elixir).


Usually test runners have some tooling to capture stdout.


just don't print logs ever when running tests, have logs go to a file


is there a function that I can give a path to a file and it will give me the corresponding namespace? e.g.

(x "project/core_test.clj") 
;; => 'project.core-test


@hiredman the issue with logging to a file is that in CI you don't usually get to look at that file after your tests failed


get a better ci server


while also not perfect I like stdout to be printed if a test fails


at my last job we had jenkins setup, jenkins ran each build in a workspace, workspaces were saved and archived, and that included the log files


it was great


yeah that's nice indeed — but also requires more setup 🙂


for other ci environments you can treat logs like another build artifact and export them to where ever you export those (s3)


good devops is just amazing


but surprisingly hard/time consuming to setup and maintain.


running jenkins is not rocket science

eccentric J22:12:15

Say you’re looking at the implementation of a popular, open-source Clojure library. One function looks pretty meaty and I think it can be broken up into several, smaller functions. Would it be acceptable to make a PR to address that or does it come off as rude or nitpicky? The choice could have been made for performance reasons but I can’t quite tell.


There's only one way to find out - open a PR and be humble and clear about why you think this is a good idea. Worst that can happen is your PR gets closed.

eccentric J23:12:55

I see your point, but I chose to raise a question as an issue in a respectful manner to identify the problem and a proposed solution. I mentioned I’m happy to implement it and provided some thinking behind how I would. I think this has the advantage that I don’t have to invest time into it only to find out it got rejected and they don’t have to read through a PR if they’re not into the idea to begin with.


Big meaty functions are par for the course in my experience. Often my problem with them isn’t so much their size but their lack respect for the potential contributor. If you’re planning to make a contribution in that regard be sure that you’re improving the overall semantics of the code and not just parameterizing.

eccentric J01:12:52

True. I tried to focus on a problem that the meatiness causes — Which is that I can’t reuse the pieces of it I need to solve my problem and have to copy parts of it even though I’m already dependent on the library to begin with.

👍 4

that's the best case for breaking a function up there is 😉


You might want to ask the author/maintainer of the library their thoughts on the matter, before opening a PR.

eccentric J22:12:52

Good idea. My instinct says to respectfully create an issue about how breaking it up would be allow other people to reuse the pieces without having to reinvent the wheel. I think that will frame it more positively towards a problem doing so will solve.


Yeah, I'll often create an issue with a subject "Question: ..." and ask for their opinion on approaches, and see how the land lies before I invest in creating a PR.