2012-06-07
| 00:10 | michaelr525 | guten Morgen! |
| 01:20 | sergey | hey there |
| 01:20 | adu | hey |
| 01:21 | sergey | does everyone use clojure.test for testing? |
| 01:21 | aperiodic | midje is also popular |
| 01:22 | sergey | or there are some popular testing frameworks? |
| 01:23 | adu | that's a good question |
| 01:23 | adu | I wish I knew the answer |
| 01:23 | adu | I've been using clojure for about a day |
| 01:24 | muhoo | clojure.test is built in so i use it, it's fast and easy |
| 01:24 | muhoo | midje seems to be more industrial-strength |
| 01:24 | sergey | did you have any NamingContext problems? |
| 01:25 | sergey | like when calling tested functions from the test file? |
| 01:25 | muhoo | not sure what you mean. i usually require or use the tested functions in the testing namespace |
| 01:26 | muhoo | it'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:26 | sergey | muhoo, how do you require tested namespaces? I use (:require [tested.namespace :as tn]) but I can't call its methods tn/method |
| 01:27 | muhoo | that looks right to me, not sure why it wouldn't work. |
| 01:30 | johnmn3 | Would there be any utility in making namespaces that you could pass arguments to? |
| 01:31 | johnmn3 | like a function with functions in it, plus namespaces' other characteristics? |
| 01:32 | muhoo | most of the clojure code i've seen seems to use factory functions for that kind of thing, closures |
| 01:32 | muhoo | like (defn foo [params] (fn [args] (make-use-of params args) (do-otherstuff params))) ... etc |
| 01:32 | gfredericks | hey then we could also give them instance variables |
| 02:37 | ibdknox | amalloy_: Raynes: 4clojure is down |
| 02:48 | leku | hey technomancy you here? |
| 03:13 | tomoj | should (fn ([x]) ([x y])) be preferred to (fn [x & [y]]) |
| 03:24 | leku | what a pita |
| 03:25 | leku | http://thecomputersarewinning.com/post/clojure-heroku-noir-mongo/ |
| 03:25 | leku | still can't get that to work |
| 04:23 | Lajla | &(map + '(1 2 3 4) '( 1 1 1 1)) |
| 04:23 | lazybot | ⇒ (2 3 4 5) |
| 04:25 | sergey | hey there, is there any stuff in clojure for testing functions which connect to the db? like fixtures in rails? |
| 04:28 | brehaut | sergey: clojure itself doesnt provide anything specific to databases |
| 04:28 | brehaut | sergey: comparing rails (a framework) to clojure (a language) is a bit squiffy |
| 04:29 | brehaut | sergey: perhaps you should see if clojure.java.jdbc or korma have something like you want |
| 04:29 | brehaut | (assuming you are talking about sql rdbms's) |
| 04:29 | sergey | brehaut, I have functions which retrive some info from the database |
| 04:30 | sergey | and I want to test them |
| 04:31 | brehaut | i havent used an sql db in clojure in ages |
| 04:32 | brehaut | so i cant comment |
| 04:32 | brehaut | but those would be the places to start looking |
| 04:52 | sergey | how to test such functions? I mean, I can't just check the results with the hardcoded data from the database |
| 04:54 | nDuff | sergey: 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:55 | nDuff | sergey: ...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:09 | edoloughlin | My 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:12 | nDuff | edoloughlin: clojure-contrib no longer exists as a single package. |
| 05:13 | nDuff | edoloughlin: see http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 05:13 | bobry | is it possible to monkey-patch symbol value in an some other ns? |
| 05:14 | nDuff | bobry: possible? Yes. |
| 05:14 | bobry | nDuff: well, what should I google? :) |
| 05:15 | nDuff | bobry: ...you could look at how clojure.osgi monkeypatches parts of clojure.core, if you wanted a place to start... |
| 05:15 | bobry | yup, thanks! |
| 05:15 | nDuff | (and also an appropriate level of fear/respect) |
| 05:15 | edoloughlin | nDuff: Thanks. What's format for deps in Leiningen? E.g., will "org.clojure/clojure.contrib.sql" work? |
| 05:16 | nDuff | edoloughlin: it's clojure.java.jdbc now |
| 05:18 | nDuff | ...not quite sure on the name. org.clojure/java.jdbc maybe? |
| 05:18 | bobry | oops, cljs is missing 'intern' :( |
| 05:19 | nDuff | err, cljs? I missed that context. |
| 05:19 | edoloughlin | nDuff: Thanks. I just picked that as an example. Clojars search only returns what look like 3rd party stuff... |
| 05:20 | penthief | What is the best way (or is it even possible) to step through clojure code with a debugger? |
| 05:20 | si14 | nDuff: clojurescript. |
| 05:21 | nDuff | si14: yes, I know what it means. |
| 05:21 | nDuff | si14: didn't know it was what bobry was using. |
| 05:21 | si14 | nDuff: ah, sorry, missed the word "that". |
| 05:39 | brehaut | ~contrib |
| 05:39 | clojurebot | Monolithic 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:39 | brehaut | edoloughlin: ^ thats a good reference for transitioning |
| 05:42 | sergey | so, 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:43 | zomg | sergey: are you looking for a clojure-specific answer or a general guideline? |
| 05:43 | sergey | zomg, both would be great :) |
| 05:44 | sergey | zomg, 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:45 | zomg | I don't really know about specifics but I would guess there are libraries whic do that for Java |
| 05:45 | zomg | and as Clojure runs on the JVM, you should be able to use those just fine |
| 05:46 | antares_ | sergey: there are various libraries that mimic ActiveRecord's fixtures |
| 05:50 | sergey | antares_, I'll check them out, thanks |
| 05:52 | antares_ | sergey: there are also libraries like https://github.com/michaelklishin/validateur for activemodel-like validations |
| 05:52 | edoloughlin | Anyone know what happened to clojure.contrib.prxml from the old contrib? |
| 05:53 | brehaut | it might be in clojure.data.xml ? |
| 05:54 | edoloughlin | Thanks. Hope so :( |
| 05:59 | sorenmacbeth | howdy |
| 05:59 | sorenmacbeth | is there some weirdness about creating java objects inside a for loop? |
| 06:00 | brehaut | sorenmacbeth: 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:00 | brehaut | but otherwise not it should be fine |
| 06:02 | brehaut | ,(for [a ["example.com", "google.com"]] (java.net.URL. (str "http://" a))) ;; sorenmacbeth |
| 06:02 | clojurebot | (#<URL http://example.com> #<URL http://google.com>) |
| 06:02 | sorenmacbeth | brehaut: 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:03 | brehaut | sorenmacbeth: put your function up on refheap.com |
| 06:05 | sorenmacbeth | brehaut: https://www.refheap.com/paste/4fd07b6fe4b0559138cc89a3 |
| 06:05 | brehaut | huh |
| 06:06 | sorenmacbeth | what the for loop returns is the equivalent of just doing (Metrics.) |
| 06:06 | sorenmacbeth | as if the doto isn't being called |
| 06:07 | brehaut | so you have something like (for [m metrics] (apply mk-metrics m)) ? |
| 06:07 | brehaut | (ridiculously contrived example) |
| 06:07 | sorenmacbeth | brehaut: yeah, something like that |
| 06:08 | sorenmacbeth | https://www.refheap.com/paste/4fd07c61e4b0559138cc89a4 |
| 06:08 | sorenmacbeth | that's the for |
| 06:09 | brehaut | those tuples are a really good case for a map :P |
| 06:10 | brehaut | sorenmacbeth: im sorry, i dont know whats going wrong. theres nothing obvious |
| 06:10 | sorenmacbeth | brehaut: yeah, thanks for humoring me |
| 06:10 | brehaut | no problem |
| 06:10 | sorenmacbeth | brehaut: how would I use a map there? |
| 06:11 | brehaut | instead of the huge tuple vector, |
| 06:11 | brehaut | tuples presumably is full of vectors currently |
| 06:11 | brehaut | how about [{:intent … :entrances … …} …] |
| 06:13 | sorenmacbeth | yeah tuples is a vector of vectors |
| 06:13 | brehaut | then either :let [metrics (apply mk-metrics (select-keys tuple [:entrances :pageviews …]))] |
| 06:13 | brehaut | or (what i would prefer) |
| 06:13 | brehaut | change mk-metrics to take a map as an argument and destructure it with keys |
| 06:13 | brehaut | and then just (map mk-metrics tuples) |
| 06:14 | sorenmacbeth | brehaut: gotcha |
| 06:15 | brehaut | sorenmacbeth: just out of curiosity, if you replace your for with doseq and [intent metrics] with (println intent metrics) does it work as expected? |
| 06:17 | brehaut | (expected = prints out intent and the correct metrics) |
| 06:19 | sorenmacbeth | brehaut: nope |
| 06:19 | brehaut | its not the lazinessthen |
| 06:21 | sorenmacbeth | brehaut: 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:21 | sorenmacbeth | was just hoping it was something simple I wasn't aware of ;) |
| 08:01 | sergey | hey there, what's the problem with requiring project namespaces from the test ns? I have NoInitialContextException |
| 08:02 | ejackson | sergey: shouldn't be a problem with that |
| 08:03 | sergey | ejackson, some functions from the tested ns work fine, some of them throw some NoInitialContextException, given that they work in REPL |
| 08:03 | ejackson | I don't know what the Exception is, feels like its coming from your code itself, rather than the test harness |
| 08:04 | ejackson | do you perhaps need to set up some context ? |
| 08:04 | sergey | nope, they are stand-alone functions |
| 08:05 | sergey | this is weird, I can't find this problem in Google |
| 08:05 | ejackson | i've never heard of it |
| 08:05 | ejackson | in the repl have you perhaps loaded some namespaces before the one being tested ? |
| 08:05 | sergey | no, I've just loaded the namespace itself |
| 08:06 | sergey | and then I render the functions - works fine |
| 08:06 | ejackson | can you paste the ns and its test perhaps ? |
| 08:06 | ejackson | to refheap.com |
| 08:06 | sergey | I can give you a link to the so question - http://stackoverflow.com/questions/10925998/error-while-testing-namespaces-in-clojure |
| 08:07 | ejackson | OK, I don't think you need :refer-clojure |
| 08:08 | ejackson | what does calc.alg look like ? |
| 08:08 | sergey | simple algebraic functions for testing like plus, minus ... |
| 08:08 | sergey | (defn plus [a b] (+ a b)) ; stuff like that |
| 08:09 | ejackson | try cut it down to a bare min, no includes, just the one function you're testing and see what happens |
| 08:10 | ejackson | the error is coming out of http://docs.oracle.com/javase/1.3/docs/api/javax/naming/package-summary.html |
| 08:10 | ejackson | any reason you would want to use this ? |
| 08:11 | ejackson | i dunno, perhaps it comes in via test, but I've never seen it |
| 08:11 | sergey | I don't |
| 08:11 | ejackson | try the min ns and lets see |
| 08:11 | sergey | anyway, thanks for the help, I'm tired of fighting it, I'll return to it later |
| 08:12 | ejackson | umm, alight then. |
| 08:12 | ejackson | i'll just go back to doing my own job then :) |
| 08:51 | solussd_ | good morning clojurians! anyone going to wwdc? |
| 09:08 | wilfredh | novice question: why does (Integer/parseInt "123") work but (map Integer/parseInt (list "123")) doesn't? |
| 09:09 | S11001001 | wilfredh: because Integer/parseInt is not a function |
| 09:09 | S11001001 | it's not even a value |
| 09:09 | S11001001 | ,(doc memfn) |
| 09:09 | clojurebot | "([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:09 | S11001001 | I guess that would be less useful |
| 09:09 | S11001001 | try #(Integer/parseInt %) |
| 09:10 | S11001001 | ,list |
| 09:10 | clojurebot | #< clojure.lang.PersistentList$1@6436bef6> |
| 09:10 | S11001001 | ok |
| 09:10 | S11001001 | ,vec |
| 09:10 | clojurebot | #<core$vec clojure.core$vec@40638118> |
| 09:10 | S11001001 | ,first |
| 09:10 | clojurebot | #<core$first clojure.core$first@5ad7a8a0> |
| 09:10 | S11001001 | ,Integer/parseInt |
| 09:10 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer, compiling:(NO_SOURCE_PATH:0)> |
| 09:10 | S11001001 | ,#(Integer/parseInt %) |
| 09:10 | clojurebot | #<sandbox$eval148$fn__149 sandbox$eval148$fn__149@6c40da0f> |
| 09:12 | wilfredh | perfect, thanks |
| 10:16 | timvisher_ | how can I control the proxy used by lein? |
| 10:19 | vijaykiran | timvisher_: http://maven.apache.org/guides/mini/guide-proxies.html |
| 10:20 | timvisher_ | vijaykiran: I didn't think that lein used maven anymore. not true? |
| 10:22 | vijaykiran | timvisher_: I think the dependency resolution is done via maven |
| 10:22 | timvisher_ | hmm… ok, I'll take your word for it. :) |
| 10:22 | S11001001 | such has it always been |
| 10:23 | timvisher_ | S11001001: meaning? |
| 10:23 | vijaykiran | timvisher_: let me know if setting proxy in m2 settings works |
| 10:23 | cemerick | timvisher_: lein2 does not use maven at all. |
| 10:24 | timvisher_ | it does not |
| 10:24 | timvisher_ | cemerick: that's what i thought |
| 10:24 | timvisher_ | vijaykiran:* it does not |
| 10:24 | borkdude | it doesn't use any maven lib or anything at all? |
| 10:24 | timvisher_ | cemerick: are you aware of any way to tell lein to use a different proxy than http_proxy is set to? |
| 10:25 | borkdude | amazing |
| 10:25 | borkdude | leiningen in leiningen ;) |
| 10:26 | cemerick | timvisher_: Not sure what http_proxy is; it currently uses the proxy defined in system properties (http.proxyHost and http.proxyPort) |
| 10:26 | Wild_Cat | is there a Clojure REPL equivalent to Python's dir()? (lists all available symbols in the current namespace) |
| 10:27 | borkdude | I think dir even exist |
| 10:27 | vijaykiran | timvisher_: :) Just scanned through the code, and it uses Aether |
| 10:27 | timvisher_ | cemerick: i believe those default to the environment variables http_proxy and https_proxy |
| 10:27 | borkdude | ,(doc dir) |
| 10:27 | clojurebot | "([nsname]); Prints a sorted directory of public vars in a namespace" |
| 10:28 | borkdude | youll have to give it a nsname though |
| 10:28 | timvisher_ | vijaykiran: know how to configure that? I suppose I can configure my calls to lein to set those system properties via -D directives? |
| 10:28 | borkdude | what is the difference in source and sourcery in reply btw |
| 10:29 | Wild_Cat | borkdude: nice, but you need a nsname, yeah. What is the "default" namespace in a REPL? |
| 10:29 | borkdude | wild_cat if you start a repl, it is user |
| 10:29 | Wild_Cat | thanks |
| 10:29 | borkdude | Wild_Cat (dir user) |
| 10:30 | Wild_Cat | cool. Although it doesn't list the builtins. Oh well, I'll live (go cheatsheet go! ;) ) |
| 10:30 | borkdude | Wild_Cat the builtins do not live in user |
| 10:31 | borkdude | you can do (dir clojure.core) though |
| 10:31 | borkdude | don't know if that is really useful though |
| 10:32 | Wild_Cat | it is. Thanks. |
| 10:32 | bordatoue | onnce i am in REPL using clojure-jack-in mode, how do i know which version of clojure I am running |
| 10:32 | timvisher_ | 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:32 | borkdude | bordatoue: (clojure-version) |
| 10:33 | bordatoue | in side repl borkdude |
| 10:33 | timvisher_ | could i do it via profiles? |
| 10:33 | borkdude | bordatoue yes, inside a repl |
| 10:33 | borkdude | :-s |
| 10:33 | cemerick | timvisher_: use :jvm-opts in project.clj, or you can set that in a profile |
| 10:33 | bordatoue | is there any way to update clojure to version 1.4 in emacs |
| 10:33 | bordatoue | borkdude: thanks |
| 10:34 | bordatoue | After 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:34 | borkdude | bordatoue you can change it in the project.clj for your project |
| 10:35 | bordatoue | borkdude: i created project.clj file using lein new commands are you refering to project.clj file created using lein |
| 10:35 | borkdude | bordatoue most definitely |
| 10:37 | timvisher_ | cemerick: well done, as usual, sir. ^_^ |
| 10:38 | cemerick | timvisher_: :-) Having distinct proxy configuration available would be valuable; feel free to open an issue in leiningen. |
| 10:38 | bordatoue | borkdude: i changed to 1.4 in project.clj file but now on starting clojure-jack-in fails with meaningless errors |
| 10:39 | borkdude | bordatoue what version of leiningen are you using |
| 10:39 | bordatoue | borkdude: lein 1.7.1 |
| 10:40 | borkdude | bordatoue I think in 1.7 you might have to rerun lein deps |
| 10:40 | borkdude | bordatoue but I don;t know … anyone? |
| 10:42 | cemerick | bordatoue: 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:42 | bordatoue | borkdude: do you know how to rerun lein deps |
| 10:43 | bordatoue | cemerick: i have only single version of clojure |
| 10:43 | borkdude | bordatoue like cemerick says: empty your lib dir first, then from the cmd line: lein deps |
| 10:44 | borkdude | or just upgrade to leiningen 2 ;) |
| 10:44 | bordatoue | borkdude: do you people really find this interesting , I couldn't even get started with this language |
| 10:44 | borkdude | bordatoue no I hate this stuff, that's why I'm doing it whenever I can ;P |
| 10:45 | bordatoue | borkdude: nice, there should be more dependencies just for fun |
| 10:45 | borkdude | bordatoue honestly, it is not so difficult if you know how leiningen works |
| 10:46 | borkdude | bordatoue and know what is really is for... |
| 10:47 | borkdude | bordatoue there is no concept of "installing one version of clojure for your entire system" in leiningen |
| 10:47 | borkdude | bordatoue settings are per project |
| 10:48 | semperos | because it's "just a jar" |
| 10:48 | bordatoue | all i wanted to do was to try some concurrency programing with clojure, and it seems I am still strugling to get it running |
| 10:48 | bordatoue | btw, how efficient is Clojure compared to Java |
| 10:48 | borkdude | bordatoue if you don't want to get into emacs/swank/slime/leiningen you can also try Eclipse and the counterclockwise plugin |
| 10:49 | dnolen | hmm got another decent CLJS optimization brewing ... |
| 10:49 | bordatoue | is clojure efficient enough compared to Java |
| 10:49 | mthvedt | if you code with performance in mind |
| 10:49 | dnolen | bordatoue: 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:50 | mthvedt | i've found idiomatic clojure code is easy to transform into performant code |
| 10:50 | mthvedt | also |
| 10:51 | twhume | Hello, 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:52 | S11001001 | and that is to assume that you write the most efficient program possible when writing in java |
| 10:52 | S11001001 | which is highly unlikely |
| 10:54 | S11001001 | twhume: first I'd drop flatten, then, do you have a tree root in the caller of add-layer? |
| 10:55 | twhume | S11001001: I'm calling it with (doseq (take 20000000 (add-layer))) to exercise the OOM error |
| 10:55 | gfredericks | that doesn't look legal |
| 10:55 | S11001001 | as gfredericks says |
| 10:55 | gfredericks | ,(doseq (take 200 (range))) |
| 10:55 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: doseq requires a vector for its binding in sandbox:> |
| 10:55 | twhume | doh. sorry - I meant dorun |
| 10:55 | S11001001 | but seriously get rid of flatten first |
| 10:56 | bordatoue | dnolen: 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:56 | gfredericks | bordatoue: why use java when you can use C? |
| 10:56 | S11001001 | bordatoue: why use C when you can write assembler? |
| 10:56 | ejackson | yeah, yeah, butterflies. |
| 10:56 | dnolen | bordatoue: I'll leave that to you figure out. Invest nothing - get nothing ;) |
| 10:56 | bordatoue | gfredericks: protablility , hotspot compilation and typesafety .etc.. |
| 10:57 | bordatoue | dnolen: I take your point |
| 10:57 | gfredericks | bordatoue: simplicity mostly |
| 10:57 | bordatoue | i wouldn't call clojure simple |
| 10:57 | gfredericks | bordatoue: have you programmed with immutable data structures before? |
| 10:58 | bordatoue | well, i use locks to attain that behaviour |
| 10:58 | bordatoue | gfredericks: you talking about concurrency part, if there is an advantage |
| 10:59 | gfredericks | bordatoue: no, just the simplicity you get from not having to worry about a data structure being mutated |
| 10:59 | gfredericks | the effect is huge |
| 10:59 | bordatoue | gfredericks: only when exploting concurrency |
| 11:00 | dnolen | bordatoue: have you read Java Concurrency in Practice? |
| 11:00 | gfredericks | no all the time |
| 11:00 | bordatoue | gfredericks: how many applications are written to exploit concurrency |
| 11:00 | gfredericks | bordatoue: it's independent of concurrency |
| 11:01 | bordatoue | if 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:01 | antares_ | bordatoue: compared to what? |
| 11:01 | antares_ | bordatoue: have you tried it or you are just guessing? |
| 11:01 | cgag | the immutability is definitely a big benefit even without concurrency imo |
| 11:01 | antares_ | I know plenty of people who prototype in Clojure |
| 11:01 | amalloy | so don't use swank. install lein, lein repl, done |
| 11:02 | _ato | for me: less boilerplate, cohesive design, interactive development, expressability/language features (just simple things like lambdas), fun: learning new things |
| 11:02 | bordatoue | cgag: I don't know if immutablity is a huge benefit without concurrency |
| 11:02 | mthvedt | bordatoue: not just multi-thread concurrency… being able to have guarantees about data structures makes programming easier |
| 11:02 | _ato | concurrency doesn't really come into it for me |
| 11:02 | gfredericks | bordatoue: it complements the style of pure functions |
| 11:02 | dnolen | bordatoue: it is - no aliasing. |
| 11:03 | gfredericks | bordatoue: the more of your program you can write as pure functions, the more of it you can test without worrying about state |
| 11:03 | gfredericks | only input->output |
| 11:03 | Hodapp | bordatoue: Managing state and changes to it, even regardless of concurrency, is one of the biggest sources of bugs in existence. |
| 11:03 | bordatoue | mthvedt: what compramises gurantee if there is no other process accessing your datastructure |
| 11:03 | antares_ | bordatoue: immutability gives you guarantees. You can go from non-concurrent algorithm to a concurrent one typically without or almost without changes. |
| 11:03 | gfredericks | bordatoue: the functions you pass your data structure to could access it |
| 11:04 | mthvedt | bordatoue: you're only thinking about multi-thread concurrency… |
| 11:04 | antares_ | bordatoue: look at C, everything may be single threaded and things will mutate your data structure when you least expect it |
| 11:04 | mthvedt | you can have different code twiddling the same data objects in the same thread |
| 11:04 | antares_ | or take a look at Ruby where things are mutated implicitly from libraries you did not know you've loaded |
| 11:04 | bordatoue | antares_: i am not taling C, compare with Java |
| 11:04 | mthvedt | you won't have race condition bugs, but most types of concurrency bugs are available to single threaded programs |
| 11:04 | Chousuke | java has the same issues |
| 11:04 | antares_ | bordatoue: so in java methods you pass data structures to cannot mutate them? |
| 11:05 | antares_ | bordatoue: Java Concurrency in Practice has almost an entire chapter dedicated to suggesting otherwise |
| 11:05 | Chousuke | if 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:05 | Chousuke | if you have a reference to a clojure data structure, it will never change |
| 11:05 | bordatoue | we can prevent mutation of datastructure in java. There are read only datastructure are you talking about persistant datastructure |
| 11:05 | Chousuke | that is guaranteed. |
| 11:06 | mthvedt | so clojure just encourages a style of programming that is immutable by default |
| 11:06 | antares_ | bordatoue: most people can't |
| 11:06 | antares_ | bordatoue: most libraries don't, most projects end up not doing that |
| 11:06 | mthvedt | if you desire mutability you can use java collections without much effort (discouraged) or atoms/refs |
| 11:06 | borkdude | in Java you have to be explicit about immutability, in Clojure the reverse |
| 11:07 | bordatoue | I bet badly written clojure code will be a nightmare to read |
| 11:07 | borkdude | bordatoue I bet too |
| 11:07 | Hodapp | I bet badly written code in any language will be a nightmare to read |
| 11:07 | dnolen | bordatoue: there is no language where that is not a problem. |
| 11:07 | antares_ | bordatoue: so, what's your point? |
| 11:07 | antares_ | are you just arguing that clojure is pointless? |
| 11:07 | antares_ | ok, we agree |
| 11:07 | antares_ | go ahead and use java or what it is that you like |
| 11:07 | vijaykiran | borkdude: "badly written code will be a nightmare" - FTFY :) |
| 11:07 | bordatoue | you can't go very wrong with Java |
| 11:07 | Hodapp | ROFL |
| 11:07 | mthvedt | to be fair, i'd rather read bad code in java than in clojure |
| 11:07 | cgag | i suppose i haven't seen bad clojure, but i've been surprised at how well i understand most clojure code i've seen |
| 11:07 | antares_ | badly written anything is a nightmare to read |
| 11:08 | mthvedt | at work, we do not let the consultants near clojure :) |
| 11:08 | Hodapp | < bordatoue> you can't go very wrong with Java |
| 11:08 | dnolen | bordatoue: that doesn't compute. |
| 11:08 | antares_ | bordatoue: really? how about Java EE? |
| 11:08 | Hodapp | that is just... that is classic |
| 11:08 | amalloy | cgag: i have written some pretty bad clojure you would be unable to read :P |
| 11:08 | Hodapp | Is that like "No one ever got fired for buying IBM"? |
| 11:08 | gfredericks | cgag: a function that creates a local atom, punches it repeatedly, then derefs and returns |
| 11:08 | Hodapp | Or is it more like "All of the sharp parts have been filed down so you can't hurt yourself" |
| 11:09 | antares_ | some of the worst code I have seen in my life was in Java (some of the best, too, by the way) |
| 11:09 | dnolen | cgag: you can go very wrong in Clojure - it's painful to watch people go through macro craziness. |
| 11:09 | borkdude | bordatoue you can't go wrong with Java… it depends on your definition of wrong or your religious / philosophical world view |
| 11:09 | antares_ | 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:10 | borkdude | Rich isn't very zen about it |
| 11:10 | borkdude | ;) |
| 11:10 | mthvedt | it's a matter of degree |
| 11:10 | matthavener | mthvedt: 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:10 | dnolen | bordatoue: 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:11 | mthvedt | matthavener: 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:11 | Hodapp | antares_: 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:11 | Hodapp | antares_: They are, thus, 'safe' choices. |
| 11:12 | mthvedt | a lot of the industry around java is all about mitigating the effect of bad programmers on big business IT |
| 11:12 | bordatoue | dnolen: I still don't see the hype in this language, compared to Lisp, Python, Java |
| 11:12 | antares_ | Hodapp: possibly. In that case, I agree. But not everybody chooses technologies for that reason, thankfully :) |
| 11:12 | borkdude | bordatoue what hype? |
| 11:12 | cgag | dnolen: 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:12 | dnolen | bordatoue: but you don't know Clojure so I'm not sure what your basing your opinions on. |
| 11:12 | antares_ | bordatoue: so, what Lisp has more momentum in Clojure? |
| 11:12 | antares_ | borkdude: and why the hell should anyone care about hype? |
| 11:12 | Vinzent | Well, bad code is easier to write in clojure than in java. Clojure, unlike java, doesn't have well established best practices, patterns, etc |
| 11:12 | antares_ | for hype, use node.js |
| 11:13 | bordatoue | dnolen: I don't know Clojure because it is hard, it has lots of dependencies |
| 11:13 | Chousuke | Vinzent: I don't think that's true |
| 11:13 | antares_ | bordatoue: do you mind answering my question? |
| 11:13 | antares_ | bordatoue: what other Lisp has "hype"? |
| 11:13 | twhume | S11001001: 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:13 | borkdude | bordatoue what dependencies do you mean, the JVM? |
| 11:13 | Chousuke | vinzent: Clojure encourages better code |
| 11:13 | bordatoue | dnolen: for example I am trying to get doc function running on SLIME |
| 11:13 | S11001001 | ,(doc flatten) |
| 11:13 | clojurebot | "([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:13 | S11001001 | dammit |
| 11:14 | antares_ | S11001001: it was supposed to miserably fail to stress bordatoue's point |
| 11:14 | dnolen | bordatoue: are you an Emacs user? Did you try some of the other environments? |
| 11:14 | antares_ | S11001001: what did you do |
| 11:14 | twhume | sure… so why would that cause problems here? |
| 11:14 | Chousuke | vinzent: in Java, it's easy to shoot yourself in the foot if you don't think about what you're doing. |
| 11:14 | Chousuke | vinzent: clojure kind of forces you to think, so that's less of an issue |
| 11:14 | S11001001 | twhume: it's the nesting that's an issue; you probably want mapcat instead of map |
| 11:14 | twhume | ah, thanks |
| 11:15 | twhume | yep, that was it. |
| 11:15 | S11001001 | antares_: ? |
| 11:15 | bordatoue | dnolen: I tried eclipse with clojure plugin, the problem there was I did not know how to create a binary distribution |
| 11:15 | S11001001 | let me see |
| 11:15 | S11001001 | flatten? |
| 11:15 | clojurebot | flatten 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:15 | antares_ | bordatoue: so, what Lisp has more momentum than Clojure? |
| 11:15 | S11001001 | twhume: that's what I was looking for :) |
| 11:15 | Vinzent | Chousuke, 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:15 | antares_ | S11001001: just ignore me :) |
| 11:16 | dnolen | bordatoue: binary distribution for who, for what? Are you trying to learn the language or deploy apps right now? |
| 11:16 | cgag | antares_: i took his use of hype to mean more just reasons to use it over those |
| 11:16 | Chousuke | Vinzent: I suppose. Clojure is very opinionated though. |
| 11:16 | antares_ | cgag: let bordatoue answer for himself |
| 11:16 | bordatoue | antares_: I don't find the point of learning something slower than Java because it embraces immutability |
| 11:16 | antares_ | bordatoue: dude this is not what I was asking you |
| 11:16 | mthvedt | headdesk |
| 11:16 | Chousuke | Vinzent: you're only given immutable data structures to start with so even newbies are forced to use them |
| 11:16 | mthvedt | performance doesn't matter for 99% of applications anymore |
| 11:16 | antares_ | bordatoue: what Lisp has more momentum than Clojure (you listed it next to Java and Python)? |
| 11:16 | mthvedt | bits are cheaper than neurons |
| 11:17 | bordatoue | dnolen: tell me how do i create a simple binary distribution in clojure using eclipse with clojure plugin |
| 11:17 | antares_ | bordatoue: is Python worth learning because it is faster than Java? |
| 11:17 | borkdude | bordatoue do you mean a standalone jar? |
| 11:17 | antares_ | bordatoue: how fast do you need to go? did you benchmark or just trying to reach Web Scale™? |
| 11:17 | dnolen | bordatoue: same as Java |
| 11:17 | borkdude | bordatoue "lein uberjar" |
| 11:17 | bordatoue | antares_: python is good to write prototypes and to prove certain concepts |
| 11:18 | dnolen | bordatoue: define a main entry point. make a jar. |
| 11:18 | antares_ | bordatoue: ok, cool, what Lisp has more momentum? |
| 11:18 | Vinzent | Chousuke, 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:18 | antares_ | bordatoue: I am afraid you are just throwing words around |
| 11:18 | antares_ | bordatoue: so please explain yourself |
| 11:18 | twhume | S11001001: hmm, but the OOM issue still persists. Any other ideas? |
| 11:18 | Vinzent | Chousuke, so in java there is no questions - I know what's the right thing. That's not true for clojure |
| 11:19 | dnolen | bordatoue: 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:20 | antares_ | 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:20 | S11001001 | twhume: change add-layer to (concat n (lazy-seq (add-layer (mapcat get-children n)))) |
| 11:21 | antares_ | bordatoue: also, I am still waiting for the answer about that mythical Lisp with a lot of "hype" (whatever that means) |
| 11:21 | twhume | giving that a go... |
| 11:22 | Hodapp | antares_: within 2%, interesting... |
| 11:22 | twhume | Whilst that's running… how does moving the lazy-seq to the right of that expression improve things? |
| 11:24 | antares_ | 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:24 | S11001001 | it's more moving it to the left rather than the right |
| 11:25 | bordatoue | yeah hotspot does it for you |
| 11:26 | S11001001 | oh, also, `iterate' will make this function simpler |
| 11:26 | twhume | Ah, still get a OutOfMemoryError Java heap space java.lang.AbstractStringBuilder.<init> (AbstractStringBuilder.java:45) |
| 11:27 | twhume | I'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:27 | S11001001 | I'd rewrite in terms of iterate, and print one node per iteration to see what they look like |
| 11:28 | twhume | Mind you, if the error is in AbstractStringBuilder that would point to get-children being the problem... |
| 11:28 | S11001001 | yes, in your example, your node sizes will keep growing |
| 11:29 | S11001001 | or it could just be random flotsam of allocation |
| 11:57 | twhume | S11001001: 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:58 | semperos | there's update-in and assoc-in, proper way to do dissoc-in ? |
| 11:58 | S11001001 | mapcat more often |
| 11:58 | twhume | heh |
| 11:58 | S11001001 | quite serious |
| 11:59 | S11001001 | I think your shape will be like (->> [treeroot] (iterate (fn [nodes] (mapcat blahblah))) (apply concat)) |
| 12:02 | twhume | Thanks… 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:02 | antares_ | semperos: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L56 |
| 12:02 | S11001001 | core.clj |
| 12:02 | S11001001 | read it, love it |
| 12:02 | semperos | antares_: yeah, I nabbed that from the old contrib source on clojuredocs as well |
| 12:02 | twhume | :) |
| 12:02 | semperos | wasn't sure if there was another idiom I was overlooking, thanks |
| 12:02 | antares_ | twhume: Clojure Programming explains lazy sequences very well, in my opinion |
| 12:03 | twhume | antares_: the o'reilly book? |
| 12:03 | antares_ | twhume: right |
| 12:10 | si14 | can I emit clojurescript code from clojurescript? compile time would be good enough. |
| 12:10 | dnolen | silven: you cannot. |
| 12:11 | si14 | SVG 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:13 | dnolen | silven: you could probably easily do some server side generation for the contents of the SVG tags via the CLJS compiler tho. |
| 12:15 | antares_ | 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:17 | technomancy | I think you can use it with couch already |
| 12:17 | dnolen | antares_: cemerick is interested in that too. |
| 12:17 | antares_ | technomancy: sure, my question is how practical it really is for this use case |
| 12:18 | dnolen | antares_: I can't imagine ~120k causing much problems on a modern JS engine server side. |
| 12:18 | si14 | dnolen: thanks, |
| 12:18 | dnolen | antares_: the size issue is really about clients. |
| 12:18 | si14 | *. |
| 12:18 | cemerick | (cljs support is integrated into clutch these days, FWIW) |
| 12:18 | antares_ | dnolen: ~120K is a lot if you want to run a query, for example |
| 12:18 | dnolen | antares_: I meant ~120k of JS. |
| 12:18 | antares_ | dnolen: imagine how much higher latency may be if you add 120K to the payload |
| 12:19 | antares_ | cemerick: ok, and ~120K is about as much as Google Closure produces on average? |
| 12:19 | dnolen | antares_: 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:19 | cemerick | antares_: nah, much less than that |
| 12:19 | cemerick | 40-50k |
| 12:19 | antares_ | dnolen: good point. Some (maybe all?) DBs with JS scripting features allow functions to be stored. |
| 12:20 | dnolen | antares_: so non-issue I think. |
| 12:20 | antares_ | cemerick: with couch, are views first installed and then used? so you only transfer 50K once? |
| 12:20 | ystael | noob 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:20 | cemerick | yes, 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:21 | amalloy | ystael: there is a very small amount of overhead for it |
| 12:21 | cemerick | And, dwarfed by the actual data being processed anyway. |
| 12:21 | ystael | amalloy: constant, or growing with the arg list size? |
| 12:21 | eggsby | so dnolen you were saying spidermonkey is better than using v8/node for a cljs env? |
| 12:21 | amalloy | constant |
| 12:21 | ystael | amalloy: cool, thank you! |
| 12:21 | dnolen | eggsby: hmm? when did I say that? |
| 12:22 | amalloy | ystael: it can't grow with the arglist size, since you can apply an infinite argseq :) |
| 12:22 | eggsby | ah, I thought I read it in irc earlier this week |
| 12:22 | eggsby | maybe i'm imagining things |
| 12:22 | ystael | amalloy: i have not yet begun to develop my lazy sequence fu :D |
| 12:22 | dnolen | eggsby: node is probably the best environment since it has system integration. |
| 12:22 | eggsby | ok |
| 12:23 | amalloy | &(apply (fn [& args] (nth args 1e5)) (range)) |
| 12:23 | lazybot | ⇒ 100000 |
| 12:24 | ystael | amalloy: ok, that's pretty cool |
| 12:25 | antares_ | cemerick: ok, now I see |
| 12:25 | semperos | looks like himera is down |
| 12:25 | hiredman | ~python |
| 12:25 | clojurebot | python is ugly |
| 12:27 | S11001001 | clojurebot? |
| 12:27 | clojurebot | clojurebot is your name |
| 12:39 | kaoD_ | hi |
| 12:39 | dnolen | not 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:40 | kaoD_ | can someone clarify EPL for me? |
| 12:40 | kaoD_ | I've read it about 4 times and I still don't grasp some parts |
| 12:40 | kaoD_ | reading about it online didn't help either |
| 12:41 | kaoD_ | in fact, I just want to know what would happen if I GPL my Clojure code |
| 12:44 | kaoD_ | I'm not sure if I could distribute JARs for it since GPL and EPL aren't compatible |
| 12:47 | kaoD_ | EPL is sort of an LGPL with an added patent clause, am I right? |
| 12:48 | eggsby | is anyone itc familiar with aleph/wrap-ring-handler ? |
| 12:48 | amalloy | i 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:49 | eggsby | I'm trying to understand how I can use ring's static file serving middleware with my aleph handlers... hm |
| 12:51 | technomancy | kaoD_: AFAIU you can't distribute GPL'd code that is "derivative" of EPL'd code |
| 12:51 | technomancy | some 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:52 | technomancy | best to avoid mixing it if there are business concerns at stake |
| 12:52 | technomancy | if you can choose the license for your own code why not use the EPL? it's got copyleft. |
| 12:52 | kaoD_ | this isn't business, I'm just curious (or kind of "respectful" for these kind of licenses) |
| 12:53 | _ato | I 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:53 | kaoD_ | well, as I said EPL is sort of an LGPL |
| 12:53 | kaoD_ | and I like plain GPL |
| 12:53 | kaoD_ | but I like the patents clause in EPL too |
| 12:54 | technomancy | yeah, it's ironic that the patents clause is what makes it GPL-incompatible since the patents clause is important to protect user freedom. |
| 12:54 | kaoD_ | _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:55 | kaoD_ | technomancy: well, some would argue that (e.g. BSD) |
| 12:55 | _ato | ah of course |
| 12:56 | AimHere | I think for those licenses, the GNU website says something like 'We've nothing against these licenses, but sadly they're GPL-incompatible |
| 12:56 | kaoD_ | AimHere: yup, I checked that source too... not really useful |
| 12:56 | kaoD_ | because this is a separate piece of code |
| 12:56 | technomancy | kaoD_: 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:58 | kaoD_ | that's covered by GPLv3, am I right? |
| 12:58 | AimHere | When you say 'your Clojure code', do you mean code written in Clojure, or stuff meant to be part of the clojure language? |
| 12:58 | S11001001 | license-list should be covering gpl3 now |
| 12:59 | kaoD_ | AimHere: meant the language, not the platform |
| 12:59 | S11001001 | in the case of EPL, the last paragraph in the license is enough to make it GPL-incompatible, even for 3 |
| 12:59 | AimHere | Well in that case, you can license your own code how you like |
| 13:00 | kaoD_ | yes, I'm just curious about the implications |
| 13:00 | kaoD_ | I can release jar files for Java GPL code |
| 13:00 | kaoD_ | but not for Clojure |
| 13:00 | AimHere | Well 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:00 | kaoD_ | (or that's what I understand, see my comment about jars above) |
| 13:00 | kaoD_ | so it actually DOES matter |
| 13:00 | _ato | you can for Clojure too can't you as long as you don't include Clojure itself in your jars? |
| 13:01 | AimHere | Well 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:01 | AimHere | Also, since there are GPLed Java runtimes out there (like the GNU one) then it's hardly likely to be a derivative work |
| 13:03 | kaoD_ | _ato, AimHere, read this: http://www.mail-archive.com/clojure@googlegroups.com/msg26420.html |
| 13:03 | kaoD_ | specially the macro part, that's actually what changed my mind |
| 13:03 | kaoD_ | I thought just like you before I did some research |
| 13:04 | _ato | yep |
| 13:04 | kaoD_ | AimHere: could you rephrase your last statement please? |
| 13:04 | _ato | although Clojure projects are often distributed non-AOTed and hence don't include the expanded macros |
| 13:04 | Hodapp | I just spelled "disclosure" as "disclojure" in a work document. I blame all of you. |
| 13:05 | AimHere | Well 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:05 | kaoD_ | AimHere: nope, that's not derivative work |
| 13:05 | AimHere | Yes it is |
| 13:05 | kaoD_ | you can only copyright implementations, not ideas |
| 13:05 | kaoD_ | although you can trademark them |
| 13:05 | AimHere | This is well covered in case law; writing your own fiction in someone else's universe can very easily be a derivative work |
| 13:06 | kaoD_ | this is not fiction |
| 13:06 | kaoD_ | see the Google vs. Oracle case |
| 13:06 | AimHere | Yes, software is different |
| 13:07 | AimHere | What 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:07 | AimHere | That wasn't covered in Google versus Oracle as far as I understand it but still |
| 13:07 | kaoD_ | 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 | _ato | yuck, I didn't know that |
| 13:08 | amalloy | i 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:10 | amalloy | and 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:10 | kaoD_ | amalloy: yep, I'm just curious |
| 13:10 | kaoD_ | I've met some libraries which require AOT |
| 13:10 | technomancy | amalloy: you can distribute AOT without source as long as source is available on request |
| 13:10 | kaoD_ | ditto |
| 13:11 | amalloy | okay, sure. but that's effectively the same as including sources; clojure's license still doesn't play into it at all |
| 13:11 | technomancy | yeah, a bit nit-picky maybe |
| 13:12 | AimHere | GPL-with-exemption should work here, though? |
| 13:12 | AimHere | Trouble is, you can't marry someone else's GPLed code to yours if you're adding in the EPLed stuff |
| 13:15 | sergey | is there any practical tutorial for clojure - some kind of guide which leads through all the processes while developing a real product? |
| 13:18 | technomancy | the peepcode kind of does that |
| 13:18 | technomancy | disclaimer: I'm the author |
| 13:19 | duck1123 | sergey: Programming Clojure (the book) builds Lancet as part of its text |
| 13:29 | pbostrom_ | 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:29 | pbostrom_ | uh, wait, that's not right, let me think about it some more |
| 13:30 | mebaran151 | pbostrom_: do you mean assoc there? |
| 13:32 | pbostrom_ | (get @some-atom :my-key (let [default "val"] (swap! some-atom assoc :my-key default) default)) |
| 13:35 | mebaran151 | pbostrom_: you could check out assoc-in to do some of that for you |
| 13:35 | mebaran151 | or update-in |
| 13:36 | mebaran151 | (update-in @some-atom [:key] get @some-atom :key "default-val") |
| 13:36 | amalloy | pbostrom_: that sounds a lot like (:my-key (swap! some-atom update-in [:my-key] #(or % (default)))) |
| 13:36 | mebaran151 | sorry: I meant what malloy said :/ |
| 13:40 | pbostrom_ | amalloy: thanks, that looks good |
| 13:47 | Jayunit100 | hi guys : i have a vagrant vm setup w/ clojure and open jdk |
| 13:47 | Jayunit100 | https://github.com/jayunit100/rudolf_dev |
| 13:48 | kjellski | Can someone tell my why this is throwing a NullPointerException? ((second (partition 2 [1 +])) (first (partition 2 [1 +])) 100) I would expect 101... |
| 13:49 | dnolen | ,(second (partition 2 [1 +])) |
| 13:49 | clojurebot | nil |
| 13:49 | dnolen | kjellski: ^ |
| 13:49 | dnolen | ,(second (first (partition 2 [1 +]))) |
| 13:49 | clojurebot | #<core$_PLUS_ clojure.core$_PLUS_@456457f0> |
| 13:49 | kjellski | dnolen: whyyyyy? ^^ thanks... |
| 13:49 | dnolen | kjellski: think about it |
| 13:50 | kjellski | *feelsdumb* |
| 13:50 | dnolen | ,(partition 2 [1 +]) |
| 13:50 | clojurebot | ((1 #<core$_PLUS_ clojure.core$_PLUS_@456457f0>)) |
| 13:50 | Jayunit100 | it returns a sinlge list |
| 13:50 | Jayunit100 | so there is no 2nd |
| 13:50 | kjellski | dnolen: I got it, in the first place… was just asking myself how I could miss it... |
| 13:51 | Jayunit100 | haha |
| 13:52 | kjellski | Jayunit100: only sorta kinda funny if it doesn't happen to you ;) |
| 13:52 | Jayunit100 | yup i been there |
| 13:55 | mrtentje | What is the best way in Clojure (with a webnoir project) to throw exceptions from the model to the view? |
| 14:04 | duck1123 | mrtentje: there's wrap-stacktrace in ring-devel. It'll display a page containing the ST on error |
| 14:41 | mrb_bk | dnolen: finally got around to watching your predicate dispatch talk, very enjoyable |
| 14:41 | Hodapp | mrb_bk: link? |
| 14:41 | Vinzent | by the way, is there some progress on it? :) |
| 14:41 | mrb_bk | http://blip.tv/clojure/david-nolen-predicate-dispatch-5953889 |
| 14:42 | dnolen | mrb_bk: thanjks! |
| 14:42 | dnolen | er thanks I mean |
| 14:42 | mrb_bk | dnolen: yeah man - how did the hacker school gig go |
| 14:42 | dnolen | mrb_bk: that's this Saturday actually. |
| 14:43 | mrb_bk | oh man! my wife's birthday |
| 14:48 | mrb_bk | dnolen: well, good luck this sat then! |
| 14:48 | timvisher_ | why do i need slime installed in emacs to run jack in when lein-swank comes with it's own? |
| 14:48 | dnolen | mrb_bk: thanks! will try to put something together that I can use another time. |
| 14:48 | technomancy | timvisher_: you don't? |
| 14:48 | wink | I didn't explicitly install it either |
| 14:49 | timvisher_ | 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:49 | timvisher_ | maybe on old version of clojure-mode? |
| 14:49 | technomancy | it could be the bootstrapped version of slime was truncated somehow |
| 14:50 | technomancy | try rm -rf ~/.emacs.d/swank? |
| 14:50 | dnolen | Vinzent: 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:50 | timvisher_ | technomancy: same deal after that |
| 14:51 | technomancy | on a fresh emacs? |
| 14:51 | timvisher_ | no slime under elpa... |
| 14:51 | timvisher_ | technomancy: yep |
| 14:52 | timvisher_ | clojure-mode 1.11.5 |
| 14:53 | timvisher_ | starter-kit-lisp 2.0.2 |
| 14:53 | technomancy | something has messed up the bootstrapped copy of slime |
| 14:53 | timvisher_ | how can i clean that puppy out? |
| 14:53 | timvisher_ | delete lein-swank and reinstall? |
| 14:54 | technomancy | depends what "something" is |
| 14:54 | technomancy | maybe there's a cron job that runs sed on every file in ~/.emacs.d or something; that won't help in that case =) |
| 14:54 | timvisher_ | i could do a totally fresh emacs |
| 14:55 | timvisher_ | as in without my configuration |
| 14:56 | timvisher_ | this is what *swank* gives me: https://gist.github.com/2890747 |
| 14:56 | Vinzent | dnolen, 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:59 | cgag | I wish there was a local lisp/clojure group around here. I feel like I'm too new to start one though. |
| 15:00 | amalloy | i'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:00 | clojurebot | /summon rhickey |
| 15:00 | timvisher_ | cgag: learn by fire! |
| 15:01 | amalloy | seriously 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:01 | wink | lol |
| 15:02 | technomancy | even if all you know is how to install swank and lein you can solve 75% of newbie questions =) |
| 15:02 | gfredericks | you do need other people though |
| 15:02 | cgag | I 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:02 | gfredericks | which is location-sensitive |
| 15:02 | wink | usergroup, not usersgroup |
| 15:02 | sh10151 | where are you? |
| 15:02 | sh10151 | cgag: where are you? |
| 15:02 | cgag | kansas city |
| 15:03 | technomancy | isn't that where jimduey is? |
| 15:03 | gfredericks | I think he's nearby |
| 15:03 | gfredericks | in midwestern distances |
| 15:03 | adu | amalloy: heh |
| 15:03 | cgag | meetup says there are 3 people waiting for a clojure group, and around 20 waiting for one on functional programming |
| 15:03 | cgag | ha, midwestern distances |
| 15:04 | adu | anyone here in the DC/MD area? |
| 15:04 | gfredericks | probably across several states in northeastern distances |
| 15:05 | plainflavored | can i go through SICP with clojure, or will i have to adapt the exercises? |
| 15:07 | adu | plainflavored: wait |
| 15:07 | timvisher_ | totally fresh emacs (as in a new .emacs.el file) displays the same behavior |
| 15:07 | adu | I'm pretty sure there is a clojure-specific SICP |
| 15:07 | timvisher_ | adu: it's nowhere near complete yet |
| 15:07 | adu | plainflavored: http://sicpinclojure.com/ |
| 15:08 | plainflavored | awesome, thank you |
| 15:08 | adu | oh "You should not be here yet." heh |
| 15:08 | timvisher_ | still a nicely formatted way to read a lot of it |
| 15:09 | Hodapp | I 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:09 | timvisher_ | Hodapp: are you aware that the whole coures is available online? |
| 15:09 | Hodapp | timvisher_: yes, but this doesn't mean I've yet set aside the time to do it. |
| 15:10 | dnolen | Vinzent: predicate dispatch is even more compelling to me now that we have ClojureScript - I'll definitely get to it :) |
| 15:10 | timvisher_ | Hodapp: I spent my lunches over a summer going through them. _fantastic_ |
| 15:10 | cgag | i've watched a few of those sicp lectures, sussman is great |
| 15:10 | Hodapp | timvisher_: I may try to set something up at the local hackerspace and get a group to go through it |
| 15:10 | Hodapp | timvisher_: does it has exercises and things in it? |
| 15:10 | Hodapp | has? have. argh. |
| 15:12 | adu | there are things I like about scheme, and things I don't like |
| 15:13 | adu | Scheme isn't Huffman |
| 15:13 | adu | I think Clojure is a little more Huffman |
| 15:13 | cgag | huffman? |
| 15:13 | Hodapp | huffman? |
| 15:14 | adu | http://en.wikipedia.org/wiki/Huffman_coding |
| 15:14 | dnolen_ | jonasen: querying codebase via Datomic looks need :) |
| 15:14 | dnolen_ | I mean neat |
| 15:14 | Hodapp | what does it mean to describe any language as "Huffman"? |
| 15:14 | adu | I 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:15 | Hodapp | but... parenthesis are only one character! |
| 15:15 | adu | for example "def" vs "define" |
| 15:16 | sh10151 | adu: sounds like Paul Graham |
| 15:16 | sh10151 | related to Huffman coding |
| 15:16 | cgag | has anyone actually done any analysis on that? it'd be cool to see some sort of break down for different languages |
| 15:16 | adu | and Racket's (current-command-line-arguments) vs (argv) |
| 15:16 | scottj | string-concatenate vs str |
| 15:16 | sh10151 | heh |
| 15:16 | sh10151 | Objective-C loses |
| 15:16 | sh10151 | flat-out |
| 15:17 | Hodapp | sh10151: I think Java would very likely be worse. |
| 15:17 | sh10151 | Common Lisp isn't great either, looking at you multiple-value-bind |
| 15:17 | scottj | (concatenate 'string ..) too |
| 15:17 | jonasen | dnolen_: It's a fun experiment |
| 15:17 | Hodapp | I don't have a problem so much with longer names as I do with more complex structures or very complex names. |
| 15:17 | technomancy | elisp should rename let non-destructuring-bind |
| 15:17 | adu | sh10151: ya, isn't there a CL function that twiddles bits called dqp? |
| 15:17 | sh10151 | Hodapp: I don't know Map.get vs NSDictionary objectForKey |
| 15:17 | sh10151 | probably counts for a lot just there |
| 15:17 | technomancy | to match remove-if-not =) |
| 15:18 | Hodapp | sh10151: FloatFactoryFactory.getInstance(FloatFactoryFactory.defaultInstanceDescriptionString).getFactory(Locale.getLocale("en-US")).createBuilder().setString("1.5").getResult() |
| 15:18 | scottj | technomancy: good one |
| 15:18 | Hodapp | the problem there isn't that names are long, it's that there are too damn many names. |
| 15:18 | timvisher__ | 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:18 | Hodapp | adu: It's "Object-Oriented"(tm)! |
| 15:19 | adu | object oriented brain vomit? |
| 15:19 | Hodapp | no, object oriented is something else from "Object-Oriented"(tm)! |
| 15:19 | dnolen_ | jonasen: it was actually one of the first things I thought about when I heard about diatomic. |
| 15:20 | technomancy | timvisher__: you can do (eval-after-load 'slime '(require 'clojure-test-mode)) |
| 15:20 | timvisher__ | technomancy: so install it manually rather than via package? |
| 15:20 | timvisher__ | makes sense |
| 15:20 | dnolen_ | 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:21 | adu | sh10151: http://clhs.lisp.se/Body/f_dpb.htm |
| 15:21 | mat`` | 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:21 | adu | an example of a short name that's probably used once a century |
| 15:21 | jonasen | dnolen_: I'd like to store many (all?) codebases and ask questions like: I'd like to change this var. Who uses it? |
| 15:21 | sh10151 | mat``: that's OK, just pass it as a function parameter every time you want it to change |
| 15:22 | sh10151 | adu: well, this is the language of car and cdr |
| 15:22 | dnolen_ | jonasen: yep, CLJS AST + Datomic would be particularly sweet. |
| 15:22 | timvisher__ | interesting, why didn't i get clojure-test-mode.el included in my install from melpa? |
| 15:22 | dnolen_ | jonasen: query, transform, unparse |
| 15:23 | pepijndevos | &(let [** (fn ** ([] 1) ([n] n) ([n ex] (apply * (repeat ex n))))] (** 2 3)) |
| 15:23 | lazybot | ⇒ 8 |
| 15:23 | adu | sh10151: if I were to have named them, I would have called them F and R |
| 15:23 | pepijndevos | What is the algorithm for doing that to a fractional exponent? |
| 15:23 | sh10151 | head and tail seem OK too |
| 15:24 | adu | then ff fr rf rr would make sense |
| 15:24 | sh10151 | oh, but cadaddr is fun! |
| 15:24 | sh10151 | I think destructuring syntax should be the more common way to do that anyway |
| 15:25 | adu | I 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:25 | jimduey | cgag: Are you in KC? I'm out south. |
| 15:25 | mebaran151 | adu: Math/pow would be your friend, otherwise you're gonna have to use some numerical method to esimate roots |
| 15:25 | cgag | i'm in overland park |
| 15:25 | mebaran151 | sorry, that was for pepijndevos |
| 15:26 | sh10151 | seems like it should be a large enough metro area to have 5-10 clojure enthusiasts able to meet... |
| 15:26 | mat`` | 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:26 | pepijndevos | mebaran151, I know abou the java thing, but I was hoping for something more clojury, using rational numbers. |
| 15:26 | technomancy | pulse uses both in-process queues and redis queues |
| 15:26 | technomancy | not that well documented though |
| 15:27 | mebaran151 | pepijndevos: rational numbers are different from rational roots |
| 15:27 | mebaran151 | you'd probably break the rational number between numerator and denominator |
| 15:28 | mebaran151 | take the root of the base with regard to the denominator and then use reduce to multiply them together numerator times |
| 15:28 | pepijndevos | mebaran151, so you'd have to got all the way with symbolic computation and such? |
| 15:28 | mebaran151 | pepijndevos: not quite symbolic: you'd have to use a numeric method |
| 15:28 | mebaran151 | (probably what Java does under the hood) |
| 15:30 | pepijndevos | mebaran151, but java returns floating point things... |
| 15:30 | timvisher__ | technomancy: does it make sense to have clojure-test-mode package-require slime? |
| 15:30 | timvisher__ | considering that the push seems to be to have lein-swank manage slime by default? |
| 15:30 | mebaran151 | pepijndevos: rational exponents can return irrational numbers |
| 15:31 | pepijndevos | mebaran151, http://richhickey.github.com/clojure-contrib/math-api.html#clojure.contrib.math/expt |
| 15:31 | lazybot | Nooooo, 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:31 | technomancy | timvisher__: the packages should still be declared |
| 15:31 | technomancy | timvisher__: what would make more sense is to make clojure-test-mode loaded by jack-in too |
| 15:31 | timvisher__ | true, true |
| 15:31 | timvisher__ | i can always install clojure-test-mode and then delete slime too |
| 15:32 | technomancy | ...? |
| 15:32 | dnolen_ | pepijndevos: thoughts on specific things people would like to hear about on Saturday? |
| 15:32 | technomancy | if you're already using package.el why would you go in and delete packages? |
| 15:32 | mebaran151 | pepijndevos: if you look at the source, unless the power is an integer, he falls back on Math/pow |
| 15:32 | timvisher__ | it seems bad to have multiple slimes on the load-path |
| 15:32 | timvisher__ | no? |
| 15:32 | clojurebot | no is tufflax: there was a question somewhere in there, the answer |
| 15:33 | technomancy | timvisher__: jack-in doesn't use the load-path, so it shouldn't matter |
| 15:33 | timvisher__ | true i suppose |
| 15:33 | pepijndevos | mebaran151, right :( |
| 15:34 | mebaran151 | pepijndevos: were you hoping for an irrational type? |
| 15:34 | pepijndevos | dnolen_, minikanren! haha |
| 15:34 | pepijndevos | mebaran151, dunno |
| 15:34 | mebaran151 | anyway, generally, to take a non-integral power, you're going to end up with floating point |
| 15:34 | timvisher__ | well, looks like that'll work just fine (everything installed + jack-in) |
| 15:35 | timvisher__ | thanks for your help as always |
| 15:35 | technomancy | np |
| 15:35 | pepijndevos | dnolen_, there is at least 4 people doing something logic-ey, and some people doing regular JS and clojure. |
| 15:35 | dnolen_ | 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:35 | pepijndevos | only one guy reading ibdknox's cljs stuff afaik. |
| 15:36 | jonasen | dnolen_: Another idea is: With lots of facts about a codebase, is it possible to make a type system? |
| 15:37 | pepijndevos | dnolen_, I have not done to much cljs myself, so I'm not sure what would be good to talk about |
| 15:38 | pepijndevos | dnolen_, there is some interest in writing compilers me thinks |
| 15:40 | dnolen_ | jonasen: hmm, create a type system? or do you mean infer types because you have the whole program? |
| 15:41 | dnolen_ | pepijndevos: cool, I figured. |
| 15:41 | pepijndevos | dnolen_, for a more representative view of the nterests, you should hop into #hackerschool |
| 15:41 | dnolen_ | pepijndevos: cool thanks for the tip |
| 15:42 | jonasen | dnolen_: I mean infer. |
| 15:42 | dnolen_ | jonasen: yes that would be awesome. Dialyzer like. |
| 15:42 | jonasen | Dialyzer? |
| 15:43 | dnolen_ | jonasen: http://www.erlang.org/doc/apps/dialyzer/dialyzer_chapter.html |
| 15:43 | jonasen | dnolen_: Cool, thanks |
| 15:44 | dnolen_ | jonasen: note that Dialyzer can have a Persistent Lookup Table :) |
| 15:46 | jonasen | dnolen_: Looks very nice! Is the design or implementation described in a paper somewhere? |
| 15:46 | timvisher__ | `{` in paredit at the repl runs self-insert-command, but in regular clojure-mode it works. `[` and `(` work as they should. thoughts? |
| 15:47 | dnolen_ | jonasen: I think there are a few papers. |
| 15:47 | timvisher__ | the repl also is aware that I sholudn't delete them (`{` and `}`) if there's content in them |
| 15:48 | dnolen_ | jonasen: http://user.it.uu.se/~kostis/Papers/succ_types.pdf |
| 15:48 | jonasen | dnolen_: http://www.it.uu.se/research/group/hipe/dialyzer |
| 15:48 | dnolen_ | jonasen: ooh much better :) |
| 15:53 | timvisher__ | ah, it's because the repl doesn't load clojure-mode |
| 15:53 | timvisher__ | so i still need to fix paredit at the repl |
| 15:56 | jedmtnman | ,(prn "other channels think bots are dumb. Yah #clojure knows whats up") |
| 15:56 | clojurebot | "other channels think bots are dumb. Yah #clojure knows whats up" |
| 15:57 | borkdude | ,(println "foo") |
| 15:57 | clojurebot | foo |
| 15:58 | lancepantz | RAYNES PARTY |
| 16:00 | bobry | is it possible to pass metadata to defmacro? for example: '(defmacro f [& more] more) (f ^:private 1)'? |
| 16:01 | bobry | i would like to have that :private thing available inside 'f' |
| 16:01 | gtrak | does this function exist somewhere? I feel like I've reinvented it twice already: https://gist.github.com/2891175 |
| 16:01 | tomoj | (defmacro f [x] (meta x)) |
| 16:01 | tomoj | (f ^:private {}) |
| 16:01 | tomoj | (note 1 can't have metadata) |
| 16:02 | tomoj | when writing cljs macros do you avoid ` and refer to everything with ns qualified symbols? |
| 16:05 | tomoj | oh, no need to avoid ` I guess |
| 16:05 | dnolen_ | tomoj: no need to avoid ` |
| 16:05 | tomoj | just looked at core.logic's macros as an example |
| 16:05 | bobry | nice, thanks tomoj :) |
| 16:05 | tomoj | thought the note about ` not supporting ~ was on the clojure side, which would be absurd.. |
| 16:07 | dnolen_ | tomoj: I currently fully namespace fns to cljs.core.logic - this may no longer be necessary. |
| 16:07 | dnolen_ | tomoj: in the past analysis did not follow namespaces, so maybe this precaution is no longer necessary. |
| 16:07 | dnolen_ | namespace dependencies I mean. |
| 16:08 | tomoj | hmm |
| 16:08 | tomoj | but macros.clj won't depend on cljs.core.logic, will it? |
| 16:17 | tomoj | wouldn't it be theoretically possible to make things which satisfy IFn into actual js functions? |
| 16:17 | dnolen_ | tomoj: hmm, not 100% sure, but note that fns like cons, take work - they resolve to cljs.core |
| 16:17 | tomoj | ah, similarly IFn will resolve to cljs's I guess, neat |
| 16:18 | dnolen_ | tomoj: the way satisfies? worked before wouldn't work except as macro - now there can be a satisfies? fn. |
| 16:19 | tomoj | protocols have been reified? |
| 16:19 | tomoj | but I mean that reify and deftype etc could theoretically notice that IFn is being implemented and return an actual js function |
| 16:20 | dnolen_ | tomoj: they always were - but the implementation prevented it working except as a macro - we can now use bit masking. |
| 16:20 | tomoj | I read "Protocols are not reified as in Clojure, there are no runtime protocol objects" |
| 16:21 | dnolen_ | tomoj: yeah, that's old - will probably change soon. |
| 16:22 | dnolen_ | tomoj: far as IFn that's kinda how it works now - tho that misses out on some optimizations which we'll get to. |
| 16:23 | tomoj | kinda? I get "Property 'foo' of object #<Object> is not a function" with (def ^:export foo [] (reify IFn (-invoke [f]))) |
| 16:24 | tomoj | s/[]// |
| 16:25 | dnolen_ | tomoj: oh, sorry wasn't following closely enough, no we're really going to emit regular JS functions for IFn |
| 16:25 | dnolen_ | we're *not* really |
| 16:25 | tomoj | it seems like a strange idea anyway, but what problems would it cause? |
| 16:26 | dnolen_ | tomoj: slows down multi-arity dispatch. |
| 16:26 | tomoj | I see |
| 16:27 | adu | don't you have to revert to using 'arguments' for multiple arity? |
| 16:27 | dnolen_ | adu: it's slow |
| 16:27 | dnolen_ | adu: and we do use it - just not under advanced compilation. |
| 16:28 | adu | oOo advanced compilation |
| 16:28 | adu | you would think with all the compilers out there that someone would have made a compiler factory factory by now |
| 16:29 | amalloy | adu: time for yaccc? |
| 16:33 | adu | amalloy: yeah |
| 17:04 | mea | has clojure ever gotten anyone liad |
| 17:04 | mea | laid* |
| 17:06 | sritchie | mea: the answer is no |
| 17:06 | sritchie | mea: it's probably gotten rhickey laid, actually |
| 17:06 | cgag | it seems opssible for hickey |
| 17:06 | gfredericks | thank goodness somebody finally said it |
| 17:06 | sritchie | that was his motivation, I think, if you read closely on clojure.org |
| 17:11 | gtrak | adding a math guy and a FP guy together you might get one full set of social skills |
| 17:12 | Hodapp | gtrak: Most of the math and FP guys I know have no trouble with the whole 'social skills' thing. |
| 17:12 | mea | i kissed a girl once |
| 17:12 | Hodapp | 9_9 |
| 17:12 | Hodapp | did you like it? |
| 17:12 | mea | not really D: |
| 17:13 | Hodapp | try again |
| 17:13 | Bronsa | lol |
| 17:15 | Hodapp | Just remember that people who laugh at someone for not getting laid/kissed/whatever tend to lead pretty empty lives... |
| 17:16 | gtrak | that's like the opposite of laughing at someone for using php |
| 17:17 | Hodapp | I said getting laid, not getting fucked. |
| 17:17 | gtrak | lol nice |
| 17:19 | nDuff | (...and her ex-wife is a library science major who used to specialize in translating dead languages...) |
| 17:19 | nDuff | (...and she says that brains don't particularly turn her on. *amused*) |
| 17:24 | gfredericks | why should I use clojure if I can use TI-BASIC? |
| 17:25 | gf3 | Good question. |
| 17:25 | AimHere | You shouldn't. Do everything in TI-BASIC from now on |
| 17:25 | gtrak | gfredericks: have you heard the good news? a concurrent lisp on the jvm! |
| 17:25 | gf3 | EVERYTHING. |
| 17:25 | gfredericks | gtrak: holy jello-wagons |
| 17:26 | gfredericks | but why is this better than a single-threaded BASIC on the TI-83+? |
| 17:26 | gfredericks | I don't think I'm allowed to bring a JVM to geometry class |
| 17:26 | gfredericks | clearly TI-BASIC is more portable |
| 17:26 | gtrak | about 3 years of rich hickey's life came and died for our sins |
| 17:29 | gtrak | gfredericks: I wish I knew some C when I had a TI calc, I made a pong game once on the 89 |
| 17:29 | Hodapp | beer pong? |
| 17:29 | gtrak | regular |
| 17:29 | Sgeo | I hate the JVM |
| 17:29 | Sgeo | I mean, hi. |
| 17:29 | gtrak | haha |
| 17:30 | gtrak | Sgeo: where you coming from? |
| 17:30 | Sgeo | Mostly Haskell, a bit of exposure to Common Lisp, a bit of exposure to Racket |
| 17:30 | Sgeo | More exposure than I'd like to C# :/ |
| 17:30 | Sgeo | Way too much exposure to LSL |
| 17:30 | Sgeo | Years of exposure to Python |
| 17:31 | Sgeo | And forced to take Java classes in highschool |
| 17:31 | borkdude | $logs |
| 17:33 | gtrak | python sits halfway between java and clojure for me now, I feel like java needs to exist, and clojure for high-level stuff. |
| 17:33 | arrdem | hey guys, is there something you can point me to that's a "first project" survival guide to stuff like Cojure naming practices? |
| 17:33 | arrdem | kina like the PEPs |
| 17:34 | pipeline | arrdem: that kind of stuff is covered really well in "joy of clojure" |
| 17:34 | gtrak | arrdem: use-hyphens-like-this except for java types (defrecords also), in which case you'd use camel-case |
| 17:34 | pipeline | arrdem: 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:34 | arrdem | pipeline: yaaay! I have a copy behind me, but haven't cracked it yet |
| 17:34 | Sgeo | "needs to exist" |
| 17:36 | gtrak | Sgeo: rather, I can see myself coding in it from time to time, I don't think I'll ever drop down to C |
| 17:36 | gtrak | unless I feel like doing some low-latency stuff |
| 17:38 | gtrak | Sgeo: last time I tried to use python it felt much more 'awkwarder than clojure' than 'better than java' :-) |
| 17:39 | gtrak | initially I learned it because of 'better than java' |
| 17:39 | gfredericks | gtrak: I made a snake game with a computer player |
| 17:40 | gtrak | nice |
| 17:41 | gfredericks | gtrak: I'd fill up sheets of paper keeping track of what all the variables meant |
| 17:41 | gtrak | lol wow |
| 17:41 | gtrak | what was it that basic didn't have? functions right? |
| 17:42 | gfredericks | and custom variable names |
| 17:42 | JorgeB | Where would one go to hire developers with Java and Clojure experience? I assume advertising in #channel is frowned upon. |
| 17:42 | gfredericks | clojure conj |
| 17:42 | pipeline | depends on who you are, JorgeB |
| 17:42 | nDuff | JorgeB: sponsoring the conj is a good one |
| 17:42 | pipeline | JorgeB: if you are directly employed by the hiring firm, i'm betting you can get away with some pretty shameless advertising |
| 17:42 | JorgeB | I am Legend |
| 17:43 | JorgeB | actually, I am Disney |
| 17:43 | pipeline | if you're a third party recruiter you're gonna find yourself klined if you offend the wrong party haha |
| 17:43 | JorgeB | not a recruiter. I am the team lead |
| 17:43 | pipeline | well then |
| 17:43 | septomin | are you allowed to have a beard |
| 17:43 | pipeline | hiring managers are allowed to shill haha |
| 17:43 | JorgeB | beards are encouraged |
| 17:44 | gtrak | they cut down on UV glare from reflected light off the pale skin |
| 17:45 | algin | does anyone have some experience with seesaw ? |
| 17:45 | JorgeB | well, then this is me looking for people who might be interested. Preferably SF Bay Area, but might be flexible. |
| 17:47 | Sgeo | Am I more likely to get a job that uses Clojure than I am a job that uses Haskell? |
| 17:48 | Sgeo | Hmm, what about Common Lisp or a Scheme |
| 17:48 | technomancy | depends on whether you're a professor or not |
| 17:48 | leku | heh |
| 17:48 | cgag | i'd expect clojure |
| 17:48 | mebaran151 | algin: I played with a little |
| 17:48 | leku | not 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:49 | gtrak | Sgeo: 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:49 | cgag | JorgeB: do you have a link or anything? |
| 17:49 | leku | clojure has a lot of momentum right now and a strong community behind it, plus its fun |
| 17:49 | Sgeo | gtrak, I don't want to work at a Java shop |
| 17:49 | gtrak | right :-) |
| 17:49 | Sgeo | I want to pretend java doesn't exist |
| 17:49 | technomancy | speaking of which, it's about time for another yearly "State of Clojure" survey soon, isn't it? |
| 17:49 | leku | java is an integral part of clojure |
| 17:49 | JorgeB | cgag, I have the generic job postings, but I am trying to stack the opportunities for Clojure hackers, let me dig it up |
| 17:49 | leku | clojure builds upon trhe success of java |
| 17:49 | technomancy | Sgeo: http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/ has some numbers on Clojure and employment |
| 17:50 | technomancy | 35% using it at work as of a year ago |
| 17:50 | leku | wow |
| 17:50 | leku | 62% of pple using it for webdev |
| 17:51 | JorgeB | cgag, send it privately |
| 17:51 | leku | hey technomancy |
| 17:51 | ystael | Are 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:51 | JorgeB | cgag, like I said, it's the generic job req |
| 17:51 | brehaut | leku: thats probably tied directly to most people doing web development for most things |
| 17:51 | leku | my ubuntu->debian adventure was seriuosly misguided |
| 17:51 | JorgeB | cgag, I am the hiring manager |
| 17:51 | leku | now I am in freebsd hell |
| 17:52 | technomancy | my condolances? |
| 17:52 | leku | lol |
| 17:52 | leku | just thought i'd share |
| 17:52 | gtrak | leku: lol did you do debian with the bsd kernel? |
| 17:52 | leku | no |
| 17:52 | leku | i went from ubuntu to debian 6.0.5 then to wheezy |
| 17:52 | technomancy | I used freebsd on the desktop for like six months in university |
| 17:52 | leku | they both failed me now i'm trying fbsd |
| 17:52 | gtrak | leku: haha: http://www.debian.org/ports/kfreebsd-gnu/ |
| 17:52 | leku | how was it techno? |
| 17:53 | cgag | what were your problems with debian? |
| 17:53 | technomancy | leku: it was a learning experience. |
| 17:53 | technomancy | the only reason it lasted all of six months was that I had a lot of time on my hands in school. |
| 17:53 | leku | let me see.. first pple said I _had_ to be using squeeze |
| 17:53 | leku | which wasn't the case, I needed to be on wheezy to make my life eeasier |
| 17:53 | gtrak | yea, debian testing's the only way to go |
| 17:53 | technomancy | leku: why? |
| 17:53 | borkdude | is removing all contents in the target directory equivalent to "lein clean"? |
| 17:53 | leku | so that took forever.. then I was seeing artifacts in my Xserver |
| 17:53 | technomancy | borkdude: yeah |
| 17:54 | leku | that wouldn't go away |
| 17:54 | borkdude | k\ |
| 17:54 | leku | that was due to the shitty opensource nvidia drivers debian made me roll with, then I tried the nvidia shit |
| 17:54 | leku | totally broke my system, can't get back into x |
| 17:54 | leku | therefor can't get back onto the network cuz gnome does the networking |
| 17:54 | leku | wouldn't even let me get into a virtual tty |
| 17:55 | borkdude | man, 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:55 | technomancy | yeah, it's always worse if you pick the hardware before the OS |
| 17:55 | gtrak | leku: what was wrong with ubuntu? |
| 17:55 | technomancy | borkdude: same problem as bultitude? |
| 17:55 | gtrak | I think your issue with the nvidia is a bad xorg.conf |
| 17:55 | leku | well I ended up installing a ton of stuff and had problems with dependencies, was just easier to reinstall then start backing stuff out |
| 17:55 | leku | and a lot of pple were telling me how great debian was etc |
| 17:55 | borkdude | technomancy similar, I don't know if it is the same, this was smth in ring |
| 17:56 | borkdude | technomancy haven't looked into the detail of ring |
| 17:56 | adu | wow Python and Ruby are the largest source of Clojure converts? |
| 17:56 | leku | it is a fairly new system so I am ok with some trial and error until I find what I like |
| 17:56 | borkdude | technomancy https://github.com/weavejester/compojure/issues/46 |
| 17:56 | technomancy | if you have hardware that requires proprietary drivers I'd expect both Debian and FreeBSD to be pretty lousy |
| 17:57 | leku | ubuntu is probably the best bet for me |
| 17:57 | leku | and I expect to end back up with that |
| 17:57 | technomancy | I've forgotten what it's like to have hardware issues since I started sticking with Intel ~5 years ago. |
| 17:58 | adu | I have intel, and hardware issues |
| 17:58 | adu | the problem is the battery |
| 17:58 | leku | my requirements are pretty small.. good access to software (emacs24, clojure, lein, swank, heroku, etc.), wireless networking, stumpwm, and stability |
| 17:59 | gtrak | is stump like xmonad? |
| 17:59 | leku | freebsd ports ha almost everything i need, and fresh ports has the rest |
| 17:59 | leku | I don't think so |
| 17:59 | cgag | I tried debian but i wasn't really into it. |
| 17:59 | leku | they both might be tiling WMs, but I don't think they're similar |
| 17:59 | cgag | I like arch a lot though. |
| 17:59 | borkdude | technomancy what version of clojure does leiningen/bultitude use? |
| 17:59 | leku | I might give arch a go today |
| 17:59 | technomancy | gtrak: it's as much like xmonad as possible considering it's implemented in CL |
| 17:59 | gtrak | archlinux is great, it replaced the role of debian for me |
| 18:00 | leku | stumpwm has been a pretty awesome WM for me so far |
| 18:00 | gtrak | leku: 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:00 | leku | is it as bad as gentoo? |
| 18:00 | gtrak | way easier |
| 18:00 | cgag | Yeah I was really surprised by how good the wiki is. |
| 18:00 | leku | gentoo was miserable |
| 18:00 | wink | arch is a lot easier to handle than gentoo |
| 18:00 | borkdude | technomancy 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:01 | lpvb | its nothing like gentoo |
| 18:01 | technomancy | if 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:01 | leku | lots of pple piping up about arch |
| 18:01 | gtrak | leku: pacman's pretty good, if you get yaourt (a wrapper) it's better than apt-get imo |
| 18:01 | leku | cool |
| 18:01 | lpvb | pacman is good enough by itself |
| 18:01 | leku | yaourt? |
| 18:01 | leku | or yogurt |
| 18:01 | gtrak | yaourt |
| 18:01 | leku | lol |
| 18:01 | amalloy | gfredericks: the TI89 had all of those creature comforts like functions and variables |
| 18:01 | lpvb | yaourt just compiles packages from the AUR when there isn't a binary package available |
| 18:01 | cgag | yet another something or other |
| 18:01 | leku | damn multiculturalism |
| 18:01 | leku | ah |
| 18:01 | technomancy | borkdude: it's just 1.4 |
| 18:02 | technomancy | I don't imagine that fix made it in if you're seeing this issue still |
| 18:02 | gtrak | yea, 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:02 | amalloy | and i found you could fake them on the TI83+, because you *could* create arrays/lists/whatever with custom names |
| 18:02 | leku | well i'll be damned |
| 18:02 | leku | 4th try with freebsd installer a charm! |
| 18:02 | technomancy | arch doesn't sign their packages =( |
| 18:02 | gtrak | yea it does |
| 18:02 | lpvb | they do |
| 18:02 | wink | it's off by default |
| 18:02 | gtrak | as of a couple months ago |
| 18:02 | wink | but they implemented it, yeah |
| 18:02 | lpvb | it's now basically required |
| 18:02 | cgag | they started recently, i have it off because i'm lazy :\ |
| 18:03 | borkdude | technomancy so I guess this can't be it then? (commit = 6 months ago, clojure 1.4 = 2 or 3 months ago?) |
| 18:03 | leku | the other thing I like about freebsd is beacuse its rather obscure, I'm less of a target for attacks |
| 18:03 | leku | or I'm a harder target anyawys |
| 18:03 | gtrak | leku: I will try to attack you to compensate :-) |
| 18:03 | technomancy | borkdude: oh, perhaps. I'm not following clojure development closely anymore. |
| 18:03 | leku | haha |
| 18:03 | adu | how are ClojureDocs generated? |
| 18:04 | lpvb | there's also the vice versa, leku. Since bsd isn't used as much it's not as tested for exploits |
| 18:04 | leku | heh |
| 18:04 | leku | good point |
| 18:05 | leku | welp |
| 18:05 | gtrak | just don't try slackware |
| 18:05 | gtrak | that leads to pain |
| 18:05 | septomin | i remember installing slackware via floppies |
| 18:05 | leku | I started with slackware |
| 18:06 | leku | kernel version 1.2.13 |
| 18:06 | leku | I think I used 23 floppies? |
| 18:06 | brehaut | adu: the website? |
| 18:06 | ystael | septomin: i remember my parents asking me what the hell i wanted a box of a hundred floppies for |
| 18:06 | leku | actually I had 23 images but 2 floppies |
| 18:06 | leku | it was fun back and forth with rawrite.exe |
| 18:06 | gtrak | i did too, on a 2.4 I think, then I tried to add the gentoo portage to it, like slortage or something |
| 18:06 | brehaut | adu: https://github.com/zkim/clojuredocs its partly from the doc strings, and partly user created content |
| 18:07 | brehaut | s/doc strings/meta data/ |
| 18:07 | gtrak | lol, emerdge, even better |
| 18:07 | gtrak | emerde* |
| 18:08 | leku | sumbitch |
| 18:08 | leku | freebsd is up and working |
| 18:09 | leku | might have to try arch another day :) |
| 18:16 | borkdude | technomancy that commit is in clojure 1.4 for sure |
| 18:17 | technomancy | borkdude: hm; sounds like a red herring then |
| 18:20 | borkdude | yeah… 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:20 | borkdude | could this be because they are loaded by different classloaders? (I have no idea how this works) |
| 18:21 | technomancy | you could try putting more jars on the bootstrap classpath to see if that's the cause |
| 18:21 | borkdude | technomancy how exactly do you mean? |
| 18:22 | borkdude | technomancy you mean in the lein script? |
| 18:23 | technomancy | never mind, I just realized lein.bat doesn't even use the bootstrap classpath o_O |
| 18:23 | technomancy | geez |
| 18:23 | technomancy | that's like an extra 0.5-1s startup penalty for no reason |
| 18:25 | nDuff | What's the var to determine if we're currently AOT compiling? |
| 18:25 | technomancy | ,*compile-files* |
| 18:25 | clojurebot | false |
| 18:25 | technomancy | nDuff: ^ |
| 18:34 | gtrak | they should have called it ubuntu quantal quetzalcoatl |
| 18:40 | borkdude | technomancy the output of all the files on the classpath looks lke this https://gist.github.com/2885180 |
| 18:40 | borkdude | technomancy I want to try your suggestion but don't know exactly what to do |
| 18:41 | borkdude | maybe something gets double encoded |
| 18:41 | technomancy | borkdude: sorry, my suggestion doesn't make sense given what I know about lein.bat now |
| 18:41 | brehaut | im pretty sure .bat files should be referred to as batshit rather than batch files |
| 18:54 | borkdude | technomancy I think I have a fix now... |
| 18:55 | borkdude | lemme test it first before I say anything |
| 19:08 | adu | brehaut: thanks |
| 19:16 | technomancy | does compojure have a convention for making links that pretend to use different verbs? |
| 19:22 | arohner | technomancy: you mean something that looks like a normal link, but POSTs? |
| 19:24 | technomancy | yeah |
| 19:33 | scottj | technomancy: 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:33 | weavejester | technomancy: Yep. It's _method |
| 19:33 | weavejester | technomancy: Same as Rails, IIRC |
| 19:33 | technomancy | weavejester: aha; thanks |
| 19:35 | hiredman | pwd |
| 19:35 | weavejester | technomancy: Note it only works with POSTed forms, since you wouldn't want a GET to become a DELETE or PUT :) |
| 19:35 | hiredman | whoops, pardon |
| 19:37 | technomancy | of course =) |
| 19:37 | technomancy | stupid browser vendors and their refusal to implement this stuff natively =( |
| 19:43 | mebaran151 | anyway to globally disable colorize? the escape sequences don't come through on my emacs swank repl |
| 19:57 | mebaran151 | nDuff: does setting the classloader explicitly in Class/forName help (i.e. Class/forName "klass" true |
| 19:57 | mebaran151 | (i.e. (Class/forName "klass" true plugin-class-loader)) |
| 19:58 | nDuff | Yes, 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:02 | mebaran151 | I think Class/forName uses the callers classloader, so you might have to do some classloader trickery inside ActiveObjects |
| 20:03 | nDuff | Hmm. |
| 20:15 | JorgeB | Is 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:15 | JorgeB | must be just me |
| 20:15 | technomancy | it's got problems |
| 20:15 | phox | a lot of what Google gets up to is inexplicably subpar |
| 20:16 | phox | they manage to get all of the hard parts right and then do things like that. |
| 20:16 | hiredman | JorgeB: the group is moderated, so if it is your first post it can take time to show up |
| 20:16 | technomancy | relevant: https://mobile.twitter.com/nathanmarz/status/193165782568550400 |
| 20:16 | JorgeB | aha, that might explain why it's not showing up, thanks hiredman |
| 20:17 | technomancy | considering moving Leiningen's to librelist; does anyone have opinions on that? |
| 20:17 | JorgeB | I don't know librelist, but it sounds like a wonderful thing to do. |
| 20:17 | metajack | I 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:19 | TimMc | metajack: reify can't extend existing classes, only interfaces and protocols. |
| 20:19 | metajack | Hm. I guess i misinterpreted the example with Object |
| 20:19 | hiredman | and don't use classes without a package |
| 20:19 | hiredman | Object is special |
| 20:22 | metajack | I didn't make this class, it's provided as a .class from an external source, so I can't control that ;( |
| 20:22 | metajack | proxy can't seem to resolve the class name either :( |
| 20:24 | TimMc | metajack: Try importing it. |
| 20:24 | metajack | TimMc: thank you tons ;) |
| 20:24 | TimMc | Did that do it? |
| 20:25 | metajack | yes |
| 20:25 | TimMc | I figured a package-less Java class would exist in a weird twilight state. Is Foo fully-resolved or not? :-P |
| 20:31 | TimMc | ,(.importClass *ns* 'fake.path.Foo java.awt.Color) |
| 20:31 | clojurebot | java.awt.Color |
| 20:31 | TimMc | ,fake.path.Foo/BLACK |
| 20:31 | clojurebot | #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: fake.path.Foo, compiling:(NO_SOURCE_PATH:0)> |
| 20:31 | TimMc | ,(.importClass *ns* 'Foo java.awt.Color) |
| 20:31 | clojurebot | java.awt.Color |
| 20:31 | TimMc | ,Foo/BLACK |
| 20:31 | clojurebot | #<Color java.awt.Color[r=0,g=0,b=0]> |
| 20:32 | TimMc | It 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:39 | metajack | Hm. now I can't get gen-class to see it, imported or not. |
| 20:40 | aperiodic | does it make a difference if you put the gen-class in the body rather than in the ns macro? |
| 20:42 | metajack | no. was just trying that. |
| 20:42 | metajack | I also tried (:import) vs. (import) |
| 20:43 | metajack | gen-class is always looking for java.lang.Foo |
| 20:46 | aperiodic | you could write a java claass that is package-qualified which extends Foo, and then extend that in your gen-class |
| 20:47 | metajack | Ok. I have up and just used a web based decompiler to get the damn source of the class. :) |
| 20:47 | aperiodic | haha, or that |
| 20:48 | metajack | it worked surprisingly well. |
| 20:59 | mefesto | is there an existing way to create a custom error 500 page in compojure or is custom middleware it? |
| 21:00 | weavejester | mefesto: You mean if there's an exception? |
| 21:00 | mefesto | weavejester: yeah just wanted to check if there was an existing middleware function for that or do i need to roll my own |
| 21:02 | weavejester | mefesto: Not in Compojure or Ring, at least not for production. There's just wrap-stacktrace. |
| 21:02 | mefesto | like how there is (ANY "*" [] not-found) for 404. I was thinking maybe there was (ERROR "*" [] blah) |
| 21:03 | mefesto | weavejester: ok, just thought i'd check. thanks. |
| 21:10 | amalloy | (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:11 | mefesto | amalloy: yeah, i just wanted to check if something like that already existed before i went a wrote my own version. |
| 21:12 | Sgeo | How usable is ClojureCLR? |
| 21:42 | cljnewb1234 | this 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:43 | cljnewb1234 | I'm wondering if there is any good tutorial that implements Scala's type system as macros / library in Clojure. |
| 21:47 | aperiodic | i 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:49 | hiredman | aperiodic: I'd recomending ignoring anyone who talks about solving NP problems in P time |
| 21:49 | cljnewb1234 | hiredman: it was meant as a joke |
| 21:55 | aperiodic | hiredman: i figured it was tongue-in-cheek. i like to give people the benefit of the doubt. |
| 21:58 | cljnewb01234 | yes ... 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:00 | cljnewb01234 | can you solve 3SAT in sub linear time? |
| 22:00 | Hodapp | doubt it. |
| 22:01 | Hodapp | it's just static typing. |
| 22:01 | Hodapp | some 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:02 | cljnewb01234 | (not saying this because I'm in #clojure rather than #haskell); I'm actually starting to find protocols more modular than types |
| 22:03 | Hodapp | but the type system in Scala is quite nice compared to Java/C++ - does decent type inference and such |
| 22:03 | cljnewb01234 | particularly because protocols allow me to hide the underlying implementing type, whereas types force me to reveal the names of the variables |
| 22:03 | Hodapp | I don't yet know anything about protocols in this context. |
| 22:03 | cljnewb01234 | I'm referring to defprotocols |
| 22:05 | Hodapp | my secret is that I hardly know Clojure, I just chill here because the conversations can be interesting |
| 22:06 | cljnewb01234 | i'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:06 | cljnewb01234 | well, maybe we are different, since I probably annoy people more |
| 22:06 | Hodapp | o_O |
| 22:07 | cljnewb01234 | I'm currently reading (source distinct). What does (fn [[f :as xs] seen] ... ) mean? |
| 22:07 | cljnewb01234 | I don't understand the [[f :as xs] seen] notation |
| 22:08 | brehaut | cljnewb01234: thats a destructuring |
| 22:08 | aperiodic | that's destructuring syntax; see the documentation for let at http://clojure.org/special_forms |
| 22:08 | brehaut | though that particular destructuring seems a little odd |
| 22:08 | brehaut | oh wait no its not |
| 22:08 | cljnewb01234 | yeah ... so "f" is bound to "as" ? |
| 22:09 | brehaut | nope |
| 22:09 | cljnewb01234 | wait wait let me figure this out |
| 22:09 | cljnewb01234 | f, and xs are both bound to the contents of seen |
| 22:09 | brehaut | theres 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:10 | cljnewb01234 | [f :as xs] == [f & _ :as xs] ? |
| 22:10 | brehaut | yeah |
| 22:10 | brehaut | if you are trying to work out what a destructuring would do, the function destructure is sometimes really helpful |
| 22:10 | brehaut | its used internally by the various macros that destructure |
| 22:10 | cljnewb01234 | it's the equiv of macroexpand-1 ? :-) |
| 22:11 | brehaut | but only of the destructuring bit |
| 22:11 | brehaut | ,(destructure '[[f :as xs] [1 2 3]]) |
| 22:11 | clojurebot | [vec__29 [1 2 3] f (clojure.core/nth vec__29 0 nil) xs ...] |
| 22:12 | cljnewb01234 | clojurebot's output is not helpful ... |
| 22:12 | brehaut | thats simply a binding form (eg from a let) |
| 22:12 | cljnewb01234 | oh I see |
| 22:12 | cljnewb01234 | vec__20 is [1 2 3] |
| 22:12 | cljnewb01234 | f is bound to the nth, 0 of that |
| 22:12 | brehaut | yeah |
| 22:12 | cljnewb01234 | and okay ... cool |
| 22:12 | brehaut | that ellipsis is just vec__29 |
| 22:15 | Hodapp | cljnewb01234: you might consider asking in #scala, though. |
| 22:16 | Hodapp | they likely won't be angry. |
| 22:20 | cljnewb01234 | let's see how long until I get kicked for my nick |
| 22:20 | cljnewb01234 | at least it's not something like clojure>scala |
| 22:21 | Hodapp | cljnewb01234: it's not like #c or #c++ |
| 22:21 | Hodapp | they're not gonna care |
| 22:22 | Hodapp | they don't have the victim complex some of those channels do when they realize their languages are horrid atrocities |
| 22:22 | cljnewb01234 | lol |
| 22:22 | cljnewb01234 | I do have to admit -- that not getting segmentation faults all over the place has made of less angry of a person. |
| 22:22 | Hodapp | I'm fine with coding in C, but C++ and Java just irk me in a lot of ways. |
| 22:22 | cljnewb01234 | the nicety of the JVM + java libraries has made me a more calm person |
| 22:23 | cljnewb01234 | I don't think I can ever return to ./configure && make && WTF why does library version XYZ not work with blah blah blah ABC |
| 22:23 | Hodapp | my degree is in EE and I've done my share of embedded programming |
| 22:24 | Hodapp | yeah, that can be a pain, though unfortunately other languages are hardly immune |
| 22:24 | cljnewb01234 | doesn't EE train you to be happy when your variables maintain their value without having to be refreshed? |
| 22:24 | Hodapp | nah, 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:25 | cljnewb01234 | does Clojure support things like guards? i.e. I want to define (fn [x] .... (x == nil ==> ... ) (otherwise ...) ) ... i.e. an implicit bond ? |
| 22:25 | cljnewb01234 | s/bond/cond/ |
| 22:27 | aperiodic | you could use (or x ...) |
| 22:27 | cljnewb01234 | I think I'm after clojure.core.match |
| 22:27 | aperiodic | oh no, not at all |
| 22:27 | cljnewb01234 | except it appears still to be in alpha astage |
| 22:27 | aperiodic | my thing |
| 22:27 | cljnewb01234 | why not clojure.core.match? |
| 22:27 | aperiodic | no, the (or x ...) is not what you want at all |
| 22:30 | aperiodic | it'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:31 | cljnewb01234 | actually, i'm an idiot |
| 22:31 | cljnewb01234 | what I want is pattern matching |
| 22:31 | cljnewb01234 | the question now is ... what library to use: |
| 22:31 | aperiodic | ok, yeah, clojure.core.match is what you want then |
| 22:31 | cljnewb01234 | core.match looks like it's good (it's in org.clojure/core) ... but it's alpha software and claims it has known issues |
| 22:35 | aperiodic | well, 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:59 | alex_baranosky | does anyone have a good lazy implementation of segregate (remove/filter side by side)? |
| 23:03 | tmciver | alex_baranosky: Hey there! Do you mean separate? (def separate (juxt filter remove)) |
| 23:05 | alex_baranosky | just uses reduce internally |
| 23:05 | alex_baranosky | I think that will mean the seq gets realized |
| 23:05 | alex_baranosky | though if I'm wrong, that is a very nice implementation of separate |
| 23:06 | tmciver | Yeah, 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:07 | alex_baranosky | also, the just veha |
| 23:07 | alex_baranosky | oops, that didn't make sense.... |
| 23:07 | alex_baranosky | I'll give it a try, thanks! |