#clojure logs

2013-10-06

00:08namccartyAlright, 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
00:08namccartyKnowing me it is going to be something stupid like a typo
00:09coventryTime to break out clojure.tools.trace.
00:09coventryhttps://github.com/timvisher/what-does-tools-trace-do
00:10namccartyI'm new to clojure, I have no idea how the debugging tools for it work, thank you coventry
00:11bitemyappI've come really close to writing a traced wrapper for "let"
00:11bitemyappSo that I don't have to manually wrap trace-forms around it :P
00:14bitemyappPassing tests are like a cushy, soft, warm blanket.
00:14namccartyI 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
00:15ddellacosta&(map inc [1 2 3 4])
00:15lazybot⇒ (2 3 4 5)
00:15bitemyappnamccarty: you don't need it as much and a lot of what you did with a debugger got broken out into various libraries.
00:15ddellacosta(showing a friend lazybot in IRC)
00:15bitemyappnamccarty: we'd like to see a nicer debugging stack, but the pain isn't great enough to force anybody to do anything about it.
00:15bitemyappddellacosta: far more impressive is the code search.
00:15bitemyappddellacosta: you give it a "before" and "after" of args and output, it automatically finds the function that produces what you want.
00:16bitemyapp[1 2 3] => '(2 3) will return rest, next, etc.
00:16ddellacostabitemyapp: oh wow, I didn't know that existed, that's amazing
00:16ddellacostayou do that with lazybot?
00:16ddellacosta&[1 2 3] => '(2 3)
00:16lazybot⇒ [1 2 3]
00:16bitemyappclojurebot I think. I'm trying to negotiate with it right now.
00:16ddellacostaah, gotcha
00:17namccartybitemyapp: yeah, iv'e noticed that finding the source of problems in clojure is a lot less painful
00:17bitemyapphm. looks like maybe lazybot.
00:18bitemyappnamccarty: yeah the pure functions do a lot for you there.
00:18coventry$findfn [1 2 3] '(2 3)
00:18bitemyappcoventry: christ thank you
00:18bitemyappneed a fucking bot wiki
00:18lazybot[clojure.core/next clojure.core/rest]
00:18bitemyappddellacosta: ^^
00:18bitemyapp$findfn [1 2 3] 1
00:18lazybot[clojure.core/first clojure.core/rand-nth]
00:18ddellacostabitemyapp: seriously, a wiki would be great
00:18coventrybitemyapp: Only reason I had it to hand is I used it a few minutes ago in a pm.
00:19bitemyappddellacosta: I'm working on it :(
00:19ddellacostaoh, that's cool, thanks
00:19ddellacostabitemyapp: I'd be happy to help, I need to read through the code for lazybot/clojurebot
00:19bitemyapplol @ rand-nth working for my example
00:20bitemyappddellacosta: 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.
00:20namccartybitemyapp: 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
00:20coventryddellacosta: The relevant library is <https://github.com/Raynes/findfn&gt;. I failed to get it working locally last time I (half-assedly) tried to, though.
00:20namccartyOne of the other owners is convinced that objects are literally jesus though
00:21bitemyappnamccarty: that's regrettable. Clojure can be thought of as, "FP and OOP - the good parts", but with the components separate and simplified.
00:22namccartyI 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
00:22bitemyappSo there's OOP, but it's mostly simple dispatch, types, etc.
00:24Pupnik_if you decompile a jar made with clojure, do you get clojure or java out?
00:25bitemyappucb: http://www.youtube.com/watch?v=FNcSFDt8GiM
00:26bitemyappPupnik_: depends.
00:26bitemyappClojure never becomes Java, fyi.
00:26bitemyappIt can only be Clojure or bytecode (.class files)
00:26bitemyappClojure is not a source-to-source compiler like ClojureScript.
00:26bitemyappPupnik_: have you read Clojure's source code?
00:27technomancyyou can get java back from the bytecode, but it won't actually be valid in most cases
00:27bitemyapptechnomancy: how would you feel about a with-hooks-disabled macro for robert.hooke that can disable multiple vars at a time?
00:28technomancybitemyapp: sounds totes reasonable
00:28bitemyapptechnomancy: (with-multiple-hooks-disabled [wrapped-1 wrapped-2] ...) seem kosher?
00:28bitemyappI'm writing this for Blackwater.
00:29Pupnik_bitemyapp: i have not
00:29technomancybitemyapp: wouldn't be to nutty to make the existing macro take a vector or a symbol
00:29technomancytoo nutty
00:29bitemyappI can adapt accordingly.
00:30bitemyappI'm stashing it in black.water.hook for now, I'll PR whatever comes out of it after.
00:36namccartywelp, it appears the source of my problem is that one of my functions decided to have a tricky failure case
00:40namccartyoh, no, that is not it at all
00:40namccartythe source was copy/paste fail
00:41namccartyand stupid tests that didnt cover all cases
00:41namccartybut mostly copy/paste fail
00:52bitemyappnamccarty: :)
00:55namccartyMy sudoku solver works now, I can die happy
00:55namccartyAlso, what is the best way to analyze how much time clojure spends in each part of the code?
00:57namccartyI want to see if I can get this to run faster, but have no idea where to start
00:58namccartyMy conventional JVM methods of profiling are just leaving me confused
01:05logic_proganyone have a good example of scheme in clojure?
01:05logic_progi.e. almost meta circula evaluator ish
01:11seangrovetechnomancy: Thank you for all the lein goodness
01:26chareyou are all dumb
01:30dcunit3dso i'd just like to say the "dependants" feature of ClojureSphere is awesome when trying to find examples of using an API
01:37mullr /ignore chare
01:39charewhy you mad?
01:42nightfly chare | you are all dumb
01:47devnWim Mertens - At The Edge Of The Void
02:16bitemyappalright, I've fucked up this macro.
02:16bitemyapphttps://www.refheap.com/19467
02:17bitemyappI would be immensely grateful if anybody could help me puzzle it out.
02:19bitemyappIt 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.
02:19bitemyappSeemingly, anyway.
02:20bitemyappindigo: me too, if it meant somebody being able to unfuck my mind.
02:21indigo:P
02:48vmarcinkonoob question...
02:50vmarcinkoi'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
02:50vmarcinko with special namespaced keyword..In other words, this type belongs to public API of my lib...
02:51vmarcinkothis special type has some specific data structure in it, so I can extract this pieces of data during processing it
02:52vmarcinkoI 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
02:53TEttingermetadata seems about right.
02:53TEttinger^:special-type
02:54vmarcinkohmmm
02:54TEttinger,[1 2 3 ^:special-type [3 4]]
02:54clojurebot[1 2 3 [3 4]]
02:54TEttingerinvisible to users, but you can query the metadata
02:55marcopolo2bitemyapp: Are you using macroexpand-1 to help you out?
02:55vmarcinkoi 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
02:55TEttingeroh ok.
02:56vmarcinkosomething like:
02:56vmarcinko[1 2 3 [:mylib/mytype mytaparg1 mytypearg2] 6 7]]
02:56vmarcinkoor maybe use special record in palce of it
02:57TEttingerI'd use a symbol, those are unlikely to show up in regular data
02:58vmarcinkoand what's wrong with keyword?
02:59vmarcinkoim so noob in clojure so i dunno a lot if it
02:59TEttingernot guaranteed to not be in the data is all
02:59TEttingersymbols aren't either i guess
02:59TEttingerthere's qualified symbols, which are unique
03:00TEttinger,#'clojure.core/map
03:00clojurebot#'clojure.core/map
03:03vmarcinkoand what about exposing just special-type factory functions, so that one just does:
03:03vmarcinko[1 2 3 (mylib/create-type arg1 arg2) 4 5]
03:04vmarcinkoso that picked data structure is kind of hidden, lib user just uses fucntion to create it
03:04vmarcinkoalthough, 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
03:16bitemyappmarcopolo2: of course I am using macroexpand-1
03:17akurilinFun 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.
03:19akurilinAnybody here got experience with web payment services? I'm thinking Stripe + the Stripe wrappers like Chargebee etc?
03:20akurilinDoes one of them suck less than the others?
03:26bitemyappakurilin: Stripe is a good idea.
03:33akurilinbitemyapp, 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.
03:33akurilinbut tbh I still have to do my research into the various differences
03:34bitemyappakurilin: a more managed solution than Stripe? o_O
03:45dcunit3dI'm running into problems writing to a BufferedImage: https://gist.github.com/dcunited001/23787c87cb8b34de264a
03:48dcunit3di'm getting this error: No matching method found: setPixels for class sun.awt.image.ByteInterleavedRaster
03:49akurilinbitemyapp, 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.
03:49dcunit3dwhen 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)
03:50dcunit3di'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.
03:51namccartyI'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
03:51dcunit3dfor example, i could easily use .setPixel, which is apparently 2 orders of magnitude slower than working with the pixels array directly
03:52namccartyyeah, that is what i wound up doing in my application
03:53namccartywhat you could try doing is creating your own raster, then using setData() on buffered image to write it
03:53namccartyim looking into it but that is all i have come up with so far
03:54dcunit3dthanks, i'll try using that
03:54opqdonutdcunit3d: the problem is that clojure doesn't know those are ints (instead of e.g. Longs)
03:54opqdonutdcunit3d: try (.setPixels (int 0) (int 0) (int sizex) (int sizey) data)
03:54opqdonut(and (int data))
03:54dcunit3dk
03:55dcunit3dif the last on is an int[] array, how do i typecast that?)
03:55opqdonutyeah, I just realized
03:55opqdonutactually, now that I look at the other setPixels methods
03:56opqdonutfrom WriteableRaster
03:56opqdonutit should be enough to hint the data as
03:56opqdonut^ints
03:56namccartyumm, you could also try making sure that you are creating the array using int-array
03:57opqdonutthat too
03:57opqdonutof course you can have data be a sequence and convert it to an int array with int-array inside digit-image
03:57namccartyeither way works just the same
03:58dcunit3dcool, trying it out
03:58opqdonutanyway, "could not resolve call" doens't mean "this method doesn't exist", it means "I don't know which of these methods to call"
03:59opqdonutoh, right, you had a "No matching method found" instead
04:02dcunit3dlearning clojure is really my first foray into java programming since 2005 lol
04:03namccartypersonally, ive got a lot of experience on the jvm, in functional programming, and in lisp
04:03namccartybut am still new at the three put together
04:03dcunit3di think i have 75 tabs open lol
04:04namccartyoh god, i've got a wall of montiors, and you should see what they look like when I am learning a new language/feature
04:04namccartyand by wall i mean 4
04:04dcunit3dlol nice
04:04namccartyi think ive gone well past 100 tabs before
04:04TEttinger300 in firefox
04:05TEttingerchrome can't handle as many
04:05dcunit3dlol omg
04:05dcunit3di know, i've been thinking about switching to firefox bc of memory.
04:06TEttingerso I'm trying to figure out a macro ns shenanigans thing
04:06dcunit3di have instances of chrome setup for email, github, docs and localhost apps. then hotkeys to switch between them
04:06namccartyive got about the same
04:07TEttingerwhen you AOT hiphip, it tries to load the same file with different vars setup, and fails on the second run through that file.
04:07namccartyplus one more for the gitlab for my work projects
04:07TEttingerhttps://github.com/Prismatic/hiphip/issues/1
04:07TEttingerhm maybe I could do it with ^:dynamic
04:12dcunit3dhmm i'm running into this message when using ^int type hints: "Only long and double primitives are supported"
04:14dcunit3dhiphip looks cool
04:14namccartyhmm
04:15namccartyinstead of using type hints, maybe try wrapping them in calls to int?
04:16namccartythat being, wrap them in (int your-stuff-here)
04:16namccartyright where you call setpixels
04:17namccartysee what that does
04:17amalloydcunit3d: functions can't take primitive ints as arguments
04:18dcunit3di'm trying to call a java method that takes (int,int,int,int,int[])
04:19namccartydcunit3d: try what i said with the wrapping them in calls to int, like (.setPixels 0 0 (int sizex) (int sizey) data)
04:19namccartyim not 100% on if that will work
04:19namccartybut worth a shot
04:19dcunit3dk, trying that
04:19dcunit3dthanks namccarty
04:20namccartydid it work?
04:20dcunit3done sec
04:21dcunit3dno, but i'm trying to wrap data as (int-array data)
04:22namccartyhold on, let me load up the repl
04:23namccartywe are going to get this working
04:23chareI am making progress on reading opengl book
04:23charegot to here http://www.arcsynthesis.org/gltut/Positioning/Tut06%20Translation.html
04:24chareyou guys mad?
04:24dcunit3dit's going to be hard to run the code in the gist. i need to update the project on github. one sec
04:24charewhat code you talking about
04:25namccartythe code he cant figure out how to get to work
04:26charewhic his
04:26namccartythe code he is working on pushing to github right now
04:26dcunit3dhttps://github.com/dcunited001/handwritten-digits
04:27dcunit3dthanks again namccarty
04:27namccartyno problem, just trying to work back the karma from when someone helped me eairler
04:27utkarsh,(def q 10) `(~q ~'r ~'n)
04:27clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
04:27chareoh dcunit3d is that guy who can't get images working
04:28dcunit3dchare: 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.
04:28utkarshnvm, how can I make this expression simpler: `(~q ~'r ~'n) ?
04:28namccartyyeah, 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
04:29dcunit3dnamccarty: once you clone, you should just be able to `lein deps` and `lein run`
04:30namccartygetting the deps now
04:32utkarshhmm, (list q 'r 'n) works..
04:34dcunit3dnamccarty: i'm writing a quick test for draw.clj that won't require the JFreeChart
04:35namccartydcunit3d: does the error you are getting show up when the main function is called?
04:36dcunit3dyeh
04:36namccartyonly error im getting is a class cast exception
04:36dcunit3dcurrently "clojure.lang.PersistentVector cannot be cast to java.lang.Number"
04:36namccartyyeah that is it
04:37namccartyare you sure your example is handing it the arguements in the right order?
04:38namccartyno, thats not it
04:39namccartyalright, this is strange, all the arguements are what they are supposed to be
04:39namccartya vector, an int and an int
04:40dcunit3di think so
04:41namccartywait
04:41namccartythere are parens there
04:41namccartyyour vector is wrapped in a list or a seq or something
04:42namccartyi think
04:43dcunit3dthat might be right, i just pushed up a test for draw/digit-image
04:43dcunit3dno assertions, but i'm not getting the error when i directly specify the vector. so that must be the problem
04:44namccartyIts looking like data is wrapped in a lazy seq
04:46namccartyalright, unrapping that using first moves the error
04:46namccartytrying something, I think ive got it
04:46dcunit3di'm doing (head images) instead of (first images)
04:47namccartyand now i somehow managed to blow up emacs
04:47namccartythat doesnt even make sense
04:48namccartyyeah, staying inside draw.clj, when i unwrap that lazy seq the error shifts to a no matching constructor for buffered image
04:49dcunit3di'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.
04:52namccartyalright, i think ive got it working
04:53namccartylet me just test that
04:54namccartyholy balls that worked
04:54dcunit3dfor real?
04:54dcunit3dwhat'd you do?
04:54namccartyive only modified digit-image, let me paste it
04:55namccartyhttp://pastebin.com/sbrXPme5
04:55namccartythat executes with no errors
04:56namccartyif you have fixed the lazy seq thing else where, remove the call to first
04:56dcunit3dk
04:57namccartythat was just there to pull the vector out of the lazy seq
05:01dcunit3dawesome!
05:01namccartylooks like its drawing correctly
05:01dcunit3di haven't been able to get it to draw yet
05:01namccartyadded a piece of code to dump the image you were making to a file, and it looks roughly like a letter
05:02namccartyhttp://puu.sh/4IT0p.png
05:02namccartythat is the image that is getting made
05:02dcunit3dk, i was just trying to view the data on the chart, but i think i have some different issues with JFreeChart
05:02namccartywell, at least the code that actually makes the image appears to be working
05:02dcunit3dmight also have some encoding issues, but maybe not, that pic looks correct
05:03dcunit3dthis is great!
05:03namccartylooks like it
05:03dcunit3dwith the awt bufferedimage, i can use either JFreeChart or Swing.
05:04dcunit3dlooks like i might need to set up swing
05:04dcunit3dthanks again :)
05:04namccartyno problem
05:30TEttingerwolfes, are you Jason Wolfe?
05:50sm0kehow do i pretty print a map?
06:01dcunit3dnamccarty: i'm gettin closur https://raw.github.com/dcunited001/handwritten-digits/master/100digits.png
06:02namccartyapparently i forgot how to use a keyboard typing that
06:11jimrthysm0ke: pprint
07:23piranhais there a better idiom for (or (:one data) (:two data) (:three data)) ?
07:26TEttingerdoes ##({:one 1 :two 2} :one) do what I think it does...
07:26lazybot⇒ 1
07:26opqdonut,(some {:a 1 :two 2 :three 3} [:one :two :three])
07:26clojurebot2
07:26opqdonuthow about that?
07:26TEttinger,(some {:a 1 :two 5 :three 7} [:one :two :three])
07:26clojurebot5
07:27TEttingeruh, it seems to be fetching the first hm
07:27opqdonutobviously
07:27opqdonut,(doc some)
07:27clojurebot"([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)"
07:27TEttingerit could have been saying how many matched I thought
07:27opqdonutright
07:29opqdonutbut using some gives you the same laziness as using or: it stops when the first match is found
07:30piranhaopqdonut: not bad
07:31piranhaexactly what I need :) ##(some {:class-name "test" :className "qwe"} [:class-name :className :class])
07:31lazybot⇒ "test"
07:31Mendor|scrwhat is the best analog for conj function if I need to add a single item to the head of the collection?
07:32opqdonutMendor|scr: conj does that for lists
07:32opqdonut,(conj (list 1 2 3) :a)
07:32clojurebot(:a 1 2 3)
07:33Mendor|scropqdonut: thanks
07:33opqdonutfor vectors conj appends:
07:33opqdonut,(conj [1 2 3] :a)
07:33clojurebot[1 2 3 :a]
08:22dcunit3dthis 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/
09:05klrr_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:
09:06klrr_CompilerException java.lang.RuntimeException: Unable to resolve symbol: connect in this context, compiling:(tob/core.clj:4)
09:06klrr_any ideas what's wrong?
09:06klrr_(also, code is from here: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/ )
09:10ambrosebsklrr_: (:require [tob.irc :refer [connect]])
09:11klrr_ambrosebs: i get same error
09:11klrr_i think the problem is that i use def, if i use defn it's not evauated before its needed
09:12klrr_damn same error even with defn
09:13ambrosebsklrr_: tried restarting your REPL? that should work
09:13ambrosebsyou should get a new error now
09:13ambrosebscomplaining about login
09:14klrr_CompilerException java.lang.RuntimeException: Unable to resolve symbol: connect in this context, compiling:(tob/core.clj:4)
09:14klrr_same error
09:14klrr_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?
09:15klrr_connect doesnt return a ref
09:15klrr_it returns unpure side effects
09:15klrr_and start printing random stuff
09:16ambrosebsklrr_: it's implied he's using connect in the same namespace
09:16klrr_eh? ok
09:17klrr_i just put everything in core.clj then?
09:17ambrosebsklrr_: sure
09:17klrr_now i get this error
09:17klrr_CompilerException java.lang.RuntimeException: Unable to resolve symbol: codetalk in this context, compiling:(tob/core.clj:39)
09:18ambrosebsklrr_: do you understand how require/refer works?
09:18klrr_https://gist.github.com/anonymous/13c7da60603ffd1b0994
09:18klrr_i dont know anything im just trying to get the code working so i can start read it and learn how it works
09:19klrr_i presumed i could just copy paste it in a leiningen project and it would work...
09:19ambrosebsklrr_: it should, you are adding extra code. Should only be one ns form
09:19klrr_ups
09:19ambrosebsklrr_: it's worth figuring out how clojure namespaces work, see http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols
09:20ambrosebsklrr_: once you get it, it's easy
09:20klrr_hmm now it compiles
09:20klrr_but the bot doesnt connect xD
09:21klrr_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 ...
09:21ambrosebsthat's not my area ;)
09:22klrr_ambrosebs: thanks for help :)
09:22ambrosebsklrr_: good luck :)
10:05ambrosebsin what situation would reduced? be useful?
10:05ambrosebsisn't the point that a Reduced is always wrapped? just useful for an implementation of reduce?
11:40sm0kehey guys anyone here using http kit?
11:42joegalloare you conducting a survey, or is there a second question?
11:42joegallo;)
11:42joegallowhich is to say, just ask the question you want to ask...
11:44sm0kejoegallo: oh sorry
11:44sm0kejoegallo: i just wnted to ask what i need to do for making a rest endpoint asynchronous
11:44joegallono worries :)
11:45sm0kethen i just saw with-channel api..i think thats the way right?
11:47joegalloi 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:48joegalloah, i guess they're talking about the pre-2.0 rcs
11:48joegalloso it sounds to me like with-channel is the thing
11:48sm0kejoegallo: right
11:48joegallobut i'm just some guy on the internet reading the documentation :)
11:49sm0kethats creepy
11:49sm0kewho reads documentation?
11:50sm0kecrap man after writing one week of clojure..i find myself parenthesizing everything in my scala code
11:51sm0keeh..lisp is like vim when it comes to habits
11:51indigoOr the usual
11:51indigo"I wish this language had macros"
11:51sm0keindigo: :( i dont do macors .. yet
11:52sm0keindigo: are they really that useful? i hear a lt of praise
11:52indigoYep, they help you write more concise code
11:53sm0ke:( i want to learn macros
11:53indigoNothing's stopping you ;P
11:53sm0kemay be i will give some time today to learning macros
11:54sm0kebut still i havent touched macros but it found writing in scala immensly better than scala
11:54sm0keeh wtf..i meant writing in clojure
11:55indigoHeh, I haven't touched Scala
11:55sm0kefor first the whole ring compojure thingy is very very intutive and easy to work with
11:55sm0kefor learining it you just need to know maps
11:56sm0kesecondly working with json in clojure is also effortless
11:57indigoMiddleware/cheshire ftw
11:57sm0kethrid, after trasitioning from scala actors to core.async ... i realize how wrting actors was such a liability
11:58sm0kealthough i still miss pattern matching in scala..but i really see that clojure has enirelt different choices to avert that
11:59alandipertsm0ke: there's https://github.com/clojure/core.match
12:00llasramsm0ke: 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:00llasramsm0ke: Also, it's only slower right now because no one has spent time making it fast :-)
12:00llasramThe backing Java implementation is highly tuned
12:01sm0kellasram: ah i see.. sorry i didnt dig into your code i was thinking may be you are using edn for ser/de
12:02llasramAnd because Avro has schemas, it should be possible to use code-generation to produce optimized per-schema de/serialization code at run-time
12:02dnolensm0ke: fwiw, other Scala -> Clojure people seem happy with core.match
12:02dnolenfor pattern matching
12:02llasramsm0ke: Ah, no. the EDN-in-Avro stuff encodes the same data structures as EDN, but doesn't actually use the EDN serialization format
12:03sm0kednolen: alandipert yes i know about core.match .. still have to look into it :)
12:04dnolensm0ke: about the only thing that's missing according to David Pollak is function application in the match
12:05sm0kellasram: 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:05sm0kednolen: you mean guards?
12:05dnolensm0ke: no
12:06dnolensm0ke: so maybe you won't notice ;)
12:07llasramsm0ke: 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:10sm0kehmm its odd to hear lost of people compile avro.. but i guess for people working with hadoop ecosystem its a natural choice
12:16sm0keanywho if i hit a roadblock i will find you here..time to fix some scala code now
12:20dnolenjonasen: finally got around to removing the weird namespace convention around data structures in CLJS
12:23jonasendnolen: I saw that. Also thanks for accepting my patch with the alias issue
12:23dnolenjonasen: np
12:29jonasendnolen: 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:32dnolenjonasen: 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:33jonasendnolen: Ok, I'll take a look at it
12:33dnolenjonasen: the name of a fn can shadow a namespace, but we have logic for this situation, we should be able to reuse it
12:34dnolenjonasen: or anything you see on the major list that looks fun, the shadowing one does not look fun to me ;)
12:44zachoakeshas anyone tried getting clojure to work with robovm?
13:16jonasendnolen: ping
13:20jonasenI'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:24zachoakesdoes anyone know if you can :import a java class without having it be initialized?
13:27vmarcinkoi 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:28vmarcinkoso, my question is what is preferred way in clojrue to define that special type
13:28vmarcinkoi can make it in few ways
13:28vmarcinkoUsing namespaced keyword marking special type:
13:28vmarcinko[1 2 3 [:mylib/specialtype mytaparg1 mytypearg2] 6 7]]
13:29vmarcinkoUsing factory function to create special type
13:29vmarcinko(regardless what data structure is used under the hood although it can be seen if printed after fn evaluation)
13:29vmarcinko[1 2 3 (mylib/create-specialtype mytypearg1 mytypearg2) 6 7]]
13:29vmarcinkoUsing records:
13:29vmarcinko[1 2 3 (->mylib/SpecialType mytypearg1 mytypearg2) 6 7]]
13:29vmarcinkoOr maybe special reader tag?
13:29vmarcinko[1 2 3 #mylib/SpecialType (mytypearg1 mytypearg2) 6 7]]
13:29vmarcinkoso I dunno which one to pick? its important because the solution will be exposed as lib's public API
13:59ibdknoxtechnomancy: were the pre 2.3.3 versions of Leiningen removed from Clojars on purpose?
14:06juliangindiHey 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&quot; any ideas?
14:06jonasendnolen: According to my testing this commit fixed both issues: https://github.com/clojure/clojurescript/commit/9ddf847b44ec82070e91038f4afbd8a2baec94ff
14:11xeqiibdknox: no, they were all removed when he was trying to fix a partial deploy
14:11xeqiibdknox: they should be back up with metadata showing them
14:11xeqithough he still needs to fix the metadata for 2.3.3
14:13ibdknoxxeqi: thanks for the info :)
14:15dnolenjonasen: ok thanks, going to add a test to be extra sure
14:16jonasendnolen: that was "low hanging fruit". Two bugs squashed, zero lines of code written! :)
14:16dnolenjonasen: my favorite :)
14:45klrr_is leinigen a standalone build system or some kind of wrapper around java stuff?
14:51jonasendnolen: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/tagged_literals.clj#L7
14:52jonasen^^ PersistentQueue/EMPTY -> PersistentQueue.Empty
14:52dnolenjonasen: thx, btw it looks like CLJS-604 is not actually resolved, there's definitely a problem with multiple arity fns and self calls ...
14:52jonasenotherwise I get WARNING: No such namespace: cljs.core.PersistentQueue
14:52dnolenjonasen: fixing now
14:53dnolenjonasen: fixed in master
14:54jonasen604? I didn't look at that one
14:55xeqiklrr_: 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:56xeqiprofiles and profile merging is its own system
14:56klrr_okey, thanks!
14:56jonasendnolen: you mean 603, right? How did you test it? with the foo.tar.gz attachment?
15:01dnolenjonasen: https://github.com/clojure/clojurescript/compare/603-multi-arity-shadow
15:02jonasendnolen: I mean how did you test 603, when you came to the conclusion that it's not yet fixed in master
15:02dnolenjonasen: ^ this test fails
15:02jonasenoh, sorry
15:03dnolenjonasen: it pretty weird I don't see why the fn doesn't get resolved to the local we create
15:03dnolenprobably something simple
15:03indigoCan anyone recommend me a good validation library for Compojure that follows the "clojure way"
15:05Bronsadnolen: 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:06dnolenBronsa: sure
15:06Bronsaok cool
15:13dobry-denindigo: i havent used it but this looks simple https://github.com/brentonashworth/sandbar/wiki/Form-Validation
15:14dobry-dencheck out https://github.com/leonardoborges/bouncer
15:16dobry-den`some-fn` is a cool way to roll your own simple validator
15:18dnolenjonasen: 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:23Bronsadnolen: 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:24dnolenBronsa: k, you should ping ambrosebs about that, don't think anybody else is really using the analyzer
15:25jonasendnolen: is it possible to run the test suite with whitespace optimizations
15:25jonasen?
15:26dnolenjonasen: hrm, I never do that - probably but would need to patch goog.provide, require I think?
15:27jonasenok
15:30dnolenjonasen: 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:31algernonif 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:32algernonas 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:33dnolenjonasen: actually I fixed it
15:33jonasendnolen: awesome!
15:39jonasendnolen: about bad namespace convention.. there are probably lots in the tests, try running e.g. grep -r "/EMPTY" test
15:40dnolenjonasen: thx fixing that now too
15:42dnolenjonasen: ok gotta run thx for the help
15:53zachoakesdoes anyone know how to prevent static initializers from running when a java class is imported?
16:11joegallozachoakes: i don't think that is possible
16:12zachoakesjoegallo: 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:13joegallohow so?
16:13zachoakeswell 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:15zachoakesi'm trying to get clojure to work with robovm, but this is turning out to be a roadblock for me
16:18joegalloahhhhh
16:38joegalloanyway, i suppose you could do all your importing at runtime using Class/forName
16:38joegallofor the class or classes whose static initializers you wish to avoid
16:39zachoakesi was going to try that, but what i'm doing requires AOT for the classes in question
16:39joegallodang
16:47gfrederickshow does nrepl.el handle multiple connections? E.g., how do I know/control which connection a buffer is associated with?
17:05gfredericksdoes conch let me set the subprocess's working directory somehow?
17:09gfredericksyes it does.
17:21bbloomanybody know what's the difference between hash and hasheq in the clojure code?
17:21bbloomand/or the motivation for it
17:21gfredericks"the clojure code" is "the java backend to clojure"?
17:21bbloomyeah
17:21gfredericks,hasheq
17:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hasheq in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:22bbloom,clojure.lang.IHashEq
17:22clojurebotclojure.lang.IHashEq
17:22gfredericksmy 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:22gfredericksI'm short on details here though
17:22bbloomyeah, that much i guessed, but was hoping for some deeper insight
17:23gfredericks,[(.hashCode (Integer/parseInt "31")) (.hashCode (Long/parseLong "31"))]
17:23clojurebot[31 31]
17:23gfredericks,[(.hashCode (Integer/parseInt "-31")) (.hashCode (Long/parseLong "-31"))]
17:23clojurebot[-31 30]
17:23gfredericks,[(hash (Integer/parseInt "-31")) (hash (Long/parseLong "-31"))]
17:23clojurebot[30 30]
17:24gfrederickshasheq should be consistent across the numeric types that clojure considers compatible
17:25bbloomthat makes sense, but i dunno why there is a need for both, rather than just making the normal hashCode work for that purpose
17:25gfredericksanother question I don't know the answer to is why BigInt exists (I think this is related)
17:26gfredericksmaybe it relates to collections containing "equal" things with different hashCodes?
17:26Bronsa,(.hashCode [(Integer. -1)])
17:26clojurebot30
17:27Bronsa,(hash [(Integer. -1)])
17:27clojurebot31
17:27gfredericks,(let [m1 [(Long. -42)] m2 [(Integer. -42)]] [(map hash [m1 m2]) (map #(.hashCode %) [m1 m2]))
17:27clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
17:27gfredericks,(let [m1 [(Long. -42)] m2 [(Integer. -42)]] [(map hash [m1 m2]) (map #(.hashCode %) [m1 m2])])
17:27clojurebot[(72 72) (72 -11)]
17:28BronsaI guess it might have something to do with equiv vs equals
17:28gfredericksbbloom: 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:28bbloomequality is all kinds of hard :-/
17:29Bronsa,(.equiv [(Integer. -1)] [-1])
17:29clojurebottrue
17:29Bronsa,(.equals [(Integer. -1)] [-1])
17:29clojurebotfalse
17:32bbloomhmmm
17:33ghadi_shaybantechnomancy: Saw your name on a dns-sd lib for ruby from a few years ago
17:33ghadi_shaybanany recommendations for calling DNS-SD on osx from clojure?
17:33technomancyghadi_shayban: haha, wow that brings me back
17:33ghadi_shaybanwas just going to shell out to dns-sd command
17:34technomancyno idea about macosecks, but I've played a bit with an avahi-like java lib
17:34ghadi_shaybani have linux covered with avahi
17:34ghadi_shaybanwhich one?
17:34technomancyjmdns: https://github.com/Seajure/cabeza-de-vaca/blob/master/src/cabeza/de/vaca.clj
17:34technomancyjust very briefly
17:35bbloom,(pop clojure.lang.PersistentQueue/EMPTY)
17:35clojurebot#<PersistentQueue clojure.lang.PersistentQueue@1>
17:35bbloom,(pop [])
17:35clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector>
17:35bbloom*sigh*
17:35gfredericks,(pop ())
17:35clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't pop empty list>
17:36bbloompublic PersistentQueue pop(){
17:36bbloom if(f == null) //hmmm... pop of empty queue -> empty queue?
17:36gfredericksis anything else poppable?
17:36bbloom return this;
17:36bbloom //throw new IllegalStateException("popping empty queue");
17:36bbloomwhoops, sorry for big paste
17:36gfredericksis returnth the old timey version of return?
17:36bbloomgfredericks: map entries
17:37gfredericks,(-> {1 2} first pop pop)
17:37clojurebot[]
17:37bbloomother than that, nothing i see
17:37gfredericks,(-> {1 2} first pop pop pop)
17:37clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector>
17:39rurumate_,(assert (Boolean. false))
17:39clojurebotnil
17:41rurumate_looks like bug in clojure.core/assert
17:42bbloomrurumate_: nah, it's a well known behavior that nil and the singleton false value are the only logically false values
17:42bbloomsingleton false *instance* i mean
17:42bbloom,(if (Boolean. false) 1 2)
17:42clojurebot1
17:43bbloom,(if (boolean (Boolean. false)) 1 2)
17:43clojurebot2
17:43bbloom^^ use that if you need to coerce
17:43rurumate_is that consistent with java's assert?
17:43bbloomno, it's consistent with clojure's notion of generalized booleans
17:44bbloom(ie generalized to nil and all other objects as false and true respectively)
17:45rurumate_it's a bit tricky for java programmers imo, at least there should be a big WARNING in the docs
17:46bbloom(doc if)
17:46clojurebotHuh?
17:46bbloom,(doc if)
17:46clojurebotI don't understand.
17:46bbloom*sigh*
17:46rurumate_Boolean.FALSE is the new true
17:46bbloom#(doc if)
17:46bbloom&(doc if)
17:46lazybot⇒ "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:46bbloomfinally :-P
17:46bbloom(doc assert)
17:46clojurebot"([x] [x message]); Evaluates expr and throws an exception if it does not evaluate to logical true."
17:46bbloomnotie "logical true"
17:46bbloomnotice* logical true
17:46rurumate_hmm
17:47bbloomi'm not claiming it's documented super well
17:47bbloombut it is documented… modulo the (Boolean. false) edge case
17:47bbloombeing not-confusing to java programmers isn't a goal of clojure :-)
17:48rurumate_well for me, it is a goal
17:48rurumate_at least the docs can get updated
17:49rurumate_maybe put WARNING here and there
17:49bbloomi don't think the docs can or should point out every edge case
17:49bbloomshould 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:49rurumate_bbloom: well maybe not
17:50bbloomrurumate: it's also documented clearly & covers that edge case here: http://clojure.org/special_forms
17:51bbloom"if you are creating your own boxed Booleans make sure to use Boolean/valueOf and not the Boolean constructors."
17:52rurumateNote that if does not test for arbitrary values of java.lang.Boolean
17:53rurumatelike Boolean.TRUE, Boolean.FALSE and Boolean.FOO
17:53bbloom"Note that if does not test for arbitrary values of java.lang.Boolean, only the singular value false (Java's Boolean.FALSE)"
17:53bbloomit literally says that
17:55rurumate,(if Boolean/FALSE "not" "not not")
17:55clojurebot"not not"
17:56rurumate,(if (Boolean. Boolean/FALSE) "not" "not not")
17:56clojurebot"not"
18:04bbloomgfredericks: while i'm studying clojure's internals…. i'm not quite sure why vector nodes have the AtomicReference<Thread> edit
18:06bbloomdon't all potential edits go through the interface of ITransientVector? meaning that edit rights could be checked at assoc! and pop! time ?
18:11bbloomwhere's mmarczyk when you need him? :-P
18:17gfredericksbbloom: is this a transient question in particular?
18:17bbloomyeah
18:19gfredericksoh I see the node has it despite being used by the persistents as well?
18:19bbloomso it's a mutable atomic cell that's null by default, but set to the current thread when editing a transient vector
18:19bbloomthen when you call persistent!, it sets it to null
18:20bbloombut for some reason it propagates the mutable cell around to nodes
18:20bbloomseemingly only for ensureEditable
18:21bbloombut 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:25gfredericksthe alternative is to track editability just at the top level of each transient object?
18:25gfredericksrather than paying attention to any given node?
18:26bbloomyeah, so look at PersistentArrayMap
18:26bbloomit's much much simpler (no interior nodes)
18:26bbloomTransientArrayMap simply has a `Thread owner` field
18:28gfredericksyeah 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:28gfrederickswhich seems impossible
18:28gfredericksbased on how I assume transients work
18:28bbloomyeah, i considered & rejected that too
18:28bbloomdoesn't make sense
18:30gfredericksif 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:30gfrederickswait how does persistent! work?
18:30bbloomsearch for "persistent("
18:30bbloomit just sets the mutable thread cell to null & then copies the fields over from the TransientVector to the PersistentVector
18:33gfredericksI was wondering if the fact that it doesn't do anything recursive was a clue
18:33gfredericksbut that thought isn't leading me anywhere
18:34bbloomit's documented constant time
18:35logic_progfor clojure apps with interacting with sql, do people prefer postgresql, mysql, or sqlite ?
18:35logic_progwhere "people" = people developing clojure apps
18:35bbloomthat's not a question about clojure at all
18:35gfredericksyeah 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:35bbloomthose are 3 very different databases that have very different use cases
18:36bbloomsqlite == fopen; mysql == dumb indexes in RDBMS' clothing; postgresql == actual database
18:37logic_proghmm, sounds like I want sqlite
18:37bbloomlogic_prog: also consider: http://www.brandonbloom.name/blog/2013/06/26/slurp-and-spit/
18:38gfredericksI hope this blog post is two sentences
18:39logic_progwhoa, pr-str and read can be quite interesting
18:39logic_proggiven there is no parsing required
18:39logic_progit's basically persistence for free
18:39logic_progsince most of clojure is "programming with values" anyway
18:40bbloomleverage, baby, leverage
18:40bbloomif that's blowing your mind, then i suggest you read my post carefully and in full :-)
18:44logic_progbbloom:
18:44logic_progyou're pretty smart
18:45bbloomdoing my best
19:00gfredericks,(into {} '(("foo" "bar")))
19:00clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map$Entry>
19:00gfredericks,(into {} [["foo" "bar"]])
19:00clojurebot{"foo" "bar"}
19:00gfredericksI imagine that error message is rooted in the silly behavior of conj
19:00bbloomi think map entries are one of the cruftiest parts of clojure's implementation
19:02ghadi_shaybantechnomancy: jmdns works just fine thx
19:02gfredericksthe conj thing is just entirely unnecessary though
19:03gfredericksconj the duck-wrapper
19:06ToxicFrogHaving a bit of an uberjar problem.
19:06ToxicFrog'lein run' works fine.
19:07ToxicFrog'lein uberjar' successfully generates a normal and standalone uberjar.
19:07ToxicFrog'java -jar uberjar.jar' returns 'could not find or load main class runewords.core'
19:08ToxicFrogUnzipping the jar shows that it has .class files for lots of libraries, but only the .clj for the main class.
19:08ToxicFrogIt does have :gen-class.
19:08ToxicFrogWhat am I missing?
19:08gfredericksan :aot entry in the project.clj?
19:09gfredericks:aot [runewords.core]
19:09gfredericksan alternative is to avoid AOT and use a launcher script, if you don't need an executable jar in particular
19:09ToxicFrogNo such entry, other projects I have don't need it
19:10gfredericksdo your other projects have a :main entry?
19:10ToxicFrog(which is to say :main normally gets AOT compiled automatically when I ask for an uberjar, looks like)
19:10ToxicFrogOh, looks like this may be a bug in lein: https://github.com/technomancy/leiningen/issues/1289
19:10gfredericksyes, I think that feature will be removed?
19:11gfredericksI'm a fan of avoiding AOT altogether though
19:11hyPiRionToxicFrog: what version are you running?
19:12ToxicFroggfredericks: well, it's kind of necessary if you want to deploy a jar that people can run with java(1)
19:12ToxicFroghyPiRion: 2.3.1
19:12hyPiRionah. Upgrade, that should do it
19:12gfredericksToxicFrog: you can run with java and extra options w/out AOT
19:12ToxicFrogJust upgraded to 2.3.3. and now it's working.
19:13ToxicFroggfredericks: the goal is to produce something that people with a JVM (and nothing else) can run by double-clicking on.
19:13ToxicFrogWithout needing to faff about with launcher scripts because fuck that noise, forever, in hell, especially on windows.
19:13gfredericksToxicFrog: yep that goal precludes my approach
19:15rurumateToxicFrog: :aot :all can be considered, also there is lein bin plugin https://github.com/Raynes/lein-bin
19:16rurumatesomethimes the sample project.clj can help: https://github.com/technomancy/leiningen/blob/master/sample.project.clj
19:17TEttingerHow can I make lein use a jar as a dependency?
19:17gfredericksthat question maybe deserves its own doc file in leiningen
19:17gfredericksseems to come up every day
19:18rurumateTEttinger: maybe :resource-paths ?
19:18TEttingeryeah, I've considered it. duplicate Manifests can be tricky.
19:18ToxicFrogNow I'm having trouble accessing my resources >.<
19:18TEttingerlein bin is not good, unfortunately it needs a JDK on the user's system
19:19ToxicFrog(->> filename clojure.java.io/resource .getFile ...) works fine in lein run
19:19ToxicFrogIn the uberjar, it throws a FileNotFoundException: target/uberjar.jar!/filename.html
19:20ToxicFrogDespite the fact that I can unzip the uberjar and see filename.html in the jar root.
19:20rurumateTEttinger: 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:20TEttingeryep, unzipping the jar. thanks rurumate
19:26TEttingerhm. [] and devlib have a type mismatch merging profiles.
19:26TEttingerwhat on earth would that mean...
19:26ToxicFrogrgrgrgrgrgr
19:32hyPiRionTEttinger: you have [] and devlib as two values for same keys when merging profiles
19:32TEttingerno, it was dumber.
19:32TEttinger"devlib" instead of ["devlib"]
19:33TEttingerit works, thanks hyPiRion, rurumate
19:33hyPiRionah, good to know
19:34paulsamwaysHi. Can someone explain what the point of the binding form [& [x]] is? Is it purely to make the last param optional?
19:36scottjpaulsamways: yeah, afaik
19:37rurumatepaulsamways: like in (delete-file f & [silently]) ?
19:38rurumatehttp://clojuredocs.org/clojure_core/clojure.java.io/delete-file
19:38paulsamwayslike: https://github.com/noir-clojure/lib-noir/blob/master/src/noir/validation.clj#L90
19:40rurumateyes it also has & [something] instead of simply & something
19:40paulsamwaysyes, like delete-file too. Actually make sense for delete-file to have silently as optional.
19:42rurumate(delete-file f & args) would almost be equivalent, but (delete-file f & [silently]) forces the bool to be wrapped in a vector
19:43rurumatethe function is easier to define that way, but it is more work and maybe runtime overhead for the caller
19:44rurumate..or does it?
19:44shokythat doesn't sound right
19:45rurumate,(let [[ & [silently] ] [true]] (not silently))
19:45clojurebotfalse
19:45rurumate,(let [[ & [silently]] true] (not silently))
19:45clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Boolean>
19:46rurumateseems like extra vector [] brackets are needed
19:47rurumatestill not sure why it's written that way
19:47shokyyou put the extra brackets in the binding form
19:49rurumateshoky: in this case, yes. they go wherever tne arguments goes
19:53paulsamwaysahh 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:53shoky,((fn [& [silently]] (not silently)) false)
19:53clojurebottrue
19:53paulsamwayscorrect?
19:53shokyyes
19:54shoky,((fn [& [silently]] (not silently)) [false])
19:54clojurebotfalse
19:54paulsamwaysthanks. Still trying to understand some of the idioms of clojure.
19:56paulsamwaysI 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:58shokyi think it's just instead of giving two separate function bodies
19:59shokyor.. what don't you understand about it?
19:59paulsamwayswell the func is a no-op if you don't pass in any args in
19:59shokyit's not
19:59paulsamwaysoh?
19:59shokythere's an else form
20:00shokythe apply
20:00paulsamwaysoh! of course.
20:00paulsamwayssorry, all makes sense now.
20:01ToxicFrogThis makes no sense!
20:01ToxicFrogI run the program, 4925 lines of output.
20:01shokynp, i've fallen for that one several times
20:01ToxicFrogI lein clean, lein uberjar, java -jar foo.jar
20:01ToxicFrog4744 lines of output
20:01gfrederickshow did you run it the first time?
20:04shokylein pollute
20:08ToxicFroggfredericks: lein run I
20:08ToxicFrogvs java -jar target/runewords-0.1.0-SNAPSHOT-standalone.jar I
20:08ToxicFrogIt's getting the same argv.
20:10gfredericksI don't have any guesses
20:10ToxicFrogI can also see that it's reading the same number of records for display
20:11ToxicFrogSo it looks like the output is actually getting cut off.
20:11ToxicFrogBut 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:12gfrederickswhat's the output mechanism? println?
20:12ToxicFrogprintf
20:12gfredericksah
20:12gfredericksmaybe the buffer doesn't get flushed?
20:12ToxicFrogI'd expect it to get flushed when the program exits, if not before
20:12gfredericksI don't know enough low-level unix details to confidently suspect one way or the other
20:12gfredericksbut yeah you would hope it works that way
20:13gfredericks(.flush *out*) at the end of main to be sure
20:13ToxicFrogAdded that and now it works perfectly.
20:13gfrederickscurious who to blame for that
20:14gfrederickslet me know if you figure it out :)
20:14gfredericksthe consistent-except-across-recompiles part is really creepy
20:14ToxicFrogYeah
20:17ToxicFroggfredericks: it's worth noting that if I make a query that generates little output, there is *no* output when running from the jar.
20:17gfredericksyeah that seems consistent
20:17ToxicFrogSo it's not "cuts off after N" but "cuts off the last N"
20:17gfredericksmakes sense if it's an unflushed buffer thing
20:20gfredericksToxicFrog: 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:21ToxicFroggfredericks: it says that the default System.out PrintStream auto-flushes on newline, and all record display is newline-terminated
20:21gfredericksoh I was thinking of the "doesn't auto-flush on exit" part in particular
20:22charei return
20:22charehello my friends
20:22gfredericksyou're write that since you're writing lines it doesn't make sense
20:22gfredericksright*
20:23gfredericks*out* is a new OutputStreamWriter(System.out)
20:25gfrederickswhen I compile a java class that only does System.out.print("foo"), it prints
20:25the-kennyUsing 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:25the-kennyThat is even for an empty file.
20:30charewhen are they going to kill kenny again in south park
20:35the-kennyOk, found the problem. ring-core was overriding tools.reader with an outdated version.
20:35gfredericksthat sounds familiar
20:36the-kennyYeah, found it in the logs of this channel
20:36gfredericksis there an issue for it yet?
20:36the-kennyDon't think it's the fault of clojurescript
20:36gfredericksin ring-core I mean
20:36the-kennyDoesn't look so
20:37gfrederickswell if you'd like to get your good deed for the day out of the way...
20:38the-kennyHeh :)
20:38the-kennyYeah, I'll open an issue.
20:38gfredericksmake sure it's not already fixed on HEAD
20:39the-kennyNope, isn't.
20:43ghadi_shaybanjust released a trivial little dev tool - EDN-payload sharing over Bonjour AKA DNS-SD
20:43ghadi_shaybangithub.com/ghadishayban/undersea
20:44charewe need a project to work on
20:44charecome on guys
20:44ghadi_shaybanit will discover other users on the same LAN and grab things from them
20:44the-kennyghadi_shayban: That's interesting. Bookmarking it :)
20:45ghadi_shaybantechnomancy: thanks for the JmDNS reference, that's what it's using
20:45ghadi_shaybanhave an Avahi backend in there too, but not in the code path right now
21:00chareyou guys like the iphone 5c
21:02benkay_in the spirit of zero? and pos? is there an equivalent test for real numbers?
21:04bbloomnot built in, no
21:04bbloomuse clojure.core/class or clojure.core/instance? to make your own
21:05benkay_,(instance? number 1)
21:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: number in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:06benkay_,(instance? Number 1)
21:06clojurebottrue
21:06benkay_woo!
21:06benkay_thanks bbloom!
21:07hyPiRion,(instance? Number Double/NaN)
21:07clojurebottrue
21:07hyPiRionPerhaps not an issue for your case, but keep it in mind
21:08gfrederickswhat does real number mean?
21:08benkay_gfredericks: not imaginary
21:08bbloombenkay_: clojure doesn't have imaginary numbers built in
21:08benkay_probly not a problem
21:08benkay_anyways thanks all!
21:09gfredericksI keep trying to make a lib for complex numbers and then it turns out super complicated to do it well
21:09gfredericksso I give up and paste my deftypes between projects
21:10bbloomgfredericks: curious: what are you using complex numbers for so often that you're copy pasting between many projects?
21:12gfredericksit might be mostly quantum computing stuff
21:12gfrederickscan't recall if there was something else
21:14gfredericksthis is a long grep
21:15gfredericksoh I was also messing with some academic research into exact algebraic number representations
21:18charegfredericks you should help me make starcraft clone
21:19marcopolo2,(+ 1 2 3)
21:19clojurebot6
21:20marcopolo2$findfn [1 2 3] => '(2 3)
21:20lazybotjava.lang.RuntimeException: Unable to resolve symbol: => in this context, compiling:(NO_SOURCE_PATH:0)
21:20marcopolo2$findfn [1 2 3] '(2 3)
21:20lazybot[clojure.core/next clojure.core/rest]
21:22nDuffghadi_shayban: Cute. I'm a bit curious -- was there a particular use case that inspired it?
21:24TEttingerhttps://cowlark.com/luje/doc/stable/doc/index.wiki if only this worked on windows.
21:47frozenlockIs there a function to replace keys in a smap?
21:48gfrederickswhat's a smap?
21:48frozenlock{:a 1}
21:49gfredericksa single entry map?
21:49gfredericks,clojure.set/rename-keys
21:49clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>
21:49ambrosebs$findfn {:a 1} {:a :b} {:b 1}
21:50lazybot[clojure.set/rename-keys]
21:50frozenlockDidn't think of looking into .set at all o_O
21:50gfredericksand for functions on vectors check the finger trees namespace
21:51frozenlockWorks perfectly, thanks :D
21:51frozenlockambrosebs: What witchraft is this?!
21:51ambrosebsmagic!
21:52TEttinger$findfn 3 4 3/4
21:53lazybot[clojure.core//]
21:53gfredericks$findfn 42 42
21:53TEttingerhuh, thought it would find /' or whatever the other kind is
21:53lazybot[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:54TEttingeroh it doesn't exist right
21:54TEttingernice gfredericks
21:55gfredericksfrozenlock: that is probably not the best bot's source code to look in
21:55frozenlockBut you don't understand... I NEED to know how it's done :p
21:56gfredericksbut you don't understand
21:56gfrederickslazybot did that, not clojurebot
21:56coventryfrozenlock: https://github.com/Raynes/findfn
21:56frozenlockOh, right...
21:57Foxboronhttps://cowlark.com/luje/doc/stable/doc/index.wiki
21:57Foxboronwouldnt this be fun to try with clojure?
22:14coventryCan someone remind me what FNONCE is for?
22:16nightflydon't re-define a function when reloading a file?
22:16paper_ziggurathow is the clojure job market?'
22:16gfrederickscoventry: it's for functions that you know will only be called once so that they can GC stuff early
22:17gfrederickscoventry: I'm only 93% sure that's the case
22:17coventrygfredericks: Thanks.
22:17gfredericksclassic use case is delay and lazy-seq
22:18gfredericks,(repeatedly 3 (let [x 42] (^{:once true} fn* [] x)))
22:18coventrygfredericks: Yeah, just came across it in lazy-seq.
22:18clojurebot(42 42 42)
22:18gfredericks,(repeatedly 3 (let [x "42"] (^{:once true} fn* [] x)))
22:18clojurebot("42" nil nil)
22:19gfredericksah there it is
22:19gfredericksneeded a proper object
22:19coventrygfredericks: Huh. Very cool. I'll put that example in my notes, so I don't forget it this time
22:22coventrypaper_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:22coventrys/working on/working in/
22:24namccartyI'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:24namccartySo there is at least one clojure job out there
22:25coventrynamccarty: What do you do?
22:25namccartyRight 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:26bitemyappcoventry: 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:26bitemyappcoventry: 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:27bitemyappcoventry: 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:27namccartybitemyapp: That is pretty much me right now
22:27benmossI've definitely found it difficult to find any jobs that seem to be using it
22:28bitemyappTake it as a personal challenge to rejigger your life to make yourself happier, whether that includes clojure or not.
22:28bitemyappIf you're satisfied using Clojure on nights and weekends - then there's nothing to complain about :)
22:29solussd I've got two jobs using clojure. :D
22:30bitemyappI'm working on a Clojure project at a company that is 99% Python.
22:30solussdstep 1: take job that says it requires and, step 2: just use clojure instead
22:30solussd*java
22:31namccartysadly 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:34coventrybitemyapp: 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:34bitemyappcoventry: 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:35solussdI 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:36namccartyIf 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:36namccartysoulssd is right with the proactive thing though
22:37coventryThinking 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:46bitemyappcoventry: I'm in startup-landia.
22:46bitemyappif that gives you any inclination as to what career track looks like
22:46namccartyAs am I
22:47namccartyMy current job started with a friend asking me how hard it would be to make a game he had an idea for
22:47namccartyand then cobol happened, but lets just forget about the cobol
22:57namccartyQuick question, is there any style guide for clojure that is consdidered universal or anything like that?
22:57technomancynamccarty: not really
22:57technomancyclojurebot: style?
22:57clojurebotstyle is http://mumble.net/~campbell/scheme/style.txt
22:57technomancy^ that one is my favourite, but it's not clojure-specific
22:58jagajyou should ideally keep all your parens on separate lines like C curly braces
22:58jagaj:)
22:58technomancy~guards
22:58clojurebotSEIZE HIM!
22:58metellus~gourds
22:58clojurebotSQUEEZE HIM!
22:58namccartytechnomancy: Thanks
23:09namccartyalright, I haven't used a case in clojure yet, will this do what I think it will do: https://www.refheap.com/19480
23:11technomancyI don't think so
23:12technomancythe clauses are constant
23:12technomancymaybe you want cond with sets instead of lists of numbers
23:13technomancy(cond color #{0x376AA4 0x85C6E1 0x07305E} :blue ...)
23:13technomancyerr
23:13technomancycondp; I think
23:13technomancyuh just ignore me
23:15yeoj____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:16rhg135Hello, 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:23coventry,('random-symbol slurp "random object") <-- In what context are you supposed to use symbols as functions?
23:23clojurebot"random object"
23:26yeoj____i don't know what i changed and now lein repl crashes... it's not even my code i don't think.
23:26yeoj____I think it's windows fault. ugh .
23:30coventryAh, a symbol-as-function is used for accessing namespace maps, apparently. http://stackoverflow.com/a/1176413/1941213
23:31coventryStill, that doesn't answer why it's just returning the second arg, if it's arg is not a map.
23:31coventry*its
23:31amalloynamccarty: that looks like a pretty reasonable case-expression, but of course you can just try it
23:32namccartyamalloy: Thank you, it appears to be behaving correctly, just wanted to make sure that it was behaving for the right reasons
23:47coventryclojure.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:52bbloom(doc *out*)
23:52clojurebot"; A java.io.Writer object representing standard output for print operations. Defaults to System/out, wrapped in an OutputStreamWriter"
23:53bbloomsee also binding and with-out-str
23:59coventryOh, rebind the output. Didn't think of that, because it's not a good option in my current case.
23:59bbloomwhy?
23:59clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone