2013-04-06
| 00:04 | tieTYT2 | i'm trying to save a data type to a file but when I (spit) it it only outputs clojure.lang.LazySeq@2cd9e23b |
| 00:05 | tieTYT2 | how do I output the whoel thing so I can read it back into my repl for debugging |
| 00:06 | mthvedt | tieTYT2: stick it into a readable data structure, like a vector |
| 00:07 | akhudek | tieTYT: pr-str |
| 00:07 | tieTYT2 | cool |
| 00:08 | tieTYT2 | thanks |
| 00:08 | bbloom | that's no good either |
| 00:08 | bbloom | just call seq on it |
| 00:08 | bbloom | pr-str will realize the full value into a string in memory |
| 00:08 | bbloom | spit will internally print directly to the writer, so the whole data structure doesn't need to be realized |
| 00:09 | akhudek | bbloom: but spit won't serialize right? |
| 00:09 | bbloom | ,(str (clojure.lang.LazySeq (fn [] ["I" "am" "the" "thunk"])) |
| 00:09 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 00:09 | bbloom | ,(str (clojure.lang.LazySeq (fn [] ["I" "am" "the" "thunk"]))) |
| 00:09 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IFn> |
| 00:09 | bbloom | ,(str (clojure.lang.LazySeq. (fn [] ["I" "am" "the" "thunk"]))) |
| 00:09 | clojurebot | "clojure.lang.LazySeq@726f771" |
| 00:09 | bbloom | ,(str (seq (clojure.lang.LazySeq. (fn [] ["I" "am" "the" "thunk"])))) |
| 00:09 | clojurebot | "(\"I\" \"am\" \"the\" \"thunk\")" |
| 00:09 | bbloom | akhudek: spit will serialize |
| 00:09 | bbloom | akhudek: but it won't hold on to the head |
| 00:10 | bbloom | akhudek: so if you have a lazy process that you want to stream to a file, you can walk the lazy structure as you print it, so you won't run out of memory if the full structure is too large |
| 00:10 | bbloom | akhudek: which is what will happen if you call vec |
| 00:10 | bbloom | akhudek: but will happen twice as fast if you call pr-str |
| 00:10 | tieTYT2 | in this situation i won't run out of memory regardless |
| 00:11 | bbloom | tieTYT2: well either way, just (spit writer (seq the-lazy-seq)) |
| 00:11 | tieTYT2 | ok |
| 00:11 | akhudek | bbloom: interesting, I didn't know that |
| 00:12 | akhudek | I might have to refactor some code to be a bit more memory efficient. |
| 00:12 | bbloom | akhudek: oh nevermind |
| 00:12 | bbloom | i'm wrong. |
| 00:12 | bbloom | lol |
| 00:12 | bbloom | sorry |
| 00:12 | bbloom | just looked at the source of spit |
| 00:12 | akhudek | oh :-( |
| 00:12 | akhudek | and here I got excited |
| 00:12 | bbloom | spit just calls (str)... *sigh* |
| 00:12 | tieTYT2 | i'm reading it back in like this: (def i (read-string (slurp "out.html"))) |
| 00:13 | bbloom | spit isn't a very clever function.... |
| 00:13 | bbloom | sorry about that, my bad. |
| 00:13 | tieTYT2 | hrm |
| 00:13 | akhudek | tieTYT2: turns out you do need to use pr-string, then that should work for reading it back in |
| 00:13 | akhudek | err pr-str |
| 00:13 | tieTYT2 | really, the issue I'm having is a debugging issue |
| 00:13 | tieTYT2 | i've written some code that works like a spider that crawls a webpage |
| 00:13 | tieTYT2 | I'm getting an error about IllegalArgumentException No value supplied for key |
| 00:13 | tieTYT2 | and I can't even be sure of which line it's outputting that on |
| 00:14 | tieTYT2 | it shows me the map after that error and it looks fine to me |
| 00:14 | tieTYT2 | if I copy it and paste it back into the repl with a ' in front of it it gives me no error |
| 00:15 | akhudek | tieTYT2: hard to help without seeing code :-/ |
| 00:15 | howdynihao | ((fn [x] (conj [x] 1)) 2) am i understanding this right? first x is setting the argument to x |
| 00:16 | howdynihao | second x is creating a vector with x |
| 00:16 | howdynihao | seems unfortunate they both appear the same? or are both actually vectors? |
| 00:16 | tieTYT2 | ok first of all this is the error: IllegalArgumentException No value supplied for key: {:post-link "http://site.com/index.php?topic=1987109.0", :image-links ("http://site.com/index.php?action=dlattach;topic=1987109.0;attach=6181834;image" "http://site.com/index.php?action=dlattach;topic=1987109.0;attach=6181836;image")} clojure.lang.PersistentHashMap.createWithCheck (PersistentHashMap.java:89) |
| 00:17 | tieTYT2 | and my code is like a 100 lines. How do I know which code to show you? |
| 00:17 | akhudek | howdynihao: they are both actually vectors, the first is simply used internally for argument bindings |
| 00:19 | tieTYT2 | oh i get it, it's saying that whole thing is one key? |
| 00:19 | tieTYT2 | that makes it easier to debug |
| 00:19 | akhudek | tieTYT2: what is the stack trace? |
| 00:19 | akhudek | yes |
| 00:19 | tieTYT2 | it doesn't show me one |
| 00:19 | tieTYT2 | unless I do (pst) |
| 00:19 | tieTYT2 | which doens't have useful line numbers |
| 00:19 | tieTYT2 | I'm using Counter Clock Wise |
| 00:19 | akhudek | (e) doesn't work? |
| 00:20 | tieTYT2 | CompilerException java.lang.RuntimeException: Unable to resolve symbol: e in this context, compiling:(NO_SOURCE_PATH:1) |
| 00:20 | akhudek | if you aren't getting line numbers, reload the namespace as a file |
| 00:20 | akhudek | not sure what the CC command for this is |
| 00:20 | tieTYT2 | the stack trace is one line |
| 00:21 | tieTYT2 | anyway, I think I can fix the problem at hand at least |
| 00:21 | tieTYT2 | i didn't know that I was supposed to get better stack traces than I am |
| 00:21 | tieTYT2 | the output is exactly what I pasted earlier including the "full" stack trace it gives me |
| 00:22 | akhudek | tieTYT2:if you require [clojure.stacktrace :refer [e]] in you namespace, you should then be able to do (e) right after an error on the repl and get a decent stack trace most of the time. |
| 00:22 | akhudek | Also, always try to reload whole namespaces when possible, I believe that way it gives you line numbers. |
| 00:23 | tieTYT2 | java.lang.ClassNotFoundException: clojure.stacktrace |
| 00:24 | tieTYT2 | ok i reloaded the namespace |
| 00:24 | tieTYT2 | err, switched to it |
| 00:24 | tieTYT2 | and then that worked |
| 00:24 | tieTYT2 | thanks |
| 00:25 | tieTYT2 | ok that worked |
| 00:25 | tieTYT2 | now I can debug my program |
| 00:25 | tieTYT2 | wtf doesn't CCW automatically include that in the repl? |
| 00:26 | akhudek | guess it doesn't want to inject unwanted things into peoples programs, though it is quite a useful library! |
| 00:27 | tieTYT2 | yeah, it doesn't have (doc) or (source) either. Quite annoying |
| 00:27 | tieTYT2 | thanks |
| 00:29 | howdynihao | i have trouble understanding this, ((fn foo [x] (when (> x 0) (conj (foo (dec x)) x))) 5)) if someone could explain it to me? the part that i dont get is... |
| 00:30 | howdynihao | is the return, i would think it would keep returning a function ? |
| 00:30 | howdynihao | so it seems like it should be ( 5 1) as the result not ( 5 4 3 2 1) ? |
| 00:31 | egghead | why do you think it would return a function howdynihao ? |
| 00:32 | egghead | the only place it can exit is from 'conj' |
| 00:33 | howdynihao | well maybe not return a function, but i would think it would keep calling foo until it gets a result |
| 00:33 | howdynihao | so i understand how it could return 4 3 2 AND still keep calling foo |
| 00:33 | howdynihao | i dont understand i mean |
| 00:33 | egghead | so what happens is the other way around, there is some initial call to (conj (something...) onto x) |
| 00:34 | egghead | and that something travels down further, until eventually the condition is no longer true because x is 0 |
| 00:35 | egghead | so when x is 0 the when doesn't get satisfied, so you get nil back, but what that means is that you haved (conj (conj (something...) x) nil) |
| 00:36 | howdynihao | ok so something is actually (4 3 2 1) ? and it isn't conjoining 5 times ? |
| 00:36 | howdynihao | well i still dont understand really why the values return |
| 00:37 | howdynihao | like in recursive functions in other languages, you get the last calls return and it bubbles up to the initial call |
| 00:37 | egghead | if you change 5 to 2 for instance: you might imagine the call stack as (conj (conj nil 1) 2) |
| 00:39 | egghead | it is doing that tho, it follows down until (foo n) returns a value instead of a new call |
| 00:39 | egghead | and that percolates back up until the very first call to conj has all it's parameters resolved |
| 00:39 | egghead | since it's call by value |
| 00:42 | howdynihao | ahhhh ok now i get it, maybe its the parenthesis :P tripping me up |
| 00:44 | egghead | cheers howdynihao |
| 01:05 | tieTYT2 | i just had a huge debugging session... does anyone know, if I define something in the repl, and then I compile a file in CCW that refers that definition but doesn't define it anywhere, should it give me a compile error? |
| 01:43 | rads | has anyone gotten the clojurescript brepl to work with node-webkit? |
| 01:43 | rads | I'm getting this: Uncaught Error: URI file:/robots.txt is invalid for field ppu |
| 01:43 | rads | seems like a cross domain security problem |
| 01:45 | a|i | any serious clojure based rules engine out there? |
| 02:04 | rads | ibdknox: just looked at the source for lighttable and didn't find anything to set up a repl. do you use the browser repl with node-webkit? |
| 02:45 | tieTYT2 | how can I do something like map, but only on the odd or even elements? |
| 02:45 | tieTYT2 | but I don't want to filter it down |
| 02:47 | bbloom | tieTYT2: two main choices |
| 02:47 | bbloom | 1) map-indexed where you conditionally transform based on (even? index) |
| 02:48 | bbloom | 2) interleave two calls to take-nth, one mapped, and one next-ed |
| 02:48 | tieTYT2 | hrm, 1) seems easier to me |
| 02:48 | tieTYT2 | i'll do that, thanks |
| 02:50 | bbloom | ,(let [v [:a :b :c :d]] (interleave (map name (take-nth 2 v)) (take-nth 2 (next v)))) |
| 02:50 | clojurebot | ("a" :b "c" :d) |
| 02:50 | bbloom | 2 is pretty easy too :-) |
| 02:51 | bbloom | ,(map-indexed (fn [i x] (if (even? i) (name x) x)) [:a :b :c :d]) |
| 02:51 | clojurebot | ("a" :b "c" :d) |
| 02:53 | Raynes | bbloom: It's a party in the USA. |
| 02:53 | bbloom | Raynes: ? |
| 02:54 | Raynes | bbloom: I was listening to that song (for scientific purposes, I assure you) and needed to tell somebody. |
| 02:55 | bbloom | Raynes: i'm glad you can confide in me, but i have no idea what that song is |
| 02:55 | Raynes | bbloom: http://www.youtube.com/watch?v=M11SvDtPBhA |
| 02:55 | Raynes | The worst thing ever. |
| 02:57 | Raynes | bbloom: I was toying with a bot that checks my last.fm and gives me a hipster percentage. I am currently 94.69% mainstream. I'm trying to raise this number by listening to more mainstream things. |
| 03:10 | Raynes | I need a trendy place to buy coffee mugs. |
| 03:13 | bbloom | Best coffee mug I ever used cost me 4 dollars at a Safeway |
| 03:14 | Raynes | I looked at mugs at Target but didn't want to pay $20 for a coffee mug. |
| 03:14 | Raynes | I'm looking on Amazon, but I'm not sure I want a mug that says "COFFEE MAKES ME POOP" and/or looks like a toilet. |
| 03:14 | Raynes | http://www.amazon.com/Big-Mouth-Toys-Toilet-Mug/dp/B002SQG4TU/ref=sr_1_10?ie=UTF8&qid=1365232495&sr=8-10&keywords=coffee+mug |
| 03:14 | bbloom | lol |
| 03:15 | bbloom | you a 1 cup am and 1 cup pm sorta guy? |
| 03:15 | bbloom | or you more of a thermos all day long sorta man |
| 03:16 | Raynes | I'm a 1 cup AM because I never sleep kind of guy who hates himself because he tries to avoid caffeine. |
| 03:17 | bbloom | yeah, you just need a plain old white cup. i prefer vertical sides, since they have a wider base & are steadier |
| 03:22 | arcatan | have a smaller cup, so you'll have less coffee and less caffeine |
| 03:31 | Raynes | bbloom: http://www.amazon.com/Dr-Who-Disappearing-Tardis-mug/dp/B003Z31K7G/ref=sr_1_9?s=home-garden&ie=UTF8&qid=1365233306&sr=1-9&keywords=mug This is what I need. |
| 04:04 | ddellacosta | I can't get ring 1.2.0-beta2 working with lein-ring: ring-server is bringing in 1.1.8 and my exclusions aren't "taking." Anyone have a fix? |
| 04:10 | borkdude | is there a way to debug routes in compojure/ring to see which route actually gets fired by a request? |
| 04:28 | borkdude | yogthos I'm trying to add resources from webjars to a luminus project, but somehow now the "/" GET requests responds with a blank page - any ideas? |
| 04:29 | borkdude | yogthos I added this line under ;;add your middlewares here: (resource/wrap-resource "/META-INF/resources/") |
| 04:30 | borkdude | yogthos one solution would be to just copy the resources to the normal resources folder, but I want to find out what's going on |
| 05:15 | murtaza52 | What does the refer key do ex - (:require [abc.core :refer :all]) |
| 05:16 | borkdude | murtaza52 it does the same as :use :only |
| 05:16 | borkdude | murtaza52 or in this case :use |
| 05:17 | murtaza52 | so if I have (:require [abc.core :refer xyz]) |
| 05:18 | murtaza52 | borkdude: does this mean that xyz is a function which is being imported in the current ns, just like :only |
| 05:18 | borkdude | (:require [abc.core :refer [fn1 fn2]]) |
| 05:18 | borkdude | yes |
| 05:41 | murtaza52 | borkude: so what is the diff of using :use and :only compared to :require and :refer |
| 05:54 | borkdude | murtaza52 no difference |
| 05:54 | borkdude | I think I found out what's going wrong with my routes and webjars: |
| 05:55 | borkdude | https://www.refheap.com/paste/13317 |
| 05:56 | borkdude | the jar directory gets recognized as a resource, but not as a file, hence it is returned as (io/input-stream resource) hm |
| 05:58 | borkdude | the protocol = jar |
| 06:09 | faust45 | hi guys |
| 06:09 | faust45 | just have a problem |
| 06:09 | faust45 | i try create class with (gen-class ...) |
| 06:10 | faust45 | then (compile it in REPL |
| 06:10 | faust45 | and its success |
| 06:10 | faust45 | but how i can load this class to REPL |
| 06:10 | faust45 | please help me |
| 06:20 | jemafeller | hello |
| 06:20 | jemafeller | what would be the best way to expose a high performance service with RPC to a node.js (or any server side) service? |
| 06:20 | jjl` | that depends what you need |
| 06:26 | jemafeller | jjl`, well, I'd like the code being executed to be as high performance as possible |
| 06:26 | jemafeller | this is because it was supposed to be the same process, and the same codebase but was split into two |
| 06:27 | jemafeller | it may also be that the two processes may live on the same machine, so that they could use pipes - but that is not guaranteed |
| 06:28 | jemafeller | on paper, zeromq looks to be answering all of these as it is a 'fancy' socket that can transparently switch between TCP/in-proc/etc |
| 06:28 | jemafeller | but I'm aware of a lot of gripe with it and JVM based code |
| 06:28 | jjl` | well you've got three basic models for services which comes down to two questions: do i need an answer and do i need it now? |
| 06:29 | jemafeller | yes to both |
| 06:29 | jemafeller | I also looked at Thrift, but there's a lot of criticism about complexity of connection handling and error handling with Thrift |
| 06:29 | jjl` | thrift was a nightmare when i worked with it |
| 06:30 | jjl` | zeromq probably isn't going to be your solution if you want an answer immediately |
| 06:31 | jjl` | have you considered XMPP? not the most efficient in terms of size of messages, but can be very low latency |
| 06:32 | jemafeller | I haven't actually. I'll throw in another thing though - the messages are big. |
| 06:33 | jemafeller | they can go into 100kb in size, since it is a document that's passed between services |
| 06:33 | jemafeller | it's online document analysis, part of it is done in service A, and part of it in service B |
| 06:34 | jemafeller | so I think XMPP wasn't built to handle big messages..? |
| 06:34 | jemafeller | and to be truthful, I don't want to build the RPC server myself (so here Thrift has an advantage - but yes, i do keep reading about Thrift nightmares) |
| 06:36 | jjl` | XMPP can be made to handle big messages but it isn't designed for it |
| 06:38 | mpenet | Did you consider the java port of 0mq? I am not sure what you were refering to it earlier. |
| 06:38 | jemafeller | mpenet, you mean jeromq? no I didn't.. I'm not sure what to think about it |
| 06:39 | mpenet | Yes, well it seems young, and I never used it, so I can't really vouch for it, but it seems like an option |
| 06:40 | jemafeller | i'm wondering about ProtocolBuffers though.. i'll need to find a way to implement the RPC daemon myself in Clojure |
| 06:40 | mpenet | but 0mq should be quite reliable anyway, I think Storm uses it internaly, it could be worth have a look there too. |
| 06:42 | alex_baranosky | does anyone know offhand how big the thread pool is for futures is? |
| 06:42 | jemafeller | mpenet, yes they do. and that's where I understood they have problems with it when it comes to Java and maintainability |
| 06:43 | jemafeller | https://github.com/nathanmarz/storm/issues/372 |
| 06:44 | Glenjamin | jemafeller: i'd vote json over rabbitMQ |
| 06:44 | Glenjamin | but it depends on your definition of high performance in this case |
| 06:44 | mpenet | interesting |
| 06:44 | jemafeller | Glenjamin, the solution would need to be synchronous and immediate. i'd like to be as close to in-proc as possible |
| 06:45 | Glenjamin | probably want something binary over http then? |
| 06:45 | Glenjamin | msgpack / thrift etc |
| 06:45 | Glenjamin | s/http/tcp |
| 06:45 | mpenet | alex_baranosky: I think it's an cachedThreadPool |
| 06:45 | jemafeller | Glenjamin, yes. that would be a reasonable solution - since I also don't want to prematurely optimize |
| 06:46 | jjl` | also think about whether you're more likely to be network or cpu bound |
| 06:46 | Glenjamin | throw together a couple of options and benchmark i guess? |
| 06:46 | alex_baranosky | mpenet: googling seems to suggest it is an unbounded thread pool, unless that has changed since these blogs were written |
| 06:46 | jemafeller | Glenjamin, but, i'm not so much experienced with Thrift and Java and heard a lot of bad experiences there |
| 06:46 | mpenet | alex_baranosky: yes |
| 06:47 | jjl` | the packets are large, so maybe it'll be network bound, but then what are the documents? do they have a native format? |
| 06:47 | Glenjamin | maybe start with json over tcp and leave the serialisation format malleable? |
| 06:47 | jemafeller | jjl`, the process doing the work behind RPC is completely CPU bound, it's a text analysis algorithm suite. |
| 06:47 | jjl` | maybe the overhead isn't going to be that large |
| 06:47 | mpenet | alex_baranosky: I have future-call and future versions that allow to use your own executors in mpenet/knit |
| 06:47 | jjl` | in which case, do minimal cpu processing and make sure the network can handle it |
| 06:47 | jemafeller | jjl`, the documents are just text. imagine a Service A -[text]-> Service B |
| 06:47 | mpenet | alex_baranosky: but their code is probably a bit outdated compared to 1.5.1, but it could give you an idea on how to proceed if you need to make your own |
| 06:48 | jjl` | jemafeller: given the docs are so large, go for a simple protocol that requires minimal cpu to process and throw it onto the network |
| 06:48 | jemafeller | jjl`, you're right, I think network bandwidth could be a problem in this case |
| 06:48 | jjl` | then your solution is wrong |
| 06:49 | jjl` | parallelise the backend service so cpu isn't a concern |
| 06:49 | jjl` | but if network bandwidth will be a problem sending large documents, then a small protocol won't help - the docs are large |
| 06:49 | jjl` | can't you get a fibre connect in? |
| 06:50 | jemafeller | yep.. i'm thinking about that |
| 06:50 | mpenet | alex_baranosky: also fyi the threadpool used by futures is the same agents use |
| 06:51 | mpenet | unless you use send-via of course |
| 06:55 | jemafeller | hmm i think i'll go by this priority - msgpack-rpc, protobuf-rpc, and then plain HTTP if none of these work |
| 08:28 | john2x | can I not require goog.x libraries in the clojurescript repl? if so, how to do? |
| 08:43 | chessguy | good mooooorning clojure world! |
| 09:21 | kmicu | Ten sam chrome, który był na webkitice tak jak safari? |
| 09:38 | borkdude | https://www.refheap.com/paste/13332 <- reproduction of my webjars problem |
| 10:31 | juhu_chapa | Hi guys! |
| 10:32 | juhu_chapa | in order to use (javadoc Object) How can I set the default browser? |
| 10:33 | juhu_chapa | this at the REPL |
| 10:34 | borkdude | juhu_chapa I don't know, but isn't this just the default system browser? |
| 10:35 | juhu_chapa | borkdude: I am on BSD, do you refer to an OS environment variable? |
| 10:36 | borkdude | juhu_chapa I have googled it for you: http://forums.freebsd.org/showthread.php?t=19829 - I don't know much about BSD |
| 10:37 | juhu_chapa | borkdude: Thank you! |
| 10:38 | borkdude | juhu_chapa no problem, googling for other people is what I do |
| 10:38 | borkdude | :P |
| 10:39 | juhu_chapa | ;) |
| 10:49 | chessguy | how do folks usually handle a tdd cycle in emacs with nrepl? i'm finding myself repeatedly going to a shell and doing 'lein test' |
| 10:52 | ucb | chessguy: you can try https://github.com/stuartsierra/lazytest |
| 10:52 | ucb | chessguy: additionally, if you're using midje for testing there's midje-mode and lazytest via midje too |
| 10:53 | chessguy | ucb: i'll probably use midje eventually, but i've never done tdd in clojure before, so i feel like i ought to start from scratch |
| 10:53 | ucb | chessguy: surely TDD is not necessarily about the testing lib? |
| 10:54 | chessguy | ucb: i'm not learning TDD, i'm learning testing in clojure |
| 10:54 | chessguy | i just want to know the standard library first |
| 10:54 | ucb | chessguy: oh, I see. |
| 10:58 | chessguy | hmm. what we really need is something like guard for clojure |
| 10:59 | headshot | erlang anyone? |
| 10:59 | ucb | chessguy: that's what lazytest does (from my brief reading about https://github.com/guard/guard-test) |
| 11:01 | chessguy | ucb: maybe i'll try that, thanks |
| 11:01 | ucb | chessguy: no worries |
| 11:10 | yogthos | dnolen: hello? :) |
| 11:12 | yogthos | is anybody versed in cljs magic? |
| 11:16 | dnolen | yogthos: what's up? |
| 11:17 | yogthos | dnolen: oh I ran into advanced optimizations problem, but I think I know what's happened |
| 11:17 | dnolen | ok |
| 11:17 | yogthos | dnolen: stuff was using this https://github.com/chengyin/albumcolors |
| 11:18 | yogthos | and it works fine without optimizations, but when I turn advanced on it gets errors that it can't find a method on the object |
| 11:18 | yogthos | so from what I gathered is names get munged? |
| 11:19 | yogthos | so I have to protect them explicitly with externs? |
| 11:20 | yogthos | dnolen: does that sound right? |
| 11:20 | yogthos | the errors I get look like Uncaught TypeError: Object [object Object] has no method 'Le' |
| 11:21 | yogthos | and the code in question is |
| 11:21 | yogthos | (defn set-colors [div] |
| 11:21 | yogthos | (.getColors (js/AlbumColors. (img-url div)) |
| 11:21 | yogthos | (fn [[background _ foreground]] |
| 11:21 | yogthos | (set-color (.-style div) foreground background)))) |
| 11:21 | yogthos | calling (.getColors is what's causing it |
| 11:25 | chessguy | looks like lazytest is pretty old. seems to be insisting on an outdated convention for file locations |
| 11:26 | lfranchi | hey guys! i'm trying to migrate my clojure usage to emacs+nrepl (and am a relative newcomer to clojure) but am running into some weird behaviour that I don't understand w/ lamina and aleph.tcp. I have this very simple code that connects to a tcp server and prints out when the connection is established: https://gist.github.com/lfranchi/5326476 (in `lein repl`). I have the exact same code in emacs+nrepl started by `nrepl-jack-in`, and my on-realized |
| 11:26 | lfranchi | callback is not printing out / being called: https://gist.github.com/lfranchi/5326479. |
| 11:26 | lfranchi | i must be missing something really fundamental, but i'm not sure what |
| 11:27 | lfranchi | any tips would be really appreciated :) |
| 11:27 | juhu_chapa | How to list all global vars? |
| 11:30 | yogthos | dnolen: is there an example on how to use externs with cljsbuild? |
| 11:32 | yogthos | dnolen: when I specify :externs ["externs.js"] is externs.js loaded in the browser at runtime or referenced during compilation? |
| 11:33 | dnolen | yogthos: no idea about cljsbuild extern support but I'm sure it does. |
| 11:33 | dnolen | yogthos: and yes your issue sounds like an externs one |
| 11:34 | yogthos | dnolen: yeah looks like I'm making progress, I'm up to Uncaught TypeError: object is not a function when I reference externs.js in the page :) |
| 11:34 | yogthos | dnolen: and I assume it's because I'm passing an anonymous function as an argument to a js function? |
| 11:34 | dnolen | yogthos: you might want to look at jayq, I believe jayq uses an externs and works via lein-cljsbuild |
| 11:34 | yogthos | dnolen: ah good idea |
| 11:35 | yogthos | dnolen: it's all about finding that one example :) after that it's usually obvious in retrospect |
| 11:37 | murtaza52 | I have a vector of fns and i want to get a subvector such that-> (subvec-fn [fn1 fn2 fn3] fn2) => [fn1] ; Is there such an inbuilt fn ? |
| 11:41 | chessguy | hm. i get an error when i M-x package-install clojure-test-mode |
| 11:41 | chessguy | technomancy: you around, by any chance? |
| 11:41 | yogthos | dnolen: yup was the externs, thanks for pointing me to jayq works like a charm now :) |
| 11:41 | dnolen | murtaza52: why not just use take-while? |
| 11:41 | dnolen | yogthos: sweet! |
| 11:43 | lfranchi | Hm, seems like my aleph connection is never even calling my on-realized callback, as throwing an exception in the fn is never hit :-/ |
| 11:43 | chessguy | dnolen: i didn't know you hung out here. seen a couple of your talks on pattern-matching. awesome stuff, keep it up! |
| 11:48 | dnolen | chessguy: thx! |
| 12:04 | lfranchi | Hmm, can someone with a better idea of clojure/java logging explain why when I use (clojure.tools.logging/info "foo") in emacs+nrepl.el, nothing gets printed out, but when I do the same in `lein repl`, I get the proper info debug message? |
| 12:05 | lfranchi | this is after calling (org.apache.log4j.BasicConfigurator/configure) |
| 12:39 | clojure-new | Hello, i have a list of #inst dates, how can i sort it? |
| 12:43 | jonasen | clojure-new: (sort [#inst "2000" #inst "2013" #inst "1984"]) |
| 12:44 | Okasu | , (sort [#inst "2000" #inst "2013" #inst "1984"]) |
| 12:44 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 12:45 | clojure-new | It works, thanks! |
| 14:01 | jameshasselman | Getting this exception when calling my multi-method ArityException Wrong number of args (2) passed to: problemC$eval7100$fn clojure.lang.AFn.throwArity (AFn.java:437) What am I doing wrong here http://pastebin.com/ACgCaHFv ? |
| 14:03 | bbloom | jameshasselman: you're not destructuring the vector in your dispatch function |
| 14:03 | bbloom | [[unit _]] |
| 14:04 | bbloom | jameshasselman: oh sorry, misread |
| 14:04 | bbloom | (value) isn't what you want |
| 14:04 | bbloom | you jsut want value by itself |
| 14:05 | bbloom | otherwise that's (10) or whatever |
| 14:05 | bbloom | and numbers aren't callable |
| 14:05 | bbloom | beyond that, you're probably expecting defmulti to redefine the dispatch fn, which, annoyingly, it won't do |
| 14:06 | bbloom | so (ns-unmap *ns* 'unit-to-minutes) |
| 14:06 | bbloom | then try again |
| 14:10 | jameshasselman | that worked, but I don't understand why |
| 14:10 | jameshasselman | Thanks though, would not have figured that out. |
| 14:37 | SirLalala | hi! I solved this problem from project euler in clojure http://projecteuler.net/problem=11 . But I'm trying to minimize the code |
| 14:44 | SirLalala | how can I convert a vector like this [ [[1 2] [2 3]] [[3 4] [4 5]]] to [ [1 2] [2 3] [3 4] etc. |
| 14:45 | Okasu | ,(flatten [[2][3]]) |
| 14:45 | clojurebot | (2 3) |
| 14:52 | eckroth | ,(apply concat [[[1 2] [2 3]] [[3 4] [4 5]]]) |
| 14:52 | clojurebot | ([1 2] [2 3] [3 4] [4 5]) |
| 14:55 | SirLalala | eckroth: awesome thanks! |
| 14:57 | danneu | nice |
| 15:08 | chessguy | ,(apply 'and '((3))) |
| 15:08 | clojurebot | nil |
| 15:08 | chessguy | can someone help me understand that? |
| 15:08 | chessguy | i would expect that to evaluate to '(3) |
| 15:09 | eckroth | ,(apply 'foo '((3))) |
| 15:09 | clojurebot | nil |
| 15:09 | eckroth | ,(apply and '((3))) |
| 15:09 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0:0)> |
| 15:10 | eckroth | and is a macro, so it acts differently than you might expect |
| 15:10 | chessguy | (macroexpand '(apply and '((3)))) |
| 15:10 | chessguy | ,(macroexpand '(apply and '((3)))) |
| 15:10 | clojurebot | (apply and (quote ((3)))) |
| 15:10 | chessguy | bah |
| 15:11 | eckroth | ,(macroexpand '(and true false false true)) |
| 15:11 | clojurebot | (let* [and__3965__auto__ true] (if and__3965__auto__ (clojure.core/and false false true) and__3965__auto__)) |
| 15:11 | eckroth | kind of cool: does (if [first value] (and [2nd value] [3rd value] [4th value]) [first value]) |
| 15:12 | eckroth | like it's currying |
| 15:12 | chessguy | eckroth: right, but the first value here is '(3), no? |
| 15:12 | eckroth | ,(and '((3)) |
| 15:12 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 15:12 | eckroth | ,(and '((3))) |
| 15:12 | clojurebot | ((3)) |
| 15:12 | eckroth | apply does not work here because it's a macro |
| 15:13 | chessguy | am i going about this wrong? i have a sequence and i want to know if every element is truthy... |
| 15:13 | chessguy | i could (every? 'id xs) |
| 15:13 | chessguy | but that seems verbose |
| 15:13 | eckroth | was just going to suggest that |
| 15:14 | eckroth | you can make a helper func that does (every? identity xs) but otherwise I don't know of a built-in |
| 15:14 | chessguy | really? wow |
| 15:14 | eckroth | mabye someone can tell use otherwise |
| 15:15 | chessguy | i suppose it's not really less verbose than apply all |
| 15:15 | eckroth | right and usually I find myself doing: (every? some-func original-xs) |
| 15:15 | eckroth | where some-func is an interesting operation |
| 15:15 | eckroth | so it's not a big loss |
| 15:15 | chessguy | sure |
| 15:16 | n_b | So I'm considering switching to emacs from vim, what's the easiest way to get started with that+clojure? |
| 15:16 | eckroth | using identity is a total code smell; I've used it but I feel weird |
| 15:16 | eckroth | n_b: clojurebox maybe? |
| 15:16 | Okasu | n_b: Nrepl is a good thing. |
| 15:17 | chessguy | n_b: i used this gist just the other week to get started: https://gist.github.com/rkneufeld/5126926 |
| 15:19 | n_b | chessguy: That looks great. I was a little unclear in my phrasing; I know Clojure, just not familiar with the emacs ecosystem at all |
| 15:20 | chessguy | n_b: ah, in that case, this is one of the few cases where i recommend starting by reading the documentation |
| 15:22 | n_b | chessguy: just `man emacs`? |
| 15:22 | chessguy | that is, open emacs and hit ctrl+h, then t |
| 15:23 | danneu | n_b: i switched to emacs from vim a few weeks ago. |
| 15:25 | chessguy | danneu: i'm curious how that went |
| 15:27 | danneu | chessguy: it was awesome. |
| 15:28 | chessguy | danneu: nice. i've tried a couple of times to add vim to my toolbelt, and struggled every time |
| 15:28 | danneu | note that i'm using Evil-mode |
| 15:28 | chessguy | danneu: is that like viper-mode? |
| 15:28 | danneu | yeah but much better apparently. they nailed it |
| 15:28 | n_b | I'm torn between having the conveniences of org-mode and non-hacky REPL integration and sticking with what I know and have fairly extensively customised |
| 15:29 | chessguy | danneu: nice |
| 15:29 | n_b | evil even has support for reading.vimrc IIRC |
| 15:29 | chessguy | n_b: what's that? |
| 15:29 | jameshasselman | does anyone use counterclockwise? |
| 15:29 | danneu | the .emacs of vim |
| 15:30 | danneu | jameshasselman: i did for a week before trying emacs. it wasnt bad and it was my first experience with an ide |
| 15:30 | chessguy | oh, sorry, the lack of space made my brain's parser fail |
| 15:30 | jameshasselman | I want to use it, but my breakpoints don't work. I need a debugger. |
| 15:30 | chessguy | jameshasselman: a debugger for clojure? |
| 15:31 | chessguy | isn't that what the repl is for? |
| 15:31 | danneu | vim->emacs is really natural. you get to use vim (evil-mode) and really just learn some emacs platform specifics like how to navigate to files. but once you're in a file, you're back in vim. but emacs->vim is much different. |
| 15:31 | danneu | i imagine |
| 15:31 | chessguy | danneu: yeah, getting used to remembering what mode you're in requires building up muscle memory |
| 15:31 | jameshasselman | well yeah, but the stack traces I get (at least in counterclockwise) don't trace the problem back to my code. It's always some Java library. |
| 15:32 | chessguy | jameshasselman: yeah, that's true |
| 15:32 | danneu | is there a way to reverse stack traces? i'm tired of scrolling up.. |
| 15:32 | chessguy | jameshasselman: i see that a lot in both the repl and lighttable |
| 15:34 | n_b | chessguy: the problem is when that memory carries over to other areas. I've submitted more than one form with :wq at the end >> |
| 15:34 | danneu | well, you should be using :x anyways |
| 15:34 | chessguy | n_b: haha |
| 15:36 | chessguy | i've been switching back and forth between emacs and lighttable. neither one really scratches my itch |
| 15:36 | n_b | I didn't like LT at all |
| 15:37 | danneu | LT is good for getting started with Clojure imo. i think it's a good middleground between emacs+nrepl and a crappy embedded repl. |
| 15:38 | danneu | the former requiring an investment to set up and the latter just sucking. |
| 15:43 | n_b | rlwarp works with the default clj repl doesn't it? |
| 15:46 | chessguy | rlwarp? is that like rlwrap, but at faster-than-light speed? |
| 15:47 | chessguy | sorry, i couldn't resist |
| 15:48 | andyfingerhut | n_b: I often use it on Mac OS X and Linux as "rlwrap java -cp clojure.jar clojure.main". I haven't had any problems. |
| 15:49 | andyfingerhut | n_b: But more often "lein repo" is what I want. |
| 15:49 | andyfingerhut | n_b: Grrr auto-correct. "lein repl" |
| 15:49 | chessguy | andyfingerhut: you mostly want that to get the project's dependencies? |
| 15:50 | andyfingerhut | chessguy: Yes, and it has a few other enhancements from reply like access to ClojureDocs examples. |
| 15:50 | n_b | Doesn't `rlwrap lein repl` work? |
| 15:50 | n_b | It should be transparent |
| 15:51 | andyfingerhut | n_b: I think it would be redundant. There is a kind of line-editing built into 'leon repl' already. Not sure if it is equivalent to or different from what rlwrap provides. |
| 15:51 | andyfingerhut | Must… figure… out… how… to … disable. auto-correct. |
| 15:52 | jameshasselman | well, found my problem. I just entered my function line by line into the repl and found the source of my problem. Turns out int does not do what I thought it did. |
| 15:52 | n_b | ,(doc int) |
| 15:52 | clojurebot | "([x]); Coerce to int" |
| 15:53 | jameshasselman | I did read the doc for it, but I stupidly thought it would work on a string like "3" and it doesn't. I wanted Integer/parseInt |
| 15:54 | chessguy | (int 3.0) |
| 15:54 | chessguy | ,(int 3.0) |
| 15:54 | clojurebot | 3 |
| 15:54 | chessguy | ,(int 3.9) |
| 15:54 | clojurebot | 3 |
| 15:55 | andyfingerhut | n_b: One difference between rlwrap and reply: Ctrl-C aborts REPL with rlwrap. reply catches it, interrupts current processing, and gives you fresh REPL prompt. That is a win on reply's side in my book. |
| 15:56 | n_b | andyfingerhut: ahh, wasn't aware of that. I use VimClojure's REPL for 95% of my work and only ever really bust out into lein when I just want to test a few things or do some math |
| 15:58 | gfredericks | jameshasselman: yeah I think the thing that int is doing is a special jvm thing related to primitives |
| 15:59 | jameshasselman | Oh, so the bot will evaluate expressions. That's pretty cool. |
| 15:59 | n_b | annnnd learning emacs is getting pushed off to another time. I got stuck in M-x-ctrl-meta-bucky-shift-meta-colon-smiling-cat-face-add-random-bugs-every-time-you-type mode |
| 15:59 | number36 | hi all i have very simple problem |
| 15:59 | number36 | if someone would be so kind to help me |
| 16:00 | number36 | i am trying to solve one problem on 4clojure.com in different way |
| 16:00 | number36 | but i dont know how can i put two IF-s in one function |
| 16:00 | n_b | jameshasselman: Yup. clojurebot responds to , and lazybot does inline stuff with ##(print 1) |
| 16:00 | lazybot | ⇒ 1nil |
| 16:00 | gfredericks | does nrepl and/or reply associate each clojure-mode buffer with anamespace |
| 16:00 | gfredericks | i.e., a value of *ns*? |
| 16:01 | n_b | number36: Which problem? |
| 16:01 | number36 | https://www.refheap.com/paste/359b51eb1d9470da44a255881 |
| 16:01 | number36 | and this is problem |
| 16:01 | number36 | http://www.4clojure.com/problem/73 |
| 16:01 | jameshasselman | n_b: is it number 36 |
| 16:01 | number36 | :) |
| 16:01 | xeqi | gfredericks: I know nrepl.el did at one point. I would expect it still did |
| 16:02 | gfredericks | xeqi: I'm just new to nrepl and am trying to explain the phenomena I observe |
| 16:04 | n_b | number36: Try to programatically generate all the winning positions and define a function that checks whether a given symbol has won, then put it in a cond |
| 16:05 | n_b | i.e (cond (won? board :x) :x (won? board :o) :o) |
| 16:06 | number36 | ok ok |
| 16:06 | number36 | i know solution with cond |
| 16:06 | number36 | but howcome i cannot use two IF-s in one function |
| 16:06 | number36 | or how could i use them |
| 16:06 | number36 | that is interesting for me |
| 16:06 | number36 | there has to be a way how function can have two IF-s |
| 16:06 | number36 | or clojure cannot do that ? |
| 16:07 | gfredericks | you can certainly have two ifs |
| 16:08 | n_b | two ifs works fine, but the final value in the body is what gets returned |
| 16:08 | gfredericks | the question is how you want them to relate to each other |
| 16:08 | n_b | so in your function, regardless of the result of the first if, you're not doing anything with the result |
| 16:08 | gfredericks | you can have one follow the other, where the first is presumably for side effects. Or you can have one in any of the three positions (condition, true-case, false-case) of the other |
| 16:09 | number36 | hmm |
| 16:09 | number36 | i have corrected values |
| 16:09 | number36 | i had a mistake there |
| 16:10 | number36 | https://www.refheap.com/paste/8e3979a547943fbfc07ecc635 |
| 16:10 | number36 | but now although i have everything written correctly |
| 16:10 | number36 | it doesnt pass the second test although |
| 16:10 | number36 | (= a d g :x) |
| 16:10 | number36 | is there |
| 16:10 | number36 | and thats exactly second test |
| 16:11 | number36 | [22:09] <n_b> two ifs works fine, but the final value in the body is what gets returned |
| 16:11 | number36 | hmm |
| 16:11 | gfredericks | number36: your first if effectively does nothing |
| 16:11 | n_b | (inc gfredericks) |
| 16:11 | lazybot | ⇒ 17 |
| 16:12 | gfredericks | number36: I guess you're hoping the :x on line 9 is equivalent to "return :x" in java? |
| 16:12 | number36 | yes |
| 16:12 | n_b | You could wrap it in a (comment) and effectively have the same function - the result of the first if is not returned |
| 16:12 | number36 | gfredericks: please correct me if you would be so kind |
| 16:12 | gfredericks | number36: you have to learn to think in terms of expressions; clojure doesn't have a "return" concept like that |
| 16:13 | gfredericks | so you want one expression that encapsulates the logic you're going for |
| 16:13 | number36 | n_b: thanks for suggestion i will check out the comment thing |
| 16:13 | gfredericks | in this case, your second if should be in the else position of the first if |
| 16:13 | gfredericks | (if a b (if c d nil)) |
| 16:13 | number36 | aha |
| 16:13 | number36 | interesting |
| 16:13 | gfredericks | ^ that sort of structure |
| 16:13 | number36 | this is very interesting |
| 16:13 | dpathakj | number36: it may help to imagine what you would do in a C-like language if you were only allowed to 'return' once, at the end of the function. |
| 16:13 | gfredericks | cond gives you the same sort of thing, but the nested ifs might be easier to understand at first |
| 16:14 | gfredericks | (inc dpathakj) |
| 16:14 | lazybot | ⇒ 1 |
| 16:14 | dpathakj | (that restriction is a real thing that is done in some places) |
| 16:14 | andyfingerhut | number36: I'm not sure what you want, but it is probably something like (if (or ...) :x (if (or ...) :o nil), replace the first ... with your conditions checking for win by x, and the second ... with your conditions checking for win by o. |
| 16:14 | andyfingerhut | number36: and adding the final ) that I left off. |
| 16:17 | number36 | :) |
| 16:17 | number36 | managed to get to 4th test its 5th one that fails with this code |
| 16:17 | number36 | mmnt |
| 16:18 | number36 | https://www.refheap.com/paste/c530e68e483f1a8f250cef238 |
| 16:18 | number36 | fails on |
| 16:18 | number36 | diagonal |
| 16:18 | number36 | mmnt maybe i have something wrong :) |
| 16:19 | Glenjamin | hi guys, i'm sure i'm missing something obvious - but how do I convert a numeric string into an integer? |
| 16:19 | jasonjckn | Integer/parseInt |
| 16:19 | gfredericks | ,(Integer/valueOf "15") |
| 16:19 | clojurebot | 15 |
| 16:19 | gfredericks | ,(Integer/parseInt "15") |
| 16:19 | clojurebot | 15 |
| 16:20 | Glenjamin | aha, thanks |
| 16:20 | number36 | oh exactly what i needed now |
| 16:20 | number36 | :) |
| 16:20 | number36 | thanks everybody for input |
| 16:21 | gfredericks | (inc everybody) |
| 16:21 | lazybot | ⇒ 2 |
| 16:21 | Glenjamin | i guess if it's not obvious in clojure core docs, the solution is java core |
| 16:21 | Bronsa | well |
| 16:21 | Bronsa | there's also read-string |
| 16:21 | gfredericks | Glenjamin: clojure.edn/read-string would do it |
| 16:21 | technomancy_ | ~guards |
| 16:21 | clojurebot | SEIZE HIM! |
| 16:21 | Bronsa | ,(read-string "14") |
| 16:21 | clojurebot | 14 |
| 16:21 | Glenjamin | read-string sounds a bit.. flexible |
| 16:21 | gfredericks | and probably much slower |
| 16:21 | gfredericks | or at least somewhat |
| 16:22 | gfredericks | yeah there are a number of different things that are trivial with interop that presumably for that reason are not baked into core |
| 16:22 | jasonjckn | Glenjamin: clojure core is a supplement to java core |
| 16:22 | jasonjckn | or vice versa |
| 16:23 | Glenjamin | it seems like "int" could do this |
| 16:23 | gfredericks | ,(int "15") |
| 16:23 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character> |
| 16:23 | Glenjamin | ,(int 1.0) |
| 16:23 | clojurebot | 1 |
| 16:23 | gfredericks | ,(int \7) |
| 16:23 | clojurebot | 55 |
| 16:24 | Glenjamin | int = (. clojure.lang.RT (intCast x)) |
| 16:24 | Glenjamin | whatever that means |
| 16:25 | Bronsa | it means https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L1079 |
| 16:25 | gfredericks | Glenjamin: it's just deferring to a method defined in RT |
| 16:25 | Glenjamin | ah, i see |
| 16:26 | Glenjamin | i assume when that was written, x instanceof String was discounted from the use cases |
| 16:26 | gfredericks | it's only fiddling with numeric types |
| 16:26 | gfredericks | it's not intended for parsing or anything else |
| 16:26 | Glenjamin | character is considered numeric? |
| 16:26 | gfredericks | in particular I believe it returns a primitive |
| 16:35 | Glenjamin | does anyone have some examples of using xml/parse and xml-seq and getting readable code? |
| 16:35 | Glenjamin | i just seem to have chains like (-> :content first :content second), which aren't great |
| 16:39 | akhudek | Glenjamin: you could always use something like enlive |
| 16:39 | akhudek | also, zippers can be useful |
| 16:40 | akhudek | though zippers will still look something like the chains you don't like |
| 16:40 | devn | Glenjamin: also, get-in |
| 16:40 | Glenjamin | it's not so much the chains i dislike |
| 16:40 | devn | ,(get-in {:x [{:a [1 2 3]}]} [:x 0 :a 1]) |
| 16:40 | clojurebot | 2 |
| 16:41 | Glenjamin | its that reading the chains gives you no information about what's going on |
| 16:41 | devn | Glenjamin: So make them small named functions |
| 16:42 | Glenjamin | thats a good idea |
| 16:49 | rads | I need to save a hashmap to a file |
| 16:49 | rads | the simplest solution to me seems to just use EDN, but I'm a little fuzzy on the border between clojure code and edn |
| 16:49 | rads | do I just write the results of (prn my-hashmap) to a file? |
| 16:49 | rads | and then read it back in with clojure.edn/read |
| 16:50 | akhudek | rads: that sounds right |
| 16:50 | akhudek | though if it's data generated by your app, you don't need to worry about edn |
| 16:51 | akhudek | edn matters if you are reading user supplied data |
| 16:51 | rads | I see |
| 16:52 | rads | I just want to make sure the data I'm reading in is safe, as a habit |
| 16:52 | rads | and that I'm not writing out any runtime-dependent junk |
| 16:52 | rads | of course I could use JSON but I <3 clojure :) |
| 17:05 | Glenjamin | found clojure.data.zip.xml, seems to work pretty well even though it hasn't been touched in a year |
| 17:15 | akhudek | Glenjamin: enlive provides an xml-zip too |
| 18:07 | frozenlock | Could someone point me to an example use of streams? I want to make a pdf using https://github.com/yogthos/clj-pdf and then send it by email. |
| 19:00 | frozenlock | drewr: Halp! |
| 19:00 | frozenlock | Any idea how I can attach a pdf using postal, but without writing the file to disk? |
| 19:52 | `arrdem | has anyone here ported a site from noir down to compojure? I'm looking at transitioning my blog off of noir but it looks like I'm gonna have to rewrite about half the UI code to do so. |
| 19:55 | frozenlock | `arrdem: I've done it. Are you planning to use lib-noir? |
| 19:56 | frozenlock | `arrdem: Also iirc Raynes did it with refheap. |
| 19:56 | `arrdem | frozenlock: I'm neutral on this. I liked noir and there's some useful stuff in lib-noir. |
| 19:57 | `arrdem | frozenlock: also my blog was definitely my Clojure second system effect so it's a rats nest to begin with |
| 19:58 | `arrdem | my main question is where can I read up on how the argument semantics change. |
| 19:58 | frozenlock | Was the same for me. Moving to compojure gave me an opportunity to tidy up a little. |
| 19:59 | `arrdem | the Noir sample projects were pretty good about illustrating the argument structure but the compojure code I've found so far not as much |
| 20:00 | frozenlock | I found https://github.com/weavejester/compojure/wiki/Destructuring-Syntax to be really useful. |
| 20:03 | `arrdem | frozenlock: awesome, thanks! |
| 20:03 | `arrdem | (inc frozenlock) ;; am I the only one who votes around here? |
| 20:03 | lazybot | ⇒ 3 |
| 20:04 | frozenlock | No... I heard a story about an old men that saw someone vote once :P |
| 20:10 | frozenlock | Any bitcoin project in clojure? |
| 20:10 | `arrdem | none that I know of... |
| 20:11 | `arrdem | hum is there a clean way to pull a library down from clojars to play with it in the repl? |
| 20:11 | `arrdem | besides throwing it in :deps and popping up a new one. |
| 20:12 | frozenlock | I assume you mean without restarting the repl. |
| 20:12 | frozenlock | Ah yeah... take a look at pomegranate |
| 20:12 | frozenlock | https://github.com/cemerick/pomegranate |
| 20:12 | `arrdem | oh cute |
| 21:50 | robertcurtis | Hi guys, I'm a student interested in Clojure for this summer's Google Summer of Code. Do any of you guys have experience with this program from last year? |
| 22:52 | murtaza52 | I have a multi arity fn, where the arity is chosen based on the type of the arg, either a keyword or string, is this possible ? |
| 22:53 | murtaza52 | I mean is it possible to create such a fn (without going the multimethod way) ? |
| 22:59 | chessguy | murtaza52: you keep using this word arity. i do not think it means what you think it means |
| 23:02 | murtaza52 | chessguy: So what I want to do is basically have 2 forms and dispatch based on the type of arg - (fn (([a] "keyword") ([b] "string")). Like pattern matching on the type in haskell. |
| 23:02 | chessguy | murtaza52: that's what multimethods are for |
| 23:03 | chessguy | (but it's got nothing to do with arity) |
| 23:04 | murtaza52 | yes u r correct used the arity in the wrong sense, if I am correct is abt number of args, rather than type of args |
| 23:05 | chessguy | yes, that's what arity is |
| 23:10 | chessguy | murtaza52: so why not use a multimethod? |
| 23:11 | murtaza52 | wanted something more terse, as the fn themselves are one liners, so just using cond right now in the same fn. |