#clojure log - Oct 06 2013

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

0:08 namccarty: Alright, so I have this hairball of a function: https://www.refheap.com/19465 . All of the functions it relies on have been tested and work correctly. It is intended to solve a sudoku board, but it is not doing that. If anyone can make sense of that and tell me what I did wrong, it would be much appreciated. The entire file is here: https://www.refheap.com/19466

0:08 Knowing me it is going to be something stupid like a typo

0:09 coventry: Time to break out clojure.tools.trace.

0:09 https://github.com/timvisher/what-does-tools-trace-do

0:10 namccarty: I'm new to clojure, I have no idea how the debugging tools for it work, thank you coventry

0:11 bitemyapp: I've come really close to writing a traced wrapper for "let"

0:11 So that I don't have to manually wrap trace-forms around it :P

0:14 Passing tests are like a cushy, soft, warm blanket.

0:14 namccarty: I was introduced to lisp through my job, where we use common lisp and pretty much have that. Debugging in clojure feels so different and scary

0:15 ddellacosta: &(map inc [1 2 3 4])

0:15 lazybot: ⇒ (2 3 4 5)

0:15 bitemyapp: namccarty: you don't need it as much and a lot of what you did with a debugger got broken out into various libraries.

0:15 ddellacosta: (showing a friend lazybot in IRC)

0:15 bitemyapp: namccarty: we'd like to see a nicer debugging stack, but the pain isn't great enough to force anybody to do anything about it.

0:15 ddellacosta: far more impressive is the code search.

0:15 ddellacosta: you give it a "before" and "after" of args and output, it automatically finds the function that produces what you want.

0:16 [1 2 3] => '(2 3) will return rest, next, etc.

0:16 ddellacosta: bitemyapp: oh wow, I didn't know that existed, that's amazing

0:16 you do that with lazybot?

0:16 &[1 2 3] => '(2 3)

0:16 lazybot: ⇒ [1 2 3]

0:16 bitemyapp: clojurebot I think. I'm trying to negotiate with it right now.

0:16 ddellacosta: ah, gotcha

0:17 namccarty: bitemyapp: yeah, iv'e noticed that finding the source of problems in clojure is a lot less painful

0:17 bitemyapp: hm. looks like maybe lazybot.

0:18 namccarty: yeah the pure functions do a lot for you there.

0:18 coventry: $findfn [1 2 3] '(2 3)

0:18 bitemyapp: coventry: christ thank you

0:18 need a fucking bot wiki

0:18 lazybot: [clojure.core/next clojure.core/rest]

0:18 bitemyapp: ddellacosta: ^^

0:18 $findfn [1 2 3] 1

0:18 lazybot: [clojure.core/first clojure.core/rand-nth]

0:18 ddellacosta: bitemyapp: seriously, a wiki would be great

0:18 coventry: bitemyapp: Only reason I had it to hand is I used it a few minutes ago in a pm.

0:19 bitemyapp: ddellacosta: I'm working on it :(

0:19 ddellacosta: oh, that's cool, thanks

0:19 bitemyapp: I'd be happy to help, I need to read through the code for lazybot/clojurebot

0:19 bitemyapp: lol @ rand-nth working for my example

0:20 ddellacosta: there's a lot that'll need done. I'm doing some maintenance on blackwater, making Simonides release-ready, and then finishing the Korma chapter for Cookbook. Then I'll move onto the wiki and the other project.

0:20 namccarty: bitemyapp: I'm currently own enough of the company to enforce coding standards, so most of our new-ish common lisp code base is pure functional, but those side effecting procedures sure do muck things up

0:20 coventry: ddellacosta: The relevant library is <https://github.com/Raynes/findfn>. I failed to get it working locally last time I (half-assedly) tried to, though.

0:20 namccarty: One of the other owners is convinced that objects are literally jesus though

0:21 bitemyapp: namccarty: that's regrettable. Clojure can be thought of as, "FP and OOP - the good parts", but with the components separate and simplified.

0:22 namccarty: I would love to use clojure for my next project, but he owns more of the business than I do and likes to muck around in the code base

0:22 bitemyapp: So there's OOP, but it's mostly simple dispatch, types, etc.

0:24 Pupnik_: if you decompile a jar made with clojure, do you get clojure or java out?

0:25 bitemyapp: ucb: http://www.youtube.com/watch?v=FNcSFDt8GiM

0:26 Pupnik_: depends.

0:26 Clojure never becomes Java, fyi.

0:26 It can only be Clojure or bytecode (.class files)

0:26 Clojure is not a source-to-source compiler like ClojureScript.

0:26 Pupnik_: have you read Clojure's source code?

0:27 technomancy: you can get java back from the bytecode, but it won't actually be valid in most cases

0:27 bitemyapp: technomancy: how would you feel about a with-hooks-disabled macro for robert.hooke that can disable multiple vars at a time?

0:28 technomancy: bitemyapp: sounds totes reasonable

0:28 bitemyapp: technomancy: (with-multiple-hooks-disabled [wrapped-1 wrapped-2] ...) seem kosher?

0:28 I'm writing this for Blackwater.

0:29 Pupnik_: bitemyapp: i have not

0:29 technomancy: bitemyapp: wouldn't be to nutty to make the existing macro take a vector or a symbol

0:29 too nutty

0:29 bitemyapp: I can adapt accordingly.

0:30 I'm stashing it in black.water.hook for now, I'll PR whatever comes out of it after.

0:36 namccarty: welp, it appears the source of my problem is that one of my functions decided to have a tricky failure case

0:40 oh, no, that is not it at all

0:40 the source was copy/paste fail

0:41 and stupid tests that didnt cover all cases

0:41 but mostly copy/paste fail

0:52 bitemyapp: namccarty: :)

0:55 namccarty: My sudoku solver works now, I can die happy

0:55 Also, what is the best way to analyze how much time clojure spends in each part of the code?

0:57 I want to see if I can get this to run faster, but have no idea where to start

0:58 My conventional JVM methods of profiling are just leaving me confused

1:05 logic_prog: anyone have a good example of scheme in clojure?

1:05 i.e. almost meta circula evaluator ish

1:11 seangrove: technomancy: Thank you for all the lein goodness

1:26 chare: you are all dumb

1:30 dcunit3d: so i'd just like to say the "dependants" feature of ClojureSphere is awesome when trying to find examples of using an API

1:37 mullr: /ignore chare

1:39 chare: why you mad?

1:42 nightfly: chare | you are all dumb

1:47 devn: Wim Mertens - At The Edge Of The Void

2:16 bitemyapp: alright, I've fucked up this macro.

2:16 https://www.refheap.com/19467

2:17 I would be immensely grateful if anybody could help me puzzle it out.

2:19 It seems like the % in the anonymous function needs to be wrapped in a var so that the deref doesn't fail, but any of my attempts to work around that get boned by gensym.

2:19 * indigo wishes he was less noob at macros

2:19 bitemyapp: Seemingly, anyway.

2:20 indigo: me too, if it meant somebody being able to unfuck my mind.

2:21 indigo: :P

2:48 vmarcinko: noob question...

2:50 i'm making a library that takes arbitrary data structure (vectorsd, nested maps...whatever), walks through it, and finds special "type" of data structure in them, and takes this "typed" piece of data from it, processes it, and replaces it in the same place of original data structure. Now, what Im itnerested is there some idiomatic way to present this type - with special defarecord, or just a vector/map that starts

2:50 with special namespaced keyword..In other words, this type belongs to public API of my lib...

2:51 this special type has some specific data structure in it, so I can extract this pieces of data during processing it

2:52 I started with records, but I dunno if that's heavyweight way for it, whereas just some vector such as [:mylibrary/mytype typearg1 typearg2] would be much better

2:53 TEttinger: metadata seems about right.

2:53 ^:special-type

2:54 vmarcinko: hmmm

2:54 TEttinger: ,[1 2 3 ^:special-type [3 4]]

2:54 clojurebot: [1 2 3 [3 4]]

2:54 TEttinger: invisible to users, but you can query the metadata

2:55 marcopolo2: bitemyapp: Are you using macroexpand-1 to help you out?

2:55 vmarcinko: i thought that meta-data is something "hidden" from lib user...Because, I want the user of my lib to be able to print original map and easily see where are these special types, to be able to easily spot that in nested map

2:55 TEttinger: oh ok.

2:56 vmarcinko: something like:

2:56 [1 2 3 [:mylib/mytype mytaparg1 mytypearg2] 6 7]]

