#clojure logs

2012-10-15

03:46kralnamaste
04:06josteinkno wonder I was getting the wrong behaviour :)
04:07tomojit seems like some ubuntu packages should have a warning label for developers
04:09josteinkyeah
04:09tomojrubygems too
04:18clgvsince leiningen has a built-in upgrade these distribution packages have no additional benefit over installing leiningen directly, I'd say
04:20josteinkyeah
04:20josteinkbut unless you -know- that
04:20josteinkthe default behaviour for most people is doing an apt-get install
04:21josteinkand assume they have a reasonably standard working setup
04:21josteinkwith leiningen you dont :)
04:21clgvwell, you know at least that a package of you linux distribution is very likely to not be uptodate ;)
04:22josteinkheh
04:22josteinkspeaking of which .. lein --version lists java 1.6 :P
04:24clgvuff
04:24clgvgo get that lein2-preview10 ;)
04:25antares_josteink: lein2 can use any JDK you want, just export LEIN_JAVA_CMD. I don't remember if lein1 can.
04:25clgvor at least 1.7.1 if you do not want to migrate to 2
04:25tomojclgv: for developers, no additional benefit
04:26tomojfor some ops people? dunno..
04:26clgvtomoj: is leiningen part of you software installation?
04:26clgvI am shipping uberjars ;)
04:26josteinkantares_: oh I no. I was just replying to clgv's comment about going with a distro's defaults and not being up to date ;)
04:27josteinkoh i know
04:27tomojme too
04:27tomojmaybe some hudson server though?
04:28tomojs/hudson/jenkins/
04:29clgvtomoj: ah well, I didn't setup something like that yet
04:30tomojreally I just imagine there are sysadmins who would get angry if they ever had to `lein upgrade`
04:31tomojI don't sympathize
04:31clgvprobably. but then you'd need some ppa-package for ubuntu to get the latest leiningen ^^
04:31tomojhuh. https://launchpad.net/~technomancy/+archive/leiningen
04:32clgvhmm nothing in there yet
04:33antares_there is someone who helps us get Lein2 into next Ubuntu and Fedora releases
04:34tomojquantal?
04:41antares_yes
04:57frawrHello
04:58frawrCan anyone tell me what the idiomatic way to make ajax calls is in clojurescript?
05:07tomojfrawr: the only idiomatic thing I know of is to use closure
05:07tomojwell, among some it is idiomatic to use jayq
05:10frawrI found some other examples using clojure. going to try these now. thanks.
05:11frawrAnd I thought using jQuery was discouraged. not jayq?
05:11lpetitclgv: hello
05:11tomojI'm not sure it's discouraged
05:11clgvfrawr: noir has some remote features.
05:11tomojdiscouraged by whom?
05:11clgvlpetit: hello
05:11tomojjayq just wraps jquery
05:11lpetitclgv: are you using Eclipse Juno ?
05:12tomojI guess it might look like jquery was discouraged because of the discussion about it
05:13tomojbut I _think_ that was mostly people getting angry because "closure", and the cljs team defending that choice
05:13clgvlpetit: no, not for production yet. I experimented with it at home. the REPL-issue happens with 3.7
05:14tomojclosure can't optimize jquery, but if you agree that using a cdn means jquery is free, no problem
05:15clgvtomoj: there was a statement by chris granger in his jayq lib
05:15lpetitclgv: ok, because I'm adding some trace statements using the Eclipse tracing facilities. Prior to Juno, activating the traces from the user side requires to start Eclipse with a -debug flag as well as specifying the location of a file containing debug options. Starting with Juno, it is possible to dynamically change the trace options from the Preferences.
05:15tomojyeah
05:15tomojpretty convincing
05:16tomojmy coworker thinks "if we don't use jquery we'll have to spend months rewriting it and its ecosystem"
05:16tomojI dunno if I agree but jayq makes him easier to convince
05:18frawrfor this project i don't really care about optimization.
05:19tomojjust make sure you keep jquery's wrongness wrapped up tight :)
05:19frawrin a seperate ns?
05:20tomojI mean, try not to let the nonfunctional parts of it infect everything
05:20tomojdunno how much jayq already helps with that
05:22frawrAah, i see. Well I just need to make a simple ajax call and that's all. Could even do it the vanilla way but I wanted to learn the right way
05:22tomojhmm
05:23tomojI don't think there is a very good way to deal with anything asynchronous in cljs yet anyway
05:23tomojyou lose dynamic bindings for example (hopefully that doesn't matter for you..)
05:24frawrnope =)
05:26clgvtomoj: but you'd loose those bindings in clojure as well
05:27tomojbut clojure has bound-fn
05:27frawrhmm, how do they influence one another?
05:27clgvah right. that on captures those explicitely?
05:27tomojyeah
05:30frawrbtw, does anyone know where to look for a clojure internship?
05:30tomojwhere are you located?
05:30frawrThe Netherlands, but I'd prefer an overseas internship
05:31tomojdoes that mean you want to go somewhere or telecommute?
05:31frawrgo somewhere
05:31tomojmind if I PM you?
05:31frawrGo ahead
06:35tomojI just realized you can type ";; foo" on the first line of a slime repl entry
06:35tomojthen use that as a bookmark in history
06:44Kototamahi, if I have the string of a JS method, how can I invoke it on the object in ClojureScript ?
06:44Kototamasomething like (.method obj) but where method is a variable
06:45BahmanKototama: Convert it to symbol and then call it.
06:58qRR7Bahman, how does one do that?
07:11hyPiRionjosteink: Why not fire up tramp?
07:11astraxqrr7. I'm pretty much a newbie so might be way off but try ((str "." variable) obj)
07:12qRR7astrax, you mean ##((symbol ".method") obj)
07:12lazybotjava.lang.RuntimeException: Unable to resolve symbol: obj in this context
07:12qRR7Well, let's give ##((symbol "+") 1 2 3)
07:12lazybotclojure.lang.ArityException: Wrong number of args (3) passed to: Symbol
07:13hyPiRionheh
07:13hyPiRionsymbol != function
07:13qRR7Indeed
07:13qRR7I'm pretty sure if that was possible the entire scoping model of the langauge would be pretty fucked
07:14clgv&((resolve (symbol "+")) 1 2 3)
07:14lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
07:14hyPiRionyou'd have to run eval to get that working. Though
07:14qRR7eval is about as evil as republicans, don't use, don't vote, and don't let your daughter marry it.
07:14clgvwell, lazybot doesnt like it but it works
07:15qRR7clgv, so like, resolve is a spcial form or a function
07:15clgvfunction.
07:15hyPiRiona function which maps symbols into functions
07:15clgvit resolves the symbol to a variable using the current scope
07:15qRR7As in, wha does (let [+ *] (resolve (symbol "+"))) evaluate to?
07:16qRR7to addition or to multiplication?
07:16clgv(let [+ *] (resolve (symbol "+"))) => clojure.core/+ and (let [+ '*] (resolve +)) = clojure.core/*
07:17qRR7So it doesn't resolve to the current scope and rather it's a pure function?
07:17qRR7Then there's honetly not a lot wrong with it.
07:17qRR7It just maps symbols to functions, random pure function
07:17clgvit depends on the state of the namespace so it is not pure
07:18clgvif you excluded clojure.core/+ and used my.lib then it would resolve to my.lib/+ provided you define + there
07:20qRR7Hmm, well, you can define your own my-resolve with identical behaviour if you watn right?
07:54clgvqRR7: you want to redefine resolve? why?
08:02bpris there a way to get nrepl to re-load the data_readers.clj file?
08:03bpri'd rather not have to ensure i've got *data-readers* bound properly
08:05tomojwell there are some private functions in clojure.core that can work
08:09bpryeah, i'm checking on that now
08:09bprthanks
08:12tomojseems problematic
08:13tomojI don't think you can do it straightforwardly in the repl
08:13tomojat least with swank, the second load-data-readers call does work, but you don't see the root value
08:13tomojso you still get the old readers
08:15tomojnrepl clone would probably preserve the old readers too?
08:15tomojmaybe there's a way to start a new session that would work?
08:16bpryeah, it might come down to that
08:18KototamaBahman: (let [x (symbol "introduction")] (.x js/ich)) does not work
08:23josteinkthe bad thing about running lein on a core i7 or a xeon
08:23josteinkis that you really have no idea how heavy it is ;)
08:29clgvKototama: it wouldnt work in clojure as well like said before. you have to resolve the symbol
08:47Kototamaclgv: but how do you invoke it with interop??
08:47lazybotKototama: Definitely not.
08:47Kototama(.resolved-sym obj) ??
08:47lazybotKototama: What are you, crazy? Of course not!
08:49clgvKototama: not with the short cut interop but with the longer version: (. obj (resolved-sym))
08:52Kototamahumm I get an error in clojurescript with (let [+ *] (resolve (symbol "+")))
08:52Kototamawhereas it works in clojure
08:52ro_stresolve isn't in cljs
08:52ro_stnone of the ns stuff is
08:54Kototamaok but then, sorry to ask again, but is there a way to invoke a JS method if I have its name as a string?
08:54ro_stanyone hosting datomic on heroku?
08:55ro_stKototama: i fought this battle and lost. i ended up manually populating an atom with string -> fn mappings
08:57Kototamahum ok maybe i'll just create a JS function that does that and invoke it from clojurescript but it's disapointing
09:05ro_stit's because the (ns) form in cljs is completely different to clj
09:05ro_stit's just a wrapper on top of google closure's provide/require
09:06Kototamabut it makes something common in JS impossible to do in ClojureScript, that's not good
09:07ro_stit's a moot point anyway because advanced compilation completely renames everything anyway
09:07`fogusro_st: I don't think Heroku is officially targeted (yet)
09:07ro_st`fogus: right now the plan is two reserved micro ec2 instances (a HA pair) for the datomic transactor and then two hk web dynos with peers
09:07tomojKototama: ((aget js/console "log") "hello")
09:08`fogusro_st, Kototama: Can externs not help you in this case?
09:09ro_st`fogus: no. he wants to store eg "my.app.name.space/fn" somewhere and then later find that fn in memory using that string. good old obj[ var ] won't work because adv compilation will munge those pretty names away
09:09tomojnot if you export :/
09:10`fogusDoh! I said the wrong thing. I meant export
09:10Kototamatomoj: this result in an illegal invokation
09:10`fogus(defn ^:export foo []...)
09:10tomojoh right
09:10`fogus!!
09:10`fogusDang.
09:10tomoj(.call (aget js/console "log") js/console "hello") ?
09:11ro_sttrue. in my case, i don't like having internal fns exposed.
09:11Kototamaactually i'm using the icanhaz library and templates are dynamically binded to to the ich object when loaded, so invokations take the form ich.templatename(arguments)
09:11tomoj(but if it's a cljs fun, don't need to do that)
09:14Kototamayour last code works
09:14Kototamathank you very much
09:28CheironHi, I have an atom (a {:a [] :b [] :c []}) how to add an item to a collection under a key (for example :a) ?
09:29clgvCheiron: (swap! a update-in [:a] conj item)
09:31Cheironclgv: Thanks!
09:34@rhickeyresults from Friday's cond-> name game are here: https://gist.github.com/3885504 - feedback welcome
09:38`fogusOh man! I love #clojure name games. Sorry I missed it
09:48TimMcrhickey: It would be really nice to see an example with each of those.
09:49TimMcOK, so when-> is a short-circuiting test-> ?
09:50@rhickeyTimMc: no, test has test expressions and when is conditional on the threaded value itself
09:50TimMcAnd let-> is like a -> with explicit stitching location?
09:50@rhickeytest-> when->
09:50TimMcOh, I see it now.
09:51@rhickeyyes, let-> just binds and you have to thread using the bound name yourself
09:51clgvrhickey: nice. I currently need something like that to conditionally add to a sequence
09:52clgvthat's similar to when-> but would need a predicate on the element to add
09:55TimMclet->'s naming is a little curious, since it can be used as -> or ->> or a "mix" of the two. I guess there's not much to do about that.
09:56clgvTimMc: mabye let=> ? ;)
09:57clgvoh I misread test-> - that seems what I want right now ;)
09:57pjstadigi've got clojure emitting invokedynamic callsites for instance method reflection
09:59clgvrhickey: so when-> and when->> are the new names for -?> and -?>>
09:59@rhickeyclgv: sort of, they use ordinary when logic, not nil? test
09:59@rhickeybut ? was dubious in those names as implies boolean
10:00clgvok :)
10:06djanatyn:)))
10:06ebaxtHi! Anyone know if the template support (https://github.com/brentonashworth/one/wiki/Design-and-templating) in ClojureScript One is available in a standalone lib?
10:07djanatynthe teacher of my java class just told us that instead of submitting java source code, we can just send her a class file
10:07dnolencemerick: do you have a :scope example? - core.logic users won't all get datomic since project.clj isn't really used by anyone but core.logic devs ... yet.
10:07`fogusebaxt: No
10:07djanatynso, if she's got some sort of testing code that runs the main method of a class, what do I need to do for her to be able to run my code?
10:07GoshHow do you do for(coll){if(cond) break} ? My current solution is (not (nil? (seq (filter #(< % 0) '(1 2 3 4 -1)))))
10:07ebaxt`fogus: OK, thanks
10:07djanatyndo I just put (:gen-class) in the namespace declaration, and create a function named "main"?
10:08cemerickdnolen: oh, I forgot it was a contrib -> mvn :-)
10:08djanatynor do I need to bundle clojure with everything?
10:08cemerickdnolen: just [com.datomic/datomic-free "0.8.3551" :provided "true"] should do it
10:08cemerickwait, sorry
10:08cemerickdnolen: [com.datomic/datomic-free "0.8.3551" :scope "provided"]
10:09cemerickcopy/paste error
10:09dnolencemerick: thx
10:11clgvdjanatyn: (:gen-class) and (defn -main ...)
10:11clgvGosh: you want the shortened seq as result?
10:11pjstadigstill very much a work in progress https://github.com/pjstadig/clojure/commit/8e42c823d3703c8fd4265a1d54caf9f5a68e7ec1
10:12pjstadig2x faster than plain reflection, an order of magnitude slower than type hinting
10:12pjstadigi think there's still some performance to be eeked out, though
10:12djanatynclgv: where will that class file generate?
10:12djanatyncan I just send her a class file, or do I need to send a jarfile after I do lein's uberjar
10:13clgvwell if you develop in clojure and AOT you better send a jar since you will get a lot of classes
10:13djanatynheh, okay
10:15clgvdjanatyn: but ask yourself what will she do if your sent in application does not work? with no sourcecode it's either 100% points or 0 points ;)
10:15pjstadigthere's a whole calculus of MethodHandles that i known next to nothing about (but I'm learning)
10:20`foguspjstadig: Thanks for helping to make Clojure relevant again! https://twitter.com/headius/status/251336909333348353
10:25pjstadighehe
10:25clgv`fogus: haha :D
10:31zerokarmaleftGosh: perhaps you want take-while?
10:32clgv$karma zerokarmaleft
10:32lazybotzerokarmaleft has karma 1.
10:32zerokarmaleftclgv: now i have to change my registered nick
10:33clgvwell, I just wanted to check ;)
10:34zerokarmaleftcurious how I even got a single point, since I rarely pipe up in here
10:44TimMc`fogus: Is Clojure a "new JVM language"? :-)
10:45pjstadighttps://twitter.com/headius/status/251474597633998849
10:46`fogusI don't know. But I've talked to Charlie about this topic and I think he'd have no qualms making an exception for Clojure in that case. :-o
10:49uvtcStrings seem to act like they're sequential, ex. `(doseq [i "hello"] (println i))`. But then why does ##(sequential? "hello") return false?
10:49lazybot⇒ false
10:49S11001001uvtc: try seqable? from core.incubator
10:51uvtcMm. https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L77
10:52TimMcuvtc: They're not sequential?, but they're seq'able.
10:52clgv&(seq "hello")
10:52lazybot⇒ (\h \e \l \l \o)
10:52uvtcSo there's ISeq, Sequence, and now I see there's a Sequable.
10:52clgv&(type (seq "hello"))
10:52TimMcYou can do ##(first "hello") because it calls 'seq on the arg
10:52lazybot⇒ \h
10:52lazybot⇒ clojure.lang.StringSeq
10:53TimMcseq special-cases strings.
10:53uvtcRight --- I'm familiar with each type having its own seq type.
10:53uvtcTimMc: Oh, interesting.
10:53TimMcYou can't use an interface test because Java doesn't allow post-hoc interface implementation.
10:54goraciohi is there alternative to curl in clojure ? i found slurp but if i want to get image then how to convert string to file ?
10:54TimMcuvtc: Same deal with arrays.
10:55uvtcTimMc: I see. Haven't had to touch arrays from Clojure yet.
10:55TimMcgoracio: You mean, get the image data?
10:55uvtcThanks all.
10:55goracioyep when i use slurp i get string of bytes i guess
10:56goracioTimMc: yep when i use slurp i get string of bytes i guess
10:57TimMcYou'll have to find a lib that can parse image formats.
10:57TimMcJava standard library might provide that...
10:57goraciohmm maybe there is alternative to slurp ?
10:58goraciosomething like curl
10:59TimMcgoracio: Are you just trying to write it all to file on disk?
10:59uvtcgoracio: https://clojars.org/clj-http ?
10:59goracioyes - what i need to get file and write it to local directory
11:00goracioalready looked at that
11:00goracioit gets all the session
11:00TimMcI could come up with a solution, but I suspect others already know a better answer.
11:01@rhickeypjstadig: that's cool - too bad it took them until Java 7 to get it in and probably 8+ to make it fast.
11:01pjstadigrhickey: yeah
11:01pjstadigi ran it on a java8 build
11:02pjstadigno dramatic performance improvement yet
11:02@rhickeyright
11:02pjstadigi wonder if i could be setting up the MethodHandles differently though to get better performance
11:02pjstadiglooking around at the JSR292 cookbook and such
11:03@rhickeypjstadig: one problem you'll have is that the underpinnings of that stuff is all going to change, and with it the perf profile
11:03pjstadigrhickey: not sure what you mean by "underpinnings"? you mean on the JVM site?
11:03pjstadigside*
11:04@rhickeyyes, John Rose presented a whole new plan for that at JVM language summit
11:04pjstadigi see
11:04@rhickeyessentially when the optimizer doesn't, it falls to an interpreter
11:05@rhickeyso he's making the intepreter something the JVM can optimize, vs now which is a lot of native code
11:06@rhickeyThe whole thing is full of promise, but I disagree with Charlie that this is something people should be using now for langs they intend for people to use now on JVMs they are using now.
11:06pjstadigrhickey: the "Lambda Forms" talk from 2012?
11:06@rhickeypjstadig: I think so
11:06goracioTimMc: https://github.com/gorsuch/clojure-curl-spike/blob/master/src/clojure_curl_spike/core.clj
11:07pjstadigrhickey: sure agreed, but sun keeps trying to deprecate java6...eventually the "JVM they are using now" will support invokedynamic :)
11:07goracioTimMc: :use [clojure.java.shell :only (sh)] and then (apply sh (curl-command url)) maybe that will work :)
11:07@rhickeyyes, but 7 doesn't well at this point, then we wait for 8 and oracle to pressure them into that
11:08clgvpjstadig: not used to oracle owning java now? ;)
11:08pjstadighaha
11:08pjstadigoops
11:08TimMcgoracio: I'm sure you could do something less hacky with inputstreams and outputstreams.
11:08pjstadigyeah i meant oracle
11:09@rhickeythe most interesting applications of invokedynamic for Clojure are not reflection sites, but dynamism in vars and protocol dispatch
11:09@rhickeyand keyword dispatch
11:10pjstadigrhickey: yeah reflection seems like an easy first target, but type hinting is probably always going to be faster
11:10@rhickeypjstadig: exactly
11:10pjstadigthough it would be nice to have a faster default than reflection
11:10pjstadigmaybe i'll experiment with vars or protocol fns next
11:11pjstadigi was thinking of trying to tackle multimethods, but you think it would be better to start with vars and/or protocol fns?
11:11chronnogoracio: http://stackoverflow.com/questions/11321264/saving-an-image-form-clj-http-request-to-file
11:12@rhickeypjstadig: multimethods are likely to remain dominated by the fact that you must call the dispatch function
11:12@rhickeysince you don't know what aspect of the args matter to it, and thus can't setup a guard
11:13@rhickeyvs say known binary dispatch on class
11:13TimMcCan you do something with the knowledge that a lot of multimethods dispatch on :type? :-)
11:14@rhickeyTimMc: possibly, but :type is broader than class
11:15goraciochronno: thanks will look at that
11:40antoineBhello is it possible to access a var given a string? (in clojurescript)
11:42antoineBi can use (js* "the.complete.name"), but i don't know how to get the current namespace
11:44Chousukedoesn't clojurescript have 'resolve?
11:44clgvseems not. that was discussed earlier today
11:50@rhickeynow with examples: https://gist.github.com/3885504
11:50@rhickeyanyone opposed to/confused by names etc?
11:57clgvrhickey: oh, test-> can't refer to the expr threaded through in its tests?
11:58@rhickeyclgv: no
11:59@rhickeyI had a version that could, not sure how often it would get used
12:00clgvrhicky: a version that can should probably have predicate like (fn [threaded, form-result] ...) to be general
12:01mpenetrhickey: test-> sounds like something that would be part of a testing library, it could be confusing.
12:02lpetitrhickey: let-> does not have the same symmetry as the others. Would let->> mean something?
12:04clgvI'd change the 'name in let-> to first position as it would be in (let [x 10] ..)
12:05duck11231does let-> support destructuring?
12:05lpetitduck11231: seems so, but you'd need the restructuring to work for each step
12:06duck11231right, that's still better than nothing
12:06yaziriani agree with clgv, let-> has its args backwards
12:06lpetitduck11231: hmm, no
12:07SgeoOh hey, the ordering of let-> does mean that it could be used within -> as far as I can tell
12:07lpetitduck11231: name must be a symbol, it's the returned value in the body of the macro-expanded let
12:08lpetitI see little value in let->, anyway
12:10@rhickeySgeo: yes, that's a big objective of let->
12:11Sgeorhickey, is being comfortably usable from within -> also an objective, because it seems to do that too
12:11@rhickeylpetit: let-> solves the problem of all threaded forms not first or last
12:11lpetitrhickey: I see it now
12:12@rhickeygets rid of libs like this: https://github.com/pallet/thread-expr/blob/develop/src/pallet/thread_expr.clj#L40
12:12@rhickeyerm, https://github.com/pallet/thread-expr/blob/develop/src/pallet/thread_expr.clj
12:13SgeoHmm, what's letfn?
12:13duck11231so, when-> is meant to replace -?>
12:13@rhickeyduck11231: well, -?> is not in core, but covers same ground yes
12:14@rhickeythe ? stuff is a mismatch with anypred?
12:14@rhickeyall of which are boolean
12:14SgeoHow about a monad->
12:14SgeoReplace Enlive's do-> (I think)
12:16@rhickeySgeo: link?
12:16antares_Clojure docs project progress report, week 1: http://blog.clojurewerkz.org/blog/2012/10/15/clojure-documentation-project-progress-report-the-week-of-october-14th/
12:16SgeoErm, I don't know of anyone who's defined a monad->, but do-> is defined https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L653
12:17SgeoI _think_ that do-> expresses the Reader monad, but I'm not sure, I haven't looked at it closely enough
12:18lpetitclojure.core.incubator/-?> stops threading when threaded value becomes nil, not falsy. Beware semantic regressions when time comes to migrate
12:18zerokarmaleftrhickey: nitpick, it seems inconsistent to have the binding order in let-> as expr name instead of name expr
12:18@rhickeyzerokarmaleft: that's to facilitate its use within ->, and the reason it doesn't take a vector of pairs
12:19@rhickeylpetit: understood, but who threads booleans?
12:20zerokarmaleftah, i see
12:22zerokarmaleftsorry, should've read scrollback
12:24lpetitrhickey: -?> was initially introduced to help threading interop calls, who know what does guys do with it ;)
12:24lpetits/does/those/
12:25@rhickeylpetit: they don't have to switch. wehn-> does what it says on the tin
12:25@rhickeywhen->
12:25duck11231I can see a potential use with threading boolean values. Less of a use for nil-sfe threading of those values
12:27@rhickeylpetit: but we don't yet have an alternative universe of not-nil boolean logic. I've thought about is? == not nil?, and things like is->, brings up when-is, if-is etc
12:27lpetitsure, I just wanted to highlight the corner case, 'cause of course once it's out the door, there will first be a word spread on when-> supersedes -?>, and then later "work for bloggers" explaining the pitfalls of looking not closely enough at what one does with respect to the other :) (and in the end, I'll be all for deprecating -?>)
12:29@rhickeylpetit: an alternative is that wehn-> would be nil?-based, but will that cause it's own confusion?
12:29@rhickeyits
12:30duck11231considering that difference. I can see the need for both of them. It's like how keep doesn't replace (comp filter identity)
12:30lpetitrhickey: yes, probably, since when works for falsy values.
12:31@rhickeymy guess is, given when->, no one will ever need the other
12:31jlongsterdnolen: is :import supported in `ns` in ClojureScript?
12:31lpetitrhickey: the ? in -?> had not this confusion, since it was intended to be a reminder of what is found in object oriented languages such as groovy with foo?.bar?. etc.
12:31dnolenjlongster: it is
12:32lpetitrhickey: I bet on it also
12:32lispnikhello. could someone enable me on clojure-dev and the dev.clojure.org jira? my CA was received a few weeks ago
12:32jlongsterdnolen: ok, the "differences" wiki page doesn't mention and differences but I'm getting the error "Only lib.Ctor specs supported in :import" for a simple line: (:import [ctco.expr.simple Simple])
12:33jlongsterI can continue to hack on it if the error isn't immediately obvious
12:33dnolenjlongster: did you try [ctco.expr.simple.Simple] ?
12:34gfredericksso I guess test-> won the cond-> battle?
12:34@rhickeygfredericks: that's what's being discussed, yes
12:34jlongsterdnolen: I did not, still not very familiar with all of the different forms for namespaces
12:34jlongstersame error
12:35gfredericksthese macros look quite useful
12:35dnolenjlongster: heh, it takes some time to figure out - tho really that's unnecessary if you want to use Simple in ClojureScript.
12:36dnolenjlongster: we added :import mostly for making GClosure ctors more pleasant to work w/.
12:37jlongsterdnolen: ok, I'll keep playing around with it. What do you mean that it's unnecessary though? Simple is a local, user-defined record in a difference file
12:37jlongster*different
12:38dnolenjlongster: :import is about foreign ctors (read ... not Clojure)
12:38jlongsterah, ok
12:38dnolenjlongster: so just :require foo and you can write foo/Simple in your file.
12:40jlongsteryeah, it seemed that :import was used so that you could just write (Simple. foo) instead of (foo/Simple. foo)
12:40jlongsterhttps://github.com/cjfrisz/clojure-tco/blob/master/src/ctco/util.clj#L29
12:40jlongsteranyway, I'm learning by assumptions here so I'll go read the real docs.
12:41dnolenjlongster: you can :use foo and Simple will work.
12:41dnolenjlongster: if it doesn't that's a bug.
12:41jlongsterok, I'll try that
12:41dnolenjlongster: :use :only to be precise
12:41jlongsterhow come Chris uses :import there?
12:42dnolenjlongster: because Clojure JVM types/records are backed by Java classes.
12:42jlongsteraah, ok. thanks!
12:42dnolenjlongster: doing that is a bit of antipattern - better for Chris to provide fns and not import types/records like that.
12:43jlongsterok
12:44hugodrhickey: pallet-thread will continue to exist. As far as I can tell the new macros don't cover the same use case.
12:46@rhickeyhugod: I don't see it - most of those are covered (better) by let->
12:46@rhickeythat lib special cases a bunch of constructs for use in ->
12:46@rhickeylet-> supports all constructs
12:47@rhickeyhugod: It's fine if it still exists of course :)
12:51jcrossley3weavejester: quick sanity check, please: the :context key in the ring request should return an empty string "" for an app mounted at the root context, right?
12:51weavejesterjcrossley3: I believe it's nil
12:52weavejesterjcrossley3: But nil and "" should be treated the same in this case, since a blank path prefix is the same as no path prefix.
12:53jcrossley3weavejester: so consider redirecting to a context-relative path: (redirect (str (:context request) "/some/path"))
12:53jcrossley3that should work for "" or nil
12:53weavejesterjcrossley3: Right
12:53jcrossley3weavejester: is there some helper somewhere that does that or is that just a known convention?
12:54weavejesterjcrossley3: Hiccup has a *base-url* binding, but there isn't any helper because :context is currently just a Compojure convention.
12:55weavejesterjcrossley3: However, I'm planning on adding it to Ring for version 1.2 since it's worked well as a de-facto standard.
12:55jcrossley3weavejester: good :)
12:55weavejesterjcrossley3: I'm toying with the idea of setting a *context* binding, but I'm not certain yet.
12:57dnolenrhickey: in the codeq podcast you mentioned there were some features in the CLJS analyzer that that you would like to see worked into codeq, anything specific?
12:57jcrossley3weavejester: how would that be more convenient than just having :context as a standard request key?
12:57amalloyi have to say i like let-> now that i've thought about it a bit. it's not that useful on its own (right?), but it's a great way to introduce some steps into a -> pipeline using some construct that doesn't ordinarily fit into the ->, like a for-comprehension: (-> x (blah) (let-> ys (for [y ys] (foo y))))
12:58amalloywhich i think is what hugod's stuff in pallet-thread is for?
12:59SgeoIt could be useful on its own I think, if the place to thread through varies a lot
12:59SgeoI could be wrong
13:01@rhickeyamalloy: right
13:01weavejesterjcrossley3: You wouldn't need to pass the request map or context explicitly when creating a resource with URIs
13:01@rhickeydnolen: I think we need to factor analysis a bit more, breaking out the js-isms
13:01amalloySgeo: certainly possible. i don't think that's nearly as common, especially because let-> means the name would have to stay the same: how often will it make sense to call something "xs" three or four times, and thread it through at a different spot?
13:02weavejesterjcrossley3: If you think about all the links on a HTML page and how often you'd need to pass the context to them
13:02@rhickeydnolen: in particular for codeq, we want an interpreter for ns forms that works completely i nthe analysis/environment space, not by affecting namespaces
13:02weavejesterjcrossley3: Also, just to clarify, the :context and :path-info keys wouldn't be part of the base Ring SPEC, but would be added by Ring middleware.
13:03weavejesterjcrossley3: Like :params is added by wrap-params, but isn't in the Ring SPEC
13:03TimMcamalloy: That's an argument for keeping the initial-value arg in the first position in let->
13:03@rhickeythen we could e.g. figure out the aliases created by ns, and attempt to resolve names in usages cases via a walk
13:03TimMc(Earlier someone was proposing having the binding name go first, which makes a different sort of sense.)
13:03amalloyTimMc: of course; that's where rich put it. is there some movement to change it? i don't think that's a good idea
13:03@rhickeythe ultimate target is to add uses to definitions
13:03@rhickeyusages
13:04@rhickeythis fn calls these others
13:04jcrossley3weavejester: that's cool. i guess i'm just equating the :request key to the servlet spec's getContextPath, which is kind of a punt, forcing the dev to dictate when it's used.
13:04@rhickeymacroexpansion aside
13:04pooya72So I feel like I walked into a room full of clojure celebrities ;) rhickey, dnolen, weavejester... me >:)
13:04hugodrhickey: the pallet-thread macros thread through the body of each of the forms - I'll have to try using the new macros, but I don't see how let-> replaces them (yet)
13:04technomancyI wonder if you could define a print-method for namespaces
13:04@rhickeyhugod: let-> binds the name, it's use in the forms is transparent and requires no work
13:05@rhickeyits, darn fingers
13:05dnolenrhickey: gotcha
13:06SgeoHow is let-> significantl better than pallet-thread's arg-> ?
13:06@rhickeyarg-> requires a []
13:07@rhickeythus not composable
13:08@rhickeyor, I guess it is , just ugly
13:08@rhickeyvery surprising to me that given its presence, the rest of the lib exists
13:09@rhickeythat lib gives me a headache
13:11SgeoI think the idea is that in the body of the other macros, the -> form still acts like it's in effect
13:11@rhickeySgeo: It's too complicated for me
13:12SgeoI think binding-> is the easiest to understand
13:12SgeoExample-wise
13:12@rhickeypallet-thread aside, looking for final feedback before I push this into core
13:13@rhickeyfor latecomers, this being: https://gist.github.com/3885504
13:17amalloyrhickey: the docstring for test-> could maybe use something clarifying that the tests are not threaded into
13:21`fogusrhickey: I apologize for arriving late to the party and potentially repeating someone else, but I'd love to see an example use in each docstring.
13:21@rhickeyamalloy: what would you guess otherwise? thread-firsting into predicates?
13:21amalloyrhickey: that's something i might guess, yes
13:22gfredericksI remember TimMc having that sort of impression initially the other day
13:25@rhickey`fogus: we don't do that elsewhere. Perhaps one day we'll have an :example entry per fn
13:25`fogusrhickey: Fair enough. I only ask because the examples are much easier for me to understand than the words. :-(
13:26@rhickeythere are examples at the bottom of the gist
13:26`fogusYep, those are the examples that I mean
13:26@rhickeyelse wait, codeq will show you examples in the wild soon enough :)
13:28hyPiRionDocumentation is the semantics of a function or macro, examples explain the documentation.
13:28`fogusrhickey: Speaking of, it seems that every time the Datomic team releases something you solve some massive issue that I was encountering the week before. Thanks for that.
13:29@rhickey`fogus: that's good!
13:29`fogusYou're helping me to fool my co-workers into thinking I'm some kind of genius! ;-)
13:29@rhickeyamalloy: is this enough? (refresh) https://gist.github.com/3885504
13:30amalloylooks good to me
13:31`fogusRIP Phil Bagwell. http://blog.typesafe.com/rip-phil-bagwell
13:31`fogusSad
13:32pjstadigwut?
13:32pjstadigthat *is* sad
13:32uvtcI just read about luriel on HN. Too many of these lately. :(
13:33pjstadigi had a good time talking to phil at the conj
13:34`fogusSame here
13:35yaziriansame here, had lunch with him, he was cool
13:39RaynesR.I.P. He gave me good advice and excellent conversation
13:40@rhickeyWe all owe Phil
13:40pjstadigis there information about a cause of death?
13:52olabiniRaynes: yeah, me too.
14:08iwilligis there an easy way to go from a structs.Map to a clojure map ? js->clj seems to return the stucts.Map
14:25XPheriorDoes anyone have a few minutes to help me review a read-me I wrote for a project? I want to make sure it makes sense.
14:25nDuffXPherior: You'd have a better chance of volunteers if you posted a link -- easier to decide whether to do an in-depth review of something when one can skim it first.
14:26XPheriorOkay, nDuff. https://github.com/MichaelDrogalis/zombie
14:28nDuff...so, some small quibbles: - assuming that everyone uses lein (it's sad, but not everybody can; see: projects w/ Maven dependencies, shops standardized on other build tools, &c); - assuming familiarity w/ QuickCheck (a line or two describing _how_ it's similar might be helpful).
14:28nDuff...the actual library usage and examples seem clear.
14:29XPheriorI did kind of gloss over those things, yeah.
14:29oskarthwhen I pull down a new dep with lein deps, my nrepl says it can't locate class on classpath, but when I restart nrepl process it works. How do I tell nrepl to update without me restarting it manually?
14:29XPheriorThat's good to hear that. It's kind of a different concept. Wanted to make sure the examples conveyed what the library is about.
14:30XPherioroskarth: I don't think you can. You need to restart the JVM, IIRC.
14:30hiredmanoskarth: you cannot, unless you add a dependency on pomegranate
14:30oskarthI see. And what's the easiest way to do that from emacs?
14:31oskarthfeels like I'm doing something wrong everytime I force quit it
14:31XPheriorI think you just jack-in again? Maybe?
14:32oskarthhm, that bugs if I have the same buffer name, but it works if I rename my current one
14:32oskarthworks well enough though. Thanks :)
14:34hiredmannrepl.el is not as pleasant to work with as slime+swank-clojure for all technomancy has deprecated swank-clojure
14:34XPheriorSure thing, oskarth
14:34hiredmanit is very rough
14:37djanatynhow can I get a keyword to evaluate to, uhh, a value that is bound?
14:37djanatyn(let [foo 10] (frobify :foo)) ;=> 10
14:37TimMcKeywords aren't used to refer to values.
14:37amalloydjanatyn: don't do it, man
14:37djanatynhaha, I was thinking I might be doing it wrong
14:38SgeoThat foo doesn't really exist, I think
14:38TimMcThere may technically be a way, but I might technically have to throw things at you.
14:38XPheriorThis is not the foo you were looking for.
14:38arrdemah the joyous cries of "you're doing it wrong"...
14:38ghadishaybanrhickey: any advice for taking a first whack at CLJ-1082, reducing over subvecs of primitive vectors?
14:38SgeoI think all instances of it in the let (including in the expansion of macros) could be replaced with bar with no effect
14:38TimMcdjanatyn: What are you trying to work around?
14:39amalloy*shrug* it's totally possible, if you only want it to work for literal keywords; but in that case it's not very useful
14:39SgeoI guess you could make a macro to scan for let and make those available in a dynamic var
14:39amalloySgeo: madness
14:39djanatynTimMc: I'm trying to build a tiny object oriented system in clojure to have fun with macros
14:39amalloy(defmacro frobify [k] (symbol k))
14:40XPheriorEeek, objects. Run.
14:40arrdemXPherior: ppft. they're not so scary.. just overgrown k->v maps
14:40XPheriorObjects put me in fostercare.
14:41djanatynI think I'm going to give up on this for now anyway
14:41djanatynclosures are fun
14:41SgeoWhy am I now reading Scala documentation?
14:41TimMcXPherior: :foo is an object. :-)
14:41XPheriorI choose to ignore hat, TimMc :)
14:41XPheriorThat*
14:41SgeoScala has macros these days, doesn't it?
14:53ebaxtHow can I "refresh" the class path so that nrepl sees newly added dependencies?
14:54TimMcI'm starting to think that sould be added to the top of the README, if it isn't already...
15:04TimMcebaxt: Restarting nrepl, or using pomegranate.
15:05ebaxtTimMc: Thx :)
15:07Raynes<shamelessplug> http://blog.raynes.me/blog/2012/10/12/help-fund-my-trip-to-the-conj/ </shamelessplug>
15:19SgeoUh
15:19SgeoApparently I am utterly confused about &env
15:21Sgeodjanatyn, hi
15:21SgeoI might actually be able to write frobify
15:24mindbender1djanatyn: http://www.infoq.com/presentations/Mixin-based-Inheritance on the difference between a programming language and a programming system
15:24TimMcSgeo: It would be pointless, since the keyword would have to be specified as a literal.
15:24TimMcYou couldn't do (let [foo 5 x :foo] (frobify x))
15:24amalloySgeo: i already showed how to do it the pointless way TimMc is talking about, and a non-pointless way is not possible
15:24amalloyor, i guess maybe that's not true
15:24SgeoTimMc, by making a macro that does stuff with &env, I should be able to get both keys and values in a data structure
15:25amalloySgeo: the values won't be useful to you, because they're compile-time values
15:25amalloybut you could expand to (case kw :foo foo, :bar bar), for all locals known to be in scope
15:25TimMcHaha, nice.
15:25Sgeoamalloy, I accidentally expanded to the values in my experimentation
15:26SgeoDangit I just closed my command prompt
15:26amalloy(defmacro frobify [k] `(case ~k ~@(for [sym (keys &env), clause [(keyword sym) sym]] clause)))?
15:27amalloyyes, that works
15:28SgeoShould be able to return a map with some fooling around, I think
15:28Sgeo(Expand to a map)
15:28amalloySgeo: http://stackoverflow.com/questions/12502933/expression-that-returns-all-currently-scoped-symbols-in-clojure/12504032#12504032
15:29SgeoAhh, I was going to work it out myself
15:29Sgeo*Aww
15:30amalloyfeel free to not read the implementation, mate
15:30SgeoToo late.
15:30SgeoBut it does some extra stuff that I'm not looking at, so
15:31`fogusSgeo: It's great fun to work this stuff out. I occasionally add little nuggets to my Evalive project as they dawn on me (or when I understand what the heck is happening)
15:31SgeoEvalive?
15:32`fogushttps://github.com/fogus/evalive
15:33Raynes`fogus: wtfn
15:34Raynes`fogus: You're my hero.
15:34`fogusThat was Alan Dipert's idea, I only named it ... he deserves all praise and/or hate
15:35Sgeohttps://www.refheap.com/paste/5885
15:35Sgeo^^my solution
15:36amalloySgeo: (into {} (for...))
15:36SgeoOh, that would probably be better
15:36SgeoThanks
15:36SgeoWTF is Persona?
15:37SgeoSome sort of proprietary OpenID-like thing?
15:39Sgeohttps://www.refheap.com/paste/5886
15:44Sgeodjanatyn, ^^
15:45lpetitRaynes: ping
15:46Rayneslpetit: Howdy partner.
15:46lpetitRaynes: howdy. I just filled my modest contribution to your fundraiser. Just wanted to let you know.
15:47RaynesI see! Thank you very much, kind sir!
15:47lpetitYou deserve it.
15:47RaynesHardly modest!
15:48lpetitRaynes: compared to what I should have invested to go myself, it is. Everything's relative :)
15:48RaynesHaha
15:49lpetitWas just a quick hello, now's time to go to bed for me, see ya
15:52RaynesNight!
15:53TimMcRaynes: Persona still doesn't support Firefox password manager.
15:53RaynesEvil.
15:55jlongsterTimMc: the ultimate goal is to have Persona integrated into Firefox itself. Also, the idea is to get rid of passwords, so password manager is kind of a different thing anyway
15:56SgeoAnd no integration with OpenID?
15:56TimMcAs long as I don't have to remember the damn ID, whatever.
15:57TimMcs/ID/password/
15:57RaynesI used personas because it's easy and I'm lazy. Not much else to say there.
15:57jlongsterSgeo: no, it's a much different (and not broken) tool
15:57Raynes:p
15:57SgeoHow is OpenID broken?
15:57jlongsterTimMc: you very rarely do, if ever
15:57RaynesI think I'll just defer any criticism to this jlongster fellow from now on. He seems hip on the matter.
15:58TimMcjlongster: ?
15:58jlongsterRaynes: hah, well, disclaimer: I work for Mozilla
15:58TimMcAre you saying that I'd have another password to remember, but would only be prompted to enter it very rarely?
15:58amalloymore of a disclosure than a disclaimer
15:58RaynesAwesome. I'll definitely defer criticism to you.
15:58TimMcBecause in that case I'd definitely forget it.
16:00TimMcjlongster: On a more important note, do you know of any work being done to establish automatic, behind-the-scenes credentials generation between browser and server?
16:00jlongsterTimMc: I'm not involved in Persona, so I can't really argue in details right now. You shouldn't ever have to "log in" unless you use a different computer, where you can either enter a password or get a link in your email you just click on.
16:01jlongsterTimMc: what kind of credentials?
16:02TimMcUser: Yeah, sign me up on this site with username JRH. Browser: Hi google.com, I'd like to register with username JRH and password o9anyc2ocnh29y5c9h8265. Server: Okey-doke.
16:03TimMcAnd then the password is automatically saved off, and the user can login with the click of a browser button.
16:03jlongsterNo, I don't know of anything like that. Persona is the architecture Mozilla is investing in.
16:04TimMcHmm, OK.
16:04jlongsterThere'd have be a standard for that (outside of Mozilla), and I haven't even heard of a standard protocol
16:07TimMcThrow in another protocol for automatic email verification and you'd take almost all the pain out of registration.
16:19jakovwhat is the opposite of (eval)
16:19jakovyou give it an expression and it changes it into a string representingit
16:21brehaut,(doc prn-str)
16:21clojurebot"([& xs]); prn to a string, returning it"
16:21Iceland_jackprn-str: porn star?
16:21emezeske,(pr '(some forms here))
16:21clojurebot(some forms here)
16:22`fogus|awayThe opposite of eval would be Byrd and Friedman's interpretter that plays expressions in reverse
16:22jakovpr sends it to stdout im fairly sure
16:23jakovis there a way to make it a string
16:23justin`marcellus
16:23justin`woops
16:23emezeske,(pr-str '(some forms here))
16:23clojurebot"(some forms here)"
16:23jakovok
16:23jakovoh wait somebody said
16:23jakovbut i didnt understand
16:24TimMcjakov: THe opposite of pr-str is read-string; I'm pretty sure the "opposite of eval" is not well defined.
16:24brehautjakov: do you want the opposite of read or eval?
16:24jakovTimMc iv just realised i asked the wrong question
16:25jakovi wanted the opposite of read-string
16:25jakovbut people answered anyway... strange, they knew what i meant
16:25TimMc:-D
16:26justin`I'm having a brain fart. I have a vector that looks like ["a" 1 2 3 "b" 5 5 6 "c" 4] and I need to turn it into a map that looks like {"a" [1 2 3] "b" [5 5 6] "c" [4]}. I basically need to use recursion to solve this, correct?
16:26Sgeo,(doc eval)
16:26clojurebot"([form]); Evaluates the form data structure (not text!) and returns the result."
16:26SgeoWhat lexical environment does eval run in?
16:27SgeoThe empty one I guess
16:28Sgeouser=> (let [a 1] (eval '(get-lexical-env)))
16:28Sgeo{}
16:28brehautjustin`: start with ##(partition-by string? ["a" 1 2 3 "b" 5 5 6 "c" 4])
16:28lazybot⇒ (("a") (1 2 3) ("b") (5 5 6) ("c") (4))
16:28amalloyjustin`: step 1 is a clearer spec. what do you do if any of the values need to be strings?
16:37justin`amalloy: good point! actually the values will all be strings but the "keys" will be of predictable value so partition-by is what I was looking for, thanks brehaut. I had a feeling I was forgetting something
16:38nDuffIf I'm manually creating a Thread object -- is there a way to copy the current set of thread-local bindings over to it?
16:38AtKaaZhi, how do you call this feature of clojure that it doesn't require explicit typing(types) ie. for functions params and stuff like that
16:38hyPiRionAtKaaZ: Dynamic?
16:39SgeoI would call it dynamic typing
16:39brehautnDuff: bound-fn?
16:39AtKaaZok, I'm making a list of bad side-effects of that :))
16:39nDuffAtKaaZ: We already know.
16:39AtKaaZI mean, it's good, but it can be evil
16:40nDuffAtKaaZ: ...People who see that as a serious problem that are already not using Clojure.
16:40AtKaaZnDuff, I'd agree, but you have to have some experience in clojure to be able to track down errors due to that
16:40SgeoStack traces in Clojure are annoying :(
16:40AtKaaZespecially since they are not explicitly taken care of
16:42nDuffSgeo: There are some libraries that prettify them.
16:42amalloynDuff: i don't agree. dynamic typing causes serious problems, and yet here i am. static typing causes serious problems too
16:43nDuffamalloy: Fair point. "A sufficiently serious problem to justify using another language" would have been more clear.
16:43AtKaaZlike this one: https://groups.google.com/d/msg/datomic/uIhKawJWL7o/gJ4doDknYfkJ
16:43AtKaaZno definitely no use another languange, none is that good (didn't try haskell tho)
16:44amalloyjust as wrong, though. you don't need any justification to use another language. if you wanted to say that, you would say "sufficiently serious problems to preclude using clojure", but then it's a useless sentence: people who hate clojure's features enough to not use it, are not using it
16:44AtKaaZSgeo, cool, which do you like most?
16:44technomancyamalloy: isn't that what nDuff said though?
16:44SgeoAtKaaZ, at the moment, Clojure, but my whims are subject to change at a moment's notice.
16:45hyPiRionSo what's the normal argument against dynamic typing? That it causes more bugs because you don't know the type of a value you're receiving or passing?
16:45ystaelWhen I type the name of a class in my code, where in Clojure is the code that decides what Class object becomes the value of this symbol?
16:45technomancyhyPiRion: certain classes of error are invisible until runtime
16:46SgeohyPiRion, the idea is that static typing will catch classes of bugs for you sooner.
16:46AtKaaZSgeo, haha, well for me clojure(+datomic) seems to be the lang I so dearly needed to do what I wanted to do before but failed in langs like cpp,js,php+sql,java+bdb
16:47hyPiRionSgeo: So the idea is that having the overhead of static typing is better because you'll have less bugs.
16:47hyPiRiontechnomancy: My personal opinion is that those errors are the hard ones, and that errors that have to do with types are more like small "fuckups".
16:47brehauthyPiRion: the overhead of static typing is always a tradeoff, and whether it is better or not depends where the code in question falls on that scale
16:48hyPiRion/s/errors/bugs
16:48nlewNot the "overhead". Static typing is an additional tool to model your problem.
16:48technomancyhyPiRion: yeah, nobody really makes that argument for languages like Java that don't have type inference, but in languages like Haskell and OCaml, the cost is much, much lower
16:48SgeohyPiRion, not "less" bugs, but you'll find out about the bugs sooner. It's like turning a logic error into a syntax error.
16:48technomancyhyPiRion: if you don't have experience in a type system, then you won't know how to structure your programs in a way that the type system can catch larger-scale bugs
16:49hyPiRiontechnomancy: Ahh, gotcha.
16:49technomancy*if you don't have experience in a good type system
16:49technomancyJava doesn't count
16:49brehauthyPiRion: http://matt.might.net/articles/intro-static-analysis/
16:49hyPiRionSgeo: Okay, so that's the rationale.
16:49AtKaaZnot sure if it's just dynamic typing at work, but this is the list of issues encountered so far: https://gist.github.com/3895312
16:50brehautAtKaaZ: nothing about that would be solved with static types
16:50AtKaaZdo you mean the hash-map part? brainproxy
16:51AtKaaZoops, brehaut
16:53Sgeo,(hash-map {:a 1 :a 2})
16:53clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: :a>
16:53AtKaaZ,(source hash-map)
16:53clojurebotSource not found
16:53SgeoWhat is meant by (hash-map {:a 1 :a 2}) works?
16:53hyPiRion,(hash-map :a 1 :a 2)
16:53clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>
16:54hyPiRion*shrugs*
16:54AtKaaZ,(. clojure.lang.PersistentHashMap (create {:a 1 :a 2}))
16:54clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: :a>
16:54AtKaaZSgeo, on 1.5.0 alpha6
16:54AtKaaZas in, it doesn't except
16:55SgeoI don't see how that last one would be solved in a statically-typed environment
16:55nlewIt seems to for me
16:55nDuffAtKaaZ: ...can't say I see how that's a static typing problem.
16:55hyPiRionHah, it's this discussion again
16:55hyPiRionhttp://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements
16:56AtKaaZSgeo, nDuff, you're probably right, let me recheck and see why I added it
16:56emezeskeWhat does that have to do with static/dynamic typing?
16:56AtKaaZnlew, it throw now for me too, wonder why it worked yesterday hmm
16:57amalloythe newest 1.5 release is more lenient on calls to hash-map, hash-set, array-map, array-set, and probably the sorted maps/sets as well
16:57amalloyas specifically requested by many users
17:01TimMc\o/
17:02emezeske /o\
17:02AtKaaZI can't believe it, I can't get it to work (anymore) on either Clojure 1.5.0-alpha6 or 1.5.0-master-SNAPSHOT
17:03AtKaaZwhich means, it always shows duplicate key
17:04amalloyAtKaaZ: what you got working before was (hash-map :a 1 :a 2), not (hash-map {:a 1 :a 2})
17:04AtKaaZoh right
17:04AtKaaZthanks so much amalloy
17:05AtKaaZdoes that make it dynamic typing issue? possibly?
17:06amalloyno, so far just you being excited about the word dynamic
17:06hyPiRionAtKaaZ: Reverse it: How would static typing help?
17:07TimMc,{:a 1 :a 2}
17:07clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: :a>
17:07TimMc^ That's a compile error, i.e., static.
17:07AtKaaZmaybe I didn't ask the right question at first, this type of coding is somewhat specific to clojure, and it's like relaxed coding, not caring to make sure the params are right or all conditions met
17:07S11001001AtKaaZ: you can't make sure all conditions are met anyway
17:07AtKaaZso I should've asked, what's that called?
17:08TimMcProgram proof of correctness? :-)
17:08AtKaaZS11001001, maybe at least as much as I'd do in java
17:08TimMcOr lack thereof.
17:08nlewAtKaaZ: What would you prefer Clojure did in this case? I'm confused what you think the issue is.
17:08AtKaaZtimmc, sounds relevant, I feel that it's a little less in clojure than it was in java though
17:08AtKaaZnlew, check for duplicate keys I guess, and throw
17:09nlewIsn't that exactly what it's doing?
17:09S11001001AtKaaZ: does java prevent you from initializing a HashMap with duplicate keys, at compile time?
17:09AtKaaZnlew, in 1.5.0 alpha 6 (hash-map :a 1 :a 2) doesn't throw
17:09AtKaaZS11001001, probably not?
17:09S11001001AtKaaZ: i.e., what happens when you Map<String,String> x= new Map<>(); x.add("hi", "42"); x.add("hi", "84");
17:09AtKaaZdidn't check
17:10AtKaaZoverwrites?
17:10S11001001AtKaaZ: I know what happens, but how about trying it out in javac and seeing what happens
17:10S11001001new HashMap, whatever
17:10AtKaaZbut I mean, in clojure since {:a 1 :a 2} is not allowed, it would be inconsistent(?) to allow (hash-map :a 1 :a 2)
17:11S11001001AtKaaZ: no, hash-map is a function, {} is syntax
17:11brehaut(let [a :a b :a] (hash-map a 1 b 2))
17:11brehautwhat should happen there?
17:11AtKaaZso I felt like that check was ommited simply as a side-effect of clojure-style coding
17:12AtKaaZ,(macroexpand (let [a :a b :a] (hash-map a 1 b 2)))
17:12clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>
17:12AtKaaZ,(let [a :a b :a] (hash-map a 1 b 2))
17:12clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>
17:12AtKaaZ,(macroexpand '(let [a :a b :a] (hash-map a 1 b 2)))
17:12clojurebot(let* [a :a b :a] (hash-map a 1 b 2))
17:12brehautAtKaaZ: dont evaluate it; i could obviously have done that myself. think about it
17:13brehautif that became (let [a :a b (complex-expression-that-evaluates-to-:a)] …) would you still expect the same result?
17:13AtKaaZok I'm failing :)
17:13AtKaaZyes
17:13AtKaaZthe throw i mean
17:13brehautand what about in a literal
17:13AtKaaZwhat's that?
17:14brehaut{a 1 b 2}
17:14AtKaaZsame I guess, doesn't the literal call something like put behind the scenes?
17:14jamiiis there a way to test if something is a record?
17:15AtKaaZbrehaut, that literal still throws in clojure 1.5.0 master
17:16brehauti personally dont give a rats arse what an alpha does. unfinished things are by definition unfinished
17:17AtKaaZbrehaut, ok, maybe it's a temporary bug, since it threw in earlier version, but I feel it's meant as a feature
17:17brehautit can well be a feature
17:17dnolenjamii: clojure.lang.IRecord
17:17jamiidnolen: thanks
17:18AtKaaZ,(alength {:a 1 :b 2})
17:18clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: alength>
17:18AtKaaZ,(.size {:a 1 :b 2})
17:18clojurebot2
17:19mindbender1In the beginning was a list of things
17:20S11001001mindbender1: did it contain all things?
17:21hyPiRionWell, if it was a list of things in Clojure, then the list didn't contain itself.
17:21mindbender1S11001001: an operation was defined that allowed that to happen
17:21AtKaaZhe probably means all things in the subsystem, so not the list itself (assuming it resides in the parent system)
17:22S11001001hyPiRion: speak for yourself. ##(let [xs (to-array [42]) xs' (vec xs)] (aset xs 0 xs') xs')
17:22lazybotjava.lang.StackOverflowError
17:23S11001001hyPiRion: (xs' is a vector whose only element is itself)
17:23AtKaaZthe list is in the same subsystem
17:23oskarthI have a macro that defines functions that takes an arg maps. What would be an idiomatic way to access these keys?
17:23amalloyjamii: that's only as of a very new version of clojure, though
17:23oskarthoutside of the function that is
17:24arohnerwhat is the preferred vim plugin for clojure these days?
17:24hyPiRionS11001001: Neat. Doesn't look like an intended feature though
17:24dnolenamalloy: wasn't in 1.4.0?
17:24amalloy&clojure.lang.IRecord
17:24lazybot⇒ clojure.lang.IRecord
17:24jamiiamalloy: thats ok, I'm targetting 1.4 anyway
17:24hyPiRionHave you some hacks for maps or sets too? I've been unable to do that.
17:24S11001001hyPiRion: it was intentionally not fixed
17:24amalloyoh, apparently it was. my mistake
17:24S11001001so in that sense, it's intentional
17:24hyPiRionS11001001: Ah.
17:25AtKaaZ,((fn [ & all] {:pre (= 1 2 ) } 0 ) 'a)
17:25clojurebot0
17:25AtKaaZcan't have :pre ?
17:25dnolenoskarth: not sure what you mean
17:27jkkramer,((fn [& all] {:pre [(= 1 2 )]} 0 ) 'a) ;see http://clojure.org/special_forms#fn
17:27clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.AssertionError: Assert failed: (= 1 2)>
17:28AtKaaZjkkramer, much appreciated thanks
17:28oskarthdnolen: trying to write a mock HDL, and I've a defchip macro that takes a map of pins on the chip. I want to be able to do (get-args mychipfn) and have it return a list of the keys I used to define that chip, but not sure about how to approach it
17:29SgeoIt suddenly occurs to me that that form of pre and post condition bothers me
17:29SgeoSuppose I have a macro that puts arbitrary maps at the beginning of function definitions for some reason
17:30SgeoSuddenly, it's asked to place a map with keys :pre and :post
17:30SgeoBoom, things break
17:30AtKaaZthey do?
17:30emezeskeoskarth: Couldn't your macro do two defs -- one for the function itself, and one for the arg map?
17:30dnolenoskarth: neat you should chat with dgrnbrg :)
17:30dnolenoskarth: another option I like if you can bear giving up various fn arg sugar - reify IFn,
17:31oskarthemezeske: yeah, that's one approach indeed
17:31AtKaaZthat map with :pre is it part of the function code ?
17:31TimMc&((fn [] {:pre false})) ;; no problemo
17:31lazybot⇒ {:pre false}
17:31dnolenoskarth: fn metadata as well
17:31dgrnbrgoskarth: hello!
17:31oskarthhi dgrnbrg!
17:31AtKaaZTimMc, I take that as a yes? :)
17:31dgrnbrgoskarth: I've been writing an HDL in clojure for the past 10 months
17:32oskarthdnolen: how does reify IFn work?
17:32oskarthI like the metadata idea
17:32TimMcAtKaaZ: Nope. "part of the function code" doesn't mean anything to me.
17:32oskarthdgrnbrg: oh, cool!
17:32dgrnbrghttps://github.com/dgrnbrg/piplin is the project
17:32AtKaaZTimMc, it means pretty much like Sgeo implied
17:32dgrnbrgIt allows you to essentially write normal clojure code, but it generates special structures that can be simulated or synthesized to verilog
17:33oskarthneat
17:33dgrnbrgit also adds a flow-typing system, so that you can encode type compatibility and promotion rules, and control the bit representation of types
17:33AtKaaZTimMc, actually I take that back, seems harmless
17:33oskarthsounds quite advanced - I started doing this as an exercise in writing a DSL as I'm working through elements of computing systems
17:34dgrnbrgit has pattern matching for union types, allows you to use destructuring for composite datatypes
17:34dgrnbrgit's got tons of extension points as it's an open system, so that you can implement things like complex fixed point arithmetic as a library
17:35jcromartiehiya everybody
17:35jcromartieI'm doing some trivial game dev stuff in Clojure, and trying to work out a sensible foundation
17:35AtKaaZSgeo, now I get what you mean, like if your function returns a map with :pre ... let me test
17:35dgrnbrgand it's designed to use as a base for HDL synthesis, so that you could write a higher level hdl and compile/eval as piplin, which would give you cycle simulation and synthesis to verilog
17:36oskarthah
17:36AtKaaZok not returns:)
17:38oskarthdgrnbrg: is there a write-up or so of it somewhere? looking through the code some but have a hard time grokking it all (esp not coming from a hardware background)
17:38SgeoAtKaaZ, if I make a macro that expands to (fn [stuff] <some map here> more stuff)
17:38dgrnbrgoskarth: I have made some work in that direction, but I haven't finished the fully writeups. There's a lot of mostly correct information on the wiki
17:38oskarthok, will have a look :)
17:38dgrnbrgalthough I refactored the namespaces so they aren't accurate
17:39dgrnbrgalso, if you look at the examples/ folder, that has simple examples
17:39dgrnbrgthe basic structure is this:
17:39dgrnbrgtypes.clj has the type/promotion system hooks in it, and types/*.clj are all the type implemenatitons
17:39AtKaaZSgeo, I see that if I make it a function , probably due to laziness, the return value is ignored so no map is returned ie. ((fn [] (evilprint) 1 ) )
17:39dgrnbrgsim.clj has a simulation engine, modules.clj has a way to make verilog-style modules
17:40dgrnbrgverilog.clj is the verilog output backend
17:40emezeskeSgeo: Ever hear the story about the patient that complained to her doctor that her arm hurt when she twisted it backwards ackwardly? The doctor said, "don't do that."
17:40AtKaaZSgeo, even as a macro looks like, ie. (defmacro evilprint [] `{:pre [false] }) ((fn [] (evilprint) 1 ) )
17:40dgrnbrgvcd.clj has a vcd file outputter
17:40SgeoI just don't like the special casing
17:40dgrnbrgif you look at the tests, they exercise most of the functionality of most of the parts, so that you can see how specific features can and cannot be used
17:41dgrnbrgand oskarth--i respond very quickly to email about piplin :)
17:41dgrnbrgif something's unclear, i'll be happy to write up a wiki page on it for you (and everyone else); it's hard to know what to document and work on w/o guidance from users/potential users
17:41oskarthok nice :)
17:42Sgeo(fn [] {:blah foo} (comment Im just a normal function))
17:42Sgeo(fn [] {:post foo} (comment oops))
17:42dnolendgrnbrg: so I notice you have some tests where it looks like you benchmark piplin against Icarus?
17:43dgrnbrgdnolen: actually, those tests run piplin & run piplin's synthesized output in icarus, to confirm they're cycle-accurate
17:43dgrnbrgthat my simulation model and verilog's simulation model haven't diverged in the ways that I want to guarentee :)
17:43dnolendgrnbrg: gotcha
17:44dgrnbrgthere's a much faster simulator in the pipeline (compiles directly to jvm bytecode), but that's not ready yet
17:44dnolendgrnbrg: so remind, is the goal to make an language more expressive / easier to use than verilog ?
17:44dnolendgrnbrg: wow
17:45AtKaaZSgeo, that :pre it seems harmless even if as macro, am I missing something maybe?
17:46dgrnbrgVerilog is terrible for expressiveness and for typing. VHDL is terrible for expressiveness, too (but has a decent type system). I want to use the power of a real programming language to generate the hardwar estructures
17:46dgrnbrgfor instance, it's not that hard to write a software version of a CLOS network, but it's quite hard to implement it in hardware
17:46dgrnbrgI want to unify those descriptions, but still generate the same circuit as if you'd hand-optimized it
17:46dnolendgrnbrg: crazy stuff ;)
17:47dgrnbrgplus, as ola bini talked about @ strange loop, macro languages are more powerful than non macro languages
17:47dgrnbrgand by embedding an HDL in clojure, you get macros, so the world becomes your oyster
17:48amalloySgeo: yes, if you do something crazy like put maps inside the body of functions you know nothing about, then sometimes for certain maps you will get behavior you didn't want
17:48amalloybut there is no reason to ever do the former, so why worry?
17:49AtKaaZamalloy, but I can't reproduce that
17:50AtKaaZhelp?:)
17:55TimMcSgeo: I share your concern in quality but not in quantity, if that makes any sense.
17:55TimMc(comment ...) is a problem anyway -- it should be preceded by a #_
17:57AtKaaZit's not possible to pass the arguments as they are inside a function in clojure right? ie. (func 1 2 3) and inside func they are passed to someotherfunc as 1 2 3 not '(1 2 3) or seq
17:57AtKaaZbut with macros is possible
17:58SgeoAtKaaZ, hmm?
17:58AtKaaZok let me rephrase, sec
17:58AdmiralBumbleBeeAtKaaZ: you could just use apply
17:58SgeoNot sure _exactly_ what you're asking, but it sounds possible.
17:58AtKaaZ,((fn [& all] (hash-map all)) :a 1 :a 2 :b 3)
17:58clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: (:a 1 :a 2 :b ...)>
17:58AtKaaZthat should show what I mean
17:59AtKaaZ,(hash-map :a 1 :a 2 :b 3)
17:59clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>
17:59AtKaaZthat is needed
17:59AdmiralBumbleBee,((fn [& all] (apply hash-map all)) :a 1 :b 2 :c 3)
17:59clojurebot{:a 1, :c 3, :b 2}
17:59AdmiralBumbleBeethat is what you want correct?
18:00AtKaaZno way, lol, that's exactly right
18:00AtKaaZwhy did I think that's not possible?
18:00SgeoToo used to Haskell?
18:00Sgeo:p
18:00AdmiralBumbleBeebecause clojure does that sometimes :)
18:00AtKaaZi didn't use it at all, but I remember I once wanted this few days back, and didn't find the solution
18:01AtKaaZthanks for the eye opener, AdmiralBumbleBee
18:01AdmiralBumbleBeesure :)
18:01AtKaaZ(inc AdmiralBumbleBee)
18:01lazybot⇒ 1
18:02AdmiralBumbleBeeI lost all my inc's from switching nicks, how sad
18:03AtKaaZnow if only I could find out what I tried back then... which would benefit from this knowledge that I got now (should be something within last 5 days)
18:04AtKaaZdoes ccw permanently save repl history ? or does anyone know of a repl logger?
18:06mindbender1,(partition 0 [:i :am :cruel])
18:06clojurebot(() () () () () ...)
18:07Sgeo,(partition-all 0 [:i :am :cruel])
18:07clojurebot(() () () () () ...)
18:08Sgeo,(partition-all 0.5 [:i :am :cruel])
18:08clojurebot((:i) (:am) (:cruel))
18:08mindbender1,(> 0.5 0)
18:08clojurebottrue
18:22gtrakwhat do I do if I want something like the agent's 'await' but more recursive. I want something that would also wait for jobs dispatched by the awaited jobs. Is that possible/stupid?
18:23AtKaaZI hate me, but let's move on :)
18:24AtKaaZagent within an agent?
18:24gtrakobviously there can be no cycles
18:24gtrakyea
18:24gtraka single agent
18:25gtrakbut a 'send' within a job running on the agent pool
18:26gtrakif i can figure out what the last thing will be, that's a good fit for promise/deliver, but i think it could be more generalized, and I hope the answer isn't 'write something custom around countdownlatch'
18:28gtrakbut now that I'm thinking through it, I think the dependency-graph needs to be defined outside of the agent
18:28gtrakhrmph
18:29AtKaaZsounds good to me
18:30gtrakso I will find the leaves... but how do I know if they will be realized?
18:30gtrakor... I guess I can't. my head hurts
18:32AtKaaZso you have a parentjob which calls other jobs ? but you don't know which jobs until you execute the parentjob?
18:51gtrakAtKaaZ: yea
18:51gtrakIt might just be an impossible problem..
18:52gtrakthere's no way to find out which one's going to run last, I can either guess, or know which ones are going to run and use a latch on them.
18:53SgeoYou can't run them all and use whichever returns the latest?
18:53gtrakSgeo: how do I know there are no later ones at the point that I'm at?
18:53gtrakyou identify the data-dependency... and wait for that, I think that's the right answer
18:53SgeoOh, I thought you knew all the ones that would run when you start them
18:53SgeoAFK
18:54gtrakSgeo: almost
18:55gtrakyou can't know on message level, but you can bind it to a particular message with a promise, which is what I did naturally anyway, but the only way to know that all of those kinds of things are done, is to additionally keep some state around keeping track of initial jobs and if they've finished or not
18:56gtrakassuming the kinds of job of interest all start from the same thread, that would work
18:57gtrakI can make that map thread-local or global
18:59AtKaaZsounds like functional programming? each job is a function which contains some elemental code mixed in with calls to other jobs(optionally); all running on a single thread, serially
19:01gtraka stack's a lot like a queue, yea
19:01gtrakbut the point of async is the controlled decoupling
19:01gtrakwhich is a requirement here
19:02gtrakhmm... the key difference is the queue has multiple entry points and it multiplexes its execution, that's what makes it non-deterministic
19:03AtKaaZlike a pmap?
19:03gtraksure, but pmap is all parallel, they run on a thread-pool but there's no data dependencies
19:04gtrakelement 2 doesn't depend on the answer for element 1
19:04AtKaaZok so you have like a root queue of jobs, which are likely to be executed by multiple threads, cause I imagined they executed sequentially so far
19:04gtrakright
19:04gtrakthey're popped off sequentially at any rate
19:05gtrakand in terms of the queue they're sequential with respect to each other
19:06AtKaaZso like one thread pops job1 and executes; thread2 pops jobs2 and executes but if job2 depends on job1 then you want it to wait for it? still unsure that I got it
19:06gtrakyea
19:07gtrakrather... thread1 pushes job1, job1 pushes job2, I want thread1 to wait for job2, without having to explicitly pass in a promise somewhere
19:07AtKaaZcan it just skip job2 until thread1 is done with job1 and instad do next job3?
19:07AtKaaZoh i see
19:08gtrakif thread1 pushes 2 jobs, the order might be job1 job2 job1.1 or job1 job1.1 job2
19:08gtrakI want it to wait for whatever the last one happens to be
19:08gtrakif I do await in the first case and time it wrong, job 1.1 happens afterwards
19:09gtrakwhere job 1.1 is a job pushed by job1 :-)
19:10AtKaaZright, but you say that thread2 can take the next job while thread1 is busy waiting for job1 to finish?
19:10gtrakyes
19:11gtrakthe problem I'm trying to solve is how to notify thread1 that job2 and job1.1 have both run, without requiring that they both run in the first place :-). I think the answer is, at the conditional that decides to push job 1.1, I need to push up the latch
19:11AtKaaZok so in that case thread2 can take job2 because job1 didn't yet push job1.1 even if it pushes it after job2 or before job2, which would mean thread2 should probably know if job2 depends on job1 else it would take it
19:11gtrakif I know it's going to run..
19:12gtrakyea, but there's a race condition
19:12gtrakhmmm.
19:12gtrakthe answer is... do everything that affects the queue with continuation-passing style
19:13gtrakmaybe..
19:13gtrakhaha
19:13AtKaaZwhat does that mean?
19:13gtrakthread1 should only dispatch a single job, but pass it a continuation to dispatch another at its leisure
19:13gtrakthat would serialize the order of the jobs once again
19:15gtrakinstead of agents, I would use futures, basically
19:15gtrakfutures within the single agent
19:15gtraktop-level agent
19:15AtKaaZI think I lost it, lol, but job1.1 depends on the previous code executed prior to it inside job1 ? ie. has to wait for that code to execute before it being launched?
19:15gtrakyea
19:16gtrakhaha, I will think about this some more, but it is very helpful to talk through it :-)
19:17AtKaaZok so basically each job in the queue should be executed serially until completion, even if it launches subjobs they are to be executed serially too(ie. likely by the same thread executting the parent job no?)
19:17gtrakyea
19:17AtKaaZbut jobs in queue may depend on each other
19:18AtKaaZok i think i got it so far
19:18gtrakit can be asynchronous from the perspective of the top-level thread, but I can hide the details and serialize its execution
19:18gtrakde-multiplexing
19:19gtraki think that's the right answer, sorry to confuse you and run :-)
19:19AtKaaZit's all good afaic;)
19:20gtrakthx
19:46timsgardneranyone know good ways to constrain printing in clojurescript, ala *print-level*, *print-length*?
19:48emezesketimsgardner: Unfortunately I think the answer to your question is "add such a feature to clojurescript's printer"
19:49holohi
19:49emezeskeholo: hallo
19:52timsgardneremezeske: yeeeah, thought it might be… ho hum
20:22mattmossI'd appreciate some eyes on this: https://gist.github.com/3896521
20:22mattmossDon't know what's going on there.
20:27xeqimattmoss: add a second set of parens around the (fn ..)
20:29mattmossxeqi: Ahhh...! Thanks... I need a brain update.
20:54nsxtany guides for putting nginx in front of a clojure app?
20:55hiredmanjust do it?
20:55nsxthahaha
20:55emezeskensxt: I don't think there's anything clojure-specific about it; just proxy_pass (or whatever) to the port your clojure app is listening on
20:56nsxti ask because i came across this http://wiki.nginx.org/JavaServers and was wondering if i had to deploy it in a certain fashion
20:57nsxtbut i'm guessing it's just a matter of "lein ring server" (in the case of compojure) and then config nginx to proxy_pass it over
20:59hiredmanI like lein ring uberwar + jetty-runner, but it seems like a lot of people get by with lein ring server and similar
21:02brehautapparently im behind the times. theres lein ring support? and a jetty runner
21:02brehaut;
21:07nsxtemezeske, hiredman: thanks, that was too easy and now i am slightly ashamed of myself
21:36lynaghk`dnolen, ohpauleez: do you know of anyone who has had luck doing ClojureScript with IE8?
21:37technomancyhiredman: why uberwar rather than uberjar?
21:38ohpauleezlynaghk: What sorts of things? We have ran an IE-compat on some of our stuff and it seemed fine. Internally we do WebKit specific stuff for one app. Are you seeing weird issues
21:38technomancybrehaut: I just use ring-jetty-adapter's run-jetty in -main
21:38brehauttechnomancy: likewise
21:38brehautwith a horrible bash script in init.d
21:38amalloytechnomancy: war+jetty lets you use jetty's container-based features, like running multiple apps in a single jvm
21:38brehaut(really i should look at supervisord or something)
21:39amalloyfor personal use i just lein run; at work we deploy wars into the jetty container
21:39lynaghk`ohpauleez: we've got a fully completed app that is blowing up IE8 and I didn't know if it was some of our libs or something in cljs itself. Sounds like core should be fine then, eh?
21:40brehautamalloy: thats good to know
21:40technomancybrehaut: upstart makes daemonization pretty easy
21:40technomancyclojars has a good example of a simple setup for that with a fallback JVM
21:41technomancyamalloy: hm cool; makes sense for more complicated deploys
21:42ohpauleezlynaghk: I'm almost certain core is fine. email detail errors if you want me to look into it. I know some people have IE compat issues with certain functionality (browser repl) and libraries (enfocus)
21:42amalloytechnomancy: also makes for more complicated deploys
21:42technomancyheh; yeah
21:42amalloyjesus god i spent all day today helping lance debug our deploy script as part of upgrading from cake to lein
21:43amalloybut, i think we successfully deployed our first lein-built artifact
21:44technomancynice
21:44lynaghk`ohpauleez: thanks. More of a hypothetical at this point; I'm happy with my current IE strategies: "Chrome Frame" or "HELL NO".
21:45dnolenlynaghk: I've never heard of any problems recently.
21:45dnolenI haven't I mean.
21:45lynaghk`dnolen: yeah, I got the sense it was more issues with DOM stuff that we're doing.
21:46dnolenlynaghk`: I know there a couple of users have posted IE bugs - but it's been a while since we've seen those.
21:46brehauttechnomancy: im struggling to find the upstart config. SYSADMIN.md suggests im looking for clojars.conf somewhere?
21:47brehauttechnomancy: however, i cant seem to find that file
21:59SgeoThe only way to win is to cheat >:D
22:02tomojis there a better way than (q '[:find ?v :in $ [?e ...] :where [?e :attr ?v]] db (index-range db ...)) ?
22:02SgeoCan anyone submit 4clojure questions?
22:02Sgeo,(count (range 5))
22:02clojurebot5
22:02SgeoHmm
22:03SgeoBest way to do an infinite seq of numbers?
22:03brehautit depends what you want the seq of numbers to be
22:04brehaut,(repeat 1)
22:04clojurebot(1 1 1 1 1 ...)
22:04brehaut,(range)
22:04clojurebot(0 1 2 3 4 ...)
22:04xeqi,(range)
22:04clojurebot(0 1 2 3 4 ...)
22:04xeqi,(iterate identity 1)
22:04clojurebot(1 1 1 1 1 ...)
22:04SgeoHow would I do range where it starts at a different number, besides ##(map (partial + 1) (range))
22:04lazybotjava.lang.OutOfMemoryError: Java heap space
22:05Sgeo:(
22:05dnolentomoj: what are you trying to do? I'm just now finally digging into Datomic ...
22:05brehaut,(doc range)
22:05clojurebot"([] [end] [start end] [start end step]); Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, and end to infinity."
22:05tomojuse index-range to restrict to a date range (domain date, not transaction date)
22:05brehaut,(iterate inc 3)
22:05clojurebot(3 4 5 6 7 ...)
22:05tomojthen run a query on just those
22:05gfredericks,(drop 2 (range))
22:05clojurebot(2 3 4 5 6 ...)
22:05shachaf,(range 3 (/ 1.0 0.0))
22:05clojurebot(3 4 5 6 7 ...)
22:05Sgeo,(doc iterate)
22:05clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
22:06Sgeobrehaut, awesomme
22:06shachaf(Note: Don't do that.)
22:06dnolentomoj: hmm, it's not my impression that's what index-range is for - don't you just want to use a db function?
22:07tomojmy understanding is that a db function would not take advantage of indexes
22:07tomoji.e. if you want today's docs, you have to pull in every doc and check the timestamp
22:08Sgeo,(let [s (range 5)] (for [i s j s] [i j]))
22:08clojurebot([0 0] [0 1] [0 2] [0 3] [0 4] ...)
22:08Sgeo,(let [s (range 2)] (for [i s j s] [i j]))
22:08clojurebot([0 0] [0 1] [1 0] [1 1])
22:08SgeoPerfect.
22:08Sgeo,(** 2 3)
22:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ** in this context, compiling:(NO_SOURCE_PATH:0)>
22:08Sgeo,(Math/pow 2 3)
22:08clojurebot8.0
22:10SgeoWould it be too much of a giveaway that cheating is expected if the function the user has to write would need to determine the truth or falsity of Fermet's Last Theorem?
22:10SgeoAlthough I'd need to make it obvious that that's what it would need to do
22:10hiredmantomoj: transaction functions get passed the db value, I don't see why you couldn't query it
22:11SgeoHow do I submit problems to 4clojure?
22:12tomojhiredman: no transaction involved, this is query
22:12dnolentomoj: from the docs I don't see how index-range could do what you want. it's just going to give you slice of an index of datoms. those datoms are organized in any that you have any control over as far as I know.
22:14dnolenare not organized
22:15brehautSgeo: you make a pull request on github i think
22:15Sgeobrehaut, and are problems where the only solution is cheating acceptable?
22:15brehauti have no idea
22:16brehauti presume not
22:16SgeoAww, darn
22:16brehauti have no idea though
22:19dnolentomoj: actually I think you're right. I see a thread on the ML about this.
22:21dnolentomoj: people were making :avet indexes of :db.type/instant and asking for index-range to determine a start point
22:21dnolentomoj: how do you know what n to start at?
22:22SgeoOh hey I found the listing of all 4cloure problems
22:27technomancybrehaut: I think the upstart config is just on the clojars-maintainers mailing list
22:27tomojdnolen: n being the start time?
22:27brehauttechnomancy: ah, thanks
22:27tomojjust whatever I want - e.g. 1 day ago
22:27technomancyoversight probably
22:27tomojI wish you could get a reverse range
22:29dnolentomoj: seems like you are right, so is that you're problem with that query ... that you't can't get a reverse range?
22:31amalloySgeo: once you have solved 50 problems, a link appears in the header allowing you to submit a problem
22:32Sgeoamalloy, ah
22:32SgeoAwesome
22:33tomojwell the query seems to work fine, would be nice to get a reverse range so I don't have to e.g. do a range 1 day ago -> today, then if I want more 2 days ago -> 1 day ago, etc
22:34tomojbut was just wondering if there was a, uh, more idiomatic (?) way to write the query
22:39JvJhey, anyone good with java interop here?
22:40JvJI'm getting a class not found exception when loading an ns with :gen-class
22:42jcromartieJvJ: can you paste anything relevant?
22:42JvJHere's my NS : (ns enjine.core.EnjineDebug
22:42JvJ (:gen-class)
22:42JvJ )
22:42JvJ
22:43hiredmanJvJ: you need to use the full class name in your :extends
22:43JvJ(defn -toString
22:43JvJ [this]
22:43jcromartienot paste like that :)
22:43JvJ "An enjine debug unit.")
22:43jcromartie...
22:43JvJsry bout that
22:43jcromartiehttps://www.refheap.com/ is a Clojure-flavored paste site
22:44hiredmanJvJ: you need docstring for gen-class
22:44hiredmanto read the
22:44JvJI was looking at a tutorial for it
22:45hiredmanhttp://clojure.org/compilation is a good place to start
22:45gertdo I need a clojure 1.5.0 alpha for the reducers library? Or can I use it with 1.4 as well?
22:46JvJthanks hiredman
22:46hiredmangert: the code is not present in 1.4
22:46gerthiredman: I vaguely remember it being available as a separate jar, but maybe I'm dreaming?
22:47hiredmanyou are
22:47gertis there a release schedule for 1.5? I would love to use the reducers for our application, but I'm slightly hesitant to use 1.5 before it's out of alpha...
22:48gertalthough it seems pretty stable in my experience....
22:51tomojreducers still need work imo, I'm hoping 1.5 is still a ways out :(
22:54dnolentomoj: it doesn't sound like that.
22:54gerthmmm... interesting dilemma. I'm a couple of months away from releasing our application... and reducers would be awesome for our use case. I think I'm going to use it.
22:55gertliving on the edge :)
23:00tomojreduce-kv seems hobbled :(
23:00tomojthe extra transforms would not be too badly missed, maybe
23:28jlongsterdnolen: is node.js support still working in latest cljs? I have a stupid simple test project and the main function doesn't seem to run: https://github.com/jlongster/cljs-node-fun/blob/master/src/test/core.cljs
23:29dnolenjlongster: it should as far as I know - ohpauleez uses it
23:29dnolenjlongster: I don't so I can't saw much about it.
23:31jlongsterdnolen: ok, thanks. I'm not sure why but I always have trouble getting started! I'll hack on it some more.
23:33dnolenjlongster: you try stuff that not enough people work on ;)
23:34dnolenjlongster: nearly all the interest in ClojureScript is web centric
23:35jlongsteryeah, that makes sense, since most people are probably using Clojure on the server
23:35jlongsterI'll try to wrangle in some node though! Could be helpful in certain cases.
23:35dnolenjlongster: yeah
23:35dnolenjlongster: a lot of people are interestd in node.js, but it takes a special kind of person to dig into poorly documented code and actually help out :)
23:36jlongsterdnolen: so you think it's worth digging into? I could be that kind of weird person that finds that a fun challenge.
23:36dnolenjlongster: I haven't looked at that stuff because there's just a ton of other stuff to do that's not node related at all.
23:36dnolenjlongster: definitely worth digging into.
23:37jlongstersweet
23:37jlongsterI'm used to node, so it may just be the gateway drug to Clojure, we'll see!
23:38dnolenjlongster: it would be nice, if somebody actually spent some time on it we'd have a compelling scriptingsolution.
23:38dnolenjlongster: I spent a little time in the early days on a Node.js based CLJS REPL
23:38dnolenjlongster: knocked the socks off of Rhino, but I just don't have time to polish it off.
23:39jlongsterdnolen: nice, I like the sound of that. It does sound promising to remove the JVM for that kind of stuff.
23:39jlongster(in terms of "precompiling" scripts)
23:39dnolenjlongster: well you still need the JVM to compile the forms, but once the REPL is fired up it's just zippier than Rhino.
23:40jlongsteryeah, V8's definitely faster
23:40dnolenlike 1000X
23:40jlongsterhaha
23:40jlongsterI'm not sure Mozilla even supports Rhino anymore
23:53doomlord_is clojure good at implementing erlang style actors
23:53dnolengfredericks: hmm, I just applied your patch for CLJS-383 and I have not run into any issues with advanced compilation.