#clojure log - May 25 2014

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

0:05 amalloy: catern: why would you care that syntax-quote gives you a seq which is not a list? it's quite rare to need something that's specifically a list

0:06 catern: amalloy: because you can't check for clojure.lang.Cons with list?

0:07 amalloy: well, that's fine, because you shouldn't use list? either. if you want to know whether something is listy, seq? is the function to use (it works, among other things, on conses)

0:07 catern: ah, but I want to treat other seqs differently

0:08 because this is a toy interpreter and I'm just making input to it, and maybe I want to use the map or vec types

0:08 amalloy: those aren't seqs

0:09 catern: huh! i thought they were

0:09 amalloy: they're collections

0:10 there's only like three functions in clojure.core that treat lists differently from other seqs: list?, and pop/peek

0:10 catern: so what implements ISeq?

0:10 amalloy: seqs

0:10 catern: no, I mean besides PersistentList and Cons

0:10 amalloy: other collections, like maps and vectors, are *seqable*, ie you can produce seqs from them

0:11 catern: oh, I see

0:11 amalloy: like a million other things implement ISeq

0:11 lazy sequences, ranges, seqs of vectors or maps...

0:12 catern: cool, then I will switch to using seq?, thanks

0:16 amalloy: you're welcome

1:11 sm0ke: hello is there a easy way to launch groovy repl with lein?

3:15 adsisco: how do you see the doc-string of a function in emacs?

4:46 mercwithamouth: o_O

5:47 r4vi: anyone have eldoc mode working with clojurescript or is it going to be a non-starter?

6:18 dissipate: how does the ':test' metadata key/value pair work? is the ':test' function run every time the var is evaluated?

6:37 mikker: I'm trying to stub out a function from an external library in my test

6:37 And I'm using Midje's provided

6:37 But I'm not doing it right

6:41 I get this error:

6:41 var: #'clostache.parser/render-template is not public

6:42 Glenjamin: is that the var you're trying to stub?

6:42 mikker: I suppose it is

6:43 Glenjamin: presumably non-public vars cannot be stubbed - which usually points to stubbing at the incorrect level

6:43 as you generally should only stub public interfaces

6:43 mikker: But I'm pretty sure that IS a public interface

6:43 Clojure is pretty sure of the opposite though

6:44 I misnamed the function

6:44 Like an idiot

6:44 Glenjamin: "render" is the public one

6:44 mikker: render-resource was what I was after :)

6:44 Thanks

6:46 I'm very new to Clojure so I'm unsure of my every move right now

6:46 I'll probably end up with something resembling OOP

6:57 Glenjamin: i think thats always the way

6:58 mikker: probably is

7:14 mercwithamouth: ddellacosta: hola

7:15 ddellacosta: mercwithamouth: howdy there. :-)

7:17 mikker: noooo, don't end up with OO...if you want OO just use Java

7:19 mikker: ddellacosta: I'm trying my best not to

7:19 ddellacosta: mikker: you can do it

7:19 mikker: I'm coming from ruby so most of my knowledge is based on OO principles

7:20 TBH clojure just seemed too rock'n'roll to not try it

7:21 gfredericks: clojurebot: clojure is too rock'n'roll to not try it

7:21 clojurebot: 'Sea, mhuise.

7:26 mercwithamouth: hmmm how to learn when you don't have a realistic project in mind =(

10:02 EClaesson: I'm a bit rusty on clojure, so sorry if i'm doing something stupid :) I'm trying to use a java.io.File. (if (.isDirectory file) ... I get "No matching field found: isDirectory for class [Ljava.io.File;"

10:11 ambrosebs: ,(.isDirectory (java.io.File. ""))

10:11 clojurebot: #<SecurityException java.lang.SecurityException: denied>

