#clojure log - Aug 28 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:08 tolstoy: Using component and reloaded.repl: I have a reference to system of type SystemMap. How do I inspect it to see instances of all the components and dependencies?

0:08 Oh: To disable this behavior and print system maps like normal records, call (remove-method clojure.core/print-method com.stuartsierra.component.SystemMap).

0:08 Ah. I see, it's just a print method. You can still (:comp system) and see things. Good! ;)

0:25 Normally, you can pass a handler into a web-runner using #'routes or #'handler or something similar.

0:25 But what if you want to use a closure for dependencies?

0:26 (make-routes db ldap) when returns something like (defn make-routes [db ldap] (fn [request] (db this)))?

0:26 How do you make that so that when you recompile that bit in a repl, the runner will recognize the change?

0:26 Alter-var-root, maybe?

0:48 (alter-var-root #'middleware-chain (constantly (partial #'actual-middleware db ldap etc)) Then use #'middleware-chain as needed.

0:48 C-c C-c any function in the middleware change actually changes on subsequent requests.

0:52 Oh. Even simpler than that. Just #' each of the middlewares in the "comp" chain. Phew!

0:56 Oh, yes. So nice.

2:14 piranha: Does anybody has an idea about how do I get rid of this message? WARNING: reader-conditional already refers to: #'clojure.core/reader-conditional in namespace: clojure.tools.reader.impl.utils, being replaced by: #'clojure.tools.reader.impl.utils/reader-conditional

2:14 I use clojure 1.7.0 and tools.reader 0.9.2...

2:37 ok, so I just need to stop using aot tools.reader and problem goes away

3:53 lodin_: Is the correct terminology that "a type extends a protocol"? The implementations in defrecord are "extensions"?

3:53 And "a protocol extends *to* a type"?

3:57 jeaye: lodin_: As far as I know, "a type implements a protocol."

4:00 lodin_: jeaye: I'm pretty sure that it's not implements. :-)

4:01 jeaye: Not that it's official, but this also uses the "implements" nomenclature: http://matthewboston.com/blog/implementing-clojure-protocols/

4:01 lodin_: I think implements is used only for interfaces. defprotocol happens to also define an interface, but I consider that an "implementation detail" (since I rarely do Java interop :-)).

4:02 * jeaye is no good at Clojure, but this is a common pattern in languages and "implements" is used pretty ubiquitously.

4:02 lodin_: jeaye: I think that implements is explicitly avoided when talking Clojure since it makes you think of Java interfaces.

4:03 And indeed, Clojure data can implement Java interfaces, and a key feature of protocols is that you can extend them after the type has been defined.

4:04 jeaye: Fair

4:04 lodin_: jeaye: I just looked at the docs for extends?, extenders, etc, and I think I was right above: a type extends a protocol.

4:04 andyf: lodin_: “a single type can implement multiple protocols” appears here: http://clojure.org/protocols

4:05 lodin_: andyf: Yeah, I saw that too, which is why I first asked here. :-)

4:06 clojure.org/protocols does not really help with the terminology. I think it is because it also talks a lot about how protocols also works well with the host.

4:08 andyf: The word “implement” with various suffixes is used a lot on that page :)

4:09 lodin_: It would probably be good if this was clarified in the docs. The docstrings seem pretty consistent with the use of extends though.

4:10 E.g. extend only mentions implementation w.r.t. the functions/methods.

4:10 As in "Implementations of protocol methods ...".

4:10 I know, it's splitting hairs. :-)

4:11 My question was really about whether a protocol extends a type, or a type extends a protocol. And that is clear now.

4:31 hellofunk: i need a bit of advice on the least resistance approach to setting up a webocket client connection on a Jetty server. one old SO thread recommended Aleph, but that would probably be a replacement for Jetty, right? Any other advice?

5:16 expez: hellofunk: sente

5:16 Bill_Cosbys_Lawy: Hi all

5:16 expez: hi

5:17 hellofunk: expez: sente does not show Jetty as a supported server

5:20 expez: hellofunk: then I only know about this: https://github.com/lynaghk/jetty7-websockets-async

5:25 hellofunk: expez: it says for jetty 7, how do i check which version of jetty i am using?

5:28 expez: hellofunk: M-x cider-classpath then find the jetty entry

5:29 hellofunk: expez: it does not show Jetty anywhere in there

5:29 expez: It's just a regular buffer so use C-s to search

5:31 hellofunk: to be clear, you had a repl going into the right project when you did M-x cider-classpath?

5:32 hellofunk: expez: whoops, had the wrong repl open. i'll check now. i just saw that the ring jetty adapter uses jetty 7, so that's probably what i'm using. will confirm in bit.

5:34 expez: yup says jetty 7. thanks that's useful. i guess the jetty7-webockets library is worth a try, the quick start looks simply.

5:34 (inc expez)

5:34 lazybot: ⇒ 2

5:36 Igor__: What is more faster to use inside function: with-local-vars or atom?