2:56 or maybe use special record in palce of it

2:57 TEttinger: I'd use a symbol, those are unlikely to show up in regular data

2:58 vmarcinko: and what's wrong with keyword?

2:59 im so noob in clojure so i dunno a lot if it

2:59 TEttinger: not guaranteed to not be in the data is all

2:59 symbols aren't either i guess

2:59 there's qualified symbols, which are unique

3:00 ,#'clojure.core/map

3:00 clojurebot: #'clojure.core/map

3:03 vmarcinko: and what about exposing just special-type factory functions, so that one just does:

3:03 [1 2 3 (mylib/create-type arg1 arg2) 4 5]

3:04 so that picked data structure is kind of hidden, lib user just uses fucntion to create it

3:04 although, if he prints the data before passing it to my lib, he will see type of data that I picked to represent this type, so i dunno if this solution si the worst

3:16 bitemyapp: marcopolo2: of course I am using macroexpand-1

3:17 akurilin: Fun bug of the day: don't forget to add an ORDER BY to UNION queries if you're expecting rows to be in a certain order :( On the plus side, it was neat to use c.t.t/deftrace to replace defn for debugging purposes.

3:19 Anybody here got experience with web payment services? I'm thinking Stripe + the Stripe wrappers like Chargebee etc?

3:20 Does one of them suck less than the others?

3:26 bitemyapp: akurilin: Stripe is a good idea.

3:33 akurilin: bitemyapp, I guess in my case we're tempted to go with a more managed solution for the sake of putting it together quickly, and then eventually we can switch to stripe for more control.

3:33 but tbh I still have to do my research into the various differences

3:34 bitemyapp: akurilin: a more managed solution than Stripe? o_O

3:45 dcunit3d: I'm running into problems writing to a BufferedImage: https://gist.github.com/dcunited001/23787c87cb8b34de264a

3:48 i'm getting this error: No matching method found: setPixels for class sun.awt.image.ByteInterleavedRaster

3:49 akurilin: bitemyapp, I think what these services on top of stripe offer is the ability to do most of the customization of your payment plans online, get analytics and notifications etc. Really hard to tell at this point if it's worth it, so I'll need to try out the different styles.

3:49 dcunit3d: when that method clearly exists, according to the documentation: http://www.docjar.com/docs/api/sun/awt/image/ByteInterleavedRaster.html#setPixels(int, int, int, int, int)

3:50 i've found a ton of basic examples of using graphics with clojure, but nothing that shows how you would actually write graphics code in the real world.

3:51 namccarty: I've got an example of an image resizing program I wrote for the lawls a while back, if you want to take a look at it

3:51 dcunit3d: for example, i could easily use .setPixel, which is apparently 2 orders of magnitude slower than working with the pixels array directly

3:52 namccarty: yeah, that is what i wound up doing in my application

3:53 what you could try doing is creating your own raster, then using setData() on buffered image to write it

3:53 im looking into it but that is all i have come up with so far

3:54 dcunit3d: thanks, i'll try using that

3:54 opqdonut: dcunit3d: the problem is that clojure doesn't know those are ints (instead of e.g. Longs)

3:54 dcunit3d: try (.setPixels (int 0) (int 0) (int sizex) (int sizey) data)

3:54 (and (int data))

3:54 dcunit3d: k

3:55 if the last on is an int[] array, how do i typecast that?)

3:55 opqdonut: yeah, I just realized

3:55 actually, now that I look at the other setPixels methods

3:56 from WriteableRaster

3:56 it should be enough to hint the data as

3:56 ^ints

3:56 namccarty: umm, you could also try making sure that you are creating the array using int-array

3:57 opqdonut: that too

3:57 of course you can have data be a sequence and convert it to an int array with int-array inside digit-image

3:57 namccarty: either way works just the same

3:58 dcunit3d: cool, trying it out

3:58 opqdonut: anyway, "could not resolve call" doens't mean "this method doesn't exist", it means "I don't know which of these methods to call"

3:59 oh, right, you had a "No matching method found" instead

4:02 dcunit3d: learning clojure is really my first foray into java programming since 2005 lol

4:03 namccarty: personally, ive got a lot of experience on the jvm, in functional programming, and in lisp

4:03 but am still new at the three put together

4:03 dcunit3d: i think i have 75 tabs open lol

4:04 namccarty: oh god, i've got a wall of montiors, and you should see what they look like when I am learning a new language/feature

4:04 and by wall i mean 4

4:04 dcunit3d: lol nice

4:04 namccarty: i think ive gone well past 100 tabs before

4:04 TEttinger: 300 in firefox

4:05 chrome can't handle as many

4:05 dcunit3d: lol omg

4:05 i know, i've been thinking about switching to firefox bc of memory.

4:06 TEttinger: so I'm trying to figure out a macro ns shenanigans thing

4:06 dcunit3d: i have instances of chrome setup for email, github, docs and localhost apps. then hotkeys to switch between them

4:06 namccarty: ive got about the same

4:07 TEttinger: when you AOT hiphip, it tries to load the same file with different vars setup, and fails on the second run through that file.

4:07 namccarty: plus one more for the gitlab for my work projects

4:07 TEttinger: https://github.com/Prismatic/hiphip/issues/1

4:07 hm maybe I could do it with ^:dynamic

4:12 dcunit3d: hmm i'm running into this message when using ^int type hints: "Only long and double primitives are supported"

4:14 hiphip looks cool

4:14 namccarty: hmm

4:15 instead of using type hints, maybe try wrapping them in calls to int?

4:16 that being, wrap them in (int your-stuff-here)

4:16 right where you call setpixels

4:17 see what that does

4:17 amalloy: dcunit3d: functions can't take primitive ints as arguments

4:18 dcunit3d: i'm trying to call a java method that takes (int,int,int,int,int[])

4:19 namccarty: dcunit3d: try what i said with the wrapping them in calls to int, like (.setPixels 0 0 (int sizex) (int sizey) data)

4:19 im not 100% on if that will work

4:19 but worth a shot

4:19 dcunit3d: k, trying that

4:19 thanks namccarty

4:20 namccarty: did it work?

4:20 dcunit3d: one sec

4:21 no, but i'm trying to wrap data as (int-array data)

4:22 namccarty: hold on, let me load up the repl

4:23 we are going to get this working

4:23 chare: I am making progress on reading opengl book

4:23 got to here http://www.arcsynthesis.org/gltut/Positioning/Tut06%20Translation.html

4:24 you guys mad?

4:24 dcunit3d: it's going to be hard to run the code in the gist. i need to update the project on github. one sec

4:24 chare: what code you talking about

4:25 namccarty: the code he cant figure out how to get to work

4:26 chare: whic his

4:26 namccarty: the code he is working on pushing to github right now

4:26 dcunit3d: https://github.com/dcunited001/handwritten-digits

4:27 thanks again namccarty

4:27 namccarty: no problem, just trying to work back the karma from when someone helped me eairler

4:27 utkarsh: ,(def q 10) `(~q ~'r ~'n)

4:27 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

4:27 chare: oh dcunit3d is that guy who can't get images working

4:28 dcunit3d: chare: i've tried using JOGL, but ran into problems getting that library to import. seems like overkill when i just need to write an image.

4:28 utkarsh: nvm, how can I make this expression simpler: `(~q ~'r ~'n) ?

4:28 namccarty: yeah, JOGL would be overkill when all you want to do is write an image, espically if you already have the image you want to write

4:29 dcunit3d: namccarty: once you clone, you should just be able to `lein deps` and `lein run`

4:30 namccarty: getting the deps now

4:32 utkarsh: hmm, (list q 'r 'n) works..

4:34 dcunit3d: namccarty: i'm writing a quick test for draw.clj that won't require the JFreeChart

4:35 namccarty: dcunit3d: does the error you are getting show up when the main function is called?

4:36 dcunit3d: yeh

4:36 namccarty: only error im getting is a class cast exception

4:36 dcunit3d: currently "clojure.lang.PersistentVector cannot be cast to java.lang.Number"

4:36 namccarty: yeah that is it

4:37 are you sure your example is handing it the arguements in the right order?

4:38 no, thats not it

4:39 alright, this is strange, all the arguements are what they are supposed to be

4:39 a vector, an int and an int

4:40 dcunit3d: i think so

4:41 namccarty: wait

4:41 there are parens there

4:41 your vector is wrapped in a list or a seq or something

4:42 i think

4:43 dcunit3d: that might be right, i just pushed up a test for draw/digit-image

