2013-03-18
| 00:36 | ambrosebs | jonasen: wow termito looks sweet! |
| 00:36 | ambrosebs | Can it handle global scope? |
| 00:56 | jonasen | ambrosebs: what do you mean? |
| 00:57 | ambrosebs | jonasen: Do we have the usual issues with assuming + means clojure.core/+? |
| 00:59 | jonasen | ambrosebs: defrules uses bblooms backtick so it doesn't ns expand symbols. But it could just as well use clojures syntax quote |
| 01:00 | ambrosebs | jonasen: You'd usually be running termito on fully macroexpanded/qualified forms though right? It would get pretty unpredictable otherwise. |
| 01:00 | jonasen | ambrosebs: depends entirely on the use case. |
| 01:01 | ambrosebs | jonasen: ok. I don't understand why you wouldn't want a fully macroexpanded form. |
| 01:02 | ambrosebs | or when, rather. |
| 01:02 | jonasen | ambrosebs: maybe your usecase is not transforming clojure code but e.g. hiccup data structures or something similar |
| 01:02 | ambrosebs | jonasen: ok, got it. |
| 01:03 | jonasen | ambrosebs: think EDN and not Clojure :) |
| 01:03 | ambrosebs | so termito is general enough not to care :) |
| 01:04 | ambrosebs | My immediate thought was to use jvm.tools.analyzer and use emit-form to convert an AST to a form to play with. |
| 01:10 | tomoj | whoa, I hadn't noticed emit-form |
| 01:43 | muhoo | ok, so wait. if i'm using a pooled data source, do i have to do this with-query-results and doall nonsense? can i have queries which return actual lazy sequences? |
| 01:44 | muhoo | my understanding is that the reason you have to doall is because by the time the with-connection + with-query-results returns, the connection might be closed. if it's a persistent connection though... |
| 01:56 | ambrosebs | tomoj: hehe emit-form is pretty cool |
| 02:13 | tomoj | I suppose tying the knot between an inner destructuring binding and its root bindings' expr is.. just not clojurey :( |
| 02:13 | tomoj | s/s'/'s/ |
| 02:15 | ambrosebs | tomoj: is this to track where a particular destructuring originated from? |
| 02:18 | tomoj | (let [[_ & rest] (cons 1 (lazy-seq rest))] ...), in spirit |
| 02:26 | muhoo | um, where is the edn reader? (require 'clojure.edn) fails, and this is on 1.5.1 |
| 02:26 | Raynes | I thought tools.reader was the only edn reader |
| 02:27 | Raynes | Apparently I'm dumb though, so disregard me. |
| 02:28 | muhoo | aha, no. godddddaaaaaaaaammmmnnn dependency hell. somehow my explicit including clojure 1.5.1 got ignored; it's still 1.4.0 :-/ |
| 02:29 | muhoo | lein deps :tree to the rescue |
| 02:34 | muhoo | Raynes: naw, it's joyful happy maven fun |
| 02:34 | muhoo | somehow [org.clojure/clojure "1.5.1"] means "just ignore this completely and use 1.4.0", and lein-pedantic has no problem with that either |
| 02:35 | ambrosebs | tomoj: to rewrite it to (let [rest (lazy-seq rest)] ...)? The useless (rest (cons 1 (lazy-seq rest)) sounds like something that can be picked up from the macroexpansion. |
| 02:36 | Raynes | ambrosebs: How are things? |
| 02:36 | ambrosebs | Raynes: delightful ;) |
| 02:36 | ambrosebs | Raynes: did you make it to Clojure West? |
| 02:37 | Raynes | ambrosebs: No. |
| 02:37 | Raynes | I should change my nickname to Raynesnotatcljwest |
| 02:37 | Raynes | At least 4 people have asked me on separate occasions today. :P |
| 02:37 | muhoo | Raynes: i was just going to suggest that |
| 02:37 | ambrosebs | Raynes: sounds depressing :( hehe |
| 02:38 | ambrosebs | Raynes: it's because we love you |
| 02:38 | muhoo | adding dependencies to a project.clj is kind of like building a house of cards |
| 02:39 | muhoo | i never know which one will cause the whole thing to come crashing down |
| 02:54 | tomoj | ambrosebs: hmm |
| 02:54 | tomoj | where's the 1 come from? :) |
| 02:54 | tomoj | oh |
| 02:54 | tomoj | I think I wrote it wrong |
| 02:59 | amalloy | Raynes: change it to Guest |
| 02:59 | Raynes | ambrosebs: I think I fixed that btw. |
| 02:59 | Raynes | Er, amalloy. |
| 03:00 | Raynes | Pretty sure Textual suddenly decided my name should be Guest. |
| 03:08 | muhoo | well... i learned me somethin new. if org.clojure/clojure is defined in profiles.clj, then no matter what is in project.clj, it gets overwritten |
| 04:23 | tgoossens | i find it sometimes difficult finding the right granularity for atoms |
| 04:23 | tgoossens | maybe because i'm trying to think OO too much? |
| 04:23 | tgoossens | I have a simulator where different robots can be in |
| 04:27 | tgoossens | is an atom in an atom unacceptable? |
| 04:28 | tgoossens | probably too complex |
| 04:32 | drorbemet | |
| 04:32 | pyykkis | tgoossens: I'd start by putting the whole world in one atom |
| 04:32 | tgoossens | that' s what i'm trying to do now |
| 04:33 | tgoossens | every robot can receive a different command. asynchronously (so i guess agents might be useful here) |
| 04:34 | pyykkis | tgoossens: have you seen http://vimeo.com/8672404 |
| 04:34 | tgoossens | nope |
| 04:35 | tgoossens | bookmarked it :) |
| 04:36 | tgoossens | will certainly watch it |
| 04:36 | tgoossens | my current idea was |
| 04:36 | tgoossens | A robot must be assigned an action-id. |
| 04:36 | tgoossens | This id will be mapped on a function (mutator) that will |
| 04:36 | tgoossens | mutate a robot (producing the next value) External users can change this mutator function, providing a way to give and change commands |
| 04:38 | tgoossens | its gonnna be difficult :p |
| 04:38 | tgoossens | i made such a system in java recently. But i'm trying to rethink it in clojure |
| 04:41 | magnars | any way to tell midje that [1 2 3] and '(1 2 3) are not equal, since they certainly aren't interchangeable? Testing frameworks should not be lax in their equality checks. |
| 05:02 | scottj | magnars: it probably uses =, which considers them equal |
| 05:05 | magnars | scottj: which is bad on so many levels, especially for a language that prides itself for being simple |
| 05:05 | noidi | magnars, try (just '(1 2 3)) |
| 05:06 | magnars | noidi: thanks, I'll give that a shot |
| 05:06 | noidi | I'm not sure, but I think it does exact matching |
| 05:07 | noidi | sorry, it seems to do fuzzy matching as well :P |
| 05:09 | magnars | yeah :P |
| 05:11 | noidi | magnars, there's also `exactly` |
| 05:12 | noidi | it seems to do a equality check using `=`, so it should forego _some_ magic behavior |
| 05:12 | noidi | ,(= '(1 2 3) [1 2 3]) |
| 05:12 | clojurebot | true |
| 05:13 | noidi | but due to clojure's equality partitions, = is not enough... |
| 05:15 | Chousuke | magnars: you should probably explicitly test for vector-ness instead of strict equality. |
| 05:30 | noidi | magnars, checking the return type of a function is probably a better fit for core.typed or a design by contract |
| 05:31 | noidi | e.g. (defn my-fn [] {:post [(vector? %)]} ...) |
| 05:32 | noidi | or (ann my-fn [-> (Vector Long)]) |
| 06:33 | wjlroe | Does anyone know why on OS X I get an icon in my dock for clojure.main when I launch `lein ring server`? |
| 06:37 | andrewmcveigh|w | wjlroe: You've probably got some java GUI stuff somewhere in your dependencies. You can get rid of it with :jvm-opts ["-Djava.awt.headless=true"] in your project.clj |
| 06:37 | andrewmcveigh|w | or at least, that works for me. |
| 06:37 | wjlroe | andrewmcveigh|w: ah thanks |
| 06:38 | andrewmcveigh|w | wjlroe: no probs |
| 06:40 | wjlroe | andrewmcveigh|w: it was even simpler. `lein ring server-headless`. silly me, it was calling open on the url so it would open in my browser (must have involved some guy library as you said) |
| 06:40 | wjlroe | gui - not guy |
| 06:40 | wjlroe | damn autocorrect |
| 06:45 | wink | ah yeah, too slow :P was about to sugghest -headless |
| 06:45 | andrewmcveigh|w | wjlroe: Ah, yeah. Forgot about server-headless, don't really use that command. |
| 09:07 | nonuby | is there a shortcut for (first (sort-by fn col)) |
| 09:08 | joegallo | i can't think of one offhand -- that seems pretty short already, though ;) |
| 09:08 | clgv | nonuby: it's not that long ;) |
| 09:09 | clgv | nonuby: something like `min` or `max` might fit if you sort numbers there |
| 09:09 | nonuby | they are maps, but yep it is, sometimes i need to think before i ask |
| 09:09 | ayia | i want to generate chars, is there any function like (range "a" "z")? |
| 09:10 | pjstadig | nonuby: using a sorted-map may make it shorter (character wise) and maybe more performant |
| 09:10 | nonuby | pjstadig, will take a look |
| 09:19 | joegallo | ,(take 5 (map char (range (int \a) (int \z))) |
| 09:19 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 09:19 | joegallo | ,(take 5 (map char (range (int \a) (int \z))))( |
| 09:19 | clojurebot | (\a \b \c \d \e) |
| 09:20 | joegallo | which is clever enough, but not very short (and also doesn't work, considering what range does exactly) |
| 09:21 | ucb | nonuby: (def first-by (comp first sort-by)) |
| 09:21 | nonuby | nice |
| 09:22 | nonuby | when use common functions and macros like that do you keep them in a namespace, in a project, or just duplicate where required. reminds me of the .net days of every company had Acme.Enterprise.Commons |
| 09:25 | ucb | nonuby: what do you mean? your own common operations or what? |
| 09:26 | nonuby | functions that are handy buy omitted by clojure.core like first-by, any? etc.. |
| 09:31 | ticking | hey, is there a string protocol, I can't seem to find one and (sadly) have to implement a new string type |
| 09:31 | joegallo | ticking: what's the problem you're trying to solve -- perhaps you've decided on a particular solution prematurely |
| 09:32 | joegallo | regarding your precise question, though, the answer is no, there isn't a string protocol. java strings are java strings. |
| 09:32 | joegallo | (and it's a final class, you can't extend it.) |
| 09:33 | ticking | joegallo, I have to process OCR XML documents, the representation in those is (horrible) to store words and lines as lists of characters with separator elements, where each character is associated with a bouding box |
| 09:34 | joegallo | okay, that sounds like a problem -- what thinking has led you down the path of trying to create a new string type? |
| 09:34 | ticking | I want to keep my core page, character and word processing functions as clean and generic as possible, thus working with regular strings |
| 09:34 | augustl | can I put ref reads in a dosync in order to get a synchronized view of multiple refs? |
| 09:35 | joegallo | ticking: i see |
| 09:35 | ticking | most of the functions do stuff like, find word in dictionary and substitute characters |
| 09:35 | llasram | augustl: That would in fact be the raison d'etre of refs |
| 09:36 | joegallo | ticking: have you ruled out just turning your objects into a plain old java String or StringBuilder and banging on that? |
| 09:37 | ticking | joegallo, so my thought was to, rather than dragging all that burden, through all my functions, thus complicating them, to implement a type that implements the string protocol (if there was one ^^) that takes care of handling all the bouding boxes and other meta info |
| 09:38 | joegallo | gotcha. here's my quick advice -- that's cutting pretty hard against the grain of the jvm, you might want to reconsider that approach. |
| 09:38 | ticking | joegallo yeah the problem is that I have to emit them into a document where everyhing is as preserved as possible after I'm done with them ^^ |
| 09:38 | joegallo | ah, gotcha |
| 09:38 | ticking | I'm all ears ^^ |
| 09:39 | joegallo | sadly, i don't have much constructive advice, just "uhhhh, that sounds like a bad idea" ;) |
| 09:39 | pjstadig | ticking: there's not a string protocol, but there is a sequence abstraction |
| 09:39 | pjstadig | can you not just process sequences? |
| 09:39 | ticking | pjstadig, I'm using regex for the matching of similar words ^^ |
| 09:40 | pjstadig | ticking: can the regexes be replaced with sequence functions like take, drop, take-while, etc.? |
| 09:41 | augustl | llasram: I see :) |
| 09:41 | augustl | it could have been that refs were for coordinated writes only, nice to know they're also good for coordinated reads |
| 09:41 | ticking | pjstadig, I'm not shure, I could try |
| 09:42 | pjstadig | augustl: the STM is an MVCC transaction system, so it gives you a snapshot view of ref-world for both reads and writes |
| 09:43 | ticking | joegallo, thanks nevertheless ^^ |
| 09:44 | ticking | pjstadig, thanks I'll probably try that, seems to be one of those cases where one gets bitten by the java heritage |
| 09:46 | augustl | I guess I'm asking more about best practices than possibilities. For all I know, a dosync that only does reads is frowned upon :) |
| 09:46 | pjstadig | augustl: i wouldn't frown upon it :) |
| 09:46 | augustl | in other words, snapshot view for reads is only "supposed" to be used for reading inside dosyncs where you also do writes |
| 09:47 | pjstadig | I think you would only need to dosync around refs for a consistent read if you are also modifying them in some way |
| 09:47 | pjstadig | if you just have some global things you want to read consistently and they never change, you could use vars or atoms or something |
| 09:47 | augustl | they are constantly modified |
| 09:48 | pjstadig | so, yeah, you would need a dosync to read consistently |
| 09:48 | augustl | so sequential dereferencing would lead to a inconsistent view of the multiple refs |
| 09:48 | pjstadig | right |
| 09:48 | augustl | deref it is! :) |
| 09:48 | pjstadig | augustl: this is a right use of dosync, and you have my blessing |
| 09:49 | augustl | anyone else doing some early morning hacking before Clojure West starts in 2 hours? :) |
| 09:49 | augustl | pjstadig: \o/ |
| 09:49 | pjstadig | :( i wish i was there |
| 09:49 | ejackson | pjstadig: you're not alone :( |
| 09:49 | augustl | there are still tickets available I think :P |
| 09:49 | pjstadig | augustl: haha |
| 09:52 | augustl | which blows my mind, the lineup is great. I wonder why they didn't sell out |
| 09:52 | ticking | pjstadig, looks like regex can handle CharSequences, I'll take a look at how that works out ^^ |
| 09:52 | augustl | many of my norwegian friends didn't go since it's such a long flight from europe, much longer than to the conj in november.. |
| 09:52 | pjstadig | ticking: oh interesting |
| 09:52 | ticking | pjstadig, or did you mean the clojure sequence abstraction? |
| 09:53 | pjstadig | ticking: not that it would help you, but i wonder if one could get clojure's sequences to extend CharSequence, then you could theoretically do regexen against an arbitrary sequence of characters |
| 09:53 | pjstadig | perhaps even a lazy sequence |
| 09:53 | pjstadig | hmm |
| 09:54 | ticking | pjstadig that would be beyond awesome |
| 09:54 | pjstadig | ticking: if you wanted to be able to run a regex against your OCR sequence you might be able to deftype or defrecord something that extends CharSequence |
| 09:54 | pjstadig | but that seems like a pretty big hammer |
| 09:56 | ticking | pjstadig that whole ocr format is a giant bug, a hammer seems like the apropriate tool ^^ |
| 09:56 | pjstadig | could be :) |
| 09:59 | hyPiRion | augustl: yeah, it's a long way from Norway. |
| 09:59 | hyPiRion | But it's mostly about the price, since we're talking about at least ~1k in travel expenses |
| 10:02 | ejackson | i calculated more from the UK |
| 10:02 | ejackson | one day |
| 10:04 | hyPiRion | It's about 1k euro in plane tickets |
| 10:04 | hyPiRion | at least from here |
| 10:06 | drorbemet | (map list (partition-all 3 (range 9))) |
| 10:06 | drorbemet | Hi, how do I lift the lists up, out of the enclosing list so I can call map list on those? |
| 10:06 | drorbemet | (((0 1 2)) ((3 4 5)) ((6 7 8))) |
| 10:08 | hyPiRion | ,(mapcat list (partition-all 3 (range 9))) ; ? |
| 10:08 | clojurebot | ((0 1 2) (3 4 5) (6 7 8)) |
| 10:09 | hyPiRion | oh, you want to map each element in the newly partitioned lists |
| 10:09 | drorbemet | Not this (((0 1 2)) ((3 4 5)) ((6 7 8))) but like this ((0 1 2) (3 4 5) (6 7 8)) |
| 10:09 | drorbemet | It is called lifting as far as I remember but with that term I didn't find the corresponding function in the Clojure libs. |
| 10:09 | matthavener | (map first l) ? |
| 10:09 | drorbemet | flatten is to much though |
| 10:10 | hyPiRion | ,(map (partial map list) (partition-all 3 (range 9))) |
| 10:10 | clojurebot | (((0) (1) (2)) ((3) (4) (5)) ((6) (7) (8))) |
| 10:10 | hyPiRion | I suspect. |
| 10:10 | hyPiRion | ,(mapcat (partial map list) (partition-all 3 (range 9))) ; It has to be some of these |
| 10:10 | clojurebot | ((0) (1) (2) (3) (4) ...) |
| 10:10 | matthavener | ,(map first '(((0 1 2)) ((3 4 5)) ((6 7 8)))) |
| 10:10 | clojurebot | ((0 1 2) (3 4 5) (6 7 8)) |
| 10:11 | hyPiRion | oh, drorbemet, that's mapcat |
| 10:11 | drorbemet | hyPiRion: I want to zip the lists comming from partition-all |
| 10:11 | drorbemet | mapcat? ok I try it |
| 10:11 | hyPiRion | ,(mapcat list (partition-all 3 (range 9))) ; <<- ? |
| 10:11 | clojurebot | ((0 1 2) (3 4 5) (6 7 8)) |
| 10:12 | hyPiRion | Is that what you want, or do you want to perform some function on 0, 3 and 6, etc? |
| 10:12 | drorbemet | Ah, thanks mapcat does lifting ok, thanks :-) |
| 10:13 | drorbemet | hyPiRion: yes, thanks |
| 10:13 | Chousuke | ,(apply map + (partition 3 [1 2 3 4 5 6 7 8 9])) |
| 10:13 | clojurebot | (12 15 18) |
| 10:14 | augustl | are there any non-macro ways to invoke methods on java objects? |
| 10:15 | Chousuke | non-macro? |
| 10:15 | hyPiRion | ,(clojure.walk/macroexpand-all '(.read System/in)) |
| 10:15 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk> |
| 10:15 | hyPiRion | humf |
| 10:15 | hyPiRion | ,(require '[clojure.walk :as walk]) |
| 10:15 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 10:16 | hyPiRion | Whaa :( |
| 10:16 | Chousuke | the underlying special form is . |
| 10:16 | Chousuke | ,'(.foo bar) |
| 10:16 | clojurebot | (.foo bar) |
| 10:16 | Chousuke | oh, right, that doesn't get expanded at read-time |
| 10:19 | ticking | use vs require which one was supposed to superseed which again? |
| 10:25 | alexnixon | ticking: require + refer > use |
| 10:26 | ticking | alexnixon, I cant seem to find the flag for importing all iwth require ^^ |
| 10:27 | alexnixon | in ns form, (:require [foo.bar :refer :all]) |
| 10:27 | alexnixon | but it's generally preferred to explicitly refer what you need or alias the ns |
| 10:31 | augustl | the problem is that I have a java object, a keyword for the method, and a vector for its arguments |
| 10:31 | augustl | so I need to apply the arguments etc |
| 10:31 | Chousuke | you'll probably need reflection for that. |
| 10:32 | augustl | which is what the "." forms does under the hood I guess? |
| 10:33 | Chousuke | augustl: if it doesn't have type hints, yes |
| 10:33 | jcidaho | hey - Am looking for approaches for comparing HTML snippets - trying enlive with midge, although I still get issues with whitespace, carriage returns etc in the enlive data tree. Anyone tackled something similar? |
| 10:34 | augustl | Chousuke: ah, good point.. I guess it's better that my API takes a function that can be called, that itself calls the interop, rather than passing data run-time, since there are compile time optimizations to be had.. |
| 10:35 | pjstadig | ticking: https://gist.github.com/pjstadig/5187587 |
| 10:38 | zerokarmaleft | pjstadig: was naming your localhost "jane" inspired by OSC? |
| 10:38 | pjstadig | yeah |
| 10:40 | zerokarmaleft | thought so...hope that works out for your investment portfolio :D |
| 10:40 | pjstadig | hehe |
| 10:40 | pjstadig | https://github.com/pjstadig/clojure/commit/03093720d44068dddaf8fdda0ffd9504acc9faa8 |
| 10:42 | tyler__ | shouldn't it be :clojure/west not clojure/west? just sayin |
| 10:42 | tyler__ | actually nevermind |
| 10:42 | tyler__ | brain not up yet |
| 10:43 | llasram | tyler__: On this channel it's just ::west |
| 10:43 | tyler__ | lol |
| 10:43 | tyler__ | (inc llasram) |
| 10:43 | lazybot | ⇒ 6 |
| 10:44 | tyler__ | ironically inc side effects |
| 10:44 | tyler__ | affects? |
| 10:44 | tyler__ | to affected something is to make it effected right? |
| 10:44 | tyler__ | affect |
| 10:45 | ticking | pjstadig, pretty cool ^^ |
| 10:45 | tyler__ | is |
| 10:45 | pjstadig | tyler__: you are commended, sir http://paddynotpatty.com/ |
| 10:46 | tyler__ | (inc pjstadig) |
| 10:46 | lazybot | ⇒ 4 |
| 10:49 | tyler__ | lol i love the st patty twitter bot |
| 10:49 | tyler__ | (inc public/shaming) |
| 10:49 | lazybot | ⇒ 1 |
| 10:51 | pjstadig | (inc public/shaming) |
| 10:51 | lazybot | ⇒ 2 |
| 12:28 | duncanm | is there a separate channel for clojurescript? |
| 12:29 | duncanm | hmm, this channel looks more lively than the other one |
| 12:30 | nDuff | duncanm: It's an unusually slow morning, but things are indeed generally lively here. |
| 12:30 | duncanm | yeah |
| 12:30 | duncanm | i used to be more active here |
| 12:30 | duncanm | nDuff: do you use clojurescript? |
| 12:31 | nDuff | duncanm: I don't generally answer questions of that form -- often, "do you use X?" is "are you willing to answer an arbitrary question about X I haven't yet chosen to ask" in disguise. |
| 12:32 | duncanm | nDuff: well, if you don't use clojurescript at all, then all subsequent questions are moot |
| 12:32 | nDuff | duncanm: Only if you were talking only to me. There's just short of 600 people here. |
| 12:32 | duncanm | nDuff: i was wondering about the implementation of vars/bindings in clojuresript |
| 12:32 | nDuff | duncanm: ...so ask _the channel_ that question. |
| 12:32 | zodiak | also a slow morning due to c/west I would think |
| 12:33 | ambrosebs | duncanm: Last I checked, vars don't exist in CLJS. |
| 12:33 | zodiak | vars don't exist in cljs ?! |
| 12:34 | supersym | lol@nduff |
| 12:34 | duncanm | ambrosebs: i thought i read something in google groups from dnolen |
| 12:34 | ambrosebs | duncanm: the compiler has an internal hash map of some sort to keep track of them. |
| 12:34 | duncanm | but i can't find the post now |
| 12:34 | supersym | that is so true about the questions... now I realise I do that sometimes as well :D |
| 12:34 | zodiak | so, you can't do (def foo) ? |
| 12:34 | ambrosebs | zodiak: you can, but there's no #' special form. |
| 12:35 | ambrosebs | zodiak: there are no Vars with a capital :) |
| 12:35 | zodiak | oh. well, that's not quite such a loss then :) |
| 12:35 | ambrosebs | zodiak: I want them. |
| 12:36 | duncanm | ambrosebs: http://markmail.org/message/fouk2zgk3v32zqxn#query:+page:1+mid:fouk2zgk3v32zqxn+state:results |
| 12:36 | duncanm | ambrosebs: maybe i'm misunderstanding dnolen |
| 12:37 | ambrosebs | duncanm: not sure, I'll check the compiler ;) |
| 12:37 | duncanm | ambrosebs: i was writing some typescript in node.js, and i really wanted something like fluid-variables in scheme |
| 12:38 | duncanm | ambrosebs: just for handling process.cwd() |
| 12:38 | duncanm | i realized the javascript people don't even have the terminology of 'fluid variables' or 'dynamic bindings' in the lisp-sense, so i thought the clojurescript people are the only ones who can answer my question |
| 12:39 | duncanm | ambrosebs: you're the one working on typed clojure? |
| 12:39 | ambrosebs | duncanm: haha yes |
| 12:39 | ambrosebs | don't worry, ask me whatever you like ;) |
| 12:39 | nDuff | duncanm: binding doesn't do a tremendous lot that you don't get with let in cljs -- it's just a try/finally block with set! calls |
| 12:39 | duncanm | ambrosebs: that's really cool, i went to school at Northeastern, and i'm friends with SamTH |
| 12:40 | nDuff | duncanm: ...and a warning if things weren't declared ^:dynamic |
| 12:40 | duncanm | ambrosebs: i was an undergrad when he worked on typed scheme |
| 12:40 | nDuff | duncanm: Since JavaScript isn't multithreaded, that's really all one needs. |
| 12:40 | ambrosebs | duncanm: wow that's great! |
| 12:40 | nDuff | s/binding/dynamic binding/ |
| 12:41 | duncanm | nDuff: i'm using async.js (maybe this is not needed with clojurescript), but with multiple async calls, i was trying to find a way to handle cwd, or basically the current output port, things like that |
| 12:41 | ambrosebs | duncanm: Sam's been an invaluable source of help for over a year for me. |
| 12:41 | ambrosebs | I'm still pestering him with ideas :) |
| 12:42 | duncanm | nDuff: what about calls scheduled later? |
| 12:44 | nDuff | duncanm: Sounds like the same problem you'd have in Clojure (with the only difference that bound-fn* isn't implemented in cljs) |
| 12:45 | tieTYT | can someone recommend a tutorial for me? i got it recommended yesterday but i'm at work now and can't find the link on google. It's more up to date than this one: http://java.ociweb.com/mark/clojure/article.html |
| 12:45 | tieTYT | that one suggests using clj and people told me that's out of date |
| 12:45 | tieTYT | i think the tutorial may actually be from the clojure site. It seems like it's made from an atlassian wiki or something |
| 12:46 | tieTYT | has pages like "Getting Started" and it talks about all the different data structures. This ringing a bell? |
| 12:46 | tyler__ | is there a channel for west? |
| 12:46 | duncanm | tieTYT: what are you trying to do with clojure? |
| 12:47 | supersym | whats the problem with clj? |
| 12:47 | tieTYT | learn it |
| 12:47 | tieTYT | supersym: i was told that's an obsolete way to run clj files. now people use lein instead |
| 12:47 | supersym | yes you can |
| 12:48 | supersym | but the repl is still handy.. I love lighttable a lot more for learning |
| 12:48 | supersym | instarepl |
| 12:48 | nDuff | tieTYT: If you're looking for a resource that covers modern tools (such as leiningen), http://www.clojurebook.com/ is pretty good -- but I don't know of anything free/online comparable. |
| 12:48 | supersym | but I also have eclipse with leiningen plugin depends on what I want to do, focus on |
| 12:48 | ambrosebs | tieTYT: try http://clojure-doc.org/articles/tutorials/getting_started.html |
| 12:49 | tieTYT | ambrosebs: that's the one I was looking for! I can't find that one from google |
| 12:50 | tieTYT | supersym: i don't know what any of those are |
| 12:51 | supersym | http://www.lighttable.com - but there is little documentation, pre-alpha software |
| 12:51 | supersym | author blog = |
| 12:51 | tieTYT | supersym: I don't even know the fundumentals yet |
| 12:52 | supersym | http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept |
| 12:52 | ambrosebs | tieTYT: yes, that's an issue. It's the best site for beginners docs. |
| 12:52 | tieTYT | ambrosebs: you think it's better than http://java.ociweb.com/mark/clojure/article.html ? |
| 12:52 | supersym | haha ok sorry,... |
| 12:53 | supersym | but its made from user-friendly perspective so not much to learn there but clojure |
| 12:53 | ambrosebs | tieTYT: not sure. Just don't use anything on clojure.org. |
| 12:53 | tieTYT | supersym: I gotta learn that first :P |
| 12:53 | tieTYT | ambrosebs: ok |
| 12:54 | tieTYT | ambrosebs: why's that? |
| 12:54 | ambrosebs | tieTYT: it's rarely suitable for beginners. |
| 12:54 | ambrosebs | there are much better resources out there |
| 12:54 | ambrosebs | clojure.org is great as a reference. |
| 12:55 | supersym | tieTYT: imma newb too in clojure, lt = "Light Table let's you see what functions are used inside of the one you're currently working on, not just by highlighting ones in your code, but by also showing you their code to the side" |
| 12:55 | supersym | so I find it useful to learn, the language actually |
| 12:55 | supersym | but if you find it too daunting already ;) don't mind |
| 13:05 | ciphergoth | is slingshot the recommended way to do exception handling in Clojure? |
| 13:06 | nDuff | ciphergoth: it's very widely used |
| 13:06 | ciphergoth | nDuff, sounds good :) |
| 13:13 | ciphergoth | hmm, need to build this combination of map and reduce: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-List.html#v:mapAccumL |
| 13:22 | jcromartie | I'd really like to just have clojure.tools.namespace.repl/refresh available all the time |
| 14:11 | amalloy | ciphergoth: most people make do with just ordinary java exceptions. if you want to do something fancier, then yes, slingshot is the way to go |
| 14:12 | ciphergoth | amalloy, thanks! It looks like creating my own exception hierarchy in Clojure could be a bit painful and not very Clojure-ish; slingshot could be nicer for that. But maybe not? |
| 14:13 | Ember- | hmm, ex-info and ex-data won't work? |
| 14:13 | Ember- | in my opinion those kinda deprecated most of slingshot |
| 14:14 | cap10morgan | is there a good way to debug "Exception in thread "main" java.lang.Exception: No namespace foo" errors? I want to figure out what in the source file that defines things in that namespace is breaking it. |
| 14:15 | amalloy | Ember-: those provided better primitives; slingshot still adds a lot of functionality on top of them |
| 14:15 | tyler__ | where are people going for lunch? |
| 14:15 | Ember- | or well, of course slingshot provides all kind of nice things yeah |
| 14:16 | Ember- | tyler__: you do realize that there's people all around the world in here? :) |
| 14:17 | amalloy | ciphergoth: sure, that would be easier in slingshot. however, consider the fact that it's not easy already as a warning that it's not really the Clojure Way |
| 14:17 | Ember- | from all around |
| 14:17 | Ember- | own exception hierarchy in clojure sounds kinda dangerous |
| 14:17 | Ember- | or well, not dangerous |
| 14:17 | Ember- | just tedious :) |
| 14:18 | nDuff | cap10morgan: Can you provide a reproducer for that? Barring that, a full (chaining included) stack trace? |
| 14:20 | cap10morgan | nDuff: sure, but it's a garden-variety kind of error. I have a file that implements the mail_batcher.t-core ns for midje tests, but when I try to run `lein midje` I get the no namespace error b/c something is wrong in the file, syntax-wise I guess. |
| 14:21 | amalloy | cap10morgan: mail_batcher.t-core is not a namespace name that you can use |
| 14:21 | nDuff | cap10morgan: sounds like something typically related to not following the convention for mapping names between file and namespace names. |
| 14:21 | nDuff | cap10morgan: mail- |
| 14:22 | nDuff | err, mail-batcher.t-core as your ns, and mail_batcher/t_core.clj as your source, would make sense. |
| 14:22 | cap10morgan | amalloy: huh, we have been using it. but I'll try making that change. |
| 14:22 | amalloy | it'd probably work if you never tried to require that file from another file |
| 14:23 | cap10morgan | amalloy: that file was use'ing mail_batcher.core. fascinating. |
| 14:24 | cap10morgan | changing that *does* seem to have improved the stacktraces, though |
| 14:26 | cap10morgan | yep, all good now. thanks all. |
| 15:06 | whilo | hi |
| 15:08 | whilo | i am trying to build my clojurescript application with the openlayers-3 version, which uses the google closure compiler. https://github.com/openlayers/ol3 |
| 15:13 | whilo | i have added :libs ["libs/ol.js"] to lein-cljsbuild compiler configurations as documented on http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html |
| 15:13 | thm_prover_ | sorry if this is repeat (other client appears to have frozen) |
| 15:14 | thm_prover_ | what is an actively maintained peg parser library for clojure? I'm currently looking at clj-peg, fnparser, ... but not sure what to go with |
| 15:14 | whilo | thm_prover_: something like this: https://github.com/richard-lyman/amotoen/ ? |
| 15:15 | nDuff | thm_prover: I haven't found one that I was happy with. That said, my requirements included support for left recursion, so that's maybe a special case. |
| 15:15 | thm_prover_ | whilo: I like this line from the documentation: "In other words: Amotoen is better than clj-peg. Amotoen is not AOT'd." |
| 15:16 | whilo | thm_prover_: i am atm. struggeling with it :-) but i am very new to parsing. my first real parser with ast |
| 15:17 | raek | I thought people quit AOT compilinging their libs in 2010 |
| 15:17 | thm_prover_ | whilo: great, pearhps we can help each other out |
| 15:17 | thm_prover_ | whilo: out of courisity, what are you parsing? |
| 15:17 | whilo | https://github.com/RagingRanek/jekyll/blob/master/doc/syntax |
| 15:19 | whilo | the more i work on it, the more i like the simplicity of lisp "syntax" :-D |
| 15:20 | whilo | about my clojurescript problem. i could require the namespace for a debug build with whitespace only and can construct some objects, but munging of ol.js breaks my code |
| 15:22 | whilo | has somebody clues of how to build an actual external closure compatible library with lein-cljsbuild and closure? on the other hand if i try to use ol-whitespace.js with my whitespace build, both include google closure libs and conflict |
| 15:23 | tyler__ | followed instructions in https://github.com/dgrnbrg/spyscope but i can't access in my lein repl. is it a lein issue or a library issue? |
| 15:25 | thm_prover_ | does cgrand hang out here? I just stumbled across parsley (and it's claim for incremental parsing) and woudl love to chat about how it works |
| 15:30 | Frozenlock | Any libraries to create invoices? (clj-pdf?) |
| 15:31 | thm_prover_ | I use itext for producing pdfs |
| 15:33 | Frozenlock | this? --> https://github.com/yogthos/iText |
| 15:35 | TimMc | Wow, this midje test actually passes: (fact (/ 1 0) =not=> 17) |
| 15:35 | TimMc | Does that seem insane to anyone else? |
| 15:35 | hyPiRion | well, it is a fact that 1/0 is not 17. |
| 15:36 | Frozenlock | what is '=not=>'? |
| 15:36 | TimMc | Yes, in a strict sense, it is true, and I see why it does it that way... |
| 15:36 | TimMc | Frozenlock: It's a midje-specific symbol. |
| 15:36 | TimMc | (fact (+ 1 1) => 2) |
| 15:36 | Frozenlock | ah, ok. |
| 15:37 | TimMc | I had a test that was incorrectly passing because it was throwing an error. |
| 15:37 | hyPiRion | TimMc: I get why you're kind of surprised, considering most test frameworks throws errors when they crash |
| 15:38 | TimMc | So it doesn't seem weird to you? |
| 15:38 | hyPiRion | TimMc: I don't know. |
| 15:38 | hyPiRion | I would probably do => testing instead of eliminations. |
| 15:39 | melipone | hello! How can I remove the nth element from a list? |
| 15:41 | nDuff | melipone: That's not a particularly efficient thing to do, particularly if it's happening in a loop. What's your use case? Ideally, there might be a better approach. |
| 15:41 | hyPiRion | melipone: hello! As nDuff commented, it's not particularly efficient. However, clever use of split-with should give you what you'd like. |
| 15:42 | hyPiRion | ,(split-at 3 (range 10)) |
| 15:42 | clojurebot | [(0 1 2) (3 4 5 6 7 ...)] |
| 15:42 | hyPiRion | ,(let [[fst [_ & rst]] (split-at 3 (range 10))] (concat fst rst)) |
| 15:42 | clojurebot | (0 1 2 4 5 ...) |
| 15:42 | QSteven | does the guy behind webfui hang out here on occasion? |
| 15:44 | jtoy_ | can someone redirect me to a better explanation of how to use ->> ? this page is not clear enough for me: http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E |
| 15:44 | jtoy_ | also is there a googleable name for that? |
| 15:46 | xeqi | jtoy_: I call it thread-last |
| 15:46 | xeqi | (->> 1 (- 2) (- 7)) |
| 15:46 | xeqi | &(->> 1 (- 2) (- 7)) |
| 15:46 | lazybot | ⇒ 6 |
| 15:46 | melipone | I was thinking of (take nth (drop n+1 ...) type of thing |
| 15:47 | whilo | thm_prover_: the unfinished parse-tree of parseley seems to be a lot more informative than the Exception from amatoen |
| 15:47 | whilo | parsley |
| 15:47 | thm_prover_ | whilo: ah, you've tried both |
| 15:47 | whilo | nope, i have just learned about parsley as u posted it :-D |
| 15:51 | jtoy_ | i see |
| 15:53 | jtoy_ | hmm, why are these different though? (->> 1 (- 2) (- 7)) and (-> 1 (- 2) (- 7)) ? shoudlnt 2nd and last be the same here? |
| 15:53 | xeqi | jtoy_: -> threads as the first argument |
| 15:54 | xeqi | (-> 1 (- 2) (- 7)) = (- (- 1 2) 7) |
| 15:54 | jtoy_ | ah ok, i see |
| 16:00 | jcromartie | clojure.xml and it's friends are totally useless when it comes to unknown outside XML and namespaces |
| 16:00 | jcromartie | its |
| 16:04 | muhoo | i remember someone, maybe it was cemerick, was working on coming up with a pattern to deal with function application that had to happen in a particular order, like middleware wrapping |
| 16:04 | xeqi | muhoo: I think that became part of nrepl's middleware |
| 16:05 | xeqi | * middleware declaration |
| 16:05 | muhoo | xeqi: cool, do you remember which project it ended up being incorporated into (so's i can have a peek at the source)? was it nrepl, piggieback, or something else? |
| 16:05 | cemerick | muhoo: yeah, don't look at it though; I can't use any useful dependencies in nREPL that would make such things way way easier |
| 16:06 | muhoo | which dependencies? |
| 16:06 | muhoo | because i'm bumping into this problem in a different domain, not nrepl, and i may be able to make use of other solutions, if they're out there. |
| 16:07 | Glenjamin | hi guys, i'm getting a weird issue with clj-http+compojure, if i pass the http response as a compojure route return value, I can see the XML response - but if i use :body on it, i get an empty string. Any ideas how to debug? |
| 16:08 | muhoo | hell i'm not even sure what to google for :-/ |
| 16:09 | cap10morgan | is there a shorter way to write this: (reduce conj (map (fn [[key val]] {val key}) {:foo "bar" :baz "qux"})) ;; mapping from one map to a new, modified map being the aspect I'm interested in ?? |
| 16:09 | lazybot | cap10morgan: What are you, crazy? Of course not! |
| 16:10 | cemerick | muhoo: something like dependency-list works for a lot of simple cases: https://github.com/clojure/clojure-contrib/blob/master/modules/graph/src/main/clojure/clojure/contrib/graph.clj#L190 |
| 16:12 | borkdude | cap10morgan |
| 16:12 | borkdude | ,(let [m {:foo "bar" :baz "qux"}] (zipmap (vals m) (keys m))) |
| 16:12 | clojurebot | {"qux" :baz, "bar" :foo} |
| 16:12 | xeqi | &(clojure.set/map-invert {:foo "bar" :baz "qux"}) |
| 16:12 | lazybot | ⇒ {"qux" :baz, "bar" :foo} |
| 16:13 | muhoo | cemerick: ok, thanks. makes sense, and now i can google for "topological sort" :-) |
| 16:13 | borkdude | xeqi why is that in clojure.set? |
| 16:14 | xeqi | borkdude: I'm going to guess legacy reasons? |
| 16:14 | muhoo | OIC, it's bascally a dependency problem, like aether/maven solves. middleware A depends on middlware B etc., and the algorithm needs to sort them first before applying them |
| 16:15 | borkdude | xeqi funny... |
| 16:17 | borkdude | $find-fn {:a 1 :b 2} {1 :a 2 :b} |
| 16:17 | borkdude | $findfn 1 2 |
| 16:18 | lazybot | [clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc] |
| 16:18 | borkdude | $findfn {:a 1 :b 2} {1 :a 2 :b} |
| 16:18 | cgag | rename-keys feels weird being in clojure.set to me as well |
| 16:18 | lazybot | [clojure.set/map-invert] |
| 16:18 | borkdude | yeah =) |
| 16:18 | borkdude | good night folks |
| 16:23 | tyler__ | man Stuart Sierra is such a good speaker |
| 16:24 | muhoo | tyler__: he was a theatre major, he said in one talk |
| 16:24 | muhoo | are you guys liveIRC'ing cljwest? |
| 16:28 | owengalenjones | this is kindof a crappy question but Im completely flumuxed, I have wildly different behavior from lein -run vs. java -jar uberjar: http://d.pr/i/t69G not even sure what to look for... Ive ran lein clean, lein compile (no output from this) then lein uberjar to create the jar file |
| 16:29 | llasram | owengalenjones: well, `lein run` will include the `dev` profile |
| 16:29 | llasram | owengalenjones: What does your project.clj look like? |
| 16:30 | owengalenjones | my dev profile has lein-midje midje abd bultitude in it |
| 16:31 | owengalenjones | project.clj: http://d.pr/i/MX23 |
| 16:31 | llasram | Ok... So honestly I'm not entirely clear on how they're acting different. In your screenshot, the lines from the uberjar run look identical to the `lein run` output up until you type `wtf` |
| 16:32 | llasram | Uh, also maybe: https://www.refheap.com/paste |
| 16:32 | owengalenjones | the request response json only occurs in the lein run |
| 16:32 | abp | woohoo: http://pedestal.io/ |
| 16:32 | llasram | abp: sparkly! |
| 16:33 | llasram | owengalenjones: Are you sure you aren't just seeing output buffer flushes occurring differently? |
| 16:34 | owengalenjones | no because the lein run will connect and insert things into a mongo database, the uberjar isnt |
| 16:35 | nbeloglazov | Hi. I'm trying to setup paredit. I have problems with curly braces. When I put close brace it finds closest non-curly brace ) or ] and jumps there. |
| 16:35 | nbeloglazov | So [:hello {:a 1|}] => [:hello {:a 1}]| .Does anybody know how to fix it? |
| 16:35 | nDuff | nbeloglazov: Which version? I haven't seen that in rather a long time. |
| 16:36 | nbeloglazov | 22 or 23 beta |
| 16:36 | nbeloglazov | Ok. I'll take a look at the vesion in emacs-live |
| 16:38 | llasram | owengalenjones: My psychic powers are failing today. Only thing I can think of is to add more debug logging to figure out where the divergence occurs |
| 16:40 | owengalenjones | llasram: well I was thinking, the wtf is a debugging statement (pretty confused at this point) that should be displaying, do uberjars do anything with stdout? does it only display stdout in the -main fn? |
| 16:41 | llasram | owengalenjones: Ah, I misinterpreted what happened there. At the very least, make sure you print a newline after your debugging logging (`println` vs `print`, if that's what you're using) |
| 16:41 | llasram | owengalenjones: Otherwise your output will be buffered until a newline |
| 16:51 | owengalenjones | llasram: ok thats really weird, the the program requests data from an api and then later sends it to mongodb, but in an uberjar the send-to-mongo fn wasn't doing anything until I put a println fn in it |
| 16:55 | drorbemet | Hi, I am currently running Win7 with Eclipse, Counterclockwise with one repl and midje.repl autotest in a PowerShell terminal. |
| 16:55 | drorbemet | I am a bit supprised about the memory consumption. Most of the time there are two java.exe and two javaw.exe processes running. Each of them taking from 400 up to 800 Megabyte of RAM. Are there some options to configure that? |
| 16:56 | drorbemet | Could one java process be shared by multiple repl instances? |
| 16:56 | drorbemet | Would the situation be different with Emacs? |
| 16:57 | technomancy | drorbemet: you can use Leiningen's "trampoline" higher-order task to allow one of the JVMs to exit and only leave the project JVM |
| 16:57 | owengalenjones | llasram: the fix: https://www.refheap.com/paste/12698 any way thank you for putting me the on the right track... |
| 16:58 | technomancy | I don't know if you can do that with ccw though |
| 16:58 | technomancy | I recommend keeping a single (possibly trampolined) repl open but I don't know if the tooling around midje/ccw supports that very well |
| 16:58 | tyler__ | anyone have an idea of why my dependency code isn't being use in my lein profile? https://www.refheap.com/paste/12699 |
| 16:58 | llasram | owengalenjones: I... um. Well. I'm glad it's working for you |
| 16:59 | tyler__ | used* |
| 16:59 | drorbemet | Ah, trampoline does that, ok I look into that, thanks. |
| 16:59 | drorbemet | Besides trampoline, are there possibilities to optimize the JVM process itself regarding memory consumption? |
| 17:00 | technomancy | drorbemet: you can set :jvm-opts to include memory tuning in project.clj |
| 17:00 | balint | I'm having problems with type-hints |
| 17:00 | technomancy | drorbemet: having a ton of JVMs open is always going to be expensive though |
| 17:00 | balint | I have to this code: (let [explored? (fn [^long i] (aget ^booleans explored (dec i)))] |
| 17:01 | balint | I get ClassCastException [Ljava.lang.Boolean; cannot be cast to [Z when I run it though |
| 17:01 | balint | explored is defined as a boolean java array |
| 17:01 | hiredman | you have an array of boxed Boolean objects, not primitive booleans |
| 17:01 | balint | explored (make-array java.lang.Boolean V) |
| 17:02 | balint | hiredman |
| 17:02 | balint | sorry |
| 17:02 | muhoo | so i have a stupid question about clojure and reentrancy and interop. if a clojure function is called from a java-driven callback interop thread, and i'm only managing clojure persistent data within it, it's reentrant and thread-safe, right? |
| 17:03 | muhoo | i'm dealing with a java library that is an absolute zoo of locks and synchronized and crap, so i'm a bit spun around. |
| 17:03 | drorbemet | technomancy: ok thanks, I am not complaining, but somehow I have to manage my 8Gigs RAM currently available ;-) |
| 17:04 | technomancy | 8 gigs! luxury. |
| 17:05 | balint | hiredman: thank you, that indeed helped |
| 17:05 | balint | I converted the array definitions from (make-array ^java.lang.Boolean V) to (boolean-array V) |
| 17:05 | llasram | Last year I was too busy to upgrade Emacs. Now I'm too busy to install the 32GB of RAM just sitting on my desk... |
| 17:05 | llasram | One day, one day |
| 17:05 | balint | so next question |
| 17:05 | balint | why does the following code: |
| 17:05 | balint | set-finished (fn [^long offset ^longs values] |
| 17:05 | balint | (doseq [idx (range (count values))] |
| 17:05 | balint | (aset ^longs finished (+ offset idx) (nth values idx)))) |
| 17:06 | balint | give me "call to aset can't be resolved." ? |
| 17:06 | hiredman | win 15 |
| 17:08 | muhoo | balint: type "aset" in your repl and see if #<core$aset clojure.core$aset@191d528d> or similar comes back? |
| 17:08 | balint | #<core$aset clojure.core$aset@7f7ef0a7> |
| 17:09 | muhoo | well, at least your repl can resolve it. |
| 17:09 | mpenet | balint: probably because finished is not an array |
| 17:09 | brehaut | balint: just btw, type hints are hints, not checks or coercions. |
| 17:10 | brehaut | balint: hints are only used to provide compile time optimisation / remove reflection / specific java method overloads to use |
| 17:10 | balint | the original problem is that I have a huge graph and need to run an algorithm on it fast |
| 17:11 | balint | so I'm doing all this because I did not prevail with the functional (meaning: using persistent data structures) method |
| 17:11 | balint | by huge I mean ~800.000 vertices |
| 17:11 | brehaut | did *warn-on-reflection* tell you it was reflecting on those calls? |
| 17:12 | balint | and running the current version I saw in the profiler that ~60% of CPU time is spent in reflection.getMethods() (or sg similar) |
| 17:12 | balint | brehaut: exactly |
| 17:12 | nDuff | balint: if I define finished with (into-array Long [...]), that code compiles perfectly. |
| 17:13 | balint | mpenet: this is how I defined finished: (let [finished (long-array V) …]) |
| 17:13 | nDuff | ...same with (into-array Long/TYPE ...) |
| 17:14 | balint | nDuff: I want to allocate an array of a certain size that I know in advance |
| 17:16 | nDuff | balint: *shrug*. Works for me. |
| 17:16 | balint | nDuff: the definition of the array works for me, too |
| 17:16 | mpenet | balint: it's another of the args of aset then that could cause problems |
| 17:17 | balint | it's the "set-finished" code snippet (see above) that throws the reflection warning |
| 17:17 | balint | this does not issue warnings: |
| 17:18 | balint | set-finished (fn [^long offset ^longs values] |
| 17:18 | balint | (doseq [idx (range (count values))] |
| 17:18 | balint | (aset ^longs finished (+ offset idx) 0))) |
| 17:18 | balint | I replaced (nth values idx) with 0 in the last line |
| 17:19 | amalloy | balint: why are you writing this function at all? just use System/arraycopy |
| 17:20 | amalloy | it takes all the args you need to do offset/slice copying |
| 17:20 | balint | amalloy: thank you |
| 17:20 | balint | my java foo is very basic |
| 17:20 | amalloy | $javadoc System arraycopy |
| 17:20 | lazybot | http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#arraycopy(java.lang.Object,%20int,%20java.lang.Object,%20int,%20int) |
| 17:20 | nDuff | "java fu", btw |
| 17:21 | balint | nDuff: you're wright ;) |
| 17:22 | amalloy | or use java.util.Arrays/copyOfRange if you don't need to allocate the object yourself |
| 17:33 | owengalenjones | llasram: ha, actually this was the culprit: http://stackoverflow.com/questions/12924870/leiningen-uberjar-different-results-from-lein-run |
| 17:34 | balint | amalloy: thank you, the first part of the algorithm just ran in 11 seconds |
| 17:34 | balint | before it would have taken ~20 hours :) |
| 17:34 | balint | there is some speedup to be had in using java arrays, it seems |
| 17:40 | Frozenlock | In the *nrepl* buffer, when I try to autocomplete a namespace that's required but not :as, I get a java.lang.ClassNotFoundException. IIRC, that wasn't the case in swank; is it normal in nrepl? |
| 17:40 | Frozenlock | For example: (clojure.string/<TAB> *BOOOM!* |
| 17:40 | xeqi | Frozenlock: what version of nrepl.el? |
| 17:40 | tgoossens | I suppose that some of you try to put as much immutability in java as well. |
| 17:40 | tgoossens | I was wondering |
| 17:40 | xeqi | I remember that happening on an older version for me |
| 17:40 | clojurebot | version ranges are nothing but trouble: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html |
| 17:40 | Frozenlock | 0.1.7-preview |
| 17:41 | tgoossens | if you are making immutable classes in java. Why not just make the (internal (final)) fields public? |
| 17:41 | tgoossens | i've always learned that making getters is a good practice |
| 17:41 | tgoossens | but is it really necessary here? |
| 17:43 | tgoossens | because seriously, currently i can think of no reason why a public field would be bad in case of an immutable java class |
| 17:44 | amalloy | tgoossens: indeed, when i define a java class that is really immutable, i don't write any getters |
| 17:45 | amalloy | getters are an OO idealism - in theory it would be nice if stored fields were indistinguishable from computed values (everything is just a message), but in practice no java code does that |
| 17:46 | xeqi | tgoossens: because then you can't lazily compute the field? |
| 17:46 | tgoossens | however "the good practice" i learned makes me feel bad sometimes. What if the string representation you chose of lets say an "Address" would be better with an Address class |
| 17:46 | tgoossens | then what? |
| 17:46 | tgoossens | my current idea is |
| 17:46 | tgoossens | you define a new immutable class |
| 17:48 | xeqi | Frozenlock: I'm on 0.1.7 for what its worth |
| 17:48 | borkdude | getters/setters is one of the things that's hard to sell when I introduce first year students with java.. |
| 17:49 | Frozenlock | xeqi: Hmm.. I'll try to update then. Thanks |
| 17:50 | djpowell | java beans were basically an alternative to activex components, a convention for making ui components for an ide. at some point people got confused and decided it was the basis of good oo design |
| 17:50 | tgoossens | borkdude: i'm currently in discussion with someone about the topic :) |
| 17:51 | djpowell | http://www.javaworld.com/jw-09-1997/jw-09-beanbox.html |
| 17:52 | borkdude | tgoossens some frameworks make use of getters/setters, but that's more like "do it, because people expect you to" |
| 17:53 | borkdude | tgoossens C# has a somewhat more polished version of this called properties |
| 17:53 | tgoossens | properties if i recall ? |
| 17:55 | borkdude | what is pedestal.io about? how does it relate to the existing clojure common webstack? |
| 17:56 | tgoossens | borkdude: what did you say on twitter about programming :p ? (and what did i respond!) |
| 17:56 | borkdude | tgoossens I'm not programming |
| 17:56 | borkdude | =) |
| 17:57 | abp | borkdude: It's neatly integrating stuff and solving major pain points. |
| 17:58 | abp | Funny thing is, I were working on a vector based routing dsv too, as well as other structural helpers. |
| 18:05 | devn | hyPiRion: Ever get a chance to look at http://dev.clojure.org/jira/browse/CLJ-1181 ? |
| 18:06 | borkdude | abp I'm reading about the ring handler vs interceptors thing now |
| 18:07 | hyPiRion | devn: oh, sorry |
| 18:07 | hyPiRion | I can do a peek at it now |
| 18:08 | devn | hyPiRion: no rush, just doing some "effective badgering" |
| 18:09 | hyPiRion | heh |
| 18:11 | abp | borkdude: I'm reading up on routing, need to go back to interceptors after that. |
| 18:11 | borkdude | abp first thought: are reducers used in here somewhere? :P but probably not |
| 18:49 | SegFaultAX | Did irccloud just die? |
| 18:50 | SegFaultAX | technomancy: I use irssi + znc, personally. |
| 18:52 | brainproxy | having trouble pulling in deps for the pedestal samples.. anyone else experiencing the same? |
| 19:05 | jonasac | any vim users here, particularly foreplay.vim/fireplace.vim ? |
| 19:05 | SegFaultAX | jonasac: Yes. |
| 19:06 | jonasac | SegFaultAX: have you found a way to set up a quasi repl when you are not in a project, i.e the repl file is missing |
| 19:09 | ivan | heh http://bugs.sun.com/view_bug.do?bug_id=4909760 |
| 19:10 | tomoj | hmm.. interceptors |
| 19:12 | hiredman | continuations |
| 19:12 | tomoj | but with, uh.. reflection? |
| 19:25 | tgoossens | borkdude: i hope i didn't gave that other guy (in the discussion) nightmares |
| 19:30 | yedi | oh snap clojurewest is today? |
| 19:31 | brehaut | yes |
| 19:40 | yedi | probably will be a while before the vids come out though |
| 19:41 | Frozenlock | :( |
| 19:41 | yedi | oh what, why have i not heard of lobos before |
| 19:41 | brehaut | clojurewest is a bit snappier than the conj with vids |
| 19:41 | yedi | why am i messing with stupid sql scripts |
| 19:43 | abp | brehaut: Yeah but infoq delays them across the coming years. ;) |
| 19:43 | tieTYT | if this is a troll, it's not intentional, but: Between scala and clojure, which one is more functional? |
| 19:43 | yedi | lol |
| 19:43 | brehaut | haha |
| 19:43 | brehaut | well scala is marketed as being an object function hybrid, and clojure is marketed as function |
| 19:43 | brehaut | you decide |
| 19:44 | brehaut | however |
| 19:44 | hiredman | I suggest going to ask in #scala |
| 19:44 | technomancy | hiredman: heh; that would be amusing |
| 19:44 | brehaut | the scala guys have some amazingly functional libraries. |
| 19:44 | tieTYT | ok I shall |
| 19:46 | brehaut | from #scala "sproingie: |
| 19:46 | brehaut | modern thinking in FP is heavily oriented toward types, which clojure doesn't do" :) |
| 19:46 | Glenjamin | can anyone tell me why this doesn't eval? (-> :a (fn [b] (do (prn b) b))) |
| 19:46 | hiredman | macroexpand it |
| 19:46 | technomancy | brehaut: I've always thought that was a weird conflation |
| 19:47 | yedi | technomancy: where do you think the idea stems from? |
| 19:47 | Glenjamin | hiredman: oh right, i see |
| 19:47 | technomancy | kind of like how people think dynamic types are for "scripting languages" |
| 19:47 | Glenjamin | is there a way to define functions inline for threading? |
| 19:47 | Glenjamin | aha |
| 19:47 | Glenjamin | i need more parens |
| 19:47 | technomancy | yedi: because most FP research has been done by haskellers? |
| 19:48 | yedi | that's what i figured, but i wasn't sure if it was because FP researchers specifically chose haskell because of its strong typing you know? |
| 19:48 | yedi | like which direction the correlation goes |
| 19:48 | pjstadig | Glenjamin: i've been bit before by the fact that I think of -> as working with values at runtime, when, in fact, it is a macro |
| 19:48 | technomancy | it's a cultural thing mostly I think |
| 19:49 | Glenjamin | i'm now having an issue with -> on a multimethod |
| 19:50 | Glenjamin | lemme see if i can isolate a testcase |
| 19:52 | Glenjamin | right |
| 19:52 | Glenjamin | https://gist.github.com/glenjamin/3a2fb21af6462a4ac6da |
| 19:52 | Glenjamin | can anyone explain to me why this isn't allowed? |
| 19:52 | brehaut | technomancy: i agree. a bit odd |
| 19:52 | brainproxy | tomoj: the description of the interceptor stuff makes me think of the state monad, but with a dsl for controlling transition between steps in the computation |
| 19:57 | tieTYT | does clojure have algebraic data types and pattern matching? |
| 19:57 | Glenjamin | there's no pattern matching |
| 19:57 | hyPiRion | only destructuring |
| 19:57 | technomancy | pattern matching is in a library |
| 19:58 | Glenjamin | i believe while you can sort-of do ADTs, the general idea is to just use built-in types? |
| 19:58 | technomancy | since there are macros it doesn't need to be in the core language |
| 19:58 | tieTYT | i see |
| 19:58 | tieTYT | i think i'm going to learn clojure instead of scala. It's more alien |
| 19:58 | amalloy | Glenjamin: that gist has no meaningful content in it. all the -> form there does is expand to (render (:body {body "some string body"})), which is equivalent to (render "some string body") |
| 19:58 | tieTYT | and I like the inventor and his lectures |
| 19:58 | technomancy | pattern matching and FP is another weird conflation |
| 19:58 | technomancy | there's no reason you can't have pattern matches in imperative languages |
| 19:58 | amalloy | whether that works or not has nothing much to do with -> |
| 19:59 | brehaut | technomancy: if one was a smartarse they would point to scala as example of that ;) |
| 19:59 | technomancy | brehaut: zing! |
| 19:59 | lovemuffin | i think its weird that lein isn't bundled with clojure binary |
| 19:59 | technomancy | what clojure binary? |
| 20:00 | brainproxy | lovemuffin: clojure is just a library |
| 20:00 | lovemuffin | i mean the release |
| 20:00 | amalloy | lovemuffin: the clojure binary is bundled with lein, so to speak |
| 20:00 | technomancy | it is kind of silly that clojure links to .zip file downloads =\ |
| 20:00 | brainproxy | lovemuffin: think of lein as a handy way to work with jars coming from maven, clojars, etc. |
| 20:00 | brehaut | technomancy: its the future |
| 20:00 | Glenjamin | amalloy: i've copied the definition of the required file in |
| 20:00 | brainproxy | including clojure itself |
| 20:00 | Glenjamin | i appear to be falling foul of some sort of compile-time type checking :s |
| 20:01 | brehaut | (note: future only with a mayan style calander) |
| 20:01 | lovemuffin | well as a new comer, it makes starting out more confusing, so i download clojure, no i need lein too apparently, what is lein? etc. |
| 20:01 | technomancy | lovemuffin: clojure.org is really a bad place for newcomers |
| 20:01 | technomancy | unfortunately |
| 20:01 | tomoj | brainproxy: the state monadiness I see is maybe the manual dynamic binding conveyance? |
| 20:01 | brainproxy | lovemuffin: you can get up and running with lein super fast |
| 20:02 | brainproxy | lovemuffin: basically download the lein script, chmod +x, run it and it will bootstrap itself |
| 20:02 | technomancy | much better to start from clojure-doc.org |
| 20:02 | brainproxy | lovemuffin: at that point you can start playing w/ clojure immediately simply by running `lein repl` |
| 20:02 | lovemuffin | i got that far now, i'm just more commenting as a new comer, in other languages, most of what you need comes with the release package to start trying it out |
| 20:02 | Glenjamin | finding the "you're new, do this" guide was far harder than it should have been |
| 20:03 | brainproxy | sure, that's fair criticism |
| 20:03 | Glenjamin | google throws up lots of outdated tutorials |
| 20:03 | lovemuffin | Glenjamin: yea, i mean i found it, but it took a few clicks |
| 20:03 | technomancy | lovemuffin: unfortunately no one in here has the ability to fix clojure.org |
| 20:03 | technomancy | I think we all agree though |
| 20:03 | brainproxy | lets take it over w/ a stampede of lambdas |
| 20:03 | Glenjamin | needs more blogs and link backs to clojure-doc.org i guess |
| 20:04 | hiredman | b/win 15 |
| 20:04 | brainproxy | tomoj: i saw it in the description of how interceptions are chained |
| 20:04 | brainproxy | *interceptors |
| 20:07 | yedi | whose behind clojure-doc.org |
| 20:07 | tomoj | what's the state? |
| 20:07 | yedi | who's* |
| 20:08 | Glenjamin | aaah, "No single method" means "no method with arity 1" |
| 20:08 | NeedMoreDesu | (Thread. (fn[] (/ 0 0))) -- can I print stacktrace, given a thread? |
| 20:09 | pjstadig | (Thread. (fn [] (try (/ 0 0) (catch Exception e (print-it))))) |
| 20:09 | yedi | has anyone checked out pedestal's clojurescript methodology/philosophy? and if so what do you think? |
| 20:09 | tomoj | I mean, if the state is the context, then we have `do _ <- interceptorA; _ <- interceptorB; ...`, i.e. `interceptorA >> interceptorB >> ...`? |
| 20:10 | NeedMoreDesu | pjstadig: Can I do it from other thread, given thread object? |
| 20:10 | hiredman | more like some combination of state and continuation |
| 20:10 | tomoj | still, what's the state? :) |
| 20:10 | pjstadig | (.setUncaughtExceptionHandler t some-handler) |
| 20:11 | pjstadig | there's also (Thread/setDefaultUncaughtExceptionHandler some-handler) |
| 20:11 | hiredman | tomoj: it sounds like the thing the docs call the `context` |
| 20:11 | pjstadig | NeedMoreDesu: http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler) |
| 20:11 | hiredman | which is some combination of other stuff and ring's request and response stuff it seems like |
| 20:11 | tomoj | but isn't that just the argument and return types of the continuations? |
| 20:18 | tomoj | I was thinking maybe they looked like iteratees, and oleg says iteratees are state and cont monads |
| 20:18 | blr | Il0vemushr00ms |
| 20:19 | blr | sigh, wrong channel, sorry. |
| 20:20 | tomoj | so hmm, the context has both the state and cont bits, depending on where you look inside it? |
| 20:21 | tomoj | e.g. terminate is #(dissoc % :io.pedestal.service.impl.interceptor/queue) |
| 20:22 | ravster | hey, does anyone out here have experience with geohash-36? |
| 20:23 | amalloy | blr: time to change all your passwords |
| 20:24 | amalloy | ~anyone |
| 20:24 | 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 ..." |
| 20:25 | blr | amalloy: clearly I should have stayed in bed today. |
| 20:26 | mrowe | blr: "wrong channel"? which one did you mean to put it in?? :-P |
| 20:27 | blr | #sshpassworddisclosure |
| 20:30 | lovemuffin | so im new to clojure, i want to build a supervisor/worker type app, how can i use threads for this? is it a good idea? with processes if a worker spawned crashes thats ok, it wont crash the entire app, main process |
| 20:30 | ravster | amalloy_: just curious. no help required atm. |
| 20:30 | NeedMoreDesu | pjstadig: http://www.everfall.com/paste/id.php?g8m0uog0kp1d what am I doing wrong? |
| 20:30 | tyler__ | uh oh: Could not find artifact io.pedestal:pedestal.app:jar:0.1.0-SNAPSHOT in clojars (https://clojars.org/repo/) |
| 20:32 | NeedMoreDesu | lovemuffin: I'm writing supervisor/process/server stuff now. |
| 20:33 | lovemuffin | but i want to use threads instead of processes if possible, i just dont know if clojure provides a way to not crash the main process if a thread has some uncaught exception or whatever |
| 20:34 | NeedMoreDesu | lovemuffin: Oh. Plenty of ways. Like me sitting and trying to GET an exception. (.start (Thread. (fn [] (/ 0 0)))) |
| 20:35 | brainproxy | tomoj: right, so maybe more like the state transformer on the cont monad |
| 20:36 | NeedMoreDesu | lovemuffin: yet I had some problems with futures. |
| 20:37 | NeedMoreDesu | So now I stick to promises. |
| 20:38 | lovemuffin | are try catch finally close to being free, or that is no real performance cost for using it too much in clojure/jvm ? |
| 20:41 | jimkcar | anyone want to help me with parsing some basic XML? |
| 20:43 | devn | anyone looking at pedestal? |
| 20:44 | redinger | tyler__: In project.clj, change the dependency to be on io.pedestal/pedestal.app 0.1.0 (not the snapshot) |
| 20:44 | Frozenlock | devn: I've seen the announcement, but nothing on the homepage convinved me it was superior to the existing alternatives. |
| 20:44 | tyler__ | redinger: thn |
| 20:45 | tyler__ | thnx* |
| 20:46 | devn | Frozenlock: I think they're doing a poor job of marketing it. I listened to the podcast and some of the ideas were interesting. Ultimately it seems like something that I might use for a client app, but something that maybe doesn't translate to simpler use cases. For instance, being able to do some decision-making in the middle of ring's middleware to say I want to take a different path to get to my end state, etc. |
| 20:48 | devn | Frozenlock: I'm probably going too far by saying that. I guess at the end of a long day at work I just want my "blog in 15 minutes" to absolve me of any guilt for not having read all the source. |
| 20:49 | Frozenlock | I think your marketing critique is fair. If I need to read the source to understand why I should use it, I think something's wrong. |
| 20:49 | Frozenlock | I'm too lazy for that. |
| 20:49 | devn | Frozenlock: There are a lot of reasons why it's cool, in fact. I made a bunch of notes, but I still just want to see a quick walkthrough of building an app. |
| 20:49 | devn | not a finished example |
| 20:49 | brainproxy | currently, I think I'm basically doing something similar by combining liberator with a "monad sandwich" (using jim duey's protocol monads) |
| 20:49 | Frozenlock | Also the mention of datomic in the docs scared me. (not FOSS) |
| 20:50 | brainproxy | but my approach is very app-specific; if pedestal has made the approach general purpose, I may get on board |
| 20:50 | Frozenlock | devn: In screencast please! :D |
| 20:51 | devn | Frozenlock: Yeah it was interesting that during the podcast interview with Tim Ewald there was a question about "Why build this?" and Tim said: Well, because most anything these days that wants to see adoption releases its source. |
| 20:53 | devn | Not verbatim of course. I'm using my own interpretation. |
| 20:53 | blr | devn: is this intending to provide some kind of general purpose framework like rails? I thought that was antithetical to clojure philosophy |
| 20:54 | xeqi | blr: from outside of c/w and only seeing the docs on the website it describes itself as a framework |
| 20:54 | devn | blr: That's just hooey that old fuddy-duddies in the clojure community say a lot. Don't listen to that noise. The Clojure community is bigger than that now, I think. |
| 20:55 | devn | That's not to say it's a good or bad idea or anything. I agree with a lot of the "why" behind that sentiment. But it's a generalization. |
| 20:56 | joegallo | Bull5h!t |
| 20:56 | joegallo | dammit |
| 20:56 | devn | lol |
| 20:56 | joegallo | more passwords #clojure tonight |
| 20:57 | joegallo | lol |
| 20:57 | brehaut | joegallo: and yet, perfectly timed ;) |
| 20:57 | devn | brehaut: boo! |
| 20:57 | joegallo | oh well, i'm not changing it, it's a great password |
| 20:57 | brehaut | apparently im and old fuddy-duddie |
| 20:57 | brehaut | who believes in the hooey |
| 20:57 | devn | brehaut: there's enough dogmatism about libraries>frameworks that it's discouraging people from doing things they are interested in doing. |
| 20:57 | devn | I don't like that. |
| 20:58 | blr | joegallo: you did that just to make me feel better didn't you. |
| 20:58 | joegallo | nah, total coincidence, but it is hilarious |
| 20:58 | tyler__ | heh loaded up chat example for pedestal and it was like "not found" |
| 20:58 | brehaut | if people want to use rails, rails still exists. |
| 20:58 | clojurebot | max people is 317 |
| 20:59 | devn | brehaut: it's not about rails vs * |
| 21:00 | NeedMoreDesu | pjstadig: http://blog.jayfields.com/2011/01/clojure-using-java-inner-classes.html don't work for me. |
| 21:01 | devn | brehaut: if people want to build a big honking framework in clojure I don't see why anyone should discourage them from doing it. |
| 21:02 | brehaut | devn: if people want a sprawl mass of mutable state in clojure, i dont see why anyone should discourage them from doing it |
| 21:02 | brehaut | oh wait |
| 21:02 | devn | brehaut: at least it has namespaces. there are tradeoffs. |
| 21:02 | devn | brehaut: the overgeneralization is all im reacting to |
| 21:03 | devn | i hear this over and over again: "but people in clojure don't like frameworks, right?" |
| 21:03 | devn | it makes this community out to be a bunch of picky eaters who can't enjoy anything for what it is |
| 21:04 | noprompt | brehaut: i don't want to use rails |
| 21:04 | hiredman | devn: that is ridiculous |
| 21:04 | devn | hiredman: i agree |
| 21:04 | noprompt | brehaut: i maintain a few rails apps. it was cool at first but, yeah, i'll pass on it now. |
| 21:04 | hiredman | devn: what you are saying is ridiculous |
| 21:04 | brehaut | noprompt: i certainly dont want to force you to use rails |
| 21:05 | devn | hiredman: oh i know, just throwing some snark on the fire |
| 21:05 | noprompt | brehaut: hehe |
| 21:05 | brehaut | devn, im pretty sure all the non-picky eaters are over using PHP |
| 21:06 | devn | bash bash bash |
| 21:06 | noprompt | i'm excited about pedestal though. haven't had a chance to run through the docs yet. |
| 21:06 | noprompt | lol php |
| 21:06 | hiredman | picky eating is what keeps you from having poison control on speed dial |
| 21:07 | noprompt | brehaut: there are people in my town that will defend php to the death and burn you at the steak for talking bad about it. |
| 21:07 | amalloy | lovemuffin: try and finally are free. throw and catch are pretty expensive and shouldn't be used for ordinary flow control |
| 21:07 | noprompt | for some reason i can't get those people to show up to our local hacker meetup. |
| 21:08 | brehaut | noprompt: certainly. im not actually disparaging PHP per se there (though i do hate it), but its about the only language community which isnt picky about things |
| 21:08 | tyler__ | hiredman: not eating poison is what keeps you from having posion control on speed dial |
| 21:08 | thm_prover | I need to use OpenGL from clojure due to performance reasons. Should I go with JOGL or LWGJL ? |
| 21:08 | hiredman | amalloy: that is not strictly true, finally compiles down to a catch |
| 21:09 | amalloy | hiredman: for the "an exception happened" case, sure. but if no exception is thrown finally is free, isn't it? |
| 21:09 | hiredman | so finally has what performance characteristics a catch has |
| 21:09 | noprompt | brehaut: that's because they have no taste. |
| 21:09 | hiredman | amalloy: "throw and catch are pretty expensive" |
| 21:10 | weavejester | I think I need to try out Pedestal before I can form a good judgement, but there are a lot of things in there that seem… maybe like it's doing too much. |
| 21:11 | xeqi | (inc weavejester) |
| 21:11 | lazybot | ⇒ 7 |
| 21:11 | noprompt | one nice thing about frameworks though, is that i don't have to worry that the guy that takes over after i do will be up shit creek without a paddle. |
| 21:11 | hiredman | yeah, I am interested in interceptors as an async middleware model, but I don't want a new routing dsl, or the SSE stuff |
| 21:12 | noprompt | i have a few small apps that are hand rolled. they're documented, but i always worry it's gonna trip the next guy up. |
| 21:13 | weavejester | I'm a little suspicious of HTTP async (long polling etc.) in general. It's a lot of extra work to support what is essentially a protocol hack, and made largely obsolete by websockets. |
| 21:13 | devn | noprompt: I think that's where all of my rambling ultimately takes me w/r/t frameworks. |
| 21:13 | devn | Selling clojure work is made more difficult by a lack of consistency between projects. |
| 21:14 | xeqi | I've been directing new people towards http://www.luminusweb.net/ for the consistency reason |
| 21:15 | noprompt | devn: selling clojure to other devs has been tough for me in general. |
| 21:15 | noprompt | they just see lisp and shutdown |
| 21:15 | noprompt | running back to ruby or *shiver* python |
| 21:15 | devn | idk, to be clear I was not reacting to pedestal, just to the parrotted "libraries over frameworks" thing. i hear it over and over, and i don't think it's inspiring anyone. |
| 21:16 | noprompt | i've tried both approaches. and my favor tends to using libraries. |
| 21:16 | noprompt | maybe that's because i've been burned less in that department. |
| 21:16 | noprompt | rails has burned me so many times. |
| 21:17 | noprompt | once i spent 11 hours trying to figure out a character encoding problem. |
| 21:17 | brehaut | noprompt: my thought is that interesting things are different. if its not different to other things, why bother doing it |
| 21:17 | devn | let people build things and the ones that are "good" will get used. there doesn't need to be a set of requirements to building stuff in clojure. Stuart Halloway said "Clojure is a consenting adults language" a long time ago. I like the spirit of that. |
| 21:17 | noprompt | turns out the `raw` method in rails changes a strings encoding. |
| 21:17 | devn | brehaut: because sometimes the same thing can be done way, way better. |
| 21:18 | noprompt | brehaut: i can respect and agree with you there. |
| 21:19 | noprompt | brehaut: it's like the old saying. if there's anything worth doing... |
| 21:19 | brehaut | noprompt: exactly |
| 21:20 | noprompt | speaking of which vim-clojure-static will have over the top support for regular expression syntax highlighting soon :) |
| 21:20 | noprompt | spent about two weeks polishing it. |
| 21:21 | noprompt | out of curiosity does anyone know of a regex optimizer? |
| 21:22 | xeqi | weavejester: are there any plans for a hiccup2 w/ string escaping soon? Considering building a fork with some changes in https://github.com/ato/clojars-web/blob/master/src/clojars/web/safe_hiccup.clj, and would hate to find out it gets obsoleted in a month |
| 21:22 | clojurebot | fork is FORK IT, FORK IT NOW! |
| 21:22 | xeqi | clojurebot: spork it now! |
| 21:22 | clojurebot | <brehaut> sporks are half way between a spoon and a fork |
| 21:22 | blr | clojurebot is wise. |
| 21:23 | brehaut | O_o |
| 21:23 | noprompt | ie. given a some pattern, optomize it to reduce the number of backtracks, etc. |
| 21:25 | noprompt | guess i'm gonna have to roll up my sleeves :) |
| 21:26 | weavejester | xeqi: Sorry, I just haven't had any time to work on Hiccup. |
| 21:27 | amalloy | brehaut: apparently you were talking about emacs for macosx at the time, telling someone it was a proper build rather than a fork |
| 21:27 | brehaut | amalloy: huh. |
| 21:27 | brehaut | i presume it was only slightly more coherent at the time |
| 21:28 | xeqi | weavejester: np, just don't want to step on any toes |
| 21:28 | amalloy | brehaut: http://logs.lazybot.org/irc.freenode.net/%23clojure/2011-10-11.txt |
| 21:55 | tieTYT2 | what's the "n" stand for in defn? |
| 21:55 | yedi | def fn |
| 21:56 | tieTYT2 | ah :) |
| 21:56 | yedi | (def (fn [] "a function")) -> (defn [] "a function") |
| 21:56 | tieTYT2 | thanks |
| 21:56 | yedi | np |
| 21:57 | yedi | lol i forgot the names... oh wells |
| 21:57 | tieTYT2 | it's weird to me that clojure can do sequences of events in its functions (like a println). Seems imperative more than functional |
| 21:58 | tieTYT2 | maybe that's using monads like haskell does? |
| 21:58 | benmoss | its not a purely functional language |
| 21:59 | tieTYT2 | (defn foo [x] [x (+ x 2) (* x 2)]) |
| 21:59 | tieTYT2 | nm |
| 22:00 | tieTYT2 | well actually, when I typed "foo 3" into the repl instead of "(foo 3)" It returned 3. Why did it do that? |
| 22:00 | yogthos | cause you made 2 statements |
| 22:01 | yogthos | they're unrelated |
| 22:01 | yogthos | you said foo, then you said 3 |
| 22:01 | tieTYT2 | what did the first statement do? |
| 22:01 | yogthos | nothing |
| 22:01 | yogthos | you just referred to the symbol foo |
| 22:01 | yogthos | and it returned it |
| 22:01 | tieTYT2 | oh |
| 22:01 | tieTYT2 | ok |
| 22:01 | tieTYT2 | thanks |
| 22:01 | yogthos | should've looked something like #<repl$foo processing.repl$foo@1b42008f> |
| 22:02 | yogthos | in general your code is written as a tree |
| 22:02 | tieTYT2 | yep |
| 22:02 | yogthos | and whatever the last statement is in any function is what gets returned |
| 22:03 | tieTYT2 | why's that a tree vs a list? |
| 22:03 | yogthos | because you can nest statements |
| 22:03 | yogthos | (defn foo [x y] |
| 22:03 | yogthos | (println x y) |
| 22:03 | yogthos | (* y |
| 22:03 | yogthos | (+ x y))) |
| 22:04 | yogthos | for example foo has 2 nodes if you like println and * |
| 22:04 | yogthos | * has another node inside it that's + |
| 22:04 | tieTYT2 | oh |
| 22:05 | yogthos | so when you read the function you know that the output of println is discarded since it's on the same level as (* |
| 22:06 | tieTYT2 | why do i know that? Because the println comes first? |
| 22:07 | tieTYT2 | related to this, the tutorial says, "If you want to make an expression that has some side-effects before it evaluates to a value, use do:" But doesn't foo make an expression w/ side effects without using a do? |
| 22:07 | yogthos | right, if you have multiple statements on the same level, the last one is what's returned |
| 22:08 | yogthos | the reason you use do is for expressions which take exactly 3 values |
| 22:08 | yogthos | for example consider the if statement |
| 22:08 | yogthos | it goes (if foo bar baz) |
| 22:08 | tieTYT2 | ah "We say that let expressions and function bodies (and also loop expressions, which you'll read about later in Looping and Recursion) have an "implicit do": within them you can list expressions one after another, and they all get evaluated in order (presumably for the side-effects), but the last one is what determines the overall resulting value of the let expression." |
| 22:09 | yogthos | so if you wanted to print something you'd do (if foo (do (println "bar") bar) baz) |
| 22:09 | yogthos | right, so in let expressions, and function bodies you don't need a do |
| 22:10 | tieTYT2 | oh i think i get it |
| 22:10 | tieTYT2 | well sorta. I mean without the do, it would use the nil from the println? |
| 22:10 | yogthos | not quite |
| 22:11 | yogthos | the if example can only be done with a do |
| 22:11 | yogthos | because if expects 3 arguments |
| 22:11 | yogthos | println will always return nil, but if you put another statement after it, then that's what gets returned from the do block |
| 22:12 | yogthos | but pretty much the only time you need to use do is if you want to cause side effects such as printing |
| 22:12 | amalloy | i just had a funny idea: (defmacro do [& body] `(peek [~@body])) |
| 22:12 | yogthos | hehe |
| 22:14 | tieTYT2 | i'd like to test out this do, but lein repl doesn't have history when I press up. I'm using cygwin |
| 22:15 | yogthos | amalloy: so it keeps going until it hits the first function that returns something :) |
| 22:16 | amalloy | eh? |
| 22:16 | yogthos | tieTYT2: light table is not bad for playing around with stuff http://www.lighttable.com/ |
| 22:16 | yogthos | tieTYT2: it's very interactive |
| 22:16 | yogthos | amalloy: your do macro |
| 22:16 | thm_prover | is there any way to use opengl with clojure on java 7? it appears lwjgl requires jawt, which java 7 no longer supports; thus, any other options? |
| 22:17 | amalloy | yogthos: your statement doesn't seem related to any part of my do macro |
| 22:18 | yogthos | amalloy: if you give it (do "x" "y") it will hit x and return it right, but if you do (do (println "foo") (prinlnt "bar") "x") then it will print foo, bar, and return x |
| 22:18 | amalloy | no, it behaves exactly like clojure's built-in do |
| 22:19 | amalloy | it certainly isn't doing anything like `(first (remove nil? [~@body])) |
| 22:19 | yogthos | amalloy: doesn't peek just grab the last thing off the vector? |
| 22:20 | amalloy | yes |
| 22:20 | yogthos | oh yeah ok makes sense :P |
| 22:20 | amalloy | and the last thing in the vector ["x" "y"] is y, not x :P |
| 22:21 | yogthos | lol brain fart, forgot the rest will just execute themselves once the macro expands |
| 22:22 | nollidj | i'm working on a weekends-and-evenings web project to expand what i can use clojure for |
| 22:23 | nollidj | atm i'm trying to get a handle on rich webapp design with clojure |
| 22:25 | nollidj | i was hoping that there would be something gwt-like that would let me do something like: define rich page content in hiccup (or another html generator) plus clojurescript, and define backend behavior in clojure, all in the same project |
| 22:26 | yogthos | nollidj: take a look at http://www.luminusweb.net/docs |
| 22:26 | brainproxy | tieTYT2: that may be a cygwin issue, as `lein repl` on mac/linux offers history and some other niceties |
| 22:26 | nollidj | yogthos: thanks |
| 22:26 | yogthos | nollidj: no prob :) |
| 22:33 | tieTYT2 | brainproxy: yeah |
| 22:34 | tieTYT2 | also, if I type lein trampoline repl it errors saying: Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Unsupported character: \"0 |
| 22:35 | Frozenlock | http://swannodette.github.com/2013/03/09/logic-programming-is-underrated/ "ruleo" "peopleo" "earliero". Am I the only one who doesn't like the 'o'? :( |
| 22:38 | mrb_bk | Frozenlock: I don't mind it. |
| 22:38 | mrb_bk | Once I understood the difference between relational and non-relational functions, it helped to have a visual reminder of which one they were |
| 22:40 | nollidj | ah, nice. luminus lets me compile cljs to javascript assets i can include as resources, basicalaly? |
| 22:45 | tieTYT2 | found an answer to my repl history issue: http://stackoverflow.com/questions/15490555/how-can-i-get-the-lein-repl-history-to-work-in-cygwin/15490662#15490662 |
| 22:46 | technomancy | Frozenlock: I wish it would just use namespaces like the rest of clojure |
| 22:49 | yogthos | nollidj: yeah pretty much |
| 22:51 | yogthos | nollidj: your cljs will get compiled to the public/js folder and then you just use it like any other js from the client side |
| 22:51 | yogthos | nollidj: I never got around to making anything fancy for making a browser repl though |
| 22:53 | nollidj | yogthos: i see. thanks for the pointer |
| 22:53 | Frozenlock | technomancy: obligated capslock... NO NAMESPACE? o_O |
| 22:54 | yogthos | nollidj: just let me know if you find anything odd/missing in it :) |
| 22:54 | nollidj | yogthos: will do |
| 22:54 | yogthos | nollidj: awesome :) |
| 22:54 | nollidj | i had a bare-bones something going with ring+compojure, and i'll see what sort of sense i can make of how things are put together here |
| 22:55 | yogthos | nollidj: it's pretty much ring+compojure+lib-noir, so should look pretty familiar |
| 22:57 | nollidj | i hadn't looked at lib-noir yet, but yeah, it's not doing anything unexpected yet |
| 22:57 | nollidj | the last time i tried to get this project off the ground, noir was still the recommended thing to start with |
| 22:59 | yogthos | nollidj: bad news is noir got deprecated, good news is that most of the good stuff lives in lib-noir now, and I'm actively maintaining and adding to it with Raynes :) |
| 23:01 | adu_ | o no |
| 23:01 | adu_ | I loved noir |
| 23:01 | nollidj | yogthos: yes, i managed to catch up that much |
| 23:01 | Frozenlock | yogthos: I'm trying clj-pdf and I think :align in tables doesn't work. Am I too tired? Should I go to bed? |
| 23:01 | adu_ | I was going to use it for production |
| 23:01 | austinh | The only problem with the 'o' suffix in core.logic programs, in my opinion, is that lots of regular functions also end in 'o.' I don't think anyone has a problem with other mnemonics like '*' or '?'. |
| 23:01 | nollidj | thanks for all the hard work |
| 23:01 | Frozenlock | Other than that it's really nice ;-) |
| 23:02 | yogthos | adu_: not much changed, luminus works very similarly and batteries are included :) |
| 23:02 | austinh | I could see myself using a different convention, like '-o' or something completely different. |
| 23:02 | adu_ | so what should I be using instead? joodoo? |
| 23:02 | yogthos | Frozenlock: it should... :) do you have a snippet handy? |
| 23:02 | austinh | The 'o' in TRS is a superscript, in case anyone didn't know that already. |
| 23:03 | Frozenlock | austinh: or just '-' I don't pronounce '-' in my head when I read it :p |
| 23:03 | yogthos | adu_: if you liked noir I recommend http://www.luminusweb.net/docs |
| 23:03 | adu_ | yogthos: thanks :) |
| 23:03 | Frozenlock | yogthos: oh boy.. give me a minute. |
| 23:03 | yogthos | and for anybody who feels adventerous there's now http://pedestal.io/ |
| 23:04 | austinh | Pedestal sounds awesome. |
| 23:04 | yogthos | adu: also, I had a post on moving to compojure from noir http://yogthos.net/blog/33-Moving+to+Compojure |
| 23:04 | yogthos | adu: migth be handy |
| 23:05 | yogthos | Pedestal looks neat for sure, curious where it'll go |
| 23:05 | nollidj | is there any general understanding of where clojurescript one is headed? it seemed like it had some momentum, but i don't get the feeling that it's approaching critical mass |
| 23:06 | adu | iirc, joodo and noir confused me alot because they both use hiccup, ring and compojure |
| 23:06 | Frozenlock | yogthos: https://www.refheap.com/paste/12707 |
| 23:07 | Frozenlock | (same as your example, but with :align :right) |
| 23:07 | adu | are (hiccup, ring and compojure) now known as pedestal? |
| 23:08 | yogthos | adu: pedestal has its own stack it seems |
| 23:08 | adu | wut |
| 23:08 | yogthos | adu: it does play nice with ring though |
| 23:08 | yogthos | Frozenlock: ok let me see what's happening there :) |
| 23:08 | Frozenlock | yogthos: Ahhh my eyes! y u hate contrast? |
| 23:08 | yogthos | Frozenlock: hehe |
| 23:09 | yogthos | Frozenlock: what and where? :) |
| 23:10 | Frozenlock | Moving to compojure |
| 23:10 | yogthos | Frozenlock: ahh yeah theme's still work in progress :) |
| 23:11 | Frozenlock | Let's just say that the transition between solarized-dark and your blog was... brutal :p |
| 23:11 | yogthos | rofl |
| 23:12 | yogthos | Frozenlock: so with the table you just have to add width to it |
| 23:13 | adu | Frozenlock: http://eclipsecolorthemes.org/?view=theme&id=1115 ? |
| 23:13 | yogthos | Frozenlock: by default it will expand to the width of the page |
| 23:13 | yogthos | Frozenlock: width is in percentage of page width so if you do :width 50 it'll take up half the page and if you have :align :right it'll be on the right |
| 23:14 | yogthos | Frozenlock: and yeah that would hurt :P |
| 23:14 | Frozenlock | adu: Yes, but for the awesomer emacs |
| 23:14 | adu | oic |
| 23:14 | adu | I use emacs |
| 23:14 | adu | alot |
| 23:14 | yogthos | I'm just holding out for light table to get more stable now ;P |
| 23:15 | adu | my work bought me IntelliJ, but I still use Emacs |
| 23:15 | Frozenlock | yogthos: Ahhh! I thought I could align the 'text' to the right, not the table. My apologies. |
| 23:16 | zakwilson | nrepl.el seems to be pretty bad at displaying function documentation in the minibuffer while editing source buffers. It shows up sometimes and not others, and it's slow. |
| 23:16 | Frozenlock | Doc in the minibuffer, or the arguments? |
| 23:17 | adu | yogthos: why is the delete button visible when I'm not even logged in to your blog? |
| 23:17 | yogthos | adu: probably a bug :) |
| 23:18 | adu | yogthos: and at the bottom it says "Commenting as Yogthos" |
| 23:18 | Frozenlock | adu: Why is the 'logout' button visible? :P |
| 23:18 | adu | Frozenlock: yes |
| 23:18 | yogthos | oh dears :P |
| 23:18 | Frozenlock | Yup I also have "Commenting as Yogthos" |
| 23:19 | adu | yogthos: I think you need to work on your auth |
| 23:19 | yogthos | haha I think it's my brilliatn content caching :P |
| 23:19 | yogthos | lol try actually comment |
| 23:19 | yogthos | curious |
| 23:19 | Frozenlock | Now, where is the button "bank transfer"? |
| 23:19 | yogthos | hahaha |
| 23:20 | austinh | Does anyone have any nrepl.el customizations in .emacs, beyond what is here?: https://github.com/kingtim/nrepl.el |
| 23:20 | adu | yogthos: oh content cache would explain it too |
| 23:20 | yogthos | that's an interesting artifact of content caching ;) |
| 23:21 | austinh | Specifically, I'd like to disable the highlighting of errors, and whatever causes *nrepl-error* to be removed from my buffer history. |
| 23:21 | yogthos | I guess I should really not cache stuff for the admin |
| 23:22 | yogthos | but now you can see how the admin ui works :P |
| 23:22 | adu | heh |
| 23:22 | adu | well, I tried submiting as you, and I can't |
| 23:22 | zakwilson | Frozenlock: arg list |
| 23:22 | adu | so it must be caching |
| 23:22 | yogthos | yeah it is |
| 23:22 | yogthos | lol did get a bit of a scare though :P |
| 23:22 | tieTYT2 | haskell has foldl and foldr, looks like clojure just has reduce. How do you do something like foldr? Reverse the list first? |
| 23:24 | Frozenlock | zakwilson: For me it only shows up in the *nrepl* buffer... need to tweek my .emacs I think. |
| 23:26 | Frozenlock | Added (add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode) and now it's purrrrfect. |
| 23:26 | devn | pedestal is pretty cool |
| 23:26 | austinh | tieTYT2: There is some discussion here: https://groups.google.com/forum/?fromgroups=#!topic/clojure/MizwTxHwLE4 |
| 23:26 | Frozenlock | devn: I'm still waiting for a screencast :P |
| 23:26 | devn | Frozenlock: that's all well and good, but it's nice code, interesting ideas |
| 23:26 | devn | kind of a fun read |
| 23:27 | yogthos | I'd like to see more examples :) |
| 23:27 | yogthos | the chat server is a bit busy |
| 23:27 | devn | i think that's the consensus and i agree |
| 23:27 | devn | but it's cool to read |
| 23:27 | yogthos | indeed |
| 23:27 | yogthos | the routing is nifty |
| 23:27 | tieTYT2 | hehe i'm reading that |
| 23:27 | zakwilson | Frozenlock: yeah, that seems to make it work. I could swear it was working some of the time and not others before though, and it's still slower than Slime. |
| 23:27 | devn | oh im talking about the app_tools code right now |
| 23:27 | tieTYT2 | i would think haskell would have the same issue |
| 23:28 | tieTYT2 | why does this snippet use def and not defn: (def fewer-args (partial lots-of-args 10 20 30)) |
| 23:28 | tieTYT2 | that reminds me of haskells point free notation |
| 23:29 | Frozenlock | yogthos: Is there a way to align stuff to the right (or center) in clj-pdf tables? |
| 23:29 | yogthos | Frozenlock: text wise? |
| 23:30 | Frozenlock | yes |
| 23:30 | yogthos | Frozenlock: I think so, have to take a look |
| 23:39 | yogthos | Frozenlock: so yeah in tables things seem to get a bit funky unfortunately |
| 23:41 | adu | who was asking for reduce-right? |
| 23:41 | adu | tieTYT: https://www.refheap.com/paste/12708 |
| 23:41 | Frozenlock | yogthos: aww, only bummer in what was otherwise a flawless experience ;-) |
| 23:42 | tieTYT2 | adu: me |
| 23:42 | yogthos | Frozenlock: hehe yeah I figured out how to get around a lot of itext weirdness, but not this one :) |
| 23:42 | tieTYT2 | adu: thanks, you also taught me how to define variable length functions |
| 23:42 | tieTYT2 | i thought you do that with the [& rest] |
| 23:42 | adu | tieTYT2: yeah, they're pretty nice |
| 23:43 | tomoj | we should be able to do much better than reverse in some cases :( |
| 23:43 | adu | scheme calls them case-lambda's |
| 23:43 | tieTYT2 | i see |
| 23:43 | tieTYT2 | afaict, haskell didn't have variable length functions |
| 23:43 | yogthos | Frozenlock: looks like might be an easy fix actually http://www.docjar.com/docs/api/com/lowagie/text/Cell.html |
| 23:43 | tieTYT2 | nor overloading |
| 23:43 | adu | nope |
| 23:43 | adu | tieTYT2: actually it does have overloading |
| 23:43 | tieTYT2 | how? |
| 23:43 | clojurebot | with style and grace |
| 23:44 | adu | tieTYT2: because haskell has pattern matching |
| 23:44 | yogthos | Frozenlock: the cell has an horizontal align property that I'm just not using, let me see if it does what it looks like it should :) |
| 23:44 | tieTYT2 | how's that overloading? |
| 23:44 | adu | tieTYT2: you could have (Either A B) as the declared type, then f (Left x) = implA, f (Right y) = implB |
| 23:45 | tieTYT2 | yes but i don't consider that overloading |
| 23:45 | adu | tieTYT2: oh ok, i do |
| 23:45 | tieTYT2 | because you still have to pass in an Either |
| 23:45 | tieTYT2 | if you could pass in a String, i'd consider that overloading |
| 23:45 | adu | tieTYT2: that's what typeclasses are for |
| 23:45 | tieTYT2 | yeah |