#clojure logs

2013-03-21

00:01technomancyrplaca: not sure off the top of my head, but inspecting the implementation of the classpath task would make it pretty clear
00:02technomancyugh; can you imagine the uproar if they charged for videos?
00:06tieTYT2did lein USED TO put libraries in a lib folder?
00:06TimMctieTYT2: Yeah, in version 1.x.
00:06tieTYT2ah this explains a lot
00:07tieTYT2i'm trying to figure out how to use La Clojure with lein together
00:07tieTYT2people keep saying to include the lib folder and logically i know that wouldn't do anything
00:09tieTYT2ah i think i figured it out
00:10TimMctieTYT2: There's a huge amount of bad information on blogs, by the way.
00:11TimMc(Mostly just horribly outdated.)
00:11tieTYT2i see
00:11tieTYT2ugh intellij wants the .bat file, lame
00:11tieTYT2i'll download that separately
00:17tomoj&(into [] (reify clojure.lang.ISeq (seq [this] this) (first [_] 42) (next [_])))
00:17lazybot⇒ [42]
00:17tomojin 1.5, the reason this works is that CollReduce is extended to Object by a seq-reduce impl
00:18tomojis there another sane way around that problem?
00:20TimMcWhat *is* the problem?
00:20tomojmaking all ISeq implement CollReduce
00:21tomojrelying on the fact that ISeq is an interface and extending CollReduce to it is cheating
00:22tylerwhats the best way to turn a NodeList into an ISeq?
00:22tyleri tried js->clj but it returned a NodeList again?
00:24tylern/m ust found some code that extended NodeList
00:24tylerjust*
00:25tomojextending NodeList is weird
00:25tomojand many other weirdnesses for cljs
00:26tomojI mean, none of us own NodeList, so by the old rules only clojurescript core should extend core protocols to NodeList
00:27tomojI guess it's like data_readers.clj, you can only extend in code you don't release as a library?
00:28tomojyou can't put the extends under the top level in cljs so.. :/
00:28tomojwell you could put them in a macro
00:29tylerits like 8 lines and its soooo ugly *cringe*
00:29tylerthe javascript that is
00:30tylerthe clojs is decent i think its actually less than the javascript heh
00:30tylercljs*
00:30Raynesmuhoo: ping
00:31muhooRaynes: yo
00:31Raynesmuhoo: How are things in San Francisco?
00:31muhooraining ATM. how's life in "the southland"?
00:31RaynesNot raining.
00:32Raynesmuhoo: I've got a cover here that I don't completely hate. Wanna link?
00:32tieTYT2anyone 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
00:32muhooRaynes: sure, let's hear it!
00:43clintmWhat'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.
00:44tieTYT2this looks convenient: http://richhickey.github.com/clojure-contrib/duck-streams-api.html
00:44lazybotNooooo, 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.
00:44tieTYT2why can't i use this?
00:44tieTYT2 (require 'clojure.contrib.duck-streams)
00:44tieTYT2FileNotFoundException Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath: clojure.lang.RT.load (RT.java:432)
00:45tieTYT2oh, deprecated :(
00:54tolstoyclintm: I think you can do something like(if x [:li] (html [:li] [:li])).
00:55tolstoyclintm: I don't think using a "do" would work.
00:57amalloyclintm: do is exactly like progn, and thus won't do what you want in your if
00:57amalloyyou just want (list [:li] [:li])
00:59clintm(list) was it. Thanks, amalloy, and tolstoy!
00:59tolstoyAh, good!
01:14lovemuffinhey, for the barrier of entry for clojure, do beginners usually say there's too many reader macros, and probably even macros ?
01:16lovemuffin#() #{} ~ ^ @ #"" ~@ #' ' ;
01:16lovemuffinheh
01:16lovemuffinits hard to remember what all that means , i guess i'll remember as i use them, but yea
01:16clintmI'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.
01:17lovemuffincl?
01:17clojurebotYou just made an ad hoc, informally -specified, bug-ridden, slow implementation of half of that.
01:17clintmcommon lisp
01:17lovemuffinforgot 'x and `x on that list of macros
01:20lovemuffinwhen reading some doc,tutorials what does the '&' mean? (lazy-seq & boidy)
01:22tomoj&((fn [& body] body) 1 2 3)
01:22lazybot⇒ (1 2 3)
01:23lovemuffinah so just variable number?
01:23lovemuffindoes it only ever apply to arguments ?
01:23tomojwell, it applies in many binding contexts
01:23tomojarguments are one
01:24tomoj&(let [[foo & bar] [1 2 3]] [foo bar])
01:24lazybot⇒ [1 (2 3)]
01:24tomoj&(for [[foo & bar] ["foo" "bar" "baz"]] bar)
01:24lazybot⇒ ((\o \o) (\a \r) (\a \z))
01:26tomojhttp://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring)
01:56tieTYT2check 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?
02:00xcvRaynes: If you're here, I wanted to ask you which editor you're currently using (I read your blog posts earlier).
02:01Raynesxcv: Emacs with evil-mode. I like to think I have the best of both worlds.
02:01RaynesBeen using it for quite a while.
02:04yunfanRaynes: tried that evil mode
02:04yunfanits cool but the way it implement it is not suit
02:04Raynes*shrug* works fine for me.
02:05yunfanit impl each :xyz by mapping xyz to a processing function, while in true vim, xyz might be a combination of three cmd
02:05RaynesI wasn't looking for an exact implementation of Vim in Emacs.
02:05yunfanso i think they need to provide a evil-cmd-eval instead
02:06RaynesI was more interested in functionality like text objects.
02:06yunfanok just shout them from a vim user :]
02:10nopromptyunfan: Raynes: i gave emacs an fair shot but, yeah, the move from vim was too hard.
02:10RaynesI 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.
02:11noprompti've got a pretty good mash up of VimClojure, vim-clojure-static (for syntax and indention), and pairedit.vim
02:11nopromptbut i'm terribly jealous of emacs in many ways
02:11RaynesVim is a perfectly acceptable editor for Clojure.
02:11Raynesvim-foreplay makes it very nice I hear.
02:11yunfannoprompt: 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
02:13nopromptyou know, i tried fireplace, but ended up going back to VimClojure.
02:13noprompthats of to tpope though. that guy is an inspiration.
02:13yunfanthen how's the vimclojure runs?
02:13nopromptyunfan: vimclojure is fine, but you have to put in some effort to get it set up.
02:14yunfannoprompt: so you prefer vim-clojure-static?
02:14noprompti checked all the necessary parts in to my dotfiles repo so i don't have to fiddle with setting it up on different stations.
02:15yunfannoprompt: maybe we could reverse the ideas,
02:15nopromptyunfan: i prefer vim-clojure-static's syntax and indention files. i've been contributing to it as well so i'm a little biased.
02:15nopromptthat's all vim-clojure-static is btw. runtime files.
02:15yunfannoprompt: if the repl could support vi like keybinding just like the bash's vi mode, that would be nice too
02:16nopromptyunfan: then you want to use VimClojure.
02:16yunfani am going to check if rlwrap has a vi mode
02:16nopromptbut what i do is remote the indent, syntax, and ftdetect folders from the VimClojure dir and symlink the ones from vim-clojure-static
02:17noprompts/remote/remove
02:18yunfanwhy no one talks lighttable?
02:19johnmn3g'day
02:20amalloyyunfan: certainly rlwrap supports vim-ish keybindings
02:20amalloythere's some incantation you can put in your ~/.inputrc to make it happen
02:20yunfanamalloy: can it launch a vi instanse?
02:21johnmn3I'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
02:21johnmn3following the directions, after I run (watch :development) I get a constant flow of execptions
02:22nopromptlight table is on the road to being awesome
02:23nopromptwindows *yikes*
02:23johnmn3its apparently in the split-path function of the build.clj file. there's a regex exception
02:23nopromptwhats the regex?
02:24johnmn3(defn- split-path [s]
02:24johnmn3 (string/split s (re-pattern File/separator)))
02:24nopromptyou might want to update to the latest JDK
02:24johnmn3yea yea, I know
02:24nopromptthe regex support has changed
02:24noprompti ran in to a similar issue not long ago
02:24technomancythe regex support changed in a minor java increment?
02:24johnmn3not only that, but there's a laundry list of vulnerabilities on this crusty old jvm
02:25technomancythe vulnerabilities are all in the browser plugin IIRC (except one in JMX)
02:25yunfani just tried using clojure's regex matching instead of my python with sed scripting days ago, and got some performance enhancement
02:25yunfanits good
02:26johnmn3is there a pedestal specific irc room?
02:26noprompttechnomancy: i'm certain that it did because a regex like #"\p{IsISOControl}" raised warnings in 1.7.0_12-ea
02:26nopromptbut not in 1.7.0_17
02:27technomancyouch
02:27nopromptcorrection to that #"\p{IsjavaISOControl}"
02:28noprompti spent the bulk of last week learning the dark depths of java's regex support.
02:29johnmn3on win7:
02:29johnmn3user=> (java.io.File/separator)
02:29johnmn3"\\"
02:29johnmn3user=> (re-pattern "\\")
02:29johnmn3PatternSyntaxException Unexpected internal error near index 1
02:29johnmn3\
02:29johnmn3 ^ java.util.regex.Pattern.error (:-1)
02:29johnmn3guess I'll file a bug on github?
02:30nopromptyeah that makes sense.
02:30nopromptit should be "\\\\"
02:30johnmn3oh, somebody already did.
02:31nopromptyou have to escape the slash twice. once for the string and again for the pattern.
02:32johnmn3and that results in #"\\"... which should end up just being one escaped slash at runtime?
02:32nopromptyou got it.
02:32johnmn3thank you noprompt
02:34noprompti have an algorithmish question, if someone is open to it.
02:35nopromptsuppose i wanted to construct a #"a(b|c|d|e)" type of pattern from a vector of strings.
02:36nopromptfor example ["alpha" "alphonso" "albert"] should create #"al(ph(a|onso)|bert)"
02:37nopromptwhat kind of algorithm would you consider for grouping like that?
02:37nopromptany ideas?
02:38amalloynoprompt: i would generate #"alpha|alphonso|albert" and let the regex engine figure it out. it's smarter than either of us
02:38nopromptamalloy: not always, especially not for large expressions. you'll end up backtracking a lot.
02:39nopromptbut i know you're partly right.
02:40noprompteven still the problem is interesting, no?
02:40amalloysure
02:40tylerweird anyone notice funky thing with if statements in javelin?
02:40tyler(cell (if (= 4 facebook-status) (-> js/console (.log "wooo"))))
02:40amalloyi'd add each item to a prefix-trie and then walk over it to produce the expressions
02:40tyleri get console log woooo even though facebook-status is a cell with a string in it
02:40amalloylook up prefix trie algorithms/structures if you can't find one prebuilt that does what you need
02:41nopromptfrom 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.
02:41amalloynoprompt: for the bad algorithms used by modern engines, that is correct
02:42amalloysee 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
02:42nopromptamalloy: i would imagine the engine would probably parse the expression first and attempt to optimize it before compiling it.
02:43nopromptlook up the info. as always thanks. :)
02:47johnmn3arg... I hardcoded it in there:
02:48johnmn3(defn- split-path [s]
02:48johnmn3 (string/split s #"\\"))
02:48johnmn3just 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
02:50nopromptjohnmn3: maybe just use Compojure :/
02:52nopromptamalloy: the first few paragraphs of this article give me reason enough to explore this problem in greater depth.
02:53nopromptmy goal is to generate more efficient expressions when the patterns are large.
02:55johnmn3I figured it out... had to change my version number for app-tools in the project file
03:17johnmn3okay, I got it running and the chat app looks pretty smooth
03:20johnmn3I 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
03:26dsppcan anyone think of a good data structure to represent a family tree?
03:26nopromptamalloy: my C skills are way rusty but this article is awesome. where do you find this stuff?
03:27amalloynoprompt: i read it once several years ago, but more recently i remember someone linking to it in #clojure. i just keep my ears open
03:27dsppcan someone repaste the link?
03:27nopromptamalloy: please tell me java uses the thompson nfa.
03:28amalloynope. nothing modern/popular really does
03:28amalloyafaik
03:28noprompt*head explodes*
03:28amalloythey're all just wrappers over the same C library perl uses
03:29nopromptis this underground information or something?
03:29noprompti mean, if the thompson nfa is superior why not use that?
03:30nopromptthe guys behind the engines surely know about this, right?
03:30nopromptalthough it makes me happy to know awk and grep use it
03:31amalloydspp: http://swtch.com/~rsc/regexp/regexp1.html
03:32dsppthanks
03:37amalloyi 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
03:37amalloyand apparently i'm too much of a luddite to just bookmark it
03:40dsppi just did a search for "regexp faster" and it came up top, is that because i've visited it already?
03:41dsppsame when not logged into google
03:41dsppi dont like bookmarks either
03:41dsppclutter :D
03:41tylerwoohoo i crashed the JVM with clojurescript
03:41tylerachievement unlocked
03:42Ember-amalloy: wow, that was interesting read
03:42tylerah it was in a c-lib
03:42tylernot in the actual JVM
03:43Ember-did not know about the Thompson NFA or the differences between programming language regexp implentations and unix awk etc
03:48navgeetIs it impossible to use push-thread-bindings without a matching call to pop-thread-bindings?
03:51amalloynavgeet: if you succeed in doing that, your lungs will leak
03:51amalloyout your ears, and you will be able to smell colors
03:52amalloy(you can probably do it, but you won't like the results)
03:53navgeetIf I push a binding and then don't pop it, wouldn't it give me a single dynamically bound var?
03:56tomoj&(((comp (partial partial map) (partial partial map)) +) [[1 2] [3 4 5]] [[6 7 8] [9 10]])
03:56lazybot⇒ ((7 9) (12 14))
03:56tomojhmm
04:28yunfani 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
04:29yunfanit seems *1 and *2 are empty, so what has changed ? my environment is clojure 1.4.0 laucnhed by lein repl
04:29tomoj&42
04:29lazybot⇒ 42
04:29tomoj&*1
04:29lazybot⇒ #<Unbound Unbound: #'clojure.core/*1>
04:29tomojshould've known
04:29tomoj*1 points to the previous thing you evaluated in the repl
04:30tomoj*2 to the thing before *1
04:30yunfanyes, but it's empty while i have output of the previous cmd
04:31yunfanoop, i got it,
04:31yunfanthe sample which defined a function using println to output strings
04:32yunfanwhile the eval of that function's return value is nil, so althought it outputs somethings, but *1 is nil
04:39yunfantomoj: do you have any earlier clojure version that (println "xxx") the expr itself's value is "xxx"
04:40tomojI don't think that was ever the case. if it was, it was a long time ago
04:45yunfanthen how the book use that sample
05:08NeedMoreDesue
06:09tsdhtechnomancy: 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.
06:26NeedMoreDesuHi. I've made some library, inspired by erlang's actor system. https://github.com/NeedMoreDesu/gen Need someone criticized me.
06:41noprompttsdh: i recently did a lot of work on something similar for vim's handling of re in clojure. it was epic.
06:44tsdhnoprompt: Oh, it was quite simple with emacs, especially as it was already implemented for elisp (but with a different regex syntax of course). ;-)
06:44noprompttsdh: it looks far more pleasant that this monstrosity https://github.com/noprompt/vim-clojure-static/blob/71f1ae607223f91fbfe5c6617c59ffc581e5b195/syntax/clojure.vim#L77-L101
06:45noprompttsdh: so does the highlighting in emacs cover character classes, quantifiers, etc.?
06:46noprompti've always found that stuff helpful when working with re.
06:46nopromptman elisp makes me so jealous.
06:47tsdhnoprompt: Not yes, I just highlighted grouping constructs so far, e.g. in #"(?<aNamedGroup>foo|bar)" (?<aNamedGroup>, |, and ) are highlighted.
06:47tsdhs/yes/yet/
06:48tsdhDitto for normal (, (?:, (?<=, (?<!, ...
06:49noprompttsdh: if you have the nerve to attempt to properly cover 99% of the allowable unicode character classes, hehe, ping me.
06:50tsdhnoprompt: I'm not going to tackle that before I've won some millions in the lottery. ;-)
06:51nopromptlooking back on it, i think just matching \p{[a-zA-Z_]+} might have been fine
06:51nopromptbut 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
06:51nopromptconstructing the patterns and checking if they were valid
06:52nopromptnasty stuff.
06:52nopromptwe wanted to go for completeness and correctness though.
06:53tsdhYep, 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.
06:54noprompthaha, indeed! and if the compiler/interpreter/reader throws and error the programmer can figure it out.
06:54noprompts/and/an
06:55noprompton the flip side though, i learned a lot of random stuff about unicode and regex in java.
06:57nopromptbtw if you do decide to plugin the unicode support, don't forget about the shortcut versions: \p[CLMNPSZ]
06:57tsdhIndeed, but there are still more enjoyable ways to nirvana.
06:58nopromptthe only thing i don't know if i can solve is matching comments in (?x..) patterns.
06:58nopromptthat's a hard one.
06:59tsdhcomments?
06:59clojurebotcomments is http://www.cc.gatech.edu/computing/classes/cs2360/ghall/style/commenting.html
06:59nopromptwell, there's an easy way, but it's probably not efficient.
07:00tsdhOMG, just seen it: (?#an-embedded-comment)
07:00tsdhCrazy
07:03nopromptthey're nice for when you want to explain why you're crazy to someone.
07:05nopromptthey'd be nicer if they only went to the next unescaped ) instead of the end of the line though.
07:06nopromptruby did a good job with that.
07:08noprompthmm, they seem to cause trouble with the clojure reader too.
07:09pwnedwhat did ruby do?
07:10nopromptpwned: ruby has the ?# modifier which allows you to nest comments inside a regular expression.
07:10noprompt%r{[a-z](?# This is a comment)}
07:11pwnednoprompt: cool I had no idea
07:11nopromptjava has the ?x which both ignores white space AND allows comments marked by # and continuing to the end of the line.
07:12nopromptbut going to EOL instead of just the next unescaped ) is a big downer.
07:12pwnedhttp://rubular.com accepts it :D
07:13nopromptwelp. i gotta get some sleep.
07:16pepijndevosdoes core.typed have type variables?
07:21mpenetpepijndevos: yes
07:21mpenetpepijndevos: it's done with "All"
07:22mpenetthere are tons of good examples on this file: https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/ann.clj
07:22pepijndevosmpenet: I just started reading that
07:23pepijndevosWhat 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
07:24mpenetI am not 100% familiar with objects yet, but there is some basic explaination in clojure-doc.org
07:25mpenetpepijndevos: http://clojure-doc.org/articles/ecosystem/core_typed/filters.html
07:25mpenetnot :object I meant :filter
07:28mpenetin 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
07:28mpenet:object {:id 0} I have no clue
07:29pepijndevosit's weird, I'd expect it to be just a -> a
07:29mpenetit's to allow better checking against filter for instance I would think
07:30pepijndevos?
07:30mpenetfalsy values
07:30mpenet(filter identity map) etc
07:30pepijndevoshm
07:30mpenetbut as I said I am still not comfortable with that stuff
07:32pepijndevosI seem to have read something about HMaps, but I can;t find it anymore
07:32mpenethttp://clojure-doc.org/articles/ecosystem/core_typed/types.html
07:32mpenetwell it's very thin on explainations but at least it's mentioned there
07:34pepijndevosassoc doesn;t seem to be using the though...
07:34pepijndevoshttps://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/ann.clj#L102
07:35mpenetHMap is for heterogenous maps
07:35mpenetassoc can work on any map
07:35mpenetso it's more generic
07:35pepijndevoswhat maps are more generic that hetrogenous maps?
07:36mpenetassoc needs to work on maps with any mix of types in keys and vals
07:36mpenetex {1 :b [1 2 3] "asdf}
07:37mpenetmaybe generic was not the right term, it's confusing since it has a double meaning here
07:38pepijndevosIn my dictionary, a map from a to b is homogeneous, all others are heterogeneous.
07:39pepijndevosassoc seems to be about homogeneous maps, or is that not what (IPersistentMap b c) means?
07:40clgvpepijndevos: depends on what the surrounding (All [b c d] ...) means
07:40mpenetYeah you're actually right. I am getting confused here
07:41pepijndevos:( I was very curious what the type of assoc on hetrogeneous maps would be.
07:42clgvpepijndevos: I think the "All" might be a mathematical all quantor so that the assoc annotation is indeed for heterogeneous maps
07:43mpenetI read it as some kind of declaration of type variables to be used in the annotation.
07:46pepijndevosclgv: a what?
07:47clgvpepijndevos: I just tried to find a definition for "All" but failed... :/
07:49mpenetbut 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
07:49clgvpepijndevos: you could browse through ambrose's thesis to find the meaning of it
07:49mpenetheterogeneous*
07:49pepijndevosok
07:52mpenetnot "to one", to "the variables", but anyway
08:39tgoossensif you have a function valid-name? and a function set-name
08:39tgoossensif 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
08:39tgoossensbut
08:40tgoossenshow can you prevent that you set an invalid name then?
08:40tgoossensone idea i have is
08:40tgoossensgive validname function as a parameter
08:40tgoossensbut then again, that isn't very robust?
08:40tgoossensbut then again, how afraid are you of users?
08:40tgoossens(unnecessary paranoia)
08:41clgvtgoossens: you could use an approach similar to core.contracts I guess
08:42tgoossenshmm interesting
08:42tgoossensnever heard of it
08:42clgvtgoossens: humm, the example on the readme does not look like, what fogus wrote in his blog a while ago...
08:43tgoossensclgv: at first sight it doesn't seem to solve what i'm trying to do
08:45clgvtgoossens: 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
08:45tgoossenshmm interesting
08:45tgoossensso you can do the following
08:46tgoossensyou annotate a function and give that to a user
08:46clgvyeah. the function wrapped into a pre-post-valiadator...
08:46tgoossensis the original function modified?
08:46tgoossensor can i say
08:47clgvthe variable of the original function gets modified if you implement it via robert.hooke
08:48tgoossenshave you seen fogus' dire ?
08:48clgvtgoossens: "dire"? you got a link?
08:51tgoossenshttps://github.com/MichaelDrogalis/dire
08:51tgoossenssorry wrong name :)
08:52tgoossensi do not understand how that works
08:52clgvah ok. thats the reason google found nothing meaningful ;)
08:52clgvhe uses robert.hooke
08:54tgoossenshmmm
08:54tgoossensso what it does is
08:54tgoossens(defn functionX [a b ] .....
08:54tgoossensand ten
08:55tgoossens*Then
08:55tgoossensusing hooks
08:55tgoossensyou say
08:55tgoossens(hookstuff functionX ....)
08:55tgoossensand it will redefine
08:55tgoossenswhat functionX (in the namespace) means
08:55tgoossensby wrapping it
08:55jimkcarI'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?
08:56tgoossensclgv: and changing what belongs to "funcitonX" in the current namespace
08:56tgoossensok i just repeated myself
08:56Chousukejimkcar: I'd go with make simply because it's shorter
08:57noidijimkcar, make- seems to be more common in lisps
08:58tgoossensclgv: is that the idea ?
08:58jimkcarChousuke: and you can type it faster because it uses both hands.
08:58clojurebotNo entiendo
08:58tgoossens(def a 2)
08:58tgoossens(-> 3 (def a)
08:59tgoossens*
08:59tgoossensnvm
08:59jimkcarnoidi: thanks! helping to settle debate here.
09:00jcromartiewhy does Midje autotest not autotest!?!?
09:01jcromartiei.e. midje.repl/autotest only seems to automatically test when all the tests pass the first time
09:03jcromartieactually it seems that the "auto" part of midje.repl/autotest just doesn't work in nREPL
09:03jcromartieprobably because the testing happens in the background? and nREPL quietly disguises all of that?
09:04jcromartieit works fine from lein repl
09:04jcromartieblerg… this makes me want to abandon nrepl
09:16jcromartiehttp://www.youtube.com/watch?v=q9r96cXx0OU
09:39clgvclgv: yeah, pretty much. but I did not read through the dire source
09:39clgvlol
09:39clgvtgoossens: ^^
09:40clgvjcromartie: isnt the midje plugin responsible for autotesting?
09:43jcromartieclgv: there's midje.repl
09:45tgoossens:)
09:46clgvjcromartie: yeah read about it. I didnt know it replaces the lein plugin completely... gotta upgrade soon
09:47clgvtgoossens: I would just strip the variable syntax from dire
09:48clgvtgoossens: only symbol would suffice. the macro can do variable resolution
09:55clgvtgossens: 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:22ravsterhello all
10:23Frozenlockhello you
10:23Frozenlock
10:47jcromartieso, in a Compojure app, I think it could be said that the routes and controller are sort of merged
10:48jcromartiebecause you just define a controller as a handler
10:48jcromartiemaybe? I dunno
10:48weavejesterWell… It really depends on what you as a developer want to do.
10:49weavejesterYou could just pass the data directly through to another controller function.
10:49weavejesterThe idea of routes in Compojure is more to isolate your internal logic from the HTTP request
10:49jcromartiehm yeah
10:50weavejesterSo ideally your route will get all the information out of the request it needs, and then pass that data to a function.
10:50jcromartieso 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:50jcromartieso web/routes/foo.clj has (make-foo-api foo-state) which takes a reference to the state it nees and returns a handler
10:51jcromartieand web/core.clj does (defn make-app [foo] (context "/api/foo" (foo/make-foo-api foo)))
10:52jcromartieweb/routes/foo.clj just defines its handler in terms of "/"
10:52jcromartieso it can be located anywhere
10:52jcromartieyou could make two handlers using different state under different parent routes
11:27devinustechnomancy: why is lein so awesome?
11:30devinusi wish there was a good complex numbers lib for 1.5 :(
11:30hyPiRiondevinus: because you don't set your hair on fire? :)
11:31ambrosebspepijndevos: I'd also like to see the type for assoc :) I need a dotted type variable that works with "pairs" of types.
11:32pepijndevosambrosebs: so what does assoc currently do?
11:32ambrosebspepijndevos: hacky special cases.
11:33ambrosebspepijndevos: It can assoc keywords to heterogeneous maps.
11:33ambrosebspepijndevos: it can also assoc onto IPersistentMap things
11:34ambrosebsclgv: core.typed's "All" is just a bit of syntax around the internal Poly type.
11:35pepijndevosambrosebs: 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:36ambrosebsyep, there's a good example in clojure.core.typed.test.compiler, there's a type for the CLJS AST nodes.
11:38ambrosebspepijndevos: 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:39pepijndevosambrosebs: I assume it also only works if the key you pass to assoc is constant, i.e. not (assoc (somefn) blah)
11:40ambrosebspepijndevos: You only keep a HMap if you assoc on more keyword keys, yes.
11:41pepijndevoswhat do you mean by keys that are missing?
11:42ravsterhow do I view the binary representation of a number?
11:42pepijndevosA key that's missing has the type (value nil) right?
11:43pepijndevosravster: the Integer class has some method for this I believe
11:43ambrosebspepijndevos: (HMap {:a Number}) guarantees that an :a is present, but makes no guarantees as to whether keys are absent.
11:43ambrosebspepijndevos: See this thread: https://groups.google.com/forum/?fromgroups=#!topic/clojure-core-typed/1OATmVMAYYw
11:44ambrosebspepijndevos: Currently the best we can do is Any, because we don't *know* if a key is absent.
11:45ravsterthanks pepijndevos, will look into that.
11:46pepijndevosambrosebs: why any? It's not suddenly going to return a string is it? It's either Number or nil.
11:46ambrosebspepijndevos: Looking up :b in a (HMap {:a Number}) tells us nothing about :b's entry.
11:47pepijndevosuhm, right
11:48pepijndevosSo what you want from :optional is to say that *if* a key is there, it's an int?
11:50ambrosebspepijndevos: Yes. I've only recently realised it doesn't quite work that way.
11:50pepijndevosI''d say (HMap {} :optional {:a Number :b Long}) should equal (HMap {:a (U Number nil) :b (U Long nil})
11:51pepijndevosthat 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:52ambrosebspepijndevos: 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:53pepijndevos(doc find)
11:53clojurebot"([map key]); Returns the map entry for key, or nil if key not present."
11:55ambrosebspepijndevos: we can also specify a different default value with `get`.
11:56pepijndevosambrosebs: I know. It just seems to me that nil is exactly intended to signal the absence of a value.
11:58ambrosebspepijndevos: 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:59tsdhWasn't there some function combining filter and remove, similar to how split-with combines take-while and drop-while?
11:59ambrosebspepijndevos: I try to be as explicit with `nil` as possible, also favouring more accurate types in general.
12:00ambrosebs(doc group-by)
12:00clojurebot"([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:00ambrosebstsdh: group-by seems close.
12:00pepijndevosambrosebs: I understand. Maybe a special Absent type? Hmmmmmm...
12:02pepijndevostsdh: if f is cheap (juxt filter remove) does the job. I seem to remember code-golfing this function with amalloy.
12:02ambrosebspepijndevos: There's a quick-fix, and there's a more substantial one.
12:02tsdhambrosebs: Hm, close.
12:02pepijndevosambrosebs: the row polymorphism you mentioned?
12:03ambrosebspepijndevos: that's the harder route, yes.
12:04tsdhpepijndevos: Yep, (let [[good bad] ((juxt filter remove) pred coll)] ...) will do.
12:04ambrosebspepijndevos: 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:04ambrosebspepijndevos: Although, just looking at it, the row seems redundant now..
12:05ambrosebsI'm still new to row variables.
12:05FrozenlockIf any of you want to help a poor soul in need (me) with its Google problems https://news.ycombinator.com/item?id=5415995 :)
12:08ambrosebspepijndevos: perhaps it's worth implementing :without for now
12:10pepijndevosambrosebs: btw, I just checked out the repo and got a dependency error for tools.analyze
12:10ambrosebspepijndevos: using lein?
12:10pepijndevosyea
12:11pepijndevosoh, am I uspposed to use maven? That seems to be some sort of rule for contrib rpojects?
12:11ambrosebsno, maven doesn't work yet, I need some assistance to get it compiling.
12:12ambrosebspepijndevos: just having a look around for the issue
12:12pepijndevosyou just need more xml I think…
12:13ambrosebspepijndevos: hehe no it seems like a bug in Clojure's compilation.
12:14ambrosebspepijndevos: core.typed doesn't compile.
12:14ambrosebspepijndevos: seemed to work for me :/
12:14ambrosebsRetrieving org/clojure/jvm.tools.analyzer/0.3.2-SNAPSHOT/jvm.tools.analyzer-0.3.2-20130321.151954-5.pom from sonatype-oss-public
12:14ambrosebsIs that the version on the repo?
12:14pepijndevoslet me try...
12:15ambrosebspepijndevos: to be clear, use lein not maven.
12:15pepijndevosoh, works….
12:15ambrosebs:)
12:16pepijndevosthe maven gods must have been angry or something
12:16ambrosebsI had some trouble deploying to sonatype a few hours ago, got a 401 error.
12:16ambrosebsPerhaps it's just a bad day
12:20ambrosebsmpenet: pepijndevos: the :object in the type for `identity` just says that the argument's "path" is preserved in the return type.
12:20ambrosebsA path is an ordered sequence of operations from a starting point, say from a local binding.
12:20ambrosebs(let [a (..)] (-> a :a :b :c))
12:21ambrosebsThe path of that expression would be (:a :b :c) from local `a`
12:21pepijndevosoh, uhm… nice?
12:22ambrosebspepijndevos: `identity` isn't all that interesting, but it's useful for recovering the types of HMaps
12:22ambrosebsWe 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:24pepijndevosso wht would happen if identity did not have the extra stuff?
12:25ambrosebspepijndevos: the :filters are the most useful part of identity's definition.
12:26ambrosebspepijndevos: although.. there is weirdness there too.
12:26ambrosebseg. (filter (fn [a] a) [...]) is more accurate than (filter identity [...])
12:27ambrosebsI don't know how to solve that issue.
12:27pepijndevosO_o why is that?
12:30TimMcambrosebs: wut
12:30ambrosebspepijndevos: brief explanation here http://clojure-doc.org/articles/ecosystem/core_typed/limitations.html#using_filter
12:31ambrosebsunforunately it seems the Typed Racket guys have put some thought into this problem and don't have a solution :(
12:32TimMcOh, so (fn [a] a) won't Just Work, you also have to annotate it.
12:34ambrosebsTimMc: ah, yes forgot to mention that.
12:34ambrosebsTimMc: It sucks, I'm working on an improved algorithm.
12:34pepijndevosBut 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:36pepijndevosI would think it's just [(Any -> Any) (Sequable a) -> (Sequable a)]
12:41mpenetambrosebs: about :object what does the :id and :path key refer to exactly?
12:45clintmYay, I figured out my problem whilst composing a clear, succinct question for this channel. IRC is the new/old rubber duck.
12:49ambrosebspepijndevos: The type you gave could never filter nils out of a (Seqable (U nil Number))
12:50pepijndevosambrosebs: oh, so a filter can actually change the type… hmmmm
12:50ambrosebsmpenet: yes, there's no equivalent in typed languages I think.
12:51ambrosebsmpenet: :id is a name of the local binding
12:53ambrosebsmpenet: the idea behind objects is to track a local binding and the "path" you have travelled down it.
12:54ambrosebs{:id 0} abstracts over the id of the first argument. In (let [a ..] (identity a)), {:id 0} would be instantiated to {:id 'a}
12:55mpenetok, I suspected this was an arg index
12:55ambrosebsThe simplest object is that of a local: (let [a ...] a) has an id 'a, and an empty path.
12:55ambrosebs(let [a ...] (-> a :a :b)) has an id 'a and a path ((KeyPE :a) (KeyPE :b))
12:55ambrosebsKeyPE = Key Path Element
12:56ambrosebsThere's also class path elements. (class a) has the object {:id 'a, :path [(ClassPE)]}.
12:56ambrosebsYou can combine them freely. (-> a :a :b class) works as you'd expect.
12:57ambrosebsmpenet: 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:58ambrosebsThey have CarPE and CdrPE
12:58mpenetok that makes a bit more sense. I think. I can find documentation on this on Typed Racket doc I hope
13:00ambrosebsmpenet: I'm not sure. You may need to open a dissertation or a paper :)
13:04ambrosebsmpenet: you'll probably almost never have to deal with objects directly.
13:04mpenetright :) 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:04mpenetgood!
13:04ambrosebsmpenet: Objects should be almost completely invisible in everyday use.
13:13tieTYTif I want to parse html and query the structure, do you guys recommend enlive?
13:20rplacacurrent status: http://www.youtube.com/watch?v=0I6xkVRWzCY :)
13:32tylerwould angular be considered FRP?
13:50Bronsak
13:50nollidji'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:53RainbowDash_Hey guys
13:53RainbowDash_Does anyone here program in Turing
13:54nollidji 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:54RainbowDash_Turing is the most up to date and best language you can program in do any of you noobs use it?
13:55dxehno
13:55dxehjust no
13:55RainbowDash_What's wrong with turing what are you some gay C++ user?
13:55dxehwell yes, i can program in c++, i used to program in turing when I was a youngster
13:56tbaldridgewait!....don't continue this debate until I pull out some popcorn...
13:56dxehlololo
14:05TimMctechnomancy: Do you know of a way I can specify additional clojure forms to indent like with-*?
14:06TimMctechnomancy: 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:08nDuff(which operates on clojure-defun-indents)
14:08nDuff...so I'd think you could add to the clojure-defun-indents list...
14:09nDuffTimMc: try M-x customize-variable clojure-defun-indents
14:11TimMcnDuff: So in a dir-locals file, I would put (clojure-defun-indents . (do-monad ...))?
14:14TimMcThis is what I have so far, and it doesn't seem to have any effect: https://gist.github.com/timmc/5215321
14:14TimMc(Emacs does pick it up.)
14:15amalloyTimMc: ((clojure-mode (clojure-defun-indents quote (at-revision)))) ;; this is in one of my .dir-locals.el files
14:15RaynesTimMc: Your Emacs is broken, effective immediately.
14:15amalloyit looks silly, of course, but that's equivalent to ((clojure-mode (clojure-defun-indents . '(at-revision))))
14:19TimMcnop
14:23TimMcamalloy: customize-variable even shows the symbols, so I guess something else is wrong.
14:23amalloyTimMc: what happens if you add it yourself via the customize interface?
14:24TimMcIt's already there. :-/
14:24amalloyso go to a different file
14:24amalloyobviously that's not the final solution you want, but it will narrow down whether the problem is related to dir-locals at all
14:25TimMcOK, works now in that file.
14:25TimMcI can't seem to get any consistency as to whether that variable is already set properly.
14:29TimMcamalloy: All the examples I see for dir-locals use a pair for mode/varaibles
14:33amalloyokay? so does my example
14:33TimMcThat's not what you pasted above.
14:33TimMcThat is, there's no dot after clojure-mode.
14:34amalloyTimMc: like i told you, (clojure-defun-indents quote (at-revision)) is just how the printer interprets (clojure-defun-indents . '(at-revision))
14:34TimMcOh... you're also using one fewer set of parens.
14:34TimMcamalloy: Yeah, that's not actually what I'm talking about, though.
14:36amalloywell, it's certainly possible my .dir-locals file is wrong
14:36TimMc(I mean, I'm not talking about that *part* of the snippet.)
14:36amalloyi was going through the same kind of confusion when i wrote it as you are now, and i might have just given up
14:37Bronsais github down only for me?
14:38tieTYTshould clojure be added to this? http://en.wikipedia.org/wiki/Design_by_contract#Languages_with_native_support
14:46S11001001Bronsa: http://downforeveryoneorjustme.com/github.com
14:46hyPiRionBronsa: not here
14:47Bronsasucks to be me then i guess.
14:53solussdWhy 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:54solussdi mean, I know that is what happens, but why? nil isn't a symbol like any other symbol?
14:55hyPiRion,(if false (nil 1 2))
14:55clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
14:55hyPiRion,(if false (1 nil 2))
14:55clojurebotnil
14:55solussd:) my point exactly.
14:55hyPiRionuh, well, I thought that last one should crash.
14:56hyPiRion,(if false (unknown 1 2))
14:56clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: unknown in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:56hiredmanreally 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:56solussdthis will work: (defmacro callme [f] `(let [f# ~f] (if f# (f#))))
14:57solussdeven if I feed it nil
14:57hyPiRionOkay, that's strange. It somehow checks if the nil is used as calling element compile-time
14:57hyPiRion,(if false (true :?))
14:57clojurebotnil
14:57solussd,(let [blah nil] (if blah (blah)))
14:57clojurebotnil
14:57solussdit really is a special case for nil
15:03xeqisolussd, hyPiRion: should the body be `(if ~f (~f))
15:03xeqi?
15:04xeqi&user/nil
15:04lazybotjava.lang.RuntimeException: No such var: user/nil
15:04solussdxeqi: hyPiRion: yes, but that still crashes
15:05solussdbasically, if the compiler sees a form starting with nil, it throws an exception
15:05solussdany other symbol is fine-- I guess nil is a function literal?
15:06solussd...or just a special case
15:06hyPiRionxeqi: I was merely curious why the behaviour solussd explained exists
15:06hyPiRion,(if false '(nil 1 2))
15:06clojurebotnil
15:06hyPiRion,(if false (nil 1 2))
15:06clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
15:06hyPiRion,(if false (1 :this :is :somehow :okay 2))
15:06clojurebotnil
15:06solussdidk.. just annoying that I have to (defmacro callme [f] (let [f# ~f] (if f# (f#))))
15:07technomancyTimMc: I recommend just renaming your macros that need that to with-[whatever]
15:07xeqihmm, that is strange
15:07hyPiRionsolussd: Well, that's safer though
15:07Okasu,({} [] ())
15:07clojurebot()
15:07hyPiRionalways `let` the values you unquote.
15:07Okasu,({} ,,,,,,[] ,,,,,())
15:07clojurebot()
15:08solussdhyPiRion: safe from what? If I'm splicing in the actual value, that's safe. :)
15:08Okasu,`({},,,,,,[],,,,,(),,),,,,,
15:08clojurebot({} [] ())
15:09hyPiRion,(let [a (atom 1), f (swap! a inc)] `(if ~f (~f)))
15:09clojurebot(if 2 (2))
15:09hyPiRiongod dangit
15:09amalloytechnomancy: just one macro will do, har har: (defmacro with-indentation [& body) body) (with-indentation (my-macro foo blah))
15:09hyPiRion,(let [a (atom 1), f '(swap! a inc)] `(if ~f (~f)))
15:09clojurebot(if (swap! a inc) ((swap! a inc)))
15:09technomancyamalloy: sweet
15:10solussdhyPiRion: ah, I see
15:11solussdwhat 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:12xeqisolussd, 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:13solussdxeqi: thanks. i hate impl details.. :)
15:13solussdstill wondering my the namespace used by def is determined at read time. :/
15:14ohpauleezlynaghk: ping
15:14hyPiRionsolussd: for hygiene
15:15solussdbut 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:16hyPiRionif 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:16solussdusing intern is fine, but there are things built on top of def (defn, defrecord, etc)
15:17Chousukeyou can temporarily switch namespaces perhaps
15:17hyPiRionuse ~'foo instead
15:17hyPiRion,`(~'into ~into)
15:17clojureboteval service is offline
15:17hyPiRiondangit clojurebot, ##`(~'into ~into)
15:17lazybot⇒ (into #<core$into clojure.core$into@13968ec>)
15:18hyPiRion&`(~'into into) ;; I mean
15:18amalloybetter still, don't write frameworks that depend on defining global symbols in someone else's namespace
15:18lazybot⇒ (into clojure.core/into)
15:18solussdamalloy: it's defining symbols in my namespaces (that may or may not yet exist when the macro is expanded / result executed)
15:19amalloyyeah, i realize that. i'm recommending you not do that
15:19solussdamalloy: also, not library code, but building up models in a webapp
15:23ozzloydoes 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:23tieTYTozzloy: i'm a newb, but that might be what trampoline does
15:24tieTYTat least I think trampoline is for solving the startup sepeed problem
15:24amalloysolussd: 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:25solussdamalloy: 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:25xeqitieTYT: not quite, it ends lein's vm before starting the project vm. Its for memory or stdin issues
15:25solussdbut I'll read it. :)
15:26xeqiozzloy: what do you mean by "script"?
15:26tieTYTxeqi: oh
15:28ozzloytieTYT, cool, i'll look into that
15:28solussdamalloy: ok, this is good stuff- thanks
15:28tieTYTozzloy: apparently i'm wrong about that
15:29ozzloyxeqi, by "script" i mean a job i run by hand every so often, like finding possible duplicates in my music collection
15:29ozzloytieTYT, bummer
15:31tieTYTwhat does the ^ mean when it's used before a parameter in a function? Eg: [^String ...]
15:31xeqitieTYT: thats a type hint for the next symbol
15:32tieTYTmakes sense
15:33xeqiozzloy: 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:33tieTYTxeqi: why doesn't it need a .?
15:34mattmosstieTYT: the type hint isn't a method call… it's meta info
15:34xeqitieTYT: a . ?
15:34xeqiah, interop call
15:34tieTYTyes
15:34tieTYTi thought . was for all interop, not just a call. That makes sense
15:36tieTYTseems to me that protocols are just like haskell's typeclasses
15:42ozzloyxeqi, i'll look into that
15:44mikerodWhy 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:48tieTYTif a variable/function is wrapped in astericks, does that mean anything special?
15:49joegallogenerally 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:50tieTYTis that simply a convention?
15:51joegalloyes, as i understand it, it's a very old lisp tradition
15:52tieTYTok thanks
15:53joegalloyou're welcome
15:57xeqimikerod: it was part of a contrib library, which got split into seperate seperate smaller libraries that could get released on their own schedule
15:57uvtcI'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:58xeqimikerod: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go says you might find it in https://github.com/clojure/core.incubator/
16:01mikerodxeqi: Thank you for the information. I'll look at this.
16:14TimMcSanity check, please: https://gist.github.com/timmc/5216308
16:14TimMcThis throws an assertion error when fed "http", instead of just returning nil.
16:15nDuffTimMc: because you're trying to cast the nil to a java.net.URL, yes.
16:16nDuff...hrm.
16:17amalloyTimMc: cast isn't java cast; it's java instanceof
16:17amalloy&(instance? String nil)
16:17lazybot⇒ false
16:17nDuffTimMc: Sure you don't mean (defn wtf [s] (try {:post [(java.net.URL. s)]} (catch java.net.MalformedURLException murle nil)))?
16:17amalloy&(cast String nil)
16:17lazybot⇒ nil
16:17amalloyhm
16:18amalloyoh. TimMc: (cast String nil) returns nil, so the :post is falsey
16:18trptcolincast returns nil in this case? so the assertion fails?
16:18TimMcoh hell
16:19trptcolinheh
16:19TimMcMy thought process: "I should check for nil before I do the cast. No wait, nil can always cast. NIL CASE: ADDRESSED."
16:22hiredmancast is magic, it provides info for the compiler for method resolution
16:22hiredmansimilar to type hinting
16:24TimMchiredman: The compiler must special-case cast calls with a class literal in the first arg position.
16:25trptcolin,(source cast)
16:25clojureboteval service is offline
16:25TimMctrptcolin: (. c (cast x))
16:25trptcolinawww. it's just a fn, though, calls java's Class.cast, right?
16:25trptcolinzackly
16:26ravsterI'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:28amalloyhiredman: you're saying that the compiler knows (cast c x) returns an instance of c? i don't see that anywhere obvious
16:29hiredmanamalloy: 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:31ravsterI'm getting a response (upon restarting) getting "No acceptable resource available" HTTP code 406
16:32TimMchiredman: I know that int and friends do that...
16:56amalloytrptcolin: fwiw, the source of 'cast isn't necessarily enough to know that it just calls Class.cast
16:57trptcolinamalloy: outside of special-casing the analysis?
16:57amalloyfor 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:57hiredmanand it does that without argument checks
16:58hiredmanor did
16:58hiredman,(instance? Class)
16:58clojurebotfalse
16:58amalloyhiredman: you mean, without checking the number of arguments? yeah
16:58hiredmanthat really needs to be rewritten as an intrinsic
16:59trptcolinsure, i mean for all user-land knows. but that's the case for pretty much every function, right?
17:00trptcolinthere *could* be a special case in the compiler
17:00hiredmaninstance? is very *special* case
17:00amalloycould 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:02hiredmanamalloy: 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:02amalloyhiredman: 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:04amalloyie, the best an intrinsic could produce is something like "push String, push x, instanceof", but there's no such instanceof operator
17:04hiredmanhmmmm
17:05hiredmanok then lets over haul the intrinsic system
17:06hiredmanthey obviously should be ifns that be passed the bytecode generator so they can do whatever they want
17:06hiredman(like sticking a class in to the constant pool, etc)
17:11TimMcSpeaking of overhauling, has there been any progress on the digital CA thing?
17:18jonas11235guys, 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:21amalloyi 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:22abp,(into ["select * from x where id = ?"] '(1))
17:22clojurebot["select * from x where id = ?" 1]
17:22abpjonas11235 ^
17:25squidzdoes anybody know of any closure(google closure) compatible charting libraries?
17:27jonas11235abp: I will try it
17:27jonas11235abp: sorry, but I did that :)
17:28jonas11235abp: in my query I have a field with "IN (?, ?, ?, ?)" but the number of '?' is dynamic
17:29TimMcjonas11235: Should still work.
17:29jonas11235abp: if I receive a list with 20 ids, I generate a query with 20 '?' in the list
17:29TimMc&(into ["(?, ?, ...)"] (range 5))
17:29lazybot⇒ ["(?, ?, ...)" 0 1 2 3 4]
17:30jonas11235abp: TimMc: my problem is to do the bind
17:30jonas11235abp: TimMc: let me try the &(into
17:33muhooi 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:33jonas11235abp: TimMc: nope, it didn't worked :(
17:34TimMcjonas11235: That's not enough information to help you.
17:34TimMcmuhoo: map + update-in ?
17:34jonas11235TimMc: I already generated the query with join and repeat
17:35TimMc"It didn't work" doesn't contain much information. What happened?
17:35jonas11235TimMc: the problem is that I need to pass 20 variables but if I pass the list it count as only one
17:35amalloy~helpme
17:35clojurebotA 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:35jonas11235TimMc: "Unable to resolve symbol: & in this context"
17:37abpjonas11235: neither , nor & belong onto the start of what we posted. Those where only to trigger the bots in this channel.
17:37TimMcjonas11235: A compile error is very different from, say, a JDBC error.
17:38abpHm, he's probably overwhelmed by inacurate error messages.
17:38jonas11235TimMc: before that I was receiving: "The conversion from UNKNOWN to UNKNOWN is unsupported"
17:38abp:D
17:38abpreally?
17:38abphow did you do that?
17:38jonas11235TimMc: abp: what didn't helped me :(
17:39abpso, show us some examples of code and what it should result in and we give you hints.
17:40TimMcjonas11235: https://www.refheap.com/paste
17:41abpActually 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:42jonas11235abp: TimMc: https://www.refheap.com/paste/2c6dc53c5ea78a818d349b12a
17:43jonas11235abp: TimMc: I have another query working but without the list-to-parameters problem
17:44jonas11235TimMc: abp: I'm trying to bind a list of ids but I don't know the size of the list
17:45TimMcjonas11235: OK, so make a function that *just* builds the queries, and see if that works, and then see if the output makes sense.
17:45TimMcs/queries/query/
17:45muhooTimMc: thanks
17:45TimMcIt sounds like you're having trouble telling where the errors are coming from, so splitting up the problem is very important.
17:46jonas11235TimMc: are you saing to inject the ids when I generate the query?
17:46TimMcNo, I'm telling you to break the function into smaller pieces.
17:46jonas11235TimMc: instead of injecting placeholders?
17:46jonas11235TimMc: ok, let me do it :)
17:51jonas11235TimMc: https://www.refheap.com/paste/12799 same error but better code :)
17:53TimMcjonas11235: So this time, just call get-collaborators-query and print the result. Don't even try to talk to the database.
17:55nDuffIt's really obvious in Light Table, too.
17:56nDuffjonas11235: (id-placeholders ["1" "2" "3"]) => " IN (???)"
17:56squidz1Pedestal looks pretty interesting, but does it differe a lot from the usual compojure + libs?
17:56nDuffsquidz1: Pretty considerably, yes.
17:57squidz1nDuff: how?
17:57nDuffsquidz1: ...particularly the client-side state model.
17:57nDuffsquidz1: ...the interceptors are a departure, too, and a worthwhile one.
17:57squidz1is it more akin to a functional philosohpy now?
17:58bendlasnDuff: interesting, have you looked into that model yet?
17:58nDuffsquidz1: ...the state model enforces breaking your transitions down into small functions.
17:58jonas11235nDuff: you're right :( fixing that
17:58nDuffsquidz1: ...I'm not going to make pronouncements on philosophy, though.
17:59squidz1okay, 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:59nDuffbendlas: A bit, but I won't say I really understand it until I've built an application on top of it.
18:00nDuffI'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:00bendlassounds like I got have a look at it ...
18:05jonas11235TimMc: nDuff: now the query is right :) https://www.refheap.com/paste/e61b1af08103b3dd9861284d0
18:05jonas11235TimMc: nDuff: but I still have the same error: "The conversion from UNKNOWN to UNKNOWN is unsupported" when I try to execute it :(
18:07nDuffjonas11235: Have you ever pasted the exception, with its stack trace, ANYWHERE?
18:08nDuffjonas11235: ...or a complete reproducer (which necessarily includes database schema, any necessary sample data to reproduce, etc)?
18:08nDuffjonas11235: I don't think you've even given us the _class_ of the exception
18:08jonas11235nDuff: TimMc: sorry: https://www.refheap.com/paste/2ff10df14aaa0de3e2eb9e302
18:08nDuffAhh -- it's an error from SQL Server
18:09nDuffClearly, then, SQL Server's documentation is the place to start from in understanding it.
18:09nDuff...though, hmm; looks like it's happening in setting prepared statement parameters...
18:09jonas11235nDuff: 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:10nDuffjonas11235: Depend on the Java type. If it's Object..., then you need to pass a Object[]
18:10nDuffjonas11235: and that's as easy as using (into-array Object your-vector)
18:10jonas11235nDuff: it is a list of int
18:10nDuffa _list_, or a _vector_?
18:11jonas11235nDuff: vector
18:11mikerodIs 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:11hiredmandepends on your client
18:12mikerodAh, I've just been going through webchat.freenode.net for this.
18:12nDuff...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:12jonas11235nDuff: I tried to use setArray before (I did this query in java first) and it didn't worked
18:13jonas11235nDuff: yeap, clojure.java.jdbc
18:14tyler,(class (,,,,,,, + ,,,, 1 ,,,,,,,,,,, 4 ,,,,,,,,, ),,,,,)
18:14clojurebotjava.lang.Long
18:14tylerheh
18:14nDuffjonas11235: Then you just need to generate a larger vector. concat will do that for you.
18:15jonas11235nDuff: https://www.refheap.com/paste/717e7f8c0997577202892333e complete code
18:15nDuffjonas11235: ...as in: (sql/with-query-results rows (concat ["your query string"] your-arg-vector)
18:16nDuffjonas11235: right -- that's generating ["your query string" [arg1 arg2 arg3]], not ["your query string" arg1 arg2 arg3]
18:16nDuff...so obviously it won't work. concat is your friend.
18:16jonas11235nDuff: exactly :)
18:16jonas11235nDuff: are you saying to put the values in the query?
18:17nDuffOF BLOODY COURSE NOT.
18:17nDuff(sql/with-query-results rs (concat [(get-collaborators-query)] item-ids) ...)
18:18jonas11235nDuff: ok, let me try it
18:19nDuff...now, how did this become a question about SQL, not a question about "how do I generate a vector of this form"?
18:27jonas11235nDuff: https://www.refheap.com/paste/3a93dd19966ad7001275c34b7
18:29jonas11235nDuff: https://www.refheap.com/paste/0dfdf4f7461d1155609777f68 it generated a IllegalArgumentException
18:29jonas11235nDuff: Exception in thread "main" java.lang.IllegalArgumentException: "sql-params" expected vector [sql param*], found clojure.lang.LazySeq
18:31tylerim 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:32jjidojonas11235: ,(vec '(1 2 3))
18:32jjido,(vec '(1 2 3))
18:32clojurebot[1 2 3]
18:32jjidotyler: yep
18:33tylerso lists serve "double duty" being a datastructure and an evaluation context
18:33jjidotyler: unless quoted (like I did just above)
18:33jjidotyler: don't know what you mean by evaluation context, but sounds right
18:34jonas11235jjido: same problem :(
18:35jonas11235jjido: I tried with and without using concat
18:35jjidojonas11235: show me your call to sql-params now?
18:36jonas11235jjido: (defn get-collaborators [item-ids]
18:36jonas11235 (sql/with-connection @db
18:36jonas11235 (sql/with-query-results rs (concat [(get-collaborators-query item-ids)] ,item-ids)
18:36jonas11235 (first rs))))
18:37tylerTIL empty lists aren't seqs
18:37nDuffjonas11235: Have you tried breaking this down into pieces?
18:37nDuffjonas11235: for instance, have you looked at (concat [(get-collaborators-query item-ids)] item-ids)
18:37nDuffjonas11235: ...I assume you're developing in a REPL, right? Use that.
18:38hiredman,(contains? (ancestors (class ())) clojure.lang.ISeq)
18:38clojurebottrue
18:38hiredmanoh really
18:38jonas11235nDuff: it generates a lazy-seq
18:38jjidohiredman: are you sure it doesn't return the same for any type?
18:39jjidojonas11235: you need a vector
18:39nDuff,(concat ["hello"] [1 2 3])
18:39clojurebot("hello" 1 2 3)
18:39nDuffAhh, so it does.
18:39hiredman,(contains? (ancestors (class 1)) clojure.lang.ISeq)
18:39clojurebotfalse
18:39nDuff,(vec (concat ["hello"] [1 2 3]))
18:39clojurebot["hello" 1 2 3]
18:39nDuffjonas11235: ^^^
18:40jjido,(contains? (ancestors (class ())) clojure.lang.IMap)
18:40clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.lang.IMap, compiling:(NO_SOURCE_PATH:0:0)>
18:44amalloytyler, jjido: the reader certainly doesn't evaluate lists
18:45jjidoamalloy: tell me more?
18:45jjido,("" 5 3.5)
18:45clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
18:46jjido^ did it not evaluate the list?
18:47mattgordon(defn db-do-prepared [db transaction? sql & param-groups] …)
18:47mattgordon^ What is the simplest way to pass a seq of param-groups to that
18:47jonas11235nDuff: Worked! Thank you! :)
18:48mattgordonie. i need to inline the seq as each item in it represents a param-group
18:48abpmattgordon: apply
18:48mattgordonyeah i'm trying that. just need to futz more i guess
18:48jonas11235nDuff: the final version: (vec (concat [(get-collaborators-query item-ids)] item-ids))
18:48mattgordonoh woops
18:48mattgordoni *thought* i was trying that but dropped off my apply
18:49mattgordon*slaps head*
18:52mattgordonabp: thanks
18:55muhoohttps://github.com/Mikkeren/FizzBuzzEnterpriseEdition
18:56patchworkAnyone tried to make a web debugging interface for clojure ala werkzeug for python?
18:56patchworkgoing through the cdt stuff it doesn't look like it would be too difficult
18:57patchworkbasically just making a web frontend to cdt
19:05TimMcjonas11235: This would also work: `[~(get-collaborators-query item-ids) ~@item-ids]
19:10nollidji'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:11hiredmannollidj: I really hope you have that on a cron job and are not manually pasting it in every 4 hours
19:11hiredmanbecause that would be a waste of time
19:23jonas11235TimMc: ty
19:24Glenjaminhi guys, what's the runtime equivalent of ~@body?
19:24Glenjaminwait, never mind - that question doesn't make sense
19:24amalloy(inc Glenjamin)
19:24lazybot⇒ 1
19:24Glenjamini was thinking i could just use a function, but i need a macro
19:25amalloyif only more people stopped to realize their question makes no sense
19:26nollidjhiredman: i promise i'm not
19:27nollidjhiredman: 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:27Glenjamincurrently trying to find a balance between testing my middleware, which has fairly complex behaviour, and testing all of its helper functions in isolation
19:27Glenjaminlots of thinking, not enough hacking
19:31nollidjhiredman: do you say that simply because i seemed spammy, or because you don't think it's a good question?
19:33chessguygood evening everyone
19:33jimkcarhey hey
19:33hiredmannollidj: spammy
19:34chessguyi'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:36Rayneschessguy: Who is your friend?
19:36RaynesI'll tell you if he sucks or not.
19:36chessguyhaha, i've worked with him for 3 years, i know he doesn't suck
19:37chessguyhis name is Seth, also goes by foogoof
19:37RaynesI don't know him so he probably sucks.
19:37RaynesTell him Raynes says "Good evening, sir."
19:37RaynesHave fun with the Clojuring. :)
19:38chessguywe will
19:39DarkLinkXXXXWhat's the solution to this? I read a little about lists, but it didn't help me. http://www.4clojure.com/problem/4
19:39Glenjamin,(macroexpand '(->> body (with abc) (with def)))
19:39clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
19:40Glenjaminbah
19:40amalloyreally, Raynes? foogoof has at least been in here a few times
19:40Glenjamincan anyone tell me why that doesn't expand fully?
19:40Raynesamalloy: Perhaps I'm not as omnipresent as you, sir.
19:40brehautDarkLinkXXXX: did you not try at all?
19:40joegalloDarkLinkXXXX: http://clojure.github.com/clojure/ the documentation is here
19:40DarkLinkXXXXbrehaut, I tried a few things.
19:40chessguyhe helps run the DC clojure meetup
19:40joegalloand the documentation for the list function is http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/list
19:40joegallo,(list 1 2 3)
19:41clojurebot(1 2 3)
19:41joegallomakes a list containing 1 and 2 and 3
19:41joegallowhat things did you try?
19:41DarkLinkXXXX'(:a :b :c)
19:41DarkLinkXXXX"a" "b" "c"
19:41DarkLinkXXXXI forget the rest.
19:41joegallothat makes a list containing a list of :a and :b and :c
19:41joegallo"a" is not :a
19:42joegallo"a" is a string, :a is a keyword
19:42DarkLinkXXXXYeah. I figured that out.
19:42joegalloit would like the difference between "1" and 1 ;)
19:42DarkLinkXXXXI'm not new to programming, btw.
19:42RaynesNobody is trying to be mean to you.
19:42joegalloneither am i
19:42chessguycalling :a a keyword and a a symbol is going to freak me out for a while, coming from ruby
19:43Glenjamini'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:43RaynesIt'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:43RaynesI think that's the connection he was trying to make.
19:43joegallomaybe now is a good time to try that
19:44DarkLinkXXXXRaynes, Ah crap. I don't know either.
19:44Raynes:p
19:46amalloyGlenjamin: sounds like ->> with its arguments reversed
19:47amalloythough i think it will come out more readable if you just wrap the (with-x (with-y ...)) forms like god intended
19:48Glenjaminit's for mocks in tests, doing a few puts me pretty far indented
19:48chessguyso, anybody working on anything interesting in clojure?
19:49Glenjamini'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:49Glenjaminand then be able to compose them
19:52Glenjamini'm still confused as to why macro expand only seems to expand ->> once
19:55amalloyGlenjamin: macroexpand only expands the "outermost" form you gave it; it doesn't walk into subforms and expand them too
19:55Glenjaminah
19:55Glenjaminis there a variant that does that?
19:55amalloythe compiler :P
19:55Glenjaminheh
19:56amalloyclojure.tools.macro/mexpand-all does a reasonably good job, although it doesn't always produce exactly the same thing the compiler does
20:01Glenjaminright, trying to write it has convinced this macro is a terrible idea
20:04amalloyGlenjamin: (defmacro make-hard-to-read [& body] `(->> ~@(reverse body)))?
20:04Glenjaminthat worked, but i'd only have one form for body
20:04Glenjaminthen i started messing with butlast and gave up
20:04TimMcGlenjamin: Be aware that ->> currently has a bug in it.
20:04Glenjamino.O
20:05amalloythat's fixed in 1.5, isn't it?
20:05Glenjamingot to this: "(defmacro <<- [& body] (let [wraps (butlast body) body (last body)] `(->> (do ~@body) ~@(reverse wraps))))"
20:05TimMcOne would hope so.
20:05Glenjaminwhich doesn't work
20:05Glenjaminspeaking of versions
20:06Glenjaminwhen a dependency depends on an older version of clojure, what happens
20:06amalloywell, of course you can only have one form for body, if you want to make all but one into wrappers
20:06Glenjaminyeah, didn't think it through
20:06Glenjamindo they get compiled into byte code separately and interact only via the jvm?
20:07TimMc&(macroexpand `(->> a b (->> c d))) ;; Glenjamin
20:07lazybotjava.lang.StackOverflowError
20:07TimMcamalloy: Patch, test, and apathy: http://dev.clojure.org/jira/browse/CLJ-1121
20:08amalloyGlenjamin: you get one version of clojure to share, selected more or less arbitrarily
20:08Glenjaminoh, i noticed leiningen downloading the old one and got suspicious
20:11eignerchrisI'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:12eignerchrisin my repl i can do this: (def http-request-method (resolve (symbol "http/get")))
20:12eignerchris(http-request-method "http://www.google.com&quot;)
20:12eignerchrisand it works great
20:12eignerchrishowever when running my app, i get a java.lang.NullPointerException error
20:12eignerchriscan anyone shed any light? i'm stumped
20:13Glenjaminamalloy: this is the code i'm trying to simplify https://gist.github.com/glenjamin/75f8d17abef4db9ca9c7
20:14Glenjamincan't decide if it feels ugly to me because i'm not used to it, or i'm just doing too much stuff
20:14amalloyGlenjamin: 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:15Glenjamincheers, still not used to lisps
20:15Glenjamini found myself thinking about a haskell-style "where" clause the other day
20:15Glenjaminlike let, but with bindings at the end
20:15Glenjaminneed to give in to the parens i think
20:16amalloywell, implementing where would not be the worst thing ever, but it'd need just as many parens as let
20:22Glenjamini also figure, without the full laziness it's less useful
20:23Glenjaminin 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:23tylerwhat is a function like conj but instead of adding to front of list it replaces first element?
20:23Glenjamin(comp tail conj) ?
20:24Glenjaminno, that doesn't work
20:24tylertail isn't a function
20:24Glenjamin`(#(conj %1 (rest %2)) 1 [2 3 4])
20:25Glenjamin&(#(conj %1 (rest %2)) 1 [2 3 4])
20:25lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection
20:26Glenjaminoh right
20:26Glenjamin&(#(conj (rest %1) %2) [2 3 4] 1)
20:26lazybot⇒ (1 3 4)
20:26Glenjaminthere
20:29amalloyyeah, i suppose the haskell version would be like... (flip (:)) . tail?
20:29amalloysince we're mentioning tail
20:34tieTYTamalloy: to add to the end?
20:34tieTYT[1..3] ++ [x]
20:34tieTYTthat'll add x to the end
20:35amalloytieTYT: 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:35arrdemdo we really not have a math library newer than contrib?
20:35Raynesjava.math
20:35arrdemmeh.
20:35arrdemmmkay
20:35Raynesjava.lang.Math, even.
20:36tieTYTtyler kind of interrupted the flow, sorry
20:37muhoohmm, lein outdated gives me a weird error
20:37muhooorg.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:37muhooum, huh?
20:37Glenjaminsounds like it's outdated :D
20:38tylerwat is my fault?
20:38tylermuhoo: i saw you pop up in a google search in logs when i was searching for a fix the other day heh
20:39tieTYTnothing, i'm just making excuses
20:39tieTYTspeaking of haskell
20:40tieTYTprotocols are just haskell class types, right?
20:40Raynes'just' is a very strong word.
20:40tieTYTwhat's the difference?
20:40RaynesWhat you want to ask is "kinda sorta somewhat a little like"
20:41amalloytieTYT: they're close enough. some things just don't translate well, eg due to lack of static typing
20:41tieTYTok
20:41amalloylike, 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:42tieTYTto 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:42RaynesWell, there are multimethods.
20:42tieTYTare you talking about haskell's mempty? Isn't that a function of Monoid?
20:42amalloyindeed
20:43Glenjamincan you put multi methods into a protocol?
20:43tieTYTamalloy: hmm, trying to think about your sentence. I'm not that familiar with haskell
20:44kmicu@unpl flip
20:44tieTYTRaynes: ah yeah, those to me seem similar to protocols too. Like more convenience
20:45tieTYTi've never learned either. This is like my 3rd day learning clojure
20:45tieTYTamalloy: ok I think I get what you're saying
20:49ironmhello kmicu ;)
20:50kmicu, :hi
20:50clojurebot:hi
20:51ironm@google tutorial
20:55tieTYTamalloy: another diff between protocols and type classes is that protocols can't have an implementation
20:56muhootyler: yeah, i'm deeply regretting living in an era of public irc logging :-/
20:58muhooTimMc: 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:58muhoothere'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:53nightfly Does ClojureScript host it's own macros yet?
22:05bloopright 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:07bloop(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:44anthonyuhow does one clear or reset an (atom ()) back to empty?
22:47tieTYT2i 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:47tieTYT2does anyone knwo what method to call?
23:10xeqianthonyu: (reset! atom-name '())
23:32benkayhi team. opsbro here. devbro tells me i need to support clojure in production. can i get a ticket to the best practices train?
23:35RaynesThat was colorful.
23:36Raynesbenkay: What does 'support Clojure in production' mean? You need to make sure your production machines can run Clojure programs and such?
23:40benkaymore 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:40benkayI suppose working through a Clojure web framework deployment would be a step in the right direction.
23:41trptcolinbenkay: you'd probably be interested in http://palletops.com/
23:42taliosI think palletops would be overkill here, depending on how you're deploying your app, its more a question of "do you support java"
23:42brehautafternoon talios
23:42talios'lo brehaut
23:43taliosbrehaut - you may enjoy our latest podcast episode - all on typed clojure
23:43benkayhm. always interested in new ops tools, talios. thanks.
23:43brehautyeah, ive got it queued up
23:43amalloybenkay: 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:43brehautif i can stomach an hour of aussie and auckland accents. ouch
23:43benkaythanks amalloy.
23:43taliosbrehaut - harsh man harsh
23:45brehauttalios: theres a reason i dont do a podcast: i find the NZ and aussie accents super grating ;)
23:45Raynesbenkay: 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:46amalloyyeah, but devbro can install leiningen anywhere he has write permission to
23:46RaynesSure, but devbro asked opsbro to set it all up for him.
23:46taliosdevbro sounds lazy
23:46RaynesSo opsbro could go ahead and do that while he is installing the jre, perhaps.
23:46talioslein uberjar should give you all you need to deploy.
23:47taliosdepending on the "app"
23:47RaynesIf we keep using the word 'bro' in this context we're going to end up with a CljCon incident.
23:47taliosI hope opsbro or devpro sets this up in demo/staging first tho :)
23:48benkayopsbro lives to make infrastructure get out of devbro's way
23:48benkayit's a good relationship
23:48taliosRaynes - 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:49taliosi like opsbro, he sounds much nicer than the opsmonkey we have
23:49benkay*bow*
23:49trptcolintalios: whoa. whoa. whoa. you are antagonizing the scala fans.
23:49trptcolin;)
23:50ambroseb_Any tips for lazily loading sections of Clojure projects?
23:50taliostrptcolin - thats ok, this is IRC not twitter ;)
23:50trptcolinhehe
23:50brehauttalios: how can you like static types and functional programming and not want programming to be math
23:50taliosambroseb_ - er, eval? ;p
23:50trptcolinambroseb_: we do some wacky stuff with REPLy to help startup time out
23:51trptcolinambroseb_: e.g. https://github.com/trptcolin/reply/blob/master/src/clj/reply/initialization.clj#L80
23:52trptcolinthat file is... not simple :)
23:52brehauttrptcolin: ◎_◎
23:52ambroseb_trptcolin: ok this looks about what I expected.
23:53taliosbrehaut - 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:53brehautlols
23:53taliosthat got certain folk…. annoyed
23:53brehauttalios: by 'certain folk' you mean scala guys eh
23:53talioswell, Tony Morris ;p
23:54brehautlol
23:54taliosbrehaut - for the lolz: https://github.com/twitter/bijection/issues/41
23:55brehautwhy am i clicking this link :/
23:55taliosfor the lolz
23:55brehautthis reminds me of the why jquery deferreds are not Promise/A implementations (but backwards)
23:57brehauttalios: i reconfnise most of these words, but im pretty sure its in a foreign language
23:57taliosbrehaut: 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:58brehauttalios: i am totally pants at math
23:58taliosbrehaut: my teacher didn't appreciate me giving imaginary answers to questions involving imaginary numbers.
23:59brehautha
23:59brehauttalios: its 5pm on friday. this is not time for computers. ttyl
23:59taliosseeya