#clojure log - Apr 29 2015

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

0:00 codefinger: np

0:01 amalloy: noir-session almost certainly requires sticky sessions

0:01 kenrestivo: thanks alan

0:05 that was it! amazing.

0:05 yeah it smelled like a thread-related problem. thanks again

0:05 amalloy: not thread, server

0:06 kenrestivo: right, two different dynos is two different servers, i guess.

0:06 codefinger: \o/

0:07 kenrestivo: very glad the clojure community is still awesome. been away for a while, but to get help fixing this kind of weird problem in ancient code in 10 minutes is fantastic. thanks again.

2:27 Natane: How come when i add [cider/cider-nrepl "0.8.2"] to my lein profiles, nothing happens?

2:28 i still get the "cider requires nrepl 0.2.7 or newer bla bla" on cider-jack-in

2:28 seangrove: ~ask

2:28 clojurebot: The Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.

2:29 Natane: i didn't ask to ask D:

2:29 i just ask, i'm rude like that

2:30 i don't even say hi, that's how efficient i am

2:30 Jaood: you are assuming cider-nrepl and nrepl are the same thing

2:31 Natane: there is also [org.clojure/tools.nrepl "0.2.10"] in my dependencies in the same profile

2:31 i thought cider-nrepl was cool with that

2:35 really i'm just butthurt eldoc doesn't work for clojure buffers

2:36 i can't seem to get it to eat nrepl 0.2.7

2:36 (whatever that is)

2:37 but then, i heard using notepad is good for memory

2:56 ed-g: Natane, I had a similar problem once. It ended up that I had to install a different version on the Emacs side.

2:56 Natane, although its been long enough I don't remember what was happening exactly

2:59 try [org.clojure/tools.nrepl "0.2.7"]

3:00 Natane: actually i think i'm no a path to figuring it out

3:00 it looks like when i start lein repl itself it uses nrepl 0.2.7

3:00 so i'm trying to get it to upgrade

3:00 oh i mean 0.2.6

3:02 ed-g: Natane, I'm running 0.2.10 on my current project. That could be the latest. Also I've found the lein "ancient" plugin handy for keeping deps up to date.

3:06 Natane: looks useful, thanks

3:11 oh my satan i figured it out

3:11 i put my profiles.clj in the wrong .lein

3:12 feels stupid but good

4:32 engblom: Wow! I did not know you could add several vectors as argument to map. (map + [1 6 3 4] [1 2 3 4]) is a very nice way to add two vectors.

4:32 Clojure never cease to amaze me.

4:41 dstockton: clojure rulez

4:46 TEttinger: engblom, I keep having those moments pretty continuously with clojure

4:46 the first time I learned about reductions was one

4:48 hyPiRion: I always love (apply map list ...)

4:49 ,(apply map list [[1 2 3] [4 5 6] [7 8 9]])

4:49 clojurebot: ((1 4 7) (2 5 8) (3 6 9))

4:51 wasamasa: zipmap?

4:51 or no, that was interleave

4:52 I'd call such a function transpose

4:57 hyPiRion: yep

4:57 matrix transposition

4:58 TEttinger: I thought this was pretty cool

4:58 &(let [r5 (Math/sqrt 5.0) phi (/ (+ 1.0 r5) 2.0) prime (fn [n] (bigint (+ (/ (Math/pow phi n) r5) 0.5)))] (map prime (range 1 1001)))

4:58 lazybot: ⇒ (1N 1N 2N 3N 5N 8N 13N 21N 34N 55N 89N 144N 233N 377N 610N 987N 1597N 2584N 4181N 6765N 10946N 17711N 28657N 46368N 75025N 121393N 196418N 317811N 514229N 832040N 1346269N 2178309N 3524578N 5702887N 9227465N 14930352N 24157817N 39088169N 63245986N 102334155N 1655801... https://www.refheap.com/100187

4:58 TEttinger: first 1000 fibonacci numbers calculated by closed-form fn

4:59 (I didn't know you could get a fibonacci number at any point without a previous calculation)

4:59 &(let [r5 (Math/sqrt 5.0) phi (/ (+ 1.0 r5) 2.0) prime (fn [n] (bigint (+ (/ (Math/pow phi n) r5) 0.5)))] (prime 1000001))

4:59 lazybot: java.lang.NumberFormatException

4:59 TEttinger: ha

5:00 it would need bigdecimals for that

5:00 hyPiRion: TEttinger: Well, it sort-of is is a previous calculation. phi^n / r5 is just phi^(n-1)*phi/r5

5:02 I like that fibonacci numbers can be calculated through matrix exponentiation. It's based upon the same underlying trick

6:57 bcn-flor: Hello! Is it possible to get a semantic representation of a form ? Something like in this snippet: https://gist.github.com/anonymous/2a030b31438c660b3926

7:04 noncom|2: bcn-flor: hi! well, it is certainly possible to write some functions that will give you such case of "explanation", but to me the explanation is not very correct (i might be mistaking)

7:06 what confuses me: 1) there is no such thing as "type fn". 2) what about arguments and bodies for multi-arity functions? 3) somehow in your example the (explain) knows that it is a function definition and analyzes the form with that knowledge. otherwise, it's just (defn) applied to the 4 args

