#clojure logs

2012-06-17

00:01loliveiraand i just checked. there is no ring.server.leiningen in my source code.
00:01xeqiloliveira: what is noir 1.2.2.1-patch ?
00:04loliveiraxeqi: https://github.com/loliveira/noir/blob/master/project.clj#L4
00:06xeqiyou're requiring hiccup 0.3.7 in that project.clj, which is not compatible with 1.0.0
00:06loliveiraxeqi: and... https://github.com/loliveira/compojure/commit/ef382f5e1679aec90ee5fe088047247827cd1846
00:06loliveiraxeqi: bingo
00:11loliveiraxeqi: changed to [hiccup "0.3.7"] and error persists. =/
00:12xeqiwhich error?
00:13arrdemanyone know a good tutorial for building websites with Clojure?
00:13loliveirajava.io.FileNotFoundException: Could not locate
00:13loliveira+hiccup/page_helpers__init.class or hiccup/page_helpers.clj on classpath
00:15xeqiwhat version of lein are you using?
00:17loliveiraLeiningen 1.7.1 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit Server VM
00:18xeqiwhat version of hiccup ends up in lib/?
00:22loliveira0.3.7
00:27akhudekarrdem: the clojure noir tutorials should help
00:28akhudekunless you want to try clojurescript as well
00:28akhudekclojurescript is not well documented at the moment
00:29xeqiloliveira: your custom noir uses hiccup 0.3.7. that means ring-devel 1.0.2, ring 1.0.2, ring-server 0.2.1, and lein-ring 0.6.7 are the lastest you can use
00:31loliveiraxeqi: makes a lot of sense.
00:35loliveirai removed ring-server "0.2.3", now i back with the original error. =)
00:37loliveiraCould not locate ring/server/leiningen__init.class or ring/server/leiningen.clj on classpath
00:38xeqiwhat version of lein-ring ?
00:39loliveira:dev-dependencies [[lein-ring "0.7.1"]]
00:41xeqiwith lein 1.7.1 that should be in :plugins
00:42loliveirasame error.
00:42arrdemakhudek: thanks I'll check it out.
00:42xeqitry 0.6.7
00:49loliveirasmae error with: 0.6.7 0.6.6 0.6.5 0.6.4 0.6.3 0.6.2 0.6.1
00:49loliveirabut
00:49loliveiradifferent error with 0.6.0
00:50loliveirahttp://pastebin.com/jNC1K9eE
00:58jayunit100__technomancy: oops i just issued a pull request to leiningan that was a bit of a mistake. Sorry sir ! I meant to simply edit the readme in the main site to link to the stable version rather than the main version.
06:08_ulisesmorning
06:15atc--hey, I've come across a peculiarity that my inexperience can't explain. Can someone help me understand what I'm doing wrong?
06:15atc--http://pastebin.com/8yJhyeV1
06:18raekatc--: a string can be used as a sequence of characters, but you try to use it as a sequence of strings
06:18atc--raek, I feel stupid
06:18atc--raek, so I just need to (int ch) the chars instead of sequencing them to strings
06:19raek(defn is-period? [c] (or (= \. c) (= \, c)))
06:19atc--raek, question is though, why is it getting characters when ltrs is a secquence of strings
06:19atc--raek, ok
06:19raekah, didn't see that
06:20raek(the (map str (seq w)) thing
06:20atc--see what I mean?
06:20atc--ltrs is defined as a sequence of strings
06:20atc--rightly or wrongly
06:21atc--so given I'm probably pointlessly converting to a seq of strings
06:21raekatc--: also you are calling filter on a single element
06:21atc--there is still a bit of oddness in the behaviour
06:21atc--raek, so?
06:21raekwhich happened to be a string, which is seqable in your case
06:21atc--yeah
06:21atc--but a seq of chars
06:22atc--I wanted (granted, naively) a seq of strings
06:22atc--hence the let bindings to (map str (seq w))
06:22atc--so I can convert to an ascii val later on
06:22raekI would do (+ (if (is-capital? (first ltrs)) 1 0) (count (filter is-period? (rest ltrs))))
06:22atc--yeah
06:22atc--I'm just curious why they're chars and not strings when the filter calls is-capital>
06:22atc--*?
06:22clojurebot* is just for when you are lazy and sloppy
06:23raekI don't see why having the individual characters as strings simplify things
06:23atc--raek, it doesn't
06:23raekfirst you stringify them with str and then you extract the char again with (.charAt c 0)
06:23atc--raek, it's making it worse. I'm changing that
06:23atc--raek, I just want to understand why they're chars at runtime when my understanding suggests they should be strs
06:24raekatc--: filter operates on sequences of elements, but you gave it a single element
06:24atc--raek, right, but that element is a str, no?
06:24raekyou could do (filter is-capital? [(first ltrs)])
06:25raekatc--: yes, but you want to pass a sequence of strings to that filter, not a sequence of chars
06:25atc--right
06:25atc--so
06:25raeksince your is-capital? expects a string, not a char
06:25atc--does (first ltrs) return a one-element seq of chars or strings?
06:25raekno
06:25atc--yes, but ltrs is a seq of strings, so when I (first ltrs) I get a one-element seq of str, now?
06:26atc--no, I mean, not "now"
06:26raekif a is ("foo" "bar"), a seq of strings, then (first a) is "foo", a string
06:26atc--agreed
06:26raekin the first case you give filter something like "foo", in the second case you give filter something like ("foo" "bar")
06:27atc--yet is-capital? expects a string to -- badly done, granted -- convert to a character to then convert to an int
06:27atc-- No matching method found: charAt for class java.lang.Character ----- that's the error at runtime
06:27atc--I shoujld've clarified that further
06:27atc--earlier, rather
06:28raekatc--: do you understand why is-capital? receives a character?
06:28atc--raek, I'm sorry, I don't.
06:28atc--I am new to clojure so forgive my confusion.
06:28raekdo you know that (filter f coll) runs the function for f for each element in coll?
06:28atc--yes
06:28raekso what type is coll in the first case?
06:29atc--seq of str, with one element?
06:29raekno, a single string
06:29atc--OH
06:29raekltrs is a seq of strings
06:29atc--I should've RTFM'd on first
06:29atc--yeah
06:30atc--so,
06:30raekanyway, using characters rather than one-char-strings should make your code shorter
06:30atc--(first ltrs) gives me "h"
06:30atc--and that is then passed to is-capital?
06:30atc--correct?
06:30atc--so
06:30raekno
06:30atc--ok
06:30raek"h" is treated as a sequence of things
06:31raekremember, filter expects a sequence in that position
06:31atc--yeah
06:31raekand strings can be treaded as sequences in clojure
06:31atc--and I'm giving it a string
06:31atc--I get you
06:31raek,(seq "hello")
06:31clojurebot(\h \e \l \l \o)
06:31atc--gotcha
06:31atc--thanks for explaining and for the patience!
06:31raekthey are treated as sequences of their characters
06:31atc--yeah
06:31atc--which I should be doing in the first place
06:31raekso is-capital? receives \h, not "h"
06:31atc--but was just curious why my already bad code was misbehaving
06:32atc--yeah
06:32atc--got you now
06:32atc--thanks :)
06:32atc--I've simplified it all anyhow
06:32atc--so just using chars
06:32raekbut since (first ltrs) is always one element, you could do (if (is-capital? (first ltrs)) 1 0)
06:33raekno need to loop over each element of a seq if the seq is always of length one
06:33atc--raek, yeah
06:33raekbut if you really want that, then you need to make a seq of one element: (filter is-capital? [(first ltrs)])
06:34atc--right
06:34atc--I think we both agree I don't want that! :D
06:34atc--unless I'm trying to right superfluous code, which I'm not
07:55si14anyone who wrote big web-apps with CLJS here?
08:45antoineBhello
08:45ohpauleezHi antoineB
09:30si14looks like there is a bug in CLJS — ::foobar in ns "test" is actually :user/foobar instead of :test/foobar
09:33gfrederickssi14: I don't think that's a CLJS bug; that's a byproduct of cljs using clojure's reader
09:34antoineBhow can i extract from a list of number the frequency of each number?
09:34antoineBi need some sort of mutable map
09:34gfredericks,(frequencies [2 3 3 2 4 2 5])
09:34clojurebot{2 3, 3 2, 4 1, 5 1}
09:34gfredericksantoineB: mutable map..?
09:35raekantoineB: no, you can use recursion instead of mutation (or use an already available function in the standard library)
09:35antoineBi don't know the frequencies function thanks
09:36antoineBraek: how?
09:36gfredericksantoineB: if you wanted to implement it yourself you should be able to use reduce
09:36raek,(loop [m {}, coll [2 3 3 2 4 2 5]] (if (empty? coll) m (recur (update-in m [(first coll)] (fnil inc 0)) (rest coll)))
09:36clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
09:36raek,(loop [m {}, coll [2 3 3 2 4 2 5]] (if (empty? coll) m (recur (update-in m [(first coll)] (fnil inc 0)) (rest coll))))
09:36clojurebot{5 1, 4 1, 3 2, 2 3}
09:38raekantoineB: it's not the map itself you need to update, it's which map is the current one
09:38gfredericks,(reduce (fn [m x] (update-in m [x] (fnil inc 0))) {} [2 3 3 2 4 2 5])
09:38clojurebot{5 1, 4 1, 3 2, 2 3}
09:38cshellhah,t hat's what I was just oging to type!
09:38raekloop/recur and fn/recur provide the basic way of "updating" variables in clojur
09:40raekthe most common iteration patterns have already been factored out into higher order functions like map, filter, and reduce
09:42antoineBraek: gfredericks: tanks
09:57antoineBhttp://pastebin.com/B4y1sDT7
09:58antoineBit is a function which give the higher element (in term of frequencie) from a frquencies sequence
09:58antoineBis there better way to do it?
09:59raek,(max-key second {2 3, 3 2, 4 1, 5 1})
09:59clojurebot{2 3, 3 2, 4 1, 5 1}
09:59raek,(apply max-key second {2 3, 3 2, 4 1, 5 1})
09:59clojurebot[2 3]
10:00raekantoineB: also, in you most recent paste you could keep the two components of m as separate variables
10:00antoineB,(max-key second (frequencies '(1 2 3 2 5 2 3)))
10:00clojurebot{1 1, 2 3, 3 2, 5 1}
10:01raek,(apply max-key second (frequencies '(1 2 3 2 5 2 3)))
10:01clojurebot[2 3]
10:02raekantoineB: max-key expects the elements as separate arguments
10:02antoineBok
10:03antoineBraek: i don't understand what you say about my paste
10:03raekantoineB: sorry, I was reading your code wrong
10:07si14what am I doing wrong? https://gist.github.com/cb2458433ee72b72417d
10:07si14this code falls to infinite loop
10:07si14printing "assoc!" all the time
10:08jjidoer, reify
10:08si14yeah
10:08si14I'm trying to mimic backbone with it's models that emit messages when some field is changed
10:09Chousukeyour assoc method implementation calls itself recursively
10:10si14Chousuke: yeah, I know. there is a similar example in clojuredocs for Clojure, don't think that that one loops too
10:10si14http://clojuredocs.org/clojure_core/clojure.core/reify here it is
10:11raekantoineB: I was thinking about something like this: https://gist.github.com/2944661
10:11Chousukethat one doesn't call seq on this, it calls seq on f
10:12piranhahmm.. how do I supply clojurescript externs to cljsbuild?
10:14si14Chousuke: yeah, I see now, thank you. but if I call (-assoc map k v) in that example I miss reified version of map; how can I avoid loop and keep reified version?
10:14Chousukesi14: call the function that creates the reified map with the updated map as parameter
10:15Chousukesi14: that avoids calling the method, but creates a new reified thing for you
10:15si14Chousuke: yeah, got it. Thanks a lot!
10:17antoineBraek: i don't understand the meaning of the "let"s specialy the second vector parameter
10:32gfredericksantoineB: you're talking about line 2 in raek's gist?
10:32ArvinJAhello there
10:32ArvinJATrying out overtone and am new to clojure
10:33ArvinJAthere are some clj files
10:33ArvinJAHow do I run them outside of REPL?
10:33si14Chousuke: if I reify one of protocols, others are lost?
10:33Chousukesi14: lost?
10:35ArvinJAseems like "java -cp clojure.jar clojure.main scriptname.clj" should work
10:35si14Chousuke: https://gist.github.com/209b5b7fead972e01296
10:35antoineBgfredericks: i am talking about the 2 "let" sexpression
10:35antoineBi don't understand the bindings
10:36antoineBso line 2 and 8
10:37gfredericksantoineB: it is using destructing; the expectation on line 2 is that (first coll) is a seq with at least 2 elements
10:37ArvinJAE:\overtone\examples>java -cp clojure.jar clojure.main blues.clj
10:37ArvinJAError: Could not find or load main class clojure.main
10:37antoineBgfredericks: ok
10:37gfredericks(let [[first-value first-freq] (first coll)] ...) is equivalent to (let [foo (first coll), first-value (first foo), first-freq (second foo)] ...)
10:38si14Chousuke: looks like I'm missing something :)
11:04si14dnolen: ping
11:42dnolenohpauleez: ping, yesterday - no protocol method -hash error, is that still a problem, we have default now in master
11:42dnolensi14: pong
11:43si14dnolen: hi. first of all — recently saw a record of your talk on dispatch, it's amazing :)
11:44ohpauleezdnolen: I haven't seen it for awhile now, it was my most common error
11:44dnolenohpauleez: k good to hear - yeah should no longer occur
11:44dnolensi14: thanks!
11:45si14dnolen: and here is a question: how would you implement a modification of map that calls something on each modification of it's field? I'm speaking about CLJS
11:46dnolensi14: hard to say without knowing what you are trying to achieve.
11:46si14I've tried something like this https://gist.github.com/cb2458433ee72b72417d , but reify returns a new class; extend-type is nice, but I can't call a "super-method" from there, can I?
11:47dnolensi14: there's no inheritance of any kind in CLJS, if that's what you mean.
11:47si14dnolen: I'm trying to build something like Backbone, because currently I'm not aware of any kind of useful framework in CLJS.
11:48dnolensi14: so I take it you're thinking about the data binding problem?
11:48si14dnolen: yeah. the idea is pretty simple: just generate an event (using Closure's PubSub, for example) every time when some field is changed
11:49ohpauleezsi14: I do that almost exact thing in Shoreleave's PubSub system
11:49si14it can be achieved with atom and watcher, but unfortunately the only way to check what particular field was changed is comparing old and new map, I don't think that it's reasonable
11:49ohpauleezbut I have a Function deftype that I abuse
11:50ohpauleezit's a generic decorator for shaping functions, at the heart of it
11:50si14ohpauleez: what's Shoreleave?
11:50ohpauleezsi14: A group of utilities to make CLJS apps
11:51ohpauleezwith a focus on security, HTML5 feature sets, and CLJS's capabilities
11:51ohpauleezEmbedded workers, a removing package, and a pub sub system to declaratively bind it all together
11:51dnolensi14: there's a few people interested in this problem space. Including Kevin Lynagh (C2), Chris Granger (Light Table), Kovas Boguta (Session)
11:51ohpauleezWe've all taken slightly different approaches
11:52ohpauleezbut they all complement each other
11:52ohpauleezI don't think any of us have the final answer
11:52dnolensi14: I think a new official abstraction is warranted if people can agree upon something.
11:52si14ohpauleez: found your repo at github. is there any example of it?
11:53dnolenohpauleez: yes, but it seems like a missed opportunity to create a new reference type, data structure, protocol - no idea what it should look like of course. But it seems like we have enought smart people to figure this out :)
11:53ohpauleezdnolen: For sure
11:54ohpauleezsi14: I'm cutting shoreleave up right now. Then I'm moving in the few example apps I have
11:54ohpauleezTutorspree has built some serious client-side apps
11:54si14ohpauleez: there is a nice thing called "todo mvc" here: http://addyosmani.github.com/todomvc/
11:54ohpauleezI worked on that example last night
11:55si14the problem is that I didn't find anything even close to https://github.com/addyosmani/todomvc/blob/master/architecture-examples/backbone/js/todos.js
11:55ohpauleezI'm going to do a TODO app and a client-side only searching app
11:55si14in terms of conciseness at least.
11:55ohpauleezI feel like I've nailed the conciseness
11:56ohpauleezAlso you have to realize a lot of these client-side only apps make no assumptions about security
11:56ohpauleezyou need to bolt it all on as an after thought
11:56ohpauleezit's baked into Shoreleave
11:56si14ohpauleez: can you share your results?
11:56si14ohpauleez: I mean TODO
11:57ohpauleezIt'll be pushed as soon as I finish cutting Shoreleave up and putting up the new repos (in the Shoreleave organization on github)
11:59ohpauleezdnolen: I think we're all close on the binding piece - but definitely something worth talking about over beers on Wednesday
11:59dnolenohpauleez: sounds good!
11:59si14kinda sad. we are just in the middle of the "maybe we should just rewrite it to Coffee instead of messing with framework invention" moment, so your example can change the final decision.
12:00dnolensi14: I will say I'm not a fan of any of the JS MVCs, Backbone.js included.
12:00ohpauleezI also agree with that si14 ^
12:00si14dnolen: me neither, but sometimes we just need some stuff done.
12:00dnolensi14. for sure.
12:01si14dnolen: at least I wouldn't try CLJS if I like JS :)
12:01ohpauleezsi14: Are you in the NYC area?
12:01si14ohpauleez: nope, Russia
12:01si14unfortunately :)
12:01ohpauleezAhh, if you can hold off for a little longer, I'll have Shoreleave examples up and probably a screencast of a build out
12:02ohpauleezBut that's two or so weeks out
12:02si14ohpauleez: I'm sorry if I was a little too persevering :)
12:03ohpauleezhaha nah
12:07si14ohpauleez: did you see "static" templates in Enfocus?
12:07si14sorry, "compiled"
12:07ohpauleezsi14: Yeah - definitely cool stuff
12:08ohpauleezI use enfocus in all of my CLJS apps, but I haven't used the compiled templates
12:08ohpauleezFor me, my apps look like this:
12:09ohpauleezBuild some static HTML and CSS. Write a bunch of pure functions. Wire the functions up with my pub sub system. Use enfocus' listeners as entry points into the pub sub system. Use Enfocus' actions as exit points in the pub system
12:10ohpauleezSL's pub sub allows for Local Storage to be published too, so that solves a lot of problems
12:10si14ohpauleez: why not Closure's PubSub?
12:11ohpauleezYou can subscribe to atoms, workers, and functions
12:11ohpauleezsi14: It's built on top of that, but as a implementation of a protocol
12:11ohpauleezbecause you might need cross doc or an xpc bus
12:11ohpauleezand Closure's pub sub isn't crossdoc
12:11ohpauleezalso it only supports strings as topics
12:12ohpauleezand I want to use it to declaratively bind my entire app
12:12ohpauleezSo two protocols - one to describe buses. One to describe publishables
12:12ohpauleezAnd you can extend the system ala carte to anything that comes along
12:13si14ohpauleez: sounds great. bad for us that we didn't start like 2 month later :)
12:14ohpauleezsi14: It's definitely the wild west
12:14ohpauleez"wild west" with CLJS
12:19bobrywild west indeed :)
13:06jayunit100_how integrated is the clojurescript ui tools. Do we have to use jquery ? Id like to do some GWT style development with clojurescript if possible (i.e. have it do my layouts and stuff for me, convention over configuration style).
13:08jayunit100_I mean, I know its just a JS generator, at its core, but I'm assuming the goal is to wrap JS in a lisp style of GWT, like A DSL for JS web apps. But maybe I'm wrong.
13:11cshelldo you mean that since GWT compiles to JS, that CLJS is similar as it takes Clojure and compiles to JS?
13:13dnolenjayunit100_: you have Google Closure if you want a widget library. being like GWT is a non-goal.
13:13cshellyeah, I am missing the GWT/CLJS connection
13:16jayunit100_cshell: yeah, thats what i meant.
13:16jayunit100_but also -
13:16jayunit100_that GWT looks "good" out of the box :) Convention over configuration.
13:18jayunit100_So, clojurescript and GWT are BOTH compilers to JS. But GWT is convention over configuration, I believe, whereas ClojureScript is not. I'd like a ClojureScript framework that was convention over configuration, like GWT, SproutTools, ExtJS….
13:19jayunit100_of course, if the only goal of CLJS is to wrap JS, than my question is quite silly.
13:19cshellMy understanding is that CLJS helps you write javascript code via clojure - if you want those things, you could just leverage the EXTJs libraries
13:19gelvaoshi!
13:19cshellI tihink the goal is to wrap js and then you can leverage the native libraries
13:19cshellcall the extjs libraries from clojurescript
13:20cshellyou could build a clojure idiomatic wrapper library over ext-js
13:20jayunit100_cshell: thats a good idea.
13:20cshelljust like they do with all the java libraries in the jvm
13:20gelvaosdoes anybody had experience with setup and usage of hypermedia.video.OpenCV in clojure?
13:23jayunit100_arg web guis got so complicated while i was away
13:31ohpauleezjayunit100_: Rather than fight upstream, I'd take some time and see how people are generating CLJS ui's now
13:31ohpauleezyou might like another approach better
13:32ohpauleezotherwise, you could generate JS with GWT, make an externs file, and wrap it all up with CLJS. But that'd be a headache
13:33jayunit100_ohpauleez: yeah, i see what you mean. where are the best CLJS apps. Are there any good CLJS app templates out there ?
13:33jayunit100_(client only, i already have a backend)
13:34ohpauleezjayunit100_: ClojureScript One, Take a look at Kevin Lynagh's C2 demos, dig through some of Chris Granger's gists
13:34ohpauleezTake a look at the enfocus demos
13:36jayunit100_ohpauleez: ok thanks
13:36ohpauleeznp
13:42uvtcHow does one get started with editing the confluence wiki? I've created an account there, but there doesn't seem to be any way to edit pages.
13:44ohpauleezuvtc: You need to request for a bump in permissions on the dev mailing list
13:44uvtcohpauleez, Does editing the confluence wiki require signing/mailing-in the CA?
13:44dnolenuvtc: yes
13:45uvtcThanks!
14:25muhooc2?
14:27gfredericksd3!
14:29muhoogfredericks: you sunk my battleshiip!
14:29muhoowtf is c2? probably the most ungoogleable abbrev evah
14:31gfredericksoh I see. I did not look far enough back in the conversation
14:32muhoonm, found it http://keminglabs.com/c2/
14:33gfredericksperhaps it is an inelastic compute cloud?
14:34muhoonaw, data visualization, clojure version of d3
14:34muhooso your guess was really good
14:54pipelinefor some reason it bothers me
14:54pipelinethat slime still tells me that lemonodor fame is only a hack away
14:54pipelinesince lemonodor has so long left us
15:21gfrederickswriting clojure.core/map in core.logic takes some thinks
15:26lynaghksi14: there's a C2-implementation of todo mvc here: https://github.com/lynaghk/c2-demos/tree/master/todoMVC
15:27lynaghkHaven't had time to give serious thought to doing more knockout.js-like two-way data binding abstraction between cljs structures and DOM elements (e.g., same interface for reading/writing DOM checkboxes or text areas or some such)
15:28lynaghkthis demo is basically single direction binding from data -> UI, with manual event handlers that alter the data in response to user actions.
15:34Jack57ciao
15:50jayunit100hmmm
15:50jayunit100 No matching field found: contains for class java.lang.String
15:50jayunit100,(.contains "AA" "A")
15:50clojurebottrue
15:50gfredericks,(.contains "AA" :foo)
15:50clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.CharSequence>
15:51gfredericks,(.contains "AA" :foo :bar)
15:51clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: contains for class java.lang.String>
15:51jayunit100I would assume that there should always be a (.contains…)
15:51jayunit100its a JVM method, not a clojure one.
15:51gfredericksjayunit100: are you passing the wrong number of args?
15:52jayunit100must be an extra / missing paren !
15:52jayunit100gfredericks: good catch :)
16:36ohpauleezlynaghk: chopped it like a surgeon: https://github.com/shoreleave
16:39pipelinei have a fencepost error that is just killing me
16:39pipelineand i can't seem to see what i'm doing wrong
16:39pipelinehttp://cljbin.com/paste/4fde404be4b0815a95f5a8fb
16:39pipelineconfusingly if i drop the "if" and just use "take 4" i get my desired result so i'm really puzzled about my bad recursion here
16:41brehautpipeline: random probably unrelated comment, i its more idiomatic to test (seq collection) rather than (empty? collection)
16:41brehautpipeline: and it will let you ditch the 'nil' clause by switching to a when too
16:42pipelineyep that is how the original function in clojure.core works
16:42pipelinebut i don't understand why my independently mangled version is fencepostin'
16:45brehautpipeline: why are you def'ing a fn ?
16:46pipelinebrehaut: so i can copy and paste out of emacs and into 4clojure
16:46brehautah right
16:46pipelinein my interactive repl i like to have names for things
16:49pipelinebrehaut: now that i have solved it with when-let, as in the source, i see how my solution SHOULD have worked
16:49pipelinebrehaut: "(if (not-empty c)" with no false return value
16:49brehautpipeline: you are fence posting because if you take the rest of [1] you get nil, and a head of 1
16:49lynaghkohpauleez: damns.
16:50ohpauleezI need to merge in the local storage stuff, but it'll all be up on clojars soon. Plus the super project: shoreleave
16:50brehautpipeline: i you are cheating by looking at the source, i guess you can see that in the real version, the cons is outside the when
16:50lynaghkohpauleez: one suggestion; if you're going to maintain remotes, you should decouple them from noir. At the very least, make sure you talk with Chris about the shared namespace "noir".
16:50pipelinebrehaut: yeah i discovered that problem also
16:50ohpauleezAlready decoupled
16:50ohpauleezand already talked to chris
16:51lynaghkohpauleez: but it isn't hard at all to make it accessible from just ring or compojure, and that would make it much more general and useful to a lot of people (myself included)
16:51ohpauleezI'll define a shoreleave-remote-compojure
16:51ohpauleezjust for you :)
16:52brehautpipeline: in future, it can help to remember that fn bodies have implicit do's
16:52brehautpipeline: so you can jam a (prn …) in before your actual behavior
16:53pipelineyeah a common-lisp-ism i appreciate
16:55lynaghkohpauleez: Don't go copy/pasting into a whole new repo just for me; my suggestion would be to sit down and think about how you could make the same codebase work with both. Also in the docs mention why this should be used over fetch (you patched some XSS stuff, yeah?)
16:56ohpauleezI mention CSRF and remote-ns
16:56ohpauleezI'll make it more explicit, thanks
17:02bbloomohpauleez: looks like a nice collection of libraries you got there
17:02ohpauleezThanks man. Docs and demo projects are just around the corner
17:02ohpauleezbbloom: ^
17:02bbloomohpauleez: you using this stuff in prod?
17:03ohpauleezyeah, it was built in parallel as we were building apps
17:03ohpauleezso, in C/Unix fashion … but because of protocols, it's all bottom-up in true Lisp fashion
17:04bbloomohpauleez: cool. https://github.com/shoreleave/shoreleave-core/blob/master/src/shoreleave/common.cljs#L13 does that work with maps of more than 32 keys?
17:04ohpauleezit needs a lot of scrubbing up though
17:05ohpauleezclj->js is crutch - so I would only use it if you really have to
17:05bbloomohpauleez: was just skimming the code. looks bugged to me, it relies on the internal implementation of ObjMap, which gets promoted to a PersistentHashMap after some number of updates or size
17:06ohpauleezWhere at?
17:06ohpauleezYou mean -strobj?
17:06bbloomyeah
17:07ohpauleezThat doesn't work on PersistentHashMap?
17:07ohpauleez(I've never encountered a moment where that failed)
17:08ohpauleezbut I also don't use it very much
17:08ohpauleezWhat would be the generic protocol call replacement?
17:08ohpauleezjust str?
17:09bbloomtry this:
17:09bbloom (.-strobj (into {} []))
17:09bbloomvs (.-strobj {})
17:09bbloomyou'll notice the former is nil
17:09bbloomyou can check for strobj as an optimization, if you want
17:10bbloombut really you should (doseq [[k v] map] ...)
17:11bbloomClojureScript:cljs.user> (type (loop [m {} i 0] (if (< i 10) (recur (assoc m (str i) i) (inc i)) m)))
17:11bbloomcljs.core.ObjMap
17:11bbloomClojureScript:cljs.user> (type (loop [m {} i 0] (if (< i 100) (recur (assoc m (str i) i) (inc i)) m)))
17:11bbloomcljs.core.PersistentHashMap
17:12ohpauleezAhh there you have it
17:12ohpauleezOk, I'll make a ticket, thanks man
17:13bbloomnp
17:18ohpauleezbbloom: https://github.com/shoreleave/shoreleave-core/compare/master...cljsjs
17:19ohpauleezuh, variable names, hang on
17:19bordatouewhich one is good for emacs inferior lisp or swank clojure
17:20ohpauleezbbloom: ok, fixed. Look good to you?
17:20bbloomohpauleez: lgtm
17:21bordatouecan anyone advise on the pros and cons for inferior lisp and swank clojure mode
17:24antares_bordatoue: compared to what?
17:24antares_swank kinda uses inferior lisp approach, no?
17:25antares_and at least for clojure, swank is more widely used than bare inferior lisp
17:31bordatoueantares_: thanks, I just wanted to know which one was widely supported for clojure emacs
17:31mattmoss,postwalk
17:31clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: postwalk in this context, compiling:(NO_SOURCE_PATH:0)>
17:32antares_bordatoue: clojure-mode's clojure-jack-in uses swank-clojure under the hood
17:32mattmoss,clojure.walk/postwalk
17:32clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0)>
17:32bbloom,(ns-aliases *ns*)
17:32clojurebot{}
17:33antares_mattmoss: http://clojuredocs.org/clojure_core/clojure.walk/walk
17:33mattmossantares_: I'm looking at postwalk there now, trying to understand the example.
17:33mattmossOn http://clojuredocs.org/clojure_core/clojure.walk/postwalk
17:34mattmossIf I use their example on [:a :b], I get [2 [[0 :a] [1 :b]]]
17:34antares_yeah, the example there is confusing
17:34mattmossBut the same example on {:a :b}, I get [3 {2 [[0 :a] [1 :b]]}]
17:34mattmossTrying to understand the reason for the difference.
17:34bbloom,(filter #(.contains (str %) "walk") (ns-refers *ns*))
17:34clojurebot()
17:35bbloommattmoss: apparently not available in clojurebot :-)
17:35antares_mattmoss: because iteration over maps vs vectors is slightly different, perhaps?
17:35mattmossantares_: I guess... I suppose I need to dig into the source for walk/postwalk and see where the difference occurs.
17:36mattmossIt just seems like it's doing an extra evaluation for the map compared to the vector.
17:36mattmossOr, perhaps, one less for the vector compared to the map.
17:37Bronsa`,(do (in-ns 'clojure.walk) postwalk)
17:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: postwalk in this context, compiling:(NO_SOURCE_PATH:0)>
17:37antares_mattmoss: that's because iterating (e.g. doseq) over a map yields pairs and for vectors, only values
17:37Bronsa`&(do (in-ns 'clojure.walk) postwalk)
17:37lazybotjava.lang.ClassNotFoundException: clojure.walk
17:37Bronsa`derp
17:37mattmosslol
17:37Bronsa`i was pretty sure it was going to work
17:38mattmossantares_: I guess that makes sense... iteration over a map "adds" an extra form, in a sense... the pairing
17:40mattmossNot that any form is truly being added, but it just seems like that because [:a :b] looks so much like {:a :b} in the editor.
17:41replcatedLet me start by saying I'm not flamebaiting. Did anyone here that really loves and makes regular use of clojure start out hating it? I'm struggling to get beyond what-the-hell-was-he-thinking and actually start on the project I had in mind.
17:43RaynesI might have, but Rich Hickey has been very clear in numerous presentations and talks what the hell he was thinking. :>
17:43zomgreplcated: I didn't like the syntax
17:43zomgI always found lisp syntax stupid
17:43zomgStill do kind of, but I can live with it :P
17:46RaynesIt still surprises me that people concern themselves with parentheses.
17:46brehautive never loved a new syntax for a programming language i dont understand
17:46replcatedRaynes, I understand. I've actually watched a number of his talks.
17:47replcatedI'm actually coming from a CL background, so the parens don't bother me.
17:47zomgRaynes: it's just that every time I move some lines of code or such I always need to check them when in most other languages you don't need to bother with such things
17:47zomgOf course paren matching in the editor helps with that but it's still something you need to do
17:47brehautzomg: no its not
17:47RaynesI don't have to do it.
17:47replcatedzomg: A "real" editor helps a lot.
17:47Raynesparedit does it for me.
17:48zomgI guess you're using emacs or something then
17:48brehautzomg: structural editing removes the need completely
17:48RaynesEven counterclockwise has some paredit support these days.
17:48brehautCCW has had paredit support for at least 2 yeard
17:48RaynesAnd besides, with paren matching, I don't understand how you have to pay any more attention than you would with another language.
17:48zomgUsing vim myself, and tbh it's mostly an issue when I'm being lazy and using dd and not d% or such :P
17:49RaynesWhen I used Vim, I used paredit.vim and lots of da(
17:49RaynesI actually do the same thing in Emacs because I use evil-mode
17:51antares_hey Raynes
17:51Raynesantares_: Hey thar
17:52antares_Raynes: pretested pull requests on travis-ci.org are on for your projects (fs, bultitude, conch — everywhere we could find a travis file)
17:52Raynesantares_: clojail is a flatland project
17:53RaynesThat's probably why you didn't see it.
17:53RaynesAnyways, awesome!
17:53RaynesNow I just need people to send me pull requests.
17:53antares_Raynes: turning it on for clojail, too
17:54antares_I have forgotten about it
17:56antares_Raynes: can you please log in on travis-ci.org so we can sync your repos?
17:56antares_flatland/clojail is not in our database
17:57Raynesantares_: Logged in.
17:58antares_Raynes: do you see flatland/clojail on your profile page?
17:58antares_if you do, that's all we need
17:58RaynesYes.
17:58RaynesNone of these are 'on' though, because I added all the hooks manually (because this page was broken before).
17:59antares_Raynes: that's fine
17:59antares_as long as our database has the repo
19:19brooksbphello
19:19brooksbpnewbie question
19:19brooksbpis there a way to conj to the end of a map?
19:20brooksbpI want to do this: (conj {:a 1} [:b 2]) => {:a 1 :b 2}
19:21RaynesYou can't rely on the ordering of maps.
19:27brooksbpRaynes: I see.. I guess it doesn't matter in my case. It's just easier to read when I evaluate the map in repl to view contents.. would like it to be ordered
19:27gfredericksbrooksbp: clojure maps don't really have an 'end'; semantically they're unordered
19:28brooksbpI'm guessing it's for implementation efficiency?
19:29bbloombrooksbp: and because, semantically, what order do you want?
19:29bbloom,(doc sorted-map-by)
19:29clojurebot"([comparator & keyvals]); keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator."
19:29bbloombrooksbp: if you just want orderd keys for debugging sake, you can use something like:
19:29brooksbpsemantically I don't care
19:30bbloom,(into (sorted-map) (conj {:a 1} [:b 2]))
19:30clojurebot{:a 1, :b 2}
19:34brooksbpI am coming from an imperative language background. Does clojure have some way to use debug flags in expressions? Something to the effect of #ifdef DEBUG ... #endif
19:35brooksbpLike... if I wanted to write that function, but have two cases where debug would use (sorted-map) version and non-debug wouldn't
19:35brooksbpWould that require passing around a debug var to every stinkin function?
19:40Hodappsomehow I'd think you could make use of a global.
19:50miclorbI am trying to look up what "->" really does - not the easiest thing to search for - anyone got a link to the doc?
19:50bhenry,(doc ->)
19:50amalloy&(doc ->)
19:50lazybot⇒ "Macro ([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
19:51clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
19:53amalloysee also http://clojuredocs.org/clojure_core/clojure.core/-%3E
19:53arohnermiclorb: (-> a (foo 1) (bar 2) (baz 3)) = (baz (bar (foo a 1) 2) 3)
19:55miclorbamalloy: arohner: thanks !
19:55miclorbI can see will see will take some practice to internalise, but looks really handy
19:55amalloythough tbh lines 15-38 of the first example on that page should be thrown in the trash
19:57arohneramalloy: what's wrong with that example?
19:57amalloy(-> foo :x :y :z) is *not* the same as (((foo :x) :y) :z)
19:57amalloyit is the same as (:z (:y (:x foo))), which just happens to usually evaluate to the same result in most clojure programs
19:58arohnerright. though that seems to be a bug w/ line 34 then, not a problem with having the example
19:58amalloyfurther, -> is only known as the "thrush operator" by people who read about thrushing and think it's cool. thrush is a function, which does something sorta similar to what -> does as a macro, in most cases
19:58arohnerand IMO, if (foo :x) is not the same as (:x foo) in your program, you have other bugs
19:59amalloyi also
19:59amalloyer
19:59amalloyarohner: (= x nil)
19:59gfredericksarohner: or you are using records
19:59amalloyor foo is nil
19:59amalloyor a record
19:59gfrederickscan you use (:x foo) for a j.u.Map?
20:00gfredericks,(let [m (java.util.Map.)] (.put m :foo 7) (:foo 7))
20:00clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching ctor found for interface java.util.Map, compiling:(NO_SOURCE_PATH:0)>
20:00gfredericks,(let [m (java.util.HashMap.)] (.put m :foo 7) (:foo 7))
20:00clojurebotnil
20:00gfredericks,(let [m (java.util.HashMap.)] (.put m :foo 7) (:foo m))
20:00clojurebot7
20:00amalloyas a matter of taste, i also don't want anyone to be told that you should use -> to get values from a nested data structure - that's exactly what get-in is for, and -> doesn't make it readable
20:00amalloybut i realize that's not a universally-shared opinion
20:01arohneramalloy: yes. :-)
20:01arohnerI think -> is more readable once you're used to it, and I like the flexibility of being able to use things like first & last in the -> expr
20:02amalloyarohner: i love ->. but not for mundane data-structure drilling
20:02brehauti like -> for unpacking stuff like that only if im chucking an (or …) as the last term
20:02amalloybrehaut: (get-in m [a b c] default)
20:02amalloyi think
20:02brehautoh true
20:02amalloy&(doc get-in)
20:02lazybot⇒ "([m ks] [m ks not-found]); Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied."
20:03gfredericksbut there's no substitute for (-> m :foo :bar fn1 fn2 (try (catch Exception e e)))
20:03arohnerI still prefer (-> m a b c (or default))
20:03amalloydoesn't work if your value is nil or false
20:03arohnershrug. doesn't happen often enough for me to say "never use ->" for nested structures
20:04brehautamalloy: who are you replying to there?
20:04amalloyto arohner
20:04amalloyi didn't say never use it. i use it when it's appropriate. but i don't want it held up as a primary example usage of ->
20:05amalloybut i doubt if i'll ever make any changes to clojuredocs, so my opinion doesn't matter much
20:05brehautoh phew. my use of (-> … (or …)) has fns as well as keywords
20:06bbloombrooksbp: regarding your question about a debug flag. you can just use any old var: (def foo 123)
20:14gfredericksyou could use a macro to do the debug testing at compile time
20:15akhudekinteresting, it seems that sqlkorma insert statements need select permissions in the database
20:24akhudekhas anyone encountered this? Do I really need to drop down to raw jdbc just to do a pure Insert?
20:26bbloomakhudek: what query gets generated?
20:26akhudekbbloom: using sql-only prints out a query that is just a normal looking insert.
20:26akhudekit works direclty in psql
20:27akhudekbut not via korma
20:27akhudekif I add select permission to the user, then the korma version starts working
20:27bbloomakhudek: have you tried logging all queries on your server to see if any ADDITIONAL queries get run? i know that rails's active record often queries extra stuff, like table shapes
20:28akhudekI'll try that
20:28bbloomakhudek: can also look at the norma source more carefully for calls to whatever it is that does the query execution
20:28bbloomkorma* dopey osx autocorrect
20:29akhudekah, in the logs it has a "RETURNING *" at the end
20:29akhudekI'm assuming that's the problem
20:30bbloomakhudek: probably :-)
20:30akhudeknow to figure out how to get korma not to do add that!
20:30bbloomakhudek: curious: why don't you allow select permissions? are you exposing the sql db directly without any sort of API or anything in between?
20:31akhudekit's a table that logs transactions in a write only fasion
20:31gfrederickshttps://www.refheap.com/paste/3202
20:31bbloomakhudek: that i assumed
20:31gfredericks^ a with-foo macro-writing macro
20:32akhudekit aggregates data from separate databases; the databases are separate for security concerns
20:32bbloomakhudek: ok gotcha
20:32bbloomgfredericks: heh. nice.
20:33gfredericksbbloom: dangit I don't think it works
20:33bbloomgfredericks: now make it support multiple different arities ;-) you'll need a multi-arity macro-defining-macro
20:33gfredericksbbloom: it's supposed to
20:33gfredericksyou should be able to (def-wrapper-macro [x y z func] (prn x y z) (func))
20:33gfredericksbut I think that fails
20:34bbloomgfredericks: i mean (def-wrapp-macro ([x] (prn x)) ([x y] (....
20:34gfredericksbbloom: I can't even get my head around what that means
20:35bbloomgfredericks: heh nevermind then
20:35gfredericksbbloom: also it might not make sense here
20:35gfrederickscertainly the resulting macro is already vararged
20:35gfrederickssince it wraps them up in the body func
20:36gfredericksyeah I'm going with that doesn't make sense here
20:36bbloomgfredericks: *looks again* oh yeah you're right :-P
20:38akhudekif anyone ever needs this, you can disable returning of results by simply removing the :results key from the query record
20:39kmicugfredericks: what are these 3 asterisks?
20:39gfrederickskmicu: ...three asterisks?
20:40kmicugredericks: ***gfredericks debugs
20:40gfredericksoh; that must be your IRC client
20:40gfrederickskmicu: try typing "/me tries this out"
20:41akhudekhttps://gist.github.com/2946182
20:42bbloomakhudek: does that work?
20:42akhudekyep
20:42bbloomcool! glad you got it :-)
20:42bordatouewhen i load clojure-jack-in it never load clojure.core or clojure.repl , is there any reason for it
20:45bordatouehello
20:45tmciverbordatoue: it *should* load clojure.core, but not clojure.repl.
20:46bordatouetmciver: you are right it loaded clojure.core but not clojure.repl
20:47bordatouetmciver: as a result i don't have doc fn working
20:47tmciverbordatoue: yeah, it's a pain but you always have to 'use' clojure.repl manually.
20:47bordatouetmciver: then wat is the point of this clojure-jack-in
20:47tmciverbordatoue: I think there might be a way to get it to 'use' it automatically but I haven't spent the time to figure out how.
20:49bordatouetmciver: thanks, i will investigate this
20:49tmciverbordatoue: there's a lot of benefit. Check out https://github.com/technomancy/swank-clojure if you haven't already.
20:50bordatouetmciver: any idea how you test your private method
20:50tmciverbordatoue: for example, I often C-c C-l a file to load the current buffer into the repl and then C-c M-p to change the repl's ns to that file's ns.
20:50bordatouetmciver: private fns from repl
20:51bordatouetmciver: thats handy
20:51tmciverbordatoue: Yep. And M-. is another good one.
20:51bbloombordatoue: you can also use the var object, which is invokable
20:51bbloom(#'somens/somefn arg1 arg2)
20:51bordatouetmciver: when i am creating a executable jar, should i explicity mention gen-class in all clj file or just the project.clj file
20:54tmciverbordatoue: I don't know much about it but I think you can get away without AOT but using TimMc's lein-otf: https://github.com/timmc/lein-otf
20:55bordatouetmciver: what does M- do, i am using aquamacs and can't see any binding to it
20:55tmciverbordatoue: mind the period: M-.
20:55bordatouetmciver: oh..
20:56tmciverbordatoue: Jumps to a definition of the var under point.
21:26calvadosis there a way to get request headers in ring without using middleware ?
21:26weavejestercalvados: In Ring? They're in the request map
21:27weavejestercalvados: (fn [req] (do-something-to (:headers req)))
21:27calvadosyes but how to get req without middleware
21:27weavejestercalvados: It's the argument passed to the handler
21:27brehautcalvados: in _ring_ or some other lib on top like compojure?
21:28calvadosactually what i want to do is
21:28weavejesterThat was going to be my next question :)
21:28calvadosi want to change the content-type dynamicly i will check Request:headers:accept part and will change content-type
21:29weavejestercalvados: What library or framework are you using? Are you just using Ring straight off?
21:30calvadosso lets say a got (defn - response [resposne] {:status 200 :body "something" headers: *i-need-to-get-request-headers-here* })
21:30calvadosyes ring stuff
21:31calvadosi just need to get request in (response [response])
21:31weavejestercalvados: The request is passed as the argument to the handler function
21:31weavejestercalvados: So your handler looks like (defn handler [request] …) right?
21:31weavejestercalvados: The headers are in the request map passed to the handler function.
21:31calvadoshm
21:31brehautcalvados: you might be overthinking this
21:32calvadoswell i am quite new
21:32brehautcalvados: look down at "Request Map" https://github.com/mmcgrana/ring/blob/master/SPEC
21:32calvadosmy brain still refuses to get it :)
21:32weavejestercalvados: In ring you have a request, pass it to a function called a handler, which returns a response.
21:33calvadosyes
21:33calvadosi mean i got more than one handler because of routes thought
21:33calvadoseach route goes different handler i beleive
21:33brehautwhat library are you using for your routes?
21:34brehautring doesnt do routes itself
21:34calvados :ring {:handler project./map-routes}
21:34calvadosit should be ring
21:35brehautcalvados: ring is the lowest level api in the clojure web stack. lots of things are part of the ring ecosystem, but are not ring itself
21:36weavejestercalvados: Routes might indicate you're using Compojure
21:36calvados(defroutes map-routes)
21:36weavejestercalvados: That's Compojure
21:36calvadosok
21:36calvadosyes it is sorry
21:36weavejestercalvados: You can use destructuring to access the request
21:36brehautcalvados: you might find http://brehaut.net/blog/2011/ring_introduction helpful
21:37weavejestercalvados: Like (GET "/" request …) or (GET "/" {:as request} …) or (GET "/" [:as request] ...)
21:39calvadosweavejester: than i need to write it to every route thought
21:39weavejestercalvados: That's usually an indication you want middleware
21:39calvadosweavejester: i used middleware but the problem
21:39weavejestercalvados: Doing some operation to multiple routes = middleware
21:40cshellisn't middleware analogous to a filter?
21:41calvadosyes i used middle ware lets says client a visited page content-type changed to a but he got nil , client b visited and he got content-type a and it content-type set to b , when client a revisits he gets content-type response as b
21:41weavejestercshell: It's more like something that modifies the behaviour of a function in a general way.
21:41calvadosi thought it is not the correct place to modify it, because i am modifying and next request its getting active
21:41calvadoslet me paste bin
21:42mmarczykdnolen: ping
21:44weavejestercalvados: The request is immutable. If you alter it for one handler, it's not going to be altered for another.
21:44weavejesterAll data structures in Clojure are immutable.
21:46cshellafter middleware returns, is there any code that runs after middleware that could alter the result?
21:46brehautcshell: any other middleware that wraps that middleware
21:46cshellor does middleware wrap handlers on both entry and exit
21:47calvadoshttp://pastebin.com/1thhJE9a
21:47cshellbrehaut: ah okay, thanks!
21:47brehautcshell: it pays not to draw to stark a line between middleware and handlers
21:47cshellah
21:47calvadosweavejester: i guess its not the best way i am using but i got it so far
21:47cshellcalvados: you shouldn't def inside a function
21:47cshelluse let
21:47cshellthat will slow you down a lot
21:47brehautcshell: with something like compojure its possible that your handlers are middelware themselves
21:48weavejestercalvados: Yes, don't def inside functions - you're using Clojure like an imperative language.
21:48cshellbrehaut: I'm using noir - have been injecting the friend middleware in
21:48calvadosweavejester: i told i am newbie
21:48brehautcshell: my noir knowledge is extremely limited
21:49cshellbrehaut: I considered moving back to plain ring, but it seems like noir is just a bunch of helper functions that help to use ring
21:50weavejestercalvados: I'd like to help, and usually I would, but I'm almost out of time. I need to get to bed!
21:50weavejestercalvados: But in a nutshell...
21:50brehautcshell: theres a big drop off to go back to 'plain ring' but stepping back to plain compojure isnt a huge change. i suspect you could still use a bunch of noir's helpers from compijure anyway
21:50calvadosweavejester: ok thanks anyway, i need to search abit more.
21:51brehautcshell: however, i would recommend learning about how ring and compojure work as they are the underpinnings anyway, and they arent hard to grasp
21:51weavejestercalvados: If you get rid of the defs and use lets instead, that should be your starting point...
21:51cshellbrehaut: yeah, that's a good idea - i've been going through their apis in the last couple of days
21:51cshelli'm so close to getting friend to work
21:52brehautcshell: good plan. i think looking at how routes and GET etc interact is a great place to start. it embodies the spirit of compojure without having to grok a huge amount of code
21:52calvadosweavejester: yes but test is out of it so i cant use let, as i read let is local
21:52cshellcalvados: oh no
21:53weavejestercalvados: Yes, but there's nothing you're doing that isn't local
21:53cshellbrehaut: thanks!
21:54gfredericks,'<o>.<o>
21:54clojurebot<o>.<o>
21:54brehautcshell: weavejester might disagree ;)
21:55cshellbrehaut: he doesn't ahve time to, tonight :)
21:56ibdknoxsome enterprising individual could fairly easily create the wrap-noir-around-compojure middleware :)
21:57cshellwhat would the code for that look like? ;)
21:57weavejesterGoodnight all
21:57brehautnight weavejester
21:57cshellnight, wj
21:59brehautibdknox: i cant imagine that would be very much code?
21:59ibdknoxyeah, not much at all
21:59brehautibdknox: is there an noir equivalent to the context macro in compojure?
21:59ibdknoxno
22:00ibdknoxthough that's another thing that could be added fairly easily
22:00ibdknoxnot as easily as wrapping compojure though
22:00brehautheh, added that would effectively make it trivial to drop compojure in
22:01ibdknoxyeah
22:10akhudekibdknox: is noir-cljs not intended to be used with uberjar or war files for production use?
22:10ibdknoxI guess it could be
22:11xeqiis that just (fn [h1 h2] (fn [r] (if-let [res (h1 r)] res (h2 r)))) ?
22:12ibdknoxakhudek: you'd have to do some trickery to make it work
22:12Raynesibdknox: What is context vs :base-url?
22:12ibdknoxRaynes: potentially nothing, I didn't know about context
22:13ibdknoxRaynes: until much later
22:13Raynesibdknox: BTW, did you see https://github.com/Raynes/refheap/issues/87
22:14brehautibdknox: i think context was new around the time you released noir
22:14ibdknoxRaynes: what's the canonical host thing for?
22:14ibdknoxbrehaut: I think it came a bit after
22:14brehautin that sort of ballpark anway
22:14ibdknoxyeah
22:14ibdknoxif it serves the same purpose, I'm all for consolidation
22:14brehautit wasnt particurly well known about when it was out too
22:15Raynesibdknox: For web apps that have numerous hosts. For example, refheap is refheap.com, www.refheap.com, and refheap.herokuapp.com. It's a way to redirect to whatever the canonical host is (in refheap's case, www.refheap.com) at an application level, since you can't do it at a server level in Heroku (and I imagine other scenarios).
22:15xeqiRaynes: friend also has a similar force-ssl fn https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L46
22:16ibdknoxRaynes: I see
22:16Raynesibdknox: Note that I'm not claiming any of this to be useful in general, just some guy mentioned it.
22:16RaynesSo I figured it worth asking what you thought.
22:16ibdknoxRaynes: they all sound reasonable to include in noir. They could use comments though :)
22:17RaynesOf course. :P
22:17Raynesxeqi: His is bigger than mine.
22:17ibdknoxthat is an epic name
22:18RaynesMine also handles the case where the scheme is there too.
22:19xeqiyah, thats his require-scheme
22:20akhudekibdknox: I think I'll just switch over to cljsbuild for now since it supports pre-compilation. Noir-cljs is pretty nice during dev work though.
22:20ibdknoxakhudek: hm?
22:20xeqijust mentioning since it looks like that concept is useful to move to a higher spot
22:20ibdknoxif you run the server in prod mode
22:20ibdknoxakhudek: and then uberjar it will be precompiled to advanced
22:21akhudekI had to disable aot compilation for it to work though
22:21akhudekalso, it needs to compile before it packages the jar
22:22akhudekI suppose I could run it once in prod mode, re-enable aot, then run uberjar
22:22ibdknoxyeah, admittedly not something I ever do
22:22ibdknoxI just use lein to run my apps
22:25brehautibdknox: what a cowboy :P
22:32akhudekls
22:32akhudekwhoops
22:36arohnerhow do I write a literal plus in a regex?
22:36brehaut[+] ?
22:36brehaut\+ ?
22:37arohnerthose aren't working for me
22:37arohnerneither is \\+
22:37arohnerI'd like something like #"^[a-zA-Z0-0/_-+]+$"
22:37brehaut, (re-find #"\+" "a+b")
22:37clojurebot"+"
22:38arohnerjava.util.regex.PatternSyntaxException: Illegal character range near index 14 ^[a-zA-Z0-0/_-+]\++$
22:38brehautah
22:38brehautits the hyphen
22:38arohneroh right
22:38brehautit defines a range unless its the first character in the character class
22:39arohnerright, forgot about that
22:39arohnerthanks!
22:40brehautno problem
23:07ghadishaybandoes anyone know how to force AOT to be 1.6 JDK compatible, when running 1.7?
23:07ghadishaybanis there a lein flag?
23:08antares_ghadishayban: yes
23:08antares_ghadishayban: what version of lein?
23:08ghadishayban2-preview
23:08antares_:javac-options ["-target" "1.6" "-source" "1.6"]
23:09ghadishaybanthat affects clojure AOT as well? I thought it's just for .java
23:09antares_it is only for Java sources
23:09ghadishaybanoh
23:10ghadishaybanI uberjarred a project using OpenJDK 1.7, ran it on a 1.6 hadoop cluster...had a bad time
23:11ghadishaybanreceived checksum errors on map input files, all sorts of unknown badness. took a while to track down
23:11gfredericksdoes the clojure compiler actually vary its bytecode output?
23:12ghadishaybanthat's the thing. i doubt it, doesn't clojure use an old version of ASM?
23:12antares_ghadishaybangh: from what I see, lein only sets up some system properties Clojure compiler uses
23:13antares_so maybe there is a property for that
23:13antares_ghadishayban: actually, I remember doing something similar and I think :javac-options helped me (but I also have java sources in that codebase)
23:16ghadishaybaninteresting (i am not using any java in this project)
23:16ghadishaybanwell it's running like a champ now that I figured it out
23:16antares_ghadishayban: what did you do? did :javac-options help?
23:17ghadishaybani compiled on 1.6 and deployed *that* (update-java-alternatives in ubuntu)
23:17antares_ghadishayban: yeah but that's a workaround, not a solution :)
23:18ghadishaybanexactly
23:18gfredericksthe difference between a workaround and a solution is how tired you are
23:19ghadishaybani was about to give up on hadoop forever =)
23:19ghadishaybanthe job was only calling (read-string) on about 150GB, feeding it into Cascalog and sorting/reducing...
23:20ghadishaybanthis was my baptism with hadoop, it seems to me to be help duct tape
23:21ghadishaybani'd much rather work using only the clojure reader for my purposes
23:39antares_gfredericks: :)