Fork me on GitHub
#clojure
<
2019-09-01
>
borkdude05:09:29

since yesterday evening I've got an issue with deploying to clojars: https://clojurians.slack.com/archives/C0H28NMAS/p1567315973001400 anyone know what's going on?

skuttleman05:09:29

I don't know what's going on, but I'm having (what appears to be) the same issue.

tianshu09:09:02

For interop like this, is there a better way? (java.nio.file.Paths/get "/Users" (into-array ["username" "dev" "clojure"]))

Toby Clemson09:09:17

@doglooksgood I'm in the process of writing a wrapper for java.nio.file that might be of use: https://github.com/logicblocks/pathological

Toby Clemson09:09:41

There's no getting started yet but hoping to work on that this week

Toby Clemson09:09:00

There are API docs but they are in a minimal state at the moment

Toby Clemson10:09:57

For your specific case, with that library:

(require '[pathological.paths :as p])
(p/path "/Users" "username" "dev" "clojure")

Toby Clemson10:09:15

Or (p/path "/Users/username/dev/clojure")

Toby Clemson10:09:12

Take a look at the tests for example usage

Leon11:09:04

is there some way to make the in-browser stacktrace-viewer thing from lein show the same stuff as is shown in the command-prompt? I'm using expound to get readable spec errors, but they don't affect the errors i see in my browser. is this doable? or is there maybe some generally better solution to have readable (or at least not clojure.core-containing) stacktraces?

craftybones13:09:21

Does Kibit make suggestions on using any of the threading macros? I see the code there, but I am unable to understand when it does so

foobar2713:09:26

Is it possible to access the line/column numbers of an sexp and all it's sub-expressions (and sub-expressions thereof etc) in a macro? Via &form I can access the meta information of the form of the macro invocation, and the meta information of the arguments, but I cannot do it recursively on these arguments (the symbols a, b, c and d in the example below). I would like to use this to improve error reporting in macros. The only solution I see for now is to implement a reader macro which adds the meta information everywhere (with tools.reader). But there must be an easier way? https://gist.github.com/foobar27/e04a952571f36376c0e3ee0c550834b3

alexmiller16:09:25

Line/col info is only attached to forms, not to symbols in the reader - does that match what you’re seeing?

alexmiller16:09:16

If so, then this is not macro-related but reader-related

foobar2720:09:41

Thanks @U064X3EF3, it does 🙂

foobar2720:09:06

One day it would be cool to have them on any tokens. In cases like (let [x 1, 2 3] 4) it would be cool if an IDE could directly highlight the offending token 2.

thelittlesipper14:09:06

Are there any pitfalls to using something like this

(defmacro apply-macro [macro args] `(~macro [email protected]))
in order to apply a macro to some list of args? Is this the way to do it, or is there a better way?

foobar2715:09:54

I never had problems with this pattern.

skuttleman15:09:15

I think that will only work if args is a collection literal.

Jack Westmore15:09:50

Hey there, would anybody be willing to help meet out setting out Emacs with Cider? Completely new to this thing and encountering a bug...

vemv16:09:53

it'd be best if you described the problem in advance and posted it in #cider or #emacs

craftybones16:09:37

can I override or add rules to kibit?

dimovich16:09:16

Is there a library that provides a set of standard read/write handlers for Fressian that can serialize default Clojure data structures, like vectors and meta?

ahungry17:09:06

If I was to publish a lib on clojars, is it a better convention to name it com.ahungry.<whatever>, or to do something like ahungry.util.<whatever>?

ahungry17:09:38

if I don't use the FQ naming for the ns, would the alternative be in a lein defproject for the group name to use ?

ahungry17:09:13

well, this is frustrating - following the clojars deploy tutorial and the similar one on lein's site, and neither work

ahungry17:09:34

Sending ahungry/xdg-rc/maven-metadata.xml (1k)to 
Could not transfer metadata ahungry:xdg-rc/maven-metadata.xml from/to clojars (): Access denied to: , ReasonPhrase: Forbidden - repo/ahungry/xdg-rc/maven-metadata.xml.md5 (No such file or directory).
Failed to deploy metadata: Could not transfer metadata ahungry:xdg-rc/maven-metadata.xml from/to clojars (): Access denied to: , ReasonPhrase: Forbidden - repo/ahungry/xdg-rc/maven-metadata.xml.md5 (No such file or directory).

ahungry17:09:06

(this comes after a few lines of successful output for sending the jar and pom

dpsutton17:09:19

known issue. issue with the storage for clojars. they are investigating

ahungry17:09:35

thanks, glad it isn't just me - i suppose bad timing on my part

dpsutton17:09:36

you can follow along in #clojars if you like

dpsutton17:09:47

yup. just the one random day that there's been a problem

ahungry17:09:01

does lein or deps.edn have a standard way to pull code straight from github and avoid clojars entirely?

dpsutton17:09:48

deps.edn does natively. i think there's a lein plugin to achieve the same

craftybones17:09:45

Isn’t there a convenience method that provides both quot and rem ? Obviously I can (juxt quot rem) but I remember something of this sort

ahungry17:09:51

ty, good to know I just have abysmal timing for the first time attempt to put something on clojars

craftybones17:09:54

or maybe that was Haskell. I can’t remember now

andy.fingerhut17:09:19

I do not recall anything in Clojure for that.

craftybones17:09:29

Yeah, I think I’ve got them mixed up. Thanks.

tcrawley17:09:14

The clojars deploy issues should now be resolved.

🎉 8
dpsutton17:09:09

thanks so much @tcrawley you're awesome

tcrawley17:09:47

My pleasure!

ahungry18:09:26

With spec fdef, I want to test/instrument a function that takes no args, but should always return a string

ahungry18:09:31

how do I do that?

ahungry18:09:59

I tried an fdef of :args nil and :ret string? but when I call stest/instrument, and then redefine the function to return a number, it doesn't throw any error or message

alexmiller20:09:18

instrument only checks invocation, not return

alexmiller20:09:38

Also (s/cat) is usually the best spec for a no arg function (although there’s not much value in testing a no arg function)

ahungry18:09:17

(defn get-string [] "Foo" 5)
         (s/fdef get-string :ret string?)
         (stest/instrument)
         (get-string)

ahungry18:09:21

maybe thats a better sample

craftybones18:09:14

user=> (if-let [z true [x y] [1 2]] [x y])
Syntax error macroexpanding clojure.core/if-let at (REPL:1:1).
([x y] [1 2]) - failed: Extra input at: [:bindings] spec: :clojure.core.specs.alpha/binding

user=> (if-let [[x y] [1 2]] [x y])
[1 2]

craftybones18:09:33

Destructuring fails if its the second binding in an if-let form

craftybones18:09:20

Rather. This fails the spec. Was this how it used to be before?I could’ve sworn it used to work…

hiredman18:09:03

It doesn't have anything to do with destructuring

hiredman18:09:21

Try [x 1 y 2]

craftybones18:09:38

Yeah I did. So only one binding is allowed! But I swear the doc said bindings. I should look that up

craftybones18:09:16

Ah! Got it. The clojuredocs version has an if-let* that I used before