2013-12-14
| 00:05 | akhudek | wow, gloss is much slower at reading than writing |
| 00:13 | cljr | ,(-> (concat (repeat 10 0x00) (repeat 2 0xff) [127 0 0 1]) (map char) (apply str)) |
| 00:13 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn> |
| 00:14 | cljr | ,(->> (concat (repeat 10 0x00) (repeat 2 0xff) [127 0 0 1]) (map char) |
| 00:14 | cljr | (apply str)) |
| 00:14 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 00:18 | cljr | ,(->> (concat (repeat 10 0x00) (repeat 2 0xff) [127 0 0 1]) (map char) (apply str)) |
| 00:18 | clojurebot | " |
| 00:20 | cljr | speaking of gloss, ive got a frame defined as an ascii string, and when i write out the above data using that frame, the hex output ends up like 00 .. 00 3f 3f 7f 00 00 01, when im expecting 00 .. 00 ff ff 7f 00 00 01, im a newbie at this, am i doing something wrong encoding-wise? |
| 00:23 | akhudek | https://www.refheap.com/21752 |
| 00:23 | akhudek | ouch |
| 00:24 | akhudek | cljr: I'm not sure. Are you sure the string encoding is right? Maybe it's utf-16 or something? |
| 00:25 | cljr | well, when i use (str ..) that is a utf-16utf-16 string, rights? |
| 00:25 | cljr | But even if i change the frame to use that, i get even weirder hex output than i would expect |
| 00:27 | akhudek | cljr: looks like you can specify the encoding in your frame definition |
| 00:28 | akhudek | https://github.com/ztellman/gloss/wiki/Introduction |
| 00:29 | cljr | akhudek: yeah, that is what i mean, when i change it to :utf-16, output is even more off |
| 00:33 | akhudek | cljr: ah, I don't know then |
| 00:42 | akhudek | yikes, a custom reader takes only 7.7msec vs 4428msecs using gloss. |
| 00:43 | deadghost | is there a sleep function to delay running code? |
| 00:43 | deadghost | or do I need to roll my own/pull from java |
| 00:43 | akhudek | deadghost: Thread/sleep |
| 00:44 | akhudek | deadghost: if you need to schedule code to run later and continue, then you can start a thread where the first call is Thread/sleep |
| 00:44 | akhudek | deadghost: there are also scheduling libraries if you want more sophisticated functionality |
| 00:46 | TEttinger | deadghost, overtone's at-at is very good. |
| 00:56 | cljr | well, maybe i know what my issues is, is a char[] in C/C++ the same as a String in Java? |
| 00:59 | dsrx | no |
| 01:02 | dsrx | a String in java is more like a std::string in C++ |
| 01:06 | amalloy | cljr: ascii is a 7-bit encoding, right? so i'm not sure it's well-defined what gloss "should" do if you ask it to encode (char 0xff) |
| 01:14 | akhudek | cljr: unicode-8 is not a simple char[] |
| 01:14 | akhudek | cljr: however, you should only encounter a difference if you have data that is outside the standard ascii set |
| 01:18 | marcopolo2 | anyone use clj-webdriver? It crashes my nrepl server whenever I spawn a new browser, anyone experience that? |
| 02:29 | ddellacosta | what do I use to get cider to recognize functions declared in the namespace I'm working in? |
| 02:29 | ddellacosta | C-c M-n doesn't seem to do it |
| 02:51 | divyansr__ | , (list 1 1 ) |
| 02:51 | ddellacosta | nevermind, needed to use C-c C-n. |
| 02:51 | clojurebot | (1 1) |
| 02:54 | alfred | help |
| 03:22 | TEttinger | Alfred, do go on |
| 03:53 | bitemyapp | Alfred: refheap.com |
| 04:11 | Pupeno | Is there a html template for Clojure that automatically escapes strings unless they been marked as safe, like Rails? |
| 04:12 | justin_smith | I think any of the moustache-derived ones should do that |
| 04:15 | Pupeno | justin_smith: it seem so, from mustache's docs: "All variables are HTML escaped by default. If you want to return unescaped HTML, use the triple mustache: {{{name}}}." |
| 04:15 | Pupeno | Is Hiccups the only structure-based template? |
| 04:15 | justin_smith | the one I use is the one we developed for caribou, antlers |
| 04:15 | justin_smith | what do you mean by structure-based - like the input is edn? |
| 04:16 | justin_smith | if so laser and enlive both can use edn data structures in templating |
| 04:17 | Pupeno | justin_smith: not sure what edn is, but what I mean is that you build a tree so you cannot accidentally open a tag without closing it, like hiccups or in rails, haml. |
| 04:17 | justin_smith | edn is the clojure equivalent of json |
| 04:17 | justin_smith | the basic data literals |
| 04:17 | Pupeno | enlive reminds me too much of the zope/plone template engine. It seemed like a good idea in paper but in the day to day it was a nightmare. |
| 04:19 | Pupeno | laser seems of the same kind as enlive and zope's |
| 04:19 | Pupeno | TAL, that was the name of Zope's. |
| 04:20 | justin_smith | I can say those are the ones I can think of off the top of my head, but usually it is the front end guy doing the template stuff, so we use something based on moustache because it is a syntax they are familiar with |
| 04:21 | justin_smith | so I don't have much experience with clojure-centric templating |
| 04:21 | justin_smith | (though antlers is done in clojure and uses clojure in the helpers) |
| 04:22 | Pupeno | In all the teams I been, frontend was done by the same people as everything else, so I stopped choosing template engines based on how easy it would be for someone used to HTML. |
| 04:22 | Pupeno | I'm not saying that this is the only way, just what tends to be true for me. |
| 04:23 | justin_smith | yeah, we clearly have different environments |
| 04:24 | sveri | hi, anyone here using cursive? whichupdate channel do i have to use for the intellij 13 release? |
| 04:24 | Pupeno | sveri: I am. |
| 04:25 | Pupeno | sveri: I used this one: http://cursiveclojure.com/plugins-13.xml |
| 04:25 | Pupeno | if that's what you are asking. |
| 04:25 | sveri | yea |
| 04:25 | sveri | thank you, i was not sure cause the doc said that this is for the EAP release |
| 04:26 | Pupeno | Yeah, intellij was just released and the docs are out of date. |
| 04:26 | sveri | ok |
| 04:26 | sveri | awesome, thank you very much |
| 04:26 | Pupeno | AFAIK |
| 04:26 | Pupeno | sveri: just getting started with it? |
| 04:27 | sveri | Pupeno: i tried it some time ago, but got not rly warm with it |
| 04:27 | sveri | however, emacs lacks some things for me too and as awesome as lighttable is, there are a lot of features missing too (regarding general editing capabilities) |
| 04:27 | Pupeno | The fact that by default it's in structural mode was confusing (http://cursiveclojure.com/userguide/paredit.html). |
| 04:27 | Pupeno | brb |
| 04:35 | Pupeno | I used to play with La Clojure back in the day, before Cursive. |
| 04:53 | pepijnd | is there a way to use neo4j via clojurescript |
| 04:55 | TEttinger | pepijnd, like via node.js? |
| 04:55 | TEttinger | you mean clojurescript not clojure? |
| 04:56 | pepijnd | TEttinger, no from the browser. neo4j has a rest api |
| 04:57 | TEttinger | http://clojureneo4j.info/ |
| 04:57 | TEttinger | first result for: clojure neo4j rest api |
| 04:58 | pepijnd | TEttinger, thats |
| 04:58 | pepijnd | not cljs |
| 04:58 | TEttinger | right forgot |
| 05:10 | pepijnd | wow https://github.com/zubairq/coils#client-side-neo4j-cypher |
| 05:11 | pepijnd | is Clojure on Coils any good? |
| 05:13 | guns | gfredericks joked once about "Clojure on Clails"; funniest damn thing I've heard on IRC. |
| 05:16 | pepijnd | ? |
| 05:17 | guns | sorry; just thinking about unfortunately named clojure libraries |
| 05:17 | pepijnd | I dont know what clails are |
| 05:17 | guns | it's a joke. Unlike Clojure on Coils apparently |
| 05:21 | pepijnd | yea. point is that the name doesnt sound very solid/professional. ao given that anyone can put up some code and pretend it's the next RoR, i'm hesitant to start using it |
| 05:22 | guns | "secure client side SQL" sounds crazy |
| 05:24 | pepijnd | I think it's a macro that does some public key crypto, but it does soud weird |
| 05:29 | guns | it sounds like a poorly thought out hack; even if it is secure, a web client should never need direct access to the database |
| 05:29 | pepijnd | phpmyadmin? |
| 05:30 | guns | I'm not sure if you're trying to illustrate my point :) |
| 05:30 | pepijnd | but in that case, you would want "sql injection" |
| 05:31 | pepijnd | Y NO LIKE phpmyadmin? |
| 05:31 | guns | if he wanted to use macro magic, he could use macros to have code in a template actually execute on the server without piping SQL over the network |
| 05:32 | pepijnd | maybe they does that |
| 05:33 | guns | then he shouldn't call it "client side"; I'm going to look for the source |
| 05:37 | guns | pepijnd: No, it looks like he's throwing _symmetrically_ encrypted SQL over the network |
| 05:37 | pepijnd | oh... |
| 05:40 | guns | plus, the cipher is PBEWithMD5AndDES, which you could crack with your kid's ps3 |
| 05:42 | guns | pepijnd: https://github.com/zubairq/coils/blob/coilsdemo/src/webapp/framework/server/encrypt.clj#L9-L17 |
| 05:42 | guns | and he uses UUID/randomUUID as a test password in development! |
| 05:43 | pepijnd | ... |
| 05:43 | guns | I hope nobody finds this chat, or somebody's client sites are going to get hacked |
| 05:44 | pepijnd | thats better than "password" I guess. |
| 05:48 | guns | Well, I see that java's randomUUID is actually random (I thought it was one of the less random variants), so I guess I'll back off on that one |
| 05:50 | pepijnd | i feel tempted to try cracking http://www.nemcv.com ... for educational value, but probably still a bad idea. |
| 05:50 | guns | you've already blown it by mentioning it here :) |
| 05:52 | pepijnd | lol, now it's all my fault if they get hacked |
| 06:05 | pepijnd | so what is the preferred micro framework these days? |
| 06:07 | pepijnd | i like moustache... |
| 06:10 | pepijnd | wat.. weavejester wrote clout AND compojure... |
| 06:11 | Raynes | pepijnd: And everything else. |
| 06:11 | Raynes | Srsly |
| 06:12 | pepijnd | haha |
| 06:12 | pepijnd | but who needs more than one router? :P |
| 06:12 | Raynes | He's basically like people perceive me (lein release clojars new libraries so often that it automatically writes them now). |
| 06:14 | Raynes | pepijnd: Also, Compojure uses clout for routing. |
| 06:14 | Raynes | For matching routes, I mean. |
| 06:15 | pepijnd | ahhh. so compojure is more than routing? never knew |
| 06:15 | S3thc0n | Is it practical to use monads instead of accessing values (as an atom for example) globally from within functions? |
| 06:15 | Raynes | Well, it's much higher level, pepijnd. |
| 06:16 | pepijnd | ok |
| 06:16 | Raynes | With a few macros to make things super pretty. |
| 06:16 | Raynes | An amazingly well designed API. |
| 06:16 | pepijnd | will try |
| 06:16 | Raynes | And goodies like some middleware sets pre-made for common use-cases. |
| 06:16 | Raynes | pepijnd: You're only just seeing the world! |
| 06:17 | Raynes | I'm so happy. ;') |
| 06:17 | pepijnd | haha, its been way to long since I did clojure webdev |
| 06:18 | Raynes | Me too, man. |
| 06:18 | Raynes | I need to give refheap some lovin'. |
| 06:18 | Raynes | And stop writing Go. |
| 06:18 | pepijnd | haha |
| 06:19 | Raynes | There is a possibility I might take some Go work soon, so I've been playing with Go for the last week. Been hacking http://github.com/Raynes/goheap like mad. |
| 06:19 | Raynes | It's fun, but I need either better static type systems or dynamic type systems in my life. :p |
| 06:20 | pepijnd | you could port all the good things from go to clojure... oh wait, core.async. |
| 06:20 | Raynes | But Go has... |
| 06:20 | Raynes | What about... |
| 06:20 | Raynes | Yeah, no clue. |
| 06:21 | pepijnd | I'm doing my first clojure job now, hence the webdev |
| 06:21 | Raynes | I mean, as far as C-like syntaxes go, I'm quite fond of it. Tabs turned me off big time, but it really makes no difference when you're writing code and you're expected to run 'go fmt' to computer-format your code anyways. |
| 06:22 | Raynes | Nice, congrats on it. |
| 06:22 | Raynes | I'm currently coming off my first Clojure job. :p |
| 06:22 | pepijnd | go is C like? |
| 06:22 | Raynes | Aye. |
| 06:23 | Raynes | I mean, it's in the C family of languages |
| 06:23 | Raynes | Beyond syntax it doesn't resmble a whole lot. |
| 06:23 | clojurebot | It's greek to me. |
| 06:23 | pepijnd | oh, ya |
| 06:23 | pepijnd | you quit the family tree thing? |
| 06:24 | Raynes | Hah, well, I didn't quit it. |
| 06:24 | Raynes | Unfortunately the company had to lay some folks off. |
| 06:24 | pepijnd | oh... |
| 06:25 | pepijnd | that sucks |
| 06:25 | Raynes | Well, that's how it always feels at first. |
| 06:25 | Raynes | :p |
| 06:26 | AeroNotix | So you got fired? |
| 06:26 | pepijnd | hah, enjoying some freedom? |
| 06:26 | Raynes | But I've got some pretty cool opportunities to pursue. I'm trying to remain in LA because I quite fancy it. |
| 06:26 | Raynes | AeroNotix: Nope. |
| 06:27 | AeroNotix | Raynes: what's goheap for? play.golang.org |
| 06:27 | AeroNotix | Done. |
| 06:27 | Raynes | hrm |
| 06:27 | Raynes | AeroNotix: What do you mean? |
| 06:28 | AeroNotix | Raynes: play.golang.org is the 'pastebin' service which is more pervasive for Go. |
| 06:28 | emil0r | hi. does anyone know what to put in leiningen in order to get clojure 1.6.0-master-SNAPSHOT as a dependancy? |
| 06:28 | Raynes | AeroNotix: Oh, goheap is an API client for refheap.com |
| 06:28 | pepijnd | magic |
| 06:28 | Raynes | It's a Clojure pastebin I wrote that the Clojure community uses. |
| 06:29 | Raynes | Or, tends to use in any case. |
| 06:29 | AeroNotix | Raynes: so you upload Clojure code from Go? I don't get it |
| 06:31 | Raynes | AeroNotix: refheap.com is a pastebin that supports tons of languages and has an API. goheap is a library wrapper around it's API (like gist's API and the various clients for it). |
| 06:31 | AeroNotix | I se.. |
| 06:31 | AeroNotix | see |
| 06:31 | Raynes | Now if someone perhaps wanted to write a program that pasted something to refheap for some reason and they wanted to write it in Go, they could use goheap to easily do that. |
| 06:32 | pepijnd | but gist is not invented here |
| 06:32 | Raynes | It was more of a learning project than anything. |
| 06:32 | Raynes | The first thing I do in languages usually is write a refheap API client. |
| 06:32 | AeroNotix | I see |
| 06:33 | pepijnd | Raynes next time try google safe browsing, for a challenge... |
| 06:34 | Raynes | pepijnd: ? |
| 06:34 | pepijnd | complicated api |
| 06:34 | Raynes | Oh! |
| 06:34 | Raynes | Hah. |
| 06:35 | Raynes | AeroNotix: http://jobsearch.about.com/od/firedtermination/qt/fired-laid-off.htm for an explanation of the difference between laying off and firing. I'm not sure if it's just a USA thing or not. |
| 06:37 | AeroNotix | I see |
| 06:44 | Raynes | pepijnd: Or! The WolframAlpha API. |
| 06:44 | Raynes | Go look at it. I dare you. |
| 06:44 | pepijnd | ok, not now, but i will |
| 06:47 | progo | enlive with XPath support would be great |
| 07:34 | piranha | anybody using cljs repl in browser here? If I did 'defn' of a function, it gets defined nicely. But when I change it and try to execute it (I have my emacs connected to a browser) it's not redefined |
| 07:34 | piranha | any pointers what should I do? |
| 08:44 | poppingtonic | hi people |
| 09:41 | cYmen | hm... |
| 09:42 | cYmen | When I do (apply max-key #(...) (filter ...somestuff...)) it is an error when the filter returns an empty list. How do I fix that? |
| 09:49 | pdk | make the #(...) function check its argument is nil? |
| 09:50 | hyPiRion | find some minimal value |
| 09:50 | hyPiRion | (apply max-key fn min-value (filter ...)) |
| 09:54 | cYmen | hm...yeah I did approximately that but I simply added a value that will not be filtered away |
| 10:06 | mi6x3m | hey, beginner clojure here, but computer scientist. I am just looking at do's details |
| 10:06 | mi6x3m | am I right that it's "do" which allows the non-strict binary tree syntax? |
| 10:06 | mi6x3m | like |
| 10:06 | mi6x3m | (a b c) |
| 10:06 | mi6x3m | (a b c d) etc. |
| 10:12 | mi6x3m | long story, short: can someone explain "do" :) |
| 10:14 | jonasen | mi6x3m: http://clojure.org/special_forms (search for "do") |
| 10:14 | mi6x3m | jonasen: was reading that |
| 10:14 | mi6x3m | I can't understand something |
| 10:15 | mi6x3m | why is it the case that program forms aren't always binary trees? |
| 10:15 | jonasen | mi6x3m: not sure I understand what you mean. But why should each form be _binary_? |
| 10:16 | Bronsa | mi6x3m: 'do is usually used when you need side-effects |
| 10:16 | mi6x3m | jonasen: (+ 1 (/ 4 2)) is in fact a binary tree |
| 10:16 | Bronsa | e.g (do (println "foo" 1) |
| 10:16 | Bronsa | e.g (do (println "foo") 1) |
| 10:17 | jonasen | mi6x3m: there are three elements in each of those lists |
| 10:17 | mi6x3m | ok, here is a better example |
| 10:17 | mi6x3m | (+ 1 2 3) should technically be (+ 1 (+ 2 3)), without do? |
| 10:17 | justin_smith | mi6x3m: not at all |
| 10:18 | jonasen | no. + can accept any number of arguments |
| 10:18 | justin_smith | variable arity is deep in the language |
| 10:18 | jonasen | not all operators are binary |
| 10:18 | mi6x3m | justin_smith: ah, okay, I see. so do is really just about evaluating a number of expressions and returning the result? |
| 10:18 | mi6x3m | no other purpose |
| 10:19 | Bronsa | yes. |
| 10:19 | justin_smith | mi6x3m: the point of do is to ignore some of the expressions in between |
| 10:19 | justin_smith | assumed for side effects |
| 10:19 | Bronsa | justin_smith: ignore is probably a bad choice of word there :) |
| 10:19 | mi6x3m | oh, okay, this clarifies it |
| 10:19 | mi6x3m | thanks |
| 10:19 | justin_smith | let, fn, catch, etc. have implicit do blocks |
| 10:20 | justin_smith | Bronsa: yeah, good call |
| 10:20 | justin_smith | ignore the return value |
| 10:20 | justin_smith | while evaluating the expression |
| 10:20 | mi6x3m | yes, this is what was confusing me |
| 10:26 | `cbp | does anyone have a merge fn for vectors handy? or a fill fn? |
| 10:27 | `cbp | like (f [1 2 3] [1 1 1 1 1]) -> [1 2 3 1 1] |
| 10:29 | mi6x3m | another question |
| 10:29 | mi6x3m | can I only use symbols for let bindings? |
| 10:30 | `cbp | symbols or destructuring |
| 10:31 | opqdonut | ,(into [1 2 3] [1 1 1 1 1]) -- `cbp |
| 10:31 | clojurebot | [1 2 3 1 1 ...] |
| 10:31 | opqdonut | oh, merge, bah |
| 10:31 | `cbp | i did (concat a (drop (count a) b)) |
| 10:31 | opqdonut | I thought concat :) |
| 10:31 | `cbp | stupid stress doesnt let me think |
| 10:31 | opqdonut | yeah that should do it |
| 10:31 | opqdonut | into is slightly nicer than concat because you get a vector out |
| 10:32 | `cbp | youre right |
| 10:38 | andyf | Bronsa: jonasen: Up early, or up all night? :-) |
| 10:38 | andyf | Now that Bronsa is the master of Clojure contrib libs, I am going to throw some 3rd party libs into the Eastwood crucible for additional testing. |
| 10:50 | Bronsa | andyf: I sleep 5am/2pm :P |
| 10:51 | andyf | excellent. Exactly what my schedule was in grad school :) |
| 11:01 | mi6x3m | are let bindings always proceeded (evaluated) in order? |
| 11:01 | mi6x3m | is this guranteed? |
| 11:01 | Bronsa | yes |
| 11:02 | opqdonut | hes |
| 11:02 | opqdonut | *yes |
| 11:03 | opqdonut | the documentation that tells you that: http://clojure.org/special_forms |
| 11:04 | mi6x3m | and their evaluation will be immediately before the evaluation of the rest of the do expressions? |
| 11:04 | mi6x3m | opqdonut: not everything is there :) |
| 11:08 | andyf | mi6x3m: If an expression bound by let is lazy (e.g. the results of map, filter, and many other Clojure functions that their docs say are lazy), then they will not be fully evaluated, only a bit. |
| 11:09 | michaelr526 | hello |
| 11:09 | andyf | That statement is independent of whether the lazy expression occurs in a let, or anywhere else |
| 11:10 | jonasen | andyf: early? It's 6PM here :) |
| 11:10 | andyf | jonasen: Sorry, I should better remember your time zone. Finland, yes? |
| 11:10 | jonasen | yes |
| 11:12 | andyf | Holy cow, the days must be getting short there now |
| 11:12 | hyPiRion | Sun sets at 2:30 pm over here, so I guess it's the same over there |
| 11:12 | jonasen | andyf: yep.. only a few hour days here... It gets dark at 4pm |
| 11:13 | jonasen | hyPiRion: probably |
| 11:14 | andyf | If it weren't terribly expensive or dangerous, I would once like to see the sun go around above the horizon in 24 hours at one of the poles. |
| 11:15 | hyPiRion | Hurray for Fennoscandians and their crazy longitude. |
| 11:15 | hyPiRion | andyf: I would guess it would be possible in Alaska during summer? |
| 11:16 | hyPiRion | Well, that's not a pole, but you'll see the sun following a sine wave |
| 11:17 | andyf | Looks like it. I hadn't checked how much land is actually in the Arctic circle. |
| 11:17 | jonasen | andyf: hyPiRion: Alaska might be expensive but I don't think its dangerous :) |
| 11:18 | andyf | jonasen: Cool. I'll have to see if there are any decent hotels in northern Alaska, for a mid-summer visit. |
| 11:25 | andyf | Google is wonderful "arctic circle hotel" finds 3 in Finland :-) |
| 11:29 | jonasen | andyf: http://www.icehotel.com/ seems cool! |
| 11:32 | bbloom | dnolen: ping |
| 11:39 | logic_prog | how does one develop a sense of absolute control over one's emotions, to be not rattled by anything? |
| 11:39 | poppingtonic | pracice mindfulness. |
| 11:40 | poppingtonic | *practice |
| 11:40 | mi6x3m | hey, what is the difference between (nth [1 2] 1) and ([1 2] 1) ? |
| 11:41 | poppingtonic | logic_prog: When you're present to your every emotion, you can choose which to express. But it takes quite a long time to master. |
| 11:41 | poppingtonic | ,(nth [1 2] 1) |
| 11:41 | clojurebot | 2 |
| 11:41 | poppingtonic | ([1 2] 1) |
| 11:41 | poppingtonic | ,([1 2] 1) |
| 11:41 | clojurebot | 2 |
| 11:42 | justin_smith | mi6x3m: nth works on anything sequential, [] as an IFn invokes the get method |
| 11:42 | logic_prog | poppingtonic: is there a way to practice this? |
| 11:43 | andyf | jonasen: :deprecated linter throws exception when trying to find protected methods, because of its use of Class/getMethod. Worth changing? |
| 11:43 | justin_smith | mi6x3m: get is always O(7) at worst, nth has O(n) complexity for seq |
| 11:44 | mi6x3m | justin_smith: how come? |
| 11:44 | mi6x3m | wouth nth just iterate? |
| 11:44 | justin_smith | for a seq, yes |
| 11:44 | mi6x3m | okay |
| 11:44 | justin_smith | for [] it calls get ([] is actually a special hash for fast lookup / tail insertion) |
| 11:44 | jonasen | andyf: yes, I think we should use getDeclaredMethod instead |
| 11:45 | poppingtonic | logic_prog: why do you want so much control? |
| 11:45 | andyf | jonasen: I'll test with that local change for a while and see how things go. |
| 11:46 | logic_prog | poppingtonic: it's a matter of self control |
| 11:46 | logic_prog | to avoid being emotionally manipulated by others |
| 11:46 | logic_prog | it's impossible to lead if one can not even control one's own emotions |
| 11:46 | poppingtonic | Then write. About what makes you feel whatever emotions you notice. When you do this, you'll realize what your triggers are. The things that make you happy, for instance, are the triggers you should be keeping track of, so you know when it's appropriate to express the emotion. |
| 11:47 | logic_prog | so it's like a tracing debugger |
| 11:47 | logic_prog | you add "println" 's all over your life |
| 11:47 | logic_prog | then when you feel a certain emotion,you look at th elog file and be like "what happened before this emotion" |
| 11:48 | poppingtonic | Remember the dictum "whatever is measured gets improved"? Consider writing about your emotions a somewhat-contrived instance of that. |
| 11:48 | poppingtonic | logic_prog: sort-of like that. |
| 11:48 | justin_smith | there are also some heuristics |
| 11:49 | justin_smith | urgency - someone telling you you don't have a choice |
| 11:49 | poppingtonic | hmmm |
| 11:49 | poppingtonic | O |
| 11:49 | poppingtonic | sorry |
| 11:50 | logic_prog | lol |
| 11:50 | logic_prog | so basically ignore everyone! |
| 11:50 | mi6x3m | is the gathering "operator" & a macro? |
| 11:50 | poppingtonic | What's the simplest way to lazily write data to a file? |
| 11:50 | mi6x3m | or just sugar |
| 11:50 | logic_prog | isn't that a bad idea? |
| 11:51 | logic_prog | when I write ot a file, I want persistence |
| 11:51 | justin_smith | mi6x3m: a part of the destructuring special form |
| 11:51 | logic_prog | I'd be rather unhappy if clojure is like "yeah, I'm going to pretend to write to the file, but not actually write to it" |
| 11:51 | andyf | logic_prog: Learn to rationally evaluate whether someone else's opinion of you matters. In most cases, it is their problem if they are trying to get to you, not yours. I'd say it is OK to be rattled by someone important in your life. |
| 11:51 | justin_smith | mi6x3m: http://clojure.org/special_forms#Special Forms--Binding Forms (Destructuring) |
| 11:53 | justin_smith | that link pasted weird |
| 11:53 | poppingtonic | logic_prog: I mean in the sense that I'm programmatically creating files according to some specification. I don't want them to exist before they're absolutely needed. Like a fog of war. I'm making a randomly-generated text-adventure game. |
| 11:58 | poppingtonic | A file describes a particular location as a map. When a player is (= n 2) hops away from that location, the file describing it is created. My specification is in development, and very incomplete. |
| 12:07 | andyf | jonasen: Looks like getMethod searches superclasses and other implemented interfaces for a method name, but getDeclaredMethod does not. Ugh. Maybe I'll try doing both, only using getDeclaredMethod if getMethod throws a NoSuchMethodException |
| 12:12 | Bronsa | andyf: FWIW clojure.reflect recursively uses getDeclaredMethod on the Class ancestors |
| 12:13 | andyf | Bronsa: Thanks for the pointer. I'll try that out. |
| 12:32 | ghadishayban | Bronsa: I updated the tail clearing patch to clear interop invocations as well |
| 12:33 | Bronsa | ghadishayban: saw that thanks, I'm going to push the update soon |
| 12:35 | ghadishayban | Bronsa: I'm not sure it's the ideal approach right now, Christophe has some interesting ideas about emission. But it works right now, and makes straight reducers super fast. |
| 12:39 | Bronsa | ghadishayban: sure -- I'll try to experiment a bit with alternative solutions too but in the meantime yours works. No big deal to revert a couple of line changes if a better solution comes up |
| 12:42 | ghadishayban | Bronsa: heh nice! I am really super excited to start experimenting with t.emitter.jvm over the next few weeks |
| 12:43 | Bronsa | ghadishayban: I see t.a.jvm/t.e.jvm as a good way to experiment with those compiler changes, it's so much faster/easier to change things and immediately see the result compared to hacking on Compiler.java |
| 12:43 | ghadishayban | Bronsa: tell me about it. I have been working on and off on that patch for a month |
| 12:47 | Bronsa | ghadishayban: just wondering, shouldn't your patch handle keyword invokes/new calls too? |
| 12:51 | ghadishayban | Bronsa: I think that the patch should only handle the minimum amount - jumping from one frame of execution to the next. keyword invoke (even in tail position) just grabs a val and dumps it on the stack - not really long lived. |
| 12:51 | ghadishayban | Bronsa: as for new -- I haven't explored that too much but I'd love to be proven lazy by a good test case |
| 12:55 | Bronsa | ghadishayban: you're probably right regarding the kw-invoke case, I'll try and see if I can find a case where not clearing this before new causes the issue |
| 12:56 | ghadishayban | Bronsa: sorry for the shit ton of jira notifications, I thought edited notifications would be somehow debounced =/ |
| 13:15 | logic_prog | does anyone fucking unerstand how deletinos in red black trees work? I'm trying to understand Clojure's persistent data structures; and I get rb-tree insertion, but rb-tree deletion is fucking confusing with red, black, double black, and negative black nodes |
| 13:17 | dnolen | core.async + om is solid gold |
| 13:22 | logic_prog | what is om? |
| 13:24 | kmicu | https://github.com/swannodette/om |
| 13:25 | dnolen | om + core.async https://gist.github.com/swannodette/7915826 |
| 13:26 | dnolen | logic_prog: it's a bridge to Facebook's React optimized for ClojureScript |
| 13:32 | xeqi | dnolen: is om 0.1.0 published or do I need clone/install |
| 13:35 | meoblast001 | as far as web frameworks in Clojure, is Luminus a pretty popular one? if not, what good alternatives are there? |
| 13:36 | dnolen | xeqi: clone/install, want to play with this a bit more before pushing it out - it's getting close! |
| 13:37 | SegFaultAX | meoblast001: Luminus isn't really a web framework so much as a set of default libraries with some obligatory boilerplate taken care of. |
| 13:38 | SegFaultAX | meoblast001: That's a feature by the way, not a drawback. |
| 13:38 | SegFaultAX | Pedestal and Caribou are also worth looking into, though. |
| 13:38 | meoblast001 | okay. i'm looking over it and it passes my test as something i want to look into more |
| 13:39 | meoblast001 | but if it's something that is a dead project or something the entire clojure community hates, i don't even want to start looking |
| 13:39 | meoblast001 | so it should be fine to carry forward? |
| 13:40 | SegFaultAX | meoblast001: To reiterate, Luminus is just a set of sane defaults. |
| 13:40 | SegFaultAX | And those defaults are the de facto libraries in the Clojure web community. |
| 13:40 | meoblast001 | okay. thanks |
| 13:41 | SegFaultAX | meoblast001: Try this `lein new luminus test-app && tree test-app` |
| 13:41 | SegFaultAX | meoblast001: You'll see there isn't very much to it at all. |
| 13:41 | meoblast001 | yeah |
| 13:41 | SegFaultAX | I'd also strongly recommend you take a look at Liberator. |
| 13:43 | meoblast001 | SegFaultAX: on the topic of sane. is clojurescript something sane or just a toy project? |
| 13:46 | SegFaultAX | meoblast001: I can't really speak to that from personal experience, but it appears to be stable enough to do real work with. |
| 13:47 | SegFaultAX | meoblast001: All of the cljs core team idles in this channel though. so you might direct your questions at them. |
| 13:47 | SegFaultAX | dnolen: *poke* ^ |
| 13:48 | dnolen | meoblast001: not a even remotely close to a toy |
| 13:48 | meoblast001 | ah, cool |
| 13:54 | meoblast001 | ouch |
| 13:54 | meoblast001 | when i do lein new luminus guestbook, it creates a project named luminus in a directory named guestbook |
| 14:01 | munderwo | Hi all. Im doing some dev in the repl, and want to reload the code from a namespace. at the moment I'm doing (use 'bob.core) at the start. But how to I get it to reload so I can run my changes? |
| 14:06 | matthavener | munderwo: i think you can do (use 'bob.core :reload) |
| 14:07 | munderwo | ahh cool.. thanks matthavener |
| 14:07 | matthavener | munderwo: you also might check out tools.namespace https://github.com/clojure/tools.namespace |
| 14:07 | matthavener | (refresh) will then reload all your namespaces nicely |
| 14:44 | noprompt | dnolen: is om cool to "beta" test? |
| 14:44 | dnolen | noprompt: getting really close, working on TodoMVC right now and it seems pretty rocking so far |
| 14:45 | noprompt | dnolen: nice. looking forward to it. hopefully a version on clojars soon? |
| 14:45 | dnolen | noprompt: yep |
| 14:46 | noprompt | such good news |
| 14:55 | rovar | how do I get frodo in my classpath so that I can load it? |
| 14:55 | rovar | I'm trying to follow the instructions at https://github.com/james-henderson/lein-frodo |
| 14:55 | rovar | frodo seems to work as a plugin, but it is not present when I run lein repl |
| 15:20 | poppingt` | Do watches keep track of metadata in refs? |
| 15:21 | poppingt` | rovar: is it in clojars? |
| 15:21 | rovar | poppingt`, it is: jarohen/lein-frodo |
| 15:21 | rovar | however, I have it included in my project as a plugin |
| 15:21 | rovar | because it is.. |
| 15:22 | rovar | however.. some instructions also mention (requiring) it |
| 15:22 | rovar | which fails. |
| 15:26 | poppingt` | do you have Nomad installed? |
| 15:28 | rovar | i unno, I assume it would pull in nomad when I referenced frodo |
| 15:41 | gfredericks | dnolen: the docstrings for fd/+ and fd/* don't specify the arg order; is that worth a jira ticket? |
| 15:41 | dnolen | gfredericks: hrm, what do you mean? |
| 15:41 | gfredericks | I still don't know how core lib maintainers prefer to handle tiny doc changes |
| 15:42 | gfredericks | dnolen: every time I go to use it I can't remember if the sum is first or last |
| 15:42 | andrei | Should there be a huge performance difference between starting a repl with 'lein repl' vs just running 'clojure-1.5'? |
| 15:43 | gfredericks | andrei: what does running clojure-1.5 do? |
| 15:43 | andrei | gfredericks: that's just the clojure binary that my distribution installed |
| 15:43 | coventry | andrei: Do you mean in startup time? lein repl starts two jvms by default. |
| 15:43 | andrei | gjl_package=clojure-1.5 |
| 15:43 | andrei | gjl_main="clojure.main" |
| 15:43 | andrei | source /usr/share/java-config-2/launcher/launcher.bash |
| 15:43 | andrei | coventry I mean runtime |
| 15:44 | dnolen | gfredericks: fixing |
| 15:44 | andrei | http://0xab.com/pi-clojure.clj |
| 15:44 | andrei | Takes 4.7 seconds in the repl that 'lein repl' sets up |
| 15:45 | gfredericks | dnolen: cool, thanks! |
| 15:45 | andrei | 1.6 seconds in the repl that 'clojure-1.5' sets up |
| 15:45 | dnolen | gfredericks: https://github.com/clojure/core.logic/commit/9b9b3a8bb87ab5ccac2491fb5fdd80af18c47847 |
| 15:46 | andrei | My profiles.clj file is empty ( {} ) and I'm strating running 'lein repl' in a directy that is not a clojure project |
| 15:46 | gfredericks | dnolen: perfect |
| 15:46 | hyPiRion | andrei: yes, should be faster to run clojure-1.5. `lein repl` starts up two JVMs, whereas clojure-1.5 starts up just one |
| 15:46 | coventry | andrei: Might be a tiered compilation issue. Try 'LEIN_JVM_OPTS= lein repl' |
| 15:46 | coventry | https://github.com/technomancy/leiningen/wiki/Faster#tiered-compilation |
| 15:47 | andrei | hyPiRion: That's startup time, I mean runtime of an algorithm |
| 15:47 | justin_smith | andrei: that's where tiered compilation comes in |
| 15:47 | andrei | coventry: That did it |
| 15:47 | justin_smith | there are different optimization settings |
| 15:47 | andrei | Oh, ok. Is there some doc that I should have read that would have pointed me in this direction? |
| 15:48 | hyPiRion | andrei: ah. Well, if you're on the newest leiningen version, add in :jvm-opts [] in your project.clj or do as coventry proposed |
| 15:48 | justin_smith | andrei: if you use criterium it gripes if you don't have optimizations on |
| 15:48 | hyPiRion | (for older version, you'd have to do :jvm-opts ^:replace []) |
| 15:49 | gfredericks | (inc dnolen) |
| 15:49 | lazybot | ⇒ 13 |
| 15:49 | andrei | Thanks for the help everyone! |
| 15:49 | andrei | Does this mean that there exist options which will produce even faster code? |
| 15:50 | coventry | andrei: Check out the leiningen wiki page I linked above. Don't know whether any of the other suggestions will help, though. |
| 15:50 | andrei | coventry: Will do. Thanks! |
| 15:51 | hyPiRion | faster is relative. You could check out tiered compilation or tweak the garbage collector settings |
| 15:51 | hyPiRion | andrei: Generally http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html is a nice webpage for performance |
| 15:52 | andrei | hyPiRion: Awesome, thanks! |
| 15:52 | hyPiRion | it doesn't tell you how to tune them properly, but at least it tells you what's available |
| 15:54 | andrei | If I wanted to extend basic numeric operations in clojure, but the multimethod way is far too slow |
| 15:54 | andrei | Where would I look? |
| 15:54 | andrei | I'm willing to spend time learning and implementing whichever approach will produce the fastest code |
| 15:54 | andrei | However low-level or involved it is in any language |
| 15:54 | amalloy | andrei: you can't really do it. just define a new function with a name that's different from +, which is what you use for adding your quasi-numbers |
| 15:55 | andrei | amalloy: Sadly that won't be sufficient in my case, the name has to be the same |
| 15:55 | TEttinger | you can redefine + can't you? |
| 15:56 | amalloy | TEttinger: you can't make the + that some other namespace uses behave like you redefined + |
| 15:56 | andrei | TEttinger: If I redefine it in one file in a project, how does that carry over to all of the other files in the project? |
| 15:56 | andrei | amalloy: Oh, I see what you mean. That's fine. |
| 15:57 | andrei | amalloy: I'm willing to put some use line at the top of each file which needs this feature |
| 15:57 | TEttinger | what is the extension for? |
| 15:57 | andrei | amalloy: So if I redefine + I can get the same performance that clojure's implementation of + gets? |
| 15:58 | TEttinger | probably not? I haven't tried, but it might be helpful to read the clojure source |
| 15:58 | andrei | TEttinger: I do research in AI/ML and I regularly perform nonstandard interpretation of numeric programs |
| 15:58 | amalloy | no, you can't, because clojure.core/+ can emit a single bytecode operation when it's working with primitives |
| 15:58 | TEttinger | neat, andrei |
| 15:58 | andrei | amalloy: And there's no way to get a user function to do the same? |
| 15:58 | amalloy | obviously you won't have primitives, you'll have these weird made-up numbers you want to invent |
| 15:58 | amalloy | no jvm bytecode knows how to add them |
| 15:59 | andrei | amalloy: Sure, but I'm willing to pay the cost for 1 branch |
| 15:59 | andrei | amalloy: For every math operation |
| 15:59 | amalloy | i don't see what you're getting at |
| 16:00 | amalloy | you'll have some Object which represents a number in your program, and some function named + that you want to use to add it |
| 16:00 | TEttinger | https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L936 |
| 16:00 | andrei | amalloy: I want to mix my numbers and standard numbers |
| 16:00 | amalloy | an Object, no matter what it contains or how you work with it, will be much more heavy-weight than a primitive |
| 16:00 | andrei | amalloy: When both operands to + are primitives I want the old behaviour + speed with the cost of 1 branch |
| 16:00 | andrei | amalloy: Like so: https://github.com/abarbu/AD/blob/master/AD.scm |
| 16:01 | amalloy | mmmmmm, you can probably do that |
| 16:01 | andrei | TEttinger: Thanks! |
| 16:01 | TEttinger | andrei, you will notice some fun stuff right away |
| 16:02 | TEttinger | like the more-than-two-args version being much heavier |
| 16:02 | andrei | TEttinger: Yeah.. that's pretty common. I'll do the standard trick of writing a macro to expand them out |
| 16:03 | amalloy | it's going to be pretty tricky to *tell* whether the operands are primitives, though |
| 16:03 | andrei | amalloy: Oh? |
| 16:04 | TEttinger | because of auto-boxing? |
| 16:04 | amalloy | you can't introspect that at runtime, because it's a decision made at compile time; and i don't know of a way for a macro to ask a question like "given the current &env, what is the type of expression e?" |
| 16:05 | andrei | amalloy: There's no runtime 'primitive?' function? |
| 16:05 | amalloy | no |
| 16:05 | coventry | typed clojure gives you no leverage there? |
| 16:05 | amalloy | all functions receive Object args |
| 16:05 | amalloy | the way clojure.core/+ works is it unconditionally expands to (RT/add x y), and later a special compiler pass replaces that with a single bytecode op iff x and y are both primitives of the same type |
| 16:05 | andyf | amalloy: Some Clojure fns receive primitive args, if they have <= 4 and are type-hinted, yes? |
| 16:06 | andyf | amalloy: Not that that invalidates any of your previous statements on the difficulty of mixing boxed and unboxed at run-time. |
| 16:06 | amalloy | andyf: sure |
| 16:06 | amalloy | but i don't think you can use that to implement "primitive?" |
| 16:07 | amalloy | because (defn primitive? ([^long x] true) ([^double x] true) ([x] false)) will call the long version if x is statically known to be a boxed Long, i think |
| 16:07 | amalloy | i'm not sure about that though |
| 16:07 | clojurebot | Excuse me? |
| 16:08 | justin_smith | https://github.com/ztellman/primitive-math what about the checks primitive-math does? |
| 16:08 | justin_smith | it gives reflection warnings if boxing of numbers happens |
| 16:10 | TEttinger | justin_smith, that might be key. |
| 16:10 | TEttinger | https://github.com/ztellman/primitive-math/blob/master/src/primitive_math/Primitives.java he uses java to implement that part |
| 16:10 | justin_smith | oh, interesting |
| 16:11 | andrei | Ah, that looks like a good way to go |
| 16:11 | TEttinger | and then he wraps it in clojure |
| 16:12 | Bronsa | https://github.com/ztellman/primitive-math/blob/master/src/primitive_math/Primitives.java#L212 how is this valid in Java? |
| 16:12 | TEttinger | https://github.com/ztellman/primitive-math/blob/master/src/primitive_math.clj looks pretty simple, but the README shows the limitations |
| 16:12 | justin_smith | I learned about primitive-math in the "Clojure High Performance Programming" book. Good, dense with info, though pricy for the short page count. |
| 16:12 | andrei | justin_smith: Awesome. Thanks! I'll check it out |
| 16:12 | amalloy | Bronsa: empty statements are allowed |
| 16:12 | Bronsa | amalloy: didn't know that, thanks |
| 16:13 | amalloy | although i'm a little surprised to see that statements are allowed at the top level of a class declaration |
| 16:13 | amalloy | like, ;;;; would be valid a lot of places, i just didn't realize this was one of them |
| 16:14 | Bronsa | isn't int foo; a statement too? |
| 16:14 | dsrx | ,;;;; |
| 16:14 | amalloy | certainly |
| 16:14 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 16:14 | amalloy | oh, i see |
| 16:14 | Bronsa | :) |
| 16:16 | andrei | In https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L936, why are there two versions of every math operator? |
| 16:17 | andrei | A quoted one and an unquoted one |
| 16:17 | amalloy | Bronsa: in a class declaration those actually aren't statements, exactly |
| 16:17 | amalloy | check out http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.6, where ; is explicitly allowed |
| 16:17 | TEttinger | one auto-promotes ints to bigInts |
| 16:17 | TEttinger | andrei ^ |
| 16:17 | TEttinger | ,(+ 1111111111111111111111111111111111 11111) |
| 16:17 | clojurebot | 1111111111111111111111111111122222N |
| 16:17 | TEttinger | wat |
| 16:18 | Bronsa | amalloy: I see |
| 16:18 | amalloy | TEttinger: 1111111111111111111111111111111111 is already a bigint |
| 16:18 | TEttinger | ##(+ 1111111111111111111111111111111111 11111) |
| 16:18 | lazybot | ⇒ 1111111111111111111111111111122222N |
| 16:18 | TEttinger | oh |
| 16:18 | TEttinger | herp |
| 16:19 | TEttinger | ##(reduce + (repeat 100 16rfffffff)) |
| 16:19 | lazybot | ⇒ 26843545500 |
| 16:19 | TEttinger | gah |
| 16:19 | amalloy | &(reduce * (repeat 100 16rfffffff)) |
| 16:19 | lazybot | java.lang.ArithmeticException: integer overflow |
| 16:19 | amalloy | ez |
| 16:19 | TEttinger | ##(reduce +' (repeat 100 16rfffffffffffffff)) |
| 16:19 | lazybot | ⇒ 115292150460684697500N |
| 16:20 | dav | What is the purpose of 'do' given that if you just put the forms one after the other it seems to work just as well as without the do-statement? |
| 16:20 | TEttinger | I just woke up haha |
| 16:20 | amalloy | dav: (if x (do y z) n) |
| 16:20 | andrei | TEttinger: Thanks! |
| 16:20 | TEttinger | dav, it's very useful when you have stuff like if, things that only allow one form... also when you want to return something after calculating something else |
| 16:21 | amalloy | imagine (if x y z n). how do those group? |
| 16:21 | dav | amalloy: so you would never do (let [..] (do ...)) ? |
| 16:21 | amalloy | dav: well, "never" is a strong word. i could imagine doing it on occasion |
| 16:21 | amalloy | to emphasize side effects or something |
| 16:21 | amalloy | but you never *need* to |
| 16:22 | TEttinger | ,(do (print "whee ") 0) |
| 16:22 | clojurebot | whee 0 |
| 16:22 | TEttinger | ,(do (print "whee ")) |
| 16:22 | clojurebot | whee |
| 16:22 | TEttinger | oh that's interesting, clojurebot doesn't show the nil? |
| 16:22 | amalloy | ,(do (do (do (do 'whop)))) |
| 16:22 | clojurebot | whop |
| 16:22 | dav | TEttinger / amalloy - thx. is there a reason to use when rather than if other than for clarity ? |
| 16:23 | TEttinger | when allows multiple forms |
| 16:23 | TEttinger | other than that, not really? it is clearer |
| 16:24 | Bronsa | dav: some (myself included) use when instead of if when there's no else branch, others only use when for side-effects |
| 16:24 | also | ,(macroexpand '(when x a b c)) |
| 16:24 | clojurebot | (if x (do a b c)) |
| 16:24 | TEttinger | when returns nil if the condition is false, so it can be handy when passed to some fns that expect nil rather than false |
| 16:24 | dav | amalloy / TEttinger / Bronsa - ok i think I have the clear picture. thanks! |
| 16:25 | amalloy | TEttinger: wat |
| 16:25 | amalloy | that last one makes little sense |
| 16:25 | Bronsa | TEttinger ##(if false 1) |
| 16:25 | lazybot | ⇒ nil |
| 16:25 | TEttinger | I am fairly certain I encountered one in the std lib... |
| 16:26 | amalloy | obviously there are functions that care about nil vs false, but that doesn't distinguish if from when at all |
| 16:26 | TEttinger | http://clojuredocs.org/clojure_core/clojure.core/keep |
| 16:27 | TEttinger | sure, it just saves typing nil as an else statement |
| 16:27 | amalloy | did you...read what Bronsa just sent you? |
| 16:27 | TEttinger | oh herp |
| 16:27 | TEttinger | that won't work for multiple forms though, you need.... do ! |
| 16:34 | technomancy | clojurebot: when? |
| 16:34 | clojurebot | when is for side effects |
| 16:34 | Bronsa | >:( |
| 16:36 | amalloy | if technomancy *and* clojurebot both think this independently and without any collusion it must be true! |
| 16:38 | hyPiRion | clojurebot: technomancy? |
| 16:38 | clojurebot | technomancy codes while wearing gravity boots to increase the blood flow to the face transplant he got after discovering the world does not treat build tool creators kindly |
| 16:39 | hyPiRion | oh, I've not seen that before |
| 16:46 | also | clojurebot: clojurebot? |
| 16:46 | clojurebot | "More human than human" is our motto. |
| 16:47 | bitemyapp | LOL |
| 16:47 | bitemyapp | hyPiRion: I hadn't seen that one before. |
| 16:48 | also | clojurebot: lazybot? |
| 16:48 | clojurebot | lazybot is echo ~lazybot |
| 16:48 | bitemyapp | I happen to agree with clojurebot and technomancy. when is for side-effects. |
| 16:48 | also | why is that? |
| 16:49 | tim__ | , (when (:a {:a 42}) "we have a") |
| 16:49 | clojurebot | "we have a" |
| 16:49 | tim__ | no side effects needed. |
| 16:51 | SegFaultAX | It's a matter of convention. |
| 16:52 | SegFaultAX | It's not like you /have/ to use it for side effecting code, obviously. |
| 16:53 | SegFaultAX | But since if and if-not don't require an alternative branch, when and when-not are used for side-effecting code by convention. |
| 16:53 | tbaldridge | ah, good point. Forgot about the optional branch |
| 17:12 | cYmen | Since when does if not require an alternative branch? |
| 17:12 | Bronsa | since always? |
| 17:13 | cYmen | huh |
| 17:13 | cYmen | odd...wonder where I got that idea, then |
| 17:14 | also | cYmen: i was confused by the first example for kibit: https://github.com/jonase/kibit |
| 17:17 | cYmen | hm...can't remember...maybe :) |
| 17:22 | cYmen | Well, I checked out the 4clojure source and now have a local copy running. |
| 17:22 | cYmen | Now, what to do. :p |
| 17:28 | cYmen | Fuck... |
| 17:45 | logic_prog | how do I get format in clojurescript? |
| 17:45 | logic_prog | what library/namespace is it part of? |
| 17:46 | rovar | java string? |
| 17:46 | rovar | ,(find-doc format) |
| 17:46 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.core$format cannot be cast to java.lang.String> |
| 17:46 | rovar | ,'(find-doc format) |
| 17:46 | clojurebot | (find-doc format) |
| 17:46 | also | logic_prog: i don't think it exists. javascript doesn't provide format |
| 17:47 | rovar | oh.. I didn't read the word clojurescript |
| 17:47 | rovar | yea.. it's a native |
| 17:47 | justin_smith | (doc format) |
| 17:47 | clojurebot | "([fmt & args]); Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax" |
| 17:48 | logic_prog | non-existence is useful |
| 17:48 | logic_prog | thanks! |
| 17:49 | rovar | so how do people work with local-repo? |
| 17:50 | rovar | I find it odd how poor the support in lein is for compiling dependencies for other projects |
| 17:54 | dnolen | ok the fact that every node in the om tree has its path is pretty awesome |
| 17:54 | justin_smith | rovar: I usually just run lein install in each project, without using local-repo |
| 17:55 | cYmen | hm...can't seem to install cider |
| 17:55 | cYmen | fails to download :/ |
| 17:55 | justin_smith | yeah, known issue with the emacs archive |
| 17:55 | cYmen | but fairly recent, I take it? |
| 17:55 | justin_smith | not a cider bug, a bug in the archive server |
| 17:57 | cYmen | but the issue is new? |
| 17:57 | cYmen | because I think it installed just fine on three machines a couple of weeks ago |
| 17:58 | rovar | justin_smith, when you use that approach, how do you reference one project from the other? |
| 17:58 | justin_smith | in project.clj |
| 17:59 | justin_smith | as I would any other dependency |
| 17:59 | rovar | does install put it into the ~/.m2? |
| 17:59 | justin_smith | yeah |
| 18:36 | sorenmacbeth | is there already a fn that does (interleave (keys m) (vals m))? |
| 18:36 | justin_smith | (mapcat m) ? |
| 18:37 | justin_smith | ,(mapcat {:a 0 :b 1}) |
| 18:37 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/map> |
| 18:37 | justin_smith | err |
| 18:37 | justin_smith | ,(mapcat identity {:a 0 :b 1}) |
| 18:37 | clojurebot | (:a 0 :b 1) |
| 18:38 | rukor | (flatten (seq m)) |
| 18:38 | justin_smith | ~flatten |
| 18:38 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 18:39 | sorenmacbeth | flatten doesn't do what I want |
| 18:39 | justin_smith | ,(flatten {:a 0 :b [1 2] :c 3}) |
| 18:39 | sorenmacbeth | yes, like clojurebot says |
| 18:39 | clojurebot | () |
| 18:39 | rukor | right |
| 18:40 | sorenmacbeth | ,(mapcat identity {"foo" [:bar]}) |
| 18:40 | clojurebot | ("foo" [:bar]) |
| 18:40 | sorenmacbeth | yeah, that's what I need |
| 18:40 | sorenmacbeth | cheers |
| 18:40 | coventry | ,(apply concat {1 2 3 4}) |
| 18:40 | clojurebot | (1 2 3 4) |
| 18:40 | sorenmacbeth | ,(apply concat {"foo" [:bar]}) |
| 18:40 | clojurebot | ("foo" [:bar]) |
| 18:40 | justin_smith | I wonder what the mapcat identity / apply concat tradeoff comes down to |
| 18:41 | coventry | Probably the mapcat version is faster. |
| 18:41 | hyPiRion | it's the other way around |
| 18:41 | hyPiRion | mapcat is just (apply concat (apply map f coll)) |
| 18:42 | coventry | Huh. |
| 18:42 | justin_smith | cool, thanks hyPiRion |
| 18:42 | seangrove | ,(reduce concat (seq {"foo" [:bar]})) ; just for fun |
| 18:42 | clojurebot | ["foo" [:bar]] |
| 18:42 | hyPiRion | (apply concat coll) would be faster, if performance was an issue |
| 18:43 | hyPiRion | ,(reduce into [] {1 2 3 4}) ; could probably be a competitor |
| 18:43 | clojurebot | [1 2 3 4] |
| 18:46 | justin_smith | (persistent! (reduce (fn [vc [k v]] (-> vc (conj! k) (conj! v))) (transient []) {1 2 3 4})) |
| 18:46 | justin_smith | likely the big winner |
| 18:49 | sorenmacbeth | thanks pals |
| 18:49 | sorenmacbeth | gonna go with (apply concat amap) for now |
| 18:49 | justin_smith | good call |
| 18:49 | hyPiRion | would be surprising if that's your bottleneck anyway |
| 18:50 | justin_smith | yeah, most likely not a bottleneck |
| 18:50 | justin_smith | but it is fun to bytecode-cycle-golf |
| 19:03 | nkozo | somebody knows how to make a _bidirectional_ binding in seesaw? |
| 19:21 | gfredericks | justin_smith: man it'd be fun if there were a expr->bytecode-cycles |
| 19:22 | gfredericks | what's the easiest way to get such a thing? |
| 19:22 | gfredericks | probably optimizing jvms would make the results irrelevant anyhow :/ |
| 19:23 | andyf_ | gfredericks: What is this bytecode-cycles you refer to? |
| 19:24 | gfredericks | welp |
| 19:24 | gfredericks | yunno. |
| 19:24 | gfredericks | number of bytecode instructions executed during the evaluation of an expression? |
| 19:26 | andyf_ | gfredericks: Yeah, I'm pretty sure most of the code that you care how fast it runs does get optimized by the JIT. |
| 19:27 | dsrx | ,(apply concat [[1 2] [3 4] [5 6]]) |
| 19:27 | clojurebot | (1 2 3 4 5 ...) |
| 19:28 | dsrx | ,(doc mapcat) |
| 19:28 | clojurebot | "([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection." |
| 19:32 | hyPiRion | Hrm |
| 19:32 | hyPiRion | ,(coll? "hey") |
| 19:32 | clojurebot | false |
| 19:33 | TEttinger | hyPiRion, that's interesting |
| 19:33 | hyPiRion | I guess it should return a seqable item instead |
| 19:33 | hyPiRion | ,(mapcat identity ["foo" "bar"]) |
| 19:33 | clojurebot | (\f \o \o \b \a ...) |
| 19:51 | lalala | is there anyone who has used Pedestal on a project who would be willing to tell me about their experience using it? |
| 19:52 | dnolen | TodoMVC in progress - https://github.com/swannodette/todomvc/tree/om/labs/architecture-examples/om |
| 19:55 | also | dnolen: awesome! |
| 19:58 | dnolen | representing your UI as EDN rocks so hard |
| 20:01 | also | i've been avoiding all the javascript template libraries...they all feel wrong |
| 20:01 | rovar | I rather like dommy |
| 20:02 | rovar | and I'm generally picky about that sort of thing |
| 20:02 | dnolen | I do not believe in templates anymore |
| 20:02 | dnolen | or string based ones anyway |
| 20:06 | bitemyapp | god I am exhausted. |
| 20:07 | andyf_ | god already knew that |
| 20:07 | bitemyapp | andyf_: teaching people is tiring. |
| 20:07 | bitemyapp | talking is tiring |
| 20:07 | bitemyapp | thinking is tiring |
| 20:08 | andyf_ | Teaching people who aren't learning very well? I find teaching people who are paying attention and interested in learning invigorating. |
| 20:08 | bitemyapp | andyf_: well it's fun, but you still have to repeat yourself some. |
| 20:08 | bitemyapp | andyf_: but I've noticed a difference in how draining it is depending on speed of uptake. |
| 20:09 | andyf_ | What are you teaching? |
| 20:09 | bitemyapp | andyf_: Haskell! |
| 20:10 | andyf_ | Ah, came to the #clojure channel to relax your mind, eh? :-) |
| 20:11 | bitemyapp | andyf_: I just have a lot of people I really like here. |
| 20:11 | pdk | #clojure |
| 20:11 | pdk | a place for friends |
| 20:11 | bitemyapp | andyf_: there are really nice people in #haskell too, I just don't know as many of them |
| 20:11 | bitemyapp | pdk: lol! |
| 20:25 | rovar | does #clojure have a history somewhere? |
| 20:25 | rovar | I need to rediscover a url that someone gave me |
| 20:25 | coventry | http://clojure-log.n01se.net/ http://logs.lazybot.org/ |
| 20:25 | Bronsa | rovar: http://clojure-log.n01se.net/ |
| 20:25 | clojurebot | Excuse me? |
| 20:26 | Bronsa | mph. |
| 20:26 | Bronsa | (inc coventry) |
| 20:26 | lazybot | ⇒ 5 |
| 20:26 | coventry | The n01se.net has gone down at times, so I think it may be incomplete, but it has the better interface. |
| 20:26 | coventry | *.net one |
| 20:28 | rovar | this was it : https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj |
| 20:28 | andyf_ | Bronsa: I am running into some cases where Eastwood analyzing multiple namespaces in a single run causes exceptions with some namespaces, but when I do those namespaces by themselves, there is no exception. Have you seen such things before? Would you be interested in looking at an example of this? |
| 20:28 | rovar | I need to tell google to increase the pagerank of that page |
| 20:29 | Bronsa | andyf_: I've seen such things before and am horrified at the thought of debugging that again. |
| 20:29 | Bronsa | but please, let me know what's failing |
| 20:30 | andyf_ | Bronsa: I'll file one as an Eastwood issue, since it might be specific to how Eastwood is using tools.analyzer. Should I try to minimize the source code size first? |
| 20:31 | Bronsa | andyf_: but first, make sure you are using the last snapshot of tools.analyzer.jvm && have lein install'ed the master version of eastwood, I really thought i had that fixed |
| 20:32 | Bronsa | andyf_: file the issue for now, so I can look into that. If you want you can try to minimize the failing source code later :P |
| 20:33 | andyf_ | OK, wiping my .m2 out first, git pull'ing, making sure everything up to date before filing the issue. |
| 20:35 | bitemyapp | andyf_: kind of you :) |
| 20:37 | Bronsa | I just went in a hurry to the kitchen with a feeling I had something really urgent to do there. |
| 20:37 | Bronsa | But then I didn't. |
| 20:37 | andyf_ | Dinnertime? :-) |
| 20:37 | Bronsa | It's 2.35AM here |
| 20:37 | bitemyapp | Bronsa: 1737 |
| 20:38 | andyf_ | Bronsa: You are going to hate this one even more, because it requires 3 namespaces to give the exception on the 3rd one. Any 2 of them gives no exception :-( |
| 20:39 | Bronsa | duh. |
| 20:39 | bitemyapp | andyf_: admittedly, you could prove that conclusively with a generative test. |
| 20:41 | seangrove | technomancy: Is this kind of 503 error on an initial clojure push sermi-normal for Heroku? https://www.refheap.com/c654aa6acc97e8f9fbe270e78 |
| 20:41 | Bronsa | andyf_: does it involve a defprotocol? |
| 20:42 | andyf_ | I think the crux of the issue is a Java import in an earlier namespace, with a type-hint on a function return value for a Java class, and then the function is called in a later namespace that doesn't have the import. But that is a guess at this point. |
| 20:42 | Bronsa | mh. |
| 20:42 | seangrove | technomancy: It gets a little bit further along each time I push it though |
| 20:42 | andyf_ | The exception is that the Java class is not found during the :deprecations linter. |
| 20:44 | andyf_ | Sorry, the exception is during the analyzer, not the linter. |
| 20:44 | andyf_ | Almost done reproducing with fresh checkouts. |
| 20:44 | Bronsa | yeah, doesn't sound like what I thought it would be. |
| 20:44 | Bronsa | damn. |
| 20:46 | andyf_ | Oh, I also saw a line of code in the Seesaw lib today where it does (extend (fn-call-that-returns-class) ...) |
| 20:46 | andyf_ | Or a fn call that returned something, maybe it wasn't a class. Anyway, it wasn't just a symbol. |
| 20:47 | andyf_ | I'll file a TANAL ticket for that one for consideration. |
| 20:47 | Bronsa | ok |
| 20:49 | dnolen | so om pretty must leaves JS client side frameworks in completely dust as far as rendering performance |
| 20:49 | dnolen | and instead of pointless models - just data |
| 20:54 | akhudek | dnolen: om looks really neat, looking forward to giving it a try |
| 20:55 | dnolen | akhudek: I'm pretty psyched about it |
| 20:59 | andyf_ | Bronsa: The 3-namespace issue: https://github.com/jonase/eastwood/issues/28 |
| 21:00 | Bronsa | ok, will look into that thanks |
| 21:06 | seangrove | Well, that only took ~15 `git push heroku master` attempts. |
| 21:06 | bitemyapp | good to see relying on magic is paying off for some people. |
| 21:06 | bitemyapp | I bet you could script that. |
| 21:07 | bitemyapp | I'm pretty sure that's how keynesianism works. When magic isn't working, layer on more magic. |
| 21:07 | TEttinger | magic/more magic switch |
| 21:13 | andyf_ | you have to get it working correctly once before you can automate. |
| 21:24 | bitemyapp | andyf_: false. |
| 21:26 | SegFaultAX | bitemyapp: (iterate magic (magic)) |
| 21:26 | SegFaultAX | (drop-while not-working? (iterate magic (magic))) to be precise. |
| 22:02 | logic_prog_ | is there anything like slingshot (try+, catch+) for clojurescript ? |
| 22:12 | rukor | how do you represent this.props.children from react.js in om? |
| 22:17 | solussd | om? |
| 22:18 | bitemyapp | solussd: it's a library. |
| 22:19 | solussd | ah |
| 22:19 | rukor | https://github.com/swannodette/om |
| 22:20 | solussd | oh neat, fancy new :include-macros option in require |
| 22:20 | seangrove | Actually what caused the new :include-macros in cljs in the first place, heh |
| 22:22 | bitemyapp | seangrove: what? |
| 22:22 | seangrove | bitemyapp: om is what pushed dnolen over the line to add the :include-macros option to cljs, I believe |
| 22:23 | bitemyapp | seangrove: that validates my suspicion that increasing his pain is the way to force a painkiller. |
| 22:23 | rukor | haha |
| 22:24 | seangrove | bitemyapp: Any easy way to get korma to play nice with dev and heroku? |
| 22:24 | seangrove | I struggle with this every time I push a new app |
| 22:24 | bitemyapp | seangrove: I can think of several. |
| 22:25 | bitemyapp | most of them involve an environment variable and weavejester's library. |
| 22:27 | dsrx | logic_prog_: (try* (throw "world") (catch e (js/alert (str "hello " e)))) |
| 22:27 | bitemyapp | seangrove: if you get specific (you need to configure a database URI that needs to vary between dev and heroku? simultaneously?) I can be more helpful. |
| 22:27 | seangrove | bitemyapp: Well, I always struggle to get korma to connect to Heroku's pg. Seems like there's some incantation that gets the ssl stuff to work properly |
| 22:28 | bbloom | dnolen: have you succeeded in reproducing the (goofy) todo mvc toy yet? curious to see how your wrapper scales to there & beyond |
| 22:28 | dsrx | logic_prog_: try in cljs is just a macro for try* that does type dispatching, try* maps pretty directly to try/catch in JS |
| 22:28 | logic_prog_ | dsrx: noted, thanks |
| 22:29 | bitemyapp | seangrove: http://stackoverflow.com/questions/13175655/trouble-connecting-to-postgresql-db-on-heroku-with-korma-clojure this looks promising. |
| 22:29 | seangrove | bitemyapp: Heh, if browser history were like ant trails, that'd be a very thick line |
| 22:30 | seangrove | If you haven't heard of the challenges, don't worry about it, I'll try to narrow it down more |
| 22:31 | Bronsa | yet another bug fixed. I can now go to sleep satisfied. |
| 22:31 | bbloom | dsrx: try* is an implementation detail |
| 22:31 | bbloom | use (catch :default ...) |
| 22:32 | Bronsa | bbloom: an implementation detail.. that doesn't even exist anymore :P |
| 22:32 | bbloom | Bronsa: oh right, i forgot. even better |
| 22:32 | bbloom | logic_prog_: see https://github.com/clojure/clojurescript/blob/master/test/cljs/cljs/core_test.cljs#L480-L482 |
| 22:32 | bitemyapp | seangrove: I understand the problem, you just need to default and vary some stuff between dev/prov in a config.clj from environment variables. |
| 22:32 | bitemyapp | seangrove: I've solved this many times before, demonstrated ways to structure it, etc. |
| 22:32 | bitemyapp | I'd do virtually the exact same thing in Haskell too. |
| 22:36 | xeqi | dnolen: do you have a gist of the om based todo? |
| 22:37 | coventry | xeqi: https://github.com/swannodette/todomvc/tree/om/labs/architecture-examples/om |
| 22:37 | xeqi | coventry: thanks |
| 22:39 | bbloom | nice |
| 22:40 | bbloom | looks like it still has a long way to go though |
| 23:08 | logic_prog_ | how do I write "document.documentElement.style.overflow = 'hidden'; " in cljs? I want to disable scrollbars |
| 23:22 | dsrx | I've got this project.clj, and leiningen wants to pull down clojure 1.2.1 https://gist.github.com/tomjakubowski/8ecc91adea9245c22d0a . Is there a way I can see which dependency has clojure 1.2.1 as a dep without waiting for all the dependencies to download (i'm on a slow connection at the moment)? |
| 23:23 | logic_prog_ | http://stackoverflow.com/questions/7836204/chrome-fullscreen-api <-- how do I make this work with clojurescript |
| 23:24 | rukor | logic_prog_: (-> js/document (.-documentElement) (.-style) (.-overflow) (set! "hidden")) |
| 23:24 | logic_prog_ | rukor: got that working already |
| 23:25 | rukor | logic_prog_: ok |
| 23:25 | logic_prog_ | just changed the html :-) |
| 23:25 | rukor | :-) |
| 23:25 | logic_prog_ | rukor: however, please help with the full screen api |
| 23:25 | SegFaultAX | Not sure why, but this problem took me an hour to solve: http://www.4clojure.com/problem/124 |
| 23:25 | logic_prog_ | (let [el (.-documentElement js/document) rfs (.-webkitRequestFullScreen el)] (. js/console log rfs) (. js/console log el) (.call rfs el)) |
| 23:25 | logic_prog_ | somehow doesn't work |
| 23:26 | SegFaultAX | But my answer is among the shortest of those I'm following. So that's awesome :) |
| 23:27 | rukor | logic_prog_: is it not intended to be called from an event handler? |
| 23:27 | logic_prog_ | why can't I call it out of an event handler, |
| 23:27 | logic_prog_ | i.e. in window.onload |
| 23:28 | logic_prog_ | http://stackoverflow.com/questions/9454125/javascript-request-fullscreen-is-unreliable on shit |
| 23:28 | logic_prog_ | I can only call it from an event handler? |
| 23:29 | rukor | logic_prog_: does it work when you do? from the SO page, it says it has to be within the context of a user interaction |
| 23:29 | logic_prog_ | well, let me hook something up :-) |
| 23:29 | logic_prog_ | this is fucking annoying though |
| 23:29 | logic_prog_ | as I have events sent to core.async go channels |
| 23:29 | logic_prog_ | s/hands/fists |
| 23:29 | rukor | logic_prog_: that would make sense though, as I have always clicked a button to go full screen :-) |
| 23:30 | rukor | logic_prog_: http://johndyer.name/lab/fullscreenapi/ |
| 23:30 | dsrx | logic_prog_: specifically it can probably only be called from a user-initiated event callback, like for creating popup windows |
| 23:31 | logic_prog_ | rukor, dsrx: this makes sense now, thanks for clarifying! |
| 23:31 | rukor | logic_prog_: np |
| 23:36 | andrei | How can one require multiple libraries and assign them to the same alias? |
| 23:40 | dsrx | nice, now for some reason it's also pulling in clojure 1.3.0-alpha6 |
| 23:43 | logic_prog_ | rukor, dsrx: it works now, bound ctrl-0 to full screen and it works |
| 23:45 | rukor | logic_prog_: nice |
| 23:52 | amalloy | andrei: you can't. a namespace's aliases are a map from alias-symbol to namespace |
| 23:54 | nathanielksmith | hiya. My tests (in test/<projname>/test/<testfile>.clj) are unable to require things in my actual code (src/<projname>/<file>.clj). |
| 23:54 | amalloy | SegFaultAX: an hour seems pretty reasonable for 4clojure 124. there's a lot to do |
| 23:54 | nathanielksmith | I'm running with lein test. |
| 23:54 | nathanielksmith | It's finding and running the tests fine |
| 23:54 | nathanielksmith | The tests just can't see the <projname> namespace |
| 23:55 | nathanielksmith | any suggestions? |
| 23:55 | rovar | what is the easiest way to map a function across the vals of a hashmap while leaving the keys in-tact? |
| 23:56 | andrei | amalloy: Ah, too bad. Thanks! |