2012-11-02
| 00:00 | frenchyp | ok, thanks for clearing that out |
| 00:10 | brainproxy | best practices for exception messages? |
| 00:11 | brainproxy | i.e. should they (never) contain line breaks? maximum length? |
| 00:26 | jkkramer | brainproxy: no advice from me re messages, but you might consider using ex-info to include relevant data in the exception for the caller to check out |
| 00:29 | TimMc | See notes on slingshot. |
| 00:36 | brainproxy | jkkramer: thanks |
| 00:36 | brainproxy | TimMc: slingshot looks awesome, need to remember to make a study of it |
| 01:20 | myguidingstar | xeqi: thank you so much. I've written a very first repl |
| 01:20 | xeqi | myguidingstar: hurray! |
| 02:30 | ForSpareParts | Does Clojure code get cached somehow by clojure.lang.Compiler? |
| 02:30 | ForSpareParts | It looks like my Java program is running an old version of my Clojure code, but I don't know why. |
| 02:38 | amalloy | AOTed code lives on disk, and its compilation is generally pretty mysterious. lein clean will get rid of it |
| 02:45 | ForSpareParts | amalloy, How can I load a file on demand? |
| 02:46 | ForSpareParts | Like outside of the classpath? |
| 02:47 | ForSpareParts | I tried Compiler.loadFile(), but as you pointed out, that's getting me AOT'd code. |
| 04:22 | wingy | is there a way to make an xml string without the <xml> tag https://www.refheap.com/paste/6336 |
| 04:34 | _ulises | wingy: any reason why you'd want that? is it to compose xml snippets? |
| 04:34 | wingy | _ulises: im going to send xml in a http request for a service and its documentation shows xml without the xml tag |
| 04:35 | _ulises | wingy: strange; have you tried sending the xlm with the <xml...> and seeing if the service complains? perhaps the <xml...> bit was omitted from the documentation for brevity |
| 04:36 | wingy | _ulises: perhaps they accept without xml? |
| 04:36 | _ulises | wingy: in any case, you could try generating the xml using hiccup |
| 04:37 | wingy | yeah that would be as good |
| 04:37 | wingy | easier to write since you don't have to use xml/element to create it |
| 04:38 | amalloy | you don't have to use xml/element for data.xml either |
| 04:38 | _ulises | amalloy to the rescue! \o/ |
| 04:38 | amalloy | i added sexp-as-element to data.xml, which takes hiccup-style vectors |
| 04:39 | wingy | amalloy: in what version? i get an error while trying that |
| 04:40 | amalloy | *shrug* |
| 04:40 | amalloy | (and if you're using clojure.xml for anything...god help you. use clojure.data.xml, or any other viable tool) |
| 04:40 | wingy | im using clojure.data.xml |
| 05:37 | maleghast | Morning All... |
| 05:40 | ejackson | morning |
| 05:41 | maleghast | Anything exciting happening today? |
| 05:41 | _ulises | morning |
| 05:41 | maleghast | I mean it __is__ Friday ;-) |
| 06:19 | hyPiRion | It's the last day before tomorrow, if that counts for anything. |
| 06:30 | wingy | huh? |
| 06:31 | Raynes | *whoosh* |
| 06:35 | ejackson | whooooooosh |
| 06:35 | ejackson | i'm enjoying your enthusiasm there Raynes |
| 06:35 | Iceland_jack | Are you? |
| 06:36 | ejackson | i'm a big fan of enthusiasm |
| 06:40 | _ulises | I'm just an enthusiast of enthusiasm |
| 06:40 | _ulises | *badum tish* |
| 06:41 | ejackson | well done. |
| 07:03 | Cheiron | Hi, I want to add Maven Central repo to project.clj to get http://search.maven.org/#artifactdetails%7Corg.apache.zookeeper%7Czookeeper%7C3.3.2%7Cjar |
| 07:03 | Cheiron | what is the address of it? |
| 07:17 | jakubH | Cheiron: I believe that maven central is checked by lein by default |
| 07:26 | clgv | jakubH: Cheiron: yes, maven central is a default repository that is checked by leiningen |
| 07:27 | Cheiron | clgv: jakubh: then I don't know why it is complaining when getting zookeeper's Sun's jmx jars |
| 07:27 | clgv | Cheiron: well, what exactly does it complain? |
| 07:27 | Cheiron | Thanks by the way! |
| 07:27 | Cheiron | it can't get jmxri and jmxtools |
| 07:27 | clgv | Cheiron: most likely you have an error in [group-id/artifact-id version] |
| 07:27 | jakubH | there are always problems with things like the jmx jars; dtailed log of the error would help |
| 07:28 | Cheiron | will install them manually |
| 07:28 | jakubH | if you have maven, you can also run lein pom and mvn -X dependency:resolve to get detailed error messages |
| 07:28 | clgv | Cheiron: I dont see any direct dependency named "jmx..." in that POM |
| 07:29 | jakubH | Cheiron: you might also try to add the java.net repo as shown in https://github.com/technomancy/leiningen/blob/master/sample.project.clj |
| 07:30 | Cheiron | I will, thanks fellas |
| 07:33 | jakubH | java.net doesn't help |
| 07:33 | Cheiron | meh, [org.apache.zookeeper/zookeeper "3.3.2"] needs jmx libs somehow |
| 07:33 | jakubH | the problem with Sun is that these stupid libs are under a license that doesn't allow them being in maven central |
| 07:34 | jakubH | here is it described: http://onemanwenttomow.wordpress.com/2007/12/31/maven2-log4j-and-jmx-dependencies/ |
| 07:35 | jakubH | the same here http://stackoverflow.com/questions/7323248/coludnt-find-the-following-dependencies-com-sun-jmxjmxrijar1-2-1-and-com-su |
| 07:35 | jakubH | really extreme pain imposed by Sun+Oracle on the poor world :( |
| 07:41 | Cheiron | jakubH: Thanks fella! |
| 07:45 | jakubH | yw |
| 08:13 | mklappstuhl | https://www.refheap.com/paste/6339 |
| 08:19 | xeqi | mklappstuhl: mean-daily-returns calls (daily-returns (:etf trade)) |
| 08:19 | xeqi | which eventually gets to parse-file, which does :etf again |
| 08:20 | mklappstuhl | xeqi, man you were fast I was still writing (got distracted then) |
| 08:20 | mklappstuhl | xeqi, thank you |
| 08:23 | mklappstuhl | xeqi, how would you approach/debug this kind of issue beside looking at the code? It's hard to tell where stuff fails with clojure sometimes |
| 08:26 | xeqi | mklappstuhl: I've heard about debuggers like https://github.com/pallet/ritz or the one in eclipse, but I usually manually walk it or stick printlns in |
| 08:28 | xeqi | for example here, println in parse-file to make sure trade is nil, then println in daily-returns and see that trade is nil, then see (:etf trade) in mean-daily-returns |
| 08:28 | xeqi | for more complex things the call stack is invaluable |
| 09:14 | shriphani | hello everyone. I have a question about how somethings in scheme map to clojure. I remember that I could place several defines inside a function definition and use them in the function body. Apart from (let [foo (fn [x]…))) is there a better way to do something about internal functions that don't fit in a line ? |
| 09:23 | swarmer | shriphani: letfn ? |
| 09:23 | shriphani | swarmer: thanks. |
| 09:57 | Cheiron | any good libraries to work with HTTP in clj? |
| 09:58 | _ulises | Cheiron: try clj-http |
| 09:58 | Cheiron | any another funky cool lib? |
| 10:02 | notsonerdysunny | is there a way to have lein2 not check for the project dependencies from the web.. because I know they are already there in the local "~/.m2" cache .. and some of them are installed by me using "lein localrepo" .. this additional checking unnecesarrily delays starting of swank |
| 10:04 | cemerick | notsonerdysunny: use `lein -o …` for offline mode |
| 10:05 | MasseR | What's the library name for pattern matching? |
| 10:05 | xeqi | core.match |
| 10:06 | MasseR | Thanks |
| 10:07 | notsonerdysunny | thanks cemerick |
| 10:07 | notsonerdysunny | I am not able to get how to run lein2 swank-wrap .. I have already set the :main namespace in the project.clj so I tried "lein2 swank-wrap [4005]" with no success .. can you please help? |
| 10:09 | notsonerdysunny | specifying the namespace again on the lein2 commad helped me run lein2 swank-wrap 4005 <main-ns> |
| 10:09 | notsonerdysunny | thanks |
| 10:11 | alexnixon | Does a function already exist in clojure which can replace the anonymous fn here (essentially a non-variable-args version of 'apply')?: (condp #(%1 %2) 42 nil? "nil!" number? "number!") |
| 10:13 | alexnixon | (I can see other ways of writing this to achieve the same effect but I'm just interested whether this fn exists) |
| 10:17 | mklappstuhl | xeqi, how would I access the call stack? |
| 10:18 | _ulises | alexnixon: why not use (comp apply vector)? |
| 10:18 | _ulises | alexnixon: I know that wasn't your question though :) |
| 10:20 | alexnixon | ,(condp (comp apply vector) 42 nil? "nil!" number? "number!") |
| 10:20 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$apply> |
| 10:20 | _ulises | oh, it'd have to be the other way around |
| 10:20 | _ulises | I mean, reverse ... never mind, ignore me |
| 10:21 | alexnixon | _ulises: you can get close using apply with (condp apply [42] nil? "nil!" number? "number!") |
| 10:22 | _ulises | hrmph |
| 10:25 | Gmind | why (defn factorial2 [acc n] |
| 10:25 | Gmind | (if (< n 2) |
| 10:25 | Gmind | acc |
| 10:25 | Gmind | (recur (* acc n ) (dec n)))) will run for (factorial2 1 20) without overflow but larger will be trouble ? |
| 10:25 | Bronsa | mi sta venendo il cancro |
| 10:25 | Bronsa | ops. wrong chan. |
| 10:25 | solussd | Gmind: use *' instead of * |
| 10:26 | solussd | it'll auto-promote to BigNums |
| 10:26 | Gmind | while (defn factorial [n acc] (if (< n 2) acc (recur (dec n) (* acc n)))) will be able to get to > 5000 |
| 10:26 | solussd | Gmind: also, it should never be overflowing, you should be getting an overflow exception |
| 10:27 | Gmind | Yep, it's an exception |
| 10:28 | Gmind | ArithmeticException integer overflow |
| 10:28 | clgv | Gmind: the long type is finite. so if you exceed it you get an exception. with *' clojure will convert the long to a BigInt which can have arbitrary size |
| 10:29 | solussd | yeah, BigInt, not BigNum. |
| 10:31 | Gmind | clgv mean "cai l*n gi vay" ? |
| 10:32 | Gmind | solussd: what's the difference ? |
| 10:32 | clgv | Gmind: hwat? |
| 10:32 | Gmind | what's your nick mean ? |
| 10:32 | Gmind | I just guess its meaning |
| 10:32 | mklappstuhl | I'm generating a list of hashmaps here but I'd like to have these sorted by one field ... |
| 10:32 | clgv | nothing special |
| 10:32 | solussd | one is for ints, the other for floats, etc |
| 10:32 | mklappstuhl | how would I use something like sorted-map in this case? |
| 10:32 | mklappstuhl | https://github.com/mklappstuhl/computational-investing.clj/blob/master/src/mklappstuhl/stock_utils/data.clj#L31 |
| 10:32 | clgv | mklappstuhl: sort-by |
| 10:34 | clgv | &(sort-by :b [{:a 10 :b 1} {:a 2 :b 2} {:a 8 :b 3} {:a 1 :b 4}]) |
| 10:34 | lazybot | ⇒ ({:a 10, :b 1} {:a 2, :b 2} {:a 8, :b 3} {:a 1, :b 4}) |
| 10:34 | clgv | &(sort-by :a [{:a 10 :b 1} {:a 2 :b 2} {:a 8 :b 3} {:a 1 :b 4}]) |
| 10:34 | lazybot | ⇒ ({:a 1, :b 4} {:a 2, :b 2} {:a 8, :b 3} {:a 10, :b 1}) |
| 10:40 | Gmind | clgv: thank for *', that really work |
| 10:41 | clgv | Gmind: the main problem with faculty is that it grows so fast ;) |
| 10:42 | Gmind | I'm new to Clojure, as on the way exploring its feature, and I stopped at this Recur keyword for a while. Must be me way too familiar with the old recur way |
| 10:43 | clgv | "old recur way"? |
| 10:53 | Gmind1 | clgv: like non-tail recursion |
| 10:56 | solussd | part of me likes the fact that I must be explicit in performing tail call recursion, rather than knowing that certain seemingly inefficient code will be optimized into tail call recursion by the compiler (like in scheme) |
| 11:05 | Gmind1 | solussd: as paul said somewhere if I can remember right, he said that writing code is what developer responsible for, optimization is what compiler made for. |
| 11:06 | Gmind1 | .. anyway, just laughing so much when reading this http://c2.com/cgi/wiki?WhyWeHateLisp =] |
| 11:06 | solussd | Gmind1: and I wholeheartedly agree-- that said, i dont want to have to avoid recursive calls altogether b/c i dont know weather or not they;ll blow up. if I explicitly make a tail call in a way I know is "safe", I'll use more tail calls. :D |
| 11:07 | Gmind1 | some reasons are very ridiculous |
| 11:07 | solussd | *whether |
| 11:07 | MasseR | The match library has a warning that it's alpha quality and shouldn't be used with aot. Does 'lein uberjar' aot compiling? |
| 11:08 | Gmind1 | that's right . I just feel it's not straight forward sometimes =.=" |
| 11:09 | jweiss | can someone recommend a way to log to a different file for each thread in the system? seems inefficient to have one function look up the current thread name and rebind *out* to a FileOutputStream to the thread's file every time a log statement is written. |
| 11:10 | jweiss | and using a binding form doesn't work either, because of futures and binding conveyance |
| 11:13 | clgv | MasseR: if you specify a :main class with a "-main" function then there will be AOT compiling |
| 11:14 | clgv | jweiss: you could use java's ThreadLocal class |
| 11:15 | clgv | jweiss: that one will call an initialize method for every thread it was not used yet |
| 11:19 | MasseR | clgv: Ok thanks |
| 11:31 | clgv | How do I get something more detailed than "Error loading project.clj" from lein2? |
| 11:40 | ambrosebs | Pretty cool example of what occurrence typing/heterogeneous maps helps Typed Clojure infer https://gist.github.com/4001974 |
| 11:42 | Anderkent | clgv: run with DEBUG set |
| 11:42 | Anderkent | clgv: DEBUG= lein <command> |
| 11:43 | clgv | Anderkent: thx |
| 11:45 | pjb3 | Hey, I have a clojure app where I'd like it to connect to one database if it's running tests and a different database otherwise |
| 11:46 | pjb3 | is there a way to set an env var or something when you run lein test? |
| 11:46 | pjb3 | I mean, I could do APP_ENV=test lein test |
| 11:46 | egghead | I usually use bindings for that pjb3, something like (with-dev-db (db stuff)) |
| 11:46 | pjb3 | but it seems like there must be a conventional solution to this already |
| 11:47 | egghead | I'm not sure if it's the best solution, but having stuff like *dbhost* and *dbport* be dynamically bound has worked for me |
| 11:47 | pjb3 | egghead: but how do you make the binding behave differently depending on if you run lein test vs. if you are just running the code in lein repl |
| 11:48 | stack | hello, I was wondering why about this strange code https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RestFn.java |
| 11:49 | egghead | lein test is hard coded to use the test bindings, lein repl I use whatever bindings I want |
| 11:49 | alexnixon | pjb3: I've used midje's 'around' form for that in the past |
| 11:51 | pjb3 | egghead: how is lein test hard coded to use the test bindings? |
| 11:52 | pjb3 | like, in every test you surround it in (with-dev-db)? |
| 11:53 | egghead | ya |
| 11:53 | egghead | again, probably not the coolest/cleanest way to do it, just what i've done in the past :) |
| 11:58 | alexnixon | egghead: AIUI that's an idiomatic solution |
| 11:59 | egghead | good to know |
| 12:01 | pjb3 | not a fan of wrapping every call in the tests in a macro |
| 12:03 | pjb3 | I know it's heresy in the Clojure community, but a global var is a better solution then bindings that are dynamically scoped at a high-level, IMO |
| 12:03 | alexnixon | pjb3: you could consider using midje: look at the sql example example under "The longer version" https://github.com/marick/Midje/wiki/Setup%2C-Teardown%2C-and-State |
| 12:04 | dnolen | pjb3: it just depends. |
| 12:12 | pjb3 | starting to think APP_ENV=test lein test isn't such a bad solution :) |
| 12:12 | technomancy | pjb3: typically you would load test-specific config from the test-resources directory, which is only on the classpath during test |
| 12:13 | pjb3 | test-resources? |
| 12:13 | technomancy | you don't need any special support from your testing lib just to change the DB connection parameters |
| 12:14 | pjb3 | technomancy: is there an example of this somewhere? |
| 12:15 | technomancy | pjb3: all the projects I've worked on have used the same config for dev/test and just pulled in special config during production from the deployment mechanism |
| 12:15 | technomancy | so I don't know off the top of my head |
| 12:16 | pjb3 | technomancy: what did you mean by test-resources directory, like test/resources/dbconfig.clj or something? |
| 12:17 | technomancy | no, just test-resources/config.clj |
| 12:18 | pjb3 | what is test-resources? Is that a leiningen thing? |
| 12:18 | technomancy | yeah |
| 12:18 | pjb3 | is that mentioned in the docs somewhere? |
| 12:18 | joegallo | technomancy: i work on a project like that, we do the same thing. |
| 12:19 | technomancy | pjb3: dev-resources certainly is... not sure about test-resources |
| 12:19 | technomancy | joegallo: you don't say? |
| 12:19 | bobbrahms | I have this large java maven spring project that I'd like to use clojure with. I'm using clojure-maven-plugin. The existing java build builds classes into target/classes. When I mvn clojure:compile I get ClassNotFound exceptions where I refer to my java classes. How do I tell the clojure-maven-plugin where to look for my java classes? |
| 12:19 | joegallo | small world |
| 12:21 | technomancy | https://github.com/Seajure/metaverse/blob/master/test/metaverse/nser.clj |
| 12:22 | technomancy | ^ nix for namespaces |
| 12:26 | egghead | i've been doing that scala course by odersky, its making me appreciate clojure more and more |
| 12:28 | dnolen_ | low hanging CLJS fruit for somebody w/ CA who wants to help out - fix Herwig's patch for CLJS-401, then we can cut a new CLJS release - http://dev.clojure.org/jira/browse/CLJS-401 |
| 12:29 | bobbrahms | Can anyone tell me how to tell clojure-maven-plugin where to look for my java class files? |
| 12:29 | bobbrahms | or point me in the right direction? |
| 12:30 | bobbrahms | I'm trying to add clojure to my spring project, but the plugin doesn't seem to know where my java class files are. |
| 12:31 | technomancy | bobbrahms: the guy who knows clojure-maven-plugin lives in new zealand, so you're not likely to get a response for another few hours just fyi |
| 12:32 | bobbrahms | Thanks for the info! |
| 12:44 | Anderkent | bobbrahms: can you do clojure:repl and print out the classpath? See if target/classes is on it (it should). |
| 12:48 | qubit[01] | !paste |
| 12:48 | qubit[01] | (paste) |
| 12:49 | qubit[01] | Hi all, Im new to clojure, I have a file that im parsing whose 4th and 3rd columns are high and low temperature, how would I store the smallest spread ? http://pastebin.com/0BANKrmF |
| 12:49 | qubit[01] | Im struggling with how to set the variable, I know (min ), just how do I assign it to something to return ? |
| 12:51 | S11001001 | qubit[01]: you can't set variables |
| 12:51 | S11001001 | &(doc min) |
| 12:51 | lazybot | ⇒ ------------------------- clojure.core/min ([x] [x y] [x y & more]) Returns the least of the nums. nil |
| 12:51 | S11001001 | qubit[01]: be prepared for a completely different way of problem solving than what you're used to |
| 12:51 | S11001001 | &(doc line-seq) |
| 12:51 | lazybot | ⇒ ------------------------- clojure.core/line-seq ([rdr]) Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader. nil |
| 12:51 | S11001001 | &(doc map) |
| 12:51 | lazybot | ⇒ ------------------------- clojure.core/map ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in ea... https://www.refheap.com/paste/6342 |
| 12:51 | S11001001 | &(doc apply) |
| 12:51 | lazybot | ⇒ ------------------------- clojure.core/apply ([f args] [f x args] [f x y args] [f x y z args] [f a b c d & args]) Applies fn f to the argument list formed by prepending intervening arguments to args. nil |
| 12:52 | S11001001 | qubit[01]: everything I just asked lazybot about are your essential tools to solve your probelm |
| 12:52 | S11001001 | problem |
| 12:52 | qubit[01] | hmm |
| 12:53 | Anderkent | qubit[01]: you might want to make a function that given a filename returns a list of differences between 3rd and 4th column values |
| 12:54 | qubit[01] | ahh ok, thanks :) |
| 12:54 | Anderkent | qubit[01]: then having that list you can reduce it the smallest one using min |
| 12:54 | qubit[01] | coolio, I'm working through codekata to try to learn clojure |
| 12:54 | S11001001 | &(min 2 3 1 4 5 7 32) |
| 12:54 | lazybot | ⇒ 1 |
| 12:54 | Anderkent | have fun :) |
| 13:00 | jro | (defn lz[i] (cons i (lz (lazy-seq (inc i))))) (take 3 (lz 3)) |
| 13:00 | jro | StackOverflowError ontrail.core/lz/fn--408 (NO_SOURCE_FILE:31) |
| 13:02 | rjo | I do not see problem in my lazy sequence ^ |
| 13:07 | raek | rjo: (assuming you are "jro") you should write it as (defn lz [i] (lazy-seq (cons i (lz (inc i))))) |
| 13:08 | raek | that is, lazy-seq wraps a seq (here a cons) and delays it |
| 13:10 | rjo | thanks! I was looking the documentation in (defn lz [i] (lazy-seq (cons i (lz (inc i))))) |
| 13:10 | rjo | http://clojuredocs.org/clojure_core/clojure.core/lazy-seq |
| 13:10 | rjo | sorry |
| 13:11 | rjo | is this somehow releted to (clojure-version) |
| 13:11 | rjo | "1.4.0" |
| 13:11 | rjo | since the documentation is for 1.3 |
| 13:11 | Anderkent | Anyone using REPL-y had an issue where ctrl-c while entering multiline statements messes up your terminal? |
| 13:12 | raek | rjo: you can also write it like this: (defn lz [i] (cons i (lazy-seq (lz (inc i))))) |
| 13:12 | raek | but then the first step is not lazy |
| 13:12 | Anderkent | rjo: in general your recursion must be within lazy-seq |
| 13:12 | raek | rjo: in your example you had the lazy-seq around the argument to lz, not around the (lz ...) expression) |
| 13:19 | rjo | oh, thanks. I was blind. |
| 13:24 | bobbrahms | Anderkent: The directory is in the classpath. I see where my error is, I have the class in a different place than it should be. Thanks! |
| 13:25 | Anderkent | Glad you figured it out. |
| 13:25 | qubit[01] | how do I get this http://pastebin.com/mQsjcJHT to work, its just returning the entire list instead of the max entry in the list |
| 13:25 | qubit[01] | is there a spread operator in clojure ? |
| 13:26 | alexnixon | ,(doc apply) |
| 13:26 | clojurebot | "([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args." |
| 13:27 | rjo | is it generally a good pattern in clojure to define lazy seqs? |
| 13:28 | technomancy | rjo: depends what "define lazy seqs" means? |
| 13:28 | rjo | well, in this case I wanted to create time intervals consisting of weeks |
| 13:29 | rjo | so I wrote: |
| 13:29 | rjo | (defn from [date-time] (cons (week-period date-time) (lazy-seq (from (time/plus date-time (time/days 7)))))) |
| 13:29 | rjo | (defn n-weeeks-from [date-time n] (take n (from date-time))) |
| 13:29 | qubit[01] | any critiques on this http://pastebin.com/Kv2LdgYg ? Gets the lowest temperature spread from a column based file |
| 13:29 | technomancy | calling lazy-seq directly is usually unnecessary unless you're writing very low-level code |
| 13:30 | TimMc | Really? |
| 13:30 | mpan | Is there an approximate equivalent to the programming style of http://hackedbellini.org/development/writing-asynchronous-python-code-with-twisted-using-inlinecallbacks/ for doing evented code in Clojure? |
| 13:31 | TimMc | If by "low-level" you mean "helper fns", sure. |
| 13:31 | rjo | technomancy, do you mean that (n-weeks-from [date-time n] ... (map (partial * 7) (range 0 n)) is better? |
| 13:32 | technomancy | rjo: probably, yeah |
| 13:32 | mpenet | mpan: Lamina is probably what you are looking for |
| 13:33 | technomancy | TimMc: I've only written a lazy-seq directly once, and even that I realized three hours later could be expressed in terms of for |
| 13:33 | mpan | And sort-of related to the previous question: Is there a way to make a "generator"? i.e. some value that can be called and maintains internal execution state between calls |
| 13:33 | mpan | mpenet: I'll look into that. Thanks! |
| 13:33 | TimMc | mpan: lazy-seq :-) |
| 13:33 | raek | mpan: lazy sequences and functions closing over atoms can both be used for that |
| 13:34 | S11001001 | &(doc reductions) ;mpan, or what TimMc said |
| 13:34 | lazybot | ⇒ ------------------------- clojure.core/reductions ([f coll] [f init coll]) Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init. nil |
| 13:34 | raek | 'iterate' can be worth checking out too |
| 13:34 | mpan | Those take explicit state passed in and out? |
| 13:34 | rjo | is there any other differences in those two, other than just the style? |
| 13:35 | S11001001 | mpan: yep |
| 13:35 | raek | mpan: yes, state is "updated" via recursion |
| 13:35 | mpan | But is there a way to write code such that an expression "yields" multiple values as it gets called multiple times? |
| 13:35 | mpan | Or is that stylistically non-idiomatic? |
| 13:35 | S11001001 | mpan: that is stylistically verboten. |
| 13:35 | raek | (lazy-seq ...) is kind of like yield |
| 13:35 | S11001001 | mpan: referential transparency is greatly favored |
| 13:35 | technomancy | mpan: if you have multiple values, you should use a seq |
| 13:35 | mpan | All right. Thanks so much, you all! |
| 13:37 | Anderkent | qubit[01]: looks okay, you can use % instead of %1 in your lambda if you only have one arg in it. You might also want to use split-lines instead of split, unless you really only want \n and not \r\n. |
| 13:37 | qubit[01] | Anderkent, ok both good suggestions :) |
| 14:02 | qubit[01] | who would I return a range in a list, like arr[5 .. 12] ? |
| 14:02 | qubit[01] | which would return elements 5 - 12 as a new list |
| 14:02 | dgrnbrg | qubit[01]: are you using vectors or sequences? |
| 14:02 | technomancy | qubit[01]: take/drop |
| 14:02 | dgrnbrg | or subvec |
| 14:03 | qubit[01] | vectors |
| 14:03 | qubit[01] | ok cool |
| 14:06 | xeqi | mklappstuhl: you could (throw (Exception. "forced exception")) or such when the :eft in the case your paste had. There are other ways, but thats the easiest |
| 14:07 | TimMc | qubit[01]: NB: subvec just does index arithmetic on the original vector (and thus keeps a pointer to the whole thing). |
| 14:32 | qubit[01] | any critiques on this binary search in clojure ? Doesnt quite feel right http://pastebin.com/9mi9f1ti |
| 14:35 | S11001001 | qubit[01]: change bsearch calls to "recur" instead |
| 14:35 | qubit[01] | ,(recur) |
| 14:35 | TimMc | qubit[01]: You're using a random-access algorithm on a sequential-access data structure. |
| 14:36 | clojurebot | Execution Timed Out |
| 14:36 | S11001001 | qubit[01]: also remember that `if' is like ternary op, not a "statement" |
| 14:36 | qubit[01] | ,(doc recur) |
| 14:36 | clojurebot | No entiendo |
| 14:36 | nDuff | qubit[01]: ...by the way, please consider using a pastebin without the flashy animated ads in the future. gist.github.com and refheap are both good. |
| 14:36 | technomancy | nDuff: how many times is this going to happen before you break down and submit a lazybot pull request? =) |
| 14:36 | S11001001 | qubit[01]: and refheap is clojurian so it's all dogfoody |
| 14:37 | TimMc | mmm, dogfood |
| 14:37 | qubit[01] | kk thanks all |
| 14:37 | qubit[01] | https://www.refheap.com/paste <-- much prettier |
| 14:37 | nDuff | technomancy: Heh. Last time I looked at lazybot's source, I didn't see a bunch of known existing triggers there -> assumed they were out-of-band somewhere, and didn't want to dig. |
| 14:38 | technomancy | nDuff: annoyance is a powerful motivator though |
| 14:38 | qubit[01] | TimMc, what is a random access data structure in clojure ? |
| 14:38 | TimMc | vector |
| 14:40 | qubit[01] | coolio |
| 14:45 | TimMc | nDuff: Oh those args... that must be for hinting, yeah? |
| 14:47 | nDuff | TimMc: Hard to have hinting work right if you don't know the object you're going to be invoked against until runtime... and why not take class/type names, then, rather than meaningless names? |
| 14:49 | TimMc | &(let [& 5] ((fn [&] &))) |
| 14:49 | lazybot | ⇒ 5 |
| 14:54 | dnolen_ | bbloom: CLJS-401 resolved |
| 14:54 | egghead | is there something like 'some' that will return the found item rather than just returning true or false? |
| 14:55 | egghead | i.e. return the first thing in the collection to satisfy th epredicate |
| 14:55 | technomancy | egghead: (comp first filter) |
| 14:55 | egghead | hmm, and so because first is lazy it won't filter the entire collection? |
| 14:56 | egghead | pretty nice... thanks technomancy |
| 14:56 | technomancy | sure |
| 14:56 | technomancy | might be more complicated with chunked sequences |
| 14:57 | egghead | hmm, swapping out (comp first filter) with some worked... now to try to wrap my head around how that composition works... |
| 14:57 | bbloom | dnolen_: good |
| 15:01 | TimMc | &(let [& 0 ampers (memfn assoc & _)] (ampers [1 2 3] 'first 'place)) |
| 15:01 | lazybot | ⇒ [(first place) 2 3] |
| 15:05 | amalloy | you are a sneaky devil, TimMc |
| 15:14 | callen | oh herro UnicodeDecodeError, long time no see. |
| 15:16 | TimMc | amalloy: I'm actually rather dissatisfied with it. I feel like it could be more compact and misleading. |
| 15:16 | TimMc | It's not immediately counterobvious enough to be cute. |
| 15:18 | Bronsa | playing with the clojure compiler http://i.imgur.com/vagyp.png |
| 15:25 | lynaghk | dnolen_: ping |
| 15:27 | dnolen_ | lynaghk: pong |
| 15:28 | lynaghk | dnolen_: What's the story with the fancy-unification you mentioned to me at Strata? |
| 15:28 | lynaghk | dnolen_: is that something that's going to land soon, on the drawing board, or what? |
| 15:28 | dnolen_ | lynaghk: I have a pretty nice idea. |
| 15:29 | dnolen_ | lynaghk: during unification you can queue a constraint for a var. after unification these will be run to make sure they weren't violated. I think this should handle your use case cleanly. |
| 15:30 | lynaghk | dnolen_: are you in the market for implementation help in the next week? I'm pushing pretty hard on rolling out an alpha for the chart stuff and would like to start filling out the rewrites. |
| 15:30 | dnolen_ | lynaghk: definitely on the table for 0.8.0, after I get out of all this election insanity, I'm planning on working on it. |
| 15:30 | dnolen_ | lynaghk: not planning on doing anything on this until after Nov. 6th |
| 15:31 | dnolen_ | lynaghk: it's a minor change that I can apply to master so maybe mid next week |
| 15:31 | lynaghk | dnolen_: okay. You're thinking that there'd be an extra parameter, "constraints", given to IUnifyTerms? |
| 15:31 | dnolen_ | lynaghk: no need |
| 15:32 | dnolen_ | lynaghk: you can cue constraints on the substitution which comes in an extra parameter already |
| 15:32 | dnolen_ | er queue |
| 15:32 | lynaghk | dnolen_: ah, yeah. that was my second guess = ) |
| 15:34 | dnolen_ | lynaghk: yeah it should be pretty simple and very useful. one place I could get help is how to support this via simple unification where the unification form is usually quoted ... multimethods? |
| 15:34 | lynaghk | dnolen_: Not sure how I'd implement a special symbol meaning "no value for this key" with that system, though. |
| 15:34 | dnolen_ | lynaghk: ^ |
| 15:35 | lynaghk | dnolen_: not following. A multimethod so that people can extend the unification sematics a la cart for their own datatypes? |
| 15:36 | dnolen_ | lynaghk: when I implement I plan on writing up an example in the repo to demonstrate how this works. |
| 15:36 | dnolen_ | lynaghk: no how interpret custom symbols |
| 15:36 | TimMc | Bronsa: Creepy. |
| 15:36 | Bronsa | thanks. |
| 15:36 | dnolen_ | lynaghk: '(1 2 ?x) where ?x must be a map, or any arbitrary predicate really |
| 15:36 | lynaghk | dnolen_: ah. args to the multimethod would be what? |
| 15:38 | dnolen_ | lynaghk: or might be better to pass constraints as map of constraint fns ... |
| 15:38 | dnolen_ | lynaghk: this is what I mean by i could use help, I don't know what the interface should look like. implementing the internal is easy |
| 15:39 | lynaghk | dnolen_: I'll gist up my wildest dreams this afternoon and we can see if they make any sense |
| 15:40 | dnolen_ | lynaghk: that will be very helpful. |
| 15:49 | dnolen_ | lynaghk: I'm assuming for your use case simple constraints are sufficient? I've been thinking about "deep constraints" as well after seeing Will & Dan's talk at StrangeLoop |
| 15:49 | lynaghk | dnolen_: yes, I believe my constraints are simple. Not sure what the technical meaning of deep is though. |
| 15:49 | dnolen_ | i.e. no subterm of this term should violate this constraint |
| 15:50 | dnolen_ | '(1 2 ?x) where is x is an arbitrary nesting of lists where even numbers don't appear. |
| 15:51 | lynaghk | dnolen_: yes, everything I have in mind satisfies that---assuming there is a way to handle the "doesn't have key". E.g., {:this 1 :no-haz !_ :that {:also-no-has !_ :c 3}} |
| 15:51 | lynaghk | dnolen_: yeah, nothing like that as far as I'm aware. |
| 15:51 | dnolen_ | cool |
| 15:52 | dnolen_ | the simpler case is easier to handle anyhow, I can the other thing later. |
| 15:52 | dnolen_ | I can add I mean |
| 16:20 | holo | hi |
| 16:20 | holo | ##(= '' "spam") |
| 16:20 | lazybot | ⇒ true |
| 16:21 | TimMc | ... |
| 16:21 | holo | i know single quotes for strings is not valid in clojure, but returning true is an expected behaviour even? |
| 16:21 | S11001001 | holo: are you looking for [+' +] |
| 16:21 | bbloom | ,(count '(= '' "spam")) |
| 16:21 | clojurebot | 2 |
| 16:22 | TimMc | bbloom: not quite |
| 16:22 | bbloom | ,'(= '' "spam") |
| 16:22 | clojurebot | (= (quote (quote "spam"))) |
| 16:22 | holo | TimMc, haha, i think it was yesterday you asked me if i knew about this. today by accident, i did it again |
| 16:22 | bbloom | my point was that what looks like 2 arguments to = is actually one argument |
| 16:22 | bbloom | ,(= 1) |
| 16:22 | clojurebot | true |
| 16:22 | TimMc | bbloom: Oh wait, you're right. |
| 16:23 | holo | bblom, great |
| 16:23 | holo | i mean *bbloom |
| 16:23 | TimMc | ,(count ''(= '' "spam")) ;; this is basically what I was thinking of |
| 16:23 | clojurebot | 2 |
| 16:24 | dnolen_ | jimduey: I'm curious if you ever tried benchmarking the monad versions of core.logic (beyond the fork/join one) and how they fared? |
| 16:24 | TimMc | ,(count (flatten ''''''''' spam)) |
| 16:24 | clojurebot | 9 |
| 16:24 | bbloom | many clojure (and most lisps) functions have seemingly odd arity base cases, but they are actually useful for code generation targets |
| 16:24 | TimMc | Unary literals! |
| 16:24 | bbloom | consider: |
| 16:24 | bbloom | ,(*) |
| 16:24 | clojurebot | 1 |
| 16:24 | bbloom | ,(+) |
| 16:24 | clojurebot | 0 |
| 16:24 | TimMc | ,(=) |
| 16:24 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ-> |
| 16:24 | S11001001 | because it makes them monoidal |
| 16:25 | bbloom | S11001001: shh beat me to it :-P |
| 16:25 | bbloom | http://en.wikipedia.org/wiki/Monoid |
| 16:25 | bbloom | not sure why = isn't defined for 0 arguments |
| 16:25 | bbloom | it is defined for 1, however |
| 16:25 | S11001001 | among the clojure data structure types, there are more monoids than non-monoids |
| 16:26 | ToBeReplaced | feel like i'm missing a core func... how would you express "integral type"... best i have is #(and (not (ratio? %)) (rational? %)) |
| 16:26 | bbloom | ,(doc integer?) |
| 16:26 | clojurebot | "([n]); Returns true if n is an integer" |
| 16:26 | bbloom | ,((juxt integer? class) 1) |
| 16:26 | clojurebot | [true java.lang.Long] |
| 16:26 | ToBeReplaced | ,(integer? 1M) |
| 16:26 | clojurebot | false |
| 16:27 | ToBeReplaced | ,(#(and (not (ratio? %)) (rational? %)) 1M) |
| 16:27 | clojurebot | true |
| 16:27 | bbloom | hm |
| 16:27 | S11001001 | ,(class 1M) |
| 16:27 | clojurebot | java.math.BigDecimal |
| 16:27 | bbloom | *shrug* numbers are hard :-P |
| 16:27 | bbloom | oh yeah, you're looking for N |
| 16:27 | bbloom | ,(integer 1N) |
| 16:27 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: integer in this context, compiling:(NO_SOURCE_PATH:0)> |
| 16:27 | bbloom | ,(integer? 1N) |
| 16:27 | clojurebot | true |
| 16:27 | ToBeReplaced | ah ya |
| 16:28 | S11001001 | ,(#(and (not (ratio? %)) (rational? %)) 1.5M) |
| 16:28 | clojurebot | true |
| 16:28 | bbloom | integer? seems to work :-) |
| 16:28 | ToBeReplaced | yea integer? sounds good :) thanks |
| 16:30 | lynaghk | dnolen_: https://gist.github.com/4004131 |
| 16:32 | dnolen_ | lynaghk: thx, will check it out. |
| 16:33 | lynaghk | dnolen_: thank you! If some of those things are terrible ideas definitely let me know---I haven't done enough logicy stuff to get a feel for what is and is not a wise systems decision. |
| 16:35 | bbloom | lynaghk: cool stuff :-) i've been thinking about lots of the same kinds of things with respect to declarative UI |
| 16:36 | lynaghk | bbloom: it's easy to imagine cool things. Just need to get it workin' now = ) |
| 16:36 | bbloom | lynaghk: the rewrite rules are kinda cousins with cascading stylesheets.... |
| 16:36 | lynaghk | bbloom: ehhhhhh...that is not obvious to me. |
| 16:38 | bbloom | lynaghk: consider your :fill color property. someone describing a graph could omit some key style information, like fill color, but specify rewrite rules to insert colors later |
| 16:38 | lynaghk | bbloom: especially since I don't think the rules are necessarily composable. Having an automagic priority model that worked based on specificity of the match would be cool though |
| 16:39 | lynaghk | bbloom: the current implementation renders out to SVG and so user-provided CSS stylesheets are definitely on the table |
| 16:39 | bbloom | lynaghk: specificity is only one option for composition |
| 16:41 | bbloom | lynaghk: WPF doesn't have a specificity model. it just has a staged model: 1) core-styles, 2) theme, 3) control-styles, 4) app-styles, 5) animated values |
| 16:41 | bbloom | something like that |
| 16:41 | bbloom | lynaghk: http://msdn.microsoft.com/en-us/library/ms745683.aspx |
| 16:42 | bbloom | lynaghk: ah, here it is: http://msdn.microsoft.com/en-us/library/ms743230.aspx#listing |
| 16:43 | bbloom | they call it "precedence" |
| 16:44 | TimMc | $findarg map % [1 1N 1M 1.5 1/2] [true true false false false] |
| 16:45 | lazybot | [] |
| 16:45 | TimMc | :-( |
| 16:46 | bbloom | lynaghk: does that make the connection clearer? |
| 16:47 | TimMc | $findarg % 2 3 5 |
| 16:48 | lazybot | [clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int] |
| 16:54 | TimMc | $findarg every? % [1 1.2 1/2] true |
| 16:54 | lazybot | [] |
| 16:54 | TimMc | $findfn 1 true |
| 16:54 | lazybot | [clojure.core/== clojure.core/odd? clojure.core/number? clojure.core/integer? clojure.core/distinct? clojure.core/boolean clojure.core/< clojure.core/= clojure.core/> clojure.core/>= clojure.core/<= clojure.core/pos? clojure.core/rational? clojure.core/await-for] |
| 16:55 | TimMc | Is findarg just timing out, or what? |
| 16:56 | holo | how do i remove these extra parentheses around the map? '('('({}))) |
| 16:56 | holo | i mean, in an obvious way |
| 16:57 | bbloom | holo: huh? those parens are a list |
| 16:57 | technomancy | meta-s |
| 16:57 | bbloom | ,'() |
| 16:57 | S11001001 | holo: there's no good answer without more details |
| 16:57 | clojurebot | () |
| 16:57 | bbloom | ,''() |
| 16:57 | clojurebot | (quote ()) |
| 16:57 | holo | bbloom, do you know any paretheses that aren't lists in clojure? |
| 16:58 | Chousuke | unless you count comments, there aren't any :P |
| 16:58 | S11001001 | &((juxt identity type) (map identity [1,2,3])) |
| 16:58 | lazybot | ⇒ [(1 2 3) clojure.lang.LazySeq] |
| 16:58 | TimMc | holo: Are you asking about a value or text in your editor? |
| 16:58 | S11001001 | &(type '(1,2,3)) |
| 16:58 | lazybot | ⇒ clojure.lang.PersistentList |
| 16:59 | holo | TimMc, it's a value. i'm assuming the number of enclosing lists is unknown |
| 17:00 | holo | S11001001, i'm sorry for the ill explained question. i hope it's clear now |
| 17:01 | Raynes | (first (filter map? (iterate first l))) |
| 17:01 | TimMc | holo: Do you know the difference between '('('({}))) and '((({}))) ? |
| 17:03 | S11001001 | holo: Raynes's solution is probably what you want, but you really shouldn't end up with any data in that shape ("unknown" recursion without an explicit termination data case is a recipe for destructuring disaster) |
| 17:03 | holo | TimMc, no. my verbose example would be (list (list (list {}))) |
| 17:04 | TimMc | holo: Ah, that is different from what you asked for! |
| 17:05 | holo | TimMc, i see. i think your example with just one quote does match the last one i wrote |
| 17:05 | holo | Raynes, you're great! thanks |
| 17:06 | ivan | http://emareaf.deviantart.com/art/Rich-Hickey-321501046 via GIS |
| 17:07 | ivan | (trying to find the "it's just data!") |
| 17:07 | TimMc | holo: 'foo is (quote foo) |
| 17:07 | TimMc | ivan: Haha, nice. |
| 17:08 | holo | S11001001, a query to a database will return me a ({something}) e.g. i think it would be a good idea to not worry the amount of enclosing around the data, and just always apply that function |
| 17:09 | TimMc | That sounds like a very bad idea. |
| 17:09 | holo | TimMc, that's possible |
| 17:09 | S11001001 | holo: TimMc merely typed faster than I could. |
| 17:12 | TimMc | Aside from weird future bugs, you're going to miss out on patterns in your code that you would later be able to factor out. |
| 17:12 | holo | TimMc, this is just for foreign code. that i'm not able or willing to factor |
| 17:14 | mpan | Guys, how relevant/useful/necessary do you suppose some of the formal theory is to practically using a functional language? |
| 17:14 | TimMc | holo: I'm not sure what you're talking about, but OK. |
| 17:14 | Raynes | TimMc: He is saying that this is code that he doesn't control that is giving him the crappy listified result. |
| 17:15 | TimMc | Raynes: holo is still writing code, and presumably more than one piece... |
| 17:15 | S11001001 | holo: ok then, as long as you have some guarantees somewhere |
| 17:15 | S11001001 | mpan: quite |
| 17:16 | holo | yes, it's like Raynes say. sorry my slow reply |
| 17:17 | TimMc | mpan: It's useful, but not essential. |
| 17:40 | mpan | I tried to ask this earlier, and I'm not sure if my net connection died right before or right after the message went through. Apologies if I'm being repetitive. |
| 17:40 | mpan | I'm just wondering, how necessary is it to understand the underlying theory to use a functional language effectively? |
| 17:40 | mpan | For example, I was reading about fixed point combinators, but I can't imagine how the idea came about or how concrete examples were discovered. |
| 17:49 | S11001001 | mpan: S11001001: mpan: quite\r\nTimMc: mpan: It's useful, but not essential. |
| 17:50 | mpan | Awesome! Thanks! |
| 17:50 | technomancy | be sure to read at least Out of the Tarpit and Equal Rights for Functional Objects |
| 17:51 | amalloy | mpan: http://lazybot.org/logs/#clojure/ |
| 17:51 | mpan | Thank you. |
| 17:52 | mpan | I was looking at a different logger before, but that one seems to be delayed and batched, and it hadn't gotten up to anywhere near the present time |
| 17:52 | S11001001 | amalloy: in this case, lazybot split from me for a chunk |
| 17:53 | amalloy | really? what's different? |
| 17:53 | S11001001 | (5:19:35 PM) S11001001: lazybot: mail mpan S11001001: mpan: quite\r\nTimMc: mpan: It's useful, but not essential. |
| 17:54 | amalloy | ~search for mail |
| 17:54 | clojurebot | if you can access the email account that is signed up then you winn |
| 17:54 | amalloy | dangit, i don't remember clojurebot's log-search feature. hiredman? |
| 17:54 | amalloy | because i didn't see that message either, S11001001 |
| 17:54 | mpan | Strange, though, because every one of my TCP connections believed they were still alive |
| 17:54 | hiredman | it is disabled |
| 17:54 | mpan | I thought they timed out much quicker than that |
| 17:54 | mpan | (They just didn't work.) |
| 17:55 | hiredman | when I moved clojurebot to a t1.micro the oomkiller kept killing elasticsearch (provides the indexing and search) |
| 17:55 | jimduey | dnolen_: re: benchmarking core.logic. I haven't yet, but I'm working towards doing that. |
| 17:58 | dnolen_ | jimduey: cool, curious to hear about that. |
| 18:03 | lpvb | what happened to the clojure android effort? |
| 18:04 | pisketti | Was there any? |
| 18:04 | lpvb | ._. |
| 18:04 | mpan | I remember seeing proof-of-concept demos |
| 18:04 | jimduey | dnolen_: I'm thinking (hoping :)) to see quite an improvement when using the continuation monad. |
| 18:04 | pisketti | lpvb: awesome idea |
| 18:05 | Raynes | $google lein-droid |
| 18:05 | lazybot | [alexander-yakushev/lein-droid · GitHub] https://github.com/alexander-yakushev/lein-droid |
| 18:06 | dnolen_ | jimduey: cool! I'm skeptical about the performance of multiple monads in core.logic (I think you alluded to this in your post) but I'm interested in the numbers. |
| 18:44 | ticking | Um, are performance improving patcheswelcome to the core? (Factor 3x on partition-by) |
| 18:45 | dnolen_ | ticking: they are |
| 18:45 | dnolen_ | lynaghk: ping |
| 18:46 | ticking | dnolen_: cool, I assume the requirement to sign the contributors agreement is transitive? |
| 18:48 | dnolen_ | ticking: you mean had signed for a specific project? |
| 18:50 | ticking | dnolen_, no I mean that only the final contributor has to sign it, so that the "author" doesn't |
| 18:51 | ticking | I think it could take quite a while for the paper to arrive in the usa from germany ^^ a hierarchy would be usefull ^^ |
| 18:52 | ticking | say I'd put the code in public domain or gpl or whatever and somebody else put it into a pull request |
| 18:59 | dnolen_ | ticking: don't really understand the finer points of EPL style licenses - perhaps someone else can say something about that. |
| 18:59 | jonasac | is it possible for clojure or java programs in general i guess to write persistent data to a file inside a jar ? |
| 18:59 | ticking | dnolen_ hrhr thanks anyway :D |
| 19:31 | lynaghk | dnolen_: pong |
| 19:33 | dnolen_ | lynaghk: hey, so yeah most of that looks possible - the `or` bit requires some thinking, but doesn't seem hard. honestly the most challenging thing is determining the interface. |
| 19:33 | lynaghk | dnolen_: yeah, I thought that was the case. Nothing I'm trying to do is too crazy. I mean, I feel it's not even really logic programming since there is no backwards/generative magic. |
| 19:34 | dnolen_ | lynaghk: I'm inclined to change prep to take a form + constraints on the vars and perhaps provide some other form for sugar which will allow for some flexiblity for experimentation. |
| 19:35 | dnolen_ | in anycase I'll try to add the internals for this + some simple demos later next week. |
| 19:35 | lynaghk | dnolen_: that makes a lot of sense, but I wonder if that would mean my syntax is impossible. |
| 19:36 | lynaghk | dnolen_: I mean, if I wanted to I could have written each rule + constraints within the body of a run and then iterate over them manually. |
| 19:37 | dnolen_ | lynaghk: no, but I'm not sure if the specific syntax is something core.logic needs to provide. but definitely interested in anything that make it simple to do what you want. |
| 19:38 | dnolen_ | ,(meta (first '(^foo ?x))) |
| 19:38 | clojurebot | {:tag foo} |
| 19:38 | lynaghk | dnolen_: yeah, agreed. Basically it comes down to how people can hook into the walk that happens during unification or if they're going to need to walk their stuff themselves first |
| 19:38 | dnolen_ | lynaghk: prep could look at symbol metadata ... |
| 19:38 | dnolen_ | ,(meta (first '(^::foo ?x))) |
| 19:38 | clojurebot | {:sandbox/foo true} |
| 19:38 | lynaghk | dnolen_: which will probably come down to how crazy their syntax is. |
| 19:38 | dnolen_ | that's actually kind of nice |
| 19:38 | dnolen_ | ,(meta (first '(^::not-present ?x))) |
| 19:38 | clojurebot | {:sandbox/not-present true} |
| 19:39 | dnolen_ | ,(meta (first '(^::numeric ?x))) |
| 19:39 | clojurebot | {:sandbox/numeric true} |
| 19:39 | lynaghk | Not all of the constraints are on a single var, though. The not-present constraint, for instance, you can't use because the standard unification will fail |
| 19:40 | dnolen_ | lynaghk: I got some ideas about this ;) we can do this during prep |
| 19:40 | dnolen_ | ^::numeric ?x could return a logic+var w/ constraint instead of just a logic var. |
| 19:40 | dnolen_ | anyways gotta do some other things but I got some ideas |
| 19:41 | lynaghk | dnolen_: ahhh. yeah, definitely. Thanks for your thoughts on this |
| 19:41 | lynaghk | dnolen_: we can get it all figured out in Raleigh = ) |
| 19:41 | dnolen_ | yes! |
| 19:49 | ivan | hope you weren't interested in any of the comments on bugs.sun.com |
| 19:49 | ivan | https://blogs.oracle.com/darcy/entry/jdk_bug_migration_bugs_sun |
| 19:57 | ivan | http://www.xmlvm.org/overview/ huh |
| 20:00 | bbloom | it's extensible! |
| 20:00 | bbloom | or should i say: |
| 20:00 | bbloom | eXtensible! |
| 20:01 | lynaghk | bbloom: sorry for missing your comment earlier. I'd just left the keyboard |
| 20:01 | bbloom | lynaghk: no worries |
| 20:01 | AtKaaZ | hi, is there some editor/ide which can do refactoring like renaming vars or function names in all relevant places? |
| 20:01 | lynaghk | bbloom: leaving again now, but I'll take a look at that stuff later. I'm trying to push out some of this grammar of graphics stuff before I leave for Sweden on Monday, so I'll ping you with info about the alpha if you're interested in kicking the tires. |
| 20:02 | bbloom | lynaghk: sure, would be happy to try it out and report back my experiences |
| 20:02 | lynaghk | bbloom: rad. Any pref on language? Right now Python, R, JavaScript, and Clojure are the targets. |
| 20:03 | bbloom | lynaghk: i assume Clojure would be the easiest initial target, no? |
| 20:03 | lynaghk | bbloom: yeah, pretty much because I don't need to dick around with EDN generation = ) |
| 20:04 | lynaghk | bbloom: though the alpha is very minimal (send spec, get SVG back) so there's not a lot the client libs actually do |
| 20:05 | bbloom | lynaghk: do you have a tiny swing app with an SVG renderer? i'd imagine that would be the fastest way to iterate, rather than having to refresh the browser each time |
| 20:06 | lynaghk | Also, since everything is a map I'm thinking about just accepting JSON and running data-readers on any maps with a :_tag key. E.g., the EDN #my/record.thing {:a 1} is the same as {"_tag": "my/record.thing", "a" 1} |
| 20:06 | lynaghk | bbloom: nah, I have no swing experience. The plots use CSS, so a browser is pretty necessary. I could throw a livereload server in the client though. |
| 20:06 | lynaghk | so refreshes would be automatic. |
| 20:06 | bbloom | mmm automatic refreshes :-) |
| 20:07 | bbloom | the _tag json thing is a reasonable approach |
| 20:07 | bbloom | keywords and symbols are going to be a real issue for some EDN targets |
| 20:07 | lynaghk | okay, I'll consider that feature request #1 for the clj client and see if I can throw it in there later tonight = ) |
| 20:08 | bbloom | the MRI implementation of ruby, for example, treats every single symbol as a memory leak :-/ |
| 20:08 | bbloom | EDN is cool, but i'm not sure how well it will be received, so JSON support is probably wise |
| 20:08 | lynaghk | bbloom: yeah, that's what I'm thinking. |
| 20:09 | bbloom | but i'm much more interested in the graph-description -> svg step, so clojure-only and no json is enough for me to play with it |
| 20:09 | lynaghk | bbloom: anyway, I'm going for a run before the Pacific NW sun completely disappears. I'll email you Sunday with deets. |
| 20:09 | bbloom | lynaghk: cool, cya |
| 20:09 | lynaghk | bbloom: okay. I am giving a talk on this stuff at Oredev in Sweden next Friday if you're feeling up for a quick Euro trip =P |
| 20:10 | bbloom | haha thanks but no thanks |
| 20:10 | lynaghk | bbloom: but I will also post slides and writeup next week too. |
| 20:35 | AtKaaZ | how to make an empty sorted map ? |
| 20:36 | AtKaaZ | oh i see |
| 20:41 | AtKaaZ | is there something like *file* for lines or current function? |
| 20:44 | S11001001 | AtKaaZ: no, but it might work to write a macro that asks the metadata on &form |
| 20:44 | S11001001 | (defmacro here [] `'~(-> &form meta :line)) |
| 20:45 | S11001001 | AtKaaZ: depends on the details of operation ordering in Compiler.java though |
| 20:47 | S11001001 | AtKaaZ: if you're writing a debugging macro, though, line and current function are pretty useless, as you can pick it up from exceptions anyway. The really useful thing is to write a macro that scribbles out details of &env (which has the current lexical env, e.g. let bindings & fun args |
| 20:48 | AtKaaZ | S11001001, that pretty much works like I wanted to, thanks, but I'm not sure what you mean with operation ordering... |
| 20:50 | S11001001 | AtKaaZ: the times when the Clojure compiler sticks metadata on forms is pretty ad hoc. It should *really* mark forms iteratively, before and between each macroexpansion phase. It's not that simple, though |
| 21:10 | AtKaaZ | EPL or AGPL? why? |
| 21:24 | xeqi | AtKaaZ: for what? |
| 21:24 | AtKaaZ | own clojure projects |
| 21:24 | AtKaaZ | I mean, projects written in clojure |
| 21:26 | technomancy | you can't use clojure in GPL'd projects |
| 21:26 | xeqi | I choose EPL cause it reduces the license complexity of the ecosystem and for my users |
| 21:26 | xeqi | technomancy: ? |
| 21:26 | AtKaaZ | really? |
| 21:26 | ivan | technomancy: wait what seriously? |
| 21:26 | technomancy | the EPL's patent clause is ironically considered "additional restrictions" by the GPL |
| 21:27 | xeqi | ah |
| 21:29 | xeqi | luckily most java gpl projects I've seen use the "classpath exemption" |
| 21:30 | technomancy | the GPL with the classpath exception is effectively no different from the EPL afaict |
| 21:31 | technomancy | or the LGPL |
| 21:31 | AtKaaZ | "A number of developers have told us that they are prohibited from adding a dependency covered by the AGPL due to the viral nature of the license." |
| 21:32 | AtKaaZ | where I read, it seems EPL is better |
| 21:32 | xeqi | for some definition of "better" |
| 21:32 | technomancy | the EPL is not very good at doing what the AGPL does |
| 21:32 | AtKaaZ | yep xeqi |
| 21:33 | AtKaaZ | "With the EPL, Developers don’t have to worry that a single library will taint an entire server-side application and compel the release of source code." lol |
| 21:36 | AtKaaZ | http://vschart.com/compare/eclipse-public-license/vs/gnu-affero-general-public-license |
| 21:37 | seancorfield | as someone who's been thru a software license audit at a large corporation, i can say that licensing is important to such companies ;) |
| 21:37 | hughfdjackson | is there a canonical online book for clojure? |
| 21:37 | hughfdjackson | by which i mean.. de-facto, for begineers |
| 21:37 | hughfdjackson | *beginners -.- |
| 21:38 | hughfdjackson | not canonical at all. |
| 21:38 | technomancy | hughfdjackson: you mean free? |
| 21:38 | hughfdjackson | I don't mind paying, but instant gratification would be nice |
| 21:38 | hughfdjackson | :D |
| 21:38 | technomancy | hughfdjackson: hard to beat clojurebook.com |
| 21:38 | seancorfield | Clojure Programming would be my recommendation - yes, clojurebook.com |
| 21:38 | xeqi | +1 for clojurebook.com |
| 21:39 | hughfdjackson | thanks all :) |
| 21:40 | seancorfield | and welcome to the clojure universe hughfdjackson |
| 21:42 | AtKaaZ | technomancy, so if I want to release my project under AGPL, I can't have it written in clojure ? or I can't dist the uberjar ? |
| 21:43 | hughfdjackson | seancorfield: :D thanks. Here's hoping it'll be a refreshing change from battling js' addition to mutable objects |
| 21:45 | dnolen_ | hughfdjackson: I think there's a lot to like for a JSer. Simple assocative model minus mutability. |
| 21:48 | hughfdjackson | dnolen_: basically what piqued my curiousity; it looks similar enough to be (perhaps) the js i wish js was |
| 21:49 | hughfdjackson | out of interest; are you working on that predicate dispatch library anywhere in public? I don't think i saw it on your github |
| 21:50 | dnolen_ | hughfdjackson: ha, people always ask about that. I do work on it, but in a very slow way via core.logic/match |
| 21:51 | xeqi | AtKaaZ: ianal, but I believe you can't distribute the uberjar |
| 21:51 | AtKaaZ | xeqi, it makes some sense |
| 21:52 | xeqi | or with the agpl even use the combined work across a network |
| 21:52 | hughfdjackson | :D fair enough |
| 21:53 | AtKaaZ | xeqi, I suppose even if you were to release the project under dual license AGPL and EPL it would still not work? |
| 21:54 | Apage43 | Then it would basically just be licensed under the EPL |
| 21:54 | AtKaaZ | like this project https://github.com/malcolmsparks/clj-logging-config |
| 21:55 | xeqi | dual licensing would be fine, everyone would just choose the epl |
| 21:56 | Apage43 | unless they want to sue you or something, and avoid the patent retaliation language |
| 21:56 | AtKaaZ | i hate licenses :/ |
| 21:57 | xeqi | and hope not to be in conflict with it and get copyright infringment :p |
| 21:57 | xeqi | AtKaaZ: yeah, thats why I just choose the EPL for clojure stuff |
| 21:59 | AtKaaZ | xeqi, yeah EPL should do, especially for whatever I program, since nobody will touch with a 10feet pole |
| 21:59 | Apage43 | both AGPL and EPL have patent grant language (if you contribute patent encumbered code, you are granting a license to that patent), but the EPL has the added restriction that if you sue someone over patent related to an an EPL project you are not able to license that project under the EPL, which is why it is not GPL compatible. |
| 22:01 | AtKaaZ | this is a good read: http://briancarper.net/blog/579/keyword-arguments-ruby-clojure-common-lisp%5D |
| 22:28 | hughfdjackson | i'd have thought that read-string and pr-str would have been defined at about the same time |
| 22:29 | hughfdjackson | any rhyme or reason to this decision, or just one of those things that happens with code? |
| 22:32 | tomoj | well, pr-str's definition makes use of destructuring, which is defined after read-string |
| 22:33 | tomoj | but maybe read-string could have been stuck under there.. |
| 22:36 | hughfdjackson | :D interesting |
| 22:36 | hughfdjackson | although i suppose that makes a lot of sense.. |
| 22:39 | joegallo | if you want to make a pie from scratch, you must first create the universe, and all that. |
| 22:39 | hughfdjackson | mmm sagan pie |
| 22:43 | tomoj | every time I didn't put pomegranate on my path and I actually care, I just curse and don't put pomegranate on my path |
| 22:43 | tomoj | |
| 22:45 | tomoj | (= (__ [{:foo #{1 2} :bar #{3}} {:foo #{4}} {:bar #{5 6} :baz #{7}}]) |
| 22:45 | tomoj | [[:foo #{[1 4 nil] [2 4 nil]}] [:bar #{[3 nil 5] [3 nil 6]}]]) |
| 22:45 | tomoj | d'oh |
| 22:47 | tomoj | also |
| 22:47 | AtKaaZ | can we def private atom? similar to defn- |
| 22:47 | tomoj | (= (__ {:a {:foo #{1 2} :bar #{3}} :b {:foo #{4}} :c {:bar #{5 6} :baz #{7}}}) |
| 22:47 | tomoj | [[:foo #{{:a 1 :b 4} {:a 2 :b 4}}] [:bar #{{:a 3 :c 5} {:a 3 :c 6}}]]) |
| 22:47 | tomoj | |
| 22:48 | tomoj | (def ^:private foo (atom :foo)) |
| 22:48 | AtKaaZ | oh it's before the symbol |
| 22:48 | AtKaaZ | thanks |
| 22:48 | AtKaaZ | works! |
| 22:49 | tomoj | there used to be a def- in contrib but it seems to have disappeared |
| 22:50 | tomoj | personally I don't use defn- anymore, ^:private is nice an clear |
| 22:50 | AtKaaZ | I agree |
| 22:50 | Raynes | Only time I use defn- is when working with code that uses it already. |
| 22:50 | Raynes | Like Clojure itself. |
| 23:10 | lpvb | has anyone done development for windows metro apps or windows phone? |
| 23:10 | lpvb | with clojure |
| 23:32 | brainproxy | Sgeo: glad you're doing alright |
| 23:45 | AtKaaZ | can we loop recur with first and rest inside a macro [firs & res] , trying to parse all by applying a check on first |
| 23:47 | AtKaaZ | the problem is in the loop let `(loop [xfirst# ~x allrest# ~all] the ~all is evaluate |
| 23:50 | AtKaaZ | if I were to not use the ` should I use eval to evaluate the form inside the macro? |
| 23:54 | Sgeo | bradfordw_, thank you |
| 23:54 | Sgeo | oops |
| 23:54 | Sgeo | brainproxy, thank you |
| 23:59 | brainproxy | btw, I've been hacking on the protocol-monads library; implemented a basic mechanism that options lets you check whether the return type of a monadic function matches the type of the monadic value |
| 23:59 | brainproxy | Sgeo: ^ |
| 23:59 | brainproxy | *optionally |