10:13 ljos: Eclaesson: that [.. , wouldn't that mean it is an array of java.io.File that you are trying to call .isDirectory on.

10:13 ?

10:15 EClaesson: I don't know. But 'file' is just a (File. "path/here/") so i don't think it's an array

10:16 ljos: EClaesson: I get the same error you get if I call it on an array of files. It works perfectly well if I call the same as ambrosebs wrote.

10:21 EClaesson: If i'm not missing something, it's not an array. https://gist.github.com/EClaesson/e60e2fbbe383e4556f32 Line 16 causes the error

10:22 That file is run by "lein exec" if that makes any difference

10:24 ljos: ECleasson: .listFiles. The second time around file will be an array of files.

10:24 _rc: EClaesson: so listFiles returns File[], so your iteration will be taking an array

10:25 EClaesson: Ahm of course. Thanks. I was completely stuck in (defn traverse

10:25 ljos: Eclaesson: Np. We are all here to learn.

11:11 arkh: why use 'complement' instead of 'not' ?

11:13 bbloom: arkh: complement operates on functions, not operates on booleans

11:13 read their doc strings carefully

11:14 arkh: bbloom: will do - thanks

11:15 fifosine: How can I get a more detailed stack trace? I'm getting this error: http://pastebin.com/QXAJ3UjX but I don't understand it. Supposedly it comes from this file: http://pastebin.com/ket8epP0.

11:17 bbloom: fifosine: that error has all the info you need

11:17 caused by handler.clj line 14

11:17 class can not be cast to ifn

11:18 on line 14, you're trying to evaluate (java.io.File "./db.sql")

11:18 java.io.File is a class

11:18 not a function

11:18 you need to use new:

11:18 (new java.io.File "./db.sql")

11:18 but more commonly, you can use the shorthand:

11:18 (java.io.File. "./db.sql")

11:20 fifosine: bbloom: Does that mean the book I'm following is wrong? This is the snippet: https://imgur.com/GyyQWCi

11:20 bbloom: fifosine: look closely

11:20 fifosine: oh!

11:20 Jeez, that period

11:20 what does it mean?

11:21 bbloom: ,(macroexpand '(Foo. 1 2 3))

11:21 clojurebot: (new Foo 1 2 3)

11:21 bbloom: ,(macroexpand '(Foo 1 2 3))

11:21 clojurebot: (Foo 1 2 3)

11:21 arkh: bbloom, helping people like fifosine and me with reading comprehension :D (no offense meant at all fifosine)

11:21 fifosine: none taken! :)

11:22 bbloom: And what does that ".exists" mean? It applies it to the object?

11:22 bbloom: fifosine: http://clojure.org/java_interop

11:22 arkh: it's calling a method of the object

11:23 (instance method)

11:23 bbloom: fifosine: http://clojure.org/documentation is very terse and assumes you have some lisp/functional background, but it's also *very clear* and complete. worth reading in full

11:24 fifosine: bbloom: If the construction of an object is very expensive and would normally be static in a Java program, how do you analogously make static objects in your clojure program?

11:25 bbloom: fifosine: clojure files are basically giant static object constructors

11:25 (def x (some-expensive-operation)) will occur once at file load time

11:26 fifosine: So in this snippet, the object is created before the method is called? http://pastebin.com/rbd7HrDx

11:27 bbloom: fifosine: let's be clear here, the only "method" in that code is .format

11:27 format-time is a function, not a method

11:27 fifosine: oh gosh, ok, I don't know what the difference between those two are

11:27 bbloom: but no, that SimpleDateFormat will be constructed every time you call format-time

11:27 in java parlance, methods are on objects

11:28 in clojure, functions are first class and can live on their own

11:28 fifosine: bbloom: How would I write it so that it's constructed once but I can use it in every format-time call?

11:29 bbloom: fifosine: https://www.refheap.com/85889

11:29 fifosine: the defs occur when the file is loaded

11:30 fifosine: Got it

11:39 kmicu: New fastload branch… but how fast? ;) https://github.com/clojure/clojure/commit/8b07773ac7582628ca84ccff40ded7c942c79a8c

11:46 bbloom: interesting

11:57 _alejandro: Does anyone have advice on using environ for multiple environments (e.g. test/dev/prod)?

12:02 uvtc: me.raynes/fs has a base-name function. Why no dir-name?

12:04 fifosine: does "& provide

12:04 optional parameters?

12:24 benmoss: does anyone have any experience with using JavaFX 8? having the same trouble this guy had: http://stackoverflow.com/questions/18089248/load-custom-fonts-in-javafx-clojure

12:26 just doing a simple (import javafx.scene.control.TextField) is throwing a “NoClassDefFoundError”

13:59 owl-v-: omg javascript++! clojure needs clojure++

14:05 pdurbin: huh. this, I guess: http://jspplang.org

14:11 owl-v-: pdurbin: i was looking at this >> http://jspp.javascript.am/

14:11 holy crap, Destructors!!!

14:12 yes, that's what i want in clojure

14:13 bbloom: says "explicitly called"

14:13 same for C#

14:13 i don't know how java doesn't have that... we have finally blocks

14:13 java has Closable which is effectively the same as Disposable

14:14 owl-v-: i don't want to use garbage collectors.

14:14 jspp morphing c++ into javascript >> http://youtu.be/D6stkg2Wm4w

14:14 Jaood: we need clojure on llvm

14:20 l3dx: I'm trying to call a function recursively for each element in a vector. (map #(recur % :something) [1 2 3]) - I don't expect this exact example to work, but is there something alike that I can use?

14:21 owl-v-: lol lambda on c++11. c++14 is on the way :-)

14:22 13dx: make function what use recursive

14:25 13dx: at the end (recur <argument1, argument2, ...>)

14:26 13dx: but then u r not going to use 'map'

14:26 13dx: if u r going to use recur

14:26 l3dx: no I guess I'd have to pass the vector as a function argument then

14:27 owl-v-: yes

14:27 expez-: Why does it not make sense to define take! and put! for channels backed by a dropping-buffer?

14:28 owl-v-: expez-: u lost me...

14:31 expez-: owl-v-: (def c (dropping-buffer 1)) (put! c 1) => No implementation of put! exceptoin

14:33 owl-v-: put! returns true unless port is already closed >> http://clojure.github.io/core.async/#clojure.core.async/put!

14:34 source >> https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async.clj#L128

14:34 expez-: ^

14:35 expez-: Are you saying my newly created channel is closed and that leads to a 'No implementation of method....' exception?

14:40 dnolen_: expez-: that's not right, buffers are not themselves channels

14:40 (def c (chan (dropping-buffer 1)))

14:40 expez-: heh, silly mistake. Thanks!

15:21 What does do-alts do? The docstring is unusably terse for beginners :/

15:29 dnolen_: expez-: do-alts is not really meant to be used directly as far as I know

15:30 expez-: ok

16:16 noprompt: if anyone i'm curious what is the best way to approach porting the clojure.lang.IFn portion of clojure.algo.generic.functor/fmap to cljs.

16:21 gfredericks: functions as functors just map the return value amirite?

16:22 noprompt: gfredericks: it's namely this part https://github.com/clojure/algo.generic/blob/master/src/main/clojure/clojure/algo/generic/functor.clj#L41-L47

16:22 it's dispatching on clojure.lang.IFn which AFAIK you can't do in cljs.

16:22 gfredericks: I'd be surprised if you couldn't at least do something equivalent

16:23 noprompt: derive?

16:38 amalloy: https://github.com/clojure/algo.generic/blob/master/src/main/clojure/clojure/algo/generic/functor.clj#L49 seems silly - why isn't it on ISeq?

16:39 noprompt: i was wondering the same thing.

16:48 yedi: for learning purposes, how does iseq and llazyseq differ

17:21 patrickod: I'm trying to use core.async in a project but I'm unable to load it in a repl due to the following error https://gist.github.com/patrickod/0f9bb3defee87065838d

17:22 I'm using clojure 1.6.0 with the latest core.async so I'm unsure why I'd be seeing issues with a core namespaced lib

17:26 http://dev.clojure.org/jira/browse/CMEMOIZE-14?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel seems like there's an open issue for this :/

17:34 yedi: what's the time complexity for a diffing algo? i'm guessing O(n)

17:58 gfredericks: yedi: that might depend on what you mean by diffing algo?

18:02 noprompt: hmm... this seems like a bit of a rat's nest. i'm drawing a blank here. maybe I'll stick with js/Function and seek guidance in the PR.

18:03 yedi: is there a better way to do: (for [[msg id] (map vector avec (range))] (do stuff))

18:04 (pretty much getting the index of a vector as you iterate over it in a for comprehension)

18:04 noprompt: (map-indexed vector avec)

18:04 then you can say (for [[id msg] ...)

18:05 ,(map-indexed vector [:a :b :c])

18:05 clojurebot: ([0 :a] [1 :b] [2 :c])

18:05 noprompt: yedi: ^

18:05 lodin: Is it a bad idea to want to dispatch multimethods on protocols?

18:06 noprompt: lodin: it depends on what you're doing.

18:06 yedi: noprompt: that just replaces this part right: (map vector avec (range))

18:06 noprompt: yedi: yes.

18:06 lodin: it doesn't work in clojurescript. :-(

18:07 lodin: I have two-three protocols and records that implement them. I want to write a function that takes to records and handle them differently depending on what protocols they implement.

18:08 I guess I should set up another is-a hierarchy, but that would be kind of double declaration.

18:09 noprompt: lodin: there's also the option of "marker" protocols if it makes sense in your case.

18:11 lodin: Yes, but I thought that multimethods use isa? and not extends?, and protocol use extends and not derive. Am I confused?

19:02 ToxicFrog: What's the inverse of (empty?)?

19:10 pdk: (identity)?

19:15 amalloy: seq

19:42 owl-v-: ,(next [1 2 3])

19:42 clojurebot: (2 3)

19:43 owl-v-: i don't understand this ^

19:43 i'm expecting a vector as an output... like [2 3]

19:48 akhudek: owl-v-: next always returns a seq. The difference between next and rest is that next is lazy.

19:49 owl-v-: if you want a vector you can use subvec

19:50 owl-v-: ,(rest [1 2 3 4])

19:50 clojurebot: (2 3 4)

19:51 owl-v-: ,(subvec (rest [1 2 3 4]))

19:51 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/subvec>

19:52 owl-v-: ,(subvec [1 2 3 4] 1)

19:52 clojurebot: [2 3 4]

19:52 owl-v-: ah

19:53 hyPiRion: just be aware that subvec leaks memory.

19:53 owl-v-: but why use (rest) on input vector on (recur) ?

19:53 hyPiRion: probably not an issue, just have that in mind

19:54 owl-v-: oh no. leaky memory is bad in embedded system

19:54 superBAD!

19:55 but why (subvec) leaks memory?

19:56 hyPiRion: because it's essentially just an object with an offset and a reference to the old vector

20:02 owl-v-: hyPiRion:if it's just a reference why does it leak memory?

20:03 hyPiRion: owl-v-: Java/the JVM cannot detect that the object with the offset will not look at the first or last elements in the vector. So everything in the original vector is kept

20:03 ssswdon: looking for a good emacs setup using cider

20:05 owl-v-: hyPiRion: original is kept as long as something is referencing it. yes, but if the reference is not used anymore?

20:06 hyPiRion: it will be collected by garbage collector

20:07 bbloom: it doesn't leak memory

20:07 it simple holds pointers to more memory than it strictly needs to

20:07 it will properly reclaim that memory if you stop pointing to it

20:08 the official term for that sort of issue is "semantic garbage"

20:08 owl-v-: so why (subvec) leaks memory?

20:08 bbloom: https://en.wikipedia.org/wiki/Garbage_(computer_science)

20:08 hyPiRion: today I learned about the idiom "semantic garbage"

20:09 owl-v-: lol

20:09 bbloom: (doc subvec)

20:09 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

20:09 bbloom: owl-v-: read the last phrase: "no trimming is done"

20:09 it shares structure

20:09 it's the same as if you pointed to a linked list of one million items, but only ever looked at the first two

20:09 you'd "leak" the last million minus two

20:10 akhudek: technically not a leak

20:10 “hold onto” is maybe a better term

20:10 bbloom: akhudek: retain

20:11 owl-v-: hyPiRion: r u sure (subvec) leaks memory?

20:11 * bbloom gives up

20:12 hyPiRion: owl-v-: it doesn't leak memory, but as bbloom says, it retains objects which can never be referenced from the subvector

20:12 I agree with bbloom, I just didn't know the proper name of the "leak"

20:13 owl-v-: proper name of the 'leak' is leak

20:13 * bbloom is remaining in the "given up" state

20:14 owl-v-: there is no memory leak in JVM unless JVM itself is leaking memory.

20:14 technomancy: no *true* scotsman would leak memory

20:15 noprompt_: bbloom: any ideas on porting this to cljs: https://github.com/clojure/algo.generic/blob/master/src/main/clojure/clojure/algo/generic/functor.clj#L41-L47

20:15 i've moved most of the low hanging fruit over.

20:16 i'm debating whether or not to just skip the IFn stuff.

20:16 bbloom: noprompt_: what's the issue?

20:16 noprompt_: can't you just use cljs.core.IFn ?

20:16 noprompt_: no because afaik you can't dispatch on protocols like that in cljs multimethods

20:16 bbloom: oh, right, no interface for it

20:17 noprompt_: is that just a limitation of cljs multimethods?

20:17 i haven't read through the impl.

20:18 bbloom: noprompt_: i'd just special case ifn?

20:19 (defn fmap [f s] (if (ifn? x) ... (-fmap f s)))

20:19 or isntead of -fmap, fmap-method or something else like that

20:20 owl-v-: what's difference between vector an list in clojure? just the order i want to keep?

20:20 bbloom: ~colls

20:20 clojurebot: colls is seqs and colls

20:20 noprompt_: bbloom: i dunno if it even makes sense for fmap in this case to be a multimethod.

20:20 bbloom: ~seqs

20:20 clojurebot: seqs is seqs and colls

20:20 bbloom: fucking bot

20:20 ~seqs and colls

20:20 clojurebot: seqs and colls is http://www.brainonfire.net/files/seqs-and-colls/main.html

20:21 bbloom: noprompt_: i'm not convinced that fmap is useful at all

20:21 noprompt_: yeah, althought (fmap inc {:a 1 :b 2}) is much nicer than the alternative.

20:22 bbloom: noprompt_: except that i have no idea if that maps keys or values or key value pairs... and whatever you say, why wouldn't it be the other one?

20:23 noprompt_: well the result there is {:a 2 :b 3}

20:23 bbloom: noprompt_: sure, i guessed that from your choice of inc, but ... why?

20:23 seems like an arbitrary choice

20:23 noprompt_: honestly, i don't really care about the fmap stuff in this case. i just more or less care about finishing the patch.

20:24 bbloom: i dunno what patch you're talking about

20:24 noprompt_: i want clojure.algo.generic to be available in cljs.

20:24 bbloom: i'd either just inline all the uses of fmap or special case with the ifn? predicate

20:24 ok, then go with ifn?

20:25 you can put that in to the :default case if you want

20:25 noprompt_: good idea. i'll go that route. that was my last option.

20:27 this seems a bit useless to me: https://github.com/clojure/algo.generic/blob/master/src/main/clojure/clojure/algo/generic/math_functions.clj#L25

20:27 bbloom: noprompt_: agreed

20:28 i think defn- should be deprecated too

20:28 noprompt_: is ^:private so hard?

20:29 bbloom: apparently

20:32 fmap seems like almost as bad an idea as CanBuildFrom

20:36 also those algo/generic impls don't obey the functor laws

20:37 ,(defn fmap-set [f s] (into (empty s) (map f s)))

20:37 clojurebot: #'sandbox/fmap-set

20:38 bbloom: ,(fmap-set (comp #(if (odd? %) (inc %) %) dec) #{1 2 3})

20:38 clojurebot: #{0 2}

20:38 bbloom: ,(fmap-set #(if (odd? %) (inc %) %) (fmap dec #{1 2 3}))

20:38 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: fmap in this context, compiling:(NO_SOURCE_PATH:0:0)>

20:38 bbloom: ,(fmap-set #(if (odd? %) (inc %) %) (fmap-set dec #{1 2 3}))

20:38 clojurebot: #{0 2}

20:38 bbloom: ,(fmap-set dec (fmap-set #(if (odd? %) (inc %) %) #{1 2 3}))

20:38 clojurebot: #{1 3}

20:39 bbloom: er hard to construct an example

20:40 point is that (fmap (comp f g) s) is not necessarily the same as (fmap f (fmap g s)) because g may create duplicate intermediate values that the intermediate set will eliminate

20:40 akhudek: the only thing I’ve used it for is as a map-vals, but there is a map-vals in the prismatic lib, or you can easily write it yourself

20:43 bbloom: it's generally quite difficult to write correct higher order operations that work over differing data structures and abstract collections

20:43 it's also of highly questionable utility

20:47 amalloy: bbloom: well, it's not so much that the algo.generic implementations don't follow the functor laws, as that it's impossible for a set to be a functor

20:47 bbloom: amalloy: right

20:48 amalloy: is there ever a time a generic functor is actually useful outside of appeasing a type system?

20:48 amalloy: huh?

20:48 bbloom: ie is polymorphic fmap actually useful?

20:49 not as far as i can tell, curious if you think so

20:50 amalloy: sure. a tree is a useful functor, for example

20:51 and so's maybe; in clojure, we do fmappy things with some-> and so on

20:51 bbloom: really? when do you ever want to create an isomorphic tree where each node's value is only ever a function of the node in that position's previous value? surely you want some context

20:52 surely you'd want to specify pre or post order traversal, and maintain context, potentially changing the shape of the tree... generic fmap seems useless there

20:52 fmappy-things are different than generic fmap

20:52 amalloy: *shrug* maybe i have a tree of strings and want to parse-int them all. perfectly plausible

20:53 bbloom: seems highly unlikely to me :-P

20:59 amalloy: bbloom: agents and refs? those are kinda functors, except for the mutation

21:00 er, atoms and refs, i mean

21:00 and it'd be nice to have a single function that worked on them all

21:00 bbloom: why would that be useful? seems like that would be an anti feature.... if i had one function that worked on all of them, then i'd write generic code which may or may not be correct given the semantics of all the possible implemetnations

21:01 ie would fmap be commute or alter?

21:01 presumably alter, but then it would need the dosync somehow, which is meaningless for atoms

21:01 sometimes, the lack of generic behavior is every bit as much of a feature as the presence of it

22:10 Frozenlock: Urr... "java.util.zip.ZipException: duplicate entry <my-file.cljs>" when doing lein jar

22:10 Any ideas why? :-/

22:20 fifosine: How do I view changes made in a liberator-service project? I've loaded the repl.clj file and am "use"ing it, but when I make changes to home.clj I have to quit the repl and re open and reload everything to see the changes. Is there a better way of doing this?

22:22 justinholguin: fifosine: I think you want "in-ns" instead of "use"

22:23 If you're in the REPL

22:24 fifosine: It moves me into the namespace? What happens when I change a function in the ns?

22:24 justinholguin: If you change a function in ns x and evaluate it, the change should carry to the REPL session where you called (in-ns x)

22:25 fifosine: ugh, I don't understand why this isn't working. Are you familiar with liberator projects?

22:25 justinholguin: Not really, sorry. I think I'm out of ideas for this one.

22:26 Are you using CIDER or fireplace or something?

22:27 Or are you just saving the changes to the files?

22:29 fifosine: I think I get what you're running into. Try (use 'namespace :reload-all)

22:29 I was assuming that you're developing with an active nREPL connection, which is my mistake.

22:30 fifosine: justinholguin: No, that doesn't work. I must be reading this wrong

22:31 justinholguin: Does this make it clear what I should be doing?

22:31 https://imgur.com/G2O2A0U

22:32 What I've been doing is performing "lein repl" then loading "src/liberator_service/repl.clj" then (use 'liberator-service.repl) then (start-server)

22:32 is that what's expected?

22:33 justinholguin: That should work. Does it?

22:34 fifosine: Not really, because when I change something, I don't see the change

22:35 justinholguin: What kind of change? You might need to run (stop-server) and (start-server) again

22:35 fifosine: yea I've been doing that :/

22:35 Just a small change, e.g., it starts out saying "Hello World!" just changing those words doesn't show

22:36 cbp: (require '[foo.repl :refer :all :reload true])

22:36 justinholguin: Even if you do (stop-server) (use 'liberator-service.repl :reload-all)?

22:36 fifosine: cbp: Do that instead of (use…) or before?

22:39 cbp: still doesn't work :/

22:40 I'm making changes in another file, do I have to do something else so that that file is reloaded?

22:43 cbp_: agh

22:43 I had massive lag

22:44 fifosine: can you explain what you're trying to do?

22:44 fifosine: I'm following along a project in "Web Development with Clojure" but I've hit a snag and can't continue with the tutorial because of it

22:45 cbp_: well that doesn't tell me much

22:45 rhg135: fifosine, yes, (require 'the.ns)

22:46 cbp_: fifosine: when you say "change" you mean you want your repl to use the changed function or your running webserver?

22:46 rhg135: i use fireplace to invoke this for me when i save to reload my code

22:46 fifosine: cbp_: I guess both?

22:47 cbp_: fifosine: uh well, the line I gave you should work for the repl

22:49 rhg135: unless start-server does somn like resolve all vars at invokation you shouldn't need to restart the server

22:50 justinholguin: The author of that book (yogthos) hangs around in here pretty regularly. Guess he's not around now.

22:51 fifosine: arggggg this is so frustrating, I don't know what's going on

22:52 cbp_: fifosine: Need to see some code to help you, can't by just guessing what you're trying to do

22:53 fifosine: cbp_: The thing is there's so much skeleton code, even if I showed something to you, would it be understandable?

22:53 cbp_: fifosine: probably with just what run-server does

22:54 fifosine: cbp_: The file I'm changing right now is 'home.clj': http://pastebin.com/sRAq0beM

22:54 the thing is, when I change the text, I don't see it change

22:55 but the repl.clj file says that changes should be applied to the server in the comments: http://pastebin.com/6XjGr7xs

22:56 the way I'm loading it is first (load-file "…repl.clg") then (use 'liberator-service.repl)

22:56 *clj

22:57 cbp_: fifosine: you don't need to do load-file

22:58 fifosine: Even still, with exiting the repl, making changes to that small amount of text, reopening repl, re"use"ing repl.clj and reperforming start-server, I don't see the changes

22:59 I think I need to tell it to recompile the file

22:59 but I don't know how to do that

23:00 justinholguin: Wait, you can't see the changes even after you completely exit the REPL and start it back up again?

23:01 fifosine: justinholguin: Ye

23:01 s

23:01 cbp_: fifosine: show me the handler file

23:01 fifosine: cbp_: http://pastebin.com/B3PjVAz4

23:02 justinholguin: Actually, that's not necessarily true, sometimes when I restart I see the changes and other times I don't

23:03 justinholguin: Going for maximum weirdness

23:05 fifosine: I think it has to do with not recompiling on save

23:05 justinholguin: lein compiles that stuff when you load it in the REPl

23:05 fifosine: but then it needs to recompile it when I change it

23:06 cbp_: have you tried doing a hard refresh on your browser?

23:06 rhg135: require recompiles it then

23:06 fifosine: How do I do that?

23:06 cbp_: uh depends on the browser + os

23:06 usually something like ctrl + shift + r

23:07 it might be liberator caching responses

23:08 the code looks fine

23:08 fifosine: now I see the change

23:08 I think it had to do with hard refresh :/

23:08 cbp_: its liberator doing http caching then

23:08 fifosine: do you know how to turn it off?

23:09 cbp_: maybe on the liberator docs, never used it myself

23:09 then again its not too uncomfortable to hard refresh

23:11 fifosine: anyway, when you do load-file, require or use clojure will compile the file for you if it finds it

23:11 fifosine: of all three require is the only one you should use

23:11 fifosine: oh, don't use "use"?

23:12 cbp_: fifosine: no that's just left around for compatibility afaik

23:12 fifosine: ok

23:12 cbp_: use (require '[foo :refer :all]) instead of (use 'foo)

23:13 fifosine: instead of the steps you were following you should do (require 'liberator-service.repl) followed by (in-ns 'liberator-service.repl)

23:13 fifosine: why is that better?

23:14 cbp_: fifosine: load-file and require are redundant

23:14 fifosine: i mean load-file and use

23:14 fifosine: cbp_: hard refresh isn't working anymore :p

23:15 cbp_: fifosine: eh?

23:16 fifosine: idk, the changes just aren't appearing

23:17 cbp_: fifosine: I guess you could ask yogthos once he's back

23:17 fifosine: ok

23:59 yedi: guys

23:59 destructuring is so sexy

Logging service provided by n01se.net