4:43 no assertions, but i'm not getting the error when i directly specify the vector. so that must be the problem

4:44 namccarty: Its looking like data is wrapped in a lazy seq

4:46 alright, unrapping that using first moves the error

4:46 trying something, I think ive got it

4:46 dcunit3d: i'm doing (head images) instead of (first images)

4:47 namccarty: and now i somehow managed to blow up emacs

4:47 that doesnt even make sense

4:48 yeah, staying inside draw.clj, when i unwrap that lazy seq the error shifts to a no matching constructor for buffered image

4:49 dcunit3d: i've run into that a few times. if i try to work with all the images and i use `nrepl-jack-in` then i run out of memory and emacs blows up.

4:52 namccarty: alright, i think ive got it working

4:53 let me just test that

4:54 holy balls that worked

4:54 dcunit3d: for real?

4:54 what'd you do?

4:54 namccarty: ive only modified digit-image, let me paste it

4:55 http://pastebin.com/sbrXPme5

4:55 that executes with no errors

4:56 if you have fixed the lazy seq thing else where, remove the call to first

4:56 dcunit3d: k

4:57 namccarty: that was just there to pull the vector out of the lazy seq

5:01 dcunit3d: awesome!

5:01 namccarty: looks like its drawing correctly

5:01 dcunit3d: i haven't been able to get it to draw yet

5:01 namccarty: added a piece of code to dump the image you were making to a file, and it looks roughly like a letter

5:02 http://puu.sh/4IT0p.png

5:02 that is the image that is getting made

5:02 dcunit3d: k, i was just trying to view the data on the chart, but i think i have some different issues with JFreeChart

5:02 namccarty: well, at least the code that actually makes the image appears to be working

5:02 dcunit3d: might also have some encoding issues, but maybe not, that pic looks correct

5:03 this is great!

5:03 namccarty: looks like it

5:03 dcunit3d: with the awt bufferedimage, i can use either JFreeChart or Swing.

5:04 looks like i might need to set up swing

5:04 thanks again :)

5:04 namccarty: no problem

5:30 TEttinger: wolfes, are you Jason Wolfe?

5:50 sm0ke: how do i pretty print a map?

6:01 dcunit3d: namccarty: i'm gettin closur https://raw.github.com/dcunited001/handwritten-digits/master/100digits.png

6:02 * namccarty nods approvinglynoo

6:02 namccarty: apparently i forgot how to use a keyboard typing that

6:11 jimrthy: sm0ke: pprint

7:23 piranha: is there a better idiom for (or (:one data) (:two data) (:three data)) ?

7:26 TEttinger: does ##({:one 1 :two 2} :one) do what I think it does...

7:26 lazybot: ⇒ 1

7:26 opqdonut: ,(some {:a 1 :two 2 :three 3} [:one :two :three])

7:26 clojurebot: 2

7:26 opqdonut: how about that?

7:26 TEttinger: ,(some {:a 1 :two 5 :three 7} [:one :two :three])

7:26 clojurebot: 5

7:27 TEttinger: uh, it seems to be fetching the first hm

7:27 opqdonut: obviously

7:27 ,(doc some)

7:27 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

7:27 TEttinger: it could have been saying how many matched I thought

7:27 opqdonut: right

7:29 but using some gives you the same laziness as using or: it stops when the first match is found

7:30 piranha: opqdonut: not bad

7:31 exactly what I need :) ##(some {:class-name "test" :className "qwe"} [:class-name :className :class])

7:31 lazybot: ⇒ "test"

7:31 Mendor|scr: what is the best analog for conj function if I need to add a single item to the head of the collection?

7:32 opqdonut: Mendor|scr: conj does that for lists

7:32 ,(conj (list 1 2 3) :a)

7:32 clojurebot: (:a 1 2 3)

7:33 Mendor|scr: opqdonut: thanks

7:33 opqdonut: for vectors conj appends:

7:33 ,(conj [1 2 3] :a)

7:33 clojurebot: [1 2 3 :a]

8:22 dcunit3d: this is a good example of working with buffered images in clojure using swing for ui http://clojurefun.wordpress.com/2013/08/31/visualising-singapores-mobile-phone-data-with-core-matrix/

9:05 klrr_: okey, i got a project with this core file https://gist.github.com/klrr/6853503 and this file https://gist.github.com/klrr/6853506 when i compile i get this error:

9:06 CompilerException java.lang.RuntimeException: Unable to resolve symbol: connect in this context, compiling:(tob/core.clj:4)

9:06 any ideas what's wrong?

9:06 (also, code is from here: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/ )

9:10 ambrosebs: klrr_: (:require [tob.irc :refer [connect]])

9:11 klrr_: ambrosebs: i get same error

9:11 i think the problem is that i use def, if i use defn it's not evauated before its needed

9:12 damn same error even with defn

9:13 ambrosebs: klrr_: tried restarting your REPL? that should work

9:13 you should get a new error now

9:13 complaining about login

9:14 klrr_: CompilerException java.lang.RuntimeException: Unable to resolve symbol: connect in this context, compiling:(tob/core.clj:4)

9:14 same error

9:14 the problem is that it cant be used int that context, but in tutorial he just put it randomly i got no idea how he means i should def irc?

9:15 connect doesnt return a ref

9:15 it returns unpure side effects

9:15 and start printing random stuff

9:16 ambrosebs: klrr_: it's implied he's using connect in the same namespace

9:16 klrr_: eh? ok

9:17 i just put everything in core.clj then?

9:17 ambrosebs: klrr_: sure

9:17 klrr_: now i get this error

9:17 CompilerException java.lang.RuntimeException: Unable to resolve symbol: codetalk in this context, compiling:(tob/core.clj:39)

9:18 ambrosebs: klrr_: do you understand how require/refer works?

9:18 klrr_: https://gist.github.com/anonymous/13c7da60603ffd1b0994

9:18 i dont know anything im just trying to get the code working so i can start read it and learn how it works

9:19 i presumed i could just copy paste it in a leiningen project and it would work...

9:19 ambrosebs: klrr_: it should, you are adding extra code. Should only be one ns form

9:19 klrr_: ups

9:19 ambrosebs: klrr_: it's worth figuring out how clojure namespaces work, see http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols

9:20 klrr_: once you get it, it's easy

9:20 klrr_: hmm now it compiles

9:20 but the bot doesnt connect xD

9:21 irc bots hates me, i tried write one in racket i rewrote it two times and couldnt get it work and no one in their irc understood why it didnt work ...

9:21 ambrosebs: that's not my area ;)

9:22 klrr_: ambrosebs: thanks for help :)

9:22 ambrosebs: klrr_: good luck :)

10:05 in what situation would reduced? be useful?

10:05 isn't the point that a Reduced is always wrapped? just useful for an implementation of reduce?

11:40 sm0ke: hey guys anyone here using http kit?

11:42 joegallo: are you conducting a survey, or is there a second question?

11:42 ;)

11:42 which is to say, just ask the question you want to ask...

11:44 sm0ke: joegallo: oh sorry

11:44 joegallo: i just wnted to ask what i need to do for making a rest endpoint asynchronous

11:44 joegallo: no worries :)

11:45 sm0ke: then i just saw with-channel api..i think thats the way right?

11:47 joegallo: i dunno -- the documentation says something about the with-channel api not being compatible with rc releases. that makes me wonder if it's still the way to do things...

11:48 ah, i guess they're talking about the pre-2.0 rcs

11:48 so it sounds to me like with-channel is the thing

11:48 sm0ke: joegallo: right

11:48 joegallo: but i'm just some guy on the internet reading the documentation :)

11:49 sm0ke: thats creepy

11:49 who reads documentation?

11:50 crap man after writing one week of clojure..i find myself parenthesizing everything in my scala code

11:51 eh..lisp is like vim when it comes to habits

11:51 indigo: Or the usual

11:51 "I wish this language had macros"

