#clojure log - Mar 21 2013

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:01 technomancy: rplaca: not sure off the top of my head, but inspecting the implementation of the classpath task would make it pretty clear

0:02 ugh; can you imagine the uproar if they charged for videos?

0:06 tieTYT2: did lein USED TO put libraries in a lib folder?

0:06 TimMc: tieTYT2: Yeah, in version 1.x.

0:06 tieTYT2: ah this explains a lot

0:07 i'm trying to figure out how to use La Clojure with lein together

0:07 people keep saying to include the lib folder and logically i know that wouldn't do anything

0:09 ah i think i figured it out

0:10 TimMc: tieTYT2: There's a huge amount of bad information on blogs, by the way.

0:11 (Mostly just horribly outdated.)

0:11 tieTYT2: i see

0:11 ugh intellij wants the .bat file, lame

0:11 i'll download that separately

0:17 tomoj: &(into [] (reify clojure.lang.ISeq (seq [this] this) (first [_] 42) (next [_])))

0:17 lazybot: ⇒ [42]

0:17 tomoj: in 1.5, the reason this works is that CollReduce is extended to Object by a seq-reduce impl

0:18 is there another sane way around that problem?

0:20 TimMc: What *is* the problem?

0:20 tomoj: making all ISeq implement CollReduce

0:21 relying on the fact that ISeq is an interface and extending CollReduce to it is cheating

0:22 tyler: whats the best way to turn a NodeList into an ISeq?

0:22 i tried js->clj but it returned a NodeList again?

0:24 n/m ust found some code that extended NodeList

0:24 just*

0:25 tomoj: extending NodeList is weird

0:25 and many other weirdnesses for cljs

0:26 I mean, none of us own NodeList, so by the old rules only clojurescript core should extend core protocols to NodeList

0:27 I guess it's like data_readers.clj, you can only extend in code you don't release as a library?

0:28 you can't put the extends under the top level in cljs so.. :/

0:28 well you could put them in a macro

0:29 * tyler is implementing facebook login button in clojurescript heh

0:29 tyler: its like 8 lines and its soooo ugly *cringe*

0:29 the javascript that is

0:30 the clojs is decent i think its actually less than the javascript heh

0:30 cljs*

0:30 Raynes: muhoo: ping

0:31 muhoo: Raynes: yo

0:31 Raynes: muhoo: How are things in San Francisco?

0:31 muhoo: raining ATM. how's life in "the southland"?

0:31 Raynes: Not raining.

0:32 muhoo: I've got a cover here that I don't completely hate. Wanna link?

0:32 tieTYT2: anyone here use La Clojure? I can't figure out how to get a REPL to use the load the files in my project. It seems to startup in a blank state

0:32 muhoo: Raynes: sure, let's hear it!

0:43 clintm: What's the equivalent of (progn in clojure? I'm using hiccup, and trying to do something like (if x [:li] (progn [:li] [:li])). I searched, and most places said to use (do) but it only gives the last value.

0:44 tieTYT2: this looks convenient: http://richhickey.github.com/clojure-contrib/duck-streams-api.html

0:44 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/duck-streams-api.html and try to stop linking to rich's repo.

0:44 tieTYT2: why can't i use this?

0:44 (require 'clojure.contrib.duck-streams)

0:44 FileNotFoundException Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath: clojure.lang.RT.load (RT.java:432)

0:45 oh, deprecated :(

0:54 tolstoy: clintm: I think you can do something like(if x [:li] (html [:li] [:li])).

0:55 clintm: I don't think using a "do" would work.

0:57 amalloy: clintm: do is exactly like progn, and thus won't do what you want in your if

0:57 you just want (list [:li] [:li])

0:59 clintm: (list) was it. Thanks, amalloy, and tolstoy!

0:59 tolstoy: Ah, good!

1:14 lovemuffin: hey, for the barrier of entry for clojure, do beginners usually say there's too many reader macros, and probably even macros ?

1:16 #() #{} ~ ^ @ #"" ~@ #' ' ;

1:16 heh

1:16 its hard to remember what all that means , i guess i'll remember as i use them, but yea

1:16 clintm: I'm a beginner with clojure, but coming from cl, those all make a lot of sense. Would like to define my own, but I understand the logic behind not being able to.

1:17 lovemuffin: cl?

1:17 clojurebot: You just made an ad hoc, informally -specified, bug-ridden, slow implementation of half of that.

1:17 clintm: common lisp

1:17 lovemuffin: forgot 'x and `x on that list of macros

1:20 when reading some doc,tutorials what does the '&' mean? (lazy-seq & boidy)

1:22 tomoj: &((fn [& body] body) 1 2 3)

1:22 lazybot: ⇒ (1 2 3)

1:23 lovemuffin: ah so just variable number?

1:23 does it only ever apply to arguments ?

1:23 tomoj: well, it applies in many binding contexts

1:23 arguments are one

1:24 &(let [[foo & bar] [1 2 3]] [foo bar])

1:24 lazybot: ⇒ [1 (2 3)]

1:24 tomoj: &(for [[foo & bar] ["foo" "bar" "baz"]] bar)

1:24 lazybot: ⇒ ((\o \o) (\a \r) (\a \z))

1:26 tomoj: http://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring)

1:56 tieTYT2: check out the example of this library: https://github.com/nathell/clj-tagsoup Should I write my own function to extract the pieces I want to find, or if this library were better would it provide me with better functions to traverse the result?

2:00 xcv: Raynes: If you're here, I wanted to ask you which editor you're currently using (I read your blog posts earlier).

2:01 Raynes: xcv: Emacs with evil-mode. I like to think I have the best of both worlds.

2:01 Been using it for quite a while.

2:04 yunfan: Raynes: tried that evil mode

2:04 its cool but the way it implement it is not suit

2:04 Raynes: *shrug* works fine for me.

2:05 yunfan: it impl each :xyz by mapping xyz to a processing function, while in true vim, xyz might be a combination of three cmd

2:05 Raynes: I wasn't looking for an exact implementation of Vim in Emacs.

2:05 yunfan: so i think they need to provide a evil-cmd-eval instead

2:06 Raynes: I was more interested in functionality like text objects.

2:06 yunfan: ok just shout them from a vim user :]

2:10 noprompt: yunfan: Raynes: i gave emacs an fair shot but, yeah, the move from vim was too hard.

2:10 Raynes: I wasn't moving from Vim to Emacs. I went from Emacs to Vim for a few months then back to Emacs with evil-mode because I missed Emacs but also grew fond of various Vimisms.

2:11 noprompt: i've got a pretty good mash up of VimClojure, vim-clojure-static (for syntax and indention), and pairedit.vim

2:11 but i'm terribly jealous of emacs in many ways

2:11 Raynes: Vim is a perfectly acceptable editor for Clojure.

2:11 vim-foreplay makes it very nice I hear.

2:11 yunfan: noprompt: i want to move to that, since i started from vim not vi, in my opinion, vim is just a 3-mode emacs with specific keybinding, i like those keybindings and the 3-mode idea, i dont care the runtime

2:13 noprompt: you know, i tried fireplace, but ended up going back to VimClojure.

2:13 hats of to tpope though. that guy is an inspiration.

2:13 yunfan: then how's the vimclojure runs?

2:13 noprompt: yunfan: vimclojure is fine, but you have to put in some effort to get it set up.

2:14 yunfan: noprompt: so you prefer vim-clojure-static?

2:14 noprompt: i checked all the necessary parts in to my dotfiles repo so i don't have to fiddle with setting it up on different stations.

2:15 yunfan: noprompt: maybe we could reverse the ideas,

2:15 noprompt: yunfan: i prefer vim-clojure-static's syntax and indention files. i've been contributing to it as well so i'm a little biased.

2:15 that's all vim-clojure-static is btw. runtime files.

2:15 yunfan: noprompt: if the repl could support vi like keybinding just like the bash's vi mode, that would be nice too

2:16 noprompt: yunfan: then you want to use VimClojure.

2:16 yunfan: i am going to check if rlwrap has a vi mode

2:16 noprompt: but what i do is remote the indent, syntax, and ftdetect folders from the VimClojure dir and symlink the ones from vim-clojure-static

2:17 s/remote/remove

2:18 yunfan: why no one talks lighttable?

2:19 johnmn3: g'day

2:20 amalloy: yunfan: certainly rlwrap supports vim-ish keybindings

2:20 there's some incantation you can put in your ~/.inputrc to make it happen

2:20 yunfan: amalloy: can it launch a vi instanse?

2:21 johnmn3: I'm trying the new chat app for pedestal and I'm having some trouble getting it running on win 7, java 1.7.0_04

2:21 following the directions, after I run (watch :development) I get a constant flow of execptions

2:22 noprompt: light table is on the road to being awesome

2:23 windows *yikes*

2:23 johnmn3: its apparently in the split-path function of the build.clj file. there's a regex exception

2:23 noprompt: whats the regex?

2:24 johnmn3: (defn- split-path [s]

2:24 (string/split s (re-pattern File/separator)))

2:24 noprompt: you might want to update to the latest JDK

2:24 johnmn3: yea yea, I know

2:24 noprompt: the regex support has changed

2:24 i ran in to a similar issue not long ago

2:24 technomancy: the regex support changed in a minor java increment?

2:24 johnmn3: not only that, but there's a laundry list of vulnerabilities on this crusty old jvm

2:25 technomancy: the vulnerabilities are all in the browser plugin IIRC (except one in JMX)

2:25 yunfan: i just tried using clojure's regex matching instead of my python with sed scripting days ago, and got some performance enhancement

2:25 its good

2:26 johnmn3: is there a pedestal specific irc room?

2:26 noprompt: technomancy: i'm certain that it did because a regex like #"\p{IsISOControl}" raised warnings in 1.7.0_12-ea

2:26 but not in 1.7.0_17

2:27 technomancy: ouch

2:27 noprompt: correction to that #"\p{IsjavaISOControl}"

2:28 i spent the bulk of last week learning the dark depths of java's regex support.

2:29 johnmn3: on win7:

2:29 user=> (java.io.File/separator)

2:29 "\\"

2:29 user=> (re-pattern "\\")

2:29 PatternSyntaxException Unexpected internal error near index 1

2:29 \

2:29 ^ java.util.regex.Pattern.error (:-1)

2:29 guess I'll file a bug on github?

2:30 noprompt: yeah that makes sense.

2:30 it should be "\\\\"

2:30 johnmn3: oh, somebody already did.

2:31 noprompt: you have to escape the slash twice. once for the string and again for the pattern.

2:32 johnmn3: and that results in #"\\"... which should end up just being one escaped slash at runtime?

2:32 noprompt: you got it.

2:32 johnmn3: thank you noprompt

2:34 noprompt: i have an algorithmish question, if someone is open to it.

2:35 suppose i wanted to construct a #"a(b|c|d|e)" type of pattern from a vector of strings.

2:36 for example ["alpha" "alphonso" "albert"] should create #"al(ph(a|onso)|bert)"

2:37 what kind of algorithm would you consider for grouping like that?

2:37 any ideas?

2:38 amalloy: noprompt: i would generate #"alpha|alphonso|albert" and let the regex engine figure it out. it's smarter than either of us

2:38 noprompt: amalloy: not always, especially not for large expressions. you'll end up backtracking a lot.

2:39 but i know you're partly right.

2:40 even still the problem is interesting, no?

2:40 amalloy: sure

2:40 tyler: weird anyone notice funky thing with if statements in javelin?

2:40 (cell (if (= 4 facebook-status) (-> js/console (.log "wooo"))))

2:40 amalloy: i'd add each item to a prefix-trie and then walk over it to produce the expressions

2:40 tyler: i get console log woooo even though facebook-status is a cell with a string in it

2:40 amalloy: look up prefix trie algorithms/structures if you can't find one prebuilt that does what you need

2:41 noprompt: from what i understand about NFA engines, it that it would actually check alpha, then alphonso, and finally albert on the input string "albert" before finally succeeding.

2:41 amalloy: noprompt: for the bad algorithms used by modern engines, that is correct

2:42 see http://swtch.com/~rsc/regexp/regexp1.html for an interesting article about how simple regexes like yours could be done much, much faster, and were done faster decades ago

2:42 noprompt: amalloy: i would imagine the engine would probably parse the expression first and attempt to optimize it before compiling it.

2:43 look up the info. as always thanks. :)

2:47 johnmn3: arg... I hardcoded it in there:

2:48 (defn- split-path [s]

2:48 (string/split s #"\\"))

2:48 just to get it running... I deleted the old pedestal folders from my .m2 folder, did lein clean on both the pedestal folder and the chat-client folder... its still spitting the same error

2:50 noprompt: johnmn3: maybe just use Compojure :/

2:52 amalloy: the first few paragraphs of this article give me reason enough to explore this problem in greater depth.

2:53 my goal is to generate more efficient expressions when the patterns are large.

2:55 johnmn3: I figured it out... had to change my version number for app-tools in the project file

3:17 okay, I got it running and the chat app looks pretty smooth

3:20 I was actually in the midst of trying to create an instant messaging app for mobile devices using cljs. I might have to explore using pedestal

3:26 dspp: can anyone think of a good data structure to represent a family tree?

3:26 noprompt: amalloy: my C skills are way rusty but this article is awesome. where do you find this stuff?

3:27 amalloy: noprompt: i read it once several years ago, but more recently i remember someone linking to it in #clojure. i just keep my ears open

3:27 dspp: can someone repaste the link?

3:27 noprompt: amalloy: please tell me java uses the thompson nfa.

3:28 amalloy: nope. nothing modern/popular really does

3:28 afaik

3:28 noprompt: *head explodes*

3:28 amalloy: they're all just wrappers over the same C library perl uses

3:29 noprompt: is this underground information or something?

3:29 i mean, if the thompson nfa is superior why not use that?

3:30 the guys behind the engines surely know about this, right?

3:30 although it makes me happy to know awk and grep use it

3:31 amalloy: dspp: http://swtch.com/~rsc/regexp/regexp1.html

3:32 dspp: thanks

3:37 amalloy: i try to link to that article as often as i can, because now it's in the channel logs; i always forget what the "right" google search terms to find it are

3:37 and apparently i'm too much of a luddite to just bookmark it

3:40 dspp: i just did a search for "regexp faster" and it came up top, is that because i've visited it already?

3:41 same when not logged into google

3:41 i dont like bookmarks either

3:41 clutter :D

3:41 tyler: woohoo i crashed the JVM with clojurescript

3:41 achievement unlocked

3:42 Ember-: amalloy: wow, that was interesting read

3:42 tyler: ah it was in a c-lib

3:42 not in the actual JVM

3:43 Ember-: did not know about the Thompson NFA or the differences between programming language regexp implentations and unix awk etc

3:48 navgeet: Is it impossible to use push-thread-bindings without a matching call to pop-thread-bindings?

3:51 amalloy: navgeet: if you succeed in doing that, your lungs will leak

3:51 out your ears, and you will be able to smell colors

3:52 (you can probably do it, but you won't like the results)

3:53 navgeet: If I push a binding and then don't pop it, wouldn't it give me a single dynamically bound var?

3:56 tomoj: &(((comp (partial partial map) (partial partial map)) +) [[1 2] [3 4 5]] [[6 7 8] [9 10]])

3:56 lazybot: ⇒ ((7 9) (12 14))

3:56 tomoj: hmm

4:28 yunfan: i am reading the book "programming clojure 2rd edition" in the chapter 1, 1.2.2 which says therr's a sample (str *1 " and " *2 ), which run on my repl output different text

4:29 it seems *1 and *2 are empty, so what has changed ? my environment is clojure 1.4.0 laucnhed by lein repl

4:29 tomoj: &42

4:29 lazybot: ⇒ 42

4:29 tomoj: &*1

4:29 lazybot: ⇒ #<Unbound Unbound: #'clojure.core/*1>

4:29 tomoj: should've known

4:29 *1 points to the previous thing you evaluated in the repl

4:30 *2 to the thing before *1

4:30 yunfan: yes, but it's empty while i have output of the previous cmd

4:31 oop, i got it,

4:31 the sample which defined a function using println to output strings

4:32 while the eval of that function's return value is nil, so althought it outputs somethings, but *1 is nil

4:39 tomoj: do you have any earlier clojure version that (println "xxx") the expr itself's value is "xxx"

4:40 tomoj: I don't think that was ever the case. if it was, it was a long time ago

4:45 yunfan: then how the book use that sample

4:48 * yunfan it seems thats my fault, sorry

5:08 NeedMoreDesu: e

6:09 tsdh: technomancy: I've just added a pull request for clojure-mode that adds highlighting of grouping constructs in regular expressions similar to how it's done in elisp.

6:26 NeedMoreDesu: Hi. I've made some library, inspired by erlang's actor system. https://github.com/NeedMoreDesu/gen Need someone criticized me.

6:41 noprompt: tsdh: i recently did a lot of work on something similar for vim's handling of re in clojure. it was epic.

6:44 tsdh: noprompt: Oh, it was quite simple with emacs, especially as it was already implemented for elisp (but with a different regex syntax of course). ;-)

6:44 noprompt: tsdh: it looks far more pleasant that this monstrosity https://github.com/noprompt/vim-clojure-static/blob/71f1ae607223f91fbfe5c6617c59ffc581e5b195/syntax/clojure.vim#L77-L101

6:45 tsdh: so does the highlighting in emacs cover character classes, quantifiers, etc.?

6:46 i've always found that stuff helpful when working with re.

6:46 man elisp makes me so jealous.

6:47 tsdh: noprompt: Not yes, I just highlighted grouping constructs so far, e.g. in #"(?<aNamedGroup>foo|bar)" (?<aNamedGroup>, |, and ) are highlighted.

6:47 s/yes/yet/

6:48 Ditto for normal (, (?:, (?<=, (?<!, ...

6:49 noprompt: tsdh: if you have the nerve to attempt to properly cover 99% of the allowable unicode character classes, hehe, ping me.

6:50 tsdh: noprompt: I'm not going to tackle that before I've won some millions in the lottery. ;-)

6:51 noprompt: looking back on it, i think just matching \p{[a-zA-Z_]+} might have been fine

6:51 but i ended up generating it partly from the unicode spec https://github.com/noprompt/vim-clojure-static/blob/noprompt-regexp/clj/src/vim_clojure_static/generate.clj#L104-L122

6:51 constructing the patterns and checking if they were valid

6:52 nasty stuff.

6:52 we wanted to go for completeness and correctness though.

6:53 tsdh: Yep, most frequently the "only highlight 100% correct syntax" approach is doomed to be 100 times more effort than the simply approach that probably does the right thing in 99% of all cases.

6:54 noprompt: haha, indeed! and if the compiler/interpreter/reader throws and error the programmer can figure it out.

6:54 s/and/an

6:55 on the flip side though, i learned a lot of random stuff about unicode and regex in java.

6:57 btw if you do decide to plugin the unicode support, don't forget about the shortcut versions: \p[CLMNPSZ]

6:57 tsdh: Indeed, but there are still more enjoyable ways to nirvana.

6:58 noprompt: the only thing i don't know if i can solve is matching comments in (?x..) patterns.

6:58 that's a hard one.

6:59 tsdh: comments?

6:59 clojurebot: comments is http://www.cc.gatech.edu/computing/classes/cs2360/ghall/style/commenting.html

6:59 noprompt: well, there's an easy way, but it's probably not efficient.

7:00 tsdh: OMG, just seen it: (?#an-embedded-comment)

7:00 Crazy

7:03 noprompt: they're nice for when you want to explain why you're crazy to someone.

7:05 they'd be nicer if they only went to the next unescaped ) instead of the end of the line though.

7:06 ruby did a good job with that.

7:08 hmm, they seem to cause trouble with the clojure reader too.

7:09 pwned: what did ruby do?

7:10 noprompt: pwned: ruby has the ?# modifier which allows you to nest comments inside a regular expression.

7:10 %r{[a-z](?# This is a comment)}

7:11 pwned: noprompt: cool I had no idea

7:11 noprompt: java has the ?x which both ignores white space AND allows comments marked by # and continuing to the end of the line.

7:12 but going to EOL instead of just the next unescaped ) is a big downer.

7:12 pwned: http://rubular.com accepts it :D

7:13 noprompt: welp. i gotta get some sleep.

7:16 pepijndevos: does core.typed have type variables?

7:21 mpenet: pepijndevos: yes

7:21 pepijndevos: it's done with "All"

7:22 there are tons of good examples on this file: https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/ann.clj

7:22 pepijndevos: mpenet: I just started reading that

7:23 What si going on in the :fitler and :object things here? https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/ann.clj#L34

7:24 mpenet: I am not 100% familiar with objects yet, but there is some basic explaination in clojure-doc.org

7:25 pepijndevos: http://clojure-doc.org/articles/ecosystem/core_typed/filters.html

7:25 not :object I meant :filter

7:28 in short :then tells it's always true when it returns "not nil or false" and :else it's always false when it returns nil or false

7:28 :object {:id 0} I have no clue

7:29 pepijndevos: it's weird, I'd expect it to be just a -> a

7:29 mpenet: it's to allow better checking against filter for instance I would think

7:30 pepijndevos: ?

7:30 mpenet: falsy values

7:30 (filter identity map) etc

7:30 pepijndevos: hm

7:30 mpenet: but as I said I am still not comfortable with that stuff

7:32 pepijndevos: I seem to have read something about HMaps, but I can;t find it anymore

7:32 mpenet: http://clojure-doc.org/articles/ecosystem/core_typed/types.html

7:32 well it's very thin on explainations but at least it's mentioned there

7:34 pepijndevos: assoc doesn;t seem to be using the though...

7:34 https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/ann.clj#L102

7:35 mpenet: HMap is for heterogenous maps

7:35 assoc can work on any map

7:35 so it's more generic

7:35 pepijndevos: what maps are more generic that hetrogenous maps?

7:36 mpenet: assoc needs to work on maps with any mix of types in keys and vals

7:36 ex {1 :b [1 2 3] "asdf}

7:37 maybe generic was not the right term, it's confusing since it has a double meaning here

7:38 pepijndevos: In my dictionary, a map from a to b is homogeneous, all others are heterogeneous.

7:39 assoc seems to be about homogeneous maps, or is that not what (IPersistentMap b c) means?

7:40 clgv: pepijndevos: depends on what the surrounding (All [b c d] ...) means

7:40 mpenet: Yeah you're actually right. I am getting confused here

7:41 pepijndevos: :( I was very curious what the type of assoc on hetrogeneous maps would be.

7:42 clgv: pepijndevos: I think the "All" might be a mathematical all quantor so that the assoc annotation is indeed for heterogeneous maps

7:43 mpenet: I read it as some kind of declaration of type variables to be used in the annotation.

7:46 pepijndevos: clgv: a what?

7:47 clgv: pepijndevos: I just tried to find a definition for "All" but failed... :/

7:49 mpenet: but what I said earlier about assoc is still true, (HMap ...) will be mapped to one of the variables and it will just work with hetetogeneous maps too

7:49 clgv: pepijndevos: you could browse through ambrose's thesis to find the meaning of it

7:49 mpenet: heterogeneous*

7:49 pepijndevos: ok

7:52 mpenet: not "to one", to "the variables", but anyway

8:39 tgoossens: if you have a function valid-name? and a function set-name

8:39 if set-name uses internally the valid-name? function then it seems to me that you complect the setting of a name with the validation of a name

8:39 but

8:40 how can you prevent that you set an invalid name then?

8:40 one idea i have is

8:40 give validname function as a parameter

8:40 but then again, that isn't very robust?

8:40 but then again, how afraid are you of users?

8:40 (unnecessary paranoia)

8:41 clgv: tgoossens: you could use an approach similar to core.contracts I guess

8:42 tgoossens: hmm interesting

8:42 never heard of it

8:42 clgv: tgoossens: humm, the example on the readme does not look like, what fogus wrote in his blog a while ago...

8:43 tgoossens: clgv: at first sight it doesn't seem to solve what i'm trying to do

8:45 clgv: tgoossens: what I remembered is the following. you have your plain function and have a way to annotate that function with a pre and post validations. robert.hooke could be used to do that

8:45 tgoossens: hmm interesting

8:45 so you can do the following

8:46 you annotate a function and give that to a user

8:46 clgv: yeah. the function wrapped into a pre-post-valiadator...

8:46 tgoossens: is the original function modified?

8:46 or can i say

8:47 clgv: the variable of the original function gets modified if you implement it via robert.hooke

8:48 tgoossens: have you seen fogus' dire ?

8:48 clgv: tgoossens: "dire"? you got a link?

8:51 tgoossens: https://github.com/MichaelDrogalis/dire

8:51 sorry wrong name :)

8:52 i do not understand how that works

8:52 clgv: ah ok. thats the reason google found nothing meaningful ;)

8:52 he uses robert.hooke

8:54 tgoossens: hmmm

8:54 so what it does is

8:54 (defn functionX [a b ] .....

8:54 and ten

8:55 *Then

8:55 using hooks

8:55 you say

8:55 (hookstuff functionX ....)

8:55 and it will redefine

8:55 what functionX (in the namespace) means

8:55 by wrapping it

8:55 jimkcar: I'm creating some functions to make creating a java object easier in clojure. The question I have is what function name is preferred in the clojure world: make-object or create-object?

8:56 tgoossens: clgv: and changing what belongs to "funcitonX" in the current namespace

8:56 ok i just repeated myself

8:56 Chousuke: jimkcar: I'd go with make simply because it's shorter

8:57 noidi: jimkcar, make- seems to be more common in lisps

8:58 tgoossens: clgv: is that the idea ?

8:58 jimkcar: Chousuke: and you can type it faster because it uses both hands.

8:58 clojurebot: No entiendo

8:58 tgoossens: (def a 2)

8:58 (-> 3 (def a)

8:59 *

8:59 nvm

8:59 jimkcar: noidi: thanks! helping to settle debate here.

9:00 jcromartie: why does Midje autotest not autotest!?!?

9:01 i.e. midje.repl/autotest only seems to automatically test when all the tests pass the first time

9:03 actually it seems that the "auto" part of midje.repl/autotest just doesn't work in nREPL

9:03 probably because the testing happens in the background? and nREPL quietly disguises all of that?

9:04 it works fine from lein repl

9:04 blerg… this makes me want to abandon nrepl

9:15 * jcromartie just learned about clojure.core/locking

9:16 jcromartie: http://www.youtube.com/watch?v=q9r96cXx0OU

9:39 clgv: clgv: yeah, pretty much. but I did not read through the dire source

9:39 lol

9:39 tgoossens: ^^

9:40 jcromartie: isnt the midje plugin responsible for autotesting?

9:43 jcromartie: clgv: there's midje.repl

9:45 tgoossens: :)

9:46 clgv: jcromartie: yeah read about it. I didnt know it replaces the lein plugin completely... gotta upgrade soon

9:47 tgoossens: I would just strip the variable syntax from dire

9:48 tgoossens: only symbol would suffice. the macro can do variable resolution

9:55 tgossens: now I did read it... this line is strange https://github.com/MichaelDrogalis/dire/blob/master/src/dire/core.clj#L98 the rest looks straight forward

10:22 ravster: hello all

10:23 Frozenlock: hello you

10:23

10:47 jcromartie: so, in a Compojure app, I think it could be said that the routes and controller are sort of merged

10:48 because you just define a controller as a handler

10:48 maybe? I dunno

10:48 weavejester: Well… It really depends on what you as a developer want to do.

10:49 You could just pass the data directly through to another controller function.

10:49 The idea of routes in Compojure is more to isolate your internal logic from the HTTP request

10:49 jcromartie: hm yeah

10:50 weavejester: So ideally your route will get all the information out of the request it needs, and then pass that data to a function.

10:50 jcromartie: so what I'm doing right now is that I have a web/core.clj which wraps up all of the controllers/routes in web/routes/foo.clj etc.

10:50 so web/routes/foo.clj has (make-foo-api foo-state) which takes a reference to the state it nees and returns a handler

10:51 and web/core.clj does (defn make-app [foo] (context "/api/foo" (foo/make-foo-api foo)))

10:52 web/routes/foo.clj just defines its handler in terms of "/"

10:52 so it can be located anywhere

10:52 you could make two handlers using different state under different parent routes

11:27 devinus: technomancy: why is lein so awesome?

11:30 i wish there was a good complex numbers lib for 1.5 :(

11:30 hyPiRion: devinus: because you don't set your hair on fire? :)

11:31 ambrosebs: pepijndevos: I'd also like to see the type for assoc :) I need a dotted type variable that works with "pairs" of types.

11:32 pepijndevos: ambrosebs: so what does assoc currently do?

11:32 ambrosebs: pepijndevos: hacky special cases.

11:33 pepijndevos: It can assoc keywords to heterogeneous maps.

11:33 pepijndevos: it can also assoc onto IPersistentMap things

11:34 clgv: core.typed's "All" is just a bit of syntax around the internal Poly type.

11:35 pepijndevos: ambrosebs: hm. I think typed hetrogenous maps are/would be really powerful. I did some Haskell recently, and hte one thing I noticed is that everything is its own record, which is essentially a very inflexible and clunky heterogeneous map.

11:36 ambrosebs: yep, there's a good example in clojure.core.typed.test.compiler, there's a type for the CLJS AST nodes.

11:38 pepijndevos: HMaps are half baked at the moment. I don't know how to represent functions like assoc and update-in, and there's no way to express keys that are known *missing*.

11:39 pepijndevos: ambrosebs: I assume it also only works if the key you pass to assoc is constant, i.e. not (assoc (somefn) blah)

11:40 ambrosebs: pepijndevos: You only keep a HMap if you assoc on more keyword keys, yes.

11:41 pepijndevos: what do you mean by keys that are missing?

11:42 ravster: how do I view the binary representation of a number?

11:42 pepijndevos: A key that's missing has the type (value nil) right?

11:43 ravster: the Integer class has some method for this I believe

11:43 ambrosebs: pepijndevos: (HMap {:a Number}) guarantees that an :a is present, but makes no guarantees as to whether keys are absent.

11:43 pepijndevos: See this thread: https://groups.google.com/forum/?fromgroups=#!topic/clojure-core-typed/1OATmVMAYYw

11:44 pepijndevos: Currently the best we can do is Any, because we don't *know* if a key is absent.

11:45 ravster: thanks pepijndevos, will look into that.

11:46 pepijndevos: ambrosebs: why any? It's not suddenly going to return a string is it? It's either Number or nil.

11:46 ambrosebs: pepijndevos: Looking up :b in a (HMap {:a Number}) tells us nothing about :b's entry.

11:47 pepijndevos: uhm, right

11:48 So what you want from :optional is to say that *if* a key is there, it's an int?

11:50 ambrosebs: pepijndevos: Yes. I've only recently realised it doesn't quite work that way.

11:50 pepijndevos: I''d say (HMap {} :optional {:a Number :b Long}) should equal (HMap {:a (U Number nil) :b (U Long nil})

11:51 that way {:a :kw :b 'a} is not of this type, but :a might not exist, which is to say it retuns nil when looked up.

11:52 ambrosebs: pepijndevos: I don't like it, since there's no way to distinguish between a non-existent key and a nil entry. This is important for eg. `find`.

11:53 pepijndevos: (doc find)

11:53 clojurebot: "([map key]); Returns the map entry for key, or nil if key not present."

11:55 ambrosebs: pepijndevos: we can also specify a different default value with `get`.

11:56 pepijndevos: ambrosebs: I know. It just seems to me that nil is exactly intended to signal the absence of a value.

11:58 ambrosebs: pepijndevos: Yes, many Clojure idioms embrace this. However, there could be a situation where there is an important semantic distinction between a nil-entry and an absent one. The current types handle all these cases.

11:59 tsdh: Wasn't there some function combining filter and remove, similar to how split-with combines take-while and drop-while?

11:59 ambrosebs: pepijndevos: I try to be as explicit with `nil` as possible, also favouring more accurate types in general.

12:00 (doc group-by)

12:00 clojurebot: "([f coll]); Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."

12:00 ambrosebs: tsdh: group-by seems close.

12:00 pepijndevos: ambrosebs: I understand. Maybe a special Absent type? Hmmmmmm...

12:02 tsdh: if f is cheap (juxt filter remove) does the job. I seem to remember code-golfing this function with amalloy.

12:02 ambrosebs: pepijndevos: There's a quick-fix, and there's a more substantial one.

12:02 tsdh: ambrosebs: Hm, close.

12:02 pepijndevos: ambrosebs: the row polymorphism you mentioned?

12:03 ambrosebs: pepijndevos: that's the harder route, yes.

12:04 tsdh: pepijndevos: Yep, (let [[good bad] ((juxt filter remove) pred coll)] ...) will do.

12:04 ambrosebs: pepijndevos: if we have row polymorphism, we can say (All [r] (HMap {:a Number} :without [:b :c] :row [r])) for a map that has an :a, doesn't have a :b or :c, and can be extended with row r.

12:04 pepijndevos: Although, just looking at it, the row seems redundant now..

12:05 I'm still new to row variables.

12:05 Frozenlock: If any of you want to help a poor soul in need (me) with its Google problems https://news.ycombinator.com/item?id=5415995 :)

12:08 ambrosebs: pepijndevos: perhaps it's worth implementing :without for now

12:10 pepijndevos: ambrosebs: btw, I just checked out the repo and got a dependency error for tools.analyze

12:10 ambrosebs: pepijndevos: using lein?

12:10 pepijndevos: yea

12:11 oh, am I uspposed to use maven? That seems to be some sort of rule for contrib rpojects?

12:11 ambrosebs: no, maven doesn't work yet, I need some assistance to get it compiling.

12:11 * pepijndevos has a race condition in his typing

12:12 ambrosebs: pepijndevos: just having a look around for the issue

12:12 pepijndevos: you just need more xml I think…

12:13 ambrosebs: pepijndevos: hehe no it seems like a bug in Clojure's compilation.

12:14 pepijndevos: core.typed doesn't compile.

12:14 pepijndevos: seemed to work for me :/

12:14 Retrieving org/clojure/jvm.tools.analyzer/0.3.2-SNAPSHOT/jvm.tools.analyzer-0.3.2-20130321.151954-5.pom from sonatype-oss-public

12:14 Is that the version on the repo?

12:14 pepijndevos: let me try...

12:15 ambrosebs: pepijndevos: to be clear, use lein not maven.

12:15 pepijndevos: oh, works….

12:15 ambrosebs: :)

12:16 pepijndevos: the maven gods must have been angry or something

12:16 ambrosebs: I had some trouble deploying to sonatype a few hours ago, got a 401 error.

12:16 Perhaps it's just a bad day

12:20 mpenet: pepijndevos: the :object in the type for `identity` just says that the argument's "path" is preserved in the return type.

12:20 A path is an ordered sequence of operations from a starting point, say from a local binding.

12:20 (let [a (..)] (-> a :a :b :c))

12:21 The path of that expression would be (:a :b :c) from local `a`

12:21 pepijndevos: oh, uhm… nice?

12:22 ambrosebs: pepijndevos: `identity` isn't all that interesting, but it's useful for recovering the types of HMaps

12:22 We can do things like eg. (let [a (ann-form 1 Any) _ (assert (-> a :a :b :c))] ...) and infer that `a` is a 3 level deep hmap

12:24 pepijndevos: so wht would happen if identity did not have the extra stuff?

12:25 ambrosebs: pepijndevos: the :filters are the most useful part of identity's definition.

12:26 pepijndevos: although.. there is weirdness there too.

12:26 eg. (filter (fn [a] a) [...]) is more accurate than (filter identity [...])

12:27 I don't know how to solve that issue.

12:27 pepijndevos: O_o why is that?

12:30 TimMc: ambrosebs: wut

12:30 ambrosebs: pepijndevos: brief explanation here http://clojure-doc.org/articles/ecosystem/core_typed/limitations.html#using_filter

12:31 unforunately it seems the Typed Racket guys have put some thought into this problem and don't have a solution :(

12:32 TimMc: Oh, so (fn [a] a) won't Just Work, you also have to annotate it.

12:34 ambrosebs: TimMc: ah, yes forgot to mention that.

12:34 TimMc: It sucks, I'm working on an improved algorithm.

12:34 pepijndevos: But why is the type of the function important at all? The type of the output seq is always the same as the input seq, right?

12:36 I would think it's just [(Any -> Any) (Sequable a) -> (Sequable a)]

12:41 mpenet: ambrosebs: about :object what does the :id and :path key refer to exactly?

12:45 clintm: Yay, I figured out my problem whilst composing a clear, succinct question for this channel. IRC is the new/old rubber duck.

12:47 * clintm looks at dysinger...

12:48 * clintm turns off flyspell for irc...

12:49 ambrosebs: pepijndevos: The type you gave could never filter nils out of a (Seqable (U nil Number))

12:50 pepijndevos: ambrosebs: oh, so a filter can actually change the type… hmmmm

12:50 ambrosebs: mpenet: yes, there's no equivalent in typed languages I think.

12:51 mpenet: :id is a name of the local binding

12:53 mpenet: the idea behind objects is to track a local binding and the "path" you have travelled down it.

12:54 {:id 0} abstracts over the id of the first argument. In (let [a ..] (identity a)), {:id 0} would be instantiated to {:id 'a}

12:55 mpenet: ok, I suspected this was an arg index

12:55 ambrosebs: The simplest object is that of a local: (let [a ...] a) has an id 'a, and an empty path.

12:55 (let [a ...] (-> a :a :b)) has an id 'a and a path ((KeyPE :a) (KeyPE :b))

12:55 KeyPE = Key Path Element

12:56 There's also class path elements. (class a) has the object {:id 'a, :path [(ClassPE)]}.

12:56 You can combine them freely. (-> a :a :b class) works as you'd expect.

12:57 mpenet: To give some context, in Typed Racket they are most useful for tracks which car or cdr you are looking at of a pair.

12:58 They have CarPE and CdrPE

12:58 mpenet: ok that makes a bit more sense. I think. I can find documentation on this on Typed Racket doc I hope

13:00 ambrosebs: mpenet: I'm not sure. You may need to open a dissertation or a paper :)

13:04 mpenet: you'll probably almost never have to deal with objects directly.

13:04 mpenet: right :) well I think I will just avoid that for now, my plate of new things to learn is already quite full. This doesn't seem like something I will need for "everyday" typechecking though

13:04 good!

13:04 ambrosebs: mpenet: Objects should be almost completely invisible in everyday use.

13:13 tieTYT: if I want to parse html and query the structure, do you guys recommend enlive?

13:20 rplaca: current status: http://www.youtube.com/watch?v=0I6xkVRWzCY :)

13:32 tyler: would angular be considered FRP?

13:50 Bronsa: k

13:50 nollidj: i'm interested in using core.logic to do validation of user input on a complex form. i can express constraints on the form's field values in clojure. these constraints can get rather complicated. can i use core.logic not to tell me all sets of assignments that satisfy those rules, but to validate a set of assignments and explicitly enumerate violations of them (e.g., "your entries are bad because variable X exceeds variable Y, and variable Z isn't in the se

13:53 RainbowDash_: Hey guys

13:53 Does anyone here program in Turing

13:54 nollidj: i suppose i can use core.logic to validate a specific set of assignments by adding constraints in the form of explicit variable settings, and the question that remains is how to handle program failure effectively

13:54 RainbowDash_: Turing is the most up to date and best language you can program in do any of you noobs use it?

13:55 dxeh: no

13:55 just no

13:55 RainbowDash_: What's wrong with turing what are you some gay C++ user?

13:55 dxeh: well yes, i can program in c++, i used to program in turing when I was a youngster

13:56 tbaldridge: wait!....don't continue this debate until I pull out some popcorn...

13:56 dxeh: lololo

14:05 TimMc: technomancy: Do you know of a way I can specify additional clojure forms to indent like with-*?

14:06 technomancy: In Emacs, that is. I'd like directory variables that I can check in to this project so that my collaborators can just use normal clojure-mode.

14:08 * nDuff eyes add-custom-clojure-indents

14:08 nDuff: (which operates on clojure-defun-indents)

14:08 ...so I'd think you could add to the clojure-defun-indents list...

14:09 TimMc: try M-x customize-variable clojure-defun-indents

14:11 TimMc: nDuff: So in a dir-locals file, I would put (clojure-defun-indents . (do-monad ...))?

14:14 This is what I have so far, and it doesn't seem to have any effect: https://gist.github.com/timmc/5215321

14:14 (Emacs does pick it up.)

14:15 amalloy: TimMc: ((clojure-mode (clojure-defun-indents quote (at-revision)))) ;; this is in one of my .dir-locals.el files

14:15 Raynes: TimMc: Your Emacs is broken, effective immediately.

14:15 amalloy: it looks silly, of course, but that's equivalent to ((clojure-mode (clojure-defun-indents . '(at-revision))))

14:19 TimMc: nop

14:23 amalloy: customize-variable even shows the symbols, so I guess something else is wrong.

14:23 amalloy: TimMc: what happens if you add it yourself via the customize interface?

14:24 TimMc: It's already there. :-/

14:24 amalloy: so go to a different file

14:24 obviously that's not the final solution you want, but it will narrow down whether the problem is related to dir-locals at all

14:25 TimMc: OK, works now in that file.

14:25 I can't seem to get any consistency as to whether that variable is already set properly.

14:29 amalloy: All the examples I see for dir-locals use a pair for mode/varaibles

14:33 amalloy: okay? so does my example

14:33 TimMc: That's not what you pasted above.

14:33 That is, there's no dot after clojure-mode.

14:34 amalloy: TimMc: like i told you, (clojure-defun-indents quote (at-revision)) is just how the printer interprets (clojure-defun-indents . '(at-revision))

14:34 TimMc: Oh... you're also using one fewer set of parens.

14:34 amalloy: Yeah, that's not actually what I'm talking about, though.

14:36 amalloy: well, it's certainly possible my .dir-locals file is wrong

14:36 TimMc: (I mean, I'm not talking about that *part* of the snippet.)

14:36 amalloy: i was going through the same kind of confusion when i wrote it as you are now, and i might have just given up

14:37 * TimMc takes a deep breath and /joins #emacs

14:37 Bronsa: is github down only for me?

14:38 tieTYT: should clojure be added to this? http://en.wikipedia.org/wiki/Design_by_contract#Languages_with_native_support

14:46 S11001001: Bronsa: http://downforeveryoneorjustme.com/github.com

14:46 hyPiRion: Bronsa: not here

14:47 Bronsa: sucks to be me then i guess.

14:53 solussd: Why do I get a compilation error if I have a macro that expands into a form including (nil <some args...>), if that code path is never actually called (e.g. (defmacro callme [f] `(if ~f (f))) ) ?

14:54 i mean, I know that is what happens, but why? nil isn't a symbol like any other symbol?

14:55 hyPiRion: ,(if false (nil 1 2))

14:55 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>

14:55 hyPiRion: ,(if false (1 nil 2))

14:55 clojurebot: nil

14:55 solussd: :) my point exactly.

14:55 hyPiRion: uh, well, I thought that last one should crash.

14:56 ,(if false (unknown 1 2))

14:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: unknown in this context, compiling:(NO_SOURCE_PATH:0:0)>

14:56 hiredman: really the compiler should do a check for any kind of not IFn literal in the fun position and error on that instead of just special casing nil

14:56 solussd: this will work: (defmacro callme [f] `(let [f# ~f] (if f# (f#))))

14:57 even if I feed it nil

14:57 hyPiRion: Okay, that's strange. It somehow checks if the nil is used as calling element compile-time

14:57 ,(if false (true :?))

14:57 clojurebot: nil

14:57 solussd: ,(let [blah nil] (if blah (blah)))

14:57 clojurebot: nil

14:57 solussd: it really is a special case for nil

15:03 xeqi: solussd, hyPiRion: should the body be `(if ~f (~f))

15:03 ?

15:04 &user/nil

15:04 lazybot: java.lang.RuntimeException: No such var: user/nil

15:04 solussd: xeqi: hyPiRion: yes, but that still crashes

15:05 basically, if the compiler sees a form starting with nil, it throws an exception

15:05 any other symbol is fine-- I guess nil is a function literal?

15:06 ...or just a special case

15:06 hyPiRion: xeqi: I was merely curious why the behaviour solussd explained exists

15:06 ,(if false '(nil 1 2))

15:06 clojurebot: nil

15:06 hyPiRion: ,(if false (nil 1 2))

15:06 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>

15:06 hyPiRion: ,(if false (1 :this :is :somehow :okay 2))

15:06 clojurebot: nil

15:06 solussd: idk.. just annoying that I have to (defmacro callme [f] (let [f# ~f] (if f# (f#))))

15:07 technomancy: TimMc: I recommend just renaming your macros that need that to with-[whatever]

15:07 xeqi: hmm, that is strange

15:07 hyPiRion: solussd: Well, that's safer though

15:07 Okasu: ,({} [] ())

15:07 clojurebot: ()

15:07 hyPiRion: always `let` the values you unquote.

15:07 Okasu: ,({} ,,,,,,[] ,,,,,())

15:07 clojurebot: ()

15:08 solussd: hyPiRion: safe from what? If I'm splicing in the actual value, that's safe. :)

15:08 Okasu: ,`({},,,,,,[],,,,,(),,),,,,,

15:08 clojurebot: ({} [] ())

15:09 hyPiRion: ,(let [a (atom 1), f (swap! a inc)] `(if ~f (~f)))

15:09 clojurebot: (if 2 (2))

15:09 hyPiRion: god dangit

15:09 amalloy: technomancy: just one macro will do, har har: (defmacro with-indentation [& body) body) (with-indentation (my-macro foo blah))

15:09 hyPiRion: ,(let [a (atom 1), f '(swap! a inc)] `(if ~f (~f)))

15:09 clojurebot: (if (swap! a inc) ((swap! a inc)))

15:09 technomancy: amalloy: sweet

15:10 solussd: hyPiRion: ah, I see

15:11 what I'm splicing in is actually defined in a let (outside of a syntax quote) within my defmacro, so no worries in my case. :)

15:12 xeqi: solussd, hyPiRion: it appears to be a special case in the compiler https://github.com/clojure/clojure/blob/clojure-1.5.1/src/jvm/clojure/lang/Compiler.java#L6552

15:13 solussd: xeqi: thanks. i hate impl details.. :)

15:13 still wondering my the namespace used by def is determined at read time. :/

15:14 ohpauleez: lynaghk: ping

15:14 hyPiRion: solussd: for hygiene

15:15 solussd: but sometimes I have a macro that expands into a def form... and I want to control the namespace (not in "everyday" code, but in framework code)

15:16 hyPiRion: if I had (defmacro foo [a] `(last ~a)), and I used it somewhere where I exclude `last` and define my own `last`, then that is most likely not the intended behaviour

15:16 solussd: using intern is fine, but there are things built on top of def (defn, defrecord, etc)

15:17 Chousuke: you can temporarily switch namespaces perhaps

15:17 hyPiRion: use ~'foo instead

15:17 ,`(~'into ~into)

15:17 clojurebot: eval service is offline

15:17 hyPiRion: dangit clojurebot, ##`(~'into ~into)

15:17 lazybot: ⇒ (into #<core$into clojure.core$into@13968ec>)

15:18 hyPiRion: &`(~'into into) ;; I mean

15:18 amalloy: better still, don't write frameworks that depend on defining global symbols in someone else's namespace

15:18 lazybot: ⇒ (into clojure.core/into)

15:18 solussd: amalloy: it's defining symbols in my namespaces (that may or may not yet exist when the macro is expanded / result executed)

15:19 amalloy: yeah, i realize that. i'm recommending you not do that

15:19 solussd: amalloy: also, not library code, but building up models in a webapp

15:23 ozzloy: does clojure have a thing where it runs a vm in the background so you don't have vm startup overhead for every script you run?

15:23 tieTYT: ozzloy: i'm a newb, but that might be what trampoline does

15:24 at least I think trampoline is for solving the startup sepeed problem

15:24 amalloy: solussd: try reading "Why not to use my library clj-record": reflections from someone who did just what you're doing now, years ago, and why he thinks it's a bad idea

15:25 solussd: amalloy: I'm not packaging my code up into a library for other people t consume- I'm just drying up some repetition in defining model entities, validators, authorization checks, etc.

15:25 xeqi: tieTYT: not quite, it ends lein's vm before starting the project vm. Its for memory or stdin issues

15:25 solussd: but I'll read it. :)

15:26 xeqi: ozzloy: what do you mean by "script"?

15:26 tieTYT: xeqi: oh

15:28 ozzloy: tieTYT, cool, i'll look into that

15:28 solussd: amalloy: ok, this is good stuff- thanks

15:28 tieTYT: ozzloy: apparently i'm wrong about that

15:29 ozzloy: xeqi, by "script" i mean a job i run by hand every so often, like finding possible duplicates in my music collection

15:29 tieTYT, bummer

15:31 tieTYT: what does the ^ mean when it's used before a parameter in a function? Eg: [^String ...]

15:31 xeqi: tieTYT: thats a type hint for the next symbol

15:32 tieTYT: makes sense

15:33 xeqi: ozzloy: if its run by hand you could keep a repl open. if it is run through lein you might be able to use https://github.com/flatland/drip

15:33 tieTYT: xeqi: why doesn't it need a .?

15:34 mattmoss: tieTYT: the type hint isn't a method call… it's meta info

15:34 xeqi: tieTYT: a . ?

15:34 ah, interop call

15:34 tieTYT: yes

15:34 i thought . was for all interop, not just a call. That makes sense

15:36 seems to me that protocols are just like haskell's typeclasses

15:42 ozzloy: xeqi, i'll look into that

15:44 mikerod: Why am I getting this error: "CompilerException java.lang.RuntimeException: Unable to resolve symbol: defmacro- in this context, compiling:..."? This is in version 1.4. The Clojure docs has docs for defmacro- in version 1.2. Was it removed?

15:48 tieTYT: if a variable/function is wrapped in astericks, does that mean anything special?

15:49 joegallo: generally it means that you might consider rebinding that variable with a different value in order to get different behavior somewhere else in the system

15:50 tieTYT: is that simply a convention?

15:51 joegallo: yes, as i understand it, it's a very old lisp tradition

15:52 tieTYT: ok thanks

15:53 joegallo: you're welcome

15:57 xeqi: mikerod: it was part of a contrib library, which got split into seperate seperate smaller libraries that could get released on their own schedule

15:57 uvtc: I'm curious to hear how takeoutweight's talk about clojure-scheme turned out. What's the status of clojure-scheme? (Also curious about tbaldridge 's talk.)

15:58 xeqi: mikerod: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go says you might find it in https://github.com/clojure/core.incubator/

16:01 mikerod: xeqi: Thank you for the information. I'll look at this.

16:14 TimMc: Sanity check, please: https://gist.github.com/timmc/5216308

16:14 This throws an assertion error when fed "http", instead of just returning nil.

16:15 nDuff: TimMc: because you're trying to cast the nil to a java.net.URL, yes.

16:16 ...hrm.

16:17 amalloy: TimMc: cast isn't java cast; it's java instanceof

16:17 &(instance? String nil)

16:17 lazybot: ⇒ false

16:17 nDuff: TimMc: Sure you don't mean (defn wtf [s] (try {:post [(java.net.URL. s)]} (catch java.net.MalformedURLException murle nil)))?

16:17 amalloy: &(cast String nil)

16:17 lazybot: ⇒ nil

16:17 amalloy: hm

16:18 oh. TimMc: (cast String nil) returns nil, so the :post is falsey

16:18 trptcolin: cast returns nil in this case? so the assertion fails?

16:18 TimMc: oh hell

16:19 trptcolin: heh

16:19 TimMc: My thought process: "I should check for nil before I do the cast. No wait, nil can always cast. NIL CASE: ADDRESSED."

16:22 hiredman: cast is magic, it provides info for the compiler for method resolution

16:22 similar to type hinting

16:24 TimMc: hiredman: The compiler must special-case cast calls with a class literal in the first arg position.

16:25 trptcolin: ,(source cast)

16:25 clojurebot: eval service is offline

16:25 TimMc: trptcolin: (. c (cast x))

16:25 trptcolin: awww. it's just a fn, though, calls java's Class.cast, right?

16:25 zackly

16:26 ravster: I'm trying -->(GET "/" [] (resource :handle-ok "hellow from liberator."))<-- Trying to use liberator on my project, but this isn't working. I'm using ring.middleware.reload, and its keeping on giving back the original message that I was setting with a simple response-map.

16:28 amalloy: hiredman: you're saying that the compiler knows (cast c x) returns an instance of c? i don't see that anywhere obvious

16:29 hiredman: amalloy: yeah, I must be mistaken, but I could have sworn I used it to get the compiler to use the right method some place

16:31 ravster: I'm getting a response (upon restarting) getting "No acceptable resource available" HTTP code 406

16:32 TimMc: hiredman: I know that int and friends do that...

16:56 amalloy: trptcolin: fwiw, the source of 'cast isn't necessarily enough to know that it just calls Class.cast

16:57 trptcolin: amalloy: outside of special-casing the analysis?

16:57 amalloy: for example, instance? is defined as (. c (isInstance x)), but when it's called with a literal class as its first argument, the compiler replaces that with the bytecode for instanceof

16:57 hiredman: and it does that without argument checks

16:58 or did

16:58 ,(instance? Class)

16:58 clojurebot: false

16:58 amalloy: hiredman: you mean, without checking the number of arguments? yeah

16:58 hiredman: that really needs to be rewritten as an intrinsic

16:59 trptcolin: sure, i mean for all user-land knows. but that's the case for pretty much every function, right?

17:00 there *could* be a special case in the compiler

17:00 hiredman: instance? is very *special* case

17:00 amalloy: could it, though, hiredman? it would add a function-call overhead at least, and i'm not sure it's even possible the way intrinsics and instanceof work at the moment

17:02 hiredman: amalloy: huh? the way intrinsics work is the function definlines at a static method call, and the compile has a list of method calls and bytecodes to replace them with

17:02 amalloy: hiredman: right, but it starts by pushing the relevant arguments onto the stack. afaict from reading jvm bytecode definitions, an instanceof call is not preceded by pushing a Class object onto the stack

17:04 ie, the best an intrinsic could produce is something like "push String, push x, instanceof", but there's no such instanceof operator

17:04 hiredman: hmmmm

17:05 ok then lets over haul the intrinsic system

17:06 they obviously should be ifns that be passed the bytecode generator so they can do whatever they want

17:06 (like sticking a class in to the constant pool, etc)

17:11 TimMc: Speaking of overhauling, has there been any progress on the digital CA thing?

17:18 jonas11235: guys, I need to call with-query-results binding a list to the a variable parameter list (the query is created dynamically), how can I explode the my list to the sql-params in with-query-results?

17:21 amalloy: i just dove into the asm code because i was curious how instanceof manages to add something to the class's constant pool. what a mess of callbacks

17:22 abp: ,(into ["select * from x where id = ?"] '(1))

17:22 clojurebot: ["select * from x where id = ?" 1]

17:22 abp: jonas11235 ^

17:25 squidz: does anybody know of any closure(google closure) compatible charting libraries?

17:27 jonas11235: abp: I will try it

17:27 abp: sorry, but I did that :)

17:28 abp: in my query I have a field with "IN (?, ?, ?, ?)" but the number of '?' is dynamic

17:29 TimMc: jonas11235: Should still work.

17:29 jonas11235: abp: if I receive a list with 20 ids, I generate a query with 20 '?' in the list

17:29 TimMc: &(into ["(?, ?, ...)"] (range 5))

17:29 lazybot: ⇒ ["(?, ?, ...)" 0 1 2 3 4]

17:30 jonas11235: abp: TimMc: my problem is to do the bind

17:30 abp: TimMc: let me try the &(into

17:33 muhoo: i vaguely remember a function that'll do something like (mystery-func inc :a [{:a 1 :b 2} {:a 7 :b 12}]) => [{:a 2, :b 2} {:a 8 :b 12}] , but i can't recall its name

17:33 jonas11235: abp: TimMc: nope, it didn't worked :(

17:34 TimMc: jonas11235: That's not enough information to help you.

17:34 muhoo: map + update-in ?

17:34 jonas11235: TimMc: I already generated the query with join and repeat

17:35 TimMc: "It didn't work" doesn't contain much information. What happened?

17:35 jonas11235: TimMc: the problem is that I need to pass 20 variables but if I pass the list it count as only one

17:35 amalloy: ~helpme

17:35 clojurebot: A bug report (or other request for help) has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it's awfully hard to help you.

17:35 jonas11235: TimMc: "Unable to resolve symbol: & in this context"

17:37 abp: jonas11235: neither , nor & belong onto the start of what we posted. Those where only to trigger the bots in this channel.

17:37 TimMc: jonas11235: A compile error is very different from, say, a JDBC error.

17:38 abp: Hm, he's probably overwhelmed by inacurate error messages.

17:38 jonas11235: TimMc: before that I was receiving: "The conversion from UNKNOWN to UNKNOWN is unsupported"

17:38 abp: :D

17:38 really?

17:38 how did you do that?

17:38 jonas11235: TimMc: abp: what didn't helped me :(

17:39 abp: so, show us some examples of code and what it should result in and we give you hints.

17:40 TimMc: jonas11235: https://www.refheap.com/paste

17:41 abp: Actually it is shocking how much of pedestal *is* documented but not obviously. You get to know about testing your app using datalog queries on state in a new apps test/behaviour.clj

17:42 jonas11235: abp: TimMc: https://www.refheap.com/paste/2c6dc53c5ea78a818d349b12a

17:43 abp: TimMc: I have another query working but without the list-to-parameters problem

17:44 TimMc: abp: I'm trying to bind a list of ids but I don't know the size of the list

17:45 TimMc: jonas11235: OK, so make a function that *just* builds the queries, and see if that works, and then see if the output makes sense.

17:45 s/queries/query/

17:45 muhoo: TimMc: thanks

17:45 TimMc: It sounds like you're having trouble telling where the errors are coming from, so splitting up the problem is very important.

17:46 jonas11235: TimMc: are you saing to inject the ids when I generate the query?

17:46 TimMc: No, I'm telling you to break the function into smaller pieces.

17:46 jonas11235: TimMc: instead of injecting placeholders?

17:46 TimMc: ok, let me do it :)

17:51 TimMc: https://www.refheap.com/paste/12799 same error but better code :)

17:53 TimMc: jonas11235: So this time, just call get-collaborators-query and print the result. Don't even try to talk to the database.

17:55 nDuff: It's really obvious in Light Table, too.

17:56 jonas11235: (id-placeholders ["1" "2" "3"]) => " IN (???)"

17:56 squidz1: Pedestal looks pretty interesting, but does it differe a lot from the usual compojure + libs?

17:56 nDuff: squidz1: Pretty considerably, yes.

17:57 squidz1: nDuff: how?

17:57 nDuff: squidz1: ...particularly the client-side state model.

17:57 squidz1: ...the interceptors are a departure, too, and a worthwhile one.

17:57 squidz1: is it more akin to a functional philosohpy now?

17:58 bendlas: nDuff: interesting, have you looked into that model yet?

17:58 nDuff: squidz1: ...the state model enforces breaking your transitions down into small functions.

17:58 jonas11235: nDuff: you're right :( fixing that

17:58 nDuff: squidz1: ...I'm not going to make pronouncements on philosophy, though.

17:59 squidz1: okay, well it certainly looks really nice, I am just unsure if I should move my web project to it since I havent really gotten that far. I will definitely read through the docs and see if I think it's worth a move

17:59 nDuff: bendlas: A bit, but I won't say I really understand it until I've built an application on top of it.

18:00 I'm in the unfortunate position of having a lot of Java-world framework forced on me for my production code, so it's not really an option for what would otherwise be the most interesting candidate.

18:00 bendlas: sounds like I got have a look at it ...

18:05 jonas11235: TimMc: nDuff: now the query is right :) https://www.refheap.com/paste/e61b1af08103b3dd9861284d0

18:05 TimMc: nDuff: but I still have the same error: "The conversion from UNKNOWN to UNKNOWN is unsupported" when I try to execute it :(

18:07 nDuff: jonas11235: Have you ever pasted the exception, with its stack trace, ANYWHERE?

18:08 jonas11235: ...or a complete reproducer (which necessarily includes database schema, any necessary sample data to reproduce, etc)?

18:08 jonas11235: I don't think you've even given us the _class_ of the exception

18:08 jonas11235: nDuff: TimMc: sorry: https://www.refheap.com/paste/2ff10df14aaa0de3e2eb9e302

18:08 nDuff: Ahh -- it's an error from SQL Server

18:09 Clearly, then, SQL Server's documentation is the place to start from in understanding it.

18:09 ...though, hmm; looks like it's happening in setting prepared statement parameters...

18:09 jonas11235: nDuff: TimMc: it is trying to set the list as an object instead of individual elements :( that is my question, how do I bind a list to a parameter list

18:10 nDuff: jonas11235: Depend on the Java type. If it's Object..., then you need to pass a Object[]

18:10 jonas11235: and that's as easy as using (into-array Object your-vector)

18:10 jonas11235: nDuff: it is a list of int

18:10 nDuff: a _list_, or a _vector_?

18:11 jonas11235: nDuff: vector

18:11 * nDuff points back up at what he already said.

18:11 mikerod: Is there a way to not get a notification for everyone who joins or leaves the channel? IRC-noob question, but I can't seem to find the answer online.

18:11 hiredman: depends on your client

18:12 mikerod: Ah, I've just been going through webchat.freenode.net for this.

18:12 nDuff: ...though if you're using clojure.java.jdbc (which we don't know, because you didn't show us your ns declaration), it's easier than that...

18:12 jonas11235: nDuff: I tried to use setArray before (I did this query in java first) and it didn't worked

18:13 nDuff: yeap, clojure.java.jdbc

18:14 tyler: ,(class (,,,,,,, + ,,,, 1 ,,,,,,,,,,, 4 ,,,,,,,,, ),,,,,)

18:14 clojurebot: java.lang.Long

18:14 tyler: heh

18:14 nDuff: jonas11235: Then you just need to generate a larger vector. concat will do that for you.

18:15 jonas11235: nDuff: https://www.refheap.com/paste/717e7f8c0997577202892333e complete code

18:15 nDuff: jonas11235: ...as in: (sql/with-query-results rows (concat ["your query string"] your-arg-vector)

18:16 jonas11235: right -- that's generating ["your query string" [arg1 arg2 arg3]], not ["your query string" arg1 arg2 arg3]

18:16 ...so obviously it won't work. concat is your friend.

18:16 jonas11235: nDuff: exactly :)

18:16 nDuff: are you saying to put the values in the query?

18:17 nDuff: OF BLOODY COURSE NOT.

18:17 (sql/with-query-results rs (concat [(get-collaborators-query)] item-ids) ...)

18:18 jonas11235: nDuff: ok, let me try it

18:19 nDuff: ...now, how did this become a question about SQL, not a question about "how do I generate a vector of this form"?

18:27 jonas11235: nDuff: https://www.refheap.com/paste/3a93dd19966ad7001275c34b7

18:29 nDuff: https://www.refheap.com/paste/0dfdf4f7461d1155609777f68 it generated a IllegalArgumentException

18:29 nDuff: Exception in thread "main" java.lang.IllegalArgumentException: "sql-params" expected vector [sql param*], found clojure.lang.LazySeq

18:31 tyler: im having a hard time grokking how lists relate to evaluation. e.g. (+ 1 2) is just a list containing three "things", does the reader try to evaluate all lists?

18:32 jjido: jonas11235: ,(vec '(1 2 3))

18:32 ,(vec '(1 2 3))

18:32 clojurebot: [1 2 3]

18:32 jjido: tyler: yep

18:33 tyler: so lists serve "double duty" being a datastructure and an evaluation context

18:33 jjido: tyler: unless quoted (like I did just above)

18:33 tyler: don't know what you mean by evaluation context, but sounds right

18:34 jonas11235: jjido: same problem :(

18:35 jjido: I tried with and without using concat

18:35 jjido: jonas11235: show me your call to sql-params now?

18:36 jonas11235: jjido: (defn get-collaborators [item-ids]

18:36 (sql/with-connection @db

18:36 (sql/with-query-results rs (concat [(get-collaborators-query item-ids)] ,item-ids)

18:36 (first rs))))

18:37 tyler: TIL empty lists aren't seqs

18:37 nDuff: jonas11235: Have you tried breaking this down into pieces?

18:37 jonas11235: for instance, have you looked at (concat [(get-collaborators-query item-ids)] item-ids)

18:37 jonas11235: ...I assume you're developing in a REPL, right? Use that.

18:38 hiredman: ,(contains? (ancestors (class ())) clojure.lang.ISeq)

18:38 clojurebot: true

18:38 hiredman: oh really

18:38 jonas11235: nDuff: it generates a lazy-seq

18:38 jjido: hiredman: are you sure it doesn't return the same for any type?

18:39 jonas11235: you need a vector

18:39 nDuff: ,(concat ["hello"] [1 2 3])

18:39 clojurebot: ("hello" 1 2 3)

18:39 nDuff: Ahh, so it does.

18:39 hiredman: ,(contains? (ancestors (class 1)) clojure.lang.ISeq)

18:39 clojurebot: false

18:39 nDuff: ,(vec (concat ["hello"] [1 2 3]))

18:39 clojurebot: ["hello" 1 2 3]

18:39 nDuff: jonas11235: ^^^

18:40 jjido: ,(contains? (ancestors (class ())) clojure.lang.IMap)

18:40 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.lang.IMap, compiling:(NO_SOURCE_PATH:0:0)>

18:44 amalloy: tyler, jjido: the reader certainly doesn't evaluate lists

18:45 jjido: amalloy: tell me more?

18:45 ,("" 5 3.5)

18:45 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>

18:46 jjido: ^ did it not evaluate the list?

18:47 mattgordon: (defn db-do-prepared [db transaction? sql & param-groups] …)

18:47 ^ What is the simplest way to pass a seq of param-groups to that

18:47 jonas11235: nDuff: Worked! Thank you! :)

18:48 mattgordon: ie. i need to inline the seq as each item in it represents a param-group

18:48 abp: mattgordon: apply

18:48 mattgordon: yeah i'm trying that. just need to futz more i guess

18:48 jonas11235: nDuff: the final version: (vec (concat [(get-collaborators-query item-ids)] item-ids))

18:48 mattgordon: oh woops

18:48 i *thought* i was trying that but dropped off my apply

18:49 *slaps head*

18:52 abp: thanks

18:55 muhoo: https://github.com/Mikkeren/FizzBuzzEnterpriseEdition

18:55 * muhoo has beend in java interop hel for too long now

18:56 patchwork: Anyone tried to make a web debugging interface for clojure ala werkzeug for python?

18:56 going through the cdt stuff it doesn't look like it would be too difficult

18:57 basically just making a web frontend to cdt

19:05 TimMc: jonas11235: This would also work: `[~(get-collaborators-query item-ids) ~@item-ids]

19:10 nollidj: i'm interested in using core.logic to do validation of user input on a complex form. i can express constraints on the form's field values in clojure. these constraints can get rather complicated. can i use core.logic not to tell me all sets of assignments that satisfy those rules, but to validate a set of assignments and explicitly enumerate violations of them (e.g., "your entries are bad because variable X exceeds variable Y, and variable Z isn't in the se

19:11 hiredman: nollidj: I really hope you have that on a cron job and are not manually pasting it in every 4 hours

19:11 because that would be a waste of time

19:23 jonas11235: TimMc: ty

19:24 Glenjamin: hi guys, what's the runtime equivalent of ~@body?

19:24 wait, never mind - that question doesn't make sense

19:24 amalloy: (inc Glenjamin)

19:24 lazybot: ⇒ 1

19:24 Glenjamin: i was thinking i could just use a function, but i need a macro

19:25 amalloy: if only more people stopped to realize their question makes no sense

19:26 nollidj: hiredman: i promise i'm not

19:27 hiredman: i figured i'd give it another go in the evening when more people might be around. i'll look for a more fruitful venue if no one bites

19:27 Glenjamin: currently trying to find a balance between testing my middleware, which has fairly complex behaviour, and testing all of its helper functions in isolation

19:27 lots of thinking, not enough hacking

19:31 nollidj: hiredman: do you say that simply because i seemed spammy, or because you don't think it's a good question?

19:33 chessguy: good evening everyone

19:33 jimkcar: hey hey

19:33 hiredman: nollidj: spammy

19:34 chessguy: i'm excited. a friend of mine is about to help me get my clojure environment up to speed, and we're going to work through the koans together

19:36 Raynes: chessguy: Who is your friend?

19:36 I'll tell you if he sucks or not.

19:36 chessguy: haha, i've worked with him for 3 years, i know he doesn't suck

19:37 his name is Seth, also goes by foogoof

19:37 Raynes: I don't know him so he probably sucks.

19:37 Tell him Raynes says "Good evening, sir."

19:37 Have fun with the Clojuring. :)

19:38 chessguy: we will

19:39 DarkLinkXXXX: What's the solution to this? I read a little about lists, but it didn't help me. http://www.4clojure.com/problem/4

19:39 Glenjamin: ,(macroexpand '(->> body (with abc) (with def)))

19:39 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

19:40 Glenjamin: bah

19:40 amalloy: really, Raynes? foogoof has at least been in here a few times

19:40 Glenjamin: can anyone tell me why that doesn't expand fully?

19:40 Raynes: amalloy: Perhaps I'm not as omnipresent as you, sir.

19:40 brehaut: DarkLinkXXXX: did you not try at all?

19:40 joegallo: DarkLinkXXXX: http://clojure.github.com/clojure/ the documentation is here

19:40 DarkLinkXXXX: brehaut, I tried a few things.

19:40 chessguy: he helps run the DC clojure meetup

19:40 joegallo: and the documentation for the list function is http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/list

19:40 ,(list 1 2 3)

19:41 clojurebot: (1 2 3)

19:41 joegallo: makes a list containing 1 and 2 and 3

19:41 what things did you try?

19:41 DarkLinkXXXX: '(:a :b :c)

19:41 "a" "b" "c"

19:41 I forget the rest.

19:41 joegallo: that makes a list containing a list of :a and :b and :c

19:41 "a" is not :a

19:42 "a" is a string, :a is a keyword

19:42 DarkLinkXXXX: Yeah. I figured that out.

19:42 joegallo: it would like the difference between "1" and 1 ;)

19:42 DarkLinkXXXX: I'm not new to programming, btw.

19:42 Raynes: Nobody is trying to be mean to you.

19:42 joegallo: neither am i

19:42 chessguy: calling :a a keyword and a a symbol is going to freak me out for a while, coming from ruby

19:43 Glenjamin: i'm looking for a macro similar to ->, that'll let me combine multiple forms of the type (with-x context body), into something like (__ (with-x x-context) (with-y y-context) body)

19:43 Raynes: It's just that if you tried "a" "b" "c" but know that "a" is different than :a, I'm a bit baffled as to why you didn't try :a :b :c

19:43 I think that's the connection he was trying to make.

19:43 joegallo: maybe now is a good time to try that

19:44 DarkLinkXXXX: Raynes, Ah crap. I don't know either.

19:44 Raynes: :p

19:46 amalloy: Glenjamin: sounds like ->> with its arguments reversed

19:47 though i think it will come out more readable if you just wrap the (with-x (with-y ...)) forms like god intended

19:48 Glenjamin: it's for mocks in tests, doing a few puts me pretty far indented

19:48 chessguy: so, anybody working on anything interesting in clojure?

19:49 Glenjamin: i'm 'with-redef'-ing the same things in multiple tests, so the idea was to move the names of what to redef into the macro

19:49 and then be able to compose them

19:52 i'm still confused as to why macro expand only seems to expand ->> once

19:55 amalloy: Glenjamin: macroexpand only expands the "outermost" form you gave it; it doesn't walk into subforms and expand them too

19:55 Glenjamin: ah

19:55 is there a variant that does that?

19:55 amalloy: the compiler :P

19:55 Glenjamin: heh

19:56 amalloy: clojure.tools.macro/mexpand-all does a reasonably good job, although it doesn't always produce exactly the same thing the compiler does

20:01 Glenjamin: right, trying to write it has convinced this macro is a terrible idea

20:04 amalloy: Glenjamin: (defmacro make-hard-to-read [& body] `(->> ~@(reverse body)))?

20:04 Glenjamin: that worked, but i'd only have one form for body

20:04 then i started messing with butlast and gave up

20:04 TimMc: Glenjamin: Be aware that ->> currently has a bug in it.

20:04 Glenjamin: o.O

20:05 amalloy: that's fixed in 1.5, isn't it?

20:05 Glenjamin: got to this: "(defmacro <<- [& body] (let [wraps (butlast body) body (last body)] `(->> (do ~@body) ~@(reverse wraps))))"

20:05 TimMc: One would hope so.

20:05 Glenjamin: which doesn't work

20:05 speaking of versions

20:06 when a dependency depends on an older version of clojure, what happens

20:06 amalloy: well, of course you can only have one form for body, if you want to make all but one into wrappers

20:06 Glenjamin: yeah, didn't think it through

20:06 do they get compiled into byte code separately and interact only via the jvm?

20:07 TimMc: &(macroexpand `(->> a b (->> c d))) ;; Glenjamin

20:07 lazybot: java.lang.StackOverflowError

20:07 TimMc: amalloy: Patch, test, and apathy: http://dev.clojure.org/jira/browse/CLJ-1121

20:08 amalloy: Glenjamin: you get one version of clojure to share, selected more or less arbitrarily

20:08 Glenjamin: oh, i noticed leiningen downloading the old one and got suspicious

20:11 eignerchris: I'm new to clojure. I'm attempting to use resolve with http-kit to build the string necessary to execute an http GET or POST and then later execute that method

20:12 in my repl i can do this: (def http-request-method (resolve (symbol "http/get")))

20:12 (http-request-method "http://www.google.com")

20:12 and it works great

20:12 however when running my app, i get a java.lang.NullPointerException error

20:12 can anyone shed any light? i'm stumped

20:13 Glenjamin: amalloy: this is the code i'm trying to simplify https://gist.github.com/glenjamin/75f8d17abef4db9ca9c7

20:14 can't decide if it feels ugly to me because i'm not used to it, or i'm just doing too much stuff

20:14 amalloy: Glenjamin: you're literally just trying to move parens around, not even change the textual order of the code. the way it is now is fine

20:15 Glenjamin: cheers, still not used to lisps

20:15 i found myself thinking about a haskell-style "where" clause the other day

20:15 like let, but with bindings at the end

20:15 need to give in to the parens i think

20:16 amalloy: well, implementing where would not be the worst thing ever, but it'd need just as many parens as let

20:22 Glenjamin: i also figure, without the full laziness it's less useful

20:23 in haskell-land you can declare a bunch of expressions that only apply to some paths of the body, so it makes more sense to leave them at the bottom out of the way

20:23 tyler: what is a function like conj but instead of adding to front of list it replaces first element?

20:23 Glenjamin: (comp tail conj) ?

20:24 no, that doesn't work

20:24 tyler: tail isn't a function

20:24 Glenjamin: `(#(conj %1 (rest %2)) 1 [2 3 4])

20:25 &(#(conj %1 (rest %2)) 1 [2 3 4])

20:25 lazybot: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection

20:26 Glenjamin: oh right

20:26 &(#(conj (rest %1) %2) [2 3 4] 1)

20:26 lazybot: ⇒ (1 3 4)

20:26 Glenjamin: there

20:29 amalloy: yeah, i suppose the haskell version would be like... (flip (:)) . tail?

20:29 since we're mentioning tail

20:34 tieTYT: amalloy: to add to the end?

20:34 [1..3] ++ [x]

20:34 that'll add x to the end

20:35 amalloy: tieTYT: have you followed the discussion, or tried to run the haskell or clojure versions of the function being discussed? it is not the thing you just offered

20:35 arrdem: do we really not have a math library newer than contrib?

20:35 Raynes: java.math

20:35 arrdem: meh.

20:35 mmkay

20:35 Raynes: java.lang.Math, even.

20:36 tieTYT: tyler kind of interrupted the flow, sorry

20:37 muhoo: hmm, lein outdated gives me a weird error

20:37 org.apache.lucene.store.LockReleaseFailedException: Cannot forcefully unlock a NativeFSLock which is held by another indexer component: /home/localkens/clojure/lein-resources/indices/http___repo1.maven.org_maven2_/write.lo

20:37 um, huh?

20:37 Glenjamin: sounds like it's outdated :D

20:38 tyler: wat is my fault?

20:38 muhoo: i saw you pop up in a google search in logs when i was searching for a fix the other day heh

20:39 tieTYT: nothing, i'm just making excuses

20:39 speaking of haskell

20:40 protocols are just haskell class types, right?

20:40 Raynes: 'just' is a very strong word.

20:40 tieTYT: what's the difference?

20:40 Raynes: What you want to ask is "kinda sorta somewhat a little like"

20:41 amalloy: tieTYT: they're close enough. some things just don't translate well, eg due to lack of static typing

20:41 tieTYT: ok

20:41 amalloy: like, you can't define something like mempty as a protocol, because it has no object to do type-dispatch on, and no return-type information

20:42 tieTYT: to me protocols feel like a convenience. Without them you could use a map with a type as a key and a function as a value, no?

20:42 Raynes: Well, there are multimethods.

20:42 tieTYT: are you talking about haskell's mempty? Isn't that a function of Monoid?

20:42 amalloy: indeed

20:43 Glenjamin: can you put multi methods into a protocol?

20:43 tieTYT: amalloy: hmm, trying to think about your sentence. I'm not that familiar with haskell

20:44 kmicu: @unpl flip

20:44 tieTYT: Raynes: ah yeah, those to me seem similar to protocols too. Like more convenience

20:45 i've never learned either. This is like my 3rd day learning clojure

20:45 amalloy: ok I think I get what you're saying

20:49 ironm: hello kmicu ;)

20:50 kmicu: , :hi

20:50 clojurebot: :hi

20:51 ironm: @google tutorial

20:55 tieTYT: amalloy: another diff between protocols and type classes is that protocols can't have an implementation

20:56 muhoo: tyler: yeah, i'm deeply regretting living in an era of public irc logging :-/

20:58 TimMc: is there some way i could convince you to publish a maven/clojars jar of handy with the org.timmc.handy.repl namespace in it, and bump the version past 1.2.0?

20:58 there's a lot of stuff in git for handy that is past the 1.2.0 release, which i use all the time, and i'm kind of getting tired of keeping private jars around

21:53 nightfly: Does ClojureScript host it's own macros yet?

22:05 bloop: right now I'm dealing with a large nested hashmap tree structure where I'm simulating laziness by making the vals in the hashmaps all wraped by calls to 'delay. I was wondering if there is another more idiomatic way to do this. It's working OK but is a bit ugly. Any suggestions?

22:07 (basically there's a huge nested tree of options which are identified by string, and the user is likely to only explore one path of the tree, so I'm optimizing it (because it was a problem) by making it so that calculations don't go deeper than they have to.)

22:44 anthonyu: how does one clear or reset an (atom ()) back to empty?

22:47 tieTYT2: i barely know clojure. I'm trying to figure out how to pass enlive raw html instead of a URL object like this: (html/html-resource (java.net.URL. url))

22:47 does anyone knwo what method to call?

22:55 * tieTYT2 found it

23:10 xeqi: anthonyu: (reset! atom-name '())

23:32 benkay: hi team. opsbro here. devbro tells me i need to support clojure in production. can i get a ticket to the best practices train?

23:35 Raynes: That was colorful.

23:36 benkay: What does 'support Clojure in production' mean? You need to make sure your production machines can run Clojure programs and such?

23:40 benkay: more or less. I have no experience with anything beyond Python web applications and really elementary devops, so I was hoping for some sort of "these are the paradigms for software development and deployment in Clojure".

23:40 I suppose working through a Clojure web framework deployment would be a step in the right direction.

23:41 trptcolin: benkay: you'd probably be interested in http://palletops.com/

23:42 talios: I think palletops would be overkill here, depending on how you're deploying your app, its more a question of "do you support java"

23:42 brehaut: afternoon talios

23:42 talios: 'lo brehaut

23:43 brehaut - you may enjoy our latest podcast episode - all on typed clojure

23:43 benkay: hm. always interested in new ops tools, talios. thanks.

23:43 brehaut: yeah, ive got it queued up

23:43 amalloy: benkay: all you really need is to make sure there's an up-to-date jre installed. if he's interested in running a servlet container, you probably have to do some stuff installing jetty or tomcat or one of those things

23:43 brehaut: if i can stomach an hour of aussie and auckland accents. ouch

23:43 benkay: thanks amalloy.

23:43 talios: brehaut - harsh man harsh

23:45 brehaut: talios: theres a reason i dont do a podcast: i find the NZ and aussie accents super grating ;)

23:45 Raynes: benkay: Second amalloy. You mostly just need a JRE >= 1.6. Having an up-to-date (2.0.0 or higher) leiningen would also be nice.

23:46 amalloy: yeah, but devbro can install leiningen anywhere he has write permission to

23:46 Raynes: Sure, but devbro asked opsbro to set it all up for him.

23:46 talios: devbro sounds lazy

23:46 Raynes: So opsbro could go ahead and do that while he is installing the jre, perhaps.

23:46 talios: lein uberjar should give you all you need to deploy.

23:47 depending on the "app"

23:47 Raynes: If we keep using the word 'bro' in this context we're going to end up with a CljCon incident.

23:47 talios: I hope opsbro or devpro sets this up in demo/staging first tho :)

23:48 benkay: opsbro lives to make infrastructure get out of devbro's way

23:48 it's a good relationship

23:48 talios: Raynes - the closest "incident" I think we'll get at a conj is a derogitory inference that someones a mathematician - we all know programming isn't math.

23:49 i like opsbro, he sounds much nicer than the opsmonkey we have

23:49 benkay: *bow*

23:49 trptcolin: talios: whoa. whoa. whoa. you are antagonizing the scala fans.

23:49 ;)

23:50 ambroseb_: Any tips for lazily loading sections of Clojure projects?

23:50 talios: trptcolin - thats ok, this is IRC not twitter ;)

23:50 trptcolin: hehe

23:50 brehaut: talios: how can you like static types and functional programming and not want programming to be math

23:50 talios: ambroseb_ - er, eval? ;p

23:50 trptcolin: ambroseb_: we do some wacky stuff with REPLy to help startup time out

23:51 ambroseb_: e.g. https://github.com/trptcolin/reply/blob/master/src/clj/reply/initialization.clj#L80

23:52 that file is... not simple :)

23:52 brehaut: trptcolin: ◎_◎

23:52 ambroseb_: trptcolin: ok this looks about what I expected.

23:53 talios: brehaut - exactly. I believe it all started with Twitter releasing an open source Bijection library for scala, only nothing they did matched the definition of bijections.

23:53 brehaut: lols

23:53 talios: that got certain folk…. annoyed

23:53 brehaut: talios: by 'certain folk' you mean scala guys eh

23:53 talios: well, Tony Morris ;p

23:54 brehaut: lol

23:54 talios: brehaut - for the lolz: https://github.com/twitter/bijection/issues/41

23:55 brehaut: why am i clicking this link :/

23:55 talios: for the lolz

23:55 brehaut: this reminds me of the why jquery deferreds are not Promise/A implementations (but backwards)

23:57 talios: i reconfnise most of these words, but im pretty sure its in a foreign language

23:57 talios: brehaut: that language would be "math", obviously you're not the programmer I thought you were. Mind you - I don't think I ever leart the terms injective/subjective in school Maths either and I didn't know what they meant

23:58 brehaut: talios: i am totally pants at math

23:58 talios: brehaut: my teacher didn't appreciate me giving imaginary answers to questions involving imaginary numbers.

23:59 brehaut: ha

23:59 talios: its 5pm on friday. this is not time for computers. ttyl

23:59 talios: seeya

Logging service provided by n01se.net