2013-10-06
| 00: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 |
| 00:08 | namccarty | Knowing me it is going to be something stupid like a typo |
| 00:09 | coventry | Time to break out clojure.tools.trace. |
| 00:09 | coventry | https://github.com/timvisher/what-does-tools-trace-do |
| 00:10 | namccarty | I'm new to clojure, I have no idea how the debugging tools for it work, thank you coventry |
| 00:11 | bitemyapp | I've come really close to writing a traced wrapper for "let" |
| 00:11 | bitemyapp | So that I don't have to manually wrap trace-forms around it :P |
| 00:14 | bitemyapp | Passing tests are like a cushy, soft, warm blanket. |
| 00: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 |
| 00:15 | ddellacosta | &(map inc [1 2 3 4]) |
| 00:15 | lazybot | ⇒ (2 3 4 5) |
| 00: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. |
| 00:15 | ddellacosta | (showing a friend lazybot in IRC) |
| 00: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. |
| 00:15 | bitemyapp | ddellacosta: far more impressive is the code search. |
| 00:15 | bitemyapp | ddellacosta: you give it a "before" and "after" of args and output, it automatically finds the function that produces what you want. |
| 00:16 | bitemyapp | [1 2 3] => '(2 3) will return rest, next, etc. |
| 00:16 | ddellacosta | bitemyapp: oh wow, I didn't know that existed, that's amazing |
| 00:16 | ddellacosta | you do that with lazybot? |
| 00:16 | ddellacosta | &[1 2 3] => '(2 3) |
| 00:16 | lazybot | ⇒ [1 2 3] |
| 00:16 | bitemyapp | clojurebot I think. I'm trying to negotiate with it right now. |
| 00:16 | ddellacosta | ah, gotcha |
| 00:17 | namccarty | bitemyapp: yeah, iv'e noticed that finding the source of problems in clojure is a lot less painful |
| 00:17 | bitemyapp | hm. looks like maybe lazybot. |
| 00:18 | bitemyapp | namccarty: yeah the pure functions do a lot for you there. |
| 00:18 | coventry | $findfn [1 2 3] '(2 3) |
| 00:18 | bitemyapp | coventry: christ thank you |
| 00:18 | bitemyapp | need a fucking bot wiki |
| 00:18 | lazybot | [clojure.core/next clojure.core/rest] |
| 00:18 | bitemyapp | ddellacosta: ^^ |
| 00:18 | bitemyapp | $findfn [1 2 3] 1 |
| 00:18 | lazybot | [clojure.core/first clojure.core/rand-nth] |
| 00:18 | ddellacosta | bitemyapp: seriously, a wiki would be great |
| 00:18 | coventry | bitemyapp: Only reason I had it to hand is I used it a few minutes ago in a pm. |
| 00:19 | bitemyapp | ddellacosta: I'm working on it :( |
| 00:19 | ddellacosta | oh, that's cool, thanks |
| 00:19 | ddellacosta | bitemyapp: I'd be happy to help, I need to read through the code for lazybot/clojurebot |
| 00:19 | bitemyapp | lol @ rand-nth working for my example |
| 00:20 | bitemyapp | 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. |
| 00: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 |
| 00: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. |
| 00:20 | namccarty | One of the other owners is convinced that objects are literally jesus though |
| 00: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. |
| 00: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 |
| 00:22 | bitemyapp | So there's OOP, but it's mostly simple dispatch, types, etc. |
| 00:24 | Pupnik_ | if you decompile a jar made with clojure, do you get clojure or java out? |
| 00:25 | bitemyapp | ucb: http://www.youtube.com/watch?v=FNcSFDt8GiM |
| 00:26 | bitemyapp | Pupnik_: depends. |
| 00:26 | bitemyapp | Clojure never becomes Java, fyi. |
| 00:26 | bitemyapp | It can only be Clojure or bytecode (.class files) |
| 00:26 | bitemyapp | Clojure is not a source-to-source compiler like ClojureScript. |
| 00:26 | bitemyapp | Pupnik_: have you read Clojure's source code? |
| 00:27 | technomancy | you can get java back from the bytecode, but it won't actually be valid in most cases |
| 00:27 | bitemyapp | technomancy: how would you feel about a with-hooks-disabled macro for robert.hooke that can disable multiple vars at a time? |
| 00:28 | technomancy | bitemyapp: sounds totes reasonable |
| 00:28 | bitemyapp | technomancy: (with-multiple-hooks-disabled [wrapped-1 wrapped-2] ...) seem kosher? |
| 00:28 | bitemyapp | I'm writing this for Blackwater. |
| 00:29 | Pupnik_ | bitemyapp: i have not |
| 00:29 | technomancy | bitemyapp: wouldn't be to nutty to make the existing macro take a vector or a symbol |
| 00:29 | technomancy | too nutty |
| 00:29 | bitemyapp | I can adapt accordingly. |
| 00:30 | bitemyapp | I'm stashing it in black.water.hook for now, I'll PR whatever comes out of it after. |
| 00:36 | namccarty | welp, it appears the source of my problem is that one of my functions decided to have a tricky failure case |
| 00:40 | namccarty | oh, no, that is not it at all |
| 00:40 | namccarty | the source was copy/paste fail |
| 00:41 | namccarty | and stupid tests that didnt cover all cases |
| 00:41 | namccarty | but mostly copy/paste fail |
| 00:52 | bitemyapp | namccarty: :) |
| 00:55 | namccarty | My sudoku solver works now, I can die happy |
| 00:55 | namccarty | Also, what is the best way to analyze how much time clojure spends in each part of the code? |
| 00:57 | namccarty | I want to see if I can get this to run faster, but have no idea where to start |
| 00:58 | namccarty | My conventional JVM methods of profiling are just leaving me confused |
| 01:05 | logic_prog | anyone have a good example of scheme in clojure? |
| 01:05 | logic_prog | i.e. almost meta circula evaluator ish |
| 01:11 | seangrove | technomancy: Thank you for all the lein goodness |
| 01:26 | chare | you are all dumb |
| 01: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 |
| 01:37 | mullr | /ignore chare |
| 01:39 | chare | why you mad? |
| 01:42 | nightfly | chare | you are all dumb |
| 01:47 | devn | Wim Mertens - At The Edge Of The Void |
| 02:16 | bitemyapp | alright, I've fucked up this macro. |
| 02:16 | bitemyapp | https://www.refheap.com/19467 |
| 02:17 | bitemyapp | I would be immensely grateful if anybody could help me puzzle it out. |
| 02:19 | bitemyapp | 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. |
| 02:19 | bitemyapp | Seemingly, anyway. |
| 02:20 | bitemyapp | indigo: me too, if it meant somebody being able to unfuck my mind. |
| 02:21 | indigo | :P |
| 02:48 | vmarcinko | noob question... |
| 02:50 | vmarcinko | 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 |
| 02:50 | vmarcinko | with special namespaced keyword..In other words, this type belongs to public API of my lib... |
| 02:51 | vmarcinko | this special type has some specific data structure in it, so I can extract this pieces of data during processing it |
| 02:52 | vmarcinko | 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 |
| 02:53 | TEttinger | metadata seems about right. |
| 02:53 | TEttinger | ^:special-type |
| 02:54 | vmarcinko | hmmm |
| 02:54 | TEttinger | ,[1 2 3 ^:special-type [3 4]] |
| 02:54 | clojurebot | [1 2 3 [3 4]] |
| 02:54 | TEttinger | invisible to users, but you can query the metadata |
| 02:55 | marcopolo2 | bitemyapp: Are you using macroexpand-1 to help you out? |
| 02: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 |
| 02:55 | TEttinger | oh ok. |
| 02:56 | vmarcinko | something like: |
| 02:56 | vmarcinko | [1 2 3 [:mylib/mytype mytaparg1 mytypearg2] 6 7]] |
| 02:56 | vmarcinko | or maybe use special record in palce of it |
| 02:57 | TEttinger | I'd use a symbol, those are unlikely to show up in regular data |
| 02:58 | vmarcinko | and what's wrong with keyword? |
| 02:59 | vmarcinko | im so noob in clojure so i dunno a lot if it |
| 02:59 | TEttinger | not guaranteed to not be in the data is all |
| 02:59 | TEttinger | symbols aren't either i guess |
| 02:59 | TEttinger | there's qualified symbols, which are unique |
| 03:00 | TEttinger | ,#'clojure.core/map |
| 03:00 | clojurebot | #'clojure.core/map |
| 03:03 | vmarcinko | and what about exposing just special-type factory functions, so that one just does: |
| 03:03 | vmarcinko | [1 2 3 (mylib/create-type arg1 arg2) 4 5] |
| 03:04 | vmarcinko | so that picked data structure is kind of hidden, lib user just uses fucntion to create it |
| 03:04 | vmarcinko | 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 |
| 03:16 | bitemyapp | marcopolo2: of course I am using macroexpand-1 |
| 03: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. |
| 03:19 | akurilin | Anybody here got experience with web payment services? I'm thinking Stripe + the Stripe wrappers like Chargebee etc? |
| 03:20 | akurilin | Does one of them suck less than the others? |
| 03:26 | bitemyapp | akurilin: Stripe is a good idea. |
| 03: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. |
| 03:33 | akurilin | but tbh I still have to do my research into the various differences |
| 03:34 | bitemyapp | akurilin: a more managed solution than Stripe? o_O |
| 03:45 | dcunit3d | I'm running into problems writing to a BufferedImage: https://gist.github.com/dcunited001/23787c87cb8b34de264a |
| 03:48 | dcunit3d | i'm getting this error: No matching method found: setPixels for class sun.awt.image.ByteInterleavedRaster |
| 03: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. |
| 03: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) |
| 03:50 | dcunit3d | 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. |
| 03: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 |
| 03:51 | dcunit3d | for example, i could easily use .setPixel, which is apparently 2 orders of magnitude slower than working with the pixels array directly |
| 03:52 | namccarty | yeah, that is what i wound up doing in my application |
| 03:53 | namccarty | what you could try doing is creating your own raster, then using setData() on buffered image to write it |
| 03:53 | namccarty | im looking into it but that is all i have come up with so far |
| 03:54 | dcunit3d | thanks, i'll try using that |
| 03:54 | opqdonut | dcunit3d: the problem is that clojure doesn't know those are ints (instead of e.g. Longs) |
| 03:54 | opqdonut | dcunit3d: try (.setPixels (int 0) (int 0) (int sizex) (int sizey) data) |
| 03:54 | opqdonut | (and (int data)) |
| 03:54 | dcunit3d | k |
| 03:55 | dcunit3d | if the last on is an int[] array, how do i typecast that?) |
| 03:55 | opqdonut | yeah, I just realized |
| 03:55 | opqdonut | actually, now that I look at the other setPixels methods |
| 03:56 | opqdonut | from WriteableRaster |
| 03:56 | opqdonut | it should be enough to hint the data as |
| 03:56 | opqdonut | ^ints |
| 03:56 | namccarty | umm, you could also try making sure that you are creating the array using int-array |
| 03:57 | opqdonut | that too |
| 03:57 | opqdonut | of course you can have data be a sequence and convert it to an int array with int-array inside digit-image |
| 03:57 | namccarty | either way works just the same |
| 03:58 | dcunit3d | cool, trying it out |
| 03: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" |
| 03:59 | opqdonut | oh, right, you had a "No matching method found" instead |
| 04:02 | dcunit3d | learning clojure is really my first foray into java programming since 2005 lol |
| 04:03 | namccarty | personally, ive got a lot of experience on the jvm, in functional programming, and in lisp |
| 04:03 | namccarty | but am still new at the three put together |
| 04:03 | dcunit3d | i think i have 75 tabs open lol |
| 04: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 |
| 04:04 | namccarty | and by wall i mean 4 |
| 04:04 | dcunit3d | lol nice |
| 04:04 | namccarty | i think ive gone well past 100 tabs before |
| 04:04 | TEttinger | 300 in firefox |
| 04:05 | TEttinger | chrome can't handle as many |
| 04:05 | dcunit3d | lol omg |
| 04:05 | dcunit3d | i know, i've been thinking about switching to firefox bc of memory. |
| 04:06 | TEttinger | so I'm trying to figure out a macro ns shenanigans thing |
| 04:06 | dcunit3d | i have instances of chrome setup for email, github, docs and localhost apps. then hotkeys to switch between them |
| 04:06 | namccarty | ive got about the same |
| 04: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. |
| 04:07 | namccarty | plus one more for the gitlab for my work projects |
| 04:07 | TEttinger | https://github.com/Prismatic/hiphip/issues/1 |
| 04:07 | TEttinger | hm maybe I could do it with ^:dynamic |
| 04:12 | dcunit3d | hmm i'm running into this message when using ^int type hints: "Only long and double primitives are supported" |
| 04:14 | dcunit3d | hiphip looks cool |
| 04:14 | namccarty | hmm |
| 04:15 | namccarty | instead of using type hints, maybe try wrapping them in calls to int? |
| 04:16 | namccarty | that being, wrap them in (int your-stuff-here) |
| 04:16 | namccarty | right where you call setpixels |
| 04:17 | namccarty | see what that does |
| 04:17 | amalloy | dcunit3d: functions can't take primitive ints as arguments |
| 04:18 | dcunit3d | i'm trying to call a java method that takes (int,int,int,int,int[]) |
| 04:19 | namccarty | dcunit3d: try what i said with the wrapping them in calls to int, like (.setPixels 0 0 (int sizex) (int sizey) data) |
| 04:19 | namccarty | im not 100% on if that will work |
| 04:19 | namccarty | but worth a shot |
| 04:19 | dcunit3d | k, trying that |
| 04:19 | dcunit3d | thanks namccarty |
| 04:20 | namccarty | did it work? |
| 04:20 | dcunit3d | one sec |
| 04:21 | dcunit3d | no, but i'm trying to wrap data as (int-array data) |
| 04:22 | namccarty | hold on, let me load up the repl |
| 04:23 | namccarty | we are going to get this working |
| 04:23 | chare | I am making progress on reading opengl book |
| 04:23 | chare | got to here http://www.arcsynthesis.org/gltut/Positioning/Tut06%20Translation.html |
| 04:24 | chare | you guys mad? |
| 04: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 |
| 04:24 | chare | what code you talking about |
| 04:25 | namccarty | the code he cant figure out how to get to work |
| 04:26 | chare | whic his |
| 04:26 | namccarty | the code he is working on pushing to github right now |
| 04:26 | dcunit3d | https://github.com/dcunited001/handwritten-digits |
| 04:27 | dcunit3d | thanks again namccarty |
| 04:27 | namccarty | no problem, just trying to work back the karma from when someone helped me eairler |
| 04:27 | utkarsh | ,(def q 10) `(~q ~'r ~'n) |
| 04:27 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 04:27 | chare | oh dcunit3d is that guy who can't get images working |
| 04: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. |
| 04:28 | utkarsh | nvm, how can I make this expression simpler: `(~q ~'r ~'n) ? |
| 04: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 |
| 04:29 | dcunit3d | namccarty: once you clone, you should just be able to `lein deps` and `lein run` |
| 04:30 | namccarty | getting the deps now |
| 04:32 | utkarsh | hmm, (list q 'r 'n) works.. |
| 04:34 | dcunit3d | namccarty: i'm writing a quick test for draw.clj that won't require the JFreeChart |
| 04:35 | namccarty | dcunit3d: does the error you are getting show up when the main function is called? |
| 04:36 | dcunit3d | yeh |
| 04:36 | namccarty | only error im getting is a class cast exception |
| 04:36 | dcunit3d | currently "clojure.lang.PersistentVector cannot be cast to java.lang.Number" |
| 04:36 | namccarty | yeah that is it |
| 04:37 | namccarty | are you sure your example is handing it the arguements in the right order? |
| 04:38 | namccarty | no, thats not it |
| 04:39 | namccarty | alright, this is strange, all the arguements are what they are supposed to be |
| 04:39 | namccarty | a vector, an int and an int |
| 04:40 | dcunit3d | i think so |
| 04:41 | namccarty | wait |
| 04:41 | namccarty | there are parens there |
| 04:41 | namccarty | your vector is wrapped in a list or a seq or something |
| 04:42 | namccarty | i think |
| 04:43 | dcunit3d | that might be right, i just pushed up a test for draw/digit-image |
| 04:43 | dcunit3d | no assertions, but i'm not getting the error when i directly specify the vector. so that must be the problem |
| 04:44 | namccarty | Its looking like data is wrapped in a lazy seq |
| 04:46 | namccarty | alright, unrapping that using first moves the error |
| 04:46 | namccarty | trying something, I think ive got it |
| 04:46 | dcunit3d | i'm doing (head images) instead of (first images) |
| 04:47 | namccarty | and now i somehow managed to blow up emacs |
| 04:47 | namccarty | that doesnt even make sense |
| 04:48 | namccarty | yeah, staying inside draw.clj, when i unwrap that lazy seq the error shifts to a no matching constructor for buffered image |
| 04: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. |
| 04:52 | namccarty | alright, i think ive got it working |
| 04:53 | namccarty | let me just test that |
| 04:54 | namccarty | holy balls that worked |
| 04:54 | dcunit3d | for real? |
| 04:54 | dcunit3d | what'd you do? |
| 04:54 | namccarty | ive only modified digit-image, let me paste it |
| 04:55 | namccarty | http://pastebin.com/sbrXPme5 |
| 04:55 | namccarty | that executes with no errors |
| 04:56 | namccarty | if you have fixed the lazy seq thing else where, remove the call to first |
| 04:56 | dcunit3d | k |
| 04:57 | namccarty | that was just there to pull the vector out of the lazy seq |
| 05:01 | dcunit3d | awesome! |
| 05:01 | namccarty | looks like its drawing correctly |
| 05:01 | dcunit3d | i haven't been able to get it to draw yet |
| 05:01 | namccarty | added a piece of code to dump the image you were making to a file, and it looks roughly like a letter |
| 05:02 | namccarty | http://puu.sh/4IT0p.png |
| 05:02 | namccarty | that is the image that is getting made |
| 05:02 | dcunit3d | k, i was just trying to view the data on the chart, but i think i have some different issues with JFreeChart |
| 05:02 | namccarty | well, at least the code that actually makes the image appears to be working |
| 05:02 | dcunit3d | might also have some encoding issues, but maybe not, that pic looks correct |
| 05:03 | dcunit3d | this is great! |
| 05:03 | namccarty | looks like it |
| 05:03 | dcunit3d | with the awt bufferedimage, i can use either JFreeChart or Swing. |
| 05:04 | dcunit3d | looks like i might need to set up swing |
| 05:04 | dcunit3d | thanks again :) |
| 05:04 | namccarty | no problem |
| 05:30 | TEttinger | wolfes, are you Jason Wolfe? |
| 05:50 | sm0ke | how do i pretty print a map? |
| 06:01 | dcunit3d | namccarty: i'm gettin closur https://raw.github.com/dcunited001/handwritten-digits/master/100digits.png |
| 06:02 | namccarty | apparently i forgot how to use a keyboard typing that |
| 06:11 | jimrthy | sm0ke: pprint |
| 07:23 | piranha | is there a better idiom for (or (:one data) (:two data) (:three data)) ? |
| 07:26 | TEttinger | does ##({:one 1 :two 2} :one) do what I think it does... |
| 07:26 | lazybot | ⇒ 1 |
| 07:26 | opqdonut | ,(some {:a 1 :two 2 :three 3} [:one :two :three]) |
| 07:26 | clojurebot | 2 |
| 07:26 | opqdonut | how about that? |
| 07:26 | TEttinger | ,(some {:a 1 :two 5 :three 7} [:one :two :three]) |
| 07:26 | clojurebot | 5 |
| 07:27 | TEttinger | uh, it seems to be fetching the first hm |
| 07:27 | opqdonut | obviously |
| 07:27 | opqdonut | ,(doc some) |
| 07: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)" |
| 07:27 | TEttinger | it could have been saying how many matched I thought |
| 07:27 | opqdonut | right |
| 07:29 | opqdonut | but using some gives you the same laziness as using or: it stops when the first match is found |
| 07:30 | piranha | opqdonut: not bad |
| 07:31 | piranha | exactly what I need :) ##(some {:class-name "test" :className "qwe"} [:class-name :className :class]) |
| 07:31 | lazybot | ⇒ "test" |
| 07: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? |
| 07:32 | opqdonut | Mendor|scr: conj does that for lists |
| 07:32 | opqdonut | ,(conj (list 1 2 3) :a) |
| 07:32 | clojurebot | (:a 1 2 3) |
| 07:33 | Mendor|scr | opqdonut: thanks |
| 07:33 | opqdonut | for vectors conj appends: |
| 07:33 | opqdonut | ,(conj [1 2 3] :a) |
| 07:33 | clojurebot | [1 2 3 :a] |
| 08: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/ |
| 09: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: |
| 09:06 | klrr_ | CompilerException java.lang.RuntimeException: Unable to resolve symbol: connect in this context, compiling:(tob/core.clj:4) |
| 09:06 | klrr_ | any ideas what's wrong? |
| 09:06 | klrr_ | (also, code is from here: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/ ) |
| 09:10 | ambrosebs | klrr_: (:require [tob.irc :refer [connect]]) |
| 09:11 | klrr_ | ambrosebs: i get same error |
| 09:11 | klrr_ | i think the problem is that i use def, if i use defn it's not evauated before its needed |
| 09:12 | klrr_ | damn same error even with defn |
| 09:13 | ambrosebs | klrr_: tried restarting your REPL? that should work |
| 09:13 | ambrosebs | you should get a new error now |
| 09:13 | ambrosebs | complaining about login |
| 09:14 | klrr_ | CompilerException java.lang.RuntimeException: Unable to resolve symbol: connect in this context, compiling:(tob/core.clj:4) |
| 09:14 | klrr_ | same error |
| 09:14 | klrr_ | 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:15 | klrr_ | connect doesnt return a ref |
| 09:15 | klrr_ | it returns unpure side effects |
| 09:15 | klrr_ | and start printing random stuff |
| 09:16 | ambrosebs | klrr_: it's implied he's using connect in the same namespace |
| 09:16 | klrr_ | eh? ok |
| 09:17 | klrr_ | i just put everything in core.clj then? |
| 09:17 | ambrosebs | klrr_: sure |
| 09:17 | klrr_ | now i get this error |
| 09:17 | klrr_ | CompilerException java.lang.RuntimeException: Unable to resolve symbol: codetalk in this context, compiling:(tob/core.clj:39) |
| 09:18 | ambrosebs | klrr_: do you understand how require/refer works? |
| 09:18 | klrr_ | https://gist.github.com/anonymous/13c7da60603ffd1b0994 |
| 09:18 | klrr_ | i dont know anything im just trying to get the code working so i can start read it and learn how it works |
| 09:19 | klrr_ | i presumed i could just copy paste it in a leiningen project and it would work... |
| 09:19 | ambrosebs | klrr_: it should, you are adding extra code. Should only be one ns form |
| 09:19 | klrr_ | ups |
| 09:19 | ambrosebs | klrr_: it's worth figuring out how clojure namespaces work, see http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols |
| 09:20 | ambrosebs | klrr_: once you get it, it's easy |
| 09:20 | klrr_ | hmm now it compiles |
| 09:20 | klrr_ | but the bot doesnt connect xD |
| 09:21 | klrr_ | 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:21 | ambrosebs | that's not my area ;) |
| 09:22 | klrr_ | ambrosebs: thanks for help :) |
| 09:22 | ambrosebs | klrr_: good luck :) |
| 10:05 | ambrosebs | in what situation would reduced? be useful? |
| 10:05 | ambrosebs | 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 | joegallo | ;) |
| 11:42 | joegallo | which is to say, just ask the question you want to ask... |
| 11:44 | sm0ke | joegallo: oh sorry |
| 11:44 | sm0ke | 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 | joegallo | ah, i guess they're talking about the pre-2.0 rcs |
| 11:48 | joegallo | 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 | sm0ke | who reads documentation? |
| 11:50 | sm0ke | crap man after writing one week of clojure..i find myself parenthesizing everything in my scala code |
| 11:51 | sm0ke | eh..lisp is like vim when it comes to habits |
| 11:51 | indigo | Or the usual |
| 11:51 | indigo | "I wish this language had macros" |
| 11:51 | sm0ke | indigo: :( i dont do macors .. yet |
| 11:52 | sm0ke | 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 | sm0ke | but still i havent touched macros but it found writing in scala immensly better than scala |
| 11:54 | sm0ke | 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 | sm0ke | for learining it you just need to know maps |
| 11:56 | sm0ke | 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 | sm0ke | 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 | llasram | sm0ke: Also, it's only slower right now because no one has spent time making it fast :-) |
| 12:00 | llasram | 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 | dnolen | 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 | sm0ke | dnolen: you mean guards? |
| 12:05 | dnolen | sm0ke: no |
| 12:06 | dnolen | 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 | sm0ke | 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 | dnolen | 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 | jonasen | 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: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 | vmarcinko | so, my question is what is preferred way in clojrue to define that special type |
| 13:28 | vmarcinko | i can make it in few ways |
| 13:28 | vmarcinko | Using namespaced keyword marking special type: |
| 13:28 | vmarcinko | [1 2 3 [:mylib/specialtype mytaparg1 mytypearg2] 6 7]] |
| 13:29 | vmarcinko | Using factory function to create special type |
| 13:29 | vmarcinko | (regardless what data structure is used under the hood although it can be seen if printed after fn evaluation) |
| 13:29 | vmarcinko | [1 2 3 (mylib/create-specialtype mytypearg1 mytypearg2) 6 7]] |
| 13:29 | vmarcinko | Using records: |
| 13:29 | vmarcinko | [1 2 3 (->mylib/SpecialType mytypearg1 mytypearg2) 6 7]] |
| 13:29 | vmarcinko | Or maybe special reader tag? |
| 13:29 | vmarcinko | [1 2 3 #mylib/SpecialType (mytypearg1 mytypearg2) 6 7]] |
| 13:29 | vmarcinko | 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 | xeqi | ibdknox: they should be back up with metadata showing them |
| 14:11 | xeqi | 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 | jonasen | ^^ 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 | dnolen | 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 | xeqi | 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 | dnolen | 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 | dobry-den | check out https://github.com/leonardoborges/bouncer |
| 15:16 | dobry-den | `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 | jonasen | ? |
| 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 | algernon | 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 | jonasen | 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 | dnolen | 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 | zachoakes | 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 | joegallo | anyway, i suppose you could do all your importing at runtime using Class/forName |
| 16:38 | joegallo | 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 | gfredericks | does conch let me set the subprocess's working directory somehow? |
| 17:09 | gfredericks | yes it does. |
| 17:21 | bbloom | anybody know what's the difference between hash and hasheq in the clojure code? |
| 17:21 | bbloom | 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 | gfredericks | 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 | gfredericks | 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 | ghadi_shayban | 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 | ghadi_shayban | which one? |
| 17:34 | technomancy | jmdns: https://github.com/Seajure/cabeza-de-vaca/blob/master/src/cabeza/de/vaca.clj |
| 17:34 | technomancy | 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 | bbloom | if(f == null) //hmmm... pop of empty queue -> empty queue? |
| 17:36 | gfredericks | is anything else poppable? |
| 17:36 | bbloom | return this; |
| 17:36 | bbloom | //throw new IllegalStateException("popping empty queue"); |
| 17:36 | bbloom | 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 | bbloom | singleton false *instance* i mean |
| 17:42 | bbloom | ,(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 | bbloom | (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 | bbloom | &(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 | bbloom | (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 | bbloom | notice* logical true |
| 17:46 | rurumate_ | hmm |
| 17:47 | bbloom | i'm not claiming it's documented super well |
| 17:47 | bbloom | but it is documented… modulo the (Boolean. false) edge case |
| 17:47 | bbloom | being not-confusing to java programmers isn't a goal of clojure :-) |
| 17:48 | rurumate_ | well for me, it is a goal |
| 17:48 | rurumate_ | at least the docs can get updated |
| 17:49 | rurumate_ | 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 | bbloom | 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 | bbloom | "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 | rurumate | 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 | bbloom | 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 | bbloom | 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 | bbloom | where's mmarczyk when you need him? :-P |
| 18:17 | gfredericks | bbloom: is this a transient question in particular? |
| 18:17 | bbloom | yeah |
| 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 | bbloom | then when you call persistent!, it sets it to null |
| 18:20 | bbloom | but for some reason it propagates the mutable cell around to nodes |
| 18:20 | bbloom | seemingly only for ensureEditable |
| 18:21 | bbloom | 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:25 | gfredericks | the alternative is to track editability just at the top level of each transient object? |
| 18:25 | gfredericks | rather than paying attention to any given node? |
| 18:26 | bbloom | yeah, so look at PersistentArrayMap |
| 18:26 | bbloom | it's much much simpler (no interior nodes) |
| 18:26 | bbloom | 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 | gfredericks | which seems impossible |
| 18:28 | gfredericks | based on how I assume transients work |
| 18:28 | bbloom | yeah, i considered & rejected that too |
| 18:28 | bbloom | 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 | gfredericks | wait how does persistent! work? |
| 18:30 | bbloom | search for "persistent(" |
| 18:30 | bbloom | 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 | gfredericks | 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 | logic_prog | 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 | bbloom | 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 | logic_prog | given there is no parsing required |
| 18:39 | logic_prog | it's basically persistence for free |
| 18:39 | logic_prog | since most of clojure is "programming with values" anyway |
| 18:40 | bbloom | leverage, baby, leverage |
| 18:40 | bbloom | if that's blowing your mind, then i suggest you read my post carefully and in full :-) |
| 18:44 | logic_prog | bbloom: |
| 18:44 | logic_prog | you're pretty smart |
| 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 | gfredericks | conj the duck-wrapper |
| 19:06 | ToxicFrog | Having a bit of an uberjar problem. |
| 19:06 | ToxicFrog | 'lein run' works fine. |
| 19:07 | ToxicFrog | 'lein uberjar' successfully generates a normal and standalone uberjar. |
| 19:07 | ToxicFrog | 'java -jar uberjar.jar' returns 'could not find or load main class runewords.core' |
| 19:08 | ToxicFrog | Unzipping the jar shows that it has .class files for lots of libraries, but only the .clj for the main class. |
| 19:08 | ToxicFrog | It does have :gen-class. |
| 19:08 | ToxicFrog | What am I missing? |
| 19:08 | gfredericks | an :aot entry in the project.clj? |
| 19:09 | gfredericks | :aot [runewords.core] |
| 19:09 | gfredericks | 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 | ToxicFrog | 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 | gfredericks | 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 | ToxicFrog | 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 | ToxicFrog | gfredericks: the goal is to produce something that people with a JVM (and nothing else) can run by double-clicking on. |
| 19:13 | ToxicFrog | 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 | rurumate | 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 | gfredericks | 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 | ToxicFrog | In the uberjar, it throws a FileNotFoundException: target/uberjar.jar!/filename.html |
| 19:20 | ToxicFrog | 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 | TEttinger | hm. [] and devlib have a type mismatch merging profiles. |
| 19:26 | TEttinger | 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 | TEttinger | "devlib" instead of ["devlib"] |
| 19:33 | TEttinger | 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 | rurumate | 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 | rurumate | the function is easier to define that way, but it is more work and maybe runtime overhead for the caller |
| 19:44 | rurumate | ..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 | rurumate | 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 | shoky | ,((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 | paulsamways | 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 | shoky | 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 | shoky | the apply |
| 20:00 | paulsamways | oh! of course. |
| 20:00 | paulsamways | sorry, all makes sense now. |
| 20:01 | ToxicFrog | This makes no sense! |
| 20:01 | ToxicFrog | 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 | ToxicFrog | 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 | ToxicFrog | vs java -jar target/runewords-0.1.0-SNAPSHOT-standalone.jar I |
| 20:08 | ToxicFrog | 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 | ToxicFrog | So it looks like the output is actually getting cut off. |
| 20:11 | ToxicFrog | 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 | gfredericks | 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 | gfredericks | but yeah you would hope it works that way |
| 20:13 | gfredericks | (.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 | gfredericks | let me know if you figure it out :) |
| 20:14 | gfredericks | the consistent-except-across-recompiles part is really creepy |
| 20:14 | ToxicFrog | Yeah |
| 20:17 | ToxicFrog | 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 | gfredericks | 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 | chare | hello my friends |
| 20:22 | gfredericks | you're write that since you're writing lines it doesn't make sense |
| 20:22 | gfredericks | right* |
| 20:23 | gfredericks | *out* is a new OutputStreamWriter(System.out) |
| 20:25 | gfredericks | 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 | the-kenny | 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 | the-kenny | 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 | ghadi_shayban | github.com/ghadishayban/undersea |
| 20:44 | chare | we need a project to work on |
| 20:44 | chare | 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 | ghadi_shayban | 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 | bbloom | 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 | benkay_ | 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 | benkay_ | 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 | gfredericks | 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 | gfredericks | can't recall if there was something else |
| 21:14 | gfredericks | this is a long grep |
| 21:15 | gfredericks | 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 | gfredericks | ,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 | frozenlock | 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 | TEttinger | nice gfredericks |
| 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 | gfredericks | 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 | Foxboron | 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 | gfredericks | 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 | gfredericks | ,(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 | gfredericks | 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 | coventry | 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 | coventry | 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 | namccarty | 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 | bitemyapp | 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 | bitemyapp | 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 | bitemyapp | 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 | solussd | *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 | namccarty | 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 | bitemyapp | if that gives you any inclination as to what career track looks like |
| 22:46 | namccarty | As am I |
| 22:47 | namccarty | 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 | namccarty | and then cobol happened, but lets just forget about the cobol |
| 22:57 | namccarty | 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 | technomancy | 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 | jagaj | :) |
| 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 | namccarty | 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 | technomancy | the clauses are constant |
| 23:12 | technomancy | maybe you want cond with sets instead of lists of numbers |
| 23:13 | technomancy | (cond color #{0x376AA4 0x85C6E1 0x07305E} :blue ...) |
| 23:13 | technomancy | err |
| 23:13 | technomancy | condp; I think |
| 23:13 | technomancy | 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 | yeoj____ | 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 | coventry | Still, that doesn't answer why it's just returning the second arg, if it's arg is not a map. |
| 23:31 | coventry | *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 |