11:51 sm0ke: indigo: :( i dont do macors .. yet

11:52 indigo: are they really that useful? i hear a lt of praise

11:52 indigo: Yep, they help you write more concise code

11:53 sm0ke: :( i want to learn macros

11:53 indigo: Nothing's stopping you ;P

11:53 sm0ke: may be i will give some time today to learning macros

11:54 but still i havent touched macros but it found writing in scala immensly better than scala

11:54 eh wtf..i meant writing in clojure

11:55 indigo: Heh, I haven't touched Scala

11:55 sm0ke: for first the whole ring compojure thingy is very very intutive and easy to work with

11:55 for learining it you just need to know maps

11:56 secondly working with json in clojure is also effortless

11:57 indigo: Middleware/cheshire ftw

11:57 sm0ke: thrid, after trasitioning from scala actors to core.async ... i realize how wrting actors was such a liability

11:58 although i still miss pattern matching in scala..but i really see that clojure has enirelt different choices to avert that

11:59 alandipert: sm0ke: there's https://github.com/clojure/core.match

12:00 llasram: sm0ke: Saw your message from earlier. Using nippy in abracad wouldn't make much sense, because the whole point of abracad is Avro for Clojure via the Java implementation

12:00 sm0ke: Also, it's only slower right now because no one has spent time making it fast :-)

12:00 The backing Java implementation is highly tuned

12:01 sm0ke: llasram: ah i see.. sorry i didnt dig into your code i was thinking may be you are using edn for ser/de

12:02 llasram: And because Avro has schemas, it should be possible to use code-generation to produce optimized per-schema de/serialization code at run-time

12:02 dnolen: sm0ke: fwiw, other Scala -> Clojure people seem happy with core.match

12:02 for pattern matching

12:02 llasram: sm0ke: Ah, no. the EDN-in-Avro stuff encodes the same data structures as EDN, but doesn't actually use the EDN serialization format

12:03 sm0ke: dnolen: alandipert yes i know about core.match .. still have to look into it :)

12:04 dnolen: sm0ke: about the only thing that's missing according to David Pollak is function application in the match

12:05 sm0ke: llasram: but still no one compiles avro to classes right..i mean it defeats the purpose SO that implies 90% of time you will ser/de clojure maps? should a clojure ser/de librry make a better fit?

12:05 dnolen: you mean guards?

12:05 dnolen: sm0ke: no

12:06 sm0ke: so maybe you won't notice ;)

12:07 llasram: sm0ke: Well, lots of people using Avro from Java build classes :-). But no, Abracad doesn't depend on the Java Avro compiler, and won't. I was proposing that Abracad could have a Clojure implementation which complied schema-specific de/ser code at *runtime* (via eval)

12:10 sm0ke: hmm its odd to hear lost of people compile avro.. but i guess for people working with hadoop ecosystem its a natural choice

12:16 anywho if i hit a roadblock i will find you here..time to fix some scala code now

12:20 dnolen: jonasen: finally got around to removing the weird namespace convention around data structures in CLJS

12:23 jonasen: dnolen: I saw that. Also thanks for accepting my patch with the alias issue

12:23 dnolen: jonasen: np

12:29 jonasen: dnolen: Any clojurescript issue(s) you need help with? I've got some extra time this week so if you need help with anything please let me know!

12:32 dnolen: jonasen: CLJS-456/603 is particularly annoying - it seems like what we have should just work, though I'm not sure why it doesn't.

12:33 jonasen: dnolen: Ok, I'll take a look at it

12:33 dnolen: jonasen: the name of a fn can shadow a namespace, but we have logic for this situation, we should be able to reuse it

12:34 jonasen: or anything you see on the major list that looks fun, the shadowing one does not look fun to me ;)

12:44 zachoakes: has anyone tried getting clojure to work with robovm?

13:16 jonasen: dnolen: ping

13:20 I'm pretty sure both CLJS-456 and 603 are fixed in master. I can't reproduce either of them (and 456 is just a simple repl session).. I'll try to come up with a simple script so I can git bisect and see which commit resolved the issues.

13:20 * fu86 is away (weg ...)

13:24 zachoakes: does anyone know if you can :import a java class without having it be initialized?

13:27 vmarcinko: i asked this question before, but not many advices then, so ill ask again now... im making a lib that is basically processing arbitrary data structure (vector, nested maps whatever), and walks through it, and when it finds some data structure of some special type, belonging to lib's public API, it processes it and replaces it on the same place of original data structure where it was contained

13:28 so, my question is what is preferred way in clojrue to define that special type

13:28 i can make it in few ways

13:28 Using namespaced keyword marking special type:

13:28 [1 2 3 [:mylib/specialtype mytaparg1 mytypearg2] 6 7]]

13:29 Using factory function to create special type

13:29 (regardless what data structure is used under the hood although it can be seen if printed after fn evaluation)

13:29 [1 2 3 (mylib/create-specialtype mytypearg1 mytypearg2) 6 7]]

13:29 Using records:

13:29 [1 2 3 (->mylib/SpecialType mytypearg1 mytypearg2) 6 7]]

13:29 Or maybe special reader tag?

13:29 [1 2 3 #mylib/SpecialType (mytypearg1 mytypearg2) 6 7]]

13:29 so I dunno which one to pick? its important because the solution will be exposed as lib's public API

13:59 ibdknox: technomancy: were the pre 2.3.3 versions of Leiningen removed from Clojars on purpose?

14:06 juliangindi: Hey everyone, I am attempting to run my clojure app using supervisor on my Ubuntu server. I have the config file set up to run "leon trampoline run" but I keep getting logged errors that say "Failed to download https://leiningen.s3.amazonaws.com/downloads/leiningen-2.3.2-standalone.jar" any ideas?

14:06 jonasen: dnolen: According to my testing this commit fixed both issues: https://github.com/clojure/clojurescript/commit/9ddf847b44ec82070e91038f4afbd8a2baec94ff

14:11 xeqi: ibdknox: no, they were all removed when he was trying to fix a partial deploy

14:11 ibdknox: they should be back up with metadata showing them

14:11 though he still needs to fix the metadata for 2.3.3

14:13 ibdknox: xeqi: thanks for the info :)

14:15 dnolen: jonasen: ok thanks, going to add a test to be extra sure

14:16 jonasen: dnolen: that was "low hanging fruit". Two bugs squashed, zero lines of code written! :)

14:16 dnolen: jonasen: my favorite :)

14:45 klrr_: is leinigen a standalone build system or some kind of wrapper around java stuff?

14:51 jonasen: dnolen: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/tagged_literals.clj#L7

14:52 ^^ PersistentQueue/EMPTY -> PersistentQueue.Empty

14:52 dnolen: jonasen: thx, btw it looks like CLJS-604 is not actually resolved, there's definitely a problem with multiple arity fns and self calls ...

14:52 jonasen: otherwise I get WARNING: No such namespace: cljs.core.PersistentQueue

14:52 dnolen: jonasen: fixing now

14:53 jonasen: fixed in master

14:54 jonasen: 604? I didn't look at that one

14:55 xeqi: klrr_: the dependency resolution is a wrapper around aether, the task evaluation is its own system, and things like clojure/java compilation are a task that wrap the clojure/java compilers

14:56 profiles and profile merging is its own system

14:56 klrr_: okey, thanks!

14:56 jonasen: dnolen: you mean 603, right? How did you test it? with the foo.tar.gz attachment?

15:01 dnolen: jonasen: https://github.com/clojure/clojurescript/compare/603-multi-arity-shadow

15:02 jonasen: dnolen: I mean how did you test 603, when you came to the conclusion that it's not yet fixed in master

15:02 dnolen: jonasen: ^ this test fails

15:02 jonasen: oh, sorry

15:03 dnolen: jonasen: it pretty weird I don't see why the fn doesn't get resolved to the local we create

15:03 probably something simple

15:03 indigo: Can anyone recommend me a good validation library for Compojure that follows the "clojure way"

15:05 Bronsa: dnolen: would you take a patch for cljs removing the cljs.core/try macro and making try the special form instead of try*? rationale: reducing the number of different special forms between cljs/clojure

15:06 dnolen: Bronsa: sure

15:06 Bronsa: ok cool

15:13 dobry-den: indigo: i havent used it but this looks simple https://github.com/brentonashworth/sandbar/wiki/Form-Validation

15:14 check out https://github.com/leonardoborges/bouncer

15:16 `some-fn` is a cool way to roll your own simple validator

15:18 dnolen: jonasen: ok, I think I know what's going on with 603, bad emit :invoke optimization logic, somehow skipping over the proper munging - passing in a string somewhere instead of the required map that includes shadow information

15:23 Bronsa: dnolen: http://dev.clojure.org/jira/browse/CLJS-613 the patch also changes the :op from :try* to :try -- this is a potentially breaking change for tools relying on the cljs analyzer

15:24 dnolen: Bronsa: k, you should ping ambrosebs about that, don't think anybody else is really using the analyzer

15:25 jonasen: dnolen: is it possible to run the test suite with whitespace optimizations

15:25 ?