5:37 For mutable vars

5:39 expez: Igor__: in 1.7 you can use volatile! with vswap! etc instead of atoms. I'm not sure how that compares to with-local-vars speed wise, but it was created to be faster than atoms

5:42 Igor__: expez: thanks, I will look it

5:49 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Volatile.java looks good :)

6:19 lwm: folks, in a distant past I remember a website that I could pass a function and it would give me examples of how to use it in clojure

6:20 it was amazing. It was the best

6:20 I've lost it.

6:21 Surely someone else saw this website as well ... I think I got the link from hckrnews

6:23 schmir: conj.io probably

6:23 lwm: THANK YOU!!!

8:26 kungi: I am having problems with clj-refactor in emacs when I have a macro in my namespace. When I try to call the cljr-clean-ns refactoring I get an error saying "Don't know how to create ISeq from Keyword".

8:26 Anyone else having this problem?

8:46 cap10morgan: When extending a protocol to core.async channels, what is the best type to use? clojure.core.async.impl.channels.ManyToManyChannel? Or are they all kind of equally "might work now but it could break in a future core.async release"?

8:59 stuartsierra: cap10morgan: ManyToManyChannel is currently the only Channel implementation, but there may be additional implementations in the future.

9:00 cap10morgan: stuartsierra: OK, thanks. I wondered if there may be a more general interface to use in extend-protocol or similar. I'll use ManyToManyChannel for now.

9:07 lambda-smith: How often do you guys need to drop down to write Java code, if at all?

9:18 chouser: lambda-smith: Depends on the kind of project. Personally, perhaps once every year or two.

