2013-01-17
| 00:11 | frozenlock | I might be way off on this, but couldn't an externs.js file be generated by looking in the cljs files? Say my library is named Foo, then all I need to do is take every "js/Foo.[^ ]*" and dump them in the externs.js. |
| 00:14 | tomoj | (def jq js/jQuery) |
| 00:14 | tomoj | (.whatever jq) |
| 00:15 | tomoj | in other words, you can't tell what properties you access indirectly |
| 00:17 | frozenlock | oh.. the properties too are munged? |
| 00:17 | frozenlock | This means that my carefully hand written externs.js file is useless... |
| 00:19 | muhoo | doesn't including stuff in the externs keep it from getting munged? |
| 00:20 | muhoo | what i've seen of externs files reminds me of c header files: function declarations |
| 00:23 | arrdem | who mentioned using irc bouncers a few weeks back? |
| 00:25 | frozenlock | muhoo: apparently one can just give the entire library as an externs file... but my compiler has been running for >5 min on it, so there must be something wrong. :( |
| 00:30 | muhoo | i'd try just pulling out the function declarations |
| 00:33 | muhoo | not a fun task on a large library, but the few things i've tried advanced mode with, someone had already done that work and published an externs for it |
| 00:37 | frozenlock | Turns out that setting :warnings false in the config reduce the compile time to ~30s :) |
| 00:38 | muhoo | ! |
| 00:38 | muhoo | good to know, thanks |
| 00:38 | frozenlock | or :pretty-print... I'm too lazy to check which one. |
| 00:39 | muhoo | i can't see using pretty-print with advanced mode anyway |
| 00:40 | tomoj | &#.foo |
| 00:40 | lazybot | java.lang.ClassNotFoundException: /foo |
| 00:40 | tomoj | hmm? |
| 00:51 | tomoj | hm, the tag for a data literal can be a data literal |
| 00:51 | tomoj | not that I can think of any sane reason to do that |
| 00:52 | arrdem | wait... so I could create a tagged literal taking its type from... a var? |
| 00:52 | arrdem | nothing could go wrong here. |
| 00:53 | tomoj | "Reader tag must be a symbol" |
| 00:54 | tomoj | `##foo bar baz`, `#foo bar` is a data literal, it must read to a symbol which is the tag used to read `baz` |
| 00:58 | muhoo | they need to be namespaced too, no? |
| 01:08 | frozenlock | Well I was totally wrong.. changing :warnings and :pretty-print had no effect, I simply forgot I switched back to externs.js instead of the library.js -_- |
| 01:09 | frozenlock | I have some uses of `this-as' in my code: (this-as this (set! (.-vis this) vis)). How am I supposed to input the .-vis field in the externs.js? |
| 01:13 | Raynes | algernon: o/ for using conch |
| 01:13 | Raynes | Of gource you use it. https://github.com/algernon/balabit.logstore/blob/master/lgstool/src/clj/balabit/logstore/visualisation/gource.clj#L95 |
| 01:30 | frozenlock | "Compiling "resources/public/js/cljs.js" failed. java.lang.NullPointerException:" Cmon, it's too late for this crap... |
| 01:30 | frozenlock | |
| 02:09 | tomoj | looks like in the 'lens' haskell library, funky flipped function invocation + argument operators are defined to get arguments in the order of (fn assoc-in [m ks v & more]) |
| 02:16 | brainproxy | so.. I really enjoy using the auto-reload function with ring, but is there a way for it to spit out a stack trace when a namespace reload fails? |
| 02:16 | brainproxy | e.g. when there's a syntax error? |
| 02:17 | brainproxy | I can achieve that effect by bounding the process, since an error like that will show up right away as the various namespaces are loaded |
| 02:17 | brainproxy | *bouncing |
| 02:45 | devn | yogthos|away: is /go daito |
| 02:45 | devn | blech |
| 03:09 | ebaxt | Anyone using https://github.com/cemerick/piggieback? |
| 03:19 | Raynes | ~anyone |
| 03:19 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 03:22 | ejackson | you got told Raynes ! |
| 03:26 | ebaxt | Raynes: Thanks, I pinged cemerick on twitter |
| 03:26 | Raynes | Good fellow, that cemerick. |
| 03:27 | ejackson | oh, there's more than one of him |
| 03:29 | ebaxt | Sure is |
| 04:32 | AWizzArd | Amazing. The bestest error message I’ve ever seen. Program terminates and outputs to the shell: “Error: no error”. |
| 04:32 | ro_st | heh |
| 04:34 | hyPiRion | I love such errors. |
| 04:38 | muhoo | very zen. the error is no error. the key is no key. dada is dead. check your overcoat. |
| 04:39 | muhoo | keep the lasagna flying. |
| 04:42 | ejackson | AWizzArd: that's up there with "Warning No keyboard. Press enter to continue" from back DOS days. |
| 04:42 | wuttf | When I do (command line windows) java "E:\Program Files (x86)\leiningen-2.0.0-preview10-standalone.jar", it says java.lang.ClassNotFoundException: E:\Program Files (x86)\leiningen-2.0.0-preview10-standalone.jar |
| 04:43 | wuttf | (I am new to the Java ecosystem) |
| 04:44 | clgv | AWizzArd: how about that one? "ava.lang.NullPointerException: null at clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:296) clojure.stacktrace$print_trace_element.invoke (stacktrace.clj:30)" |
| 04:44 | p_l | wuttf: java -jar <path-to-jar> |
| 04:44 | clgv | from a print-cause-trace in a catch statement. something throwable or exception that cannot be printed via print-cause-trace it seems |
| 04:45 | wuttf | p_l: Failed to load Main-Class manifest attribute from E:\Program Files (x86)\leiningen-2.0.0-preview10-standalone.jar |
| 04:45 | hyPiRion | wuttf: have you followed the instructions on leiningen.org? It'd make stuff easier. |
| 04:46 | wuttf | hyPiRion: Well I talked with some dudes here yesterday, If I remeber well they said I can set some envars (I did) and run leiningen directly |
| 04:48 | clgv | wuttf: did you? |
| 04:48 | acron^ | hyPiRion: you didn;t used to play Anarchy Online, did you? |
| 04:49 | wuttf | clgv: Which part? Did I talk or did I set the envars? |
| 04:49 | wuttf | clgv: Both anyway. |
| 04:50 | clgv | wuttf: so you added the directory where lein.bat is to the path and downloaded a wget.exe and finally ran "lein" from command line? |
| 04:51 | wuttf | clgv: No, Ember and an other guys said there is an other way (wget crashed on me) |
| 04:51 | wuttf | -s |
| 04:51 | clgv | curl.exe should work as well |
| 04:51 | wuttf | clgv: I try that then. |
| 04:52 | clgv | but it needs to be on the path as well. so maybe just put it beside the lein.bat |
| 04:57 | wuttf | "leiningen-2.0.0-preview10-standalone.jar can't be used now" wtf? |
| 04:58 | hyPiRion | acron^: No, I've actually never used this nickname in gaming. |
| 04:58 | hyPiRion | Though apparently people use it frequently there. |
| 04:59 | acron^ | Is it from somewhere? |
| 05:01 | hyPiRion | It's a combination of my middle name, my skills in math and the god Hyperion. |
| 05:02 | hyPiRion | PiR => Pi R |
| 05:02 | hyPiRion | PiR => can be spoken as Pierre |
| 05:07 | acron^ | Ahh |
| 05:07 | acron^ | You're right, I didn't notice the spelling |
| 05:19 | Guest20858 | Any recommendation for validation on http requests and routes. For example to check that 'id' exists in route-params and is a valid guid, or that that 'body' is given as post data and is less than some number of characters. |
| 05:20 | silasdavis | recommendations for a validation library that is |
| 05:24 | rodnaph | silasdavis: are you planning to do that validation via middleware? could be neat. |
| 05:27 | ejackson | silasdavis, clj-schema might help ? |
| 05:32 | silasdavis | ejackson: useful thanks |
| 05:35 | silasdavis | rodnaph: I'm using liberator (http://clojure-liberator.github.com/) to return appropriate http responses and I think I need to do validation within it's decision tree, which is a graph of decision functions. It passes a context map between those functions but that map is not quite the same as a ring response map |
| 06:45 | ChongLi | hi |
| 06:46 | ChongLi | anyone around? |
| 06:52 | ro_st | yep |
| 07:10 | augustl | I'm going to use MySQL from Clojure (and JVM in general) for the first time. Anyone got some suggestions to stuff I should read? |
| 07:10 | augustl | would be nice to make it so that I could use an in-memory database for testing, for example |
| 07:16 | ro_st | presumably you know about sqlkorma.com already? |
| 07:16 | ro_st | i don't know if you get in-memory sql databases. sqlite3 is disk based. perhaps h2? |
| 07:26 | p_l | ro_st: SQLite3 has in-memory store as well |
| 07:27 | ro_st | there ya go, then :-) |
| 07:27 | p_l | you just open, iirc, :memory: as filename |
| 07:37 | xificurC | if I wanted to start a custom repl for a simple game that will accept a couple of commands only, is there a way to print text in the repl without getting a nil after each print? |
| 07:53 | augustl | p_l, ro_st: thanks! |
| 07:53 | augustl | seems that if I just use the jdbc stuffs I'm golden. |
| 08:01 | cemerick | xificurC: if it's a custom REPL, then you have complete control over what is printed or not |
| 08:03 | xificurC | cemerick: you are right, if I knew what exactly was I doing I would :D Anyway I changed some parts of the code and now it's fine |
| 08:04 | xificurC | by custom repl i meant a quite simple (loop [] (do (print (eval (read))) (recur))) |
| 08:05 | xificurC | oh one more question: I get these ^M symbols at the end of each printed line for some reason, what does that mean? I am using Emacs-nrepl |
| 08:17 | hyPiRion | $google ^M emacs |
| 08:17 | lazybot | [Hiding ^M in emacs - Stack Overflow] http://stackoverflow.com/questions/730751/hiding-m-in-emacs |
| 08:21 | xificurC | hyPiRion: thanks, I tend to forget googling when I'm sitting in a chat room :( |
| 08:22 | hyPiRion | no problem, didn't know ^M would be read literally either |
| 08:44 | calis | I'm an objective-c programmer. I'd like to learn some server-side stuff, so I can do the whole caboodle (native apps which use custom made web services etc) for clients. Clojure (+ ring etc) seem like a good fit for the web side. What would be a good route for me to learn? I've started on the 4clojure site already. |
| 08:44 | Bronsa | ,(symbol nil) |
| 08:44 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 08:45 | Bronsa | ,(keyword nil) |
| 08:45 | clojurebot | nil |
| 08:45 | Bronsa | ew |
| 08:50 | aroemers | calis: read the excellent Clojure Programming book: http://www.clojurebook.com |
| 08:51 | aroemers | It will get you up to speed quickly and contains a lot of practical stuff as well. |
| 08:57 | calis | aroemers: thanks, I will have a look. My only concern is that it compares clojure with Java, Ruby, and Python, none of which I'm familiar with |
| 08:59 | clj | I'm new to clojure. I installed leiningen 2 on my OSX 10.8. I want to install https://github.com/hugoduncan/criterium, what's the best way to do it? Do I need to clone the repo and do something? I think I could do it using lein plugin install <> in lein 1, but not sure about lein 2. |
| 09:00 | xificurC | calis: I myself started learning clojure only a couple of weeks ago and since I have only a little bit of experience with programming (and none with Lisp or functional languages) it was quite hard to get used to it |
| 09:02 | xificurC | googling for manuals, tutorials, books etc lands you enough resources but to get accustomed to the language I think you really need to just code, code and code |
| 09:02 | xificurC | I also did the 4clojure problems (not all) and about 60 of Project Euler problems until I felt comfortable with the basics |
| 09:06 | calis_ | +: How does Euler help? Is it clojure is a math-heavy language? Objective-c doesn't feel too mathy |
| 09:09 | xificurC | calis_: it only helped me because I was never able to use map, reduce, apply, filter and the like the right way. Forcing myself to store numbers in lists or vectors and apply changes to them helped me train these functions |
| 09:11 | xificurC | but yes, since Clojure is a general-purpose language you wont learn all you need from solving math problems :) |
| 09:13 | calis_ | Thanks +, I'll definitely make Euler part of my learning experience |
| 09:16 | calis_ | http://grokcode.com/367/learning-clojure-with-project-euler/ |
| 09:19 | xificurC | calis_: also, if you want to check other clojure solutions to the problems you solved - http://clojure-euler.wikispaces.com/ |
| 09:21 | biff_tannen | whats the standard web-framework/toolchain for developing web applications with clojure? |
| 09:23 | S11001001 | biff_tannen: clojure isn't the standard language for developing web applications. Why stop exploring now? |
| 09:24 | biff_tannen | no i mean |
| 09:25 | cemerick | biff_tannen: compojure is the most common baseline |
| 09:25 | biff_tannen | is there a library/framework that enables web facing development with closure |
| 09:25 | biff_tannen | ok |
| 09:30 | basefriend | whois biff_tannen |
| 09:35 | jweiss | where's the best place to post job openings for clojure programmers? (i mean clojure-specific place) I have seen a couple on the mailing list but thought there might be something else. |
| 09:35 | pjstadig | usually the mailing list |
| 09:36 | pjstadig | that's where we've posted several |
| 09:36 | bordatoue | could anyone please tell me if there is any built in support for Unsigned primitive types in clojure |
| 09:36 | jweiss | ok i'll have to see if our HR will do that or if I should just do it myself |
| 09:37 | jweiss | pjstadig: did you get some bites when you posted? |
| 09:37 | yogthos | biff_tannen: I'm maintaining this http://www.luminusweb.net/ |
| 09:37 | pjstadig | jweiss: yeah we've hired some great candidates from there |
| 09:37 | jweiss | great, that's good to hear |
| 09:37 | pjstadig | there's not a ton of bites right a way, you have to be a little patient sometimes |
| 09:38 | yogthos | biff_tannen: it creates a template project using Ring/Compojure and sets it up following some of the best practices currently agreed upon right now |
| 09:38 | pjstadig | bordatoue: no, there are no unsigned numbers on the JVM |
| 09:38 | S11001001 | bordatoue: not sure about CLR version though. |
| 09:38 | pjstadig | and so no support for them in clojure |
| 09:39 | bordatoue | pjstadig: S11001001, thanks - do you know about any java lib with these support |
| 09:39 | S11001001 | bordatoue: you can't add it with a library |
| 09:39 | S11001001 | unless you're talking about vector ops or whatnot, in which case, you'd have to look for that specifically |
| 09:39 | bordatoue | S11001001: why can't i make fn calls to the lib from clojure |
| 09:40 | S11001001 | bordatoue: Perhaps you should narrow what you're looking for. In Java, you can't stick unsigned values on the stack, and can't put them in the managed heap, and that's what "unsigned primitive types" means. |
| 09:41 | S11001001 | And by "can't" I mean you could not possibly find a library that does it, because it's not supported by the VM. |
| 09:42 | S11001001 | So if that's *not* what you mean, what do you mean? |
| 09:46 | bordatoue | S11001001: isn't there any library that would automatically promote a type to a large type , only when it comes to long it need to make some reference type |
| 09:48 | S11001001 | You mean with plus, minus, etc functions that simulate the clock math you're looking for? |
| 09:49 | S11001001 | You can write clock math on signed primitive types, but they would still be signed types, and you can't add new primitive types in JVM. |
| 09:50 | bordatoue | S11001001: I agree with you, I can see the bytecode ins uses fixed java types . |
| 09:53 | jweiss | i want to write pmap, but for trees. pass each node of the tree through f, returning a tree of the same structure but different nodes. i'm at a loss how to write this functionally. zippers don't seem to work because they only have a notion of one "current" node, so it's not parallelizable. any suggestion? |
| 09:53 | bordatoue | is there anyway to use bytebuffer to deal with unsigned types |
| 09:58 | S11001001 | and immutability will help you avoid deadlocks when doing so |
| 09:58 | S11001001 | s,help,make, |
| 10:01 | maleghast | Anyone in here got any experience using Clojure / JDBC or SQLKorma with a clustered MySQL environment..? Just looking for some pointers with regard to setting up the connection(s)... |
| 11:04 | Bronsa | user=> (deftype foo [bar]) |
| 11:04 | Bronsa | user.foo |
| 11:04 | Bronsa | user=> (baz/.bar (foo. 1)) |
| 11:04 | Bronsa | 1 |
| 11:04 | Bronsa | user=> (find-ns 'baz) |
| 11:04 | Bronsa | nil |
| 11:06 | TimMc | heh |
| 11:07 | TimMc | ,(fnurbl/.length "hi!") |
| 11:07 | clojurebot | 3 |
| 11:07 | TimMc | Yeah, there are parts of Clojure that only use the name portion of symbols. |
| 11:07 | TimMc | Good stuff for obfuscation, by the way. |
| 11:07 | Bronsa | namely, the macroexpander |
| 11:08 | TimMc | ,(. "hi!" fnurbl/.length) |
| 11:08 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: .length for class java.lang.String> |
| 11:08 | TimMc | Ah! |
| 11:08 | hyPiRion | wrap it |
| 11:08 | TimMc | ,(. "hi!" fnurbl/length) |
| 11:08 | clojurebot | 3 |
| 11:08 | TimMc | I don't think the macroexpander has anything to say about that. |
| 11:08 | TimMc | It's the Compiler. |
| 11:09 | Bronsa | the compiler too, then |
| 11:09 | jkkramer | ,(macroexpand '(baz/.foo blah)) |
| 11:09 | clojurebot | (. blah foo) |
| 11:09 | Bronsa | ^ |
| 11:09 | hyPiRion | ,(macroexpand '(. blah baz/.foo)) |
| 11:09 | clojurebot | (. blah baz/.foo) |
| 11:09 | TimMc | So it really is both. |
| 11:09 | Bronsa | yep |
| 11:21 | solussd | is there an easy way to add a jar to your classpath using leiningen 2? I dont want to create a local maven repo- I just want to "try" something real quick. :) |
| 11:21 | augustl | I've always used HTTP for APIs. Now I'm using a message queue for the first time. What do you typically do for things like status codes, and what format should one use for the message contents? |
| 11:23 | llasram | augustl: What do you mean by 'status codes' in the MQ context? |
| 11:23 | augustl | llasram: I'm using the MQ for RPC |
| 11:24 | llasram | augustl: As far as message contents, whatever is easiest in your system, although I'd definitely suggest using a general extensible encoding scheme. We're using JSON, although honestly you don't get as much benefit from a human-parsable format as you do in other arenas |
| 11:24 | augustl | so my typical use is (let [res @(do-rpc .....)]). Need to figure out what "res" should be and what the "..." part should be :) |
| 11:24 | augustl | I'd default to JSON everywhere, and just {"status":"ok","message":...}, etc |
| 11:24 | llasram | Hmm. I'm of the opinion that RPC over message queues is an anti-pattern, so don't have any good suggestions on how to do it :-) |
| 11:25 | augustl | llasram: hmm, how so? |
| 11:25 | kmeister123 | How do you get out of the current line if the repl's expecting more, a command like C-c? Ex: I entered (instance? java.util.List {1 2 |
| 11:26 | augustl | llasram: it seems to solve a lot of problems for me at least |
| 11:26 | llasram | augustl: There's a mismatch in semantics which leads to fighting against your queuing system to some extent and failing to fully exploit what it can do well |
| 11:28 | llasram | augustl: If I may ask, what's your larger problem? |
| 11:29 | augustl | llasram: the biggest benefit the way I see it is that I can just add more servers |
| 11:30 | augustl | and do things like deploying the newest version and taking down the older version, in that order, without any of the API users noticing |
| 11:31 | llasram | augustl: Sure, but those are properties of using a message queue, not using it for RPC. If the RPC requirement is baked in stone, well -- I guess you do what you can :-) |
| 11:37 | augustl | llasram: not sure if I follow. They are the properties of a message queue, and that's what I want |
| 11:43 | llasram | Right. I think RPC via message queues is problematic, but my proposed solution would be to use message queues with message-oriented vs RPC semantics, not use RPC via some other mechanism |
| 11:46 | augustl | llasram: my API will occasionally be proxied through HTTP though, so I need request/response-ish so that the HTTP request can respond accordingly etc |
| 12:07 | e_svedang | Hello, is there a special channel for Clojure CLR? |
| 12:15 | Anderkent|away | Why do people put log4j.properties in their libraries? Expecially ones that config the root logger? Gah! |
| 12:17 | TimMc | Anderkent|away: Because Log4j is incomprehensible magic, so people are satisfied to get it working at all. |
| 12:23 | Anderkent | TimMc: pretty sure rootLogger is clear enough to know that you shouldn't use it... Similarly why is a library selecting appendersls |
| 12:23 | Anderkent | woops didnt mean to do 'ls<return>' there :P |
| 12:27 | maleghast | Anyone in here deploying on Immutant..? |
| 12:28 | technomancy | Anderkent: but people just copy/paste log4j configs around without reading them because they generally consist of complete gibberish |
| 12:28 | ucb | once I have a project I'm hacking in parallel in checkouts/, I assumed I have to include it in my list of :dependencies, right? |
| 12:28 | technomancy | ucb: right |
| 12:28 | ucb | thanks |
| 12:28 | technomancy | ucb: most people don't understand that for some reason |
| 12:29 | jcrossley3 | maleghast: if immutant-specific, ask it in #immutant |
| 12:29 | ucb | technomancy: I didn't initially; I thought it'd be some magical pony thing but then I read that the checkouts actually take "precedence" over clojars which made the difference for me. I was just confirming my conclusion |
| 12:29 | maleghast | jcrossley3: Good point… |
| 12:30 | ucb | technomancy: quick question, if checkouts/ takes precedence over clojars, what does it look for? a prebuilt jar? I'm thinking about the dependencies of my checkouts/ |
| 12:34 | jchauncey | can you only use tools.cli when executing a jar file? seems that it won't work with lein run |
| 12:34 | jchauncey | oh wait i may have figured it out |
| 12:35 | technomancy | ucb: have you seen the lein-pprint plugin? |
| 12:35 | technomancy | `lein pprint :checkout-deps-shares` will show you what entries from the checkouts/ projects are added to your project's classpath |
| 12:44 | rads | hello all. I've been testing out clojurescript and one of the hardest things to do is to avoid using the same patterns I do in javascript |
| 12:44 | rads | for example, Backbone.js is OO-based, and I was wondering if there is anything in the clojurescript world for the same use case, but in a functional manner |
| 12:44 | S11001001 | rads: don't use loop for stuff |
| 12:44 | rads | or at least some examples |
| 12:44 | S11001001 | rads: also, don't use reduce for stuff |
| 12:44 | S11001001 | rads: should get you started |
| 12:45 | nDuff | What _is_ backbone.js? |
| 12:45 | rads | S11001001: thanks :) I'm pretty experienced with clojure so the functional programming part isn't too much of a switch |
| 12:45 | S11001001 | ah ok |
| 12:45 | S11001001 | n/m then |
| 12:45 | rads | it's more questions of "how do you represent a View" in clojurescript? |
| 12:46 | rads | in backbone it's common to create a class to wrap around a DOM element and associate events to it, but the API for doing so is not very functional |
| 13:03 | asteve | I want a function that returns 2 numbers, 1 and 2 |
| 13:03 | frozenlock | (defn my-fn [] [1 2])? :P |
| 13:03 | asteve | why won't (fn [1] [2]) do that? |
| 13:03 | asteve | ah, I'm forgetting the input |
| 13:04 | asteve | (let [[x y] (fn [] [1 2])] y) |
| 13:05 | asteve | what am I doing wrong there? |
| 13:05 | frozenlock | Hmm... someone has a clever way of doing this? (apply .trigger `(component ~@args)) |
| 13:05 | S11001001 | asteve: (fn [] [1 2]) is a function. |
| 13:05 | frozenlock | #(let [y (fn [] [1 2])] y) |
| 13:06 | asteve | I'm trying to let x = 1 and y = 2; |
| 13:06 | S11001001 | frozenlock: can only do with reflection |
| 13:06 | S11001001 | asteve: functions are not the values they return, they are functions. |
| 13:06 | nDuff | asteve: ...so you want to actually _call_ the function? |
| 13:06 | asteve | yes |
| 13:07 | skelternet | would it be (let [ [x y] (myfn ... |
| 13:07 | nDuff | ,(let [[x y] ((fn [] [1 2]))] y) |
| 13:07 | clojurebot | 2 |
| 13:07 | frozenlock | S11001001: And in layman terms? |
| 13:07 | nDuff | asteve: ^^ the extra parens are needed to make it a call; otherwise, you're returning the function itself, not calling it. |
| 13:07 | frozenlock | (cljs, not clj btw) |
| 13:07 | asteve | nDuff: thanks! |
| 13:08 | asteve | this clojure stuff is cool |
| 13:08 | asteve | :) |
| 13:10 | frozenlock | Interesting, (`(.trigger component ~@args)) doesn't seem to choke the compiler. |
| 13:10 | S11001001 | frozenlock: it wouldn't |
| 13:11 | S11001001 | the result of that doesn't try to "apply" to `.trigger'; it has .trigger in the (here<<<- ...) position at compile-time |
| 13:12 | technomancy | ,`(do ~@(map / [1] [0])) |
| 13:12 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ArithmeticException: Divide by zero> |
| 13:12 | technomancy | ,(do `(do ~@(map / [1] [0])) nil) |
| 13:12 | clojurebot | nil |
| 13:13 | technomancy | ^ fun fact |
| 13:13 | S11001001 | ,`(do '~@(map / [1] [0])) |
| 13:13 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ArithmeticException: Divide by zero> |
| 13:13 | S11001001 | &(doc memfn) |
| 13:13 | lazybot | ⇒ "Macro ([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn." |
| 13:14 | S11001001 | frozenlock: as with .method forms, memfn also enforces knowledge of the argument count at compile time, for the same reasons |
| 13:15 | S11001001 | there are some convenient static methods in the clojure java code you can use for making variadic, necessarily reflective calls, more conveniently than the java stdlib allows |
| 13:18 | frozenlock | I'm not sure I get everything :( |
| 13:18 | frozenlock | but as a rule of thumb, dot calls should always be in the left position? |
| 13:18 | frozenlock | (here<<<<<< ) |
| 13:20 | hyPiRion | frozenlock: not neccesarily |
| 13:20 | hyPiRion | ,(macroexpand '(.length "1234")) |
| 13:20 | clojurebot | (. "1234" length) |
| 13:20 | TimMc | ,(macroexpand '(.foo "1234")) |
| 13:20 | clojurebot | (. "1234" foo) |
| 13:21 | TimMc | ,(macroexpand '(.foo "1234" 42)) |
| 13:21 | clojurebot | (. "1234" foo 42) |
| 13:21 | TimMc | Huh... |
| 13:21 | frozenlock | lol |
| 13:21 | TimMc | ,(macroexpand '(. "1234" (foo 42))) |
| 13:21 | clojurebot | (. "1234" (foo 42)) |
| 13:22 | TimMc | I'm still unclear on exactly when the compiler (as a whole) makes the decision on when an interop call is a field or method. |
| 13:27 | augustl | this returns the value of the first function in a list that returns something truthy: (some #(%) [(fn []) (fn []) #(- 5 1) #(+ 1 2)]) |
| 13:27 | augustl | any better ways to do it? #(%) looks weird.. |
| 13:28 | metellus | identity |
| 13:28 | TimMc | not quite... |
| 13:29 | augustl | nope, that just gives me the first function :) |
| 13:31 | TimMc | fun-call |
| 13:31 | TimMc | Doesn't exist in CLojure, but you could write it. :-) |
| 13:33 | S11001001 | #(% %&) should :) |
| 13:33 | TimMc | &(letfn [(fn-call [f & args] (apply f args))] (some fn-call [(fn []) (fn []) #(- 5 1) #(+ 1 2)])) |
| 13:33 | lazybot | ⇒ 4 |
| 13:34 | TimMc | S11001001: Needs an apply, yeah? |
| 13:34 | frozenlock | Well... I think I just overwritten my js library by giving a clojure namespace the same name as the library. |
| 13:35 | S11001001 | '#(do %&) |
| 13:35 | S11001001 | ,'#(do %&) |
| 13:35 | clojurebot | (fn* [& rest__27#] (do rest__27#)) |
| 13:35 | frozenlock | In retrospect it's obvious. |
| 13:35 | S11001001 | ah, heah, TimMc |
| 13:35 | S11001001 | yeah |
| 13:35 | S11001001 | got it mixed up with cut/cute's variadic syntax |
| 13:35 | TimMc | &(let [fn-call #(apply % %&)] (some fn-call [(fn []) (fn []) #(- 5 1) #(+ 1 2)])) |
| 13:35 | lazybot | ⇒ 4 |
| 13:45 | ucb | augustl: you could try #(apply % '()) |
| 13:45 | ucb | blip |
| 13:45 | augustl | :D |
| 13:46 | augustl | why the list instead of a vector? |
| 13:46 | TimMc | or nil |
| 13:47 | ucb | nothing in particular |
| 13:47 | ucb | could've been #{} or even {} if you want |
| 13:48 | S11001001 | (java.util.Map.) |
| 13:48 | ucb | (or nil as TimMc point's out) |
| 13:48 | S11001001 | HashMap whatever |
| 13:51 | sorenmacbeth | ahoy! |
| 13:51 | sorenmacbeth | can one destructure namespace-qualified keywords from a map? |
| 13:51 | sorenmacbeth | using the {:keys [a b c]} m syntax |
| 13:52 | sorenmacbeth | or do I have to do it long form? |
| 13:56 | S11001001 | sorenmacbeth: I can't imagine a good short-form encoding. |
| 13:57 | rippy | (count [1 2 3]) ; prints 3 |
| 13:57 | rippy | i want to do ... |
| 13:57 | rippy | (quote (count [1 2 3])) |
| 13:58 | augustl | how do you add new columns with clojure.java.jdbc? Since I couldn't find that on google.. Is nobody actually using clojure.java.jdbc? |
| 13:58 | rippy | something like that, but have it come out as 3 |
| 13:58 | S11001001 | rippy: and get...? |
| 13:58 | technomancy | augustl: here's what I do: https://github.com/technomancy/syme/blob/master/src/syme/db.clj#L50 |
| 13:58 | augustl | technomancy: tnx |
| 13:58 | technomancy | c.j.jdbc isn't great, but it mostly gets the job done |
| 13:58 | rippy | so the (count [1 2 3]) gets evaulated in side before the quote |
| 13:59 | technomancy | augustl: beware libraries that claim to be able to support DB-agnostic migrations |
| 13:59 | rippy | not sure if it can be done, i'm pretty new to clojure |
| 13:59 | AimHere | You mean you want something evaluated inside a quote at compile-time? |
| 13:59 | S11001001 | ,`'~(count [1,2,3]) |
| 13:59 | clojurebot | (quote 3) |
| 13:59 | rippy | awesome, thanks |
| 13:59 | augustl | technomancy: indeed :) |
| 13:59 | augustl | technomancy: do you have an example of an actual migration in there? |
| 14:00 | svjson | I can't for the life of me seem to get compojure/ring to use a custom session store. (wrap-session {:store (whatev-store)}) seems to have no effect whatsoever. Anyone with experience there? |
| 14:00 | technomancy | augustl: this might be a better example: https://github.com/heroku/buildkits/blob/master/src/buildkits/db/migrate.clj |
| 14:00 | luxbock | if I have a sequence [A B A A C B A C], how do I find out how many times an item takes place in the sequence? |
| 14:01 | technomancy | luxbock: try frequencies |
| 14:01 | weavejester | svjson: Perhaps the session middleware has already been added with the default store. |
| 14:02 | weavejester | svjson: Are you using compojure.handler/site at all? |
| 14:02 | luxbock | I'm doing a 4Clojure problem and frequencies is banned |
| 14:02 | weavejester | luxbock: Just the one item? |
| 14:02 | svjson | weavejester: Yeah, I'm starting off from template code generated from the leiningen plugin |
| 14:02 | luxbock | yeah just one item is fine |
| 14:03 | svjson | weavejester: So, basically I've got this: (def app (handler/site app-routes)) |
| 14:03 | svjson | (def war-handler |
| 14:03 | svjson | (-> app |
| 14:03 | svjson | (wrap-resource "public") |
| 14:03 | svjson | (wrap-base-url) |
| 14:03 | svjson | (wrap-session {:store (monger-store)}) |
| 14:03 | svjson | (wrap-file-info))) |
| 14:03 | nDuff | Is cljs/lua still live? Its github repo doesn't look like it's seen action in a while. |
| 14:03 | svjson | Ah, that didn't format itself very good, sorry for spamming |
| 14:03 | weavejester | svjson: handler/site adds in a session already |
| 14:04 | weavejester | svjson: Try: (handler/site app-routes {:session {:store (whatever-store)}}) |
| 14:04 | svjson | weavejester: Aha! |
| 14:04 | weavejester | svjson: Or alternatively, add the middleware yourself. |
| 14:05 | brainproxy | weavejester: is there a way to have ring print an exception to stdout/err when the ring reload throws, e.g. when it encounters a syntax error when reloading a namespace? |
| 14:05 | weavejester | svjson: BTW, in Compojure, I tend to prefer (route/resources "/") over the middleware (wrap-resource "public") |
| 14:05 | svjson | weavejester: Can't say I'm well versed enough to understand the difference there :/ |
| 14:06 | weavejester | brainproxy: I suspect that might be lein ring server putting wrap-reload before wrap-stacktrace |
| 14:06 | weavejester | svjson: Well, either will do. |
| 14:07 | svjson | weavejester: Doing what you suggested with the session-store worked like a charm, though! Thanks - The banging of this head against hard surfaces may now cease. |
| 14:08 | weavejester | svjson: Effectively the wrap-session added by handler/site overrode the wrap-session added by you |
| 14:08 | brainproxy | weavejester: i see, so maybe I should manually setup wrap-reload, and make sure wrap-stacktrace comes before it? |
| 14:08 | brainproxy | i.e. instead of depending on the :auto-reload? option in project.clj |
| 14:09 | weavejester | brainproxy: Which version of lein-ring are you using? |
| 14:09 | brainproxy | 0.8.0 |
| 14:10 | weavejester | brainproxy: Hm, in that the stacktrace printing should come last |
| 14:10 | weavejester | Oh wait |
| 14:10 | weavejester | No, I fixed it, but didn't release a new version |
| 14:11 | weavejester | So the repo is up to date, but I'll need to release a 0.8.1 |
| 14:11 | brainproxy | okay |
| 14:11 | weavejester | I'll do that tomorrow |
| 14:11 | brainproxy | quick question, would it be possible in the project.clj to specify wrap-stracktrace-log behavior vs. wrap-stracktrace? |
| 14:11 | weavejester | brainproxy: Not unless you wrap it yourself |
| 14:12 | weavejester | brainproxy: But I want to make wrap-stacktrace smarter for Ring 1.2 |
| 14:12 | brainproxy | okay, that's what I meant, and that's fine |
| 14:12 | minimal | http://www.python.org/dev/peps/pep-0427/ |
| 14:12 | brainproxy | lein-ring is great btw, thanks for your hard work on it |
| 14:12 | minimal | ah wrong window |
| 14:13 | svjson | weavejester: turns out I also have (route/resources "/") among my routes (also generated by the lein-plugin). So what that does is basically to serve the resources directory under /, I gather. You said you prefer this of (wrap-resource "public") - are these two ways of achieving the same thing? |
| 14:13 | weavejester | svjson: Yes. (route/resources "/") == (route/resources "/" {:root "public"}) |
| 14:14 | weavejester | svjson: Which will achieve the same effect as (-> handler (wrap-resource "public") (wrap-file-info)) |
| 14:14 | svjson | weavejester: In other words, I can toss (wrap-file-info) as well, then? |
| 14:15 | weavejester | svjson: Yes, unless you're returning java.io.File objects from your own routes |
| 14:15 | weavejester | brainproxy: You're welcome :). Lein-Ring is a little tricky to write, because there's inevitably some corner case it doesn't apply to. |
| 14:16 | svjson | weavejester: Got it, thanks. |
| 14:17 | svjson | weavejester: Oh, and thanks for Compojure as a whole. I'm having great fun with it! |
| 14:17 | weavejester | svjson: You're welcome :) |
| 14:19 | technomancy | weavejester: the evolution of compojure from "clojure web framework" to "library for setting up routes" is interesting to me; have you written/spoken anywhere about the process of paring it down and finding just the right way to decompose things? |
| 14:21 | technomancy | might be especially relevant with all this "full-stack" talk that was running on the mailing list |
| 14:21 | weavejester | technomancy: No, I don't believe so. It was mostly driven by the appearance of Ring. When I took out all the servlet stuff the only parts left were the routes and the HTML generation, and then it seemed natural to split them apart too. |
| 14:22 | weavejester | technomancy: I thought the consensus was just to create useful templates |
| 14:22 | weavejester | Good templates for starting projects seem a good idea. |
| 14:23 | technomancy | well yes, but it's a limited consensus =) |
| 14:24 | technomancy | I agree that's the most effective way to communicate patterns to newcomers myself. |
| 14:24 | nz- | example apps that go beyond simple hello world, are also nice |
| 14:27 | technomancy | the motivation and process behind that might make a good blog post or conference talk |
| 14:28 | ucb | technomancy: got a sec to look at my checkouts/ setup? it doesn't seem to be working unfortunately :( |
| 14:28 | technomancy | ucb: sure |
| 14:29 | asteve | (let [[x y] ((fn [] [1 2]))] [y x]) is the same as (defn one-two [] [1 2]) (let [[x y] (one-two) [y x])? |
| 14:29 | ucb | technomancy: this is the tree https://gist.github.com/4558722 |
| 14:29 | asteve | one-two)]* |
| 14:29 | ucb | technomancy: and the relevant project.clj https://gist.github.com/4558728 |
| 14:30 | amalloy | asteve: well, except one of them leaves a function defined in the global scope |
| 14:30 | asteve | amalloy: that is what I want |
| 14:30 | technomancy | ucb: and riemann.orig has a proper checkout of riemann with a project.clj in it? what does `lein classpath` say? |
| 14:31 | asteve | I guess I need to verify that I only need a single parenthesis around the function call one-two |
| 14:31 | asteve | and when a function has no input, do I leave it blank? |
| 14:32 | ucb | technomancy: indeed; lein classpath where? in centinela or riemann.orig? |
| 14:32 | asteve | should it be (one-two) or (one-two [])? |
| 14:32 | technomancy | ucb: in the project that has a checkouts/ dir |
| 14:33 | ucb | technomancy: I get https://gist.github.com/4558782 |
| 14:33 | amalloy | asteve: (one-two []) calls the function with a single argument, the empty vector |
| 14:33 | ucb | technomancy: so that's basically my problem, lein deps or lein repl report the same thing |
| 14:34 | ucb | technomancy: that's why I was wondering whether I need to build the projects in checkouts/ or? If I lein install rieman.orig everything works fine (as expected) |
| 14:34 | ferd | anybody using monger + ragtime + lein ? any example to start form? |
| 14:34 | asteve | amalloy: I want one-two to take in no argument; so (one-two) is more appropriate? |
| 14:34 | technomancy | ucb: :dependencies and checkouts/ are orthogonal; the only overlap they have is that they both affect the classpath |
| 14:35 | amalloy | i've already answered that question twice. what you wrote the first time is correct |
| 14:38 | ucb | technomancy: I see. So, checkouts/ should be added to the path even if I don't list riemann as a dependency? |
| 14:38 | technomancy | ucb: right |
| 14:41 | ucb | technomancy: right, if I remove riemann from the dependencies it all works and it appears fine in the classpath |
| 14:41 | ucb | works means I get a repl; trying to use/require an ns from riemann fails though |
| 14:41 | ucb | that might be a different problem though |
| 14:41 | technomancy | ucb: right, because the dependencies don't get pulled in |
| 14:41 | technomancy | because it's not in :dependencies |
| 14:42 | augustl | I'm getting a NullPointerException when I use "jdbc:h2:mem:" as the arg to with-connection.. Any ideas why? |
| 14:42 | ucb | technomancy: oh, so adding checkouts to ... grumble ... how can I get riemann's dependencies pulled in then? |
| 14:42 | ucb | listing riemann as a dependency I suppose, but that didn't quite work for me earlier |
| 14:42 | technomancy | ucb: if you have a dependency you have to put it in :dependencies |
| 14:43 | technomancy | you can also put it in checkouts, but you can't omit it from :dependencies |
| 14:43 | augustl | anyone ever used h2 in-memory from clojure.jdbc? |
| 14:44 | ucb | technomancy: fair enough, say I depend on the entirety of riemann. I've added [riemann "X.Y.Z"] to my dependencies however it failed at fetch time from clojars (it hasn't been published) |
| 14:44 | augustl | can't seem to figure out what the correct URL is, the one from the h2 docs doesn't seem to work - "jdbc:h2:mem:" |
| 14:44 | technomancy | ucb: sure; that has nothing to do with checkouts |
| 14:44 | ucb | technomancy: I've obviously misunderstood checkouts then :) |
| 14:45 | technomancy | you are not alone |
| 14:45 | technomancy | I simply can't figure out how to explain it differently though. |
| 14:45 | ucb | I suppose I'll have to go the lein install route for now |
| 14:45 | ucb | technomancy: so, checkouts only affects the classpath, correct? |
| 14:46 | technomancy | I think people assume it does more than it actually does or something. |
| 14:46 | technomancy | right |
| 14:46 | ucb | right, if that's the case I understand now. As you say, I assumed it did more than it does. |
| 14:46 | augustl | wow, clojure.java.jdbc seems to do a lot of parsing of the URLs on its own |
| 14:47 | ucb | I suppose that I was expecting checkouts to put a working version of riemann on my classpath |
| 14:47 | ucb | but it only puts the riemann code on the classpath and not its dependencies |
| 14:47 | ucb | I see now. Thanks technomancy |
| 14:47 | technomancy | right; it's supplementary and non-transitive |
| 14:48 | technomancy | if you can think of how to explain it so people wouldn't be confused by it I would be happy to update the docs, but at this point I'm beginning to think it's impossible =) |
| 14:53 | ucb | technomancy: how does this read "Checkouts will only affect your project's classpath, i.e. only the clojure source code of the projects you're hacking in paralell will be placed in your classpath but not their dependencies."? |
| 14:54 | ucb | technomancy: to replace "Libraries located under the..." in https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md |
| 14:56 | technomancy | maybe "not transitive" isn't clear enough |
| 14:57 | ucb | I understand transitive now that we've been through the dance. |
| 15:00 | technomancy | maybe this is better? https://github.com/technomancy/leiningen/commit/6e42ceea191ac80b86b7b270240dc1a6576bd651 |
| 15:02 | ucb | technomancy: that reads better; but there's still an edge case, i.e mine. I've a version of riemann in checkouts/ that hasn't been pushed. Even after puttin riemann in checkouts/ I can't put it in :dependencies because lein won't find it in clojars |
| 15:03 | technomancy | ucb: that's completely unrelated to checkouts though |
| 15:03 | tomoj | &(with-meta (constantly 42) {}) |
| 15:03 | lazybot | ⇒ #< clojure.lang.AFunction$1@6e6189> |
| 15:03 | technomancy | you can't put things in :dependencies that aren't in a repo ever |
| 15:04 | ucb | technomancy: sure, but I thought checkouts/ (somewhat) was my solution to my problem: I want to work on riemann as well as on my project. |
| 15:04 | amalloy | tomoj: http://dev.clojure.org/jira/browse/CLJ-908 is related |
| 15:04 | tomoj | thanks |
| 15:05 | ucb | technomancy: my point is, no matter how thick I may be, the description of checkouts/ seemed like a good fit for my problem. |
| 15:06 | technomancy | is it not? |
| 15:07 | ucb | well, no. I mean, it's half a solution. I don't want to list all of riemann's dependencies as dependencies of my top-level project |
| 15:07 | hiredman | but you shouldn't need to |
| 15:07 | technomancy | of course; it's supplementary |
| 15:08 | technomancy | that's the whole point |
| 15:08 | hiredman | if you have riemann as a dep you should get all its deps |
| 15:08 | amalloy | i get the impression his locally-modified version of riemann has different deps |
| 15:08 | ucb | hiredman: problem is that I'm using a version of riemann that hasn't been pushed to clojars |
| 15:08 | ucb | oh wait |
| 15:09 | ucb | I haven't changed the dependencies. Maybe I should see if there's a diff and instead depend on a published version of riemann |
| 15:09 | technomancy | the problem checkout dependencies solves is "I don't want to have to re-run `lein install` and restart my repl whenever the source changes" |
| 15:09 | hiredman | ucb: exactly |
| 15:09 | ucb | technomancy: indeed |
| 15:09 | hiredman | technomancy: codeveloment dependencies |
| 15:09 | ucb | hiredman: problem with that is that if I push my project anywhere, all of the sudden I'm depending on the wrong version of riemann |
| 15:10 | technomancy | doing the "install/restart" cycle when dependencies change is still necessary, and not nearly as annoying as having to do it all the time |
| 15:13 | augustl | do I have to use a singleton connection with korma? Or can I pass in a connection thingie to queries? |
| 15:14 | nDuff | augustl: I haven't used it in a while, but I thought korma used dynamic vars, no? |
| 15:15 | nDuff | augustl: ...so, you may not be passing them in with queries, but that's plenty of fine-grained control over which ones are used when. |
| 15:17 | augustl | nDuff: yeah if I can bind it that's more than good enough |
| 15:17 | augustl | nDuff: I like to mount my actual apps when testing them, singletons makes that tedious.. |
| 15:21 | augustl | ah, there's a with-db |
| 15:23 | andersf | augustl: leaving datomic? :) |
| 15:25 | nybbles | hey does anyone know how to paste a string into a repl so that quotes are escaped? i.e. i have a bunch of json that i want to paste into the repl |
| 15:25 | nybbles | something like the '''blah''' syntax in python |
| 15:27 | upgradingdave | hey all, I'm trying to wrap my brain around bound-fn and bound-fn*, trying to understand why bound-fn* doesn't seem to eval the function shown here: https://gist.github.com/4559296, any ideas? |
| 15:28 | nybbles | whoa.. holy crap, i just found out how |
| 15:29 | mpenet | technomancy: I am not sure it's still true, but I noticed something with checkouts: when doing lein jar/uberjar it won't take the code from the checkouts, but get it from the local repo. Is this by design (repeatability and all) ? |
| 15:29 | mpenet | gets* |
| 15:29 | technomancy | mpenet: yes, checkouts shouldn't influence downstream consumers |
| 15:30 | mpenet | right |
| 15:30 | augustl | andersf: nah, different project |
| 15:30 | ebaxt | I'm looking for a client-side router for ClojureScript. Found https://github.com/gf3/secretary, any other suggestions? |
| 15:30 | technomancy | so by design |
| 15:30 | augustl | andersf: two clojure projects at work now, w00t :) |
| 15:30 | llasram | upgradingdave: bound-fn/* return *functions* |
| 15:30 | mpenet | ebaxt: snout |
| 15:31 | mpenet | I didn't use it but I know some people who do and seem happy with it. |
| 15:32 | ebaxt | mpenet: thx! |
| 15:32 | ebaxt | augustl: Client project or internal? :) |
| 15:34 | no7hing | thanks, i was about to ask about the cljs router lib too |
| 15:35 | upgradingdave | llasram: ahhh, ok, I glanced at def for bound-fn* and saw the line (apply with-bindings* bindings f args). But now I see it returns a fn, thx |
| 15:35 | frozenlock | arrr! Interop will be the death of me... (`(.trigger component ~@args)) doesn't work, even if the compiler is ok with it... How can I have a method with variable number of args? |
| 15:35 | augustl | ebaxt: one internal-ish, one client |
| 15:36 | nDuff | frozenlock: Out of context of the enclosing defmacro, that doesn't look so insane to me. |
| 15:36 | biff_tannen | hey ... newbie user here trying to get acquainted with the language ... i just cloned this repo (https://github.com/briancarper/cow-blog) and am trying to follow the instructions ... theres a step that mentions a .clj file that i need to 'run' in order to create the db tables ... how exactly do i run a specific .clj file with lein (if lein is the right tool to use) ? |
| 15:36 | amalloy | frozenlock: the compiler is okay with it because it's valid code for constructing a list object and then calling it |
| 15:36 | frozenlock | (defn trigger |
| 15:36 | frozenlock | [component & args] |
| 15:36 | frozenlock | (`(.trigger component ~@args))) |
| 15:36 | frozenlock | |
| 15:36 | ebaxt | augustl: cool, *envy* |
| 15:36 | amalloy | nDuff: no, it's insane |
| 15:36 | nDuff | frozenlock: ...it's a defn, not a defmacro? Then that's seriously wrong. |
| 15:36 | llasram | frozenlock: `(. component trigger ~@args) |
| 15:37 | augustl | ebaxt: it's a bit painful atm though.. Doing SQL stuffs was a bit more work than I expected |
| 15:37 | amalloy | you guys are all crazy. you just can't do that to a special form like . at runtime; suggesting code to him that obviously won't work doesn't help a lot |
| 15:38 | llasram | Sorry -- I thought this was in the context of a macro |
| 15:38 | nDuff | amalloy: Was I suggesting other code? I'm pretty sure the only thing I asserted was that that was broken. |
| 15:38 | amalloy | frozenlock: the best you can do is (fn ([component] (.trigger component)) ([component x] (.trigger component x)) ...) |
| 15:38 | nDuff | (unless being done within a macro, in which case it's at compile time, in which case it's valid/legal) |
| 15:38 | frozenlock | amalloy: can I splice 'x'? |
| 15:39 | ebaxt | augustl: greenfield? |
| 15:39 | amalloy | nDuff: yes, i did a bad job of rebuking both of you at once |
| 15:39 | augustl | ebaxt: both are, yeah |
| 15:39 | augustl | aren't that many large clojure projects around in Norway :) |
| 15:39 | frozenlock | Oh, a different case for each number of arguments? |
| 15:40 | amalloy | (`(.trigger component ~@args)) is provably wrong whether in a macro or not, though, which was why i said you were crazy for saying it looked fine |
| 15:40 | ebaxt | augustl: Yes, no kidding. We need to fix that |
| 15:40 | andersf | augustl: what's the other one? |
| 15:40 | gf3 | ebaxt: I used secretary for a project, it could use some love but it works |
| 15:40 | gf3 | ebaxt: I mean, I wrote it to use in a project |
| 15:42 | ebaxt | gf3: Cool, I'll have a look. Any gotchas I should know about? |
| 15:42 | frozenlock | amalloy: It works (I'm sure you knew that :P), thank you very much. |
| 15:42 | gf3 | ebaxt: The param substitution supports many options but could be more robust, I think it has tests |
| 15:43 | augustl | andersf: husleie.no |
| 15:43 | gf3 | ebaxt: Secretary works well with Closure's hashchange stuff, that's how I used it |
| 15:43 | technomancy | biff_tannen: you should be able to use `lein run -m whatever.namespace` if it's set up properly |
| 15:45 | biff_tannen | technomancy ok, i'll try that ... i was also trying to run it via REPL, but i can't figure out how to include the local file structure |
| 15:45 | gf3 | ebaxt: Here's a code fragment lifted from the project (note: There are things in there you don't need) → https://gist.github.com/fd8c8a4ec16d0ff35ffb |
| 15:46 | ebaxt | gf3: thx! |
| 15:48 | gf3 | ebaxt: NP, updated gist |
| 15:56 | upgradingdave | hmmm, I'm still not fully understanding bound-fn...not sure why this dosn't use the "different" binding. Thanks again in advance your help, driving crazy all day ... my brain hurts...https://gist.github.com/4559296 |
| 15:57 | llasram | upgradingdave: lazy seqs again |
| 15:58 | upgradingdave | doh, so I guess bound-fn has to be wrapped around the for? |
| 15:58 | upgradingdave | and then map apply to the resulting lazy-seq of fn's? |
| 16:01 | llasram | upgradingdave: So functions created with bound-fn will restore dynamic var bindings visible when the function is defined, but only within the scope of the function's execution |
| 16:01 | llasram | upgradingdave: A lazy seq which is realized in a different dynamic scope sees the values at the point where realization occurs |
| 16:02 | amalloy | the point is more that it will restore only dynamic var bindings that were in place when the function was defined |
| 16:02 | amalloy | here, no dynamic bindings were in place when bound-fn was called |
| 16:02 | amalloy | the seq of bound-fns is not realized until after the binding exits |
| 16:02 | llasram | Oh, that too :-) |
| 16:04 | upgradingdave | I think it'll take me a while to digest that, but very helpful, thx |
| 16:05 | pbostrom | hey y'all, I've been working on a little side project, a shared, web-based REPL, I was wondering if anyone is interested in checking it out, I'm mostly just curious if it will actually work: http://cwo.io |
| 16:05 | skelternet | just tried (doc doc) |
| 16:06 | saolsen | neat |
| 16:06 | frozenlock | pbostrom: really nice! |
| 16:06 | skelternet | I guess I was in the home repl |
| 16:07 | saolsen | backspace isn't working in the repl |
| 16:07 | kovas | nice |
| 16:07 | kovas | pbostrom: I'm working on a similar project, https://github.com/kovasb/session, if you are interested in collaborating |
| 16:08 | saolsen | so can you not type in other peoples repls? |
| 16:08 | pbostrom | kovas: yeah, I saw that a few days ago, it gave me some motivation to polish mine up a little bit |
| 16:09 | kovas | cool. well now I'm motivated as well :) |
| 16:09 | pbostrom | kovas: I will check it out, still working on getting mine put up on github |
| 16:09 | saolsen | very neat |
| 16:09 | kovas | what did u do the front end in? |
| 16:11 | pbostrom | kovas: it's cljs with jquery and bootstrap |
| 16:11 | pbostrom | saolsen: you can only type in someone else's repl if they transfer to you |
| 16:12 | saolsen | pbostrom: oh cool, I see that now |
| 16:13 | pbostrom | saolsen: I did include core.logic, but that's one of the few non-core libs |
| 16:13 | pbostrom | oops, maybe not |
| 16:14 | pbostrom | anyway, thanks for humoring me, I'll try not to take up too much more of the chat with this |
| 16:14 | frozenlock | pbostrom: really really nice. |
| 16:14 | kovas | is the repo clojailed? |
| 16:14 | kovas | repl |
| 16:14 | pbostrom | yes, clojail |
| 16:15 | frozenlock | Is it possible to simultaneously connect to a repl with emacs/vim? |
| 16:15 | frozenlock | I might be pushing it here... :P |
| 16:16 | saolsen | if it uses nrepl that doesn't sound too crazy |
| 16:16 | ebaxt | kovas: do you have a demo site of session? |
| 16:16 | pbostrom | no, the editing experience was the thing I spent the least amount of time on |
| 16:17 | kovas | ebaxt: i haven't set up a clojailed version, so not yet |
| 16:17 | pbostrom | I'm going to look into trying to swap in nrepl at some point |
| 16:17 | kovas | it should be pretty simple to just clone the repo and run the 2 commands |
| 16:44 | devn | yogthos: Is it possible to run the luminus template on top of an existing project? |
| 16:45 | devn | Sort of like rails generators where it would prompt you if there are conflicts? |
| 16:54 | S11001001 | devn: you've been storing your project in a version control system? |
| 16:55 | Sgeo_ | Monticello totally counts as a good version control system, right? |
| 16:57 | amalloy | monticello sounds more like a font |
| 16:57 | S11001001 | I follow this lovely process, which works even if the template system is "here's the base template set, edit these files to do stuff" |
| 16:57 | S11001001 | 1. go back to when you checked in the pure template |
| 16:57 | Sgeo_ | It's a version control system for Smalltalk |
| 16:58 | S11001001 | 2. make a rev on top of that with the new template/paster/whatever |
| 16:58 | S11001001 | 3. merge that into your project |
| 16:58 | devn | Monaco is a better name for a version control system |
| 16:58 | S11001001 | your VC is better at managing conflict resolution anyway |
| 16:58 | devn | gambling! |
| 16:58 | Sgeo_ | Convenient enough to use that I'm actually likely to use it for stuff! |
| 16:58 | devn | maybe you get that commit history... maybe you don't... lay your cards on the table |
| 16:59 | devn | S11001001: yeah i can do it by hand. it's more of a feature request |
| 16:59 | S11001001 | I'm suggesting it's an antifeature |
| 16:59 | devn | i dont think we're talking about the same thing |
| 16:59 | S11001001 | because, whereas the VC records the history of the relationship between the template and your changes |
| 16:59 | S11001001 | a paster's resolution doesn't |
| 16:59 | S11001001 | maybe not |
| 17:01 | devn | S11001001: i would like to have a command line "lein add-luminus" which initializes the files for a base luminus project, and if i dont have any conflicts, it just gives me those files and adds deps to my project.clj |
| 17:02 | devn | if there are conflicts, it says: "do you want to overwrite, quit, get a diff, edit, or continue without action" |
| 17:03 | devn | i routinely have a clojure thingy ive been playing with that ive built from the bottom up. that's how most of my clojure projects go. I start with some data manipulation stuff and do some interesting stuff, and then i want to give it a simple web interface |
| 17:03 | devn | it would be nice to just say "sudo give me a working web stack" |
| 17:04 | hyPiRion | gem install hairball |
| 17:04 | devn | the only conflicts i would have had in my current project are: project.clj and src/myproject/util.clj |
| 17:04 | devn | hyPiRion: that's hyperbolic |
| 17:05 | devn | you go to your project.clj and add a dep and run lein deps, did you just "lein get hairball"? |
| 17:06 | devn | hyPiRion: there's nothing wrong with making something easy at the expense of flexibility if you don't give a damn |
| 17:06 | devn | i reserve the right to piss all over my personal projects |
| 17:11 | hyPiRion | devn: what? I was referring to http://www.youtube.com/watch?v=rI8tNMsozo0#t=947s |
| 17:13 | devn | hyPiRion: i think we probably agree with the "simple ain't easy" stuff, but i think what you sort of are doing by parroting that quote in this context is suggesting that i didn't think about ease vs simplicity. i have, and i want something easy in this case. i don't think that's a crime. |
| 17:15 | devn | correct me if im wrong, but i think people need to relax a bit and say: "hm, yeah, i see what you did there. you composed some very common libraries into a template and wrote some boilerplate. thank you. now, i'd like to drop it all into my project." |
| 17:24 | devn | it's the same thing clojure the language does: it's pragmatic about side effects. it steers you away from them, but it doesn't say "absolutely not". stuart halloway once called clojure a "consenting adults language". as a community i think we should try to steer people away from making a mess, but no one should be given the snide "gem install hairball" if they're conscious of the tradeoffs and decide that whatever tradeoffs may exist are orthogonal to the ... |
| 17:25 | devn | ... problem they're fundamentally trying to solve. |
| 17:25 | devn | hyPiRion: do you think that's wrong? |
| 17:28 | devn | in this case: I have a bunch of code that has nothing to do with building a website. i just want a quick way to get some boilerplate and common dependencies so I can type a command and go home. there's nothing "hairball" about that. |
| 17:28 | frozenlock | I'm once again confused by cljs interop... (this-as this (set! (.-field this) value)) works, but this doesn't: (this-as this (set! (. this field-name) value)) |
| 17:29 | nDuff | ...right -- because (. this field-name) is an invocation, not a property reference. IIRC. |
| 17:30 | amalloy | frozenlock: (. this -field-name) would be equivalent |
| 17:31 | frozenlock | Hmm... is there another way to access the field? I have the field name as a string. (symbol (str "-" field-name)) makes me feel dirty inside. |
| 17:34 | piranha | frozenlock: (aset this field-name value) |
| 17:35 | AimHere | Every time I have to change symbols and/or keywords by converting to str and then modding and converting back, I have to take a cold shower |
| 17:35 | piranha | if I understood correctly |
| 17:36 | frozenlock | piranha: Well at least the repl didn't choke on it. Let me see if it works. |
| 17:37 | piranha | frozenlock: ah well, read your messages properly - yes, this is exactly what you need for cljs (didn't notice 'cljs' mentioned) |
| 17:41 | frozenlock | piranha: Seems like it, thank you very much :) |
| 17:46 | seangrove | If I have a function that uses keywords, can I pass a map to it and have it destructured? |
| 17:47 | seangrove | (defn open-popup [& {:keys [oauth-url base-url]}] ...) and calling it with (open-popup {:oauth-url "x"}) |
| 17:48 | bbloom | ,(apply (fn [& {:keys [x y]}] [x y]) (apply concat {:x 1 :y 2})) |
| 17:48 | frozenlock | Yes, but if you use &, you'll need to put your {:keys ...} in a vector IIRC. |
| 17:48 | clojurebot | [1 2] |
| 17:48 | bbloom | that's the best i've got :-) |
| 17:48 | amalloy | ~mapply |
| 17:48 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 17:48 | seangrove | wow, looks gnarly |
| 17:48 | amalloy | yes, it's ugly because it's bad |
| 17:48 | bbloom | i generally don't like keyword functions |
| 17:48 | amalloy | & {:keys ...} just leads to pain eventually |
| 17:48 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: ... in this context |
| 17:49 | seangrove | Why's that? |
| 17:49 | amalloy | because it makes the function near-impossible to apply |
| 17:49 | frozenlock | Really? I find it really convenient to pass arguments around. |
| 17:49 | seangrove | Ah, I see |
| 17:49 | bbloom | it's optimizing for usage over composition |
| 17:49 | hiredman | and, I mean, what else are you going to do with a function besides apply it? |
| 17:50 | hiredman | attach metadata to it? hah! |
| 17:50 | gfredericks | clojure/west ends rather early on wednesday...I guess not many people will be staying through the evening? |
| 17:51 | egghead | my flight out is wed. night |
| 17:51 | bbloom | i'm out early thursday morning |
| 17:54 | gfredericks | alright I'll do wednesday night |
| 17:56 | frozenlock | If you don't use keywords argument, do you limit your functions to 2-3 arguments? |
| 17:57 | amalloy | frozenlock: instead of (fn [& {:keys [a b c d e]}]), (fn [{:keys [a b c d e]}]) is just as "legible", and much more flexible |
| 17:58 | frozenlock | Oh I see, '&' is the problem. |
| 17:58 | bbloom | keyword arguments are only really useful for functions that are command-like |
| 17:59 | bbloom | which is pretty rare |
| 17:59 | bbloom | stuff you intend to use form the repl |
| 17:59 | bbloom | in that sense, they are like --flags |
| 18:03 | frozenlock | quote isn't defined in cljs? |
| 18:04 | bbloom | ,`quote |
| 18:04 | clojurebot | quote |
| 18:04 | bbloom | it's a special form, not a function or macro |
| 18:04 | bbloom | ,`not-quote |
| 18:04 | clojurebot | sandbox/not-quote |
| 18:10 | frozenlock | Oh my mistake, I just remembered there's some special incantation for macros in cljs. -_- |
| 18:48 | AtKaaZ | hi, how can I specify class type in a let form like ^ClassName or ^{:tag ClassName} when I want to (def ClassName java.io.File), is that even possible? |
| 18:49 | mattmoss | ,(let [cls java.io.File] cls) |
| 18:49 | clojurebot | java.io.File |
| 18:49 | AtKaaZ | I mean like this let [^String full-path "test"] |
| 18:49 | mattmoss | Ah... |
| 18:49 | mattmoss | Don't know that you can. |
| 18:49 | amalloy | no |
| 18:49 | AtKaaZ | aw :( |
| 18:50 | mattmoss | THIS IS NOT JAVA. lol |
| 18:50 | AtKaaZ | maybe I can use the c++ preprocessor |
| 18:50 | mattmoss | egads |
| 18:52 | TimMc | It would probably be possible to do this with a macro. |
| 18:53 | amalloy | TimMc: no |
| 18:53 | TimMc | Note that (not= could should). |
| 18:53 | amalloy | well, you could do it with a sufficiently aggressive macro, but such a thing would break a lot of other things |
| 18:53 | TimMc | :-) |
| 18:53 | AtKaaZ | so if I make the macro return ^java.io.File it would work? |
| 18:54 | TimMc | That's not a thing, so a macro can't return it. |
| 18:54 | AtKaaZ | oh right |
| 18:55 | cbp` | import-static wasn't migrated right? do i need to write it or is there a new import-static? |
| 18:55 | AtKaaZ | what macro preprocessors would you guys suggest? |
| 18:55 | Sgeo_ | Is there some weird metadata problem going on? |
| 18:56 | AtKaaZ | Sgeo_: i just want to be able to specify the class type in only one place in the (def cls java.io.File) for example |
| 18:56 | bbloom | what's icky about it? i've found it to be absurdly useful |
| 18:57 | hyPiRion | AtKaaZ: I'd recommend search-and-replace. |
| 18:58 | brehaut | bbloom: i think theres a noob trap where metadata applied with ^ (ie to forms) is primarily for the compiler/macros, and with-meta is what you want for runtime meta |
| 18:58 | AtKaaZ | hyPiRion, that's what I'm trying to avoid :) |
| 18:59 | bbloom | brehaut: that is definitely true |
| 18:59 | bbloom | AtKaaZ: what you want is the ability to create type aliases for use in hints, right? |
| 19:00 | AtKaaZ | bbloom: i think so |
| 19:00 | bbloom | that's a legitimate feature request. dunno if it's one that would ever be accepted, but it seems sensible |
| 19:00 | bbloom | i've wanted something similar for Clojure / ClojureScript hybrid projects |
| 19:00 | bbloom | the thing is that ^Foo and ^{:tag Foo} performs static class name resolution |
| 19:01 | bbloom | the issue is that metadata with ^ is evaluated at read time |
| 19:01 | AtKaaZ | I'm thinking of using m4 but does anyone know how I could integrate that with leiningen? something like preprocess the source before being fed to lein |
| 19:01 | bbloom | which is what brehaut was alluding to |
| 19:01 | AtKaaZ | it's static which I needed in my case |
| 19:03 | bbloom | i mean that it's looking up classes by name with a class loader |
| 19:03 | bbloom | it won't look at symbols local to your code |
| 19:03 | bbloom | and this occurs when the file is read, not when it's being compiled |
| 19:03 | hiredman | ,(meta (quote ^Foo foo)) |
| 19:03 | clojurebot | {:tag Foo} |
| 19:04 | hiredman | ,(type (:tag (meta (quote ^Foo foo)))) |
| 19:04 | clojurebot | clojure.lang.Symbol |
| 19:04 | bbloom | AtKaaZ: Why do you need a type alias anyway? maybe we can suggest an alternative? |
| 19:04 | AtKaaZ | bbloom: it's just for code structure really, ie. it's like stating that all those places where this symbol is used are meant to use the same class (where symbol would be the classname) |
| 19:05 | hyPiRion | hiredman: ##(let [^String foo "foo"] (meta foo)) |
| 19:05 | lazybot | ⇒ nil |
| 19:05 | bbloom | AtKaaZ: i think you're overthinking it :-P my suggestion: just don't do that |
| 19:05 | bbloom | problem solved! |
| 19:05 | AtKaaZ | well, you're right |
| 19:06 | hiredman | hyPiRion: you are looking at the metadata of the string "foo" there |
| 19:06 | bbloom | if you really want that, #haskell is over that way ---> |
| 19:06 | hiredman | there is no way to look at the meta of foo in that example out side of a macro |
| 19:06 | AtKaaZ | bbloom, I'll check, thanks |
| 19:07 | frozenlock | Omg noes!!! |
| 19:07 | bbloom | frozenlock: whoa whoa, that's 4 hyphens, you went way too far |
| 19:07 | arrdem | yeah that's #lisp |
| 19:07 | brehaut | frozenlock: i think you just saw #coq |
| 19:08 | technomancy | devn: I am interested in allowing `lein new` templates to run in existing projects |
| 19:08 | TimMc | cbp`: Does this work for you? https://github.com/baznex/imports |
| 19:13 | cbp` | thanks |
| 19:16 | TimMc | Let me know if there are any features you want. It was fun to work on, and I learned a hell of a lot about the compiler. |
| 19:39 | cbp` | will do |
| 19:47 | AtKaaZ | ok, haskell&co is not what I want... |
| 19:49 | Sgeo_ | AtKaaZ, what's wrong with Haskell? |
| 19:50 | ChongLi | haskell is a fantastic language |
| 19:50 | ChongLi | I just wish its standard library was as good as clojure's |
| 19:51 | ChongLi | particularly the sequences library and all the niceness of maps and sets |
| 19:52 | AtKaaZ | Sgeo_: nothing, I can even do that typing that I said above |
| 20:30 | bbloom | hmmm looks like fogus is up to something.... https://github.com/fogus/ariadne |
| 20:30 | technomancy | fogus is always up to something |
| 20:31 | Sgeo_ | o.O Smalltalky stuff! |
| 20:31 | Sgeo_ | "The oldest example is also the source for the name - the Smalltalk development environment. " |
| 20:31 | Sgeo_ | :D |
| 20:31 | bbloom | peeking through his reading list, it looks like he's putting together a rules engine on datomic |
| 20:32 | bbloom | which would be pretty cool :-) |
| 20:32 | AtKaaZ | what's that simulant thing? |
| 20:33 | bbloom | AtKaaZ: i think it's an integration testing framework that some relevance guys are working |
| 20:33 | bbloom | on |
| 20:33 | AtKaaZ | private github repo? since I can't find it |
| 20:34 | bbloom | i think they are planning on revealing it at clojure/west |
| 20:35 | technomancy | secret open source |
| 20:35 | technomancy | so weird |
| 20:36 | brehaut | everyone wants secret sauce |
| 20:42 | tomoj | http://clojurewest.org/sessions#halloway |
| 20:49 | frozenlock | tomoj: I really hope this will be recorded... |
| 21:11 | RazWelles_ | Is there a way to explore a library from clojure like is done with python's "dir"? I'm trying to view what's available in a dll I just loaded in clojureclr |
| 21:12 | bbloom | ,(ns-publics *ns*) |
| 21:12 | clojurebot | {} |
| 21:12 | skelternet | what all can clojurebot do? |
| 21:13 | RazWelles_ | I got empty brackets with that |
| 21:13 | bbloom | yeah that's your local namespaces' publics |
| 21:13 | RazWelles_ | ahh so I guess that means my load was a failure o.x |
| 21:13 | bbloom | no |
| 21:13 | bbloom | that's your local namespace, not what's imported |
| 21:14 | RazWelles_ | How would I investigate what's imported? |
| 21:14 | bbloom | try (find-doc "clojure.core/") |
| 21:14 | ivan | ,(ns-publics 'clojure.core) |
| 21:14 | clojurebot | {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, ...} |
| 21:15 | bbloom | RazWelles_: yeah, what ivan said :-) |
| 21:15 | RazWelles_ | ok trying that :) |
| 21:15 | bbloom | and then you can do: |
| 21:15 | bbloom | (doc sorted-map) |
| 21:15 | clojurebot | "([& keyvals]); keyval => key val Returns a new sorted map with supplied mappings." |
| 21:15 | bbloom | for example |
| 21:16 | ivan | it took me a while to figure out that I should just pass a symbol into that function |
| 21:16 | ivan | super-obvious to everyone else, I'm sure |
| 21:16 | bbloom | ivan: not at all, i was just mucking with it lol |
| 21:16 | bbloom | really should be documented better :-P |
| 21:17 | AtKaaZ | is there a one liner that I can put at the beginning of a file to prevent anything below from getting executed/compiled/loaded ? |
| 21:18 | bbloom | (comment .............. ) |
| 21:18 | bbloom | so a two liner |
| 21:18 | amalloy | (throw (Exception.)) |
| 21:18 | bbloom | you need to give it the ending ) |
| 21:18 | bbloom | amalloy: lol |
| 21:18 | brehaut | (inc amalloy) |
| 21:18 | lazybot | ⇒ 41 |
| 21:18 | amalloy | (/ 1 0) |
| 21:18 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: Divide by zero> |
| 21:18 | AtKaaZ | I need it to be ignored, for some reason midje loads all |
| 21:19 | AtKaaZ | I think I'm stuck with the two liner then? thanks |
| 21:25 | gfredericks | (alter-var-root #'read (-> nil constantly constantly)) |
| 21:27 | AtKaaZ | infinite loop? |
| 21:27 | gfredericks | haha that's a funny one to try at the repl |
| 21:27 | frozenlock | cljs: "WARNING - dangerous use of this in static method envision_cljs.timeseries var this$ = this;" Is this warning always present when one uses `this-as', or am I doing something wrong? |
| 21:27 | gfredericks | AtKaaZ: I have no idea about the implications :P |
| 21:28 | AtKaaZ | gfredericks: what is it supposed to do in non-repl? |
| 21:29 | gfredericks | AtKaaZ: bork everything |
| 21:29 | gfredericks | AtKaaZ: it was supposed to be a crazy-hilarious knee-slapper. do not try this at home more than several times. |
| 21:30 | skelternet | would be cruel to slip that in someone else's code |
| 21:30 | AtKaaZ | restarting eclipse... :D |
| 21:31 | skelternet | I had a colleague who redefined the value of 0 in an early version of FORTRAN |
| 21:32 | gfredericks | woah this gives me crazy ideas |
| 21:33 | frozenlock | gfredericks: Like trying it on clojurebot? |
| 21:34 | gfredericks | ,(alter-var-root #'read (partial comp #(if (integer? %) (inc %) %))) |
| 21:34 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 21:35 | gfredericks | huh |
| 21:35 | gfredericks | (+ 1 2) returns 3 while 0 returns 2 |
| 21:35 | clojurebot | *suffusion of yellow* |
| 21:35 | ivan | bug report: nREPL does not recover from (alter-var-root #'read pr) |
| 21:36 | frozenlock | I never tried to run a repl on top of the repl in clj. (I did once in CL for the heck of it) |
| 21:36 | frozenlock | Literally: read eval print loop |
| 21:39 | AtKaaZ | did anyone do something with 3D and clojure's AST? |
| 22:17 | AtKaaZ | did anyone try to write clojure code in java? via like RT class, where can I find docs about this? |
| 22:18 | brehaut | lol docs |
| 22:19 | AtKaaZ | tutorial? :) |
| 22:19 | nonuby | newbie, i have a json file (which I have no control over), I load it in via load-blob fn so now i have a hash map, i need to make several changes to do so i have another fn called transform-json, i have a series of assoc-in that I chain together via -> to get the return transformation, presumably this isnt very pragmatic? |
| 22:19 | AtKaaZ | well I mean, I could read the clojure code, |
| 22:19 | brehaut | AtKaaZ: you basically want to look at the interface for RT.var and Var.invoke i belive |
| 22:20 | brehaut | yup, thats it |
| 22:20 | AtKaaZ | k thx |
| 22:20 | brehaut | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L331-L333 |
| 22:20 | brehaut | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L410-L529 |
| 22:21 | brehaut | AtKaaZ: ^ |
| 22:21 | frozenlock | pbostrom: Is your repl project OSS? |
| 22:21 | AtKaaZ | brehaut: what are the invokes supposed to do |
| 22:22 | brehaut | AtKaaZ: invoke the function int he var for different arities |
| 22:22 | AtKaaZ | brehaut, I should look up what a var is |
| 22:22 | brehaut | AtKaaZ: a var is a thing in a namespace |
| 22:23 | AtKaaZ | brehaut: like the most elemental thing is a var? ie. a symbol is a var? |
| 22:23 | brehaut | so clojure.core has a big old bag of vars, such as symbol, let, conj, defn, list, map, filter, vector, vec etc etc |
| 22:23 | brehaut | no, a symbol refers to something that may be a var |
| 22:23 | AtKaaZ | oh |
| 22:24 | brehaut | symbols tpyically refer to either lexical values (locals, arguments etc) or to namespace Vars |
| 22:24 | pbostrom | frozenlock: I have it in a private repository at the moment, but I can put it out on github if you want to take a look at it |
| 22:24 | brehaut | Vars are defined with def and friends |
| 22:24 | AtKaaZ | right, cool |
| 22:25 | frozenlock | pbostrom: I would really like to :) |
| 22:25 | brehaut | AtKaaZ: http://clojure.org/vars |
| 22:25 | xumingmingv | brehaut: is there a way to get the var for a object(function, macro) dynamicly? |
| 22:25 | brehaut | xumingmingv: RT.var |
| 22:26 | brehaut | xumingmingv: unless you want to get the var by the thing it points to, in which case probably not |
| 22:26 | xumingmingv | I know (var xxx), but it seems checks whether xxx exists statically |
| 22:26 | pbostrom | frozenlock: ok, give me a sec, just a warning, it might not follow a lot of the best practices that some of the experienced clojure devs might recommend |
| 22:26 | brehaut | xumingmingv: (var (symbol "foo")) ? |
| 22:26 | AtKaaZ | brehaut, thanks, that's what I want to read |
| 22:26 | brehaut | ,(var (symbol "inc")) |
| 22:27 | clojurebot | #<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)> |
| 22:27 | brehaut | hah no |
| 22:27 | brehaut | looks like var is a macro |
| 22:27 | xumingmingv | var is a special form |
| 22:27 | brehaut | oh. special form |
| 22:28 | xumingmingv | resolve might be the trick |
| 22:28 | brehaut | ,(clojure.lang.RT/var "clojure.core" "inc") |
| 22:28 | clojurebot | #'clojure.core/inc |
| 22:28 | brehaut | yeah resolve works |
| 22:28 | xumingmingv | but then the question is how to get the symbol for a object (function or macro) |
| 22:29 | brehaut | due to the potential *:1 relationship between vars and an object, that seems difficult |
| 22:29 | aperiodic | i'd imagine that you can't do it at all for macros, since you can't use them as values |
| 22:29 | brehaut | xumingmingv: anyway, why do you need the var if you have the thing it refers to |
| 22:29 | xumingmingv | Acutally I want to check its metadata |
| 22:29 | AtKaaZ | a macro is a var though right? |
| 22:30 | xumingmingv | macro IS a var |
| 22:30 | brehaut | ,macro |
| 22:30 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: macro in this context, compiling:(NO_SOURCE_PATH:0)> |
| 22:30 | brehaut | no its not :P |
| 22:30 | xumingmingv | to check its metadata, i need its var |
| 22:30 | AtKaaZ | I meant, a defined macro |
| 22:30 | aperiodic | ,-> |
| 22:30 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/->, compiling:(NO_SOURCE_PATH:0)> |
| 22:31 | aperiodic | ,(var '->) |
| 22:31 | clojurebot | #<CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0)> |
| 22:31 | AtKaaZ | I remember it has meta |
| 22:31 | brehaut | AtKaaZ: yes, a macro is referenced by a var, but you cant get the value for it |
| 22:31 | AtKaaZ | brehaut: what do you mean by value? |
| 22:31 | skelternet | ,(class '->) |
| 22:31 | clojurebot | clojure.lang.Symbol |
| 22:31 | brehaut | ,when |
| 22:31 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/when, compiling:(NO_SOURCE_PATH:0)> |
| 22:31 | AtKaaZ | oh that? |
| 22:31 | skelternet | ,(class ->) |
| 22:31 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/->, compiling:(NO_SOURCE_PATH:0)> |
| 22:31 | brehaut | AtKaaZ: something you can get hold of |
| 22:31 | aperiodic | something you can pass to functions |
| 22:32 | AtKaaZ | can pass the var I guess |
| 22:32 | brehaut | ,#'when |
| 22:32 | clojurebot | #'clojure.core/when |
| 22:32 | brehaut | but im not sure what use that is |
| 22:33 | AtKaaZ | like to check if the symbol is a macro maybe |
| 22:33 | brehaut | macros are (effectively) installed into the compiler |
| 22:33 | AtKaaZ | are macros in the AST? |
| 22:33 | brehaut | sure |
| 22:33 | AtKaaZ | awesome |
| 22:33 | brehaut | er, sure checking meta data |
| 22:33 | AtKaaZ | ah |
| 22:33 | brehaut | no idea about AST |
| 22:34 | AtKaaZ | still trying to understand things... |
| 22:34 | brehaut | im not sure what clojure does with ASTs (if any) |
| 22:34 | xumingmingv | brehaut: yeah, I want to check function/macro's metadata, so I need its corresponding var. |
| 22:35 | brehaut | xumingmingv: i suspect you may need to exhaustively search all the namespaces? |
| 22:35 | xumingmingv | until find the var? |
| 22:35 | brehaut | indeed |
| 22:36 | brehaut | functions dont hold back references to their vars |
| 22:36 | brehaut | and many functions dont have vars |
| 22:36 | frozenlock | pbostrom: you weren't here to see me ask dumb question this afternoon... :P |
| 22:36 | AtKaaZ | I've something related to that: https://github.com/DeMLinkS/demlinks/blob/master/src/runtime/util.clj#L15 |
| 22:36 | brehaut | AtKaaZ: a lisp style crime has been commited by that code |
| 22:36 | brehaut | ~style |
| 22:37 | clojurebot | style is http://mumble.net/~campbell/scheme/style.txt |
| 22:37 | AtKaaZ | ok, checking |
| 22:37 | brehaut | hanging parens are nasty |
| 22:37 | xumingmingv | brehaut: thanks! |
| 22:37 | brehaut | xumingmingv: i do wonder if you arent going about things in an arse about face way |
| 22:37 | AtKaaZ | I'll make a mental note to either fix my style or prevent my code from being seen |
| 22:37 | brehaut | fix your style |
| 22:38 | frozenlock | The parens! What happened to them?! |
| 22:40 | brehaut | frozenlock: i think they may have been drugged. they look all spun out |
| 22:40 | AtKaaZ | lol brokets |
| 22:40 | frozenlock | lein do? |
| 22:40 | AtKaaZ | in lein2 only |
| 22:40 | gfredericks | lein do! |
| 22:41 | brehaut | lein do‽ |
| 22:41 | gfredericks | ~brehaut |
| 22:41 | clojurebot | brehaut: I think struct embedding is monkey patching / mixins, and interface embedding is duck typing / typeclasses |
| 22:41 | AtKaaZ | lein do clean, install vs lein1 clean, install |
| 22:41 | brehaut | seriously what the hell clojurebot |
| 22:41 | gfredericks | clojurebot: brehaut is ‽ |
| 22:41 | clojurebot | Ik begrijp |
| 22:42 | brehaut | ~clojurebot |
| 22:42 | clojurebot | clojurebot is amazing |
| 22:42 | gfredericks | ~brehaut |
| 22:42 | brehaut | ~lazybot |
| 22:42 | clojurebot | brehaut is ‽ |
| 22:42 | clojurebot | It's greek to me. |
| 22:42 | xumingmingv | ~clojurebot |
| 22:42 | clojurebot | clojurebot will become skynet |
| 22:42 | gfredericks | clojurebot: forget brehaut is ‽ |
| 22:42 | clojurebot | In Ordnung |
| 22:42 | xumingmingv | ~lazybot? |
| 22:42 | clojurebot | Huh? |
| 22:42 | gfredericks | clojurebot: brehaut is <reply> ‽ |
| 22:42 | clojurebot | You don't have to tell me twice. |
| 22:42 | gfredericks | ~brehaut |
| 22:42 | AtKaaZ | gfredericks your ? is odd |
| 22:42 | clojurebot | ‽ |
| 22:43 | frozenlock | gfredericks: Thanks for that, I would have continued to do 'lein clean' 'lein whatever' for a long time... |
| 22:43 | brehaut | AtKaaZ: Interrobang! |
| 22:43 | AtKaaZ | brehaut: oh i get it :) |
| 22:43 | gfredericks | frozenlock: ANYTIME |
| 22:43 | mattmoss | ~c++ |
| 22:43 | clojurebot | ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an")) )] (testar 10 25)) |
| 22:44 | mattmoss | !? |
| 22:44 | clojurebot | CLABANGO! |
| 22:45 | mattmoss | ~? |
| 22:45 | clojurebot | Pardon? |
| 22:45 | amalloy | gfredericks: your "forget" surely just made things worse |
| 22:45 | amalloy | now he's learned what "forget brehaut" means |
| 22:46 | pbostrom | frozenlock: I only give the warning so you might avoid picking up any of my bad habits. Here it is, use at your own risk https://github.com/pbostrom/cwo-public |
| 22:47 | gfredericks | amalloy: I'm not sure I'd say that's "worse" |
| 22:47 | gfredericks | perhaps "richer" |
| 22:47 | gfredericks | clojurebot: forget brehaut? |
| 22:47 | clojurebot | forget brehaut is ‽ |
| 22:47 | gfredericks | (inc clojurebot) |
| 22:47 | lazybot | ⇒ 14 |
| 22:47 | amalloy | clojurebot: gfredericks is polluting your memory and must be destroyed |
| 22:47 | clojurebot | Ik begrijp |
| 22:48 | gfredericks | why would alter-var-root hang? |
| 22:49 | frozenlock | pbostrom: thank you very much! Do you intend to use this repo, or was it only for me? |
| 22:50 | gfredericks | oh that's why |
| 22:51 | AtKaaZ | brehaut: I'm currently hoping for a third variant, code clojure in java directly |
| 22:51 | pbostrom | frozenlock: I might push out bug fixes, and any new features if I get some time to work on it |
| 22:51 | AtKaaZ | this way maybe I also have refactoring |
| 22:51 | brehaut | AtKaaZ: that sounds like a recipe for sadness |
| 22:52 | brehaut | AtKaaZ: im pretty sure Object defeats IDE refactorings |
| 22:52 | djwonk | ⇒ 14 |
| 22:55 | brehaut | AtKaaZ: at least, thats the only interpretation of 'have refactoring' that you sensibly could mean. |
| 22:55 | brehaut | AtKaaZ: because of course you can refactor clojure code |
| 22:55 | mattmoss | &(*)/(+) |
| 22:55 | lazybot | ⇒ 1 |
| 22:55 | AtKaaZ | brehaut: I'm using eclipse+ccw |
| 22:56 | mattmoss | uhhh |
| 22:56 | mattmoss | &1/0 |
| 22:56 | lazybot | java.lang.ArithmeticException: Divide by zero |
| 22:56 | mattmoss | &(+) |
| 22:56 | lazybot | ⇒ 0 |
| 22:56 | AtKaaZ | lol |
| 22:56 | mattmoss | &(*) |
| 22:56 | lazybot | ⇒ 1 |
| 22:56 | brehaut | mattmoss: literal ratios only apply to numbers |
| 22:57 | mattmoss | brehaut: Sure, but I didn't get a ratio for 1/0, I got an exception. |
| 22:57 | brehaut | ,'[(*)/(+)] |
| 22:57 | clojurebot | [(*) / (+)] |
| 22:57 | brehaut | ,[(*)/(+)] |
| 22:57 | clojurebot | [1 #<core$_SLASH_ clojure.core$_SLASH_@43495829> 0] |
| 22:57 | mattmoss | & (*) / (+) |
| 22:57 | lazybot | ⇒ 1 |
| 22:57 | mattmoss | So why do I get 1? |
| 22:57 | brehaut | mattmoss: because lazy bot is returning the result of the first expression |
| 22:58 | AtKaaZ | nice1 |
| 22:58 | mattmoss | lazybot is lazy |
| 22:58 | mattmoss | &((*) / (+)) |
| 22:58 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 22:58 | mattmoss | doh, i'm stupid |
| 22:58 | brehaut | mattmoss: well, what you told it to evaluate wasnt really an expression |
| 22:59 | tmciver | &(/ (*) (+)) |
| 22:59 | lazybot | java.lang.ArithmeticException: Divide by zero |
| 22:59 | mattmoss | Thanks, brain failure. |
| 22:59 | gfredericks | &'[(*)/(+)] |
| 22:59 | lazybot | ⇒ [(*) / (+)] |
| 22:59 | skelternet | is the ampersand a clojure thing or a clojurebot thing? |
| 22:59 | mattmoss | This is what happens when I write C++ and Clojure on alternate days. |
| 23:00 | brehaut | skelternet: lazybot evaluation |
| 23:00 | tmciver | skelternet: neither: it's a lazybot thing. :) |
| 23:00 | tmciver | ha |
| 23:00 | skelternet | (goes to google lazybot and clojurebot) |
| 23:02 | amalloy | they're right here, man. ask them yourself |
| 23:02 | skelternet | didn't want to spam the group, but ok |
| 23:02 | skelternet | lazybot help |
| 23:02 | amalloy | this channel is nothing but comical noise of people toying with the bots |
| 23:02 | amalloy | but i won't leave you stranded: |
| 23:02 | amalloy | $whatis source |
| 23:02 | amalloy | ~source |
| 23:02 | lazybot | source is http://github.com/flatland/lazybot |
| 23:02 | clojurebot | source is http://github.com/hiredman/clojurebot/tree/master |
| 23:03 | skelternet | I have it on audio with Adium |
| 23:03 | skelternet | sometimes the snarkiness is actually pretty good comedy |
| 23:04 | brehaut | amalloy: what about they imprecise answers to questions! |
| 23:06 | skelternet | $help |
| 23:06 | lazybot | You're going to need to tell me what you want help with. |
| 23:07 | skelternet | $find-fn mysql-server |
| 23:07 | skelternet | $find defpallet |
| 23:09 | xeqi | $find-fn 1 1 2 |
| 23:09 | brehaut | skelternet: i think you are thinking of apropos or find-doc |
| 23:09 | brehaut | ,(apropos 'part) |
| 23:09 | clojurebot | (partition-by partition-all partial partition) |
| 23:10 | skelternet | find-fn may not be installed: https://github.com/flatland/lazybot/compare/544566f7ee740731ca69...da4fcae5f3afe6cc9e6c, for finding the clojure function you're looking for, by https://github.com/jColeChanged |
| 23:11 | skelternet | $help find-fn |
| 23:11 | lazybot | Topic: "find-fn" doesn't exist! |
| 23:13 | xeqi | $findfn 1 1 2 |
| 23:13 | xeqi | no - in it |
| 23:13 | lazybot | [clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int clojure.core/bit-shift-left] |
| 23:13 | skelternet | $findfn defpallet |
| 23:13 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: defpallet in this context, compiling:(NO_SOURCE_PATH:0) |
| 23:14 | skelternet | $findfn 'defpallet |
| 23:14 | lazybot | [] |
| 23:14 | skelternet | Not really expecting it, but thought it would be worth a try |
| 23:16 | skelternet | clojurebot: source comp |
| 23:17 | skelternet | that could be pretty useful |
| 23:22 | skelternet | $fcst 78620 |
| 23:23 | skelternet | $rwhatis |
| 23:23 | lazybot | matrix is everywhere. It is all around us. Even now, in this very room. You can see it when you look out your window or when you turn on your television. You can feel it when you go to work... when you go to church... when you pay your taxes. It is the world that has been pulled over your eyes to blind you from the truth. That you are a slave, Neo. Like everyone else you were born into bondage. Born into a prison that you cannot smel |
| 23:25 | skelternet | $help fcst |
| 23:25 | lazybot | Topic: "fcst" doesn't exist! |
| 23:32 | xumingmingv | ~clojurebot |
| 23:32 | clojurebot | clojurebot is amazing |
| 23:32 | xeqi | ~lazybot |
| 23:32 | clojurebot | Cool story bro. |
| 23:32 | metellus | ~clojurebot |
| 23:32 | clojurebot | clojurebot is not very good at indicating the difference between a return value and an exception |
| 23:46 | luxbock | I'm doing the 4Clojure problem #56: http://www.4clojure.com/problem/56#prob-title |
| 23:47 | luxbock | my solution is #(keys (group-by identity %)), but it fails the last test |
| 23:47 | luxbock | yet REPL tells me: |
| 23:47 | luxbock | user> (= (keys (group-by identity (range 15))) (range 15)) |
| 23:47 | luxbock | true |
| 23:47 | luxbock | why is that? |
| 23:48 | luxbock | (doc distinct) |
| 23:48 | clojurebot | "([coll]); Returns a lazy sequence of the elements of coll with duplicates removed" |
| 23:48 | luxbock | err ops |
| 23:53 | handojin | question... |
| 23:53 | cbp` | luxbock: hashmaps don't have an specified order for keys |
| 23:54 | luxbock | ahhh right |
| 23:54 | handojin | anyone know offhand how to start server from a luminus project from eclipse/counterclockwise |