7:07 in other words, ok, you write a macro that parses a defn form like that, but what is the benifit?

7:08 aside from that it gives a rather confusing output..

7:11 j-pb: noncom|2: I think bcn-flor just want a static code analyser and the defn was just an example

7:11 bcn-flor: look at clojure.tools.analyzer

7:11 it does exactly that

7:11 https://github.com/clojure/tools.analyzer

7:13 noncom|2: but that's a syntax (AST to be precise) analyzer, not semantics...

7:14 bcn-flor: noncom|2 : I'm trying to parse clojure source code in order to build a visual representation of it.

7:14 noncom|2: well, then what j-pb said, could be a good start

7:15 j-pb: bcn-flor: yeah go with tools.analyzer

7:15 bcn-flor: thank you both, I'll take a look at the tools.analyzer

7:15 Bronsa: start directly with tools.analyzer.jvm

7:21 j-pb: noncom|2: in most lisps syntax is just a very thin wrapper around semantics, tools.analyzer will actually give you quite a lot of info, it's what clojure.typed uses for its type checker

7:21 noncom|2: yeah, thinking about it, it is

7:28 bcn-flor: won't you mind telling a little about what is your project about? you want to visualize clojure code?

7:36 dstockton: for rails it was a blog in 15mins, can anyone suggest a 'classic' toy clojure project?

7:36 that shows it off as much as possible

7:36 perhaps something with lots of parallelism

7:37 j-pb: dstockton: maybe a blog in 15 minutes ;)

7:37 dstockton: it really depends on what you want to do, clojure feels a bit more general than ruby

7:38 dstockton: i want a toy project that can show off as many clojure features as possible

7:38 j-pb: evry project can do that

7:38 dstockton: or perhaps something you might want to extract from a hypothetical web app and make into a clojure microservice

7:39 j-pb: I'd probably do a toy thing that I always wanted to have, and then just use clojure for that

7:39 you can use pretty much every clojure feature in every context

7:40 dstockton: i suppose so, im actually wanting to write a kind of intructional walkthrough and looking for a good idea to walkthrough building something practical

7:40 mpenet: dstockton: write a database in 15min?

7:40 since it deals with data at the core, fits

7:41 dstockton: mpenet: that's a great idea actually

7:41 mpenet: multiple implementations: show off atoms, then refs, then make it multithreaded, then with core.async

7:41 dstockton: no necessarily in 15 mins

7:41 mpenet: yeah

7:41 dstockton: not*

7:41 thanks!

7:41 j-pb: yeah sounds like a good idea

7:41 mpenet: you're welcome. I like the community idea btw, looking forward to it (and contributing as well hopefully)

7:43 dstockton: wrong person for the community stuff, I confused you with d. s. gomez

7:44 dstockton: thought so :)

7:46 bcn-flor: noncom|2: yeah, just experimenting. I want to build a visual representation of the source code, in which forms are represented using graphical blocks and the syntax is reduced to bare minimum. The user can navigate between the forms with the keyboard or mouse, move forms around, evaluate them in place, etc.

7:48 noncom|2: dstockton: have you looked at the luminus guestbook example?

7:49 dstockton: i havent noncom|2 but the database idea is perfect for what I want to do

7:49 of course clojure is great for most things but a guestbook wouldnt give much opportunity to shine

7:50 noncom|2: bcn-flor: cool! i always liked this kind of projects.. surprisingly there were not so many of them, despite the topic is very captivating

7:50 dstockton: its the canonical example for most frameworks, that or a blog

7:50 bcn-flor: noncom|2: I'm trying to tackle the idea of non-textual representation of programs and visual/interactive development

7:51 justin_smith: bcn-flor: I've done a lot of visual programming. The problem I ran into was that you can represent a higher dimensionality of connections in linear text than you can in visual form.

7:53 noncom|2: justin_smith: yeah, i've stumbled into that too. but still i believe. there must be a way...

7:53 also, maybe i'm repeating myself, but this kind of semi-visual coding is quite interesting, esp on a mobile: www.youtube.com/watch?v=nHh00VPT7L4

7:54 bcn-flor: noncom|2: yes, that, taken to the extreme

7:57 noncom|2: bcn-flor: what are you using for graphics, standard GUI libs or OpenGL or something else?

7:57 bcn-flor: noncom|2: as in, paranthesis can be replaced by background color representation of the form, functions can have image representations, can run the form in place, by supplying values for arguments, etc.

8:00 noncom|2: stepping through forms visually, with a function return value pointing an arrow to the next function's argument.

8:06 noncom|2: yeah, that would be interesting! hope to see it available sometime!

8:06 bcn-flor: noncom|2: i'm at the idea phase :) I'm rendering html at the moment

8:07 noncom|2: i forgot about the html5 GUIs, right. they are pretty advanced today.. could really serve as an IDE of sorts

8:08 p_l: noncom|2: if you want to waste a lot of resources and/or reimplement local drawing...

8:09 bcn-flor: noncom|2: it's easier to experiment visually with html, but for a true vi-like experience, a native gui toolkit must be used. html (and even java) doesn't quite cut it in my opinion :)