9:18 I read Java (Clojure implementation, libraries I'm using) far more often than I write it.

9:18 lodin_: Is there any (good) way to find all protocols that a type extends? It would be useful for finding supported operations.

9:22 chouser: lodin_: hm, not easily. A type knows which protocols it extended inline when defined (via Java interfaces), but any extended later are stored in the protocol, not in the type.

9:23 I guess you could find all protocols in all namespaces and look for the type in question there.

9:23 Does sound useful...

9:24 lambda-smith: chouser: I see, that's good to hear

9:26 lodin_: chouser: Unfortunately, you can't do with-meta on a class. :-/ Otherwise that would be the obvious place to add supported protocols.

9:30 chouser: (defn all-protocols [] (filter :on-interface (map deref (mapcat (comp vals ns-publics) (all-ns))))

9:31 lodin_: chouser: Yeah, but that's the solution I was /not/ looking for. ;-)

9:31 chouser: yeah

9:32 lodin_: chouser: It works for REPL stuff, though.

9:32 RedNifre: Has anyone tried to create atom editor plugins with clojurescript?

9:33 lodin_: chouser: Except :on-interface might break. I assume that there's a reason for protocol? to be private in deftype.clj.

9:35 chouser: yeah, I wouldn't trust :on-interface across Clojure versions.

9:35 lodin_: It would be great if protocol? would be made public.

9:43 RedNifre: So I was thinking about learning a lisp and heard about clojure and racket. Racket looks interesting because you can change the syntax a lot and clojure sounds interesting because it sounds like a "practical lisp you can use for serious stuff.". I heard clojure still has macros, so how much can you warp the language? What is the most extreme DSL you can build with it?

9:46 chouser: Racket's macros are more advanced in a way that makes them easier to write, not (I think) more powerful.

9:48 In Clojure, if you want an embedded DSL, you'll be constrained by the basic syntax of s-expressions (Clojure does not have reader macros).

9:49 Once I became comfortable with s-exprs, I found this constraint to be liberating rather than an obstacle.

9:49 RedNifre: Hm, I guess that's fine.

9:49 chouser: Of course you can have complete syntactic flexibility with an external DSL, writing your own parser. There are a couple of nice parser libs for Clojure if you want to go that way, though I haven't explored them much.

9:50 RedNifre: Another thing, while having a quick glance at the documentation I found something about only using read-string for trusted data and look at clojure.core.edn for reading untrusted data. Why is that? My understanding was that it only gets dangerous when you actually try to eval what you read, not when you parse it?

9:50 snowell: When passing a function (e.g., for an event handler) is it more/less memory/space intensive or better/worse programming practice to use anonymous functions vs partial?

9:51 #(foo "bar") vs (fn [] (foo "bar)) vs (partial foo "bar")

9:51 chouser: The Clojure default reader has a couple hooks that are useful when reading code, which make it unsafe.

9:51 RedNifre: The most obvious being the #=(foo) syntax, where foo is actually evaluated at read-time. There are some restrictions on that, but not enough to make it truly safe.

9:52 snowell: Not enough of any of those to matter, compared to the programmer's time/energy to understand and interact with the code. Do what makes sense for the humans.

9:54 #() actually expands to (fn []) at read time, so they're as close to identical as possible. They both generate a class at compile time, which (partial) does not, but again by runtime that basically never matters.

9:55 snowell: Hmm, true. Thanks!

9:55 RedNifre: Can you recommend a small open source project that I could look at to get an impression on how normal good clojure looks like in practice?

9:55 Something not too magical but not to primitive either.

9:56 xemdetia: RedNifre, try https://github.com/stuartsierra/component ?

9:57 there is a lot of supporting resources to the 'why'

9:57 but its kind of on the small side

9:57 chouser: maybe https://github.com/ring-clojure/ring

9:58 Used ubiquitously, does something every language needs to do (web app backend stuff), and is primarily good clean code.

10:00 RedNifre: Thanks, looks good.

10:01 Many people say that having null/nil in a language is a bad idea. What's clojure's reason for having it?

10:03 stuartsierra: RedNifre: This post offers some reasons http://www.lispcast.com/nil-punning

10:04 snowell1: Ugh. My internet crapped out and now I can't /nick back to snowell

10:05 chouser: stuartsierra: that's a lovely answer. Thanks for pointing it out; I don't think I've seen it before.

10:05 stuartsierra: chouser: You're welcome.

10:08 snowell: Guess I just had to wait for the old login to die

10:09 xemdetia: snowell, you might want to learn about nickserv ghost

10:09 snowell, you can force-disconnect an old session that way with /msg nickserv GHOST <nick> [password]

10:09 RedNifre: stuartsierra thanks for the article. I have a question regarding type-checking and nil: If nil is a value of the nil type, why can functions return it? Isn't it weird if the same function can return values of different types?

10:11 The article made weird examples, like saying that it makes sense that the first element of an empty list is nil. I'd prefer an exception in this case because it's an out of bounds exception. I mean, you can put nils in lists, so how would you differentiate a valid nil from an out of bounds exception?

10:12 stuartsierra: RedNifre: It depends on your point of view. :) Clojure is a dynamically-typed language, so it's not weird at all. Another way to think of it is in terms of Union types, which most mainstream statically-typed languages, e.g. Java, don't support. core.typed has explicit definitions for the return types of most Clojure functions.

10:13 In general, it is a mistake to use 'nil' as a value anywhere it could be confused with a 'nil' returned to indicate absence of a value.

10:14 For example, core.async channels use `nil` to signal that a channel is closed, and disallow putting as a value on a channel.

10:14 s/putting/putting nil/

10:24 lwm: guys, can someone explain me how this submitting a code example on clojuredocs.org works?

10:24 it seems like I can just bork anything into the editor and add it

10:24 RedNifre: How does typed clojure work in practice? Can you start without it and gradually add type annotations whenever you get a type error? How does it compare to the type systems in Java, C# or Haskell?

10:27 chouser: RedNifre: That's the only way I've used it, though I'm sure some people use it right from the beginning of the project.

10:30 RedNifre: Has anyone tried clojure in a conservative enterprise environment (java shop)? What to expect?

10:37 chouser: In my experience, deploying Clojure into "enterprise" Java shops hasn't been a problem. I've seen more resistance for development activities, and rightfully so. Maintaining code in a language that is not familiar to all devs on a team has costs and risks.

10:44 stuartsierra: RedNfire: I have acted as a consultant for enterprise Java shops adopting Clojure. In my experience, developers are happy with it. There's definitely a learning curve, but even people with no prior Clojure experience can get started fairly quickly. The strongest resistance tends to come from management. People who don't have the day-to-day experience of working with code are slower to recognize the productivity benefits of switching a

10:46 snowell: I've hit heavy resistance from project leaders who don't want to adopt it because Java/JS is more mainstream and therefore it's easier to find new people that already know it

10:47 Even when I show them that it is objectively faster/smaller/more awesome than the thing they want to use

10:47 OK, maybe the 'more awesome' part isn't very objective :D

10:47 chouser: stuartsierra: you cut off at "benefits of switching a..."

10:48 stuartsierra: huh

10:48 … The strongest resistance tends to come from management. People who don't have the day-to-day experience of working with code are slower to recognize the productivity benefits of switching away from Java.

10:49 * stuartsierra talks in paragraphs

10:49 chouser: IRC prefers sentence

10:49 fragments

10:49 stuartsierra: :)

10:54 pepijndevos: With a list it's easy to take the first and the other element, but what is the most elegant way of taking the nth element and the others?

10:55 snowell: Convert it to a vector :)

10:55 troydm: how do I specify newline character?

10:55 chouser: Or better yet, maintain it as a vector instead of a list. Then use 'nth'

10:55 troydm: \\n obv is not correct

10:56 chouser: troydm: \newline for a character, "\n" for a string of length one

10:56 pepijndevos: well, I have a vector already, and nth works for the first part, but now I also want a new vector without the nth element.

10:57 snowell: pepijndevos: (vec (concat (subvec v 0 n) (subvec v (inc n))))

10:57 chouser: pepijndevos: vectors are bad at that. There are some other data structures that would be a better choice.