15:26 dnolen: jonasen: hrm, I never do that - probably but would need to patch goog.provide, require I think?

15:27 jonasen: ok

15:30 dnolen: jonasen: should be able to solve 603 w/ :simple though, I'm 95% sure it's because we call munge on the name instead of info

15:31 algernon: if anyone in here has some experience with laser: if I have a fragment (via parse-fragment), how do I get back a part of it, which I can use with l/content?

15:32 as in, I have a fragment f, which has an element with class i-want-you, I want that element lifted out, and used elsewhere within a transformation

15:33 dnolen: jonasen: actually I fixed it

15:33 jonasen: dnolen: awesome!

15:39 dnolen: about bad namespace convention.. there are probably lots in the tests, try running e.g. grep -r "/EMPTY" test

15:40 dnolen: jonasen: thx fixing that now too

15:42 jonasen: ok gotta run thx for the help

15:53 zachoakes: does anyone know how to prevent static initializers from running when a java class is imported?

16:11 joegallo: zachoakes: i don't think that is possible

16:12 zachoakes: joegallo: i figured not, but i'm surprised i haven't found more people discussing it, considering it can make a lot of java libraries difficult or impossible to use

16:13 joegallo: how so?

16:13 zachoakes: well if someone writes a static initializer with the intention of having it run at runtime, and clojure makes it run at compile time, weird things can happen

16:15 i'm trying to get clojure to work with robovm, but this is turning out to be a roadblock for me

16:18 joegallo: ahhhhh

16:38 anyway, i suppose you could do all your importing at runtime using Class/forName

16:38 for the class or classes whose static initializers you wish to avoid

16:39 zachoakes: i was going to try that, but what i'm doing requires AOT for the classes in question

16:39 joegallo: dang

16:47 gfredericks: how does nrepl.el handle multiple connections? E.g., how do I know/control which connection a buffer is associated with?

17:05 does conch let me set the subprocess's working directory somehow?

17:09 yes it does.

17:21 bbloom: anybody know what's the difference between hash and hasheq in the clojure code?

17:21 and/or the motivation for it

17:21 gfredericks: "the clojure code" is "the java backend to clojure"?

17:21 bbloom: yeah

17:21 gfredericks: ,hasheq

17:21 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hasheq in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:22 bbloom: ,clojure.lang.IHashEq

17:22 clojurebot: clojure.lang.IHashEq

17:22 gfredericks: my fuzzy understanding is that hashCode is the Object method and it tries to conform to java-style equality, while hasheq is clojureland equality semantics

17:22 I'm short on details here though

17:22 bbloom: yeah, that much i guessed, but was hoping for some deeper insight

17:23 gfredericks: ,[(.hashCode (Integer/parseInt "31")) (.hashCode (Long/parseLong "31"))]

17:23 clojurebot: [31 31]

17:23 gfredericks: ,[(.hashCode (Integer/parseInt "-31")) (.hashCode (Long/parseLong "-31"))]

17:23 clojurebot: [-31 30]

17:23 gfredericks: ,[(hash (Integer/parseInt "-31")) (hash (Long/parseLong "-31"))]

17:23 clojurebot: [30 30]

17:24 gfredericks: hasheq should be consistent across the numeric types that clojure considers compatible

17:25 bbloom: that makes sense, but i dunno why there is a need for both, rather than just making the normal hashCode work for that purpose

17:25 gfredericks: another question I don't know the answer to is why BigInt exists (I think this is related)

17:26 maybe it relates to collections containing "equal" things with different hashCodes?

17:26 Bronsa: ,(.hashCode [(Integer. -1)])

17:26 clojurebot: 30

17:27 Bronsa: ,(hash [(Integer. -1)])

17:27 clojurebot: 31