8:10 justin_smith: so you are making something for only one OS

8:10 bcn-flor: noncom|2: or opengl, which opens up 3D which would be interesting as well

8:11 justin_smith: you can do opengl in the browser

8:13 noncom|2: i did a renderer to render clojure forms in OpenGL a while ago ...

8:13 simple ones, more even for edn

8:14 i realized that it requires much much optimization

8:18 bcn-flor: noncom|2, justin_smith: the idea i'm dabbling with is a client-server setup, in which the clojure process (server) performs all the logic operations on the representation and sends out (through socket or IPC) the delta of the changes to the client. the client is written in anything, Objective-C or C++ and is reponsible for rendering the world and user input. Sort-of like game engines. But I'm thinking too far ahead of me..

8:18 it's still less than a concept in my head :)

8:22 noncom|2: bcn-flor: well, i can only encourage you to experiment with it more. we really have to explore the possibilities to improve the media of code

8:23 bcn-flor: noncom|2: it's from clojure. I'm still learning it, but my mind explodes with ideas of things that could be done with it :)

8:24 noncom|2: bcn-flor: yeah, but i think not just clojure, but lisp in general. in my opinion lisp is almost the only language that is really viable for such code representations

8:28 bcn-flor: noncom|2: yes, true. I guess I'm going through those 'aha' moments associated with understanding lisp :)

9:28 Empperi: does anyone have a reasonable example for reagent where TransitionGroups are used?

9:28 having trouble getting it to work and to call the extra lifecycle functions

9:55 guess no one can help :/

9:55 this seems to be somehow myriad to solve

9:56 mpenet: Empperi: you'd probably have more luck on #clojurescript

10:30 noncom|2: is anybody using aleph for tcp recently?

10:40 craigglennie: I have a function that creates a string and writes it to disk; it doesn't return any value that I care about. I need to call it with a range of integers, so I do (map the-file-writing-fn (range 3)) which returns (nil nil nil). Since I don't care about the result of the call to "map", is "map" the right function to be using? It works, but I wasn't sure if it's idiomatic.

10:40 sw1nn: craigglennie: doseq is preffered for side effects

10:46 craigglennie: sw1nn: Thanks, I'll use that

10:56 sobel: what's the difference between a string in "quotes" and a string in ""double quotes"" ?

10:57 Bronsa: sobel: clojure has no double quotes syntax

10:57 sobel: huh. it seems to be successful code (project.clj) and i picked it up of the Sonatype site

10:58 of=off

10:58 oddcully: double and quotes defined?

10:58 "" double quotes "" e.g.