10:57 pepijndevos: a nice. I keep forgetting those vector functions.

10:57 snowell: But listen to chouser :)

10:58 chouser: snowell: or (into (subvec v 0 n) (subvec v (inc n))) ;-)

10:58 snowell: chouser: More parens means it's more clojure-y

10:58 pepijndevos: chouser, if their length is 6, the overhead of a nice tree is probably not worth it.

10:58 chouser: pepijndevos: indeed, likely.

11:01 pepijndevos: For reference: https://github.com/clojure/core.rrb-vector

11:02 pepijndevos: Though I'm always interested to learn about new types of fancy trees

11:04 troydm: chouser: thx

11:04 chouser: rrb-vectors have subvec and catvec which together should give you O(log) deletion of an interior entry.

11:04 pepijndevos: I wasn't aware of the difference between clojure.lang.PersistentVector and clojure.core.Vec

11:04 chouser: most people don't even know about gvec

11:07 pepijndevos: So it's a vector for primitive types? Not much I can find about it.

11:07 Bronsa: I don't think gvec is much maintained these days

11:07 chouser: pepijndevos: right. Implemented in Clojure (instead of Java like clojure.lang.PersistentVector)

11:11 sdegutis: How can you tell what JVM you're using from Clojure/Leiningen?

11:12 chouser: Bronsa: is it broken?

11:12 pepijndevos: Copyright Michał Marczyk... who else.

11:14 chouser: ,(System/getProperty "java.version")

11:15 clojurebot: #error {\n :cause "denied"\n :via\n [{:type java.lang.SecurityException\n :message "denied"\n :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}]\n :trace\n [[clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]\n [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkPropertyAccess nil -1]\n [java.lang.System getProperty ...

11:18 troydm: anyone using parsatron?

11:18 Bronsa: chouser not broken but it hasn't been as performance tuned as PV has in recent times

11:28 troydm: also how do I check if number is not equals to some value? in more shorter form rather than (not (= a 42))

11:30 chouser: (not= a 42)

11:31 luxbock: TIL: https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj

11:31 in case anyone else was looking for a link as well

11:33 oddcully: ,(def ≠ not=)

11:33 clojurebot: #'sandbox/≠

11:33 luxbock: I had seen `vector-of` before but I didn't know that it was written in clojure

11:35 if I wanted to read through the Clojure source bit by bit, where should I start?

11:36 justin_smith: luxbock: RT.java + clojure.core side by side I think

11:36 luxbock: justin_smith: thanks, wonder how long getting through it is going to take me

11:37 someone should create a curated version of it, though now that I think about Github is kind of like that

11:38 sdegutis: (inc oddcully)

11:38 lazybot: ⇒ 19

11:38 sdegutis: ,(≠ 1 2)

11:38 clojurebot: true

11:38 sdegutis: <3

11:39 luxbock: reminds me of a post I saw on HN asking about why literate programming never took of, and someone pointed out that version control is kind of like the evolved version of literate programming

11:39 sdegutis: heh

11:40 Literate programming is only necessary when your code is unreadable. We found a better solution: make your code readable.

11:41 luxbock: https://news.ycombinator.com/item?id=10070444

11:42 Bronsa: most git commit messages in clojure are not helpful at all

11:42 luxbock: never having been a professional developer, that comment made me reconsider my git habits

11:42 oh, that's too bad :/

11:43 I discovered today that Emacs can display git commit messages at point in a tooltip which is very nice

11:43 Bronsa: luxbock: uh?

11:43 luxbock: https://github.com/syohex/emacs-git-messenger

11:44 Bronsa: ah, that's nice

11:44 justin_smith: git log -p some/file-in/repo is still a nice way to see what's been going on

11:44 Bronsa: I use magit-blame

11:44 justin_smith: even if the commit messages are shit

11:44 luxbock: magit is incredible, I would be completely useless with git on the command line

11:45 justin_smith: is there a version of blame that shows more than the most recent change? or is it just most recent change on each line?

11:45 sdegutis: justin_smith: I always just do `git log -p some_file`

11:45 justin_smith: inside the terminal, where I can then use /foo n n n to find "foo" in the history

11:45 justin_smith: luxbock: trufax - many things in magit are accessed with normal git tools with an added command line parameter, usually that parameter is -p

11:46 in fact many might just be most there

11:46 sdegutis: justin_smith: this lets me see what commit a thing happened in, or in general let me track the history of that file/dir until it was created (or moved to this location)

11:47 luxbock: I wonder if there's a mode for displaying the comments people make on Github in Emacs as well

11:47 those are not part of git right?

11:47 justin_smith: I think those are github only yeah

11:48 luxbock: it's a bit shame, I wish git acted as a decentralized discussion board for the code base it represents

11:48 sdegutis: oh wait justin_smith has me on ignore too

11:48 never mind, will stop wasting my breath

11:48 luxbock: maybe this is something someone is working on