17:27 gfredericks: ,(let [m1 [(Long. -42)] m2 [(Integer. -42)]] [(map hash [m1 m2]) (map #(.hashCode %) [m1 m2]))

17:27 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

17:27 gfredericks: ,(let [m1 [(Long. -42)] m2 [(Integer. -42)]] [(map hash [m1 m2]) (map #(.hashCode %) [m1 m2])])

17:27 clojurebot: [(72 72) (72 -11)]

17:28 Bronsa: I guess it might have something to do with equiv vs equals

17:28 gfredericks: bbloom: this was all tied up with a major bug I found at work wrt set equality, and even then I didn't really understand what was going on

17:28 bbloom: equality is all kinds of hard :-/

17:29 Bronsa: ,(.equiv [(Integer. -1)] [-1])

17:29 clojurebot: true

17:29 Bronsa: ,(.equals [(Integer. -1)] [-1])

17:29 clojurebot: false

17:32 bbloom: hmmm

17:33 ghadi_shayban: technomancy: Saw your name on a dns-sd lib for ruby from a few years ago

17:33 any recommendations for calling DNS-SD on osx from clojure?

17:33 technomancy: ghadi_shayban: haha, wow that brings me back

17:33 ghadi_shayban: was just going to shell out to dns-sd command

17:34 technomancy: no idea about macosecks, but I've played a bit with an avahi-like java lib

17:34 ghadi_shayban: i have linux covered with avahi

17:34 which one?

17:34 technomancy: jmdns: https://github.com/Seajure/cabeza-de-vaca/blob/master/src/cabeza/de/vaca.clj

17:34 just very briefly

17:35 bbloom: ,(pop clojure.lang.PersistentQueue/EMPTY)

17:35 clojurebot: #<PersistentQueue clojure.lang.PersistentQueue@1>

17:35 bbloom: ,(pop [])

17:35 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector>

17:35 bbloom: *sigh*

17:35 gfredericks: ,(pop ())

17:35 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Can't pop empty list>

17:36 bbloom: public PersistentQueue pop(){

17:36 if(f == null) //hmmm... pop of empty queue -> empty queue?

17:36 gfredericks: is anything else poppable?

17:36 bbloom: return this;

17:36 //throw new IllegalStateException("popping empty queue");

17:36 whoops, sorry for big paste

17:36 gfredericks: is returnth the old timey version of return?

17:36 bbloom: gfredericks: map entries

17:37 gfredericks: ,(-> {1 2} first pop pop)

17:37 clojurebot: []

17:37 bbloom: other than that, nothing i see

17:37 gfredericks: ,(-> {1 2} first pop pop pop)

17:37 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector>

17:39 rurumate_: ,(assert (Boolean. false))

17:39 clojurebot: nil

17:41 rurumate_: looks like bug in clojure.core/assert

17:42 bbloom: rurumate_: nah, it's a well known behavior that nil and the singleton false value are the only logically false values

17:42 singleton false *instance* i mean

17:42 ,(if (Boolean. false) 1 2)

17:42 clojurebot: 1

17:43 bbloom: ,(if (boolean (Boolean. false)) 1 2)

17:43 clojurebot: 2

17:43 bbloom: ^^ use that if you need to coerce

17:43 rurumate_: is that consistent with java's assert?

17:43 bbloom: no, it's consistent with clojure's notion of generalized booleans

17:44 (ie generalized to nil and all other objects as false and true respectively)

17:45 rurumate_: it's a bit tricky for java programmers imo, at least there should be a big WARNING in the docs

17:46 bbloom: (doc if)

17:46 clojurebot: Huh?

17:46 bbloom: ,(doc if)

17:46 clojurebot: I don't understand.

17:46 bbloom: *sigh*

17:46 rurumate_: Boolean.FALSE is the new true

17:46 bbloom: #(doc if)

17:46 &(doc if)

17:46 lazybot: ⇒ "Special: if; Evaluates test. If not the singular values nil or false,\n evaluates and yields then, otherwise, evaluates and yields else. If\n else is not supplied it defaults to nil."

17:46 bbloom: finally :-P

17:46 (doc assert)

17:46 clojurebot: "([x] [x message]); Evaluates expr and throws an exception if it does not evaluate to logical true."

17:46 bbloom: notie "logical true"

17:46 notice* logical true

17:46 rurumate_: hmm

17:47 bbloom: i'm not claiming it's documented super well

17:47 but it is documented… modulo the (Boolean. false) edge case

17:47 being not-confusing to java programmers isn't a goal of clojure :-)

17:48 rurumate_: well for me, it is a goal

17:48 at least the docs can get updated

17:49 maybe put WARNING here and there

17:49 bbloom: i don't think the docs can or should point out every edge case

17:49 should that warning be put on "if" or on "assert" or on every function in the entire standard library that acts as or operates on the result of a predicate?

17:49 rurumate_: bbloom: well maybe not

17:50 bbloom: rurumate: it's also documented clearly & covers that edge case here: http://clojure.org/special_forms

17:51 "if you are creating your own boxed Booleans make sure to use Boolean/valueOf and not the Boolean constructors."

17:52 rurumate: Note that if does not test for arbitrary values of java.lang.Boolean

17:53 like Boolean.TRUE, Boolean.FALSE and Boolean.FOO

17:53 bbloom: "Note that if does not test for arbitrary values of java.lang.Boolean, only the singular value false (Java's Boolean.FALSE)"

17:53 it literally says that

17:55 rurumate: ,(if Boolean/FALSE "not" "not not")

17:55 clojurebot: "not not"

17:56 rurumate: ,(if (Boolean. Boolean/FALSE) "not" "not not")

17:56 clojurebot: "not"

18:04 bbloom: gfredericks: while i'm studying clojure's internals…. i'm not quite sure why vector nodes have the AtomicReference<Thread> edit

18:06 don't all potential edits go through the interface of ITransientVector? meaning that edit rights could be checked at assoc! and pop! time ?

18:11 where's mmarczyk when you need him? :-P

18:17 gfredericks: bbloom: is this a transient question in particular?

18:17 bbloom: yeah

18:18 * gfredericks pokes around

18:19 gfredericks: oh I see the node has it despite being used by the persistents as well?

18:19 bbloom: so it's a mutable atomic cell that's null by default, but set to the current thread when editing a transient vector

18:19 then when you call persistent!, it sets it to null

18:20 but for some reason it propagates the mutable cell around to nodes

18:20 seemingly only for ensureEditable

18:21 but i guess in theory i can edit a node w/o permission if i use java interop? but other than that, i can't think of any reason to weave that cell through the nodes

18:23 * gfredericks thinks thinks thinks

18:25 gfredericks: the alternative is to track editability just at the top level of each transient object?

18:25 rather than paying attention to any given node?

18:26 bbloom: yeah, so look at PersistentArrayMap

18:26 it's much much simpler (no interior nodes)

18:26 TransientArrayMap simply has a `Thread owner` field

18:28 gfredericks: yeah it seems as if the only reason to do this for the tree collections is some expectation that somehow the nodes in a tree might end up being owned by more than one transient?

18:28 which seems impossible

18:28 based on how I assume transients work

18:28 bbloom: yeah, i considered & rejected that too

18:28 doesn't make sense

18:30 gfredericks: if I were implementing transients right now, I'd have an owner at the top level and track per node whether it's editable _at all_

18:30 wait how does persistent! work?

18:30 bbloom: search for "persistent("

18:30 it just sets the mutable thread cell to null & then copies the fields over from the TransientVector to the PersistentVector

18:33 gfredericks: I was wondering if the fact that it doesn't do anything recursive was a clue

18:33 but that thought isn't leading me anywhere

18:34 bbloom: it's documented constant time

18:35 logic_prog: for clojure apps with interacting with sql, do people prefer postgresql, mysql, or sqlite ?

18:35 where "people" = people developing clojure apps

18:35 bbloom: that's not a question about clojure at all

18:35 gfredericks: yeah I know it's supposed to be constant time, I just didn't know if sticking to that required the trickery at the node level

18:35 bbloom: those are 3 very different databases that have very different use cases

18:36 sqlite == fopen; mysql == dumb indexes in RDBMS' clothing; postgresql == actual database

18:37 logic_prog: hmm, sounds like I want sqlite

18:37 bbloom: logic_prog: also consider: http://www.brandonbloom.name/blog/2013/06/26/slurp-and-spit/

18:38 gfredericks: I hope this blog post is two sentences

18:39 logic_prog: whoa, pr-str and read can be quite interesting

18:39 given there is no parsing required

18:39 it's basically persistence for free

18:39 since most of clojure is "programming with values" anyway

18:40 bbloom: leverage, baby, leverage

18:40 if that's blowing your mind, then i suggest you read my post carefully and in full :-)

18:44 logic_prog: bbloom:

18:44 you're pretty smart

18:45 * bbloom blushes

18:45 bbloom: doing my best

19:00 gfredericks: ,(into {} '(("foo" "bar")))

19:00 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry>

19:00 gfredericks: ,(into {} [["foo" "bar"]])

19:00 clojurebot: {"foo" "bar"}

19:00 gfredericks: I imagine that error message is rooted in the silly behavior of conj

19:00 bbloom: i think map entries are one of the cruftiest parts of clojure's implementation

19:02 ghadi_shayban: technomancy: jmdns works just fine thx

19:02 gfredericks: the conj thing is just entirely unnecessary though

19:03 conj the duck-wrapper

19:06 ToxicFrog: Having a bit of an uberjar problem.

19:06 'lein run' works fine.

19:07 'lein uberjar' successfully generates a normal and standalone uberjar.

19:07 'java -jar uberjar.jar' returns 'could not find or load main class runewords.core'

19:08 Unzipping the jar shows that it has .class files for lots of libraries, but only the .clj for the main class.

19:08 It does have :gen-class.

19:08 What am I missing?

19:08 gfredericks: an :aot entry in the project.clj?

19:09 :aot [runewords.core]

19:09 an alternative is to avoid AOT and use a launcher script, if you don't need an executable jar in particular

19:09 ToxicFrog: No such entry, other projects I have don't need it

19:10 gfredericks: do your other projects have a :main entry?

19:10 ToxicFrog: (which is to say :main normally gets AOT compiled automatically when I ask for an uberjar, looks like)

19:10 Oh, looks like this may be a bug in lein: https://github.com/technomancy/leiningen/issues/1289

19:10 gfredericks: yes, I think that feature will be removed?

19:11 I'm a fan of avoiding AOT altogether though

19:11 hyPiRion: ToxicFrog: what version are you running?

19:12 ToxicFrog: gfredericks: well, it's kind of necessary if you want to deploy a jar that people can run with java(1)

19:12 hyPiRion: 2.3.1

19:12 hyPiRion: ah. Upgrade, that should do it

19:12 gfredericks: ToxicFrog: you can run with java and extra options w/out AOT

19:12 ToxicFrog: Just upgraded to 2.3.3. and now it's working.

19:13 gfredericks: the goal is to produce something that people with a JVM (and nothing else) can run by double-clicking on.

19:13 Without needing to faff about with launcher scripts because fuck that noise, forever, in hell, especially on windows.

19:13 gfredericks: ToxicFrog: yep that goal precludes my approach

19:15 rurumate: ToxicFrog: :aot :all can be considered, also there is lein bin plugin https://github.com/Raynes/lein-bin

19:16 somethimes the sample project.clj can help: https://github.com/technomancy/leiningen/blob/master/sample.project.clj

19:17 TEttinger: How can I make lein use a jar as a dependency?

19:17 gfredericks: that question maybe deserves its own doc file in leiningen

19:17 seems to come up every day

19:18 rurumate: TEttinger: maybe :resource-paths ?

19:18 TEttinger: yeah, I've considered it. duplicate Manifests can be tricky.

19:18 ToxicFrog: Now I'm having trouble accessing my resources >.<

19:18 TEttinger: lein bin is not good, unfortunately it needs a JDK on the user's system

19:19 ToxicFrog: (->> filename clojure.java.io/resource .getFile ...) works fine in lein run

19:19 In the uberjar, it throws a FileNotFoundException: target/uberjar.jar!/filename.html

19:20 Despite the fact that I can unzip the uberjar and see filename.html in the jar root.

19:20 rurumate: TEttinger: if nothing helps, you can 1) unzip the jar, using jar xf, and use :resource-paths or 2) create a maven artifact from the jar using mvn install-file, and reference that in :dependencies

19:20 TEttinger: yep, unzipping the jar. thanks rurumate

19:26 hm. [] and devlib have a type mismatch merging profiles.

19:26 what on earth would that mean...

19:26 ToxicFrog: rgrgrgrgrgr

19:32 hyPiRion: TEttinger: you have [] and devlib as two values for same keys when merging profiles

19:32 TEttinger: no, it was dumber.

19:32 "devlib" instead of ["devlib"]

19:33 it works, thanks hyPiRion, rurumate

19:33 hyPiRion: ah, good to know

19:34 paulsamways: Hi. Can someone explain what the point of the binding form [& [x]] is? Is it purely to make the last param optional?

19:36 scottj: paulsamways: yeah, afaik

19:37 rurumate: paulsamways: like in (delete-file f & [silently]) ?

19:38 http://clojuredocs.org/clojure_core/clojure.java.io/delete-file

19:38 paulsamways: like: https://github.com/noir-clojure/lib-noir/blob/master/src/noir/validation.clj#L90

19:40 rurumate: yes it also has & [something] instead of simply & something

19:40 paulsamways: yes, like delete-file too. Actually make sense for delete-file to have silently as optional.

19:42 rurumate: (delete-file f & args) would almost be equivalent, but (delete-file f & [silently]) forces the bool to be wrapped in a vector

19:43 the function is easier to define that way, but it is more work and maybe runtime overhead for the caller

19:44 ..or does it?

19:44 shoky: that doesn't sound right

19:45 rurumate: ,(let [[ & [silently] ] [true]] (not silently))

19:45 clojurebot: false

19:45 rurumate: ,(let [[ & [silently]] true] (not silently))

19:45 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean>

19:46 rurumate: seems like extra vector [] brackets are needed

19:47 still not sure why it's written that way

19:47 shoky: you put the extra brackets in the binding form

19:49 rurumate: shoky: in this case, yes. they go wherever tne arguments goes

19:53 paulsamways: ahh i know - destructuring.. if you don't put it in as a vector, silently is a vector and is truthy even when false is passed in.

19:53 shoky: ,((fn [& [silently]] (not silently)) false)

19:53 clojurebot: true

19:53 paulsamways: correct?

19:53 shoky: yes

19:54 ,((fn [& [silently]] (not silently)) [false])

19:54 clojurebot: false

19:54 paulsamways: thanks. Still trying to understand some of the idioms of clojure.

19:56 I still don't quite understand the use of [& [x]] in the noir.validation/get-errors func. I guess it's just a convenience thing.

19:58 shoky: i think it's just instead of giving two separate function bodies

19:59 or.. what don't you understand about it?

19:59 paulsamways: well the func is a no-op if you don't pass in any args in

19:59 shoky: it's not

19:59 paulsamways: oh?

19:59 shoky: there's an else form

20:00 the apply

20:00 paulsamways: oh! of course.

20:00 sorry, all makes sense now.

20:01 ToxicFrog: This makes no sense!

20:01 I run the program, 4925 lines of output.

20:01 shoky: np, i've fallen for that one several times

20:01 ToxicFrog: I lein clean, lein uberjar, java -jar foo.jar

20:01 4744 lines of output

20:01 gfredericks: how did you run it the first time?

20:04 shoky: lein pollute

20:08 ToxicFrog: gfredericks: lein run I

20:08 vs java -jar target/runewords-0.1.0-SNAPSHOT-standalone.jar I

20:08 It's getting the same argv.

20:10 gfredericks: I don't have any guesses

20:10 ToxicFrog: I can also see that it's reading the same number of records for display

20:11 So it looks like the output is actually getting cut off.

20:11 But only when run from the jar, and the point at which it gets cut off is completely consistent across runs - but changes when I recompile the jar.

20:12 gfredericks: what's the output mechanism? println?

20:12 ToxicFrog: printf

20:12 gfredericks: ah

20:12 maybe the buffer doesn't get flushed?

20:12 ToxicFrog: I'd expect it to get flushed when the program exits, if not before

20:12 gfredericks: I don't know enough low-level unix details to confidently suspect one way or the other

20:12 but yeah you would hope it works that way

20:13 (.flush *out*) at the end of main to be sure

20:13 ToxicFrog: Added that and now it works perfectly.

20:13 gfredericks: curious who to blame for that

20:14 let me know if you figure it out :)

20:14 the consistent-except-across-recompiles part is really creepy

20:14 ToxicFrog: Yeah

20:17 gfredericks: it's worth noting that if I make a query that generates little output, there is *no* output when running from the jar.

20:17 gfredericks: yeah that seems consistent

20:17 ToxicFrog: So it's not "cuts off after N" but "cuts off the last N"

20:17 gfredericks: makes sense if it's an unflushed buffer thing

20:20 ToxicFrog: the last sentence in the first answer here assumes this behavior is expected: http://stackoverflow.com/questions/7166328/when-why-to-call-system-out-flush-in-java

20:21 ToxicFrog: gfredericks: it says that the default System.out PrintStream auto-flushes on newline, and all record display is newline-terminated

20:21 gfredericks: oh I was thinking of the "doesn't auto-flush on exit" part in particular

20:22 chare: i return

20:22 hello my friends

20:22 gfredericks: you're write that since you're writing lines it doesn't make sense

20:22 right*

20:23 *out* is a new OutputStreamWriter(System.out)

20:25 when I compile a java class that only does System.out.print("foo"), it prints

20:25 the-kenny: Using lein-cljsbuild (0.3.3) with clojurescript-1913 (and 1909 too) I get the following error message on one of my files: "Failed to compile [...]" and "Caused by: clojure.lang.ArityException: Wrong number of args (3) passed to: reader-types$indexing-push-back-reader"

20:25 That is even for an empty file.

20:30 chare: when are they going to kill kenny again in south park

20:35 the-kenny: Ok, found the problem. ring-core was overriding tools.reader with an outdated version.

20:35 gfredericks: that sounds familiar

20:36 the-kenny: Yeah, found it in the logs of this channel

20:36 gfredericks: is there an issue for it yet?

20:36 the-kenny: Don't think it's the fault of clojurescript

20:36 gfredericks: in ring-core I mean

20:36 the-kenny: Doesn't look so

20:37 gfredericks: well if you'd like to get your good deed for the day out of the way...

20:38 the-kenny: Heh :)

20:38 Yeah, I'll open an issue.

20:38 gfredericks: make sure it's not already fixed on HEAD

20:39 the-kenny: Nope, isn't.

20:43 ghadi_shayban: just released a trivial little dev tool - EDN-payload sharing over Bonjour AKA DNS-SD

20:43 github.com/ghadishayban/undersea

20:44 chare: we need a project to work on

20:44 come on guys

20:44 ghadi_shayban: it will discover other users on the same LAN and grab things from them

20:44 the-kenny: ghadi_shayban: That's interesting. Bookmarking it :)

20:45 ghadi_shayban: technomancy: thanks for the JmDNS reference, that's what it's using

20:45 have an Avahi backend in there too, but not in the code path right now

21:00 chare: you guys like the iphone 5c

21:02 benkay_: in the spirit of zero? and pos? is there an equivalent test for real numbers?

21:04 bbloom: not built in, no

21:04 use clojure.core/class or clojure.core/instance? to make your own

21:05 benkay_: ,(instance? number 1)

21:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: number in this context, compiling:(NO_SOURCE_PATH:0:0)>

21:06 benkay_: ,(instance? Number 1)

21:06 clojurebot: true

21:06 benkay_: woo!

21:06 thanks bbloom!

21:07 hyPiRion: ,(instance? Number Double/NaN)

21:07 clojurebot: true

21:07 hyPiRion: Perhaps not an issue for your case, but keep it in mind

21:08 gfredericks: what does real number mean?

21:08 benkay_: gfredericks: not imaginary

21:08 bbloom: benkay_: clojure doesn't have imaginary numbers built in

21:08 benkay_: probly not a problem

21:08 anyways thanks all!

21:09 gfredericks: I keep trying to make a lib for complex numbers and then it turns out super complicated to do it well

21:09 so I give up and paste my deftypes between projects

21:10 bbloom: gfredericks: curious: what are you using complex numbers for so often that you're copy pasting between many projects?

21:12 gfredericks: it might be mostly quantum computing stuff

21:12 can't recall if there was something else

21:12 * gfredericks greps his projects directory

21:14 gfredericks: this is a long grep

21:15 oh I was also messing with some academic research into exact algebraic number representations

21:18 chare: gfredericks you should help me make starcraft clone

21:19 marcopolo2: ,(+ 1 2 3)

21:19 clojurebot: 6

21:20 marcopolo2: $findfn [1 2 3] => '(2 3)

21:20 lazybot: java.lang.RuntimeException: Unable to resolve symbol: => in this context, compiling:(NO_SOURCE_PATH:0)

21:20 marcopolo2: $findfn [1 2 3] '(2 3)

21:20 lazybot: [clojure.core/next clojure.core/rest]

21:22 nDuff: ghadi_shayban: Cute. I'm a bit curious -- was there a particular use case that inspired it?

21:24 TEttinger: https://cowlark.com/luje/doc/stable/doc/index.wiki if only this worked on windows.

21:47 frozenlock: Is there a function to replace keys in a smap?

21:48 gfredericks: what's a smap?

21:48 frozenlock: {:a 1}

21:49 gfredericks: a single entry map?

21:49 ,clojure.set/rename-keys

21:49 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>

21:49 ambrosebs: $findfn {:a 1} {:a :b} {:b 1}

21:50 lazybot: [clojure.set/rename-keys]

21:50 frozenlock: Didn't think of looking into .set at all o_O

21:50 gfredericks: and for functions on vectors check the finger trees namespace

21:51 frozenlock: Works perfectly, thanks :D

21:51 ambrosebs: What witchraft is this?!

21:51 ambrosebs: magic!

21:52 TEttinger: $findfn 3 4 3/4

21:53 lazybot: [clojure.core//]

21:53 gfredericks: $findfn 42 42

21:53 TEttinger: huh, thought it would find /' or whatever the other kind is

21:53 lazybot: [clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/long clojure.core/short clojure.core/+ clojure.core/* clojure.core/doto clojure.core/unchecked-long clojure.core/+' clojure.core/unchecked-short cloj... https://www.refheap.com/19479

21:54 TEttinger: oh it doesn't exist right

21:54 nice gfredericks

21:55 * frozenlock furiously browsing clojurebot's github code to see how it's done

21:55 gfredericks: frozenlock: that is probably not the best bot's source code to look in

21:55 frozenlock: But you don't understand... I NEED to know how it's done :p

21:56 gfredericks: but you don't understand

21:56 lazybot did that, not clojurebot

21:56 coventry: frozenlock: https://github.com/Raynes/findfn

21:56 frozenlock: Oh, right...

21:57 Foxboron: https://cowlark.com/luje/doc/stable/doc/index.wiki

21:57 wouldnt this be fun to try with clojure?

22:14 coventry: Can someone remind me what FNONCE is for?

22:16 nightfly: don't re-define a function when reloading a file?

22:16 paper_ziggurat: how is the clojure job market?'

22:16 gfredericks: coventry: it's for functions that you know will only be called once so that they can GC stuff early

22:17 coventry: I'm only 93% sure that's the case

22:17 coventry: gfredericks: Thanks.

22:17 gfredericks: classic use case is delay and lazy-seq

22:18 ,(repeatedly 3 (let [x 42] (^{:once true} fn* [] x)))

22:18 coventry: gfredericks: Yeah, just came across it in lazy-seq.

22:18 clojurebot: (42 42 42)

22:18 gfredericks: ,(repeatedly 3 (let [x "42"] (^{:once true} fn* [] x)))

22:18 clojurebot: ("42" nil nil)

22:19 gfredericks: ah there it is

22:19 needed a proper object

22:19 coventry: gfredericks: Huh. Very cool. I'll put that example in my notes, so I don't forget it this time

22:22 paper_ziggurat: Recently a couple of prominent and talented #clojure denizens have said here that they're working on other languages now, so I don't think the market is particularly good. There are job ads for clojure out there if you look, though.

22:22 s/working on/working in/

22:24 namccarty: I've managed to convince the other owner of my buisness to do our next project in clojure, we are going to be hiring another dev sometime in the next few months, but not right now

22:24 So there is at least one clojure job out there

22:25 coventry: namccarty: What do you do?

22:25 namccarty: Right now we are a small software house working a few in town contracts mantaining legacy code bases, but we are looking at getting into the games market

22:26 bitemyapp: coventry: Clojure isn't a language you learn to get a job, you learn it because you enjoy programming, want to get better at programming, and want a nicer language to go with that experience.

22:26 coventry: Most of the companies I've seen using Clojure are startups. If that's your sort of thing, it's entirely possible to get a job writing Clojure. Small businesses and media companies will use it when they have a "go-to" guy programmer that is a Clojure hacker.

22:27 coventry: but if you want to work at a large corporation, for the government, etc - you can't hope to use anything approaching nice tools anyway, let alone Clojure.

22:27 namccarty: bitemyapp: That is pretty much me right now

22:27 benmoss: I've definitely found it difficult to find any jobs that seem to be using it

22:28 bitemyapp: Take it as a personal challenge to rejigger your life to make yourself happier, whether that includes clojure or not.

22:28 If you're satisfied using Clojure on nights and weekends - then there's nothing to complain about :)

22:29 solussd: I've got two jobs using clojure. :D

22:30 bitemyapp: I'm working on a Clojure project at a company that is 99% Python.

22:30 solussd: step 1: take job that says it requires and, step 2: just use clojure instead

22:30 *java

22:31 namccarty: sadly half of my current work is mantaning cobol, but hey, now that my business is finaly working on achiving what we set out to do, ive got a project in clojure

22:34 coventry: bitemyapp: I'm more optimistic than that. I think something like clojure is going to see a lot of use in the future. But paper_ziggurat asked about the current job market, not about general reasons for using the language.

22:34 bitemyapp: coventry: I don't doubt Clojure has a bright future, I just think one shouldn't view ones' career possibilities through the lens of monster.com job postings.

22:35 solussd: I think it's important to be proactive- if clojure really is such a great language, then make the case for it at your job.

22:36 namccarty: If you have the resources like I do, you can always try to create the job you want to have, but sadly that isn't always a viable option

22:36 soulssd is right with the proactive thing though

22:37 coventry: Thinking about my career a lot lately. Curious about the ways you view career possibilities. (Not actively looking for a job at the moment, but I will be.)

22:46 bitemyapp: coventry: I'm in startup-landia.

22:46 if that gives you any inclination as to what career track looks like

22:46 namccarty: As am I

22:47 My current job started with a friend asking me how hard it would be to make a game he had an idea for

22:47 and then cobol happened, but lets just forget about the cobol

22:57 Quick question, is there any style guide for clojure that is consdidered universal or anything like that?

22:57 technomancy: namccarty: not really

22:57 clojurebot: style?

22:57 clojurebot: style is http://mumble.net/~campbell/scheme/style.txt

22:57 technomancy: ^ that one is my favourite, but it's not clojure-specific

22:58 jagaj: you should ideally keep all your parens on separate lines like C curly braces

22:58 :)

22:58 technomancy: ~guards

22:58 clojurebot: SEIZE HIM!

22:58 metellus: ~gourds

22:58 clojurebot: SQUEEZE HIM!

22:58 namccarty: technomancy: Thanks

23:09 alright, I haven't used a case in clojure yet, will this do what I think it will do: https://www.refheap.com/19480

23:11 technomancy: I don't think so

23:12 the clauses are constant

23:12 maybe you want cond with sets instead of lists of numbers

23:13 (cond color #{0x376AA4 0x85C6E1 0x07305E} :blue ...)

23:13 err

23:13 condp; I think

23:13 uh just ignore me

23:15 yeoj____: if i'm going to use jtds with windows-authentication i need to have "ntlmauth.dll in my "bin" directory".... does anyone know where that would be in a lein2 project?

23:16 rhg135: Hello, i can see this defcodes macro doesn't work because it produces a list with defmethod in a nested list, but i can't see how to fix it https://www.refheap.com/19481

23:23 coventry: ,('random-symbol slurp "random object") <-- In what context are you supposed to use symbols as functions?

23:23 clojurebot: "random object"

23:26 yeoj____: i don't know what i changed and now lein repl crashes... it's not even my code i don't think.

23:26 I think it's windows fault. ugh .

23:30 coventry: Ah, a symbol-as-function is used for accessing namespace maps, apparently. http://stackoverflow.com/a/1176413/1941213

23:31 Still, that doesn't answer why it's just returning the second arg, if it's arg is not a map.

23:31 *its

23:31 amalloy: namccarty: that looks like a pretty reasonable case-expression, but of course you can just try it

23:32 namccarty: amalloy: Thank you, it appears to be behaving correctly, just wanted to make sure that it was behaving for the right reasons

23:47 coventry: clojure.tools.trace/tracer's docstring says "Prints to standard output, but may be rebound to do anything you like." How is that rebinding supposed to happen, given that it's a private, non-dynamic var? (I know ways to rebind it, but they seem a bit icky, so I'm wondering if I'm missing something.)

23:52 bbloom: (doc *out*)

23:52 clojurebot: "; A java.io.Writer object representing standard output for print operations. Defaults to System/out, wrapped in an OutputStreamWriter"

23:53 bbloom: see also binding and with-out-str

23:59 coventry: Oh, rebind the output. Didn't think of that, because it's not a good option in my current case.

23:59 bbloom: why?

23:59 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

Logging service provided by n01se.net