10:58 sobel: :url """"

10:58 oddcully: or is it just some way to quote the quote there?

10:59 sobel: that is the literal example

11:00 ah well, it's not a big deal

11:00 noncom|2: sobel: can you show the full project.clj?

11:00 or at least this part of it

11:01 sobel: noncom|2: the rest of the project.clj is entirely ordinary; i'll make a paste of the :mirrors section

11:05 http://pastebin.com/AT0J0UYs

11:06 i went ahead and stripped identifying info and pasted the whole project.clj

11:07 seems to work the same when i remove the extraneous quotes

11:09 mpenet: sobel: it'll probably be read as {:name "Nexus", :url "", "", :repo-manager true}

11:09 so the url becomes a key (a symbol) with empty str as value

11:10 so yeah, readable, but broken if you need to actually use this mirror

11:12 sobel: mpenet: that makes sense. i figured it was slipping through a quirk of parsing somehow, but not as intended. might write to Sonatype about their example code.

11:12 thanks all

11:12 code is no place for a mystery :)

11:14 noncom|2: sobel: i believe the automata that puts the second " and the human factor were the cause of this mistype

11:15 sobel: noncom|2: true, i end up with unbalanced quotes and parens that way. not every edit is perfectly supported by clever editors.

11:38 bobpoekert: I have a vim-fireplace question: apparently exceptions are supposed to go in the location list, but when I run :lopen I get "E776: No location list"

11:42 oddcully: bobpoekert: something special you are doing? e.g. cpp with a typo gives the exception and :lopen shows it to me

11:42 bobpoekert: I don't think I'm doing anything special. My .vimrc is pretty simple.

11:43 oddcully: how do you trigger the exception?

11:43 bobpoekert: :%Eval

11:53 oddcully: bobpoekert: sorry, can't reproduce in any way. once the exception shows up in the statusbar i get the stacktrace in lopen

11:56 noncom|2: did anyone using Cursive succed in setting up all the hotkeys for clojure ok?

11:57 when I choose a Cursive or Emacs keybindings scheme, it is full of conflicts and does not apply...

12:00 oddcully: bobpoekert: i use git://github.com/tpope/vim-fireplace.git via pathogen. is your version reasonable new?

12:00 bobpoekert: I installed it via pathogen last week

12:01 I'm running vim 7.3, though

12:02 oddcully: i'm on 7.4

12:03 justin_smith: anyone have pros/cons for using jsvc to launch clojure services?

12:09 http://www.rkn.io/2014/02/06/clojure-cookbook-daemons/

12:09 looks good

12:14 i-blis: justin_smith: if you don't mind positive only feedback, been using it very successfully on many projects

12:14 justin_smith: you may want to adjust the jvm settings

12:15 justin_smith: awesome, thats good to hear

12:15 i-blis: justin_smith: and launch a new thread from start

12:15 justin_smith: oh, so basically put my -main in a thread?

12:16 (defn start [] (.start (Thread. -main)))

12:16 i-blis: in -start

12:16 yes, exactly

12:16 justin_smith: cool

12:16 dnolen: cfleming: would be nice if find usages on protocols worked :)

12:17 justin_smith: i-blis: so what happens if I don't create a new thread? accidental shutdown?

12:18 i-blis: justin_smith: jsvc wants the -start method to return fast, if I remember correctly

12:18 justin_smith: ahh, that makes sense

12:18 it thinks something went wrong if it times out

12:18 thanks again for the info

12:19 i-blis: jsutin_smith: oh, and check the jsvc's cli options (I am sure you would have)

12:19 justin_smith: definitely on my to-do list, yes

12:19 i-blis: justin_smith: my pleasure

12:22 justin_smith: and I guess you looked at lein-daemon? (it uses jsvc too)

12:22 I had an issue with it, do not remember what kind, so I went on to harness jsvc and the Daemon class directly

12:22 end of my 2 cts

12:33 kwladyka: (if (contains? {:a nil :b 2} :c) 1 2) - java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn

12:33 / how to write this corretly?

12:35 i-blis: kwladyka: what's the problem?

12:35 ,(if (contains? {:a nil :b 2} :c) 1 2)

12:35 clojurebot: 2

12:35 kwladyka: mmm interesting

12:35 i have error

12:35 like i wrote

12:36 i-blis: you probably had a set of () around (contains?...)

12:36 kwladyka: i have, i paste that like i have

12:36 or i am blind and i dont see difference

12:37 i-blis: I suspect this :

12:37 ,(if ((contains? {:a nil :b 2} :c)) 1 2)

12:37 clojurebot: #error{:cause "java.lang.Boolean cannot be cast to clojure.lang.IFn", :via [{:type java.lang.ClassCastException, :message "java.lang.Boolean cannot be cast to clojure.lang.IFn", :at [sandbox$eval49 invoke "NO_SOURCE_FILE" 0]}], :trace [[sandbox$eval49 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.java" 6792] [clojure.lang.Compiler eval "Compiler.java" 6755] [clojure.core$eval in...

12:38 kwladyka: i have exatly this copy&past (if (contains? {:a nil :b 2} :c) 1 2)

12:39 wow it works in repl console

12:39 i-blis: kwladyka: where, how do you run it?

12:39 kwladyka: but it doesnt work in light table

12:39 mmm i reset light table and it works...

12:39 never mind

12:40 anyway thank you, without you i would spent hours on that :)

12:40 nooga: I want to use future fn to run fire-and-forget job frequently - like sending something to external API without blocking the thread and caring about the result

12:40 i-blis: kwladyka: no pb :)

12:41 nooga: is this a good idea?

12:41 mpenet: nooga: depends on the "frequently" and the duration of the jobs, future runs on a unbounded threadpool

12:43 (which is same threadpool as agents if I recall)

12:49 amalloy: there are two agent threadpools, depending on whether you use send (bounded) or send-off (unbounded). i think these days you can actually specify your own executor even, so you can have any number of threadpools

12:50 nooga: mpenet: like logging events to a time series database using rest api

12:51 I'm writing a service and I want to log 1-3 events per request without delaying the response

12:51 mpenet: amalloy: for agents yes, for future I don't think so


12:51 amalloy: mhm, that's why i said "agent"

12:54 nooga: alternatively, I could conj them to some list and then have a thread runnig that would iterate through this list and do stuff

12:54 but sending them directly without blocking my handler thread would be nice

13:00 hiredman: <ztellman> that is an unbounded queue

13:01 nooga: what is an unbounded queue?

13:03 hiredman: this list you are describing is a queue between some thread and your handler

13:03 nooga: yes, basically that's what I'm trying to implement

13:04 hiredman: if you handler can put stuff on the queue without ever blocking, then unless the thread processing the queue always pulls stuff from the queue way faster than handlers can write stuff, it is an unbounded queue

13:05 java.util.concurrent has a few nice blocking queues

13:05 nooga: oh good

13:05 I'm going to check that

13:06 thanks hiredman

13:06 hiredman: the unbounded queue thing in my best ztellman irc voice was because he just gave a talk about (and has been going on about for sometime) backpressure and bounded queues

13:07 nooga: haha

13:12 J_Arcane: So, data.zip.xml's magic appears to be failing me.

13:14 I have a very simple bit of code, which according to every single example I can find, should work just fine, and yet all I get is ().

13:14 https://github.com/jarcane/wunderprojectj/blob/db4584c3cc8e1243e52ad2f00a5d0dd4c529ca09/src/wunderprojectj/get-data.clj

13:23 TimMc: How come `lein javac` succeeds but `lein deploy` fails on the javac step? https://github.com/brightcove/johnny/blob/master/project.clj

13:23 This is a profiles thing, right? Where it fails to see the junit dependency?

13:23 I don't know how to set this up correctly.

13:26 hiredman: TimMc: add "src/test/java" to java source paths in the dev profile

13:28 (and remove it from the, whatever it is, default profile?)

13:28 TimMc: Ah, of course! That makes sense.

13:29 I had a mismatch in dependencies vs. source paths.

13:34 drguildo: hi. i'm trying to use criterium with a lein project + cider. i added (:require (criterium.core)) to my ns but i can't seem to use criterium.core/bench at all despite being able to use it in a lein repl. am i doing something wrong?

13:35 i'm new to clojure so i probably am. just no idea what.

13:36 puredanger: did you reload the ns?

13:37 drguildo: well i even restarted emacs and it still doesn't work

13:37 but i tried cider-restart

13:38 i'm dumb so i still feel like i don't understand namespaces completely

13:38 TimMc: drguildo: Does require need a vector instead of a list there?

13:38 puredanger: not dumb at all, understanding namespaces when you start is tricky

13:38 drguildo: TimMc: i'm going by the docs on clojure.org

13:38 TimMc: I can't remember which of the namespace modifiers is picky...

13:38 drguildo: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ns

13:39 puredanger: yeah, that should be fine

13:39 drguildo: as i say, it works in lein repl which makes me think it's something about cider

13:39 puredanger: perhaps the repl you are getting with cider is not in the context of your project and doesn't have it's classpath?

13:40 drguildo: i started it with a file from the project in the current buffer

13:40 puredanger: with jack-in?

13:40 drguildo: then did (ns exercises.project-euler) to switch to the file's namespace

13:41 TimMc: ,(require '(clojure.set))

13:41 clojurebot: nil

13:41 TimMc: ,clojure.set/union

13:41 clojurebot: #error{:cause "clojure.set", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.ClassNotFoundException, :message "clojure.set", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$1 run ...

13:41 TimMc: drguildo: Try making it a vector.

13:41 drguildo: but (criterium.core/bench foo) doesn't work

13:41 puredanger: can you (require 'criterium.core) ?

13:42 TimMc: that should work too

13:42 (:require (criterium.core x y z)) says "Require the following namespaces: criterium.core.x, criterium.core.y, criterium.core.z"

13:42 so (:require (criterium.core)) says "Require the following namespaces: ..."

13:43 You're using a prefix list with no suffixes.

13:43 drguildo: TimMc: you're right. it seems to be working in cider now i used a vector.

13:43 does that mean the docs are wrong?

13:44 puredanger: the examples in the docs are fine - you're using it slightly differently

13:44 TimMc: No, it means the docs for clojure.core/ns show a somewhat less common usage.

13:44 (:require (clojure.contrib sql combinatorics)) doesn't bring in an ns calle dclojure.contrib

13:44 drguildo: so how come it doesn't work in cider?

13:44 but works in lein

13:44 puredanger: yeah, that would probably be good to address

13:45 TimMc: drguildo: I don't think it does work in lein.

13:45 drguildo: oh yeah, you're right

13:45 i was doing (require) rather than putting it in an (ns)

13:46 so if it doesn't work, the docs need updating?

13:46 TimMc: It does work, it's just not what you want. :-)

13:46 drguildo: can you explain it to me like you'd explain it to a not-very-bright child?

13:47 TimMc: OK, take (:require (clojure.contrib sql combinatorics)). See how that uses a list instead of a vector?

13:47 drguildo: yeah

13:48 TimMc: That's a shorthand for using vectors this way: (:require [clojure.contrib.sql] [clojure.contrib.combinatorics])

13:49 A different shorthand would be (:require clojure.contrib.sql clojure.contrib.combinatorics) -- drop the enclosing vectors since you're not passing in any options for require'ing those namespaces.

13:49 Put it a different way...

13:50 ,(map #(str "hello " %) ["Alice" "Bob"])

13:50 clojurebot: ("hello Alice" "hello Bob")

13:50 TimMc: ,(map #(str "hello " %) [])

13:50 clojurebot: ()

13:50 drguildo: ahh gotcha

13:50 thanks

13:51 TimMc: Namespace syntax is tricky to learn.

13:51 * drguildo feels 0.0000000001% less dumb

14:07 TimMc: drguildo: You already made it past the require vs. :require stage, so that

14:07 's pretty good. :-)

14:07 ,(ns foo.bar (:println hello))

14:07 clojurebot: hello\n

14:09 amalloy: TimMc: wait what, since when is clojure.set not automatically required? i thought it was one of the big three, or big four or whatever, that are automatically loaded with clojure.core

14:09 TimMc: A couple versions ago, maybe?

14:09 I *think* it was loaded along with the REPL.

14:12 so it might have more to do with the version of lein?

14:14 drguildo: TimMc: so (:require foo bar) just executes (foo bar)?

14:14 puredanger: the clojure.main repl refers a few things from clojure.repl, clojure.java.javadoc, and clojure.pprint and that hasn't changed in at least a few years

14:15 https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L161-L165

14:16 TimMc: drguildo: Nope, (:require foo bar) in the ns form results in a call to (require 'foo 'bar).

14:17 justin_smith: at the top level, it just returns bar

14:17 TimMc: You're not *supposed* to put in things like :println because that's not at all a supported form -- I'm just demonstrating an implementation detail.

14:17 puredanger: justin_smith: you might want to explain why :)

14:18 drguildo: ahh. that's pretty neat.

14:19 justin_smith: any keyword used as a function invokes get, and the second arg acts as a default

14:19 ,(:something :else :entirely)

14:19 clojurebot: :entirely

14:20 TimMc: Oh, you're talking about accidentally using :require outside of an ns block, got it.

14:20 ,(:foo :bar :baz :quux)

14:20 clojurebot: #error{:cause "Wrong number of args passed to keyword: :foo", :via [{:type java.lang.IllegalArgumentException, :message "Wrong number of args passed to keyword: :foo", :at [clojure.lang.Keyword throwArity "Keyword.java" 97]}], :trace [[clojure.lang.Keyword throwArity "Keyword.java" 97] [clojure.lang.Keyword invoke "Keyword.java" 150] [sandbox$eval49 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compile...

14:20 TimMc: oops

14:20 ,(:foo :bar :baz)

14:20 clojurebot: :baz

14:21 TimMc: Sorry, not at full brain today, didn't see justin_smith's demo.

14:21 justin_smith: a classic example of this is the accidental (:or nil :otherwise)

14:21 which even seems OK until the first arg is not nil, but doesn't contain otherwise

14:25 TimMc: ,('+ 2 3)

14:25 clojurebot: 3

14:29 puredanger: ,('+ :banana 99)

14:29 clojurebot: 99

14:29 puredanger: seems right

14:36 hiredman: puredanger: what does 1.7 being in beta mean in regards to patches being merged? I ask just because I had previously written off having a patch make it in to 1.7, but should I raise my hopes at all now that you've looked at clj-1399?

14:39 (I ask only for the sake of my vanity)

14:51 puredanger: you should not raise your hopes :)

14:51 I'm prepping for 1.8 :)

14:51 by pre-screening tickets

14:53 moquist: I just refactored my project to use com.stuartsierra.component, and I immediately ran into the issue caused by reloading protocol definitions in the REPL. I don't see a way to start my system (instantiating component/SystemMap) and reload my code without either losing or hosing the state of the started system.

14:54 This discussion of reloading protocols (https://github.com/clojure/tools.namespace#warnings-for-protocols) says "don't leave old instances around", but that's precisely what I want to do, now that I'm using Component.

14:54 Does anyone have any suggestions for me? I could just re-load my entire system each time, but that's certainly not ideal.

14:55 irctc: Is there a way to reference the threaded variable when using -> ?

14:55 moquist: It's a tiny bit tempting to re-refactor Component back out, so that the state of my system isn't tied up with protocols, so I can reload code in my REPL without restarting the system. :/

14:56 i-blis1: irctc: you could capture it with a macro, what do you want to achieve

14:57 irctc: i-blis1: for instance: (-> {:a [1 2 3]} (assoc :avga (let [r (:a ???)] (/ (apply + r) (count r)))))

14:57 Duke-: irctc: use as-> instead

14:57 amalloy: moquist: i don't think Component is about keeping your program running across reloads

14:57 i-blis1: (inc Duke-)

14:57 lazybot: ⇒ 1

14:58 amalloy: the thing i remember from the Component talk is that Component is designed to *avoid* those problems, by making it easy to tear down your app and restart it

14:58 irctc: :Duke- cool. Thanks!

14:59 amalloy: Duke-, irctc: you don't have to use it "instead", you can use it in addition, which is kinda what it's for

14:59 ,(-> 10 (+ 5) (as-> x (/ x 3)))

14:59 clojurebot: 5

14:59 moquist: amalloy: Ah! Maybe I should watch the/a talk, instead of just reading the docs. That's a helpful observation. Maybe what I should do is handle the 20-second part of system startup some other way.

15:00 (inc amalloy)

15:00 lazybot: ⇒ 264

15:00 irctc: :amalloy very cool. thanks,

15:01 hiredman: puredanger: oooh 1.8

15:01 moquist: amalloy, irctc: Yes, very cool.

15:05 TimMc: Never 2.0, I'm guessing.

15:07 irctc: ,(-> {:a [1 2 3]} (as-> x (assoc x :avg_a (let [r (:a x)] (/ (apply + r) (count r))))))

15:07 clojurebot: {:a [1 2 3], :avg_a 2}

15:09 whodidthis: denormalization! alert

15:10 sobel: ?

15:34 TimMc: Now `lein deploy` is yelling about not finding a connector: "Failed to deploy artifacts/metadata: No connector available to access repository snapshots (snapshots) of type default using the available factories FileRepositoryConnectorFactory, WagonRepositoryConnectorFactory"

15:35 Project file for reference: https://github.com/timmc/johnny/blob/timmc-release-0.1/project.clj

15:36 hiredman: those repos should be pairs

15:36 [[name map] [name map]] vs [[name map name map]]

15:36 TimMc: oy, thanks

15:36 So I probably could have deployed to releases. :-P

15:38 irctc_: I want to use a library from Javascript in a Clojurescript app, but the library uses JavaScript's "require' module, how can I leverage such libraries from within ClojureScript?

15:44 puredanger: might want to move to #clojurescript instead

15:49 amalloy: cfleming: https://cursiveclojure.com/userguide/leiningen.html skips over the one step that i was looking for help with: what is meant by an SDK, and how i should pick one. the menu that appears contains zero items, and the + button just opens a Finder window

15:49 it turns out that the Finder window is pointing at a JDK, and i can just hit Choose without navigating at all to get my default JDK, but at first i was like "argh what SDK does it want, how am i supposed to find one in this Finder window if i don't know what i'm looking for"

15:57 mskoud: Anyone got an example on using boot instead of leiningen to run a ring/compojure webserver?

16:12 gfredericks: am considering using `apt-get install leiningen` inside of docker as the cleanest option for getting lein; anybody do something different?

16:12 haven't checked what version that gets me yet

16:12 (working on that now)

16:16 1.7.1; ouch

16:16 nevermind that I guess

16:19 cfleming: amalloy_: Thanks - someone else just wrote to me with similar feedback, along with many other documentation bugs. It's pretty out of date, I'm going to bring it up to date soon.

16:21 dnolen: Find usages should work for invocations, but doesn't work for finding implementations yet.

16:21 dnolen: Agreed that this would be very nice.

16:25 sobel: gfredericks: not only that, but it will use apt for all jar deps. wondering if the deb package maintainer is at all clear on the concept of leiningen.

16:25 long-story-short, ~/bin/lein

16:26 (i ended up walking away from the lein install when i tried it on my raspberrypi2)

16:26 gfredericks: sobel: like you do a `curl` in your dockerfile?

16:31 oddcully: gfredericks: according to github, curl seems to be the popular approach

16:40 gfredericks: I'm gonna try to convince hypirion to get an official thing on docker hub

16:41 would be nice for versionability as well

16:41 I guess doing such a thing would require choosing a JRE as well :/

16:41 sooo....I guess we'd just bite the combinatorial explosion?

16:42 amalloy: cfleming: i'm just getting used to apple stuff too, so maybe i am just confused about my keyboard, but the "unused import" popup claims i should hit Cmd-F1, where the key that actually seems to work is fn-F1 (ie, actually just F1, since the key without any modifiers does something to do with brightness)

16:43 cfleming: amalloy: You probably want to switch that in OSX, see System Preferences->Keyboard->Use F keys as standard function keys

16:44 amalloy: cfleming: i'm not objecting to whether or not i have to hit Fn, i get that that's a keyboard preference/setting. what i'm saying is, it asks me to hit Cmd as well, but that actually doesn't work

16:44 cfleming: amalloy: Re: the keyboard problem, that's odd - it should prompt with the actual mapped keybinding

16:44 amalloy: Let me check, one sec

16:46 amalloy: So for me, Cmd-F1 pops up the information tooltip, and F1 pops up the doc for the symbol under the caret.

16:47 amalloy: So Cmd-F1 should show you the tooltip without having to use the mouse to hover

16:48 amalloy: oh, i see. cfleming: i was under the impression that pressing this key combination was supposed to actually do something (eg, remove the import, like the analogous eclipse feature), not just add another line to the popup

16:48 so the keybindings are correctly reported, but the key did something i didn't even notice

16:49 cfleming: amalloy: No - if your cursor is on the greyed import, you'll get the lightbulb popup on the left which means you have an intention you can perform there. Then you invoke it via alt-enter.

16:51 twiles: Hey all, I'm working my way through https://github.com/omcljs/om/wiki/Basic-Tutorial, but I'm getting the error below when I try to add a :ref to the JS map after an input text box:

16:51 Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created inside of another component's `render` method). Try rendering this component inside of a new top-level component which will hold the ref.

16:51 Any tips?

16:58 Moses_: I'm trying to figure out how to use JavaScript libraries that are loaded via the "Require" module in Clojurescript

16:58 Any advice?

16:59 bensu: Moses_: try asking in #clojurescript

17:02 devn: Clojure Applied is quite good.

17:13 bridgethillyer: Hear, hear. Clojure Applied is filled with all kinds of useful information

17:18 gfredericks: does it address databases at all?

17:18 the ToC didn't seem to suggest so

17:18 sobel: gfredericks: i'm not quite there yet but i'm inclined to version lein with my code for bootstrapping, and generally stay current

17:23 catern: Is there a good, simple macro in core that I can show off? or what would be a good very simple example of macros?

17:23 gfredericks: sobel: does that suggest anything in particular about docker+lein?

17:23 catern: -> and doto are pretty compelling

17:23 doto especially can be compared with a lot of more repetitive java code

17:24 catern: gfredericks: wow, I didn't actually think I would get a meaningful answer to that question

17:24 but yeah that's a good example

17:24 This is from the perspective of *writing* the code, btw4

17:25 okay, uh

17:25 what is a good example of a use of -> or doto

17:25 (functional style preferred so I guess -> is preferred)

17:25 oh

17:25 nvm, I'll check grimoire

17:27 or, wait, what is the place that has a lot of examples?

17:27 gfredericks: I particularly like to contrast -> and doto with the fluent APIs in java

17:27 catern: grimoire has no examples, it seems

17:29 oddcully: catern: there are several examples for doto

17:29 catern: I'm primarily looking for ->>

17:47 sdalton: hi clojurians, just started learning the language and am trying to create a ring app with compojure. app is running fine (very simple) but i can’t get my tests to pass when the request-method matches. I’m getting a java.lang.ClassCastException: clojure.lang.Cons cannot be cast to java.util.regex.Pattern

17:48 https://gist.github.com/scotdalton/a5302b5687b34ddf621b

17:49 here’s the code. really any insights would be really appreciated. i’ve been staring at it for the past couple of hours and cannot figure it out.

17:51 sobel: gfredericks: not really. i would be happy to wget lein in Dockerfile or import it as a vendored part of my codebase

17:51 gfredericks: just...anything but apt/deb

17:57 sdegutis: Is it possible to programmatically scour through a subset of ClojureScript namespaces to get their public vars?

17:57 hiredman: there is nothing in that code that would do that, can you pastebin your entire stacktrace?

17:58 (my guess would be something in the ring.mock.request library, but the stacktrace will show)

18:00 sdalton: hiredman: thanks! here’s the stacktrace, http://pastebin.com/atFG6CH6

18:01 hiredman: the routes work in the repl with ring.mock.request which is confusing

18:03 hiredman: how are you running the tests? `lein test` ?

18:05 what version of compojure are you using?

18:06 sdalton: hiredman: yeah, lein test. compojure 1.3.3

18:07 hiredman: what does `lein deps :tree` say?

18:08 sdalton: hiredman: http://pastebin.com/AQ61ZDqL

18:11 hiredman: maybe try running lein clean

18:11 sdalton: hiredman: cool. thanks. will do. appreciate you taking a look.

18:15 hiredman: compojure uses clout for routing stuff, and that error is coming out of the interface between the two

18:16 so my guess would be using incompatible versions of compojure and clout, but that seems unlikely and lein deps :tree would generally print a warning

18:16 so given the :gen-class in your namespace maybe you are aot compiling, which can do weird things, and lein clean might help

18:19 amalloy: hiredman: it looks like sdalton has left, but that stacktrace was coming from a totally different file: bigtalk.core-test rather than bigtalk.core

18:21 my guess would be a form in bigtalk.core-test was accidentally (and incorrectly) using compojure's syntax for using specialized regexes for route params

18:23 hiredman: amalloy: uh, the source to core-test is in the gist and it isn't doing that

18:24 (but who knows, the error sames to bare no connection to anything so he may have shared the wrong source or something)

18:25 amalloy: oh, it is. i never look for a second file in a gist (and have my fonts large enough that it's not apparent without scrolling)

19:32 tomjack: I wonder if anyone's thought about cider-jump-to-var and boot?

19:33 (if you have, you know my problem with it already, so I petition for an ~anyone exemption...)

20:33 timvisher: anyone have any tips on clojure 'workflow' libraries? https://github.com/relaynetwork/impresario is very close, but lacks some basic features like exception transitions, etc.

20:33 basically, i'm looking for a library that allows me to create a workflow that will happen asynchronously, recording it's progress in a db

20:34 i think i could probably whip something together without _too_ much trouble using core.async but this feels like something that's probably already been written

20:38 actually prismatic's graph might be something else that could come into play for this

22:03 ADot: ld

22:13 isaac_rks: what is clojure's position on homosexuality

22:17 brehaut_: its fine with homogeneous and heterogenous collections; theres no intrinsic bias

22:24 badfish129: whats the best way to export environment variables on lein server or lein fig wheel without checking them into source control (can't be in project.clj)

22:33 puredanger: You might look at the environ library

23:07 Travisty: This probably isn’t the best place to ask, but does anyone know of a standard reference for hashing?

23:07 I’d like to use hashes in place of a random number generator for certain computational reasons. Mostly I want to read about the concerns for that kind of application

23:11 echo-area: I don't know if it could be counted as a reference or not, but there is a section in Effective Java talking about hashCode

23:11 Also there is https://squarecog.wordpress.com/2011/02/20/hadoop-requires-stable-hashcode-implementations/

23:17 crimeminister: @Travisty not sure if this is helpful for your purposes, but folks looking for a refresher on the subject might appreciate this lecture:

23:17 http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/lecture-7-hashing-hash-functions/

23:18 Travisty: echo-area: Cool, thanks for the reference :) I’ll check it to see if there is something useful :D

23:18 crimeminister: I was watching that a bit earlier in the day :)

23:19 crimeminister: psychic much? :)

23:19 Travisty: So, the actual problem I have is kind of interesting. I want to generate a random vector belonging to the unit sphere in n dimensions, where n is super huge. The only operation I’ll ever do with that vector is computer the inner product with a k-sparse vector

23:19 My hope is to use a hash function to be able to compute the i^th component of this random vector, rather than actually computing it and storing it

23:19 I mean, storing the random direction vector in memory

23:21 if I can use a hash to effectively generate uniform [0,1] random variables, then I think I can do this really quite efficiently :)

Logging service provided by n01se.net