11:48 expez: There's also vc-annotate which is pretty sick too. http://devblog.avdi.org/2012/06/22/use-revision-control-annotation-in-your-editor/

11:48 justin_smith: luxbock: startup idea! git as a social network. This is kind of what github does though.

11:49 expez: that gets the blame info, right?

11:49 sdegutis: So, if most of #clojure has me on ignore, then I can't really help anyone here since they won't see it. So, bye I guess.

11:49 luxbock: justin_smith: it would be great if they built this as an open source extension to git

11:49 expez: justin_smith: it allows time travelling through the file

11:50 justin_smith: cool

11:50 luxbock: expez: awesome!

11:50 expez: yeah pretty helpful when you want to answer questions like 'why does this look like this?'

11:50 luxbock: the more I learn the worse I feel about my past git habits :P

12:00 xemdetia: luxbock, what do people not use the stuff under C-x v l to walk versions of a file?

12:00 notid1: is this a good channel to ask incanter questions?

12:00 xemdetia: I mean I prefer C-x v l to magit because it works the same-ish for svn as well as git

12:01 magit for actual commits, C-x v l to walk history

12:02 luxbock: xemdetia: that was a new command to me as well

12:02 I have only ever used git

12:02 notid1: specifically, i'm wondering how I can do a $where or (i/$ :filter (fn ...)) based on the previous row.

12:03 xemdetia: luxbock, if you do use that move the cursor in the file and just hit 'd' to see the diff and 'f' to get a version of the file to look at

12:03 if you use 'd' tap 'q' in the opened diff buffer to close it

12:04 luxbock: xemdetia: thanks

12:06 hiredman: /win 17

12:20 dagda1_: I see how I can create a tree-seq like this (def t (tree-seq next rest xs)) but how can I navigate the tree after it is created

12:20 justin_smith: dagda1_: tree-seq does not create a tree

12:20 it creates a seq

12:20 each node is a sub-tree or leaf of the input tree

12:21 s/node/element

12:22 dagda1_: justin_smith so if i have '(:a (:b nil nil) (:b nil nil))) I can I get to the b nodes, maybe I should use a zipper

