#clojure logs

2012-06-07

00:10michaelr525guten Morgen!
01:20sergeyhey there
01:20aduhey
01:21sergeydoes everyone use clojure.test for testing?
01:21aperiodicmidje is also popular
01:22sergeyor there are some popular testing frameworks?
01:23aduthat's a good question
01:23aduI wish I knew the answer
01:23aduI've been using clojure for about a day
01:24muhooclojure.test is built in so i use it, it's fast and easy
01:24muhoomidje seems to be more industrial-strength
01:24sergeydid you have any NamingContext problems?
01:25sergeylike when calling tested functions from the test file?
01:25muhoonot sure what you mean. i usually require or use the tested functions in the testing namespace
01:26muhooit's also possible to use the testing stuff from within the source itself, apparently tests are just metadata on regular functions. used that in a few situations too.
01:26sergeymuhoo, how do you require tested namespaces? I use (:require [tested.namespace :as tn]) but I can't call its methods tn/method
01:27muhoothat looks right to me, not sure why it wouldn't work.
01:30johnmn3Would there be any utility in making namespaces that you could pass arguments to?
01:31johnmn3like a function with functions in it, plus namespaces' other characteristics?
01:32muhoomost of the clojure code i've seen seems to use factory functions for that kind of thing, closures
01:32muhoolike (defn foo [params] (fn [args] (make-use-of params args) (do-otherstuff params))) ... etc
01:32gfrederickshey then we could also give them instance variables
02:37ibdknoxamalloy_: Raynes: 4clojure is down
02:48lekuhey technomancy you here?
03:13tomojshould (fn ([x]) ([x y])) be preferred to (fn [x & [y]])
03:24lekuwhat a pita
03:25lekuhttp://thecomputersarewinning.com/post/clojure-heroku-noir-mongo/
03:25lekustill can't get that to work
04:23Lajla&(map + '(1 2 3 4) '( 1 1 1 1))
04:23lazybot⇒ (2 3 4 5)
04:25sergeyhey there, is there any stuff in clojure for testing functions which connect to the db? like fixtures in rails?
04:28brehautsergey: clojure itself doesnt provide anything specific to databases
04:28brehautsergey: comparing rails (a framework) to clojure (a language) is a bit squiffy
04:29brehautsergey: perhaps you should see if clojure.java.jdbc or korma have something like you want
04:29brehaut(assuming you are talking about sql rdbms's)
04:29sergeybrehaut, I have functions which retrive some info from the database
04:30sergeyand I want to test them
04:31brehauti havent used an sql db in clojure in ages
04:32brehautso i cant comment
04:32brehautbut those would be the places to start looking
04:52sergeyhow to test such functions? I mean, I can't just check the results with the hardcoded data from the database
04:54nDuffsergey: just because nobody has implemented a database mocking tool in Clojure yet (if in fact you've investigated the places that were directed to you and determined that nobody has) doesn't mean you can't write one.
04:55nDuffsergey: ...and that's _if_ it's the database layer you're trying to test -- if you were just trying to test the business logic, you could mock the returns from the database layer rather than trying to interact with a real external store at all.
05:09edoloughlinMy Clojure backend project has been dormant for a few months while I've been working on other parts of my app (JS and a Java applet). Today I tried a 'lein upgrade' and 'lein deps' and it can't locate clojure-contrib (I've tried 1.2.1, 1.3.0 and 1.4.0) in clojars or central. Do I no longer specify [org.clojure/clojure-contrib "<version>"] as a dependency? It doesn't work for Clojure versions 1.2.1-1.4.0.
05:12nDuffedoloughlin: clojure-contrib no longer exists as a single package.
05:13nDuffedoloughlin: see http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
05:13bobryis it possible to monkey-patch symbol value in an some other ns?
05:14nDuffbobry: possible? Yes.
05:14bobrynDuff: well, what should I google? :)
05:15nDuffbobry: ...you could look at how clojure.osgi monkeypatches parts of clojure.core, if you wanted a place to start...
05:15bobryyup, thanks!
05:15nDuff(and also an appropriate level of fear/respect)
05:15edoloughlinnDuff: Thanks. What's format for deps in Leiningen? E.g., will "org.clojure/clojure.contrib.sql" work?
05:16nDuffedoloughlin: it's clojure.java.jdbc now
05:18nDuff...not quite sure on the name. org.clojure/java.jdbc maybe?
05:18bobryoops, cljs is missing 'intern' :(
05:19nDufferr, cljs? I missed that context.
05:19edoloughlinnDuff: Thanks. I just picked that as an example. Clojars search only returns what look like 3rd party stuff...
05:20penthiefWhat is the best way (or is it even possible) to step through clojure code with a debugger?
05:20si14nDuff: clojurescript.
05:21nDuffsi14: yes, I know what it means.
05:21nDuffsi14: didn't know it was what bobry was using.
05:21si14nDuff: ah, sorry, missed the word "that".
05:39brehaut~contrib
05:39clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
05:39brehautedoloughlin: ^ thats a good reference for transitioning
05:42sergeyso, I've been googling for a while but haven't found an answer yet - how to test functions which access the database? for example, get-car-by-id which retrieves the car object from the db - how to check all the values of it?
05:43zomgsergey: are you looking for a clojure-specific answer or a general guideline?
05:43sergeyzomg, both would be great :)
05:44sergeyzomg, I know that there are fixtures in Rails that are actually awesome for that but I can't find anything like that in clojure
05:45zomgI don't really know about specifics but I would guess there are libraries whic do that for Java
05:45zomgand as Clojure runs on the JVM, you should be able to use those just fine
05:46antares_sergey: there are various libraries that mimic ActiveRecord's fixtures
05:50sergeyantares_, I'll check them out, thanks
05:52antares_sergey: there are also libraries like https://github.com/michaelklishin/validateur for activemodel-like validations
05:52edoloughlinAnyone know what happened to clojure.contrib.prxml from the old contrib?
05:53brehautit might be in clojure.data.xml ?
05:54edoloughlinThanks. Hope so :(
05:59sorenmacbethhowdy
05:59sorenmacbethis there some weirdness about creating java objects inside a for loop?
06:00brehautsorenmacbeth: depends waht they are doing. for loops create a lazy sequence, so any side effects in the object will be delayed until the sequence is realized
06:00brehautbut otherwise not it should be fine
06:02brehaut,(for [a ["example.com", "google.com"]] (java.net.URL. (str "http://&quot; a))) ;; sorenmacbeth
06:02clojurebot(#<URL http://example.com&gt; #<URL http://google.com&gt;)
06:02sorenmacbethbrehaut: I'm calling a function that creates a java object inside my list comprehesion. that function creates a java object and calls set methods on it. the function works fine outside of the comprehension, inside it, it doesn't set the properties at all
06:03brehautsorenmacbeth: put your function up on refheap.com
06:05sorenmacbethbrehaut: https://www.refheap.com/paste/4fd07b6fe4b0559138cc89a3
06:05brehauthuh
06:06sorenmacbethwhat the for loop returns is the equivalent of just doing (Metrics.)
06:06sorenmacbethas if the doto isn't being called
06:07brehautso you have something like (for [m metrics] (apply mk-metrics m)) ?
06:07brehaut(ridiculously contrived example)
06:07sorenmacbethbrehaut: yeah, something like that
06:08sorenmacbethhttps://www.refheap.com/paste/4fd07c61e4b0559138cc89a4
06:08sorenmacbeththat's the for
06:09brehautthose tuples are a really good case for a map :P
06:10brehautsorenmacbeth: im sorry, i dont know whats going wrong. theres nothing obvious
06:10sorenmacbethbrehaut: yeah, thanks for humoring me
06:10brehautno problem
06:10sorenmacbethbrehaut: how would I use a map there?
06:11brehautinstead of the huge tuple vector,
06:11brehauttuples presumably is full of vectors currently
06:11brehauthow about [{:intent … :entrances … …} …]
06:13sorenmacbethyeah tuples is a vector of vectors
06:13brehautthen either :let [metrics (apply mk-metrics (select-keys tuple [:entrances :pageviews …]))]
06:13brehautor (what i would prefer)
06:13brehautchange mk-metrics to take a map as an argument and destructure it with keys
06:13brehautand then just (map mk-metrics tuples)
06:14sorenmacbethbrehaut: gotcha
06:15brehautsorenmacbeth: just out of curiosity, if you replace your for with doseq and [intent metrics] with (println intent metrics) does it work as expected?
06:17brehaut(expected = prints out intent and the correct metrics)
06:19sorenmacbethbrehaut: nope
06:19brehautits not the lazinessthen
06:21sorenmacbethbrehaut: there are all kinds of nasty layers. that java object is a Thrift object, I'm calling the list comprehension inside a hadoop job, etc etc
06:21sorenmacbethwas just hoping it was something simple I wasn't aware of ;)
08:01sergeyhey there, what's the problem with requiring project namespaces from the test ns? I have NoInitialContextException
08:02ejacksonsergey: shouldn't be a problem with that
08:03sergeyejackson, some functions from the tested ns work fine, some of them throw some NoInitialContextException, given that they work in REPL
08:03ejacksonI don't know what the Exception is, feels like its coming from your code itself, rather than the test harness
08:04ejacksondo you perhaps need to set up some context ?
08:04sergeynope, they are stand-alone functions
08:05sergeythis is weird, I can't find this problem in Google
08:05ejacksoni've never heard of it
08:05ejacksonin the repl have you perhaps loaded some namespaces before the one being tested ?
08:05sergeyno, I've just loaded the namespace itself
08:06sergeyand then I render the functions - works fine
08:06ejacksoncan you paste the ns and its test perhaps ?
08:06ejacksonto refheap.com
08:06sergeyI can give you a link to the so question - http://stackoverflow.com/questions/10925998/error-while-testing-namespaces-in-clojure
08:07ejacksonOK, I don't think you need :refer-clojure
08:08ejacksonwhat does calc.alg look like ?
08:08sergeysimple algebraic functions for testing like plus, minus ...
08:08sergey(defn plus [a b] (+ a b)) ; stuff like that
08:09ejacksontry cut it down to a bare min, no includes, just the one function you're testing and see what happens
08:10ejacksonthe error is coming out of http://docs.oracle.com/javase/1.3/docs/api/javax/naming/package-summary.html
08:10ejacksonany reason you would want to use this ?
08:11ejacksoni dunno, perhaps it comes in via test, but I've never seen it
08:11sergeyI don't
08:11ejacksontry the min ns and lets see
08:11sergeyanyway, thanks for the help, I'm tired of fighting it, I'll return to it later
08:12ejacksonumm, alight then.
08:12ejacksoni'll just go back to doing my own job then :)
08:51solussd_good morning clojurians! anyone going to wwdc?
09:08wilfredhnovice question: why does (Integer/parseInt "123") work but (map Integer/parseInt (list "123")) doesn't?
09:09S11001001wilfredh: because Integer/parseInt is not a function
09:09S11001001it's not even a value
09:09S11001001,(doc memfn)
09:09clojurebot"([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
09:09S11001001I guess that would be less useful
09:09S11001001try #(Integer/parseInt %)
09:10S11001001,list
09:10clojurebot#< clojure.lang.PersistentList$1@6436bef6>
09:10S11001001ok
09:10S11001001,vec
09:10clojurebot#<core$vec clojure.core$vec@40638118>
09:10S11001001,first
09:10clojurebot#<core$first clojure.core$first@5ad7a8a0>
09:10S11001001,Integer/parseInt
09:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)>
09:10S11001001,#(Integer/parseInt %)
09:10clojurebot#<sandbox$eval148$fn__149 sandbox$eval148$fn__149@6c40da0f>
09:12wilfredhperfect, thanks
10:16timvisher_how can I control the proxy used by lein?
10:19vijaykirantimvisher_: http://maven.apache.org/guides/mini/guide-proxies.html
10:20timvisher_vijaykiran: I didn't think that lein used maven anymore. not true?
10:22vijaykirantimvisher_: I think the dependency resolution is done via maven
10:22timvisher_hmm… ok, I'll take your word for it. :)
10:22S11001001such has it always been
10:23timvisher_S11001001: meaning?
10:23vijaykirantimvisher_: let me know if setting proxy in m2 settings works
10:23cemericktimvisher_: lein2 does not use maven at all.
10:24timvisher_it does not
10:24timvisher_cemerick: that's what i thought
10:24timvisher_vijaykiran:* it does not
10:24borkdudeit doesn't use any maven lib or anything at all?
10:24timvisher_cemerick: are you aware of any way to tell lein to use a different proxy than http_proxy is set to?
10:25borkdudeamazing
10:25borkdudeleiningen in leiningen ;)
10:26cemericktimvisher_: Not sure what http_proxy is; it currently uses the proxy defined in system properties (http.proxyHost and http.proxyPort)
10:26Wild_Catis there a Clojure REPL equivalent to Python's dir()? (lists all available symbols in the current namespace)
10:27borkdudeI think dir even exist
10:27vijaykirantimvisher_: :) Just scanned through the code, and it uses Aether
10:27timvisher_cemerick: i believe those default to the environment variables http_proxy and https_proxy
10:27borkdude,(doc dir)
10:27clojurebot"([nsname]); Prints a sorted directory of public vars in a namespace"
10:28borkdudeyoull have to give it a nsname though
10:28timvisher_vijaykiran: know how to configure that? I suppose I can configure my calls to lein to set those system properties via -D directives?
10:28borkdudewhat is the difference in source and sourcery in reply btw
10:29Wild_Catborkdude: nice, but you need a nsname, yeah. What is the "default" namespace in a REPL?
10:29borkdudewild_cat if you start a repl, it is user
10:29Wild_Catthanks
10:29borkdudeWild_Cat (dir user)
10:30Wild_Catcool. Although it doesn't list the builtins. Oh well, I'll live (go cheatsheet go! ;) )
10:30borkdudeWild_Cat the builtins do not live in user
10:31borkdudeyou can do (dir clojure.core) though
10:31borkdudedon't know if that is really useful though
10:32Wild_Catit is. Thanks.
10:32bordatoueonnce i am in REPL using clojure-jack-in mode, how do i know which version of clojure I am running
10:32timvisher_so how would I go about setting http.proxyHost and proxyPort for a call to lein? simply doing `lein -Dhttp.proxyHost=... -Dhttp.proxyPort=...` doesn`t work
10:32borkdudebordatoue: (clojure-version)
10:33bordatouein side repl borkdude
10:33timvisher_could i do it via profiles?
10:33borkdudebordatoue yes, inside a repl
10:33borkdude:-s
10:33cemericktimvisher_: use :jvm-opts in project.clj, or you can set that in a profile
10:33bordatoueis there any way to update clojure to version 1.4 in emacs
10:33bordatoueborkdude: thanks
10:34bordatoueAfter struggling for days I finally managed to install clojure 1.3.0 which is excatly what i don't want I wanted to install the most recent version
10:34borkdudebordatoue you can change it in the project.clj for your project
10:35bordatoueborkdude: i created project.clj file using lein new commands are you refering to project.clj file created using lein
10:35borkdudebordatoue most definitely
10:37timvisher_cemerick: well done, as usual, sir. ^_^
10:38cemericktimvisher_: :-) Having distinct proxy configuration available would be valuable; feel free to open an issue in leiningen.
10:38bordatoueborkdude: i changed to 1.4 in project.clj file but now on starting clojure-jack-in fails with meaningless errors
10:39borkdudebordatoue what version of leiningen are you using
10:39bordatoueborkdude: lein 1.7.1
10:40borkdudebordatoue I think in 1.7 you might have to rerun lein deps
10:40borkdudebordatoue but I don;t know … anyone?
10:42cemerickbordatoue: sounds like you have multiple versions of clojure in your project's lib directory. Yes, in lein 1.x, if you change a dependency version, you need to flush lib (and maybe run `lein deps`).
10:42bordatoueborkdude: do you know how to rerun lein deps
10:43bordatouecemerick: i have only single version of clojure
10:43borkdudebordatoue like cemerick says: empty your lib dir first, then from the cmd line: lein deps
10:44borkdudeor just upgrade to leiningen 2 ;)
10:44bordatoueborkdude: do you people really find this interesting , I couldn't even get started with this language
10:44borkdudebordatoue no I hate this stuff, that's why I'm doing it whenever I can ;P
10:45bordatoueborkdude: nice, there should be more dependencies just for fun
10:45borkdudebordatoue honestly, it is not so difficult if you know how leiningen works
10:46borkdudebordatoue and know what is really is for...
10:47borkdudebordatoue there is no concept of "installing one version of clojure for your entire system" in leiningen
10:47borkdudebordatoue settings are per project
10:48semperosbecause it's "just a jar"
10:48bordatoueall i wanted to do was to try some concurrency programing with clojure, and it seems I am still strugling to get it running
10:48bordatouebtw, how efficient is Clojure compared to Java
10:48borkdudebordatoue if you don't want to get into emacs/swank/slime/leiningen you can also try Eclipse and the counterclockwise plugin
10:49dnolenhmm got another decent CLJS optimization brewing ...
10:49bordatoueis clojure efficient enough compared to Java
10:49mthvedtif you code with performance in mind
10:49dnolenbordatoue: very idiomatic Clojure is slower than Java (but still quite good), however Clojure provides all the constructs to write Java speed code from w/in the language itself.
10:50mthvedti've found idiomatic clojure code is easy to transform into performant code
10:50mthvedtalso
10:51twhumeHello, me again. I'm trying to generate a sequence which corresponds to a breadth-first traversal of an infinitely deep tree. I have some code that works, but once I'm about 10m nodes into the sequence I run out of heap space, which suggests to me that I'm doing it wrong. Can anyone see anything obviously iffy at https://gist.github.com/2889179 ? I spent the morning beating my head against the wall just to get it working...
10:52S11001001and that is to assume that you write the most efficient program possible when writing in java
10:52S11001001which is highly unlikely
10:54S11001001twhume: first I'd drop flatten, then, do you have a tree root in the caller of add-layer?
10:55twhumeS11001001: I'm calling it with (doseq (take 20000000 (add-layer))) to exercise the OOM error
10:55gfredericksthat doesn't look legal
10:55S11001001as gfredericks says
10:55gfredericks,(doseq (take 200 (range)))
10:55clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: doseq requires a vector for its binding in sandbox:>
10:55twhumedoh. sorry - I meant dorun
10:55S11001001but seriously get rid of flatten first
10:56bordatouednolen: I have been trying to learn clojure it is not very intutive either. If the performance is slower than Java then what is the actaul point. Why can't we just use Java
10:56gfredericksbordatoue: why use java when you can use C?
10:56S11001001bordatoue: why use C when you can write assembler?
10:56ejacksonyeah, yeah, butterflies.
10:56dnolenbordatoue: I'll leave that to you figure out. Invest nothing - get nothing ;)
10:56bordatouegfredericks: protablility , hotspot compilation and typesafety .etc..
10:57bordatouednolen: I take your point
10:57gfredericksbordatoue: simplicity mostly
10:57bordatouei wouldn't call clojure simple
10:57gfredericksbordatoue: have you programmed with immutable data structures before?
10:58bordatouewell, i use locks to attain that behaviour
10:58bordatouegfredericks: you talking about concurrency part, if there is an advantage
10:59gfredericksbordatoue: no, just the simplicity you get from not having to worry about a data structure being mutated
10:59gfredericksthe effect is huge
10:59bordatouegfredericks: only when exploting concurrency
11:00dnolenbordatoue: have you read Java Concurrency in Practice?
11:00gfredericksno all the time
11:00bordatouegfredericks: how many applications are written to exploit concurrency
11:00gfredericksbordatoue: it's independent of concurrency
11:01bordatoueif i want to write a simple prototypoe it is going to take ages to get it running in clojure , because of the dependencies to other stuffs such as lein , swank , etc
11:01antares_bordatoue: compared to what?
11:01antares_bordatoue: have you tried it or you are just guessing?
11:01cgagthe immutability is definitely a big benefit even without concurrency imo
11:01antares_I know plenty of people who prototype in Clojure
11:01amalloyso don't use swank. install lein, lein repl, done
11:02_atofor me: less boilerplate, cohesive design, interactive development, expressability/language features (just simple things like lambdas), fun: learning new things
11:02bordatouecgag: I don't know if immutablity is a huge benefit without concurrency
11:02mthvedtbordatoue: not just multi-thread concurrency… being able to have guarantees about data structures makes programming easier
11:02_atoconcurrency doesn't really come into it for me
11:02gfredericksbordatoue: it complements the style of pure functions
11:02dnolenbordatoue: it is - no aliasing.
11:03gfredericksbordatoue: the more of your program you can write as pure functions, the more of it you can test without worrying about state
11:03gfredericksonly input->output
11:03Hodappbordatoue: Managing state and changes to it, even regardless of concurrency, is one of the biggest sources of bugs in existence.
11:03bordatouemthvedt: what compramises gurantee if there is no other process accessing your datastructure
11:03antares_bordatoue: immutability gives you guarantees. You can go from non-concurrent algorithm to a concurrent one typically without or almost without changes.
11:03gfredericksbordatoue: the functions you pass your data structure to could access it
11:04mthvedtbordatoue: you're only thinking about multi-thread concurrency…
11:04antares_bordatoue: look at C, everything may be single threaded and things will mutate your data structure when you least expect it
11:04mthvedtyou can have different code twiddling the same data objects in the same thread
11:04antares_or take a look at Ruby where things are mutated implicitly from libraries you did not know you've loaded
11:04bordatoueantares_: i am not taling C, compare with Java
11:04mthvedtyou won't have race condition bugs, but most types of concurrency bugs are available to single threaded programs
11:04Chousukejava has the same issues
11:04antares_bordatoue: so in java methods you pass data structures to cannot mutate them?
11:05antares_bordatoue: Java Concurrency in Practice has almost an entire chapter dedicated to suggesting otherwise
11:05Chousukeif you have a reference to a data structure, you can never be certain that it will not be mutated by something else unless you know what the entire program is doing
11:05Chousukeif you have a reference to a clojure data structure, it will never change
11:05bordatouewe can prevent mutation of datastructure in java. There are read only datastructure are you talking about persistant datastructure
11:05Chousukethat is guaranteed.
11:06mthvedtso clojure just encourages a style of programming that is immutable by default
11:06antares_bordatoue: most people can't
11:06antares_bordatoue: most libraries don't, most projects end up not doing that
11:06mthvedtif you desire mutability you can use java collections without much effort (discouraged) or atoms/refs
11:06borkdudein Java you have to be explicit about immutability, in Clojure the reverse
11:07bordatoueI bet badly written clojure code will be a nightmare to read
11:07borkdudebordatoue I bet too
11:07HodappI bet badly written code in any language will be a nightmare to read
11:07dnolenbordatoue: there is no language where that is not a problem.
11:07antares_bordatoue: so, what's your point?
11:07antares_are you just arguing that clojure is pointless?
11:07antares_ok, we agree
11:07antares_go ahead and use java or what it is that you like
11:07vijaykiranborkdude: "badly written code will be a nightmare" - FTFY :)
11:07bordatoueyou can't go very wrong with Java
11:07HodappROFL
11:07mthvedtto be fair, i'd rather read bad code in java than in clojure
11:07cgagi suppose i haven't seen bad clojure, but i've been surprised at how well i understand most clojure code i've seen
11:07antares_badly written anything is a nightmare to read
11:08mthvedtat work, we do not let the consultants near clojure :)
11:08Hodapp< bordatoue> you can't go very wrong with Java
11:08dnolenbordatoue: that doesn't compute.
11:08antares_bordatoue: really? how about Java EE?
11:08Hodappthat is just... that is classic
11:08amalloycgag: i have written some pretty bad clojure you would be unable to read :P
11:08HodappIs that like "No one ever got fired for buying IBM"?
11:08gfrederickscgag: a function that creates a local atom, punches it repeatedly, then derefs and returns
11:08HodappOr is it more like "All of the sharp parts have been filed down so you can't hurt yourself"
11:09antares_some of the worst code I have seen in my life was in Java (some of the best, too, by the way)
11:09dnolencgag: you can go very wrong in Clojure - it's painful to watch people go through macro craziness.
11:09borkdudebordatoue you can't go wrong with Java… it depends on your definition of wrong or your religious / philosophical world view
11:09antares_in general, the argument that "dumbed down languages are safe" does not fly in practice. No language is safe if you have idiots or careless people on the team.
11:10borkdudeRich isn't very zen about it
11:10borkdude;)
11:10mthvedtit's a matter of degree
11:10matthavenermthvedt: i think one of the premises of FP is that even if the code is really bad, at least you can guarantee it has no side effects. so no matter how crazy some "fn" is, as long as you understand the in and out you don't have to understand the internals :)
11:10dnolenbordatoue: Clojure is not some magic fairy dust that will make all programs better. However it is designed with two decades of OO programming experience in C++, Java, C# in mind.
11:11mthvedtmatthavener: i work with both java and clojure at work… even though bad java code is a nightmare, the tooling to trace through the spaghetti is very good
11:11Hodappantares_: You misunderstand what "safe" means there. It doesn't mean they're safe in the sense of having safe programs. It means that when your idiot pointy-haired boss chooses it and then a catastrophe results, no one will ever blame him because "industry told me to use it".
11:11Hodappantares_: They are, thus, 'safe' choices.
11:12mthvedta lot of the industry around java is all about mitigating the effect of bad programmers on big business IT
11:12bordatouednolen: I still don't see the hype in this language, compared to Lisp, Python, Java
11:12antares_Hodapp: possibly. In that case, I agree. But not everybody chooses technologies for that reason, thankfully :)
11:12borkdudebordatoue what hype?
11:12cgagdnolen: ok yeah, macros trip me up, but I'm enough of a noob that I can't really tell macro craziness from regular macros
11:12dnolenbordatoue: but you don't know Clojure so I'm not sure what your basing your opinions on.
11:12antares_bordatoue: so, what Lisp has more momentum in Clojure?
11:12antares_borkdude: and why the hell should anyone care about hype?
11:12VinzentWell, bad code is easier to write in clojure than in java. Clojure, unlike java, doesn't have well established best practices, patterns, etc
11:12antares_for hype, use node.js
11:13bordatouednolen: I don't know Clojure because it is hard, it has lots of dependencies
11:13ChousukeVinzent: I don't think that's true
11:13antares_bordatoue: do you mind answering my question?
11:13antares_bordatoue: what other Lisp has "hype"?
11:13twhumeS11001001: I'm working on removing that flatten (just straight taking it out causes everything to break). Why's flatten a bad thing here, tho?
11:13borkdudebordatoue what dependencies do you mean, the JVM?
11:13Chousukevinzent: Clojure encourages better code
11:13bordatouednolen: for example I am trying to get doc function running on SLIME
11:13S11001001,(doc flatten)
11:13clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence."
11:13S11001001dammit
11:14antares_S11001001: it was supposed to miserably fail to stress bordatoue's point
11:14dnolenbordatoue: are you an Emacs user? Did you try some of the other environments?
11:14antares_S11001001: what did you do
11:14twhumesure… so why would that cause problems here?
11:14Chousukevinzent: in Java, it's easy to shoot yourself in the foot if you don't think about what you're doing.
11:14Chousukevinzent: clojure kind of forces you to think, so that's less of an issue
11:14S11001001twhume: it's the nesting that's an issue; you probably want mapcat instead of map
11:14twhumeah, thanks
11:15twhumeyep, that was it.
11:15S11001001antares_: ?
11:15bordatouednolen: I tried eclipse with clojure plugin, the problem there was I did not know how to create a binary distribution
11:15S11001001let me see
11:15S11001001flatten?
11:15clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
11:15antares_bordatoue: so, what Lisp has more momentum than Clojure?
11:15S11001001twhume: that's what I was looking for :)
11:15VinzentChousuke, I agree that clojure forces you to think and structure your code well, but my point is not about it. In java, any novice programmer gets a ton of "how to write things right" information, in clojure (as in any other lisp) there is much more freedom
11:15antares_S11001001: just ignore me :)
11:16dnolenbordatoue: binary distribution for who, for what? Are you trying to learn the language or deploy apps right now?
11:16cgagantares_: i took his use of hype to mean more just reasons to use it over those
11:16ChousukeVinzent: I suppose. Clojure is very opinionated though.
11:16antares_cgag: let bordatoue answer for himself
11:16bordatoueantares_: I don't find the point of learning something slower than Java because it embraces immutability
11:16antares_bordatoue: dude this is not what I was asking you
11:16mthvedtheaddesk
11:16ChousukeVinzent: you're only given immutable data structures to start with so even newbies are forced to use them
11:16mthvedtperformance doesn't matter for 99% of applications anymore
11:16antares_bordatoue: what Lisp has more momentum than Clojure (you listed it next to Java and Python)?
11:16mthvedtbits are cheaper than neurons
11:17bordatouednolen: tell me how do i create a simple binary distribution in clojure using eclipse with clojure plugin
11:17antares_bordatoue: is Python worth learning because it is faster than Java?
11:17borkdudebordatoue do you mean a standalone jar?
11:17antares_bordatoue: how fast do you need to go? did you benchmark or just trying to reach Web Scale™?
11:17dnolenbordatoue: same as Java
11:17borkdudebordatoue "lein uberjar"
11:17bordatoueantares_: python is good to write prototypes and to prove certain concepts
11:18dnolenbordatoue: define a main entry point. make a jar.
11:18antares_bordatoue: ok, cool, what Lisp has more momentum?
11:18VinzentChousuke, yeah, but I'm talking more of design or something like that. E.g. in java if I want to have Person, I'd create a bean. In clojure, I can use a map or a record, I have to create factory function by myself, etc
11:18antares_bordatoue: I am afraid you are just throwing words around
11:18antares_bordatoue: so please explain yourself
11:18twhumeS11001001: hmm, but the OOM issue still persists. Any other ideas?
11:18VinzentChousuke, so in java there is no questions - I know what's the right thing. That's not true for clojure
11:19dnolenbordatoue: plenty of people in here are familiar and even like Python, Common Lisp, Scheme and Java - so I'm not sure where you're going with this.
11:20antares_bordatoue: I have several Clojure libraries that are within 2% in performance with their Java counterparts. They are deployed with all other dependencies in a single jar. I did not have to do much for it, tooling packages said jar for me. How is that "a huge dependency" or "slower"?
11:20S11001001twhume: change add-layer to (concat n (lazy-seq (add-layer (mapcat get-children n))))
11:21antares_bordatoue: also, I am still waiting for the answer about that mythical Lisp with a lot of "hype" (whatever that means)
11:21twhumegiving that a go...
11:22Hodappantares_: within 2%, interesting...
11:22twhumeWhilst that's running… how does moving the lazy-seq to the right of that expression improve things?
11:24antares_Hodapp: obviously it's not like that for every single library or workload. But it's not impossible, hotspot can do pretty impressive things with reasonable code.
11:24S11001001it's more moving it to the left rather than the right
11:25bordatoueyeah hotspot does it for you
11:26S11001001oh, also, `iterate' will make this function simpler
11:26twhumeAh, still get a OutOfMemoryError Java heap space java.lang.AbstractStringBuilder.<init> (AbstractStringBuilder.java:45)
11:27twhumeI'm very much a beginner, but am seeing a familiar pattern of "beat head against desk for a day, find a clojure function which does most of the work already"… will look at iterate.
11:27S11001001I'd rewrite in terms of iterate, and print one node per iteration to see what they look like
11:28twhumeMind you, if the error is in AbstractStringBuilder that would point to get-children being the problem...
11:28S11001001yes, in your example, your node sizes will keep growing
11:29S11001001or it could just be random flotsam of allocation
11:57twhumeS11001001: Ok, I've had a go at writing it using iterate (passing (defn add-children [n] (mapcat get-children n)) into iterate), and am back at the point where I'm tempted to use flatten again. Now, I'm already mapcatting … any ideas?
11:58semperosthere's update-in and assoc-in, proper way to do dissoc-in ?
11:58S11001001mapcat more often
11:58twhumeheh
11:58S11001001quite serious
11:59S11001001I think your shape will be like (->> [treeroot] (iterate (fn [nodes] (mapcat blahblah))) (apply concat))
12:02twhumeThanks… giving that a go. I'm generally finding that "getting something to work" is OK - but there's a gap in my understanding when it comes to avoiding leaks when the sequence gets huge. Any suggestions for sites or books to learn more about that?
12:02antares_semperos: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L56
12:02S11001001core.clj
12:02S11001001read it, love it
12:02semperosantares_: yeah, I nabbed that from the old contrib source on clojuredocs as well
12:02twhume:)
12:02semperoswasn't sure if there was another idiom I was overlooking, thanks
12:02antares_twhume: Clojure Programming explains lazy sequences very well, in my opinion
12:03twhumeantares_: the o'reilly book?
12:03antares_twhume: right
12:10si14can I emit clojurescript code from clojurescript? compile time would be good enough.
12:10dnolensilven: you cannot.
12:11si14SVG elements want to be scripted with <script> tag inside themselves, so it would be better to be able to put some code in there.
12:13dnolensilven: you could probably easily do some server side generation for the contents of the SVG tags via the CLJS compiler tho.
12:15antares_dnolen: as a clojurescript hacker, do you often see people using CLJS with databases like riak or couchdb? or Google Closure produces too much overhead for those cases?
12:17technomancyI think you can use it with couch already
12:17dnolenantares_: cemerick is interested in that too.
12:17antares_technomancy: sure, my question is how practical it really is for this use case
12:18dnolenantares_: I can't imagine ~120k causing much problems on a modern JS engine server side.
12:18si14dnolen: thanks,
12:18dnolenantares_: the size issue is really about clients.
12:18si14*.
12:18cemerick(cljs support is integrated into clutch these days, FWIW)
12:18antares_dnolen: ~120K is a lot if you want to run a query, for example
12:18dnolenantares_: I meant ~120k of JS.
12:18antares_dnolen: imagine how much higher latency may be if you add 120K to the payload
12:19antares_cemerick: ok, and ~120K is about as much as Google Closure produces on average?
12:19dnolenantares_: I'm not sure how JS engines are integrated with DBs, but re-evaluating the JS every time doesn't sound efficient to me.
12:19cemerickantares_: nah, much less than that
12:19cemerick40-50k
12:19antares_dnolen: good point. Some (maybe all?) DBs with JS scripting features allow functions to be stored.
12:20dnolenantares_: so non-issue I think.
12:20antares_cemerick: with couch, are views first installed and then used? so you only transfer 50K once?
12:20ystaelnoob question: is there any penalty for using 'apply' to apply a fn with a rest argument to a very long argument sequence, rather than writing the fn to take the sequence as a single argument?
12:20cemerickyes, views are stored. They need to be loaded into the view server (really, just another local process using stdin/out), but that is rare over the long term.
12:21amalloyystael: there is a very small amount of overhead for it
12:21cemerickAnd, dwarfed by the actual data being processed anyway.
12:21ystaelamalloy: constant, or growing with the arg list size?
12:21eggsbyso dnolen you were saying spidermonkey is better than using v8/node for a cljs env?
12:21amalloyconstant
12:21ystaelamalloy: cool, thank you!
12:21dnoleneggsby: hmm? when did I say that?
12:22amalloyystael: it can't grow with the arglist size, since you can apply an infinite argseq :)
12:22eggsbyah, I thought I read it in irc earlier this week
12:22eggsbymaybe i'm imagining things
12:22ystaelamalloy: i have not yet begun to develop my lazy sequence fu :D
12:22dnoleneggsby: node is probably the best environment since it has system integration.
12:22eggsbyok
12:23amalloy&(apply (fn [& args] (nth args 1e5)) (range))
12:23lazybot⇒ 100000
12:24ystaelamalloy: ok, that's pretty cool
12:25antares_cemerick: ok, now I see
12:25semperoslooks like himera is down
12:25hiredman~python
12:25clojurebotpython is ugly
12:27S11001001clojurebot?
12:27clojurebotclojurebot is your name
12:39kaoD_hi
12:39dnolennot sure if there are any CLJS core.logic users but 0.7.5 went out yesterday, works now with CLJS master - possibly 1236 too.
12:40kaoD_can someone clarify EPL for me?
12:40kaoD_I've read it about 4 times and I still don't grasp some parts
12:40kaoD_reading about it online didn't help either
12:41kaoD_in fact, I just want to know what would happen if I GPL my Clojure code
12:44kaoD_I'm not sure if I could distribute JARs for it since GPL and EPL aren't compatible
12:47kaoD_EPL is sort of an LGPL with an added patent clause, am I right?
12:48eggsbyis anyone itc familiar with aleph/wrap-ring-handler ?
12:48amalloyi don't think clojure's EPL matters at all to you in distributing clojure code. you're not distributing clojure (the language), so what impact do its redistribution clauses have?
12:49eggsbyI'm trying to understand how I can use ring's static file serving middleware with my aleph handlers... hm
12:51technomancykaoD_: AFAIU you can't distribute GPL'd code that is "derivative" of EPL'd code
12:51technomancysome interpretations say that if your application can't function without a given piece of code it counts as derivative, but it's never been taken to court
12:52technomancybest to avoid mixing it if there are business concerns at stake
12:52technomancyif you can choose the license for your own code why not use the EPL? it's got copyleft.
12:52kaoD_this isn't business, I'm just curious (or kind of "respectful" for these kind of licenses)
12:53_atoI guess technically you could do GPL with an exception to say that you're not attempting to relicense Clojure as GPL. But then it's not compatible with regular GPL so is pretty pointless
12:53kaoD_well, as I said EPL is sort of an LGPL
12:53kaoD_and I like plain GPL
12:53kaoD_but I like the patents clause in EPL too
12:54technomancyyeah, it's ironic that the patents clause is what makes it GPL-incompatible since the patents clause is important to protect user freedom.
12:54kaoD__ato: you wouldn't need to add that exception, it's implied in the license, but then you couldn't release JARs because it's (technically) a derivative work which mixes EPL and GPL
12:55kaoD_technomancy: well, some would argue that (e.g. BSD)
12:55_atoah of course
12:56AimHereI think for those licenses, the GNU website says something like 'We've nothing against these licenses, but sadly they're GPL-incompatible
12:56kaoD_AimHere: yup, I checked that source too... not really useful
12:56kaoD_because this is a separate piece of code
12:56technomancykaoD_: yes, but even the FSF is supportive of patent clauses; I think that means it's a bug in the GPL's legal language.
12:58kaoD_that's covered by GPLv3, am I right?
12:58AimHereWhen you say 'your Clojure code', do you mean code written in Clojure, or stuff meant to be part of the clojure language?
12:58S11001001license-list should be covering gpl3 now
12:59kaoD_AimHere: meant the language, not the platform
12:59S11001001in the case of EPL, the last paragraph in the license is enough to make it GPL-incompatible, even for 3
12:59AimHereWell in that case, you can license your own code how you like
13:00kaoD_yes, I'm just curious about the implications
13:00kaoD_I can release jar files for Java GPL code
13:00kaoD_but not for Clojure
13:00AimHereWell the implications will just be that of the license and copyright law itself; the license covering the software implementing your language doesn't really matter
13:00kaoD_(or that's what I understand, see my comment about jars above)
13:00kaoD_so it actually DOES matter
13:00_atoyou can for Clojure too can't you as long as you don't include Clojure itself in your jars?
13:01AimHereWell you should be able to release both under the 'mere aggregation' clause, since your GPLed clojure code should just be the input for the EPL'ed platform
13:01AimHereAlso, since there are GPLed Java runtimes out there (like the GNU one) then it's hardly likely to be a derivative work
13:03kaoD__ato, AimHere, read this: http://www.mail-archive.com/clojure@googlegroups.com/msg26420.html
13:03kaoD_specially the macro part, that's actually what changed my mind
13:03kaoD_I thought just like you before I did some research
13:04_atoyep
13:04kaoD_AimHere: could you rephrase your last statement please?
13:04_atoalthough Clojure projects are often distributed non-AOTed and hence don't include the expanded macros
13:04HodappI just spelled "disclosure" as "disclojure" in a work document. I blame all of you.
13:05AimHereWell sometimes if you have a work that doesn't copy another work, it can still be a derivative work - such as if I was to write my own Batman comic, say.
13:05kaoD_AimHere: nope, that's not derivative work
13:05AimHereYes it is
13:05kaoD_you can only copyright implementations, not ideas
13:05kaoD_although you can trademark them
13:05AimHereThis is well covered in case law; writing your own fiction in someone else's universe can very easily be a derivative work
13:06kaoD_this is not fiction
13:06kaoD_see the Google vs. Oracle case
13:06AimHereYes, software is different
13:07AimHereWhat I was saying was that because there are at least two different implementations of the Java runtime with different owners, then anything that runs on the Java runtime can't be a derivative work of either one of them
13:07AimHereThat wasn't covered in Google versus Oracle as far as I understand it but still
13:07kaoD_yes AimHere, I'm talking about the special case of AOTed code
13:08_ato"Sylvester Stallone successfully pursued an action for copyright infringement against Anderson, an author who wrote a proposed script for Rocky IV, by proving that the copyright-protected characters used in the previous Rocky movies were central to the new script"
13:08_atoyuck, I didn't know that
13:08amalloyi think clause (5) is only relevant if the jar you create is AOTed, which is rare-ish. if you just use the jar as a packaging mechanism, then clause (3) is what's relevant: you're just distributing a zip file with your source
13:10amalloyand if you're trying to distribute AOTed versions of your code without including the source, then you're not GPL-compatible anyway, so clojure's EPL doesn't matter
13:10kaoD_amalloy: yep, I'm just curious
13:10kaoD_I've met some libraries which require AOT
13:10technomancyamalloy: you can distribute AOT without source as long as source is available on request
13:10kaoD_ditto
13:11amalloyokay, sure. but that's effectively the same as including sources; clojure's license still doesn't play into it at all
13:11technomancyyeah, a bit nit-picky maybe
13:12AimHereGPL-with-exemption should work here, though?
13:12AimHereTrouble is, you can't marry someone else's GPLed code to yours if you're adding in the EPLed stuff
13:15sergeyis there any practical tutorial for clojure - some kind of guide which leads through all the processes while developing a real product?
13:18technomancythe peepcode kind of does that
13:18technomancydisclaimer: I'm the author
13:19duck1123sergey: Programming Clojure (the book) builds Lancet as part of its text
13:29pbostrom_I occasionally find myself wanting to do some form of this: (get @some-atom :my-key (swap! some-atom :my-key "default-val")), the problem is that the default value function gets evaluated, is there an idiomatic way to do this?
13:29pbostrom_uh, wait, that's not right, let me think about it some more
13:30mebaran151pbostrom_: do you mean assoc there?
13:32pbostrom_(get @some-atom :my-key (let [default "val"] (swap! some-atom assoc :my-key default) default))
13:35mebaran151pbostrom_: you could check out assoc-in to do some of that for you
13:35mebaran151or update-in
13:36mebaran151(update-in @some-atom [:key] get @some-atom :key "default-val")
13:36amalloypbostrom_: that sounds a lot like (:my-key (swap! some-atom update-in [:my-key] #(or % (default))))
13:36mebaran151sorry: I meant what malloy said :/
13:40pbostrom_amalloy: thanks, that looks good
13:47Jayunit100hi guys : i have a vagrant vm setup w/ clojure and open jdk
13:47Jayunit100https://github.com/jayunit100/rudolf_dev
13:48kjellskiCan someone tell my why this is throwing a NullPointerException? ((second (partition 2 [1 +])) (first (partition 2 [1 +])) 100) I would expect 101...
13:49dnolen,(second (partition 2 [1 +]))
13:49clojurebotnil
13:49dnolenkjellski: ^
13:49dnolen,(second (first (partition 2 [1 +])))
13:49clojurebot#<core$_PLUS_ clojure.core$_PLUS_@456457f0>
13:49kjellskidnolen: whyyyyy? ^^ thanks...
13:49dnolenkjellski: think about it
13:50kjellski*feelsdumb*
13:50dnolen,(partition 2 [1 +])
13:50clojurebot((1 #<core$_PLUS_ clojure.core$_PLUS_@456457f0>))
13:50Jayunit100it returns a sinlge list
13:50Jayunit100so there is no 2nd
13:50kjellskidnolen: I got it, in the first place… was just asking myself how I could miss it...
13:51Jayunit100haha
13:52kjellskiJayunit100: only sorta kinda funny if it doesn't happen to you ;)
13:52Jayunit100yup i been there
13:55mrtentjeWhat is the best way in Clojure (with a webnoir project) to throw exceptions from the model to the view?
14:04duck1123mrtentje: there's wrap-stacktrace in ring-devel. It'll display a page containing the ST on error
14:41mrb_bkdnolen: finally got around to watching your predicate dispatch talk, very enjoyable
14:41Hodappmrb_bk: link?
14:41Vinzentby the way, is there some progress on it? :)
14:41mrb_bkhttp://blip.tv/clojure/david-nolen-predicate-dispatch-5953889
14:42dnolenmrb_bk: thanjks!
14:42dnolener thanks I mean
14:42mrb_bkdnolen: yeah man - how did the hacker school gig go
14:42dnolenmrb_bk: that's this Saturday actually.
14:43mrb_bkoh man! my wife's birthday
14:48mrb_bkdnolen: well, good luck this sat then!
14:48timvisher_why do i need slime installed in emacs to run jack in when lein-swank comes with it's own?
14:48dnolenmrb_bk: thanks! will try to put something together that I can use another time.
14:48technomancytimvisher_: you don't?
14:48winkI didn't explicitly install it either
14:49timvisher_technomancy: that's what I thought. except that i'm getting an error in the process filter if i don't have slime installed because it can't find the function slime-connect
14:49timvisher_maybe on old version of clojure-mode?
14:49technomancyit could be the bootstrapped version of slime was truncated somehow
14:50technomancytry rm -rf ~/.emacs.d/swank?
14:50dnolenVinzent: not really, been focusing on CLJS perf & debugging things. But I've been using CLJS core.logic as a benchmark for CLJS perf - when things are in a better place I'm planning on overhauling core.logic & core.match.
14:50timvisher_technomancy: same deal after that
14:51technomancyon a fresh emacs?
14:51timvisher_no slime under elpa...
14:51timvisher_technomancy: yep
14:52timvisher_clojure-mode 1.11.5
14:53timvisher_starter-kit-lisp 2.0.2
14:53technomancysomething has messed up the bootstrapped copy of slime
14:53timvisher_how can i clean that puppy out?
14:53timvisher_delete lein-swank and reinstall?
14:54technomancydepends what "something" is
14:54technomancymaybe there's a cron job that runs sed on every file in ~/.emacs.d or something; that won't help in that case =)
14:54timvisher_i could do a totally fresh emacs
14:55timvisher_as in without my configuration
14:56timvisher_this is what *swank* gives me: https://gist.github.com/2890747
14:56Vinzentdnolen, yeah, I've seen you've done huge amount of work on cljs, thank you for this! Still, me and some other people from local lisp group are waiting forward for the predicate dispatch stuff - I hope you'd have time to do everything planned :)
14:59cgagI wish there was a local lisp/clojure group around here. I feel like I'm too new to start one though.
15:00amalloyi'm pretty sure if you can bring your computer to a coffee shop with a handmade sign that says "clojure meetup", you have all the necessary qualifications
15:00clojurebot/summon rhickey
15:00timvisher_cgag: learn by fire!
15:01amalloyseriously it's not like you have to give lectures at your meetup. the topic every week can be "i'm trying to figure out this clojure thing, anyone think it's cool, maybe we should hang out, also punctuation is hard?"
15:01winklol
15:02technomancyeven if all you know is how to install swank and lein you can solve 75% of newbie questions =)
15:02gfredericksyou do need other people though
15:02cgagI think that's what I'll end up doing if I can find some interested people. I just looked at the NYC clojure group on meetup trying to get some ideas, and I see one of my friends from high school is an organizer... small world.
15:02gfrederickswhich is location-sensitive
15:02winkusergroup, not usersgroup
15:02sh10151where are you?
15:02sh10151cgag: where are you?
15:02cgagkansas city
15:03technomancyisn't that where jimduey is?
15:03gfredericksI think he's nearby
15:03gfredericksin midwestern distances
15:03aduamalloy: heh
15:03cgagmeetup says there are 3 people waiting for a clojure group, and around 20 waiting for one on functional programming
15:03cgagha, midwestern distances
15:04aduanyone here in the DC/MD area?
15:04gfredericksprobably across several states in northeastern distances
15:05plainflavoredcan i go through SICP with clojure, or will i have to adapt the exercises?
15:07aduplainflavored: wait
15:07timvisher_totally fresh emacs (as in a new .emacs.el file) displays the same behavior
15:07aduI'm pretty sure there is a clojure-specific SICP
15:07timvisher_adu: it's nowhere near complete yet
15:07aduplainflavored: http://sicpinclojure.com/
15:08plainflavoredawesome, thank you
15:08aduoh "You should not be here yet." heh
15:08timvisher_still a nicely formatted way to read a lot of it
15:09HodappI do want to go through SICP, whether in Clojure or Scheme or whatever other language. I watched one recent Sussman lecture and would like to see some other things of his
15:09timvisher_Hodapp: are you aware that the whole coures is available online?
15:09Hodapptimvisher_: yes, but this doesn't mean I've yet set aside the time to do it.
15:10dnolenVinzent: predicate dispatch is even more compelling to me now that we have ClojureScript - I'll definitely get to it :)
15:10timvisher_Hodapp: I spent my lunches over a summer going through them. _fantastic_
15:10cgagi've watched a few of those sicp lectures, sussman is great
15:10Hodapptimvisher_: I may try to set something up at the local hackerspace and get a group to go through it
15:10Hodapptimvisher_: does it has exercises and things in it?
15:10Hodapphas? have. argh.
15:12aduthere are things I like about scheme, and things I don't like
15:13aduScheme isn't Huffman
15:13aduI think Clojure is a little more Huffman
15:13cgaghuffman?
15:13Hodapphuffman?
15:14aduhttp://en.wikipedia.org/wiki/Huffman_coding
15:14dnolen_jonasen: querying codebase via Datomic looks need :)
15:14dnolen_I mean neat
15:14Hodappwhat does it mean to describe any language as "Huffman"?
15:14aduI don't remember who first used it as an adjective, but it means commonly used language structures are short, and uncommon language structures are longer
15:15Hodappbut... parenthesis are only one character!
15:15adufor example "def" vs "define"
15:16sh10151adu: sounds like Paul Graham
15:16sh10151related to Huffman coding
15:16cgaghas anyone actually done any analysis on that? it'd be cool to see some sort of break down for different languages
15:16aduand Racket's (current-command-line-arguments) vs (argv)
15:16scottjstring-concatenate vs str
15:16sh10151heh
15:16sh10151Objective-C loses
15:16sh10151flat-out
15:17Hodappsh10151: I think Java would very likely be worse.
15:17sh10151Common Lisp isn't great either, looking at you multiple-value-bind
15:17scottj(concatenate 'string ..) too
15:17jonasendnolen_: It's a fun experiment
15:17HodappI don't have a problem so much with longer names as I do with more complex structures or very complex names.
15:17technomancyelisp should rename let non-destructuring-bind
15:17adush10151: ya, isn't there a CL function that twiddles bits called dqp?
15:17sh10151Hodapp: I don't know Map.get vs NSDictionary objectForKey
15:17sh10151probably counts for a lot just there
15:17technomancyto match remove-if-not =)
15:18Hodappsh10151: FloatFactoryFactory.getInstance(FloatFactoryFactory.defaultInstanceDescriptionString).getFactory(Locale.getLocale("en-US")).createBuilder().setString("1.5").getResult()
15:18scottjtechnomancy: good one
15:18Hodappthe problem there isn't that names are long, it's that there are too damn many names.
15:18timvisher__so if i'm trying to avoid having slime installed because i can use jack-in for that, what do I do for clojure-test-mode, which still requires it?
15:18Hodappadu: It's "Object-Oriented"(tm)!
15:19aduobject oriented brain vomit?
15:19Hodappno, object oriented is something else from "Object-Oriented"(tm)!
15:19dnolen_jonasen: it was actually one of the first things I thought about when I heard about diatomic.
15:20technomancytimvisher__: you can do (eval-after-load 'slime '(require 'clojure-test-mode))
15:20timvisher__technomancy: so install it manually rather than via package?
15:20timvisher__makes sense
15:20dnolen_jonasen: erg, datomic. Would be interesting to store tons of data about a code base - access them directly via indexes and query over that with core.logic too :)
15:21adush10151: http://clhs.lisp.se/Body/f_dpb.htm
15:21mat``having trouble wrapping my brain around FP.. Really how to manage state. I am used to wrapping state in methods.. I am having trouble thinking of much besides passing my state round like you would in C..
15:21aduan example of a short name that's probably used once a century
15:21jonasendnolen_: I'd like to store many (all?) codebases and ask questions like: I'd like to change this var. Who uses it?
15:21sh10151mat``: that's OK, just pass it as a function parameter every time you want it to change
15:22sh10151adu: well, this is the language of car and cdr
15:22dnolen_jonasen: yep, CLJS AST + Datomic would be particularly sweet.
15:22timvisher__interesting, why didn't i get clojure-test-mode.el included in my install from melpa?
15:22dnolen_jonasen: query, transform, unparse
15:23pepijndevos&(let [** (fn ** ([] 1) ([n] n) ([n ex] (apply * (repeat ex n))))] (** 2 3))
15:23lazybot⇒ 8
15:23adush10151: if I were to have named them, I would have called them F and R
15:23pepijndevosWhat is the algorithm for doing that to a fractional exponent?
15:23sh10151head and tail seem OK too
15:24aduthen ff fr rf rr would make sense
15:24sh10151oh, but cadaddr is fun!
15:24sh10151I think destructuring syntax should be the more common way to do that anyway
15:25aduI also like to make puns, like when I'm writing a for loop iterating a linked list, I call the iteration variable 'cur' lol
15:25jimdueycgag: Are you in KC? I'm out south.
15:25mebaran151adu: Math/pow would be your friend, otherwise you're gonna have to use some numerical method to esimate roots
15:25cgagi'm in overland park
15:25mebaran151sorry, that was for pepijndevos
15:26sh10151seems like it should be a large enough metro area to have 5-10 clojure enthusiasts able to meet...
15:26mat``in rich's talk "simple made easy" he suggested using queues to hook compoents together. Is there a good example of this in clojure somewhere?
15:26pepijndevosmebaran151, I know abou the java thing, but I was hoping for something more clojury, using rational numbers.
15:26technomancypulse uses both in-process queues and redis queues
15:26technomancynot that well documented though
15:27mebaran151pepijndevos: rational numbers are different from rational roots
15:27mebaran151you'd probably break the rational number between numerator and denominator
15:28mebaran151take the root of the base with regard to the denominator and then use reduce to multiply them together numerator times
15:28pepijndevosmebaran151, so you'd have to got all the way with symbolic computation and such?
15:28mebaran151pepijndevos: not quite symbolic: you'd have to use a numeric method
15:28mebaran151(probably what Java does under the hood)
15:30pepijndevosmebaran151, but java returns floating point things...
15:30timvisher__technomancy: does it make sense to have clojure-test-mode package-require slime?
15:30timvisher__considering that the push seems to be to have lein-swank manage slime by default?
15:30mebaran151pepijndevos: rational exponents can return irrational numbers
15:31pepijndevosmebaran151, http://richhickey.github.com/clojure-contrib/math-api.html#clojure.contrib.math/expt
15:31lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/math-api.html#clojure.contrib.math/expt and try to stop linking to rich's repo.
15:31technomancytimvisher__: the packages should still be declared
15:31technomancytimvisher__: what would make more sense is to make clojure-test-mode loaded by jack-in too
15:31timvisher__true, true
15:31timvisher__i can always install clojure-test-mode and then delete slime too
15:32technomancy...?
15:32dnolen_ pepijndevos: thoughts on specific things people would like to hear about on Saturday?
15:32technomancyif you're already using package.el why would you go in and delete packages?
15:32mebaran151pepijndevos: if you look at the source, unless the power is an integer, he falls back on Math/pow
15:32timvisher__it seems bad to have multiple slimes on the load-path
15:32timvisher__no?
15:32clojurebotno is tufflax: there was a question somewhere in there, the answer
15:33technomancytimvisher__: jack-in doesn't use the load-path, so it shouldn't matter
15:33timvisher__true i suppose
15:33pepijndevosmebaran151, right :(
15:34mebaran151pepijndevos: were you hoping for an irrational type?
15:34pepijndevosdnolen_, minikanren! haha
15:34pepijndevosmebaran151, dunno
15:34mebaran151anyway, generally, to take a non-integral power, you're going to end up with floating point
15:34timvisher__well, looks like that'll work just fine (everything installed + jack-in)
15:35timvisher__thanks for your help as always
15:35technomancynp
15:35pepijndevosdnolen_, there is at least 4 people doing something logic-ey, and some people doing regular JS and clojure.
15:35dnolen_pepijndevos: heh, I'll talk about it in passing but that's asking for a whole lot of head scratching. my plan was to talk about CLJS compiler for a little bit since probably easier to understand. Then hang out and hack and show people miniKanren that are interested.
15:35pepijndevosonly one guy reading ibdknox's cljs stuff afaik.
15:36jonasendnolen_: Another idea is: With lots of facts about a codebase, is it possible to make a type system?
15:37pepijndevosdnolen_, I have not done to much cljs myself, so I'm not sure what would be good to talk about
15:38pepijndevosdnolen_, there is some interest in writing compilers me thinks
15:40dnolen_jonasen: hmm, create a type system? or do you mean infer types because you have the whole program?
15:41dnolen_pepijndevos: cool, I figured.
15:41pepijndevosdnolen_, for a more representative view of the nterests, you should hop into #hackerschool
15:41dnolen_pepijndevos: cool thanks for the tip
15:42jonasendnolen_: I mean infer.
15:42dnolen_jonasen: yes that would be awesome. Dialyzer like.
15:42jonasenDialyzer?
15:43dnolen_jonasen: http://www.erlang.org/doc/apps/dialyzer/dialyzer_chapter.html
15:43jonasendnolen_: Cool, thanks
15:44dnolen_jonasen: note that Dialyzer can have a Persistent Lookup Table :)
15:46jonasendnolen_: Looks very nice! Is the design or implementation described in a paper somewhere?
15:46timvisher__`{` in paredit at the repl runs self-insert-command, but in regular clojure-mode it works. `[` and `(` work as they should. thoughts?
15:47dnolen_jonasen: I think there are a few papers.
15:47timvisher__the repl also is aware that I sholudn't delete them (`{` and `}`) if there's content in them
15:48dnolen_jonasen: http://user.it.uu.se/~kostis/Papers/succ_types.pdf
15:48jonasendnolen_: http://www.it.uu.se/research/group/hipe/dialyzer
15:48dnolen_jonasen: ooh much better :)
15:53timvisher__ah, it's because the repl doesn't load clojure-mode
15:53timvisher__so i still need to fix paredit at the repl
15:56jedmtnman,(prn "other channels think bots are dumb. Yah #clojure knows whats up")
15:56clojurebot"other channels think bots are dumb. Yah #clojure knows whats up"
15:57borkdude,(println "foo")
15:57clojurebotfoo
15:58lancepantzRAYNES PARTY
16:00bobryis it possible to pass metadata to defmacro? for example: '(defmacro f [& more] more) (f ^:private 1)'?
16:01bobryi would like to have that :private thing available inside 'f'
16:01gtrakdoes this function exist somewhere? I feel like I've reinvented it twice already: https://gist.github.com/2891175
16:01tomoj(defmacro f [x] (meta x))
16:01tomoj(f ^:private {})
16:01tomoj(note 1 can't have metadata)
16:02tomojwhen writing cljs macros do you avoid ` and refer to everything with ns qualified symbols?
16:05tomojoh, no need to avoid ` I guess
16:05dnolen_tomoj: no need to avoid `
16:05tomojjust looked at core.logic's macros as an example
16:05bobrynice, thanks tomoj :)
16:05tomojthought the note about ` not supporting ~ was on the clojure side, which would be absurd..
16:07dnolen_tomoj: I currently fully namespace fns to cljs.core.logic - this may no longer be necessary.
16:07dnolen_tomoj: in the past analysis did not follow namespaces, so maybe this precaution is no longer necessary.
16:07dnolen_namespace dependencies I mean.
16:08tomojhmm
16:08tomojbut macros.clj won't depend on cljs.core.logic, will it?
16:17tomojwouldn't it be theoretically possible to make things which satisfy IFn into actual js functions?
16:17dnolen_tomoj: hmm, not 100% sure, but note that fns like cons, take work - they resolve to cljs.core
16:17tomojah, similarly IFn will resolve to cljs's I guess, neat
16:18dnolen_tomoj: the way satisfies? worked before wouldn't work except as macro - now there can be a satisfies? fn.
16:19tomojprotocols have been reified?
16:19tomojbut I mean that reify and deftype etc could theoretically notice that IFn is being implemented and return an actual js function
16:20dnolen_tomoj: they always were - but the implementation prevented it working except as a macro - we can now use bit masking.
16:20tomojI read "Protocols are not reified as in Clojure, there are no runtime protocol objects"
16:21dnolen_tomoj: yeah, that's old - will probably change soon.
16:22dnolen_tomoj: far as IFn that's kinda how it works now - tho that misses out on some optimizations which we'll get to.
16:23tomojkinda? I get "Property 'foo' of object #<Object> is not a function" with (def ^:export foo [] (reify IFn (-invoke [f])))
16:24tomojs/[]//
16:25dnolen_tomoj: oh, sorry wasn't following closely enough, no we're really going to emit regular JS functions for IFn
16:25dnolen_we're *not* really
16:25tomojit seems like a strange idea anyway, but what problems would it cause?
16:26dnolen_tomoj: slows down multi-arity dispatch.
16:26tomojI see
16:27adudon't you have to revert to using 'arguments' for multiple arity?
16:27dnolen_adu: it's slow
16:27dnolen_adu: and we do use it - just not under advanced compilation.
16:28aduoOo advanced compilation
16:28aduyou would think with all the compilers out there that someone would have made a compiler factory factory by now
16:29amalloyadu: time for yaccc?
16:33aduamalloy: yeah
17:04meahas clojure ever gotten anyone liad
17:04mealaid*
17:06sritchiemea: the answer is no
17:06sritchiemea: it's probably gotten rhickey laid, actually
17:06cgagit seems opssible for hickey
17:06gfredericksthank goodness somebody finally said it
17:06sritchiethat was his motivation, I think, if you read closely on clojure.org
17:11gtrakadding a math guy and a FP guy together you might get one full set of social skills
17:12Hodappgtrak: Most of the math and FP guys I know have no trouble with the whole 'social skills' thing.
17:12meai kissed a girl once
17:12Hodapp9_9
17:12Hodappdid you like it?
17:12meanot really D:
17:13Hodapptry again
17:13Bronsalol
17:15HodappJust remember that people who laugh at someone for not getting laid/kissed/whatever tend to lead pretty empty lives...
17:16gtrakthat's like the opposite of laughing at someone for using php
17:17HodappI said getting laid, not getting fucked.
17:17gtraklol nice
17:19nDuff(...and her ex-wife is a library science major who used to specialize in translating dead languages...)
17:19nDuff(...and she says that brains don't particularly turn her on. *amused*)
17:24gfrederickswhy should I use clojure if I can use TI-BASIC?
17:25gf3Good question.
17:25AimHereYou shouldn't. Do everything in TI-BASIC from now on
17:25gtrakgfredericks: have you heard the good news? a concurrent lisp on the jvm!
17:25gf3EVERYTHING.
17:25gfredericksgtrak: holy jello-wagons
17:26gfredericksbut why is this better than a single-threaded BASIC on the TI-83+?
17:26gfredericksI don't think I'm allowed to bring a JVM to geometry class
17:26gfredericksclearly TI-BASIC is more portable
17:26gtrakabout 3 years of rich hickey's life came and died for our sins
17:29gtrakgfredericks: I wish I knew some C when I had a TI calc, I made a pong game once on the 89
17:29Hodappbeer pong?
17:29gtrakregular
17:29SgeoI hate the JVM
17:29SgeoI mean, hi.
17:29gtrakhaha
17:30gtrakSgeo: where you coming from?
17:30SgeoMostly Haskell, a bit of exposure to Common Lisp, a bit of exposure to Racket
17:30SgeoMore exposure than I'd like to C# :/
17:30SgeoWay too much exposure to LSL
17:30SgeoYears of exposure to Python
17:31SgeoAnd forced to take Java classes in highschool
17:31borkdude$logs
17:33gtrakpython sits halfway between java and clojure for me now, I feel like java needs to exist, and clojure for high-level stuff.
17:33arrdemhey guys, is there something you can point me to that's a "first project" survival guide to stuff like Cojure naming practices?
17:33arrdemkina like the PEPs
17:34pipelinearrdem: that kind of stuff is covered really well in "joy of clojure"
17:34gtrakarrdem: use-hyphens-like-this except for java types (defrecords also), in which case you'd use camel-case
17:34pipelinearrdem: it is not a primer for never-used-lisp-before types but it covers a lot of helpful "what do i do now" bits
17:34arrdempipeline: yaaay! I have a copy behind me, but haven't cracked it yet
17:34Sgeo"needs to exist"
17:36gtrakSgeo: rather, I can see myself coding in it from time to time, I don't think I'll ever drop down to C
17:36gtrakunless I feel like doing some low-latency stuff
17:38gtrakSgeo: last time I tried to use python it felt much more 'awkwarder than clojure' than 'better than java' :-)
17:39gtrakinitially I learned it because of 'better than java'
17:39gfredericksgtrak: I made a snake game with a computer player
17:40gtraknice
17:41gfredericksgtrak: I'd fill up sheets of paper keeping track of what all the variables meant
17:41gtraklol wow
17:41gtrakwhat was it that basic didn't have? functions right?
17:42gfredericksand custom variable names
17:42JorgeBWhere would one go to hire developers with Java and Clojure experience? I assume advertising in #channel is frowned upon.
17:42gfredericksclojure conj
17:42pipelinedepends on who you are, JorgeB
17:42nDuffJorgeB: sponsoring the conj is a good one
17:42pipelineJorgeB: if you are directly employed by the hiring firm, i'm betting you can get away with some pretty shameless advertising
17:42JorgeBI am Legend
17:43JorgeBactually, I am Disney
17:43pipelineif you're a third party recruiter you're gonna find yourself klined if you offend the wrong party haha
17:43JorgeBnot a recruiter. I am the team lead
17:43pipelinewell then
17:43septominare you allowed to have a beard
17:43pipelinehiring managers are allowed to shill haha
17:43JorgeBbeards are encouraged
17:44gtrakthey cut down on UV glare from reflected light off the pale skin
17:45algindoes anyone have some experience with seesaw ?
17:45JorgeBwell, then this is me looking for people who might be interested. Preferably SF Bay Area, but might be flexible.
17:47SgeoAm I more likely to get a job that uses Clojure than I am a job that uses Haskell?
17:48SgeoHmm, what about Common Lisp or a Scheme
17:48technomancydepends on whether you're a professor or not
17:48lekuheh
17:48cgagi'd expect clojure
17:48mebaran151algin: I played with a little
17:48lekunot a lot of Lisp guys, i'd think if you knew some dialect and were good at it, you'd be able to get a job
17:49gtrakSgeo: I think it's more likely to find work at a java shop and successfully sneak it in than getting a Scheme/CL job
17:49cgagJorgeB: do you have a link or anything?
17:49lekuclojure has a lot of momentum right now and a strong community behind it, plus its fun
17:49Sgeogtrak, I don't want to work at a Java shop
17:49gtrakright :-)
17:49SgeoI want to pretend java doesn't exist
17:49technomancyspeaking of which, it's about time for another yearly "State of Clojure" survey soon, isn't it?
17:49lekujava is an integral part of clojure
17:49JorgeBcgag, I have the generic job postings, but I am trying to stack the opportunities for Clojure hackers, let me dig it up
17:49lekuclojure builds upon trhe success of java
17:49technomancySgeo: http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/ has some numbers on Clojure and employment
17:50technomancy35% using it at work as of a year ago
17:50lekuwow
17:50leku62% of pple using it for webdev
17:51JorgeBcgag, send it privately
17:51lekuhey technomancy
17:51ystaelAre the imports introduced in the :imports clause of an ns form in scope for type hints in a [:gen-class :methods] clause on the same ns form?
17:51JorgeBcgag, like I said, it's the generic job req
17:51brehautleku: thats probably tied directly to most people doing web development for most things
17:51lekumy ubuntu->debian adventure was seriuosly misguided
17:51JorgeBcgag, I am the hiring manager
17:51lekunow I am in freebsd hell
17:52technomancymy condolances?
17:52lekulol
17:52lekujust thought i'd share
17:52gtrakleku: lol did you do debian with the bsd kernel?
17:52lekuno
17:52lekui went from ubuntu to debian 6.0.5 then to wheezy
17:52technomancyI used freebsd on the desktop for like six months in university
17:52lekuthey both failed me now i'm trying fbsd
17:52gtrakleku: haha: http://www.debian.org/ports/kfreebsd-gnu/
17:52lekuhow was it techno?
17:53cgagwhat were your problems with debian?
17:53technomancyleku: it was a learning experience.
17:53technomancythe only reason it lasted all of six months was that I had a lot of time on my hands in school.
17:53lekulet me see.. first pple said I _had_ to be using squeeze
17:53lekuwhich wasn't the case, I needed to be on wheezy to make my life eeasier
17:53gtrakyea, debian testing's the only way to go
17:53technomancyleku: why?
17:53borkdudeis removing all contents in the target directory equivalent to "lein clean"?
17:53lekuso that took forever.. then I was seeing artifacts in my Xserver
17:53technomancyborkdude: yeah
17:54lekuthat wouldn't go away
17:54borkdudek\
17:54lekuthat was due to the shitty opensource nvidia drivers debian made me roll with, then I tried the nvidia shit
17:54lekutotally broke my system, can't get back into x
17:54lekutherefor can't get back onto the network cuz gnome does the networking
17:54lekuwouldn't even let me get into a virtual tty
17:55borkdudeman, spaces in file paths are really haunting me, finally found where the filenotfoundexception some of my students had was coming from: https://github.com/ibdknox/noir/issues/36
17:55technomancyyeah, it's always worse if you pick the hardware before the OS
17:55gtrakleku: what was wrong with ubuntu?
17:55technomancyborkdude: same problem as bultitude?
17:55gtrakI think your issue with the nvidia is a bad xorg.conf
17:55lekuwell I ended up installing a ton of stuff and had problems with dependencies, was just easier to reinstall then start backing stuff out
17:55lekuand a lot of pple were telling me how great debian was etc
17:55borkdudetechnomancy similar, I don't know if it is the same, this was smth in ring
17:56borkdudetechnomancy haven't looked into the detail of ring
17:56aduwow Python and Ruby are the largest source of Clojure converts?
17:56lekuit is a fairly new system so I am ok with some trial and error until I find what I like
17:56borkdudetechnomancy https://github.com/weavejester/compojure/issues/46
17:56technomancyif you have hardware that requires proprietary drivers I'd expect both Debian and FreeBSD to be pretty lousy
17:57lekuubuntu is probably the best bet for me
17:57lekuand I expect to end back up with that
17:57technomancyI've forgotten what it's like to have hardware issues since I started sticking with Intel ~5 years ago.
17:58aduI have intel, and hardware issues
17:58aduthe problem is the battery
17:58lekumy requirements are pretty small.. good access to software (emacs24, clojure, lein, swank, heroku, etc.), wireless networking, stumpwm, and stability
17:59gtrakis stump like xmonad?
17:59lekufreebsd ports ha almost everything i need, and fresh ports has the rest
17:59lekuI don't think so
17:59cgagI tried debian but i wasn't really into it.
17:59lekuthey both might be tiling WMs, but I don't think they're similar
17:59cgagI like arch a lot though.
17:59borkdudetechnomancy what version of clojure does leiningen/bultitude use?
17:59lekuI might give arch a go today
17:59technomancygtrak: it's as much like xmonad as possible considering it's implemented in CL
17:59gtrakarchlinux is great, it replaced the role of debian for me
18:00lekustumpwm has been a pretty awesome WM for me so far
18:00gtrakleku: give arch a try definitely, it's really simple and you have to do everything yourself, but the guides are great. it only took me a couple of hours the first time
18:00lekuis it as bad as gentoo?
18:00gtrakway easier
18:00cgagYeah I was really surprised by how good the wiki is.
18:00lekugentoo was miserable
18:00winkarch is a lot easier to handle than gentoo
18:00borkdudetechnomancy I mean, was it before or after this commit that leiningen uses: https://github.com/clojure/clojure/commit/1538d809db22346987075b7f91d37addd33e1afd#src/clj/clojure/java/io.clj
18:01lpvbits nothing like gentoo
18:01technomancyif you have enough time to spend installing freebsd fully intending to switch away from it later then you are probably in the target demographic for arch =)
18:01lekulots of pple piping up about arch
18:01gtrakleku: pacman's pretty good, if you get yaourt (a wrapper) it's better than apt-get imo
18:01lekucool
18:01lpvbpacman is good enough by itself
18:01lekuyaourt?
18:01lekuor yogurt
18:01gtrakyaourt
18:01lekulol
18:01amalloygfredericks: the TI89 had all of those creature comforts like functions and variables
18:01lpvbyaourt just compiles packages from the AUR when there isn't a binary package available
18:01cgagyet another something or other
18:01lekudamn multiculturalism
18:01lekuah
18:01technomancyborkdude: it's just 1.4
18:02technomancyI don't imagine that fix made it in if you're seeing this issue still
18:02gtrakyea, I went to arch because I/updates kept breaking my ubuntu by trying to be on the bleeding edge. arch tracks upstream for everything
18:02amalloyand i found you could fake them on the TI83+, because you *could* create arrays/lists/whatever with custom names
18:02lekuwell i'll be damned
18:02leku4th try with freebsd installer a charm!
18:02technomancyarch doesn't sign their packages =(
18:02gtrakyea it does
18:02lpvbthey do
18:02winkit's off by default
18:02gtrakas of a couple months ago
18:02winkbut they implemented it, yeah
18:02lpvbit's now basically required
18:02cgagthey started recently, i have it off because i'm lazy :\
18:03borkdudetechnomancy so I guess this can't be it then? (commit = 6 months ago, clojure 1.4 = 2 or 3 months ago?)
18:03lekuthe other thing I like about freebsd is beacuse its rather obscure, I'm less of a target for attacks
18:03lekuor I'm a harder target anyawys
18:03gtrakleku: I will try to attack you to compensate :-)
18:03technomancyborkdude: oh, perhaps. I'm not following clojure development closely anymore.
18:03lekuhaha
18:03aduhow are ClojureDocs generated?
18:04lpvbthere's also the vice versa, leku. Since bsd isn't used as much it's not as tested for exploits
18:04lekuheh
18:04lekugood point
18:05lekuwelp
18:05gtrakjust don't try slackware
18:05gtrakthat leads to pain
18:05septomini remember installing slackware via floppies
18:05lekuI started with slackware
18:06lekukernel version 1.2.13
18:06lekuI think I used 23 floppies?
18:06brehautadu: the website?
18:06ystaelseptomin: i remember my parents asking me what the hell i wanted a box of a hundred floppies for
18:06lekuactually I had 23 images but 2 floppies
18:06lekuit was fun back and forth with rawrite.exe
18:06gtraki did too, on a 2.4 I think, then I tried to add the gentoo portage to it, like slortage or something
18:06brehautadu: https://github.com/zkim/clojuredocs its partly from the doc strings, and partly user created content
18:07brehauts/doc strings/meta data/
18:07gtraklol, emerdge, even better
18:07gtrakemerde*
18:08lekusumbitch
18:08lekufreebsd is up and working
18:09lekumight have to try arch another day :)
18:16borkdudetechnomancy that commit is in clojure 1.4 for sure
18:17technomancyborkdude: hm; sounds like a red herring then
18:20borkdudeyeah… what is weird is that some (the default paths like the java libs and leiningen standalone) have the %20, but others (from .m2) don't
18:20borkdudecould this be because they are loaded by different classloaders? (I have no idea how this works)
18:21technomancyyou could try putting more jars on the bootstrap classpath to see if that's the cause
18:21borkdudetechnomancy how exactly do you mean?
18:22borkdudetechnomancy you mean in the lein script?
18:23technomancynever mind, I just realized lein.bat doesn't even use the bootstrap classpath o_O
18:23technomancygeez
18:23technomancythat's like an extra 0.5-1s startup penalty for no reason
18:25nDuffWhat's the var to determine if we're currently AOT compiling?
18:25technomancy,*compile-files*
18:25clojurebotfalse
18:25technomancynDuff: ^
18:34gtrakthey should have called it ubuntu quantal quetzalcoatl
18:40borkdudetechnomancy the output of all the files on the classpath looks lke this https://gist.github.com/2885180
18:40borkdudetechnomancy I want to try your suggestion but don't know exactly what to do
18:41borkdudemaybe something gets double encoded
18:41technomancyborkdude: sorry, my suggestion doesn't make sense given what I know about lein.bat now
18:41brehautim pretty sure .bat files should be referred to as batshit rather than batch files
18:54borkdudetechnomancy I think I have a fix now...
18:55borkdudelemme test it first before I say anything
19:08adubrehaut: thanks
19:16technomancydoes compojure have a convention for making links that pretend to use different verbs?
19:22arohnertechnomancy: you mean something that looks like a normal link, but POSTs?
19:24technomancyyeah
19:33scottjtechnomancy: no. compojure doesn't have anything for links. hiccup does. but link-to doesn't accept the optional map so you either have to add that to it or write your own link function. then put onclick code in the map. afaik
19:33weavejestertechnomancy: Yep. It's _method
19:33weavejestertechnomancy: Same as Rails, IIRC
19:33technomancyweavejester: aha; thanks
19:35hiredmanpwd
19:35weavejestertechnomancy: Note it only works with POSTed forms, since you wouldn't want a GET to become a DELETE or PUT :)
19:35hiredmanwhoops, pardon
19:37technomancyof course =)
19:37technomancystupid browser vendors and their refusal to implement this stuff natively =(
19:43mebaran151anyway to globally disable colorize? the escape sequences don't come through on my emacs swank repl
19:57mebaran151nDuff: does setting the classloader explicitly in Class/forName help (i.e. Class/forName "klass" true
19:57mebaran151(i.e. (Class/forName "klass" true plugin-class-loader))
19:58nDuffYes, it does -- though that doesn't help with the real problem, the 3rd-party (ActiveObjects) library blowing up when it can't introspect what I'm passing it.
20:02mebaran151I think Class/forName uses the callers classloader, so you might have to do some classloader trickery inside ActiveObjects
20:03nDuffHmm.
20:15JorgeBIs it just me or is Google Groups … subpar? I replied to a question, but don't see my answer anywhere, nor can I find a place where it might list a history of my posts.
20:15JorgeBmust be just me
20:15technomancyit's got problems
20:15phoxa lot of what Google gets up to is inexplicably subpar
20:16phoxthey manage to get all of the hard parts right and then do things like that.
20:16hiredmanJorgeB: the group is moderated, so if it is your first post it can take time to show up
20:16technomancyrelevant: https://mobile.twitter.com/nathanmarz/status/193165782568550400
20:16JorgeBaha, that might explain why it's not showing up, thanks hiredman
20:17technomancyconsidering moving Leiningen's to librelist; does anyone have opinions on that?
20:17JorgeBI don't know librelist, but it sounds like a wonderful thing to do.
20:17metajackI have a class that comes from a java .class flie which has no namespace. How do I use that with reify? It can't seem to find it, even though (Nameofclass.) works
20:19TimMcmetajack: reify can't extend existing classes, only interfaces and protocols.
20:19metajackHm. I guess i misinterpreted the example with Object
20:19hiredmanand don't use classes without a package
20:19hiredmanObject is special
20:22metajackI didn't make this class, it's provided as a .class from an external source, so I can't control that ;(
20:22metajackproxy can't seem to resolve the class name either :(
20:24TimMcmetajack: Try importing it.
20:24metajackTimMc: thank you tons ;)
20:24TimMcDid that do it?
20:25metajackyes
20:25TimMcI figured a package-less Java class would exist in a weird twilight state. Is Foo fully-resolved or not? :-P
20:31TimMc,(.importClass *ns* 'fake.path.Foo java.awt.Color)
20:31clojurebotjava.awt.Color
20:31TimMc,fake.path.Foo/BLACK
20:31clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: fake.path.Foo, compiling:(NO_SOURCE_PATH:0)>
20:31TimMc,(.importClass *ns* 'Foo java.awt.Color)
20:31clojurebotjava.awt.Color
20:31TimMc,Foo/BLACK
20:31clojurebot#<Color java.awt.Color[r=0,g=0,b=0]>
20:32TimMcIt seems that if there are dots in the classname, Clojure assumes it is already resolved, and skips the lookup in the namespace's import map.
20:39metajackHm. now I can't get gen-class to see it, imported or not.
20:40aperiodicdoes it make a difference if you put the gen-class in the body rather than in the ns macro?
20:42metajackno. was just trying that.
20:42metajackI also tried (:import) vs. (import)
20:43metajackgen-class is always looking for java.lang.Foo
20:46aperiodicyou could write a java claass that is package-qualified which extends Foo, and then extend that in your gen-class
20:47metajackOk. I have up and just used a web based decompiler to get the damn source of the class. :)
20:47aperiodichaha, or that
20:48metajackit worked surprisingly well.
20:59mefestois there an existing way to create a custom error 500 page in compojure or is custom middleware it?
21:00weavejestermefesto: You mean if there's an exception?
21:00mefestoweavejester: yeah just wanted to check if there was an existing middleware function for that or do i need to roll my own
21:02weavejestermefesto: Not in Compojure or Ring, at least not for production. There's just wrap-stacktrace.
21:02mefestolike how there is (ANY "*" [] not-found) for 404. I was thinking maybe there was (ERROR "*" [] blah)
21:03mefestoweavejester: ok, just thought i'd check. thanks.
21:10amalloy(defn wrap-custom-error [handler error-handler] (fn [request] (try (handler request) (catch Exception e (error-handler e))))) (wrap-custom-error my-routes (constantly {:status 500 :body "Something broke, dude. Sorry"})) ;; isn't that all, mefesto?
21:11mefestoamalloy: yeah, i just wanted to check if something like that already existed before i went a wrote my own version.
21:12SgeoHow usable is ClojureCLR?
21:42cljnewb1234this is a genuine question, not a troll: I've been using Clojure for about 3-4 years now; and haven't studied Scala (preferring to focus on one rather than split over 2). However, I keep on hearing this + that about Scala's type system and how it solves NP complete problems in polynomial time.
21:43cljnewb1234I'm wondering if there is any good tutorial that implements Scala's type system as macros / library in Clojure.
21:47aperiodici think the closest thing to a type system in clojure is ambrose's typed-clojure project, which is still under progress: https://github.com/frenchy64/typed-clojure
21:49hiredmanaperiodic: I'd recomending ignoring anyone who talks about solving NP problems in P time
21:49cljnewb1234hiredman: it was meant as a joke
21:55aperiodichiredman: i figured it was tongue-in-cheek. i like to give people the benefit of the doubt.
21:58cljnewb01234yes ... it was meant as a way to say "people claim this Type system solves _ALL_ problems, even those that would win auto Turing awards"
22:00cljnewb01234can you solve 3SAT in sub linear time?
22:00Hodappdoubt it.
22:01Hodappit's just static typing.
22:01Hodappsome people talk about it like it's the second coming of Christ and like it's basically completely impossible to ever write a program in a dynamic language and have any idea about its reliability or correctness.
22:02cljnewb01234(not saying this because I'm in #clojure rather than #haskell); I'm actually starting to find protocols more modular than types
22:03Hodappbut the type system in Scala is quite nice compared to Java/C++ - does decent type inference and such
22:03cljnewb01234particularly because protocols allow me to hide the underlying implementing type, whereas types force me to reveal the names of the variables
22:03HodappI don't yet know anything about protocols in this context.
22:03cljnewb01234I'm referring to defprotocols
22:05Hodappmy secret is that I hardly know Clojure, I just chill here because the conversations can be interesting
22:06cljnewb01234i'm not too different; I try to string together syntactically valid but semantically nonsense sentences about things I find interesting, in hopes people get annoyed at my stupidity and correct them.
22:06cljnewb01234well, maybe we are different, since I probably annoy people more
22:06Hodappo_O
22:07cljnewb01234I'm currently reading (source distinct). What does (fn [[f :as xs] seen] ... ) mean?
22:07cljnewb01234I don't understand the [[f :as xs] seen] notation
22:08brehautcljnewb01234: thats a destructuring
22:08aperiodicthat's destructuring syntax; see the documentation for let at http://clojure.org/special_forms
22:08brehautthough that particular destructuring seems a little odd
22:08brehautoh wait no its not
22:08cljnewb01234yeah ... so "f" is bound to "as" ?
22:09brehautnope
22:09cljnewb01234wait wait let me figure this out
22:09cljnewb01234f, and xs are both bound to the contents of seen
22:09brehauttheres two arguments, the first is a sequence. f is bound to the first argument of the sequence, the whole sequence is bound as xs, and theres another argument 'seen'
22:10cljnewb01234[f :as xs] == [f & _ :as xs] ?
22:10brehautyeah
22:10brehautif you are trying to work out what a destructuring would do, the function destructure is sometimes really helpful
22:10brehautits used internally by the various macros that destructure
22:10cljnewb01234it's the equiv of macroexpand-1 ? :-)
22:11brehautbut only of the destructuring bit
22:11brehaut,(destructure '[[f :as xs] [1 2 3]])
22:11clojurebot[vec__29 [1 2 3] f (clojure.core/nth vec__29 0 nil) xs ...]
22:12cljnewb01234clojurebot's output is not helpful ...
22:12brehautthats simply a binding form (eg from a let)
22:12cljnewb01234oh I see
22:12cljnewb01234vec__20 is [1 2 3]
22:12cljnewb01234f is bound to the nth, 0 of that
22:12brehautyeah
22:12cljnewb01234and okay ... cool
22:12brehautthat ellipsis is just vec__29
22:15Hodappcljnewb01234: you might consider asking in #scala, though.
22:16Hodappthey likely won't be angry.
22:20cljnewb01234let's see how long until I get kicked for my nick
22:20cljnewb01234at least it's not something like clojure>scala
22:21Hodappcljnewb01234: it's not like #c or #c++
22:21Hodappthey're not gonna care
22:22Hodappthey don't have the victim complex some of those channels do when they realize their languages are horrid atrocities
22:22cljnewb01234lol
22:22cljnewb01234I do have to admit -- that not getting segmentation faults all over the place has made of less angry of a person.
22:22HodappI'm fine with coding in C, but C++ and Java just irk me in a lot of ways.
22:22cljnewb01234the nicety of the JVM + java libraries has made me a more calm person
22:23cljnewb01234I don't think I can ever return to ./configure && make && WTF why does library version XYZ not work with blah blah blah ABC
22:23Hodappmy degree is in EE and I've done my share of embedded programming
22:24Hodappyeah, that can be a pain, though unfortunately other languages are hardly immune
22:24cljnewb01234doesn't EE train you to be happy when your variables maintain their value without having to be refreshed?
22:24Hodappnah, EE trains you to write C like it's C, to write C++ like it's C, and to use real languages if you want to express something more complex.
22:25cljnewb01234does Clojure support things like guards? i.e. I want to define (fn [x] .... (x == nil ==> ... ) (otherwise ...) ) ... i.e. an implicit bond ?
22:25cljnewb01234s/bond/cond/
22:27aperiodicyou could use (or x ...)
22:27cljnewb01234I think I'm after clojure.core.match
22:27aperiodicoh no, not at all
22:27cljnewb01234except it appears still to be in alpha astage
22:27aperiodicmy thing
22:27cljnewb01234why not clojure.core.match?
22:27aperiodicno, the (or x ...) is not what you want at all
22:30aperiodicit's not really clear to me what your example wants to do. do some stuff on x if it's nil, and return some constant otherwise?
22:31cljnewb01234actually, i'm an idiot
22:31cljnewb01234what I want is pattern matching
22:31cljnewb01234the question now is ... what library to use:
22:31aperiodicok, yeah, clojure.core.match is what you want then
22:31cljnewb01234core.match looks like it's good (it's in org.clojure/core) ... but it's alpha software and claims it has known issues
22:35aperiodicwell, you can take a look at the jira and see if any of its known issues are showstoppers for you. i don't know of any alternatives.
22:59alex_baranoskydoes anyone have a good lazy implementation of segregate (remove/filter side by side)?
23:03tmciveralex_baranosky: Hey there! Do you mean separate? (def separate (juxt filter remove))
23:05alex_baranoskyjust uses reduce internally
23:05alex_baranoskyI think that will mean the seq gets realized
23:05alex_baranoskythough if I'm wrong, that is a very nice implementation of separate
23:06tmciverYeah, I'm actually not sure if it's lazy, but in the interest of full disclosure - I lifted that from some of TimMc's code.
23:07alex_baranoskyalso, the just veha
23:07alex_baranoskyoops, that didn't make sense....
23:07alex_baranoskyI'll give it a try, thanks!