2013-03-03
| 00:03 | akhudek | Hm, I don't suppose there is any clojure xml library that keeps the structure compressed in memory (e.g. use a dictionary for tag names and store it in binary?) |
| 00:09 | amalloy | even better, akhudek: the tag names are stored as keywords, so all they cost you is a pointer, which you'd have to pay anyway |
| 00:10 | akhudek | amalloy: good point, forgot about that |
| 00:12 | derekv | learning a new language while doing TDD is the worst thing ever |
| 00:12 | mybuddymichael | derekv: Easy solution. Don't do TDD. |
| 00:12 | mybuddymichael | :-) |
| 00:12 | derekv | required |
| 00:18 | derekv | I tried print a collection to a string by doing a (reduce #(conj (print-item %) "\n") "Your items\n" items) |
| 00:18 | derekv | but it doesn't like that. |
| 00:18 | derekv | rather it was more like (reduce #(conj % (print-item %1) "\n") "Your items\n" items) |
| 00:19 | derekv | thats not how conj work apperently |
| 00:20 | tomoj | % and %1 are the same, use %1 and %2 (or if you insist % and %2). and use str instead of conj |
| 00:21 | tomoj | but it sort of looks like you're trying to do (clojure.string/join \newline (map print-item items)) ? |
| 00:22 | derekv | tomoj, that looks good. |
| 00:22 | tomoj | or say (->> items (map print-item) (cons "Your items") (clojure.string/join \newline)) |
| 00:23 | derekv | gotchya |
| 00:24 | derekv | I knew there was a nice functional way to do it. |
| 00:24 | derekv | getting late in the day |
| 00:24 | derekv | what is the name of the ->> function if I looked it up? |
| 00:25 | mybuddymichael | derekv: Threading macros. |
| 00:26 | jeremyheiler | derekv, -> is "thread first" and ->> is "thread last" |
| 00:26 | derekv | Its just rearranging things for readability? |
| 00:26 | jeremyheiler | yeah |
| 00:50 | TimMc | Or for unreadability. :-) |
| 00:51 | TimMc | &(((((((-> x (fn [] x)))))))) |
| 00:51 | lazybot | ⇒ #<sandbox20321$eval58027$x__58028 sandbox20321$eval58027$x__58028@1e30afc> |
| 00:53 | frenchyp | how to I print to repl in a seesaw callback function? |
| 01:35 | shriphani | hi. I am trying to use lein-localrepo to install a jar on my filesystem but the coords come up nil and I can't import it in my source. Any ideas ? |
| 01:44 | mattmoss | shriphani: I don't know about lein-localrepo... I used https://gist.github.com/stuartsierra/3062743 on my project to install jars manually, paying attention to stuart's comment at the bottom. Worked fine for me. |
| 01:46 | shriphani | mattmoss: I see. And how do you use it from clojure source (sorry I'm a noob here and I am not sure if I should import or require or use) |
| 01:49 | mattmoss | shriphani: My use is fairly simple... so I just use require to bring in the particular classes I need. |
| 01:49 | shriphani | mattmoss: and your local jar is a java jar? |
| 01:49 | mattmoss | Yup. |
| 01:50 | shriphani | mattmoss: thanks a lot. I'll report back if it succeeded or failed. |
| 01:50 | mattmoss | The mvn command in that link will create a local repo, and then install it to the usual maven repo (usually ~/.m2 ?), from which the project will get its deps. |
| 01:51 | mattmoss | Good luck! |
| 01:53 | shriphani | generally, what is the deal with the artifactId? |
| 01:54 | shriphani | What is it supposed to signify i.e. ? |
| 01:55 | akhudek | shriphani: it is from java land |
| 01:56 | akhudek | the group id is intended to be the group that created it (e.g. com.mycompany) |
| 01:56 | akhudek | the artifact id is the thing itself |
| 01:57 | akhudek | e.g. library name |
| 01:57 | akhudek | clojure authors often ignore this and set the group and artifact to be the same |
| 01:58 | akhudek | when you specify [my-library "1.0"] in lein, it just expands it such that both the group and artifact id are my-library |
| 01:59 | shriphani | hmm. I seee. |
| 01:59 | shriphani | mattmoss: is the repo supposed to be in the root of the lein project ? |
| 02:00 | shriphani | I put it in ~ and mvn had no problems building it. |
| 02:01 | shriphani | but lein deps complains. |
| 02:02 | shriphani | oh wow maven created a "~" directory in my folder. omg.. the jvm is a harsh place. |
| 02:13 | akhudek | shriphani: why not just mvn install? |
| 02:13 | akhudek | or install the jar via mvn directly if it's a single jar |
| 02:14 | akhudek | http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html |
| 02:14 | akhudek | both those method should install to your local repostiory and lein will pick it up automatically |
| 02:15 | shriphani | akhudek: I did a deploy:deploy-file thingy that mattmoss gave me |
| 02:15 | shriphani | but lein deps is dying. |
| 02:15 | shriphani | and I can't decipher the error. Do you want to take a look @ my project.clj ? |
| 02:16 | akhudek | you are trying to do a project local repo? |
| 02:17 | akhudek | instead of using your user local repo? |
| 02:17 | shriphani | well I just want to use a jar. I don't really care.. |
| 02:17 | akhudek | if it's one jar with no dependencies |
| 02:18 | akhudek | just use the 3rd-party-jars-local link I pasted |
| 02:18 | shriphani | ah ok. And then how do I use it in clojure? |
| 02:19 | akhudek | in lein deps add an entry: [group-id/artifact-id "version"] |
| 02:19 | akhudek | where the group, artifact, and version match whatever you put on the command line |
| 02:19 | akhudek | packaging should be jar |
| 02:20 | akhudek | no need for any extra repo links |
| 02:21 | shriphani | ok lein deps exited without barfing. So that's good right? |
| 02:21 | akhudek | yes |
| 02:21 | akhudek | should be good to go I think |
| 02:22 | shriphani | so if lein deps had an entry of the form: local/heideltime "1.0.0", how do I use it? Like any other clojure jar ? |
| 02:22 | akhudek | yes, it will have a namespace like all java libraries and clojure libraries |
| 02:23 | akhudek | so either impoort the right classes as with standard java interop |
| 02:23 | akhudek | or if it's a clojure lib then require the right things |
| 02:23 | akhudek | (though if it was a clojure lib you could have just did "lein install" to get it to install locally!) |
| 02:24 | shriphani | no it is a java lib. |
| 02:24 | shriphani | hmm I used the same namespace as I have in eclipse and lighttable is complaining. |
| 02:25 | akhudek | in an :import? |
| 02:25 | shriphani | in an (import) |
| 02:25 | akhudek | should be (import '[my.namespace Class]) |
| 02:25 | akhudek | I think |
| 02:26 | akhudek | note the space |
| 02:27 | shriphani | umm that's what I have |
| 02:27 | shriphani | is it a light table thing? |
| 02:27 | akhudek | could be, not sure, did you try it in a normal repl? |
| 02:27 | shriphani | lein run on the file didn't complain |
| 02:28 | akhudek | try lein repl |
| 02:28 | akhudek | and importing it manually |
| 02:28 | shriphani | ClassNotFoundException de.unihd.dbs.heideltime.standalone.HeidelTimeStandalone java.net.URLClassLoader$1.run (URLClassLoader.java:202) |
| 02:28 | shriphani | :_( |
| 02:29 | shriphani | btw, I didn't use the group or the artifact in the import statement. |
| 02:29 | shriphani | the groupid was local and artifact was heideltime |
| 02:29 | shriphani | is that a problem or will maven sort things out ? |
| 02:30 | akhudek | hm, that shouldn't matter |
| 02:30 | shriphani | I see. |
| 02:30 | akhudek | is the library in the list when you do lein deps :tree |
| 02:30 | shriphani | and I just pasted the (import .**) in my repl. that was right wasn't it ? |
| 02:30 | shriphani | [local/heideltime "1.0.0"] |
| 02:30 | shriphani | yup |
| 02:31 | akhudek | what is (import .**) supposed to do? |
| 02:31 | akhudek | import a bunch of things? |
| 02:31 | akhudek | not sure if that works in clojure |
| 02:31 | shriphani | umm no. |
| 02:31 | shriphani | I did: (import '(de.unihd.dbs.heideltime.standalone HeidelTimeStandalone)) |
| 02:31 | akhudek | ah, ok, that looks right too |
| 02:31 | akhudek | odd |
| 02:32 | shriphani | is there like a make clean I am supposed to do ? |
| 02:32 | akhudek | lein clean |
| 02:32 | akhudek | it can help get rid of weirdness sometimes |
| 02:33 | shriphani | and then deps again ? |
| 02:33 | akhudek | deps isn't really needed in lein2 |
| 02:33 | shriphani | nope classnotfound |
| 02:33 | akhudek | think it just checks things now |
| 02:34 | akhudek | is the right jar sitting in ~/.m2/repository? |
| 02:34 | shriphani | ls ~/.m2/repository/heideltime/heideltime/1.0/ |
| 02:34 | shriphani | _maven.repositories heideltime-1.0.jar |
| 02:34 | lazybot | bin data dev etc home lib media opt sbin selinux src sys var |
| 02:34 | shriphani | is that a problem ? |
| 02:35 | shriphani | wow... i could make lazybot run commands on a root dir ? |
| 02:35 | akhudek | haha, it's probably just chirping up something someone told it previously |
| 02:35 | shriphani | well I have 1.0.0 in my project.clj |
| 02:36 | akhudek | that looks like it should be accessed by [heideltime "1.0"] |
| 02:36 | shriphani | could the number of periods be a problem ? |
| 02:36 | shriphani | so [local/heideltime "1.0"] right ? |
| 02:36 | shriphani | hmm lein deps couldn't resolve it.. |
| 02:37 | shriphani | and in the error msg, no mention of ~/.m2 |
| 02:37 | shriphani | just clojars and repo1 |
| 02:37 | akhudek | no, just [heideltime "1.0"] |
| 02:37 | akhudek | it never mentions .m2 |
| 02:37 | shriphani | ok that works (for lein deps at least) |
| 02:38 | akhudek | that's the local repository that everything gets stored in |
| 02:38 | akhudek | even the things you pull from clojars |
| 02:38 | akhudek | or other maven repositories |
| 02:39 | shriphani | aaaah ! ClassNotFoundException org.apache.uima.UimaContext java.net.URLClassLoader$1.run (URLClassLoader.java:202) |
| 02:39 | shriphani | ugh. |
| 02:39 | akhudek | haha, well, there is probably a maven source for uima somewhere |
| 02:39 | shriphani | but that happened when I asked it to do heideltime |
| 02:39 | shriphani | I mean in the repl I pasted: (import '(de.unihd.dbs.heideltime.standalone HeidelTimeStandalone)) |
| 02:40 | akhudek | guess it's a dependency |
| 02:40 | shriphani | but I used that jar in java (eclipse) when I added ti as an external lib. |
| 02:40 | shriphani | so how did it work then? |
| 02:42 | akhudek | maybe eclipse pulled the dependency automatically for you? |
| 02:42 | shriphani | hmm.. I am also an eclipse noob so I won't try to answer that. |
| 02:42 | shriphani | oh god. so much pain. |
| 02:43 | shriphani | ok I added it to project.clj and did lein deps and I get the same error in the repl. |
| 02:43 | shriphani | what is wrong now... |
| 02:43 | akhudek | are you sure you installed the right jar? |
| 02:44 | shriphani | well there is only 1 jar... |
| 02:44 | shriphani | that I am trying to install.. |
| 02:45 | shriphani | the name changed in ~/.m2 though |
| 02:45 | shriphani | the local file has a name that contains much of the namespace in it. |
| 02:45 | shriphani | in ~/.m2 it is just heideltime-1.0.har |
| 02:45 | shriphani | jar * |
| 02:46 | akhudek | is there a .m2/local/heideltime ? |
| 02:46 | shriphani | nope. |
| 02:46 | shriphani | just ~/.m2/repository/heideltime |
| 02:46 | akhudek | what was your maven install string again? |
| 02:47 | shriphani | mvn install:install-file -DgroupId=local -DartifactId=heideltime -Dversion=1.0.0 -Dpackaging=jar -Dfile=de.unihd.dbs.heideltime.standalone.jar |
| 02:49 | shriphani | akhudek: should it have created a ~/.m2/local ? |
| 02:49 | akhudek | I thought so :-/ |
| 02:50 | shriphani | ugh. there's a local-repository where it dumped some stuff from a previous command |
| 02:50 | shriphani | that has a local/ |
| 02:50 | shriphani | let me rm that thing and try again |
| 02:50 | shriphani | nstalling /Users/shriphani/Documents/heritrix-inspector/de.unihd.dbs.heideltime.standalone.jar to /Users/shriphani/.m2/repository/local/heideltime/1.0.0/heideltime-1.0.0.jar |
| 02:50 | shriphani | wooo! |
| 02:51 | shriphani | now ~/.m2/repository/local/heideltime/1.0.0/ has _maven.repositories heideltime-1.0.0.jar heideltime-1.0.0.pom in it. that's good right ? |
| 02:51 | akhudek | looks right |
| 02:52 | akhudek | change your lein dep to match |
| 02:52 | shriphani | so local/heideltime |
| 02:52 | akhudek | and try it out in the repl |
| 02:52 | akhudek | yes, with version 1.0.0 |
| 02:53 | shriphani | ClassNotFoundException de.unihd.dbs.heideltime.standalone.HeidelTimeStandalone java.net.URLClassLoader$1.run (URLClassLoader.java:202) |
| 02:53 | shriphani | ugghh! |
| 02:54 | akhudek | :-( |
| 02:54 | shriphani | dammit! |
| 02:55 | shriphani | lein repl must be run from the project root isn't it? |
| 02:55 | akhudek | yes |
| 02:56 | shriphani | why does it never work :_( |
| 02:58 | shriphani | akhudek: any other ideas ? |
| 02:58 | akhudek | check lein deps :tree again |
| 02:59 | akhudek | if it looks right, then I am at a loss |
| 03:00 | akhudek | try lein clein and restart the repl |
| 03:00 | shriphani | [local/heideltime "1.0.0"] |
| 03:00 | shriphani | is in :tree |
| 03:02 | shriphani | yeah still fails... |
| 03:02 | shriphani | can I just import everything from the namespace ? |
| 03:02 | shriphani | what's the syntax ? |
| 03:03 | akhudek | no |
| 03:03 | akhudek | don't think so |
| 03:03 | akhudek | lein classpath |
| 03:03 | akhudek | should show the jar |
| 03:04 | akhudek | if it is in the list, then you should have access to it and the problem is something else |
| 03:04 | shriphani | /Users/shriphani/.m2/repository/local/heideltime/1.0.0/heideltime-1.0.0.jar |
| 03:04 | shriphani | yup its in there. |
| 03:04 | shriphani | ughh.. |
| 03:05 | akhudek | then the namespace or class name must be different in that version, or the jar might be corrupt? |
| 03:05 | shriphani | can eclipse see this maven repo then? |
| 03:05 | akhudek | yes |
| 03:05 | shriphani | or does that require some magic too? |
| 03:06 | akhudek | that might be where that other jar came from actually |
| 03:06 | akhudek | installed via eclipse |
| 03:06 | akhudek | btw, looking at the soruce, the standalone version does require uima |
| 03:08 | shriphani | the source of waht ? |
| 03:08 | shriphani | heideltime ? |
| 03:08 | akhudek | yes |
| 03:08 | shriphani | hmm.. |
| 03:08 | shriphani | well I have that in my project.clj |
| 03:08 | shriphani | [org.apache.opennlp/opennlp-uima "1.5.2-incubating"] |
| 03:08 | shriphani | |
| 03:08 | shriphani | oh wait that might not be what it wants eh ? |
| 03:09 | akhudek | if I had to guess, the other library that you have in your .m2, the first one we tried, was from eclipse |
| 03:09 | akhudek | and is probably correct |
| 03:09 | akhudek | https://code.google.com/p/heideltime/source/browse/src/de/unihd/dbs/heideltime/standalone/HeidelTimeStandalone.java?r=00785fb7d205c2dd5a3b7ea855d556ee836c93ee |
| 03:10 | shriphani | hmm. So if I pull the right uima from maven, I should be good to go ? |
| 03:10 | shriphani | from here i.e. :http://mvnrepository.com/artifact/org.apache.uima |
| 03:10 | akhudek | perhaps, though I'm not sure what is going on with your local jar that you installed |
| 03:10 | akhudek | lein will automatically check the main maven repository btw |
| 03:10 | akhudek | so just put in the dep for it |
| 03:11 | akhudek | in any case, I must go |
| 03:11 | akhudek | hope you manage to get it working! |
| 03:11 | shriphani | ah man. thanks for the help. |
| 03:11 | Pupnik- | which of the clojure books is generally recommended? |
| 03:12 | Pupnik- | (for someone new to functional programming) |
| 03:15 | akhudek | Pupnik-: Pragamming Clojure is good for people coming from langauges like ruby/python and includes the web stack. Joy of Clojure is great for a more technical treatment |
| 03:15 | akhudek | night! |
| 03:15 | Pupnik- | clojure programming is the other new one i found |
| 03:21 | shriphani | interesting the jar file mvn installed has nothing but a META-INF and a README.md in it. |
| 03:29 | shriphani | akhudek: I got it to work. you were right, the jar was broken. |
| 03:37 | clifton | i come from Ruby, and Clojure Programming (O'Reilly) is the best programming book I've ever read |
| 03:37 | clifton | really great examples, fast pace, completeness, it's just a great book |
| 03:48 | Pupnik- | thanks |
| 03:57 | Ember- | I liked Programming Clojure |
| 03:57 | Ember- | this http://pragprog.com/book/shcloj2/programming-clojure |
| 04:00 | Pupnik- | ok so thats 2 votes for programming clojure and 1 for clojure programming |
| 04:00 | Pupnik- | anyone read both? |
| 04:01 | Pupnik- | (although i suppose thats unlikely really) |
| 04:01 | Pupnik- | what was your background before reading it Ember- ? |
| 04:08 | Ember- | Pupnik-: java background |
| 04:09 | Ember- | and web |
| 05:13 | shriphan` | Hi. I am having some issues calling a public method of an object. Calling (.getMethods ..) on the classname shows the method but when I do (.fname (new ClassName constr_args) <fname_args>), it complains that it can't find the function name. |
| 05:13 | shriphan` | am I supposed to not use new or something ? |
| 05:14 | Ember- | ,(java.io.File. "foo") |
| 05:14 | clojurebot | eval service is offline |
| 05:14 | Ember- | &(java.io.File. "foo") |
| 05:14 | lazybot | ⇒ #<File foo> |
| 05:14 | Ember- | I usually use that syntax |
| 05:16 | shriphan` | Ember-: was that for me? |
| 05:16 | Ember- | yes |
| 05:17 | shriphan` | well that didn't work... |
| 05:17 | Ember- | &(.doubleValue (java.lang.Integer 3)) |
| 05:17 | lazybot | java.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IFn |
| 05:17 | shriphan` | the method is overloaded... that a problem ? |
| 05:17 | Ember- | &(.doubleValue (java.lang.Integer. 3)) |
| 05:17 | lazybot | ⇒ 3.0 |
| 05:18 | shriphan` | (.process (HeidelTimeStandalone. Language/ENGLISH DocumentType/COLLOQUIAL OutputType/TIMEML) "Friday 2012") |
| 05:18 | shriphan` | The constructor returns an object alright. |
| 05:18 | shriphan` | the .process complains that it doesn't exist. |
| 05:19 | shriphan` | yet when I do .getMethods on HeidelTimeStandalone, it is cool. |
| 05:19 | Ember- | well, are you absolutely sure it *does* exist :) |
| 05:19 | shriphan` | i.e. I see a .process in that list. |
| 05:19 | terom | maybe it's a private method+ |
| 05:19 | terom | ? |
| 05:19 | Ember- | or protected |
| 05:19 | shriphan` | no. public. |
| 05:20 | Ember- | sounds wierd |
| 05:20 | shriphan` | #<Method public java.lang.String de.unihd.dbs.heideltime.standalone.HeidelTimeStandalone.process(java.lang.String,de.unihd.dbs.heideltime.standalone.components.ResultFormatter) |
| 05:21 | Ember- | you're passing only one parameter |
| 05:21 | Ember- | it requires two |
| 05:21 | Ember- | String and ResultFormatter |
| 05:21 | shriphan` | weird. the source exposes a single arg method. |
| 05:21 | Ember- | well, that method you pasted requires two |
| 05:22 | shriphan` | hmm. so that not-found error msg is standard ? |
| 05:22 | shriphan` | i mean even when the sig is diff from the call ? |
| 05:23 | Ember- | if you have a one arg method signature which is public you should be able to call it no problemo |
| 05:23 | Ember- | and I'm 100% certain you can. I'd double check that your java class is actually the same you think it is |
| 05:23 | Ember- | maybe your clojure code sees an old version without the single arg method |
| 05:27 | shriphan` | Ember-: that is possible. I had to screw around too much with maven to get it working and I manually moved this jar in there. |
| 05:27 | shriphan` | Also, it returns and then throws an exception. Most fascinating thing ever. |
| 05:29 | Ember- | shriphan`: I'd look into that then |
| 05:29 | shriphan` | yea it is definitely confused. |
| 05:57 | borkdude | Ember- did you already solve your problem? |
| 05:57 | Ember- | yeah, did it the old fashioned way in the end |
| 05:57 | Ember- | not pretty but works |
| 05:58 | Ember- | I did check your refheap paste |
| 05:58 | Ember- | I had to write my own zipper to make it work and even then it didn't really do what I needed |
| 05:58 | Ember- | finally I gave up and decided to write it just for this case |
| 05:59 | borkdude | Ember- you can see the path it takes, but those are not equal to keys for get-in. |
| 05:59 | Ember- | indeed |
| 05:59 | borkdude | Ember- your approach: just try a lot of keys, brute force or smth? |
| 06:00 | Ember- | borkdude: depth-first search for a pre defined structure |
| 06:00 | Ember- | map-indexed + bunch of other stuff |
| 06:00 | Ember- | recursive function calls, stack consuming |
| 06:00 | Ember- | not a problem in my case |
| 06:00 | Ember- | stack will NOT end in this case :) |
| 06:00 | borkdude | ok |
| 06:01 | Ember- | I'd guess worst case scenario is something like 20 nested function calls |
| 06:02 | Ember- | but I did learn a lot about zippers on the way |
| 06:03 | Ember- | so definetly not wasted time :) |
| 06:03 | Ember- | especially since this is my own personal project without tight deadlines |
| 07:29 | jimkcar | anyone in here that can answer a vim/clojure question? |
| 07:32 | jimkcar | its more of an annoyance than anything else but for some reason when I can't get vim to put closing parens on the end of the line. They always seem to end up on their own line. |
| 08:19 | clojure-new | Hello, can you tell what i'm doing wrong? http://cljbin.com/paste/51334e2ae4b0f3b237b3f7a9 |
| 08:20 | clojure-new | I'm trying to require feedparser-clj.core as feed but fail. |
| 08:28 | borkdude | I saw this https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint.clj contains load statements |
| 08:28 | borkdude | is that supposed to be? |
| 08:29 | clojure-new | borkdude: I don't get it. |
| 08:29 | jimkcar | @clojure-new in your main defn :feed/title should be feed/title |
| 08:29 | jimkcar | you don't use a colon there |
| 08:31 | clojure-new | jimkcar: http://cljbin.com/paste/513350c3e4b0f3b237b3f7aa It still triggers error. And in console: |
| 08:31 | clojure-new | Exception in thread "main" java.lang.RuntimeException: No such var: feed/title, compiling:(rss/core.clj:6) |
| 08:32 | clojure-new | Caused by: java.lang.RuntimeException: No such var: feed/title |
| 08:33 | borkdude | clojure-new it says that in the namespaces feed there is no var (function) called title |
| 08:33 | jimkcar | doesn't look to be a function called title in feed |
| 08:34 | jimkcar | looks like you're trying to extract the :title from feed/feed-parse return value |
| 08:35 | clojure-new | jimkcar: Yep. |
| 08:35 | clojure-new | With this http://cljbin.com/paste/513351b3e4b0f3b237b3f7a i've got, Exception in thread "main" java.lang.RuntimeException: No such var: feed/feed-parse, compiling:(rss/core.clj:6) |
| 08:35 | jimkcar | http://cljbin.com/paste/513351dde4b0f3b237b3f7ac |
| 08:37 | clojure-new | clojure-new: Yeah, but now it complains about feed/feed-parse... |
| 08:37 | clojure-new | jimkcar: Oh, wrong function name, sorry. It works now, thanks! |
| 08:38 | jimkcar | looks like there is a parse-feed function and a make-feed function but no feed-parse |
| 08:38 | jimkcar | cool |
| 10:11 | ayia | Hi guys. I am struggling the 4clojure.com, the "Count a Sequence" problem (https://www.4clojure.com/problem/22). In the solutions of users I follow I found the following one: reduce #(or (+ % 1) %2) 0. But I can't understand why it works... Can anybody explain me? I know that reduce applies consequentially given function position to each element of the given sequence and the result of previous "application"… So let we have '(1 2 3) as a seq. The |
| 10:11 | ayia | n at first iteration the #(or (+ % 1) %2) will get 0 and 1 as arguments, and all these arguments will be evaluated as (+ (0 1) 1), or what? I can't get this... |
| 10:51 | callenbot | ayia: it's an or |
| 10:52 | ayia | callenbot: but what then? |
| 10:52 | TimMc | ayia: At the first iteration, that would be (or (+ 1 1) 2) -> (or 2 2) -> 2 |
| 10:52 | callenbot | ayia: it returns the result of incrementing the accumulator, or if the 'or' returns false, it'll just return the second argument. |
| 10:52 | callenbot | which I believe in this case is the acum |
| 10:52 | callenbot | accum* |
| 10:59 | ayia | callenbot: I can't understand why the first iteration will be (or (+ 1 1) 2) -> ... "%" in the (+ % 2) should be (0 1), shouldn't it? since the function gets two arguments: 0 and first element of the sequence, 1... |
| 11:01 | ayia | the original call should be something like: reduce #(or (+ % 1) %2) 0 (list 1 2 3) |
| 11:07 | callenbot | ayia: decompose the function literal into a defn with print statements |
| 11:08 | callenbot | ayia: form hypotheses - then test them. |
| 11:08 | ayia | callenbot: thanks friend! The easiest way... Don't know why I did not get this by my own... |
| 11:09 | callenbot | ayia: Iuno. Programmers tend to get...get stuck in loops... |
| 11:09 | callenbot | ayia: avoid that. |
| 11:43 | t-goossens | For all belgian clojurians (or other people interested in this) : i'm pleased to announce the first every belgian clojure meetup group. Starting this month! http://lanyrd.com/2013/belgiumclj |
| 11:45 | clojure-new | Is there guys familiar with lanterna/clojure-lanterna? Can you explain why this produces column of c's and not a b c column? |
| 11:45 | clojure-new | (for [str '("a" "b" "c") row [0 1 2]] (do (s/put-string screen 0 row str) (s/redraw screen))) |
| 11:46 | gfredericks | lynaghk: ping |
| 11:58 | octagon | clojure-new: it's because of the for loop you have there |
| 11:58 | octagon | ,(for [str '("a" "b" "c") row [0 1 2]] (prn [row str])) |
| 11:58 | clojurebot | eval service is offline |
| 11:59 | gfredericks | ,(println "eval service is offline") |
| 11:59 | clojurebot | eval service is offline |
| 11:59 | johndeo | FInally taking some time to check out Leiningen. I downloaded the script and now I'm going thru the tutorial at https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md |
| 11:59 | octagon | clojure-new: try that in your repl, and look at how you get [0 "c"] [1 "c"] [2 "c"] at the end |
| 12:01 | brum | is there a leiningen template for creating mvc projects with dependencies like ring added |
| 12:01 | brum | not that it takes much work, just coming from ruby to clojure and want to play around and make sure i have everything set up correctly |
| 12:04 | mpfundstein | is someone in the mood to do a code review (https://gist.github.com/MarkusXite/f99abde7f67eca751d63) .. datasource included + expected outcome. I am mostly interested where stuff can be more in the clojure-way and where i can improve it (clojure n00b) |
| 12:05 | gfredericks | mpfundstein: don't use use |
| 12:05 | gfredericks | (:require [clojure.java.io :as io] [clojure.string :as s]) |
| 12:05 | mpfundstein | you mean in the beginning? |
| 12:05 | gfredericks | yeah line 9 |
| 12:05 | mpfundstein | ok |
| 12:05 | mpfundstein | what is the reason? |
| 12:05 | gfredericks | then you'll add prefixes to the usages of the vars in the respective namespaces |
| 12:06 | gfredericks | e.g., line 42 becomes s/split |
| 12:06 | gfredericks | then it's more explicit what your symbols are referencing |
| 12:06 | mpfundstein | aah ok |
| 12:06 | mpfundstein | thats awesome |
| 12:06 | gfredericks | reader => io/reader |
| 12:06 | clojure-new | octagon: Oh, indeed... |
| 12:07 | mpfundstein | gfredericks: ok super, thanks for the info |
| 12:07 | mpfundstein | any more feedback :-) |
| 12:07 | gfredericks | you can also (:require [clojure.java.io :refer [reader]]) if you like the naked symbols -- that way it's still explicit within the file |
| 12:07 | mpfundstein | i feel for example that i use (def every line to "redef outlet-map and total-transactions" is somhow unelegant |
| 12:07 | mpfundstein | gfredericks: i write that down, very good |
| 12:08 | gfredericks | oh yeah don't do that |
| 12:08 | gfredericks | only def at the top level, not inside a function |
| 12:08 | clojure-new | octagon: But how can i fix it? I want for loop that iterates over '("a" "b" "c") and [0 1 2] simultaneosly. |
| 12:08 | mpfundstein | gfredericks: but how do i redef than outlet-map |
| 12:08 | gfredericks | clojure-new: ##(map vector '("a" "b" "c") [0 1 2]) |
| 12:08 | mpfundstein | i need it to be persistent until the end |
| 12:09 | gfredericks | mpfundstein: I haven't understood the code yet so I don't know why you're using state -- probably you don't need it in the first place |
| 12:09 | mpfundstein | i have 2 states |
| 12:09 | mpfundstein | total-transactions |
| 12:09 | mpfundstein | and outlet-map |
| 12:09 | mpfundstein | i read the source file |
| 12:09 | clojure-new | gfredericks: What does ## means? |
| 12:09 | mpfundstein | a csv |
| 12:09 | mpfundstein | depeneding on two rows i have to add up certain values |
| 12:09 | gfredericks | clojure-new: I was trying to get lazybot to eval the expression |
| 12:09 | gfredericks | clojure-new: map vector will zip them up for you so you can loop over the pairs |
| 12:09 | mpfundstein | total-transactions (which is actually the sum of the last column) |
| 12:09 | clojure-new | Ah. |
| 12:10 | mpfundstein | and outlet-map which is a very small tree (outlet_a (category a, category b), outlet_b (category a, ... etc |
| 12:10 | johndeo | mpfundstein: What does it mean to use a leading '-' in front of function names? |
| 12:11 | smnirven | anybody have any experience using clojure.java.jdbc and postgres/postgis ? |
| 12:11 | mpfundstein | johndeo: than its private |
| 12:11 | gfredericks | smnirven: minus the postgis part, yes |
| 12:11 | johndeo | thx |
| 12:11 | gfredericks | mpfundstein: a) use (defn ^:private foo-bar ...) for private fns |
| 12:11 | smnirven | gfredericks: yeah im mostly scratching my head trying to figure out how to do geometry inserts |
| 12:11 | gfredericks | b) basically every do you have is unnecessary |
| 12:12 | gfredericks | c) 42 and 43 can be a single let |
| 12:12 | mpfundstein | gfredericks: ok, why? (i started clojure yesterday so sorry if i am a bit n00bish) |
| 12:12 | gfredericks | d) switch outlet-map and total-transactions to using atoms for the time being, and think about whether you really need state |
| 12:12 | mpfundstein | geoffeg: yes 42 and 43 one let.. true |
| 12:13 | mpfundstein | gfredericks: atom ok |
| 12:13 | mpfundstein | so (def outlet-map (atom hash-map)) ? |
| 12:13 | gfredericks | so 12 is (def outlet-map (atom {})) |
| 12:13 | gfredericks | and 45 is |
| 12:13 | gfredericks | (swap! outlet-map insert-in-map (second hash) (nth hash 2) transactions) |
| 12:13 | mpfundstein | yeah i saw swap |
| 12:13 | mpfundstein | in a article |
| 12:14 | mpfundstein | but the author doesnt explain what it does |
| 12:14 | gfredericks | similarly 47 is (swap! total-transactions + transactions) |
| 12:14 | mpfundstein | das is swap outlet-map with the return value of insert-in-map ? |
| 12:14 | gfredericks | yeah |
| 12:14 | mpfundstein | what is the diff of def than |
| 12:14 | gfredericks | and the current value gets passed in as the first arg |
| 12:14 | mpfundstein | in def i just assign new and the old one gets gc'ed right? |
| 12:14 | gfredericks | yes but that's not how def is meant to be used |
| 12:14 | TimMc | mpfundstein: -insert-in-map can be (assoc cache outlet (-sum-in-map (get cache outlet {}) vod-type transactions)) |
| 12:14 | mpfundstein | gfredericks: i understand |
| 12:15 | mpfundstein | TimMc: ok, i have to think about that :-) |
| 12:15 | gfredericks | def is for defining things just once, like your top-level functions |
| 12:15 | mpfundstein | gfredericks: ok, so its good style to not use it again, got it |
| 12:15 | gfredericks | exactly |
| 12:15 | mpfundstein | gfredericks: super |
| 12:15 | mpfundstein | gfredericks: any more ? :D |
| 12:15 | mpfundstein | TimMc: i will try that, thx for the input |
| 12:16 | TimMc | mpfundstein: -sum-in-map can be similarly modified |
| 12:16 | mpfundstein | TimMc: yeah, i had a hard time figuring out how to finally do it, if key exists work on value, otherwise create value |
| 12:16 | gfredericks | update-in with fnil |
| 12:16 | mpfundstein | TimMc: thought already that it must be easier |
| 12:17 | mye | hm, trying to use lein with a maven project, lein-maven can't be installed, lein-nevam given null pointer exception :-\ |
| 12:17 | TimMc | mpfundstein: Nota bene: My suggestions there assume that there won't be a nil in cache. |
| 12:17 | TimMc | &(get {:a nil} :a 0) |
| 12:17 | mpfundstein | TimMc: what is that? |
| 12:18 | mpfundstein | TimMc: the & |
| 12:18 | TimMc | bot eval trigger |
| 12:18 | TimMc | But the bot is dead or something. |
| 12:18 | TimMc | $ping |
| 12:18 | mpfundstein | ah k |
| 12:18 | mpfundstein | :D |
| 12:18 | mpfundstein | yesterday it was ' |
| 12:18 | mpfundstein | '(println "hello") |
| 12:18 | mpfundstein | ok wrong assumption |
| 12:18 | mpfundstein | ^^ |
| 12:18 | gfredericks | both the dang bots are dead |
| 12:18 | TimMc | ,(+ 1 2) ;; and clojurebot is down as well |
| 12:18 | clojurebot | eval service is offline |
| 12:19 | mpfundstein | hey , he responded |
| 12:19 | mpfundstein | :- |
| 12:19 | mpfundstein | ) |
| 12:19 | TimMc | Oh, lazybot isn't even in the channel. |
| 12:19 | mpfundstein | ok thanks guys, i will no go on with my study of clojure |
| 12:19 | mpfundstein | any tips :-) |
| 12:19 | mpfundstein | ? |
| 12:19 | mpfundstein | (avoid state hrhr) |
| 12:19 | gfredericks | :) |
| 12:19 | TimMc | mpfundstein: So yeah, take a look at (get {:a nil} :a 0) vs. (or (get {:a nil} :a) 0). |
| 12:20 | TimMc | Don't use the suggestion I made unless you understand why those behave differently. :-) |
| 12:20 | mpfundstein | TimMc: that for sure |
| 12:20 | mpfundstein | TimMc: i am not naive ;-) |
| 12:20 | gfredericks | does anybody know of a cljs lib for seeded randomness, or should I create one? |
| 12:22 | TimMc | mpfundstein: It's not a question of naïveté -- I shouldn't have made that suggestion without asking about cache. It's an inherently tricky case. |
| 12:23 | mpfundstein | TimMc: true, but as it is for my learning i consider it as good input |
| 12:24 | mpfundstein | TimMc: the danger would be if i would blind-eyed take it as a definite answer and use in my programs |
| 12:24 | gfredericks | it seems rather stark that clojure.core's random functions don't have a *rand* var they rely on :( |
| 12:25 | smnirven | hey folks, im trying to get clojure.java.jdbc/execute! to work, anyone used that function? |
| 12:27 | frozenlock | Is there something I'm missing here? I use noir.response/json to encode a map into json. However the guy at the receiving end says the keywords with hypen '-' aren't working and ask me to convert them to underscores '_'. To my knowledge, '-' is a valid json character, is it not? |
| 12:27 | smnirven | gfredericks: okay, im going crazy, i know I just need an extra set of eyes to figure out why this doesnt work |
| 12:27 | smnirven | gfredericks: https://gist.github.com/smnirven/5077092 |
| 12:28 | gfredericks | smnirven: you never closed off your list of column names |
| 12:28 | smnirven | UGHHHHHHHHH |
| 12:29 | smnirven | god i knew it was something stupid like that |
| 12:33 | smnirven | gfredericks: okay, one more weird thing - when I try to load my file in nrepl, it says "No such var: sql/execute!" |
| 12:34 | gfredericks | you have (:require [clojure.java.jdbc :as sql])? |
| 12:34 | smnirven | aye |
| 12:35 | gfredericks | I have no ideas then |
| 12:35 | gfredericks | unless it's private |
| 12:35 | gfredericks | well that's probably not it |
| 12:36 | smnirven | yeah doesnt look like it |
| 13:04 | noncom | hi anyone familiar with Luminus web framework and creating forms in it? |
| 13:06 | edtsech | noncom: hi, it just uses hiccup for that |
| 13:06 | noncom | yeah, there is a single problem for me: how do i specify a link for action that is relative to the root address? |
| 13:07 | nightfly | A regular relative link? |
| 13:08 | frozenlock | in hiccup? IIRC "/some-url" will go to BASE-URL/some-url, while "some-url" will go yo BASE-URL/current-url/some-url (or vice versa) |
| 13:10 | noncom | oh, thanks! |
| 13:18 | gfredericks | it's just being translated into the href attribute directly, so it's subject to how the browser interprets it |
| 13:18 | smnirven | gfredericks: just fyi, i switched it up to use do-commands and that seems to be doing the trick |
| 13:19 | gfredericks | ah right |
| 13:24 | dobladez | ok, not really a Clojure question, but: Anybody using edn on client-side javascript? |
| 13:25 | dobladez | I'm looking at https://github.com/shaunxcode/jsedn ; but seems to need a bit of modification to work outside of NodeJS ... Or am I missing something? |
| 13:41 | sritchie | do you guys have any good tips on configuring a ring app to force https for every URL? |
| 13:42 | sritchie | or is that a bad idea, and should I restrict https to certain URLs only |
| 13:42 | weavejester | sritchie: Create some middleware that redirects if the URL scheme is :http |
| 13:42 | sritchie | weavejester: okay, and that's recommended over .htaccess tricks? |
| 13:42 | augustl | are there any ways to exclude dependencies from "lein uberwar", alternatively are there CLI tools to remove .jars from a .war? |
| 13:43 | weavejester | sritchie: Well, you can do it via any mechanism, it amounts to the same thing |
| 13:43 | augustl | err, "lein ring uberwar" |
| 13:44 | weavejester | augustl: A war file is just a zip, so easily modified with zip/unzip. You could use profiles to exclude jars as well. |
| 13:44 | weavejester | augustl: I don't think there's an option for it, yet... |
| 13:46 | sritchie | weavejester: for heroku clojure apps, can one just add ".htaccess" to the resources folder? |
| 13:46 | weavejester | sritchie: I don't think so. |
| 13:47 | sritchie | I guess I could configure the middleware to only run in "production" mode |
| 13:47 | sritchie | so no SSL cert is needed locally |
| 13:47 | sritchie | just trying to figure out best practices here |
| 13:48 | weavejester | sritchie: If you're using Heroku, probably the best way to do it is to have some middleware that's applied if a certain environment variable is set, such as FORCE_SSL. |
| 13:48 | sritchie | weavejester: gotcha, makes sense |
| 13:49 | dobladez | sritchie: cemerick/friend has requires-schemes middleware that does channel security |
| 13:50 | dobladez | sritchie: https://github.com/cemerick/friend#channel-security |
| 13:50 | sritchie | oh, cool |
| 13:50 | sritchie | okay, great, there's my middleware. |
| 13:51 | sritchie | thanks guys |
| 13:52 | augustl | weavejester: ah, profiles makes sense. I guess leiningen can exclude dependencies etc |
| 13:53 | weavejester | augustl: I believe so |
| 13:53 | augustl | trying to figure out how to best accommodate a tomcat7 setup where I want some of the .jars in the uberwars generated by lein ring to not be in the war, but in tomcat7's shared lib folder |
| 13:53 | weavejester | That sounds like a job for a profile |
| 13:54 | augustl | cool! |
| 13:56 | smnirven | anybody every use the postgres postgis functions with clojure.java.jdbc? |
| 13:58 | nightfly | I'm sure they have. Go ahead and ask you question. |
| 14:02 | augustl | smnirven: only used basic mysql with clojure.java.jdbc 0.23 |
| 14:02 | smnirven | im continually beating my head against the wall cause I need to use a postgis geometry query inside of with-query-results |
| 14:03 | smnirven | and when the query reaches postgres it interprets it as a varchar |
| 14:03 | smnirven | let put what im trying todo in a gist |
| 14:06 | smnirven | nightfly: augustl https://gist.github.com/smnirven/5077704 |
| 14:09 | smnirven | when I run my peek function, I get this error PSQLException The column index is out of range: 1, number of columns: 0. org.postgresql.core.v3.SimpleParameterList.bind (SimpleParameterList.java:53) |
| 14:11 | mye | anyone using autodoc with leiningen2? |
| 14:11 | mye | I get an error when I put it in :user :plugins [lein-autodoc "0.9.0"] |
| 14:12 | augustl | smnirven: and I guess you've tried running a similar query in the postgres console? |
| 14:12 | smnirven | augustl: yep |
| 14:12 | smnirven | augustl: here's my query in the postgres console |
| 14:13 | smnirven | SELECT eggs.*, (ST_Distance(eggs.point, 'POINT(-78.51500 38.00705)'::geometry)) AS distance from eggs |
| 14:13 | smnirven | augustl: that works splendidly in the postgres console |
| 14:13 | tomoj | 'POINT (? ?)' is quoted, so they're not parameters |
| 14:15 | smnirven | tomoj: its almost like I need to build up the POINT variable as its own string, and send that as the query param |
| 14:16 | tomoj | or maybe ST_Point(?, ?) ? |
| 14:16 | smnirven | there we go |
| 14:16 | smnirven | I think I got it |
| 14:16 | smnirven | ["SELECT eggs.*, (ST_Distance(eggs.point, ?::geometry)) AS distance FROM eggs" (str "POINT(" lng " " lat ")")] |
| 14:16 | smnirven | tomoj: seems like a hack but it worked |
| 14:19 | augustl | ah |
| 14:30 | derekv | so if i have a niave bruteforce algo but it should be working lazily, I don't think it should run out of memory... |
| 14:31 | derekv | oh hey look it works if i crank up the memory |
| 14:31 | derekv | on an input size 21, have a feeling it wouldn't work for eg 30 |
| 14:38 | weavejester | derekv: Are you holding onto the head of the seq? |
| 14:39 | weavejester | derekv: That's the usual cause of a lazy algorithm consuming more memory than it should. |
| 14:40 | derekv | weavejester, ok... I've got a set, and I use subsets on that, then I filter, then I reduce. |
| 14:40 | derekv | which should leave me with one set (the optimum) |
| 14:41 | weavejester | subsets from where? |
| 14:41 | derekv | contrib.combinitorics |
| 14:42 | derekv | i'll paste |
| 14:42 | derekv | https://www.refheap.com/paste/12043 this is just the knapsack problem |
| 14:43 | derekv | and I just went for an obiovious to me brute force solution to start |
| 14:43 | derekv | still pretty new to functional programming and especially clojure so I'm not sure how to guage the cost of things. |
| 14:45 | weavejester | That looks okay, actually... |
| 14:45 | weavejester | How large is "dolls"? |
| 14:46 | derekv | works fine on inputs like 5 or 6, but i have a functional test thats got 21 |
| 14:46 | weavejester | derekv: A size of 21 runs out of memory? |
| 14:46 | derekv | That makes it think for a minute, and abort with default jvm settings. if i crank up xmx it finishes. |
| 14:46 | derekv | yea. |
| 14:46 | weavejester | So (count dolls) => 21 |
| 14:46 | weavejester | ? |
| 14:46 | derekv | yes. |
| 14:47 | derekv | let me get the exact error... |
| 14:47 | weavejester | Hmm, subsets *looks* lazy enough |
| 14:48 | weavejester | And you're not holding onto the head of the seq |
| 14:48 | derekv | It says its lazy in the doc. |
| 14:51 | weavejester | derekv: I don't see a problem just looking at it, I'm afraid. You might want to build it up a bit at a time, to see where the issue might be. |
| 14:54 | derekv | https://www.refheap.com/paste/12044 this is the error, but I think thats just a normal out of memory error |
| 14:59 | derekv | is it possible Im holding onto it higher up in the stack? full code-> http://tinyurl.com/cu8lfhw I guess I'm not sure what holding onto the head of the seq means. unless reduce holds onto it |
| 14:59 | derekv | but reduce is just a recursion with accumulator right? |
| 14:59 | weavejester | derekv: Oh, that's not a normal out of memory error |
| 15:00 | weavejester | That's an error thrown when too much time is spent GCing |
| 15:00 | derekv | JvmIsStupidAndWhyDoesntItSolveAllMyProblemsForMeException |
| 15:00 | weavejester | specificially "if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered" |
| 15:00 | derekv | hmm |
| 15:01 | derekv | That would still imply that a bunch of memory is being held at least temporarily right? |
| 15:02 | weavejester | derekv: Ohh, hum, you have some odd things in your code |
| 15:02 | derekv | no doubt |
| 15:02 | derekv | but not on purpose. |
| 15:02 | weavejester | derekv: You're using the very old clojure.contrib library, which was deprecated years ago |
| 15:02 | weavejester | derekv: You probably want to use clojure.math.combinatorics instead: https://github.com/clojure/math.combinatorics |
| 15:03 | derekv | *sigh, I guess thats the drawback to the hyperavailability of solutions and example code on the internet |
| 15:03 | derekv | weavejester, nice I'll take a look |
| 15:03 | weavejester | Doll doesn't need to be a record, because you're not doing anything with protocols per se |
| 15:03 | weavejester | I'm not sure whether using math.combinatorics will help, but it's worth using up-to-date code just in case there's some sort of leak in the older code. |
| 15:05 | weavejester | It's a little strange you're returning a one-element set from your solver function... |
| 15:05 | weavejester | You could also use preconditions inetad of solver-argument-validator |
| 15:07 | weavejester | But… I'm not sure why the app would be spending so much time GCing... |
| 15:07 | derekv | weavejester, I tried the preconditions thing but couldn't get the syntax to work off the examples I was looking at. |
| 15:08 | weavejester | derekv: It would be something like... |
| 15:08 | derekv | The final (or initial, if reading top down) 'set' in the solver is just to make sure what is returned is a set... it should be a set of dolls, unless i'm misunderstanding what that does, but it seems to pass my unit tests |
| 15:08 | weavejester | {:pre [(number? max-weight) (pos? max-weight) (coll? dolls)]} |
| 15:09 | weavejester | ,(set [1 2 3]) |
| 15:09 | clojurebot | eval service is offline |
| 15:09 | weavejester | ~(set [1 2 3]) |
| 15:09 | ibdknox | &(set [1 2 3]) |
| 15:09 | weavejester | Hum, you might be right. I might be misremembering the syntax. |
| 15:09 | ibdknox | lazybot isn't here |
| 15:10 | ibdknox | This must be the apocalypse |
| 15:10 | ibdknox | Raynes: where's lazybot? |
| 15:10 | derekv | weavejester, yea I was trying that very early on and it just wouldn't work, so I gave up on it since i had like 1 hour into writing clojure at that point it was too confusing to fight with it over syntax when I had no clue why it wasn't working. |
| 15:10 | Raynes | Vacation. |
| 15:11 | ibdknox | We all need one |
| 15:11 | weavejester | derekv: Fair enough :) |
| 15:11 | weavejester | On another note, has anyone heard of a project that uses git as a microblogging system? |
| 15:11 | Raynes | &(+ 3 3) |
| 15:11 | lazybot | ⇒ 6 |
| 15:12 | derekv | weavejester, microblogging not sure... there's a bunch of static site generators that support blogging and integrate with git |
| 15:12 | yogthos | weavejester: that's more or less what I'm doing with the luminus docs site |
| 15:12 | ibdknox | weavejester: https://github.com/cloudhead/toto |
| 15:12 | ibdknox | gfredericks: |
| 15:13 | ibdknox | gfredericks: whoops, what bug? |
| 15:13 | weavejester | I mean, not a microblog website built on git, but a microblog system build from git and terminal commands |
| 15:13 | derekv | I was trying to find one that kept a seperation between the articles and the code , like seperate repositories |
| 15:14 | weavejester | I'm building one, and I don't think it's been done before, but it's always possible I've missed something. |
| 15:14 | derekv | weavejester, oh... you could rig something up with org-mode, git and remember if you live in emacs |
| 15:14 | ibdknox | I'm not sure I understand what that means :) |
| 15:14 | gfredericks | ibdknox: a scoping bug with (doseq [... :let [f #(...)]] ...) |
| 15:14 | gfredericks | making a gist now |
| 15:15 | weavejester | In the system I've got, I'm abusing git commits as microblog entries. |
| 15:15 | weavejester | So I can type: git upto add "Doing something" |
| 15:15 | weavejester | To view the entries: git upto log |
| 15:15 | yogthos | weavejester: should work pretty well, what I ended up doing is caching the pages locally, so if github goes down or gets slow there's no hit |
| 15:16 | weavejester | And to sync with a remote: git upto link git@…; git upto sync |
| 15:16 | ibdknox | haha |
| 15:17 | derekv | You really mean that small ... not sure why you'd need git for what amounts to a list of strings with possibly datestamps on them |
| 15:17 | gfredericks | ibdknox: https://gist.github.com/fredericksgary/5078092 |
| 15:17 | yogthos | github does provide a nice webui for editing your md files :) |
| 15:18 | yogthos | I just ended up doing this https://github.com/yogthos/luminus/blob/master/src/luminus/util.clj |
| 15:18 | clojure-new | sjl: Hello, i'm using your library(clojure-lanterna) and it's great! But is it possible to hide cursor? |
| 15:18 | weavejester | derekv: A static file works with only one user, but in a team you'd need to be able to sync messages without losing any. |
| 15:19 | ibdknox | gfredericks: huh, nice catch |
| 15:20 | gfredericks | looks like for does not have the same issue |
| 15:22 | gfredericks | looks like it's CLJS-39; I must not have the latest code? :/ |
| 15:23 | gfredericks | supposedly fixed back in september |
| 15:23 | ibdknox | I'm on the latest |
| 15:23 | ibdknox | and it's definitely happenin |
| 15:23 | ibdknox | g |
| 15:23 | derekv | is all of clojure.contrib out of date? |
| 15:25 | derekv | where do I get that nice defnk macro |
| 15:28 | weavejester | derekv: You don't really need it for modern Clojure versions, as you can use destructuring |
| 15:28 | weavejester | Although I guess the syntax might not be as nice. |
| 15:34 | ivan | did you know jdk.map.althashing.threshold exists http://docs.oracle.com/javase/7/docs/technotes/guides/collections/changes7.html |
| 15:46 | derekv | hmm it always craps out on the reduce is bag-weight |
| 15:51 | derekv | what would be better than defrecord for my items? |
| 15:51 | derekv | if this was C i'd just use a struct, that was what I was going for |
| 15:54 | xeqi | https://github.com/cemerick/clojure-type-selection-flowchart |
| 15:56 | xeqi | ,"no eval? denied!" |
| 15:56 | clojurebot | "no eval? denied!" |
| 15:56 | hiredman | clojurebot: oomkiller? |
| 15:57 | hiredman | clojurebot: oomkiller? |
| 15:57 | xeqi | ,(+ 1 2) |
| 15:57 | clojurebot | 3 |
| 15:57 | clojurebot | Gabh mo leithscéal? |
| 15:57 | xeqi | hmm, guess it works now |
| 15:57 | hiredman | clojurebot: oomkiller is what you get for running on a t1.micro |
| 15:57 | clojurebot | You don't have to tell me twice. |
| 15:58 | akhudek | that chart is great! |
| 16:00 | gfredericks | ibdknox: oh good to know; I'm terrible at telling what version I'm on or running tests out of the project |
| 16:00 | gfredericks | how do we handle regressions on jira? new ticket or old ticket? |
| 16:00 | gfredericks | oh actually I think my bug is subtler than this one |
| 16:14 | Raynes | ibdknox: ohai |
| 16:18 | ibdknox | Raynes: hola |
| 16:19 | Raynes | ibdknox: How is the paredit contracting going? |
| 16:19 | Raynes | I may have already asked this. |
| 16:19 | Raynes | Apologies if I have. |
| 16:19 | ibdknox | fell through |
| 16:19 | Raynes | Shame. |
| 16:19 | ibdknox | I added auto-pair completion myself |
| 16:19 | ibdknox | I might add slurp and barf |
| 16:19 | Raynes | I bet it was like "Oh. Oh wait. I have to do this in javascript? Yeah, no." |
| 16:20 | ibdknox | haha |
| 16:20 | ibdknox | nah, he just got busy with other things |
| 16:36 | derekv | hey whats the lightest weight thing I can use to represent an aggregate collection of three things (preferabbly named), one short string and two ints |
| 16:37 | Raynes | A map? |
| 16:38 | derekv | map is lighter than record? |
| 16:38 | Raynes | If you don't need a type there is rarely a reason to use a record. |
| 16:38 | derekv | just curioust, probably the problem isn't with the data objects i'm using |
| 16:38 | derekv | ok |
| 16:44 | gfredericks | http://dev.clojure.org/jira/browse/CLJS-481 |
| 16:47 | derekv | actually it can't be the problem, i got like 20 of these objects, i never 'change' them, just put them in different subsets, so the items themselves should never get dupblicated ... |
| 17:00 | bws | Hey looking for some help with an error during clojure koans |
| 17:01 | bws | I get "clojure.lang.Keyword cannot be cast to java.lang.Number" when I try to solve the second problem in exercise 10 of the clojure koans |
| 17:02 | bws | copy pasting that in a repl returns true |
| 17:03 | bws | (= [0 1 2 3 4] (range 5)) is the problem that returns the error. Any helps appreciated. Thanks. |
| 17:11 | leku | works for me bws |
| 17:12 | bws | Thanks for trying it out leku |
| 17:12 | bws | It works for me in the regular repl, but as a whole the koans script doesn't work for me when I enter that. |
| 17:12 | Raynes | Could you paste the whole thing on https://www.refheap.com? |
| 17:13 | bws | I'm trying to see if any of the previous solutions might somehow be causing some error. |
| 17:13 | bws | But this only happens when I enter the solution to this question. If I delete it, it doesn't whine. |
| 17:14 | Raynes | We might be able to help, but we definitely need to see it in context. |
| 17:14 | bws | Raynes https://www.refheap.com/paste/12051 |
| 17:14 | bws | That's the one file (10th one in the exercise) |
| 17:15 | leku | what version of clojure are you using? |
| 17:15 | leku | and java |
| 17:15 | leku | java -version |
| 17:15 | Raynes | Why would that matter? |
| 17:15 | bws | clj 1.5 |
| 17:15 | leku | just wondering |
| 17:15 | leku | why wouldn't it? |
| 17:15 | bws | java 1.7 |
| 17:15 | leku | those aren't good things to know? |
| 17:16 | bws | Well if it helps any, I did tyr it in clj 1.5 repl with the expected output |
| 17:16 | Raynes | This looks fine. Not sure what is going on. |
| 17:17 | bws | That's what's driving me crazy! |
| 17:17 | leku | lol i bet |
| 17:17 | leku | i've had some weird crap happen to me lately too |
| 17:17 | leku | frustrating |
| 17:17 | Raynes | I would expect that this is a problem with the koans. |
| 17:18 | leku | and clj 1.5 perhaps? |
| 17:18 | leku | it was just released pretty recently right? |
| 17:18 | leku | I just did the koans up to 10 I think a few days ago in 1.4 |
| 17:18 | leku | worked fine |
| 17:19 | bws | I mean the solution seems straightforward, there's definitely something funky going on with the koans runner or something perhaps. |
| 17:19 | bws | Up until this one I didn't see any issues. |
| 17:20 | bws | Going to dive into the runner script |
| 17:21 | Raynes | bws: Yeah, `lein koan run` is giving me the same failure in this situation. I call broken koans. |
| 17:21 | jcromartie | so I'm doing a presentation on Tuesday night on where FP fits in web programming |
| 17:21 | bws | Alright thanks for the confirmation. |
| 17:21 | Raynes | I'm pretty sure I know how to program in Clojure, so... |
| 17:21 | Raynes | :p |
| 17:22 | jcromartie | I'm going to touch on Compojure and some of the functional aspects of Backbone and Underscore for JS code... |
| 17:22 | jcromartie | but I'm pretty much talking out my butt here |
| 17:22 | jcromartie | any thoughts? |
| 17:22 | bws | Hehe.. I'll just see if I can find out what the issue is. A little more learning. Thanks Raynes and leku |
| 17:22 | Raynes | jcromartie: Well, I'd start by not talking out of your ass. If you think you're doing that they probably will too. :p |
| 17:23 | jcromartie | I'll try |
| 17:23 | jcromartie | I mean the obvious starting point is that the request/response cycle lends itself to simple functions |
| 17:23 | jcromartie | which Compojure demonstrates nicely |
| 17:24 | jcromartie | and then using functional templates in Backbone gets away from stateful jQuery spaghetti |
| 17:24 | Raynes | jcromartie: You give 'em the old "Less state = easier to understand and reason about". You could also talk about how the Clojure stack is super minimal and pluggable. Show them how easy it is to switch between things like hiccup, laser, and clabango. Show them middleware and stuff. |
| 17:24 | jcromartie | not that these frameworks are the only options |
| 17:24 | jcromartie | yah |
| 17:24 | jcromartie | I am going to put together a little concurrent chat server |
| 17:24 | jcromartie | and show how it's a few lines of code, and handles some large number of concurrent connections |
| 17:25 | jcromartie | with no hiccups and no errors |
| 17:25 | jcromartie | as long as you keep things nice and pure |
| 17:26 | derekv | my app is spinning all four cpus pretty hard |
| 17:26 | derekv | it doesn't automatically parrellelize somehowe does it? |
| 17:27 | derekv | i can't even spell that word. |
| 17:33 | jcromartie | derekv: what is your app? can you show code? |
| 17:39 | bws | Raynes and leku: Confirmed with the author of clojure-koans, there is a bug in there. |
| 17:40 | Raynes | Excellent. |
| 17:40 | derekv | jcromartie, yea http://tinyurl.com/cu8lfhw |
| 17:40 | Raynes | Well, not excellent. |
| 17:40 | Raynes | But great that you confirmed it. |
| 17:40 | derekv | jcromartie, cpu is expected not sure why it runs out of memory |
| 17:41 | derekv | or rather crashes due to gc overhead limit |
| 17:41 | bws | Now to figure out how to pull updated changes from the author's github repo into mine. |
| 17:41 | bws | Adding upstream seems to be the solution. |
| 17:42 | derekv | and not sure why it uses all four cpus unless 300% is GC |
| 17:42 | jcromartie | derekv: 300% would be 3 cores, no? |
| 17:42 | derekv | jcromartie, thats what I meant yea sorry |
| 17:43 | derekv | jcromartie, it uses > 300% when running, closer to %400, on a 4core machine |
| 17:45 | seangrove | Is it possible to do deep destructing to avoid code like this? https://www.refheap.com/paste/5592dbe0999cd64c75c49db3e |
| 17:45 | seangrove | (let [profile (get (first (get profile "profile")) "merges")] ...) |
| 17:45 | jcromartie | derekv: are you getting any OOM crashes? |
| 17:46 | jcromartie | derekv: I'm pretty sure that none of the combinatorics functions yield infinite seqs |
| 17:46 | jcromartie | derekv: but they can be very *very* large |
| 17:46 | jcromartie | and if you give them an infinite seq, then you will have problems |
| 17:46 | derekv | jcromartie, yes. usually GC overhead limit crash, sometimes heap space. it finishes if i turn up heap. input size 21 |
| 17:47 | derekv | jcromartie, I thought it was lazy, but I was trying to figure that out ... |
| 17:47 | derekv | the subset function |
| 17:49 | derekv | 21 should yield a couple million combinations I think, but they shouldn't all be in memory |
| 17:49 | jcromartie | yeah, they're lazy |
| 17:49 | jcromartie | they're all lazy |
| 17:50 | derekv | i figure you could get subsets by mapping bits in an int to items, then counting 0 - 2^n |
| 17:50 | derekv | so there'ss at least one way to do it without eating memory |
| 17:51 | jcromartie | derekv: but you're not giving any of those combinatorics functions an infinite seq, right? |
| 17:51 | jcromartie | derekv: how about some println debugging |
| 17:51 | derekv | jcromartie, good thought |
| 17:52 | derekv | i don't see how it should get anything infinate |
| 17:52 | leku | bws where was the bug? |
| 17:52 | sw1nn | anyone have any problems with nrepl-middleware/wrap-javadoc? I'm trying to pass local-paths to local javadocs and i get an exception when I do nrepl-jack-in: http://pastebin.com/KJAdH0Bw |
| 17:53 | bws | leku: The author said he'll fix it, I have no clue where it was. I'm independently trying to figure out. |
| 17:53 | leku | weird.. |
| 17:54 | leku | wonder how i got through them the other day |
| 17:54 | bws | Maybe some recent change |
| 17:55 | bws | I forked it last night. |
| 17:57 | tomoj | seangrove: please put a newline before `profiles` :) |
| 17:57 | seangrove | tomoj: where the docstring should be? |
| 17:58 | tomoj | no I mean (map (fn ....) \newline coll) when (fn ...) is multiline |
| 17:58 | tomoj | btw, your map fn appears to always return nil? |
| 17:58 | seangrove | Oh, yes, that's just a wip |
| 17:59 | seangrove | I saw the (get (first (get ....))) and thought some deep destructing would really help clean it up |
| 17:59 | seangrove | Not sure if that works in clojure though, so just asking |
| 17:59 | tomoj | it looks like [list-id {"profile" [{"merges" merges}]}] ? |
| 18:00 | seangrove | {"profile" [{"merges" [...]}]} |
| 18:00 | seangrove | so a combination of arrays of maps with strings as keys |
| 18:01 | tomoj | er |
| 18:01 | tomoj | I meant [list-id {[{merges "merges"}] "profile"}] |
| 18:01 | tomoj | as the params |
| 18:03 | seangrove | profiles looks like {"list-id" {"profile" [{"merges" [{}]}]}} |
| 18:03 | tomoj | &((fn [[list-id {[{:strs [merges]}] "profile"}]] [list-id merges]) [[1 {"profile" [{"merges" [1 2 3]}]}]]) |
| 18:03 | lazybot | ⇒ [[1 {"profile" [{"merges" [1 2 3]}]}] nil] |
| 18:03 | seangrove | Porting some ruby code to clojure that's dealing with a 3rd-party api |
| 18:03 | amalloy | seangrove: i don't think you're understanding tomoj's suggestion |
| 18:03 | seangrove | amalloy: I don't think so either :) |
| 18:03 | tomoj | well, close, I think.. |
| 18:03 | seangrove | tomoj: That's great, thanks |
| 18:04 | seangrove | I'll take that and run with it... certainly much nicer than my code |
| 18:04 | seangrove | Is it possible to do the same thing inside of a `let` binding though? |
| 18:05 | seangrove | Ah, yes, that should work :) |
| 18:05 | seangrove | Thanks for that, sorry to be so thick |
| 18:06 | deeplloyd | on arch linux, when using lein as root i get a warning to set LEIN_ROOT. Where and to what do I set this to? Is it /usr/bin/lein ? |
| 18:15 | alandipert | deeplloyd: setting to anything non-empty will disable the warning |
| 18:15 | alandipert | deeplloyd: e.g. # LEIN_ROOT="true" lein ... |
| 18:15 | deeplloyd | ok yea i just did 1 and it worked |
| 18:16 | deeplloyd | just wanted to double check because il forget that mod down the line |
| 18:16 | deeplloyd | if i run as not root i get a shit load of errors |
| 18:17 | TimMc | deeplloyd: Out of curiosity... why as root? |
| 18:17 | amalloy | deeplloyd: that's because you installed as root |
| 18:18 | amalloy | definitely recommend installing as the user who's going to run it; just put it in ~/bin or somewhere |
| 18:18 | deeplloyd | i am required by pacman/aur to makepkg as non root, but in order to install i need to be root to run pacman |
| 18:25 | leku | anyone familiar with nanite? |
| 18:28 | derekv | its something in my input function |
| 18:28 | derekv | i thought actually there'd be no problem there since i use slurp |
| 18:28 | derekv | something about my input function makes the rest of it blow up |
| 18:30 | derekv | so I got a line like : (set (filter identity (map parse-doll (split-lines input)))) ... input comes from (slurp *in*) , so this shouldn't be an infinate seq? or is it? |
| 19:01 | muhoo | i'm dealing with a java library that has a big blob of global state, a server in fact. where's the best place to store it? an atom in a *foo* in an ns somewhere? |
| 19:28 | Rich_Morin | Clojure functions can be defined in multiple sections, each of which handles a different arity (ie, number of arguments). Is there a preferred name for these sections? |
| 19:33 | tomoj | "arities"? "overloads"? |
| 19:33 | Raynes | tomoj: Arities. |
| 19:33 | tomoj | is that metonymy? |
| 19:37 | TimMc | Pretty much. |
| 19:37 | amalloy | $dict metonymy |
| 19:37 | lazybot | amalloy: noun: A figure of speech in which one word or phrase is substituted for another with which it is closely associated, as in the use of Washington for the United States government or of the sword for military power. |
| 19:39 | TimMc | $dict synecdoche |
| 19:39 | lazybot | TimMc: noun: A figure of speech in which a part is used for the whole (as hand for sailor), the whole for a part (as the law for police officer), the specific for the general (as cutthroat for assassin), the general for the specific (as thief for pickpocket), or the material for the thing made from it (as steel for sword). |
| 19:40 | TimMc | All these violent examples. |
| 19:40 | TimMc | Also, I had no idea that an amalloy was a figure of speech. |
| 19:41 | Rich_Morin | Calling the section of a function that handles a particular "arity" an "Arity" seems a lot like synecdoche. Is this common usage? |
| 19:43 | ayia | Hi guys, (cons x seq) returns a sequence where x is the first element and seq is the last. It there a function in clojure that returns a sequence where seq are the first elements and x is the last? |
| 19:44 | TimMc | ayia: concat is prety close |
| 19:45 | TimMc | Just be warned that adding stuff onto the end of a seq tends to be relatively expensive. |
| 19:49 | ayia | TimMc: Thanks! What is it expensive? Is it expensive for all collections? or just for vector? |
| 19:49 | TimMc | Specifically for sequences, which are not vectors. |
| 19:49 | ayia | TimMc: oh... |
| 19:49 | TimMc | ~seqs and colls |
| 19:49 | clojurebot | seqs and colls is http://www.brainonfire.net/files/seqs-and-colls/main.html |
| 19:50 | TimMc | Sequences are not random access. You have to walk or rebuild them to read or modify them. |
| 19:51 | TimMc | lazy seqs can allow you to build up a sequence starting at the head, but that's different than taking an existing seq and appending to it. |
| 19:52 | ayia | TImMc: so "more expensive" belongs only to sequences that are not lazy, correct? |
| 19:54 | TimMc | No, I only mentioned the lazy seq things because it's a way of *avoiding* appending. |
| 19:54 | TimMc | If you're doing a lot of appending, perhaps you should be conj'ing onto a vector. |
| 19:54 | TimMc | &(conj [1 2 3] :a) |
| 19:54 | lazybot | ⇒ [1 2 3 :a] |
| 19:55 | TimMc | That's an O(log n) operation. (Relatively fast.) |
| 19:56 | ayia | TimMc: hm... I see I am so week in this... Can you recommend me some article about all these "guts"? (so i won't waste your time) Or that article you already posted is enough? |
| 19:58 | TimMc | The thing I posted may not cover your questions -- that's really more about the relationship between sequences and collections, and I guess you're asking about performance and the appropriateness of various data structures. |
| 20:00 | TimMc | ayia: This has some relevant info: http://clojure.org/data_structures#Data%20Structures-Collections |
| 20:01 | ayia | TimMc: yes, i asked about performance and "when use what"... big thanks for links! You helped me a lot! |
| 20:02 | TimMc | vectors are fast for: append, random read, random update, count |
| 20:02 | TimMc | seqs are fast for: add/remove head |
| 20:11 | gfredericks | how are IPersistentList and IPersistentStack different? |
| 20:11 | gfredericks | oh it's an interface |
| 20:12 | gfredericks | well they both are |
| 20:12 | gfredericks | let's pretend I haven't said anything yet this evening. |
| 20:15 | derekv | this pretty much does it right here (filter #(let [s (reduce + %)] (and (> 200 s) (< 250 s))) (subsets (range 11 160 7))) |
| 20:15 | derekv | eats memory till the jvm chokes |
| 20:16 | gfredericks | (and (> 200 s) (< 250 s)) is always false ain't it? |
| 20:17 | Iceland_jack | Should it be (> 200 s 250) ? |
| 20:17 | gfredericks | that's even falser |
| 20:17 | Iceland_jack | *< |
| 20:18 | derekv | yea probably, its not finishing i'm just trying to isolate it |
| 20:18 | yedi | weavejester: thanks |
| 20:19 | weavejester | yedi: What did I do? |
| 20:19 | yedi | weavejester: lein-beanstalk |
| 20:19 | weavejester | yedi: Ohh |
| 20:20 | derekv | (filter #(let [s (reduce + %)] (= 88 s)) (subsets (range 0 44 22)) |
| 20:20 | derekv | anouther type |
| 20:20 | derekv | typo |
| 20:20 | derekv | going to bed |
| 20:20 | weavejester | I really need to make the configuration of lein-beanstalk better |
| 20:21 | weavejester | The default environments are bad, and the config map could be improved. |
| 20:24 | bws | Raynes leku: The author mentioned there was something funky going on with Clojure 1.3 behavior. |
| 21:05 | yedi | why might lein-beanstalk hang after creating the application war? |
| 21:51 | gfredericks | did you move to a different country? |
| 21:52 | dabd | no i didn't change anything |
| 21:52 | ivan | what does `locale` say? |
| 21:52 | dabd | where can i find it? |
| 21:53 | ivan | it comes with linux |
| 21:53 | gfredericks | clojurescript does not like js/undefined |
| 21:53 | dabd | i am running it on windows atm |
| 21:54 | ivan | http://stackoverflow.com/questions/5182451/how-to-format-double-with-dot |
| 21:54 | dabd | i noticed that when starting nrep-jack-in the nrepl-server buffer showed a message that it was retrieving clojure-1.6.0-master snapshot or something. But my proj.clj is using the latest stable version. Could it it be the cause? |
| 22:09 | fbernier | clojure noob here.. this seems to return a sequence, when what I want is the map inside the sequence .. how do I fetch it? |
| 22:09 | fbernier | (fn [x y] (first (for [index y] |
| 22:09 | fbernier | {index x}))) |
| 22:10 | fbernier | oops .. without the first |
| 22:12 | dabd | if I evaluate (java.util.Locale/getDefault) it shows |
| 22:13 | dabd | it returns* #<Locale en_US> |
| 22:13 | dabd | I'm not in the US but (format "%.1f" 0.5) should show 0.5 and not 0,5 right? |
| 22:16 | gfredericks | fbernier: y is a map and x is a key? |
| 22:17 | fbernier | gfredericks: yes |
| 22:17 | gfredericks | fbernier: (get y x) should work |
| 22:17 | gfredericks | or maybe even (y x) or (x y) depending on details |
| 22:20 | fbernier | gfredericks:actually its a 4clojure problem... |
| 22:20 | fbernier | (= (__ 0 [:a :b :c]) {:a 0 :b 0 :c 0}) |
| 22:20 | holo | hi |
| 22:21 | gfredericks | fbernier: you're supposed to assemble a map from a keylist and a val? |
| 22:23 | fbernier | "Write a function which takes a default value and a sequence of keys and constructs a map." |
| 22:25 | gfredericks | fbernier: so for always returns a sequence. That's what it's for. |
| 22:25 | gfredericks | functions you might be interested in looking at include hash-map, zipmap, into, reduce, assoc... |
| 22:26 | fbernier | gfredericks: ok thanks, got it with this but I get it's far from optimal: |
| 22:26 | gfredericks | you won't need all of those, there's just several different approaches you could have |
| 22:26 | fbernier | (fn [x y] (into {} (for [index y] |
| 22:26 | fbernier | {index x}))) |
| 22:37 | tomoj | I wonder if it makes sense to have function that turn reducers into kvreducer |
| 22:39 | Foxboron | Just came across Clozure. Obvious rip off? |
| 22:39 | brehaut | no |
| 22:40 | amalloy | Foxboron: is it obvious we ripped the name off of them? |
| 22:40 | Foxboron | amalloy: was more thinking the other way around |
| 22:40 | amalloy | only if rich has a time machine |
| 22:40 | derekv | clozure is older i think |
| 22:40 | amalloy | by a decade |
| 22:41 | Foxboron | amalloy: i do consider that plausible |
| 22:42 | Foxboron | derekv: from what i am reading is that the language it self is from the 80's. But they changed name in 2012. |
| 22:50 | ChongLi | rich definitely has a time machine |
| 22:51 | ChongLi | except I think his ideas are ripped off from the future! |
| 22:54 | dcolish | hah, yeah clozure is a just a little older |
| 23:00 | frenchyp | I am just starting to play with Seesaw. |
| 23:00 | frenchyp | I am trying to print debug information to the REPL from an event handler. |
| 23:00 | frenchyp | I understand that event handlers run in the UI thread, whose *out* isn't bound to my REPL. |
| 23:00 | frenchyp | So I am trying to work around that with the (let ... (binding ...)) trick from http://stackoverflow.com/a/4533791/127810 , but it isn't working. |
| 23:00 | frenchyp | My code is at https://www.refheap.com/paste/12062 |
| 23:00 | frenchyp | Am I missing anything obvious? |
| 23:01 | leku | hey this is an emacs/paredit question I think, but how do I force it to delete a parens? |
| 23:02 | jao | leku, C-u <BACKSPACE> |
| 23:02 | frenchyp | leku: if parens are unbalanced or empty it works, otherwise it doesn't let you. |
| 23:02 | jao | or C-u C-d |
| 23:02 | leku | thx |
| 23:02 | frenchyp | jao: oh cool |
| 23:02 | leku | finally |
| 23:02 | leku | thank you |
| 23:03 | jao | you're welcome |
| 23:17 | TimMc | leku: Selecting and then hitting C-w also works. |
| 23:34 | leku | i'm having a problem fetching some json data with clj-http and then parsing it with cheshire |
| 23:34 | leku | https://www.refheap.com/paste/12064 |
| 23:35 | TimMc | leku: I'm guessing client/get returns a response map. |
| 23:35 | Raynes | Yes. |
| 23:35 | leku | yeah |
| 23:35 | Raynes | ieure: (:body ..) |
| 23:37 | leku | basically I just want to get the data out of "values" |
| 23:40 | leku | is json the best format to maybe get this data? |
| 23:40 | leku | I think I have a few options |
| 23:40 | Raynes | Probably. |
| 23:40 | Raynes | Unless edn is another option. |
| 23:41 | leku | looks like XML, tab-delimited, or JSON |
| 23:41 | Raynes | Yes, json is your best option. |
| 23:41 | Raynes | (-> (client/get "http://waterservices.usgs.gov/nwis/iv?sites=05331580&period=P7D&format=json" {:accept :json}) :body parse-string) |
| 23:41 | Raynes | leku: ^ |
| 23:41 | leku | nice |
| 23:42 | leku | thanks |
| 23:42 | Raynes | Also, to whoever ieure is, sorry for pinging you a minute ago. I mean't leku. |
| 23:42 | Raynes | And now, I guess. |
| 23:42 | leku | oh ah hah |
| 23:42 | leku | was wondering.. |
| 23:42 | leku | wicked |
| 23:42 | leku | thanks |
| 23:52 | clifton | what is the newer site that is an alternative to clojars? |