12:23 justin_smith: ,(tree-seq next rest '(:a (:b nil nil) (:b nil nil)))

12:23 clojurebot: ((:a (:b nil nil) (:b nil nil)) (:b nil nil) nil nil (:b nil nil) ...)

12:23 justin_smith: dagda1_: if you wanted all subtrees starting with :b you could filter the output for first item = :b

12:24 dagda1_: justin_smith :b is just an example, it could be any keyword. finding it difficult to model trees

12:25 justin_smith: tree-seq isn't for modeling things, it's for disecting them...

12:25 dagda1_: I find the adjacency list representation is the most flexible (it can even do arbitrary graphs with circularities)

12:26 dagda1_: justin_smith yes, I just want to grab left, right of :a

12:26 justin_smith I'll check that out, thanks

12:26 justin_smith: dagda1_: then filter tree-seq output for first thing starting :a, then get its left, right?

12:27 with an adj-list you would search your nodes for soemthing with val=a (they are in a flat series of already) then find paths coming from there as needed

12:28 one way to do your example as adj-list [{1 :a 2 :b 3 :b} {:a [2 3]}]

12:29 sorry, that second one would be {1 [2 3]}

12:34 pepijndevos: Isn't there a nice repl for figwheel that has line editing and tab completion?

12:34 I'm already using rlwrap, but it sill kind of sucks.

12:47 Bronsa: hiredman: the bug in hoistedmethods-pass-7.patch was just a missing s/OBJECT_TYPE/retType

12:50 hiredman: Bronsa: oh, good

12:52 I feel like I should try and get test.check or test.generative to generate valid fn forms

12:55 Bronsa: hiredman: I wonder if there are performance/inlining implications for all the hops an invoke might go through

12:56 ah nevermind invokeStatic is direct linking stuff not relevant to your patch

12:56 hiredman: for the hoisted stuff? well it is getting hoisted out as fn already, hoisting just switches that to hoist as a static method with type info

12:59 right now for my hoisted method patch the compiler writer has to opt in to the hoisted stuff, which is only done for loops and trys, I was thinking it would be nice to have invokeexpr hoist automatically when it is an immediately invoked function literal, but the most straightforward way to do that ends up double analyzing forms, which breaks everything

13:01 Bronsa: hiredman: because of double macroexpansion or what?

13:01 hiredman: yeah

13:01 Bronsa: hiredman: loop body analysis might cause multiple form analysis

13:01 pepijndevos: Why can't I do max on things other than strings?

13:02 Bronsa: ,(max 1 3 2)

13:02 clojurebot: 3

13:02 pepijndevos: I mean numbers

13:02 Bronsa: hiredman: http://dev.clojure.org/jira/browse/CLJ-1407

13:02 hiredman: now, or is it something my patch does :(

13:02 pepijndevos: ,(max "foo" "bar")

13:02 clojurebot: #error {\n :cause "java.lang.String cannot be cast to java.lang.Number"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.String cannot be cast to java.lang.Number"\n :at [clojure.lang.Numbers gt "Numbers.java" 229]}]\n :trace\n [[clojure.lang.Numbers gt "Numbers.java" 229]\n [clojure.lang.Numbers max "Numbers.java" 4027]\n [sandbox$eval49 invokeStatic "NO_SOURCE_FILE" 0]\n...

13:02 hiredman: gross

13:02 pepijndevos: ,(compare "foo" "bar")

13:02 clojurebot: 4

13:04 Bronsa: hiredman: a solution would be having an AST->clj compiler and building the macroexpanded form & doing subsequent analysis on that rather than on the original one

13:04 real tricky wrt metadata

13:04 and line/col info

13:04 hiredman: or mutate the expr tree :(

13:04 Bronsa: ew

13:20 sdegutis: Anyone have experience with ultra?

13:20 https://github.com/venantius/ultra

13:20 I'm wondering if anyone has used it and can recommend it or advise against it. It seems awesome.

13:21 wink: sounded good, yes. haven't tried it

13:22 sdegutis: Wow it seems to work nice so far.

13:24 Bronsa: puredanger: CLJ-1805 reports the issue with :rettag I was telling you a while ago

13:55 ashwink005: hey why does println "Something" and println "\"Something" give the same output?

13:55 noob quest

13:56 Bronsa: they don't

13:56 ,(println "foo")

13:56 ,(println "\"foo")

13:56 clojurebot: foo\n

13:56 "foo\n

14:01 ashwink005: Bronsa: huh? then I must be doing something wrong

14:01 thanks

14:30 I'm having some problem in emacs while coding in clojure

14:36 anyone? my nrepl is not updated to my core.clj file

14:38 sdegutis: What was the motivation behind using symbols instead of strings with (deftest)?

14:39 Bronsa: ashwink005: nobody can help you if you don't say what problems you're having

14:40 ashwink005: Bronsa: my cider's nrepl is not recognizing new functions etc that i add to my core.clj

14:40 it says can't resolve symbol

14:41 its stuck to some old version of the same file. I tried saving the file, then restarting everything, still no lucj

14:45 justin_smith: ashwink005: so you go to the buffer with the file, and do the key-combo to make cider load the file, and it fails?

14:46 ashwink005: justin_smith: I edit the file ( defn a new function), save it, go to the nrepl buffer, and run the function, it says can't resolve symbol

14:46 justin_smith: ashwink005: that's not how it works

14:46 ashwink005: even changing println statements is not showing effect

14:46 justin_smith: there is no auto-reload by default

14:46 ashwink005: it was happening earlier ...

14:46 justin_smith: you have to go to the file with the changes, and make cider load your new definition, or reload the file

14:47 ashwink005: justin_smith: how do I make cider load the new file defs?

14:48 darth10: ashwink005: M-x cider-load-buffer

14:48 justin_smith: usually bound to C-c C-k

14:48 (by default at least)

14:49 there's a decent overview here https://github.com/clojure-emacs/cider#cider-mode

14:50 * Bronsa is thinking of trying out cider

14:50 justin_smith: I may try it again some day

14:50 ashwink005: justin_smith: ok will look into it

14:50 justin_smith: I got fed up by the breaking changes, but it seems that might be happening less now

14:51 Bronsa: yeah seems to be stable enough for me to try again

14:51 darth10: justin_smith: cider is pretty stable now. there's a pretty decent debugger in it now as well.

14:51 Bronsa: and the refactor capabilities seem really nice

14:51 darth10: cider and clj-refactor are both really nice

15:07 ashwink005: I'm pressing C-c C-k and Nothing is happening

15:09 justin_smith: ashwink005: in which buffer

15:10 ashwink005: in cider buffer

15:10 justin_smith: ashwink005: you have to do C-c C-k in the buffer you want cider to load

15:10 ashwink005: I'm also getting a warning that my cider version is not matching my nrepl version (not installed)

15:10 justin_smith: yeah I tried that as well

15:11 justin_smith: ashwink005: sounds like your cider is not set up properly, maybe the folks in #clojure-emacs can help with that

15:11 cider is hard to set up in my experience

15:11 ashwink005: ooh

15:11 thanks I'll join that channel

16:06 spieden-: think i just landed my first clojure day job!

16:06 sdegutis: ,(.contains ["foo" "bar"] "foo")

16:06 clojurebot: true

16:06 sdegutis: ,(.contains '("foo" "bar") "foo")

16:06 clojurebot: true

16:06 sdegutis: neat

16:28 justin_smith: spieden-: congrats

16:34 spieden-: justin_smith: cheers =)

16:43 troydm: is there a clojars statistic somewhere? like which libraries are most downloaded etc

16:44 tcrawley: troydm: you can figure it out from https://clojars.org/stats/all.edn

16:46 amalloy: https://crossclj.info/

16:46 although i do find the ordering at https://crossclj.info/all.html?sort=r somewhat hard to believe

16:49 troydm: tcrawley: there is an .edn data but there is no simple page that would display it in more human readable form? am I correct?

16:49 tcrawley: correct, clojars doesn't currently publish the stats other than via .edn files

16:50 well, you can get them via the API as well, but only on a per-artifact basis

16:50 and that's not still easily readable

16:50 troydm: tcrawley: hmm, so I assume in library listing there is no sorting too to sort search results by download numbers

16:51 dagda1_: how can I change this for to return one hash-map https://gist.github.com/dagda1/2fb86f7a3a10073b205b

16:51 justin_smith: troydm: I guess you could do a sort-by on the edn

16:51 troydm: justin_smith: I mean on website search results

16:52 tcrawley: troydm: ah, the search index is scored by # of downloads, and I believe that is used to sort the results

16:53 troydm: tcrawley: oic so naturaly I see the output already sorted by downloads yes

16:53 amalloy: dagda1_: for always returns a sequence. you have to call some other function on the result

16:53 also, rather than two nested for-comprehensions you want a single comprehension with two clauses

16:53 tcrawley: troydm: if there is some other way you'd like to see the data, please file an issue at https://github.com/ato/clojars-web/issues

16:54 sdegutis: Just converted our suite to clojure.test to see if a bug is still present using this framework. So far so good!

16:54 troydm: tcrawley: just checked it the search results aren't sorted by number of downloads

16:54 amalloy: ,(into {} (for [[x y] '{a {p 1, q 2} b {m 3, n 4}} [a b] y] [[a x] b]))

16:54 clojurebot: {[p a] 1, [q a] 2, [m b] 3, [n b] 4}

16:54 justin_smith: (take 10 (sort-by #(apply - (vals (val %))) dls)) where dls is (read-string (slurp clojars-edn-url))

16:54 gives the 10 most downloaded projects across all versions

16:55 clojure-complete/clojure-complete ring/ring-core, clj-time/clj-time cheshire/cheshire ...

16:55 troydm: tcrawley: like for example try searching "json" and compare clj-json with tigris

16:56 tcrawley: tigris has less downloads but comes first a

16:56 tcrawley: heh, I think there is some non-determinism there - it comes after clj-json for me

16:57 troydm: tcrawley: so I assume there is no sorting of search results in place

16:57 tcrawley: would you mind filing an issue about the result order? I can take a look when I have more time

16:57 troydm: tcrawley: yeah, sure

16:57 tcrawley: bonus points if you d/l the clojars src and fix it :)

16:58 dagda1_: amalloy great, thanks

17:00 amalloy: dagda1_: did you see my response on the 4clojure mailing list? i'm puzzled why you think it's not symmetrical

17:01 dagda1_: amalloy let me check

17:01 sdegutis: Is it possible to hide the "Testing some.name.space \n\n" lines that show up when doing `lein test` ?

17:02 I read the docstring for clojure.test and do not see anything, but I'm hoping there is something that someone knows about.

17:03 amalloy: sdegutis: i don't think so. the best you can do is `lein test | grep -v lein test`

17:03 sdegutis: Thanks amalloy. I'll look into the source code as a last resort.

17:03 amalloy: i already did

17:03 sdegutis: <3

17:03 amalloy: (feel free though, of course)

17:04 dagda1_: amalloy ok, it is the positioning of the left and right nodes of node with the value of 4

17:04 [2 nil [3 [4 [5 nil nil] [6 nil nil]]

17:04 [2 [3 nil [4 [6 nil nil] [5 nil nil]]]

17:04 sdegutis: amalloy: actually wouldn't I just need to do (report :begin-test-ns [m] ... my own code goes here ...) ?

17:04 amalloy: sdegutis: maybe. i don't actually know how the clojure.test mechanism works very well; i was looking in lein's source

17:05 sdegutis: Ahh.

17:05 I'm looking at https://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj

17:05 dagda1_: amalloy rignt, I just clicked

17:06 sdegutis: Seems to work!

17:06 Wonder why the \n is at the beginning of everything :/

17:14 ,(name #'map)

17:15 clojurebot: #error {\n :cause "clojure.lang.Var cannot be cast to clojure.lang.Named"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.Var cannot be cast to clojure.lang.Named"\n :at [clojure.core$name invokeStatic "core.clj" 1527]}]\n :trace\n [[clojure.core$name invokeStatic "core.clj" 1527]\n [clojure.core$name invoke "core.clj" -1]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE...

17:15 sdegutis: awww, so it needs to be from meta?

17:15 ,(-> #'map meta :name)

17:15 clojurebot: map

17:46 justin_smith: ,(map map (meta #'map))

17:46 clojurebot: (#object[clojure.core$map$fn__4537 0x740fad61 "clojure.core$map$fn__4537@740fad61"] #object[clojure.core$map$fn__4537 0x313ff6ce "clojure.core$map$fn__4537@313ff6ce"] #object[clojure.core$map$fn__4537 0x5e6467a4 "clojure.core$map$fn__4537@5e6467a4"] #object[clojure.core$map$fn__4537 0x11d07066 "clojure.core$map$fn__4537@11d07066"] #object[clojure.core$map$fn__4537 0xb8341ad "clojure.core$map$fn__4...

18:53 sdegutis: ,(instance? clojure.lang.IFn {})

18:53 clojurebot: true

18:58 amalloy: $mail sdegutis see also clojure.core/ifn?

18:58 lazybot: Message saved.

19:51 sdegutis: ,(meta #'print-method)

19:51 clojurebot: {:line 3540, :column 1, :file "clojure/core.clj", :name print-method, :ns #object[clojure.lang.Namespace 0x3f1cb25f "clojure.core"]}

19:52 sdegutis: Where's the implementations actually stored??

19:52 lazybot: sdegutis: What are you, crazy? Of course not!

19:52 sdegutis: ,(var-get #'print-method)

19:52 clojurebot: #object[clojure.lang.MultiFn 0x3d90e205 "clojure.lang.MultiFn@3d90e205"]

19:52 amalloy: inside an atom in the MultiFn

19:52 sdegutis: Ah clever.

19:52 Thanks amalloy, +1

19:53 Fwiw clojure.test is *super* nice to customize.

19:53 wish stuartsierra still ung around so I could congratulate him on a job well done

21:53 TEttinger: ,(+ 12 34)

21:54 clojurebot: 10

22:00 andyf__: TEttinger: What fresh witchcraft is that?

22:01 TEttinger: apparently some clients render it "correctly" but others don't

22:01 ,",(+ \u001e1\u001e2 \u001e3\u001e4)"

22:01 clojurebot: ",(+ 12 34)"

22:01 TEttinger: ,"\u001e"

22:01 clojurebot: ""

22:01 TEttinger: counts as whitespace

22:03 andyf__: Ah, got it. More normally one would write that (+ 1 2 3 4)

22:06 Bronsa: andyf__: more normally one would write 10

22:06 gfredericks: ,0xa

22:06 clojurebot: 10

22:07 gfredericks: ,8r12

22:07 clojurebot: 10

22:07 andyf__: gfredericks: Which numeric constant was your recent library created for?

22:07 gfredericks: 71

22:07 I might have generated that randomly using clojurebot, can't recall

22:08 Bronsa: wow, it even has cljs support

22:08 gfredericks: oh yep, found it in the log

22:08 Bronsa: and generative testing

22:09 I might suggest it to newcomers asking for well maintained libs to learn clojure from

22:09 andyf__: generative testing …. for 71. I almost feel like I need to look at that to see what it does.

22:11 gfredericks: http://logs.lazybot.org/irc.freenode.net/%23clojure/2015-05-28.txt

22:11 search ^ there for "my new library"

22:11 andyf__ was even right there

22:14 andyf__: Not afraid someone will 1-up you? 71++

22:14 gfredericks: somebody oughta update test.check so the test namespace doesn't have so much duplication

22:15 Bronsa: gfredericks: IIRC cljs aliases clojure.* to cljs.*

22:15 the duplication in the require shouldn't be necessary

22:15 except maybe when :include-macros/:refer-macros are used

22:16 if clojure's ns made :refer-macros an alias for :refer and ignored :include-macros, that would be lovely

22:16 puredanger: any chance that might get considered? ^

22:18 oh well, looks like :ignore-macros is already ignored

22:19 gfredericks: Bronsa: woah what

22:19 Bronsa: like it checks for clojure.* first and then checks cljs.*?

22:19 Bronsa: I talked to david about this and I swear he recommended renaming the namespaces

22:20 I guess I can just try it

22:20 Bronsa: gfredericks: oh no wait

22:20 it's just for clojure.core->cljs.core

22:20 gfredericks: phew

22:20 Bronsa: is that how `(+ 1 2) works correctly?

22:20 Bronsa: yes

22:20 https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L661-L663

22:20 gfredericks: everything makes a lot more sense now

22:21 Bronsa: well

22:21 gfredericks: Bronsa: would you say the cljs.* naming is regrettable?

22:21 Bronsa: tools.reader now has support for making ` work correctly regardless of that

22:21 gfredericks: and is there any benefit to the name difference?

22:21 Bronsa: gfredericks: the less reader-conditionals required, the better IMHO

22:21 and I don't see any benefit, no

22:22 gfredericks: I've never heard anybody defend it

22:22 Bronsa: otoh I just realized I'm doing that for tools.reader too.

22:23 gfredericks: when david ported test.check that's what he did, and I ended up switching it

22:23 stuartsierra had a clojure-dev thread about this that I don't think anybody but me replied to

22:24 Bronsa: I honestly think that aliasing clojure.* to cljs.* in cljs would be valuable

22:25 gfredericks: :'(

Logging service provided by n01se.net