#clojure log - Mar 30 2012

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

0:54 zawzey: hi, just checking with anyone has the same problem with clojurescript generating

0:54 hi, just checking with anyone has the same problem with clojurescript generating "can't recur here"

0:55 the live-cljs also has the same problem https://github.com/ibdknox/live-cljs/blob/master/README.md

1:01 ibdknox: I'm also getting the same problem as you

1:06 ibdknox: zawzey: you can't aot the compiler

1:06 delete your classes dir

1:06 and add ^{:skip-aot true}

1:07 zawzey: ibdknow: yeah, well, is this a bug?

1:08 we have to file that somewhere, it took me over a day to discover this fix

1:56 nybbles: hey does anyone know the opposite of interleave function?

1:56 i.e. i have a sequence of [a b] and i want two sequences, one with all the a's and the other with all the b's

1:57 amalloy: &(let [in '[a b a b a b a b]] (apply map list (partition 2 in)))

1:57 lazybot: ⇒ ((a a a a) (b b b b))

2:01 nybbles: amalloy: cool, thanks.. was hoping it would be a builtin

2:01 but whatever works :P

2:35 muhoo: hmm, noir question. let's say i've defpartialed a layout, and the :head is defined in there. now inside a page, i want to include-js something, and have it appear in the head of the generated html

2:36 (and "don't use js, use cljs" is NOT a valid answer)

2:37 so i guess it's a hiccup question really, or rather a hiccup + ring question maybe

2:37 ibdknox: just make your layout take an additional parameter

2:37 muhoo: ah, cool.

2:37 ibdknox: (defn layout [array-of-js & content] ...)

2:37 muhoo: that was easy :-)

2:37 thanks

2:37 ibdknox: np :)

2:38 muhoo: i guess it could even take map-of-head-things, i could have code in there which stuffs them in as needed

2:39 like :title, frinstance

2:39 ibdknox: yeah, that's what I do

3:16 progo: you think it'd be idiomatic enough to write a macro that parses strings like "a beautiful_ day out there" into (str "a " (somefunc) " day out there") ?

3:18 I probably would use such a thing for in-game dialogues which can have different level of profanity ... depending on user setting. And it could also shuffle something random each time :)

3:26 amalloy: why would you parse strings? you have a gorgeous reader/macro system that gives you a rich set of symbols and lists, trivially pre-parsed

3:28 progo: yeah... it is about the fluentliness of writing dialogue. Natural languages, see.

3:29 were I to write the next Fallout in clojure, I wouldn't prefer writing thousands of lines in exact S-expression syntax because it is bit too verbose.

3:34 ibdknox: progo: that doesn't need to be a macro

3:35 progo: you are right about that.

3:35 I went to premature optimization already with macro thinking :/

3:36 ibdknox: a decent rule of thumb: macros are for creating new syntax

3:39 progo: In most schemes, I understand, macros are used to lift some of the static computing to read phase. I take it JVM helps here in the case of clojure?

3:40 or rather, can also be used *

3:41 ibdknox: hotspotting definitely helps remove redundancies and such

3:42 and my suggestion wasn't a steadfast rule

3:42 but in general, I think it's a good way of thinking about it

3:42 progo: I agree.

3:42 ibdknox: There are certainly some things that are nice to do at read/load time

3:42 korma, for examples, walks where clauses and does symbol replacement

3:43 no value in doing that at runtime if you don't need to

3:44 but I think those cases are relatively rare

3:45 in your case, I could imagine a compilation phase where you simply turn all your dialogue possibilities into functions and when you need some permutation you just call the function

3:46 that can be done at "load" time and have nothing to do with macros

3:47 progo: okay :)

3:48 ibdknox: So you're building a game in Clojure? :)

3:50 progo: just thinking about writing one

3:51 and it's been for a long time. Now that Clojure has come up, I actually think I have a chance of maintaining such a project by myself

3:55 emezeske: progo: Have you seen this? https://gist.github.com/1678577

3:59 progo: emezeske, nope. Looks nice :(

3:59 *:)

4:20 kral: 'morning

5:37 AWizzArd: http://isjavaexploitable.com/

6:20 tacit-phoenix: whois technomancy

7:19 mindbender1: Is there a way to inspect the ring and compojure request map from the repl. And is the request map modifiable by the user?

7:20 weavejester: mindbender1: If you're using an IDE or Emacs you could add a debug step at the top of your handler

7:20 mindbender1: Or you could use the debug-repl project

7:21 mindbender1: weavejester: I'm using emacs.. how would I do that

7:21 any links

7:21 weavejester: mindbender1: The only way you can change the request map is to add a wrapper, like middleware.

7:21 mindbender1: How are you running Ring?

7:22 mindbender1: I'm using it with clojurescript one.. as a development server

7:23 I'm finding it hard inspecting the request map from the repl

7:23 weavejester: mindbender1: Hm, I'm not sure if that's been started with swank support then...

7:23 mindbender1: Ok if you giude me I'm sure I can tweak my settings

7:23 weavejester: But if you've started a server from a swank process, you can use (swank.core/break)

7:24 I don't have time to guide you, I'm afraid

7:24 But take a look at: https://github.com/weavejester/ring-serve

7:24 mindbender1: weavejester: you are saying that I can only inspect the map with swanl.core/break

7:25 weavejester: *swank.core/break

7:25 weavejester: mindbender1: No, you could also use debug-repl

7:25 mindbender1: Or print it out

7:25 mindbender1: weavejester: Ok point me to a link for debug-repl

7:25 weavejester: mindbender1: https://github.com/GeorgeJahad/debug-repl

7:26 mindbender1: weavejester: thanks let me study those

7:28 weavejester: what's the recommended way recently for swanking clojure projects

7:30 I still use my old clojure-jack-in style when working with clojure only projects

7:59 y3di: did rhickey say that simplicity was the opposite of complexity, or the opposite of complicatedness..?'

8:00 gtrak``: complectedness?

8:01 i guess that would be simplectedness

8:01 it's so complicated

8:08 y3di: he did say that things could be both simple and complex right?

8:13 josteink: so what do you guys use to search up syntax things in clojure when you're fooling around?

8:13 I find that google is pretty poor at indexing things which are central in clojure syntax...

8:13 like trying to lookup set! on google is hopeless :P

8:20 headius: simplexity is the mother of complicity

8:25 gtrak``: josteink, try clojuredocs

8:26 there is like a symbol oriented search engine somewhere, too, but the name escapes me

8:27 TimMc: symbolhound

8:30 josteink: ^

8:34 Scorchin: what's the best way to model a Java Object which is to be accepted as a parameter? Should it look like a map with relevant methods, or as a function?

8:35 gtrak``: huh what?

8:35 you making something to be consumed by java, or from java to clojure, or clojure-to-clojure

8:35 Scorchin: to be consumed in Clojure, but I'm wrapping Java

8:36 gtrak``: you could just leave it

8:36 Scorchin: currently I'm just passing the Java object, but want to know if there's a cleaner way to wrap it

8:36 gtrak``: zach tellman had a good talk about this

8:37 https://github.com/strangeloop/clojurewest2012-slides/blob/master/Tellman-Distilling-Java-Libraries.pdf?raw=true

9:40 jtoy: on clojure 1.3, how do I use split? I tried with: (clojure.string/split (slurp "stop.txt")) and get java.lang.ClassNotFoundException: clojure.string (NO_SOURCE_FILE:0)

9:41 chouser: have you done (ns ... (:require clojure.string)) ?

9:41 cemerick: You have to require the namespace first, e.g. (require 'clojure.string)

9:41 chouser: cemerick: good morning!

9:41 cemerick: chouser: morning!

9:42 Still beating me out by an instant ;-)

9:42 jtoy: yes, that works, thx

9:42 how does one only allow the file to load once in idiomatic clojure?

9:43 cemerick: jtoy: namespaces will only be loaded once unless you specify :reload or :reload-all in the require/use form

9:44 But outside of the REPL, you should make sure to use a top-level ns form, as chouser hinted at.

9:48 jtoy: sorry, i explained it wrong, i mean with a slurp, i have: (defn filter_words [word] (not (some #(= % word) (clojure.string/split (slurp "stop.txt")) ))) how do I have the slurp only happen once? or is the file already loaded for each subsequent call to filter_words ?

9:51 pandeiro: jtoy: i would def a var, slurp into that, and then pass that var to my filter-words fn, but i'm pretty new here... maybe there's a better way?

9:51 jtoy: I'm new too

9:52 clgv: jtoy: there is 'defonce

9:52 pandeiro: there's the clojure.java.io ns too for doing more elaborate things but not sure you need that

9:53 cemerick: jtoy: if stop.txt isn't going to change, use defonce

9:53 feh, I'm slow today :-P

9:53 jtoy: cool, thanks

9:53 clgv: cemerick: ;)

9:53 pandeiro: cemerick: would the ns get re-evaled every time another ns in the execution path refers to it?

9:53 hence the need for defonce?

9:54 cemerick: defonce just ensures that the var's definition isn't re-evaluated and reset each time the ns is loaded

9:54 pandeiro: right, gotcha... things i'm still learning 7-8 months in... man

9:55 stuartsierra: defonce really only matters if you're reloading code during development

9:55 cemerick: the ns won't get re-loaded due to another namespace referring to it; defonce is largely to prevent against redefinition when loading files via the REPL

9:55 pandeiro: stuartsierra: that's what i was wondering, if i have a ns being required in different parts of my code, is it getting evaled each time?

9:55 stuartsierra: no

9:56 `require` never loads the same namespace more than once unless you tell it to

9:56 pandeiro: wonderful, that's the behavior i assumed

9:57 clgv: Has there ever been a discussion about caching the byte[] representation of dynamically created classes (via proxy, deftype...) in Clojure's DynamicClassLoader?

9:57 stuartsierra: clgv: discussion, yes, vaguely and briefly

9:57 essentially that's what AOT-compile does

9:58 clgv: but AOT is different. I have written down my issue here: http://groups.google.com/group/clojure/browse_frm/thread/613998ce1682c293#

9:59 summarizing, the byte[] representation of dynamically created classes is need when the class is loaded from a remote location when using JPPF

10:00 stuartsierra: no idea, that's a very special case

10:00 you can always hack the compiler :)

10:01 clgv: yeah but you have to hack it again and again for each release... ;)

10:01 stuartsierra: Never Stop Hacking.

10:01 cemerick: clgv: there was a ML post on that, right?

10:01 clgv: cemerick: yes, the link above

10:02 cemerick: jeez

10:02 * cemerick is just going to take the rest of the day off

10:02 clgv: if AOT wouldnt be required, I could have a future-like command that distributes the jobs via JPPF which is also usable from REPL

10:03 cemerick: I was going to say, it sounds like JPPF should work fine if everything is AOT'd right?

10:03 clgv: yes it does.

10:05 but the interactive usage on a REPL would be the killer feature ;)

10:06 cemerick: regular functions presumably work fine as well?

10:08 clgv: cemerick: good question. as far as I understood: if they have no classfile on the classpath it will not work

10:09 pandeiro: each java process entails a unique jvm instance, am i understanding that right?

10:10 i'm running into memory problems on my netbook having a web server, browser repl, and swank all running at the same time, but i guess there's no way around that

10:10 clgv: cemerick: I couldnt try it since the proxy is needed and it already fails with loading the proxy-class

10:11 cemerick: Cool JVM failure: Invalid access of stack red zone 0x11626bff8 rip=0x115e15c1d

10:11 clgv: pandeiro: upgrade to a laptop ;)

10:11 pandeiro: clgv: actually it's a tweener but yeah, 2GB of ram and netbook-grade processor :(

10:12 i also think it's because i am working with a large dataset and 5-10mb svg files open in the browser :) not all java's fault

10:14 fdaoud: pandeiro: I love my netbook but yeah you gotta go a bit more easy on it :)

10:15 pandeiro: i love the portability, hate the processor

10:16 fdaoud: have had mine for 4 years, it has taken the use and abuse of being pounded on every day on the bus and subway, have run many different things on it, even wrote a book on it, and it hasn't complained

10:17 pandeiro: fdaoud: model?

10:18 fdaoud: pandeiro: it's an asus eee

10:18 pandeiro: cool yeah always heard good things about them

10:18 stuartsierra: cemerick: You red-lined your stack?

10:18 fdaoud: pretty much looks like this: http://en.wikipedia.org/wiki/File:ASUS_Eee_White_Alt-small.png

10:19 pandeiro: fdaoud: what os?

10:19 fdaoud: pandeiro: and the battery life is pretty good too

10:19 lubuntu

10:19 pandeiro: nice

10:20 fdaoud: I've tried others including eeebuntu, but lubuntu has proven the most stable (on this netbook anyway)

10:23 pandeiro: fdaoud: i have a toshiba satellite t215 and it wouldn't install ubuntu, part of what precipitated my move to arch

10:23 i like not running gnome too, seems like a resource hog

10:26 muhoo: Raynes: what did you end up choosing as a templating engine for refheap?

10:32 fdaoud: pandeiro: indeed. what did it come with preinstalled? mine came with Xandros

10:34 chouser: pandeiro, fdaoud: what do you use for wifi network management?

10:35 pandeiro: fdaoud: wow, yeah mine came with Windows 7 Inferior Edition

10:35 chouser: i use wicd

10:36 devn: good morning all

10:37 pandeiro: chouser: i installed dhclient too b/c the default dhcpd was pissing me off, performs better now

10:37 chouser: pandeiro: ok, thanks.

10:37 devn: g'morning.

10:38 fdaoud: chouser: gnome network manager

10:43 chouser: are you having linux wifi problems?

10:45 chouser: fdaoud: no, not for a long time.

10:46 fdaoud: chouser: ah ok, good :)

10:46 pandeiro: somewhat of a linux rite of passage, that

10:46 chouser: But the desire to use gnome network manager was my gateway drug into using gnome again after years of not.

10:46 pandeiro: chouser: what did you use previously?

10:47 chouser: oh, goodness. wpa_supplicant or something

10:59 fliebel: What do you recommend for doing stuff to a /dev/ttyblah device? I read there is javax.comm aand rxtx, but... do I need them?

11:01 Zoka: cemerick: drawbridge looks really cool.

11:01 cemerick: :-)

11:02 Zoka: and very compact too:)

11:02 cemerick: Zoka: I hope you find it usable. Let me know if you hit problems.

11:02 Maybe I'm finally learning to keep things simple.

11:02 simpler*, perhaps

11:02 pandeiro: i want to invoke a fn with a keyword as first argument which then determines how the fn executes - would that be a case for multimethods or just a (cond) in a regular fn?

11:03 Twey: pandeiro: Are you sure this wouldn't be a better case for several different functions?

11:04 pandeiro: Twey: i don't think so, they just trigger a small tweak to the jquery selector syntax depending on that keyword

11:06 Twey: pandeiro: Multimethods are more for cases where the function performs semantically ‘the same’ operation on different values or types

11:07 pandeiro: If you've got a value that's explicitly for switching, you probably don't want multimethods

11:07 pandeiro: Twey: gotcha, so i will go with the (defn (cond combo i guess

11:08 Twey: *nod* Seems reasonable

11:10 Multimethods aren't really for things that ‘just trigger a small tweak’; the idea is that they're useful for making the operation transparent when it's basically the same operation, but may be implemented completely differently based on the values passed to it (hence the syntax of defining methods as totally separate functions)

11:10 Zoka: cemirick: for the time being I am staying with my transport, while I am working on more sessions features. Using Ring for nREPL communication was your idea anyway, I just have not implemented it in a such elegant way, but I am more familiar with it at the moment.

11:11 devn: wait, what's drawbridge?

11:11 * devn checks his email

11:12 fdaoud: devn: https://github.com/cemerick/drawbridge

11:12 pandeiro: Twey: so in another case, say I want this fn to accept both strings and RegEx, which obviously need different impls, that would be a case for multimethods?

11:13 * pandeiro goes and checks if jquery selectors can be regexes

11:13 fliebel: Maybe I'll just use Python for this project... I don't feel like fighting the classpath today, which seems to be required for getting rxtx to work.

11:20 "RXTX is actually in central, but only the java portion; the native libraries are not distributed."

11:27 So, before I just walk over to Python, how can I depend on a native library that is not on Maven?

11:30 devn: aww, chas left :(

11:30 * devn thinks someone should put up a screencast of drawbridge in action

11:31 rplevy: in lein2 is there a new way of specifying the groupid for plugins? it seems to ignore the groupid

11:31 TimMc: rplevy: Yes. The first step is, come to BAZNEX.

11:31 We'll tell you the rest there.

11:31 rplevy: I live in Burlington, VT now

11:31 so there's no way

11:31 TimMc: NO EXCUSES

11:31 rplevy: haha

11:32 TimMc: What do you mean by ignoring the groupid?

11:33 rplevy: ok so I have installed in my local maven a little fork of lein-cucumber, i put in my profiles.clj {:user {:plugins [[rplevy-draker/lein-cucumber "1.0.0.M1-SNAPSHOT"]]}}

11:33 rplevy-draker, the groupid appears to be ignored

11:33 muhoo: fliebel: i saw there's a better replacement for rxtx

11:33 it's pure java, less bugs than the jni-laden mess that is rxtx

11:34 fliebel: muhoo: What? Where? *drool*

11:34 muhoo: i don't recall the name but it's used in the ols project

11:34 i can look it up, hang on

11:34 TimMc: rplevy: And it's picking up the regular lein-cucumber?

11:34 rplevy: yeah

11:35 actually it look for it with no groupid in the repos

11:35 fliebel: muhoo: http://www.sparetimelabs.com/purejavacomm/index.html

11:35 TimMc: And you've saved your buffers? *dubious*

11:37 muhoo: fliebel: http://www.sparetimelabs.com/purejavacomm/index.html

11:37 yep

11:38 fliebel: muhoo: Thanks, I guess you just saved me a ton of nastiness.

11:38 muhoo: it's thread safe :-O

11:38 rplevy: TimMc: and when I make a local maven install of it with no groupid that works fine

11:38 muhoo: fliebel: np, glad to help

11:38 fliebel: wow, that... exceptional for a hardare interfacing thing.

11:38 rplevy: (it's not in a repo online yet)

11:38 TimMc: rplevy: Freaky.

11:39 rplevy: so either there's a bug, or group/artifact is no longer the way

11:41 maybe there should be a lein help sample-profile

11:42 because the upgrade guid doesn't contain an example of this

11:43 source dive time I guess, if no IRC answer :)

11:45 TimMc: I haven't really mucked about with lein2 yet.

11:48 muhoo: hmm, the idea of calling directly from clojure to c library and os functions seems kinky and appealing to me, if i ever have occasion to use it: https://github.com/twall/jna

11:48 rplevy: I'v been using and making a few contributions to lein-cucumber and cucumber-jvm. Nils' latest change to use the new cucumber-jvm stuff is on a lein2-only branch, so I get to play with lein 2.

11:50 chouser: muhoo: it's old, but... https://github.com/chouser/clojure-jna

11:50 muhoo: oh, cool, thanks

11:55 rplevy: lein2 also ignores groupid when declaring plugins in project.clj in :plugins vector

11:57 muhoo: {:vector "Victor", :clearance "Clarence", :over "Ouvre", :roger "Roger"} => "what?"

11:58 * muhoo is done procrastinating for the morning now.

11:59 rplevy: I figured it out

11:59 there's no bug

11:59 lein2 install must have a different convention, because when I lein2 install the library it works

11:59 it must name or write the pom somehow differently

12:01 markgunnels: I'm trying to include json-lib in my leiningen project. It exists in maven central and sonatype (which I have added as a repository in my project.clj). The pom for json-lib is <dependency><groupId>net.sf.json-lib</groupId><artifactId>json-lib</artifactId><version>2.4</version></dependency> and my entry in dependencies is [net.sf.json-lib/json-lib "2.4" :classifier "jdk15"] or [net.sf.json-lib/json-lib "2.4"] (tried both).

12:01 lein for some reason can't resolve it though.

12:03 Anybody see anything immediately that I am doing it wrong?

12:04 TimMc: rplevy: But it's still searching on just the artifact ID?

12:04 rplevy: no it works, I jumped to an incorrect conclusion, it wasn't ignored, it just couldn't find it

12:06 is there anyone already working on making leiningen-war work with lein 2?

12:12 dakrone: Zoka: lemme know if cheshire 3.1.0 works for you, it should now

12:17 clizzin: anyone know the story for asset packaging in clojure web apps?

12:18 dakrone: ibdknox: just release cheshire 3.1.0, which now won't complain if clj-json is in the same project, so hopefully that will help with the noir issues for 1.2.1

12:21 rplevy: clizzin: you mean like war files?

12:38 offby1: Help -- M-x clojure-jack-in keeps failing with a baffling error: http://ix.io/2g7

12:38 I cannot for the life of me find any file that contains the symbol "slime-fancy"

12:38 rplevy: TimMc: on second thought I still think there is some groupid weirdness

12:38 offby1: I suspect this is due to leftover cruft somewhere in my home directory; M-x clojure-jack-in works OK when I start emacs with -Q

12:40 Frozenlock: offby1: I personally gave up trying to make it work with 'fancy'.

12:40 rplevy: technomancy: have you noticed any problems in lein2 using plugins specified like <groupid>/<artifact> as opposed to just the artifact?

12:41 offby1: Frozenlock: that'd be fine. How do I tell it "I don't want fancy"?

12:41 technomancy: offby1: definitely a hold-over from manually-installed slime; maybe rgrep ~/.emacs.d?

12:41 offby1: been there done that

12:41 technomancy: rplevy: I don't think I've tried that yet

12:41 offby1: maybe apt-get?

12:42 offby1: well, this is OS X, but I'll look in macports

12:42 Frozenlock: offby1: install slime from marmalade, make sure there isn't another slime around (for CL for example). Someone else might tell you how to mix the two, but I have no idea.

12:42 technomancy: Frozenlock: actually with jack-in you don't need to install slime yourself

12:42 it can bootstrap itself

12:42 so it's just a matter of finding the existing version and destroying it

12:42 Frozenlock: technomancy: Oh nice!

12:43 offby1: or as I say: hunting it down and killing it

12:43 I see a version in ~/quicklisp but I assume that you put that there.

12:43 since I deleted it recently and it just came back.

12:44 * technomancy would never do such a thing

12:44 Frozenlock: Indeed, in my notes I see "Install clojure-mode from git or Marmalade." No mention of slime. My apologies.

12:44 offby1: can't find any other version: "locate slime.el" yields just those two hits under ~/quicklisp

12:45 TimMc: rplevy: Try pulling in [org.timmc/lein-otf "1.1.0"]

12:46 offby1: weird, M-x slime tries to run sbcl ... but M-x find-function RET slime RET errors: signal(error ("Don't know where `slime' is defined"))

12:47 Frozenlock: offby1: You should start it with clojure-jack-in

12:48 technomancy: Is lein2 ready for showtime? I would like to install it on my machine, but I'm afraid of the consequences on my Win7 OS...

12:49 offby1: Frozenlock: that's what I've been doing.

12:49 huh, rebooting emacs ... now it worked.

12:49 weird

12:50 Frozenlock: offby1: If you just installed Lein your environnement variables might have been outdated. (I know I lost hours before thinking of rebooting emacs)

12:52 technomancy: Frozenlock: someone claimed to get it working on Windows

12:53 Frozenlock: I use it every day on debian, but I'm not sure if the batch file has been updated

12:54 offby1: Frozenlock: I haven't explicitly installed lein

12:55 technomancy: rplevy: leiningen-war is deprecated IIRC

12:55 Frozenlock: technomancy: 'get it working' scares me :P

12:55 technomancy: Frozenlock: well I mean they got it working and submitted a patch =)

12:55 which is a lot better than getting it working and not submitting a patch

12:56 Frozenlock: Indeed :)

12:56 rplevy: technomancy: what is the new way of doing what leiningen-war did?

12:57 technomancy: rplevy: lein-ring is generally the way to go these days I believe

12:57 fdaoud: rplevy: lein ring uberwar

12:57 rplevy: ok, neat, I'll use that

12:58 TimMc: In noir, is there a way to get automatic resource reloading?

12:59 E.g., I'd like to be able to do (defresource foo "path/to/query.sparql") and have it define an IDeref that will be swapped whenever the resource changes on disk.

13:00 (only in dev mode, perhaps)

13:16 simard`: what's the simplest way to run (swank.swank/start-server) in a thread of its own ? I basically want to start a swank server within my clojure VM without blocking at that call

13:18 technomancy: simard: easiest to wrap it in a future

13:19 simard: technomancy: thank you

13:23 sritchie: technomancy, do I need to run anything special to get checkout dependencies working w/ lein swank?

13:24 oh, never mind

13:24 working

13:24 nice

13:24 !

13:28 fdaoud: [ibo;c vpod

13:28 muhoo: ! was my reaction to lein too. i couldn't imaagine clj without it.

13:28 fdaoud: sorry, handed shifted on kbd + wrong window!

13:29 technomancy: fdaoud: just blame the cat; works every time

13:29 fdaoud: technomancy: :D

13:29 muhoo: ok, just convinced a customer to let me deliver him code written in clojure. win.

13:29 progo: fantastic :)

13:29 * RickInGA cheers

13:29 muhoo: thanks!

13:34 phiat: hello clojurians... I have a question about Java interop that I can't find the answer to...

13:35 how do i instantiate a new java class like Polygon Polygon(int[] xpoints,

13:35 int[] ypoints,

13:35 int npoints)

13:35 (i.e. mulitple params in the ctor)

13:36 sritchie: (Polygon. array-1 array-2 points)

13:36 phiat: wow thanks. i'll try that

13:37 TimMc: &(doc int-array)

13:37 lazybot: ⇒ "([size-or-seq] [size init-val-or-seq]); Creates an array of ints"

13:38 sritchie: phiat: yeah, that might be what's getting in your way

13:38 mega`: ,(int-array [1 2 3])

13:38 clojurebot: #<int[] [I@1685b65>

13:38 sritchie: it's gotta be a primitive array for that constructor

13:38 phiat: ah ok.. thanks a buynch

13:38 bunch

13:38 sritchie: (defn mk-polygon [xs ys n] (Polygon. (int-array xs) (int-array ys) n))

13:38 phiat: very nice

13:39 fdaoud: sritchie: SICP flashback

13:39 sritchie: painters!!

13:39 fdaoud: :)

13:39 sritchie: (def x-coord car)

13:39 yup

13:48 dnolen: nice, new CLJS release going out with PersistentVector

13:51 fdaoud: dnolen: very cool

14:09 dnolen: and no more warning about .foo

14:12 fliebel: muhoo: Do you have any personal experience with the purejavacomm thing?

14:15 fdaoud: dnolen: oh that's nice. I'd been somewhat relunctantly ignoring those.

14:21 dnolen: k core.logic 0.7.0 out the door, now works easily with Clojure and ClojureScript

14:24 fliebel: dnolen: yay!

14:25 kmicu: Anyone has problems with 'lein cljsbuild auto' on project https://github.com/swannodette/cljs-demo ?

14:29 dnolen: kmicu: sorry, been busy with a few things - soon as core.logic 0.7.0 hits maven central that project should just work.

14:32 fdaoud: dnolen: so first clojurescript has to hit maven central, and then a new version of cljsbuild needs to use the new version of clojurescript?

14:33 dnolen: another reason to get cooking on the killer Clojure REPL in HTML 5, put this in your google search input: sqrt(x*x+y*y)+3*cos(sqrt(x*x+y*y))+5

14:33 fdaoud: no, just core.logic

14:34 fdaoud: oh, yes, if you're talking about the latest CLJS

14:34 fdaoud: dnolen: yes sorry meant the new CLJS release you mentioned earlier, and using cljsbuild.

14:35 kmicu: dnolen: Im on ubuntu 12.04 beta and I have lein 1.7.1 and lein 2 and I don't know if problems are on my side or not :), I can't even get core.logic 0.6.9 from clojars/maven but I can see this version on mvn Central :/ so I added 0.6.9 jar manually, but now when I run lein cljsbuild auto I get java.io.FileNotFoundException: Could not locate clj/core/logic/macros__init.class or clj/core/logic/macros.clj on classpath :P

14:36 dnolen: kmicu: nothing will work until 0.7.0 hits maven central - you'll have to be patient - it takes some time.

14:36 Zoka: dakrone: cheshire 3.1.0 fine

14:36 dnolen: kmicu: if you really want to get going - you'll have to clone core.logic and install it by hand - which is pretty easy.

14:36 kmicu: dnolen: 0.7.0 not 0.6.9?

14:37 dnolen: kmicu: yes

14:37 kmicu: anything prior to 0.7.0 will have the wrong jar layout.

14:37 kmicu: dnolen: thx, you're great! ;)

14:37 dnolen: kmicu: so 0.6.9 has CLJS support but nothing works because the JAR layout is wrong.

14:37 kmicu: np

14:46 offby1: basic Java ignorance: I've attempted to set CLASSPATH inside of emacs like this: (setenv "CLASSPATH" "/opt/local/share/java/clojure/lib/clojure-contrib.jar") ...

14:46 ... then I killed "java" and re-did M-x clojure-jack-in ...

14:46 But now I see user> (System/getProperty "java.class.path") => "/Users/erichanchrow/doodles/clojure/hello/test:/Users/erichanchrow/doodles/clojure/hello/src:/Users/erichanchrow/doodles/clojure/hello/classes:/Users/erichanchrow/doodles/clojure/hello/lib/clojure-1.2.1.jar:/Users/erichanchrow/.lein/plugins/swank-clojure-1.4.0.jar"

14:47 which seems wrong: shouldn't the clojure-contrib.jar appear in that output?

14:47 this is OS X; is this one of those deals where the new java process _doesn't_ inherit the environment from the process that started it?

14:47 technomancy: offby1: you should be able to avoid setting the classpath by hand by just changing project.clj

14:47 offby1: technomancy: hmm, uh OK

14:47 technomancy: managing dependencies by hand is just no fun

14:47 offby1: well, sure

14:48 even if this worked I wouldn't want to _always_ do it this way.

14:48 But I'm at such a baby-beginner level that I'd like to understand _why_ it's not working

14:48 do I just add clojure-contrib to the :dependencies in the semi-obvious way?

14:49 Twey: offby1: Could be that emacs isn't passing that on, or that the Java instance started by emacs has an explicit -cp argument?

14:49 technomancy: offby1: yes, but with caveats

14:49 :dependencies [[org.clojure/clojure-contrib "1.2.0"]]

14:50 offby1: technomancy: that's pretty much what I guessed; tx

14:50 technomancy: and that's fine for messing around, but in general "monolithic contrib" is deprecated

14:50 offby1: Twey: ooh, good point about the explicit -cp

14:50 technomancy: what does that mean in English?

14:50 technomancy: offby1: it means rather than a bucket-o-libraries all mushed into one jar, the path forward is having each library in contrib maintained separately

14:50 amalloy: offby1: don't use clojure-contrib; use the new broken-up contrib modules

14:50 technomancy: clojurebot: where did contrib go?

14:50 clojurebot: well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

14:51 offby1: *sigh*

14:51 technomancy: offby1: contrib-as-a-single-jar is just a holdover from the days when having more than two jars was a huge pain in the neck

14:51 but if you're just messing around it's not a big deal

14:51 * offby1 wonders how much else of the Halloway book is no longer relevant

14:52 technomancy: offby1: the list is pretty short

14:52 offby1: good

14:52 technomancy: 0) contrib, 1) #^ for metadata is replaced with just ^, and a couple other fairly obscure things

14:52 amalloy: i bet structs and duck-streams are on the list (not having read the book though)

14:52 technomancy: yeah, no more structs

14:53 clojure.java.io and clojure.test are included in clojure itself now

14:53 amalloy: duck-streams is what i hear most often from people who read some old book

14:54 technomancy: c.j.io being the duck-streams replacement

14:55 offby1: looks like there's no "clojure.contrib.str-utils" although there is a "clojure.contrib.string"

14:55 amalloy: clojure.string

14:55 emezeske: fdaoud: I just saw the new clojurescript release on the ML. I'll try to squeeze out a quick cljsbuild release today, although I do have to hit the road here in a bit... :)

14:56 offby1: I just don't know what it is about Clojure -- every time I try to learn it, I seem overwhelmed with hindrances. Either I'm consistently doing something wrong, or I just lack sufficient motivation ...

14:57 maybe it's my insistence on using it via Emacs, combined with my utter ignorance of Java

14:57 technomancy: coming at it fresh would probably be easier than coming at it after two years away =\

14:57 amalloy: offby1: emacs is the way to go, especially if (as you of course are) you're already familiar with emacs

14:58 offby1: I try to start from scratch each time.

14:58 RickInGA: offby1 if you use emacs for other things, it is a good way to go. If you are not an emacs user normally, try clooj. It is a great way to start with Clojure

14:59 technomancy: offby1: there's an updated edition of the halloway book, plus the new oreilly book is good

14:59 lynaghk`: emezeske: where are you off to? JSConf?

15:00 amalloy: RickInGA: offby1 has probably never turned off emacs in his entire life

15:00 offby1: technomancy: oh! I didn't know.

15:00 emezeske: lynaghk`: Nah, just a little road trip. Up to your neck of the woods, actually!

15:00 lynaghk`: emezeske: yeah? If you're in PDX and need a beer, drop me a line

15:00 emezeske: lynaghk`: Sounds good!

15:01 aperiodic: i like beer

15:01 ;)

15:01 emezeske: BEEEEEEEEEEER

15:02 aperiodic: lynaghk` has my number, so you should hit me up if y'all are doing that

15:02 lynaghk`: Does anyone know if trying to use pushState and hashChange at the same time is asking for a boatload of trouble?

15:02 aperiodic: will do.

15:02 RickInGA: ,(symbol :foo)

15:03 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.String>

15:03 dnolen: emezeske: sick, thx for the quick switch to latest!

15:03 RickInGA: Is there a function for converting keyword to symbol?

15:03 dnolen: emezeske: oh, you haven't got there yet :)

15:03 emezeske: dnolen: I'd have it done already if 0.0-1006 was in maven (or whatever)

15:04 dnolen: emezeske: yeah it usually takes a few hours

15:04 emezeske: dnolen: Hopefully I can sneak away later tonight to push out the release real fast :)

15:05 kmicu: dnolen: It works, pure madness!

15:05 emezeske: aperiodic: Souns good, man!

15:05 dnolen: kmicu: excellent! did you just install core.logic yourself?

15:05 kmicu: dnolen: yes, fresh 0.7.0!

15:06 dnolen: kmicu: cool, glad to hear that the instructions weren't too obtuse.

15:07 xeqi: $findfn :a 'a

15:07 lazybot: []

15:08 kmicu: :dnolen one question about this warnings during cljs build e.g.: WARNING: The form (. this toString) is no longer a property access. Maybe you meant (. this -toString) instead? For now it is ok?

15:08 xeqi: $findfn 'a :a

15:08 lazybot: [clojure.core/keyword clojure.core/find-keyword]

15:09 RickInGA: is findfn just a bot thing? I got an error in inferior-lisp

15:09 xeqi: yeah

15:09 dnolen: kmicu: for now it is OK, we're waiting for CLJS 1006 to hit maven, I'll update cljs-demo soon as it does to grab latest lein-cljsbuild

15:09 RickInGA: cool

15:09 xeqi: ,((comp symbol name) :x)

15:09 clojurebot: x

15:09 Raynes: RickInGA: It is a library too though.

15:09 RickInGA: https://github.com/Raynes/find-fn

15:10 RickInGA: thanks

15:10 Raynes: Er, https://github.com/Raynes/findfn

15:18 gfredericks: what's the deps.js file for that my app.js keeps trying to load?

15:19 i.e., what's it expecting to be in there and how would I go about fulfilling those expectations (or changing them)?

15:19 emezeske: gfredericks: That file is something that would be used if you were not compiling down to one file

15:19 gfredericks: (using lein-cljsbuild)

15:19 emezeske: gfredericks: Here's an example of how to make that go away: https://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/simple/src-clj/example/views.clj#L13

15:20 gfredericks: emezeske: thx

15:21 emezeske: on a related note, I have no idea how to do clojurescript deps anyhow -- is there some doc on that somewhere?

15:22 emezeske: gfredericks: All you have to do is (require ...) them, and if they're in the classpath you're good

15:22 gfredericks: And they can get in the classpath by adding them to your :dev-dependencies or whatever

15:23 gfredericks: okay sweet

15:23 wait a minute

15:23 uh

15:24 what does that assume about what I'm doing in the project.clj config with cljsbuild?

15:24 emezeske: gfredericks: Nothing at all.

15:24 gfredericks: okay

15:24 emezeske: gfredericks: It really is just as simple as "is it on the classpath"

15:25 gfredericks: Whether or not the classpath is simple is another discussion :P

15:25 mega`: sup cljs experts getting some error with clojure.browser.repl/connect in the newest cljs version parentElm is null.. anny one seen this before?

15:25 gfredericks: I'll not ask anything else until I can't get it to work :)

15:26 emezeske: gfredericks: ^_^

15:30 fdaoud: emezeske: great, thanks!

15:31 emezeske: fdaoud: Note that, as others have mentioned, it could be a few hours before the upstream release hits the repositories

15:31 fdaoud: emezeske: noted. I'll be patient. :)

15:33 ipostelnik: is there a way to get "lein uberjar" to not check for dependency updates?

15:42 offby1: is it normal for "lein search" to take many minutes?

15:51 TimMc: the first time, yes

15:54 Raynes: offby1: It downloads lucene indexes.

15:54 offby1: Which is the equivalent of downloading the internet.

15:55 fdaoud: if only lein clean cleaned the internet.

15:56 Raynes: Every time you run `lein clean`, 12 comments disappear from hacker news forever.

15:56 offby1: anyone know offhand if some bit of Clojure creates a directory ~/.m2, and fills it with class files?

15:56 dnolen: kibit is headed towards being as cool as this: http://soft.vub.ac.be/SOUL/

15:57 offby1: Raynes: that'd be a _good_ thing, no? :-)

15:58 fdaoud: offby1: that's a maven thing, which I believe lein uses as well

15:58 offby1: hm, OK; I'll spare it the wrath of my "nuke everything that I don't understand" impulse

15:58 since it does have a ton o' stuff in it

15:59 fdaoud: offby1: for example, clojurescript might come from here: http://repo1.maven.org/maven2/org/clojure/clojurescript/

15:59 then it would go into your .m2/repository/org/clojure/clojurescript

15:59 offby1: ah, ~/.m2 implies "maven2". Got it

16:00 thanks

16:00 fdaoud: right, sorry should have mentioned that.

16:00 welcome

16:00 * offby1 wonders how hard it'd be to make "lein search" give some feedback ... a progress indicator, or at least the name of the temp file to which it's downloading ...

16:01 jtoy: if i need a very simple web app to serve the contents of a file on the fs to the browser, what lib would you guys recommend? Im a clojure newb

16:01 fdaoud: offby1: my .m2 has about 500-600MB in it.. you might want to hold off on nuking it.

16:01 hiredman: jtoy: I would recommend this thing called "apache" it's pretty good

16:02 jtoy: hiredman: i will convert the file a little bit

16:02 with some code

16:02 offby1: fdaoud: yeah, I've put lamb's blood around its doorframe; it shall be spared my wrath

16:02 jtoy: hiredman: because, if it was just a web server, i would use nginx, it uses less resources

16:03 besides

16:03 * fdaoud puts some lamb's blood around his doorframe.

16:03 offby1: I'd put in an ignorant vote for nginx too -- I vaguely recall it's easier to set up than apache

16:04 fdaoud: does this mean I shall never ever again suffer the wrath of offby1 errors?

16:04 offby1: I don't see no lamb's blood round _your_ doorway.

16:04 * offby1 raises his Palm of Wrath™

16:05 fdaoud: wait, didn't you see what I did above?

16:05 offby1: oops!

16:05 I guess I'm not as omniscient as y'all thought

16:07 fdaoud: ,(map list "abcde" (cycle [:odd :even]))

16:07 clojurebot: ((\a :odd) (\b :even) (\c :odd) (\d :even) (\e :odd))

16:08 fdaoud: love stuff like that, no more (for i = 0, t = ...) { (i % 2 == 0) ? .. : ..)

16:08 offby1: that's exactly the sort of thing that keeps me plugging away at trying to learn this beast

16:12 fdaoud: offby1: I agree. One hurdle I'm trying to overcome is to "unthink" the ways I've always done this stuff, and find better functional-style solutions

16:12 autodidakto: jtoy: lib? you mean web framework, or?

16:12 jtoy: yeah, web framework

16:13 amalloy: :( web framework. "Clojure: build libraries, not frameworks"

16:13 jtoy: or lib is fine

16:14 autodidakto: It's helpful to make comparisons/analogies *cough*

16:14 fdaoud: (map (fn [name] (amalloy :description)) ["ring" "compojure" "noir" "hiccup"])

16:14 autodidakto: jtoy: so there's ring, on top of ring, there's compojure, on top of compojure there's noir

16:15 if you know ruby, ring is like rack

16:15 jtoy: i know ruby

16:15 * weavejester needs to change the project description of compojure - it's not really a framework.

16:15 amalloy: personally, i'd just slap something together with ring/compojure. a lot of people would use noir. the smart people would use probably use nginx or apache for production

16:15 autodidakto: noir is something like sinatra

16:16 amalloy: fdaoud: '(library library framework/but-pretty-cool-anyway library)

16:17 fdaoud: amalloy: cool. so why is compojure a library, but noir a framework?

16:17 technomancy: offby1: lein2 has a progress bar for search index downloading now

16:17 offby1: fdaoud: I'm quite familiar with functional style and Lisp; what's tripping me up is the Java-ness.

16:17 and the always-quickly-changing-ness.

16:17 * offby1 <-- Zen surfer. Not.

16:18 amalloy: noir has all this implicit stuff about views and models and partials and middleware it injects automatically for you. but also, because i don't know that much about it

16:18 so don't take my word for it

16:19 technomancy: offby1: picking up Clojure c. 1.4.0 when you last touched it at 1.0 would be a bit like getting back into Emacs when you hadn't touched it since version 20. =)

16:19 autodidakto: About the "framework" word.... I agree that it isn't the right word... what's great about the clojure web..sphere... how these small, well written parts (ring/compojure/noir) fit one ontop of the other

16:19 technomancy: which I believe seancorfield actually did, but it wasn't pretty

16:19 fdaoud: offby1: oic. I'm coming from the other side. 15 years of Java. Not so many of lisp/FP. I'd say interested in FP since about the last 4 years or so (FunctionalJ, 2008)

16:19 offby1: technomancy: Actually it's not a problem since I remember approximately nothing

16:19 technomancy: ah, perfect then

16:20 autodidakto: amalloy: I think ibdknox would disagree about noir doing a substantial amount of background magic. In any case, you should check it out

16:20 fdaoud: amalloy: np. I'm just curious at the boundary between library and framework. Framework would be where you have to mostly go "all-in", then?

16:20 as opposed to library which is more "use what you need"?

16:22 weavejester: A framework is usually something that dictates how your code is laid out.

16:22 So Rails sets up a folder structure and a way of doing things for you

16:22 A library just provides an API you use. It's a servant, rather than a master.

16:23 fdaoud: weavejester: well said.

16:24 that is useful since I am trying to write about all this stuff.

16:26 offby1: is there some reason that "lein search" can't cause the search to run remotely? That way I wouldn't have to wait half an hour for the index to download :-|

16:27 weavejester: offby1: As far as I know, Maven repositories are just static folder structures - no search

16:28 technomancy: offby1: you can use http://search.maven.org and the search box on http://clojars.org if you know which repository contains the dependency

16:29 Raynes: Or technomancy can make his broken softwares faster.

16:29 technomancy: repo1.maven.org is not my software =P

16:29 fdaoud: Raynes: you still lacking sleep bro? :)

16:29 autodidakto: Raynes: come on now, be nice, he's making broken software as fast as he can

16:29 Raynes: fdaoud: A little bit.

16:29 autodidakto: :p

16:29 dnolen: just tried kibit - very neat!

16:29 fdaoud: Raynes: I hope your weekend is RESTful.

16:30 Raynes: fdaoud: :)

16:37 TimMc: ibdknox: How hard would it be to hook into noir's view reloading to provide an atom that kept getting refreshed with the contents of some resource?

16:40 fdaoud: Raynes: what's happening with Meet Clojure?

16:41 Raynes: fdaoud: It's just taking a while because I have a lot on my plate.

16:41 Still in progress though.

16:41 fdaoud: cool. believe me, I know how much work it is.

16:44 autodidakto: Raynes: The yellow E in the MSPaint-cover-concept-art is a nice touch

16:44 Raynes: That was something a friend just threw together as a placeholder for an actual cover.

16:46 autodidakto: Learn You a Haskell has the elephant, Land of lisp the alien (elephant like creature). Meet clojure maybe needs an animal mascott too

16:46 fdaoud: autodidakto: O'Reilly's Clojure and Closure both have birds :D

16:47 autodidakto: The sometimes-italic j in Clojure is suggestive of an ant-eater or aardvark

16:47 fdaoud: I see they're not concerned about confusion

16:47 fdaoud: hehe

16:48 TimMc: The animals they use are completely random, right?

16:49 I'm pretty sure their Python book has a rat on the cover.

16:49 autodidakto: nah it has a snake

16:49 but I vaguely remember hearing that it's not exactly author's choice. i'll look it up

16:49 fdaoud: nothing beats the drunk dude on the Joy of Clojure cover.

16:50 dnolen: huh kibit runs in a reasonable amount of time even on large Clojure code bases

16:50 autodidakto: Wait. there is an edition with a rat... weird

16:51 fdaoud: haha yeah

16:51 raek: the joy of clojure cover guy looks like the břežňák man

16:51 autodidakto: TimMc: you're right, latest python has rat on it. Python food methinks.

16:54 no wait, was rat until latest edition. then they changed the name slightly and put a python. same author.

16:58 TimMc: Authors usually have little to no control over book covers.

16:59 autodidakto: TimMc: "explaination" here -> http://oreilly.com/news/ediemals_0400.html TL;DR, cover design just makes it up and gives no explanation

16:59 TimMc: Title and subtitles too. Crazy marketers get more say

17:00 *Cover designer just makes it up...

17:02 TimMc: I love it: "One author desperately wanted to have a boll weevil on his book cover"

17:02 offby1: Damn, more trouble: on Ubuntu, now, M-x clojure-jack-in is getting me ``Starting swank server... Connecting to Swank on port 62854.. [2 times] error in process filter: Symbol's function definition is void: slime-output-buffer [2 times]''

17:02 what's odd is that I can see there's a hidden buffer that contains slime, and it contains a definition for that function

17:03 technomancy: offby1: looks like you still have something installed that's expecting a newer version of slime

17:03 offby1: *sigh*

17:03 emacs does not make it easy to see where code is loaded

17:03 autodidakto: TimMc: The boll weevil really is the king of the weevils

17:04 offby1: technomancy: so is that *swank* buffer supposed to get evalled?

17:04 TimMc: s/evalled/weeviled/

17:04 * offby1 chooses the lesser of two weevils

17:04 dnolen: emezeske: looks like cljs might have made it to maven

17:04 autodidakto: hehe

17:04 technomancy: offby1: oh my bad; I thought you said it was a variable rather than a function

17:05 offby1: older swank-clojure implementations spewed out all of slime.el into *swank*, but in 1.4.0 it's a bit more streamlined

17:05 offby1: hmm

17:05 technomancy: offby1: you could try lein plugin install swank-clojure 1.4.0

17:05 offby1: sure why not

17:06 by the way, I'm using lein 1.6.0 which appears to have come from Ubuntu, since it's in /usr/bin/lein ... Is that bad?

17:06 technomancy: no, that should be fine

17:06 if you do have slime from marmalade already, you can just do "lein swank" and M-x slime-connect

17:06 offby1: ok, installing the plugin appears to have succeeded

17:07 technomancy: jack-in is mostly there to avoid all the headaches people get from figuring out how marmalade works

17:07 offby1: you totally lost me

17:07 I'll try clojure-jack-in again

17:07 technomancy: sure

17:09 offby1: apparently lein 1.6.0 _is_ bad: it says "lein swank is not a task"

17:09 life on the bleeding edge!

17:09 technomancy: oh cripes; yeah... I thought that bug was older

17:09 * offby1 rolls up his sleeves and hoists his Purging Flamethrower

17:10 technomancy: easy fix though; remove the old swank from ~/.lein/plugins

17:10 fdaoud: dnolen: sweet!

17:11 offby1: may just nuke all of ~/.lein

17:11 technomancy: offby1: if it placates your fury

17:12 fdaoud: precates?

17:12 ;)

17:18 offby1: hooray, shiny new lein fixes all problems. I even noticed my hair growing back.

17:19 technomancy: fwiw 1.7.1 is in debian testing =)

17:19 there's hope for a brighter tomorrow

17:22 fdaoud: good weekend all

17:46 emezeske: dnolen: sweet, it sure did!

17:48 lynaghk`: emezeske: have you ever used cljsbuild with ibdknox's fetch?

17:48 emezeske: lynaghk`: Yeah, I use that in my closed-sauce project

17:48 lynaghk`: I ran into an issue where cljsbuild auto wasn't refreshing properly.

17:49 emezeske: Under what circumstances?

17:49 lynaghk`: nothing crazy as far as I could tell. I just added fetch to my project and started playing around with it and ran into that issue

17:50 emezeske: Like, you saved one of your project's cljs files and it didn't rebuild?

17:50 lynaghk`: not using the macro made it go away; I was going to dig into it more but decided to just switch over to using Compojure with XHR manually.

17:50 ibdknox: lynaghk`: when you add a new clj dependency you have to restart the watcher

17:50 lynaghk`: no, it rebuilt and no errors showed up but It would serve a stale version

17:50 ibdknox: like the macros for fetch

17:51 lynaghk`: ibdknox: yep, it persisted after that though.

17:51 ibdknox: hm

17:51 lynaghk`: ibdknox: I just integrated waltz into a project this morning; it's rad.

17:51 ibdknox: :)

17:51 lynaghk`: I have some wishlist items---I can submit a pull if you're game

17:51 one would be to have a listener called on all state changes

17:52 ibdknox: yeah, that was on my list

17:52 emezeske: lynaghk`: That's weird, I don't know what's up with that.

17:52 ibdknox: having a deterministic version

17:52 and renaming those stupid names

17:52 lol

17:52 lynaghk`: emezeske: yeah, I'll try the new cljs build and put together a minimal example if I run into it again

17:52 ibdknox: deftrans/transition is confusing :(

17:52 lynaghk`: yeah, I was confused about that too. Also, I'd love a macro where you can define it all in one form (like compojure's defroutes)

17:53 ibdknox: sure

17:53 you can do that already just with (->

17:53 I think

17:53 lynaghk`: ahhh, good point.

17:53 emezeske: lynaghk`: That would be aweesome.

17:54 ibdknox: defevent or definput?

17:54 lynaghk`: ibdknox: have you seen https://github.com/gf3/secretary ?

17:54 ibdknox: yeah, I have something similarish in waltz

17:55 where you can do transitions based on hash changes or urls

17:55 lynaghk`: there is no destructuring in there though, eh?

17:55 ibdknox: yeah

17:56 lynaghk`: What I'm doing right now is actually just shoving all context into a url-encoded string

17:56 gfredericks: what is the fancy point-free way to go from x to (fn [y] (@x y))?

17:56 (partial deref x) is clearly wrong

17:57 lynaghk`: i.e., clientsideapp.com/state/{:my "cljs" :prn "datastructure}

17:57 weavejester: gfredericks: juxt, I think...

17:57 pjstadig: (partial apply (deref x))?

17:57 or maybe a comp in there?

17:57 gfredericks: pjstadig: I don't want to deref until the function is called though

17:57 ibdknox: lynaghk`: haha interesting

17:58 pjstadig: hmm

17:58 emezeske: Okay, I just pushed out lein-cljsbuild 0.1.4, which depends on the latest clojurescript release (0.0-1006) as well as closes a few other cases.

17:58 weavejester: Ohh, I didn't notice the derefing

17:58 gfredericks: weavejester: I was really hoping you were wrong :)

17:58 weavejester: I don't think there's a built in function for that.

17:58 lynaghk`: emezeske: high-five!

17:58 pjstadig: #(@x %)

17:58 * emezeske high fives back!

17:58 gfredericks: weavejester: perhaps not one but a small combination...

17:58 pjstadig: that's shorter, not point-free

17:58 pjstadig: oh yeah

17:58 point free

17:59 technomancy: pjstadig: that looks like a screenshot from nethack

17:59 gfredericks: partial apply sounds promising though

17:59 technomancy: not saying that's a bad thing

18:00 gfredericks: I guess what you need is a call function

18:00 TimMc: this is going to be something horrible with partial apply apply, isn't it

18:00 gfredericks: or invoke or whatever

18:00 TimMc: that's why you need call, it's cleaner

18:00 hiredman: ((fn [y] (@x y)) 1) is just ((deref x) 1)

18:00 gfredericks: hiredman: certainly

18:00 but I want an expression for the function

18:00 not the result of calling it

18:00 hiredman: so, uh, (deref x) is point free

18:01 gfredericks: hiredman: but that derefs immediately rather than when the function is called

18:01 (def my-fn (deref x)) is no good

18:01 yeah I think it will have to be really ugly

18:01 at least without a call function

18:02 probably even ugly with that

18:02 TimMc: trampoline :-P

18:02 gfredericks: ooh

18:02 lynaghk`: ibdknox: Why did you decide to write a deftrans construct for Waltz? All I'm doing with them is defining transitions that set the machine to the state with the same name (am I missing something?)

18:03 ibdknox: lynaghk`: it's non-deterministic, so a transition (or input, or event) can cause multiple states to flip

18:03 lynaghk`: transitions should be verbs, states should be nouns/adjectives

18:03 lynaghk`: ibdknox: ahhhh, got it.

18:04 ibdknox: transition: load -> state: loading

18:04 as an example

18:05 lynaghk`: ibdknox: so the machine can be "in" any subset of the total number of states?

18:06 ibdknox: yes

18:06 it's up to you to define exclusions

18:06 buuut, like I said, I want to add a deterministic version too. In that case, all states are mutually exclusive

18:07 lynaghk`: ibdknox: any plans to do something hiearchical?

18:07 emezeske: these undeclared var warnings are pretty hot, thanks.

18:07 ibdknox: you can accomplish that with what's there

18:08 lynaghk`: ibdknox: But I demand synatactic sugar!

18:08 ibdknox: but it depends on what you mean

18:08 lynaghk`: =P

18:08 ibdknox: haha

18:08 lynaghk`: Nah, all I have in mind would be to have different SMs for different screens, but with a deterministic version it wouldn't be difficult to implement that

18:09 I'll have to make a large app with these things, and then log the transitions and make some cool visualizations.

18:09 ibdknox: yeah

18:09 :)

18:09 the ability trace everything is pretty neat

18:10 muhoo: fliebel: i've used ols, which uses purejavacomm

18:11 emezeske: lynaghk`: yeah, thanks go to jenan wise for that feature, and dnolen for suggesting it!

18:11 TimMc: ibdknox: Did you see my question about reloading arbitrary resources?

18:11 muhoo: Raynes: what template engine did you end up settling on for refheap?

18:11 emezeske: lynaghk`: I have wanted that for a while

18:11 Raynes: muhoo: Mustache.

18:11 * emezeske is out!

18:11 muhoo: Raynes: thanks

18:11 lynaghk`: emezeske: man, cljs really is taking all of the runtime fun out of clientside development.

18:11 Raynes: muhoo: Via https://github.com/davidsantiago/stencil

18:12 muhoo: oh yes, thanks. i do remember you talking abotu that now.

18:16 ibdknox: TimMc: missed it

18:17 * muhoo mutters "alzheimer's again" to himself

18:18 ipostelnik: is there a way to figure out what's holding the head of lazy-seq and why?

18:18 * offby1 holds his head when he's hung over

18:19 TimMc: ibdknox: How hard would it be to hook into noir's view reloading to provide an atom that kept getting refreshed with the contents of some resource?

18:20 I guess it wouldn't have to be noir-specific -- it would just be a nice feature when editing SQL or SPARQL query files.

18:24 * Frozenlock is sad... the compojure's example he used was really old.

18:25 Frozenlock: Any advice on whether I should use Noir or compojure/hiccup?

18:26 vijaykiran: Noir uses compojure/hiccup AFAIK and you get some extra sugar as well.

18:28 dnolen: nice lein-cljsbuild now gives declaration warnings

18:28 technomancy: Frozenlock: if you know how all the pieces fit together you might try compojure itself first, but noir makes a lot of choices for you that you may not care to bother with

18:33 Frozenlock: technomancy: thanks. As a neophyte, I'll give a try to Noir.

18:34 simard: is there a way to force the termination of a future when future-cancel fails ?

18:36 ivan___: in cljs how do you access the window object? i seem to get a namespaced window object, but that doesnt seem like the 'real' one

18:38 nvm

18:39 * Frozenlock is happy to see Noir uses ring-reload-modified

18:40 weavejester: Frozenlock: Does it use that library in particular?

18:41 Frozenlock: I think it does; it's in the lib folder.

18:42 weavejester: Frozenlock: Ah, it looks like it uses the more up-to-date ring.middleware.reload in the upcoming version 1.3.0

18:43 Frozenlock: Will it use your new version of compojure/hiccup too? I saw both were in beta.

18:44 nvm: [hiccup "1.0.0-beta1"] [compojure "1.0.1"]

18:44 weavejester: Frozenlock: The master branch of Noir has those deps

18:44 I'll probably release Hiccup 1.0.0-RC1 tomorrow

18:44 And Ring 1.1.0-RC1 sometime this weekend, too.

18:51 lynaghk`: emezeske: auto compilation with fetch seems to work fine in the new cljsbuild.

18:54 weavejester: would you still be open to a pull request for an :allow-symlink option for (wrap-file) middleware? I ran into that problem yesterday and saw you had a discussion about it with someone last summer and said you'd welcome a patch.

19:08 arohner: simard: not really. there are ways to terminate threads in java, but they're very unsafe

19:09 simard: arohner: hum then I'll have to find a way to kill that swank gracefully.. say send it a message.

19:09 somehow.

19:09 arohner: simard: your goal is to stop the swank server?

19:09 simard: yes

19:09 well..

19:09 I tried (swank.swank/stop-server)

19:09 and it seems to work.

19:10 it fact I'm not sure which thread is preventing my software from stopping.

19:10 s/it/in

19:10 when I asked the question about futures I thought it was swank

19:11 arohner: simard: (Thread/getAllStackTraces) will return a list of all threads

19:11 simard: then call .getName and .isDaemon on all of them

19:11 sorry (-> (Thread/getAllStackTraces) (keys))

19:12 simard: the non-daemon threads keep the app alive

19:12 though if you wait 60s for the app, and it shuts down on its own, that's probably the clojure agents keeping it up

19:13 simard: 60s eh. I'll try that

19:14 arohner: oh it did shut down after 1s this time..

19:14 arohner: if it shuts down after 60s, you need to call (shutdown-agents) when you're ready to shut down

19:15 simard: arohner: yup it definitely shuts down after a while

19:15 I'll add this call then, thanks :)

19:16 arohner: np

19:21 does anyone have experience w/ cron4j or a similar library?

19:25 jhickner: clojurescript question. I'm trying to set a js propertty - camera.position.z = 1000. Is there a nicer way to do it than this? (set! (.-z (.-position camera)) 1000)

19:27 ideally_world: is it possible to assert something in a midje after wrapper?

19:27 * ideally_world needs to test the value of state after a function with side-effects

19:32 oakwise: jhickner: (set! (.. camera -position -z) 1000)

19:32 jhickner: hotness. thanks!

19:33 oakwise: np

19:34 simard: jhickner: are you working on a game ?

19:36 jhickner: some work with three.js

19:36 not a game, just messing around really

19:38 aperiodic: jhickner: is the source available anywhere?

19:39 ibdknox: TimMc: yeah, I don't think I would tie it to noir :)

19:39 jhickner: not yet, I just started this morning

19:40 aperiodic: jhickner: i've entertained the idea of doing that myself, but haven't gotten around to it yet. hopefully i can just steal your code ;)

19:40 eggsby: is there a canonical clojure redis client?

19:41 or is it a free-for-all

19:41 jhickner: sure, the hardest part so far was making an externs file

19:41 eggsby: Is anyone itc familiar with using redis with clojure?

19:41 aperiodic: eggsby: yeah; we use our own fork of clj-redis at work (it has pipelining, woo)

19:42 eggsby: https://github.com/tavisrudd/redis-clojure this is what google returns, but I don't know that it's a full client... it doesn't even seem to have pubsub

19:42 aperiodic: jhickner: are you the jhickner on gh?

19:42 ibdknox: eggsby: there's a new one that abedra is working on, one sec

19:43 eggsby: https://github.com/abedra/accession

19:43 technomancy: I think clj-redis has pubsub

19:43 eggsby: thank ibdknox

19:43 aperiodic: clj-redis does have pubsub

19:43 Frozenlock: Is there a way to automatically add functions name in Emacs syntax highlighting?

19:43 aperiodic: well, pub, for sure, can't vouch for sub

19:44 eggsby: We're working on a project at work that I think redis would be an extremely elegant solution for (right now we're doing intense polling across several systems) but it's kind of hard to argue in favor for it when I can't even show a good client :p

19:44 jhickner: yeah jhickner on gh

19:44 ibdknox: eggsby: that should be a good one

19:44 technomancy: eggsby: oh man you're in luck; there are like a bazillion redis clients; that's even better, right?

19:44 eggsby: anyhow thank you ibdknox/technomancy/aperiodic, I'll look into redis-clj and accession

19:44 haha technomancy :(

19:44 ibdknox: eggsby: just look who contributes :)

19:45 aperiodic: accession looks like it's actively developed, though; i'd go with that, unless you need multi/exec

19:45 eggsby: a commit by fogus :o

19:46 accession looks nice

19:46 will have to dig into it

19:54 ideally_world: what's the right way to add a key-value pair to a map reference? I'm trying (dosync (alter my-ref assoc :key :value)) and getting a "clojure.lang.Keyword cannot be cast to clojure.lang.Associative" :/

19:55 no idea what the means

19:55 technomancy: it means your ref doesn't contain a map

19:55 ideally_world: (ref {}) ??!

19:55 * ideally_world is feeling REALLY stoopid :(

19:56 technomancy: you must have changed it somewhere else

19:56 ideally_world: I did

19:56 just checked it

19:56 dynamic typing for the bitting in the arse :)

20:00 simard: say I have a list (of symbols) ('KEY_0 'KEY_1 ...) that would actually be members of some class (org.lwjgl.input.Keyboard). Is there a special form to convert that list to a list of member access like this: (org.lwjgl.input.Keyboard/KEY_0 org.lwjgl.input.Keyboard/KEY_1 ...) ?

20:13 org.lwjgl.input.Keyboard/KEY_0 is 11, (resolve (symbol (str "org.lwjgl.input.Keyboard/" "KEY_0"))) is nil, why ?

20:14 amalloy: because that's not a var

20:14 and resolve looks up vars

20:14 simard: is there a way to do "what I want" then ?

20:15 amalloy: reflection

20:16 $javadoc Class getFields

20:16 lazybot: http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getFields()

20:16 simard: aw. emacs macro it will be.

20:38 muhoo: i am totally baffled by #'

20:41 hmm ##(let [foo "bar"] (class #'foo))

20:41 lazybot: java.lang.RuntimeException: Unable to resolve var: foo in this context

20:42 muhoo: &(let [foo "bar"] (class foo))

20:42 lazybot: ⇒ java.lang.String

20:42 muhoo: &(let [foo "bar"] (class #'foo))

20:42 lazybot: java.lang.RuntimeException: Unable to resolve var: foo in this context

20:42 ibdknox: ,(doc var)

20:42 muhoo: well on mine it says clojure.lang.Var, so i guess that's what it is

20:42 clojurebot: Excuse me?

20:42 Raynes: A name created by let is not a var.

20:42 muhoo: ah

20:43 well, my repl says it is :-)

20:43 Raynes: Your repl is incorrect.

20:43 amalloy: muhoo: you have a global def named foo

20:43 Raynes: Indeed.

20:43 muhoo: ah

20:43 ataggart: Anyone know of a straight-forward way to have a defrecord class so that it's available to java code?

20:43 muhoo: right

20:47 oic, it looks like it's a reference basically.

21:03 simard: how would I create a new map by exchanging keys and values of a map ? (assume the map is bijective)

21:04 I have this.. (apply hash-map (flatten (map list (vals keymap) (keys keymap))))

21:04 muhoo: in server.clj in noir, why this "force runtime resolution of jetty"?

21:05 why is it necessary to force it? it's required above that, and why wouldn't calling it with ring.adapter.jetty/run-jetty work?

21:05 ibdknox: muhoo: so that it can be excluded

21:06 muhoo: some people don't want to bring down the jetty dependency

21:07 muhoo: oh, for the compiler not to puke on it, got it, thanks

21:07 if the compiler ain't happy, ain't nobody happy.

21:08 thanks. noir is awesome, btw.

21:11 ibdknox: :)

21:12 gfredericks: simard: (zipmap (vals keymap) (keys keymap))

21:13 ((comp (partial apply zipmap) (juxt vals keys)) keymap) also of course

21:14 simard: zipmap.. I had been looking at zip/ instead :S

21:14 thank you

21:16 Frozenlock: Is wrap-multipart-params required to upload a file using Noir?

21:17 I'm using this as the sending page:

21:17 (defpage "/file" []

21:17 (common/site-layout

21:17 (form-to [:post "/file"]

21:17 (file-upload "file")

21:17 (submit-button "Send file"))))

21:17

21:17 But I'm a little confused by how my POST page is supposed to be...

21:22 ibdknox: Frozenlock: it'll be just like all your other posts :)

21:23 there will just be a key with the file information in it

21:23 in the params

21:24 Frozenlock: I have this so far:

21:24 (defpage [:post "/file"] {file :file}

21:24 (let [filename (upload-file file)]

21:24 (common/site-layout

21:24 [:p (str "File " filename" added!")])))

21:24 ibdknox: Frozenlock: you should use gists instead of pasting in here :)

21:25 johnkpaul: is there more to getting leinigen to use clojure 1.3.0 instead of 1.2.1 than just changing the dpendency in project.clj?

21:25 ibdknox: Frozenlock: that looks fine

21:25 Frozenlock: I don't know what upload-file does

21:25 johnkpaul: I keep getting an error with lein-cljsbuild that is supposed to be solved by using clojure 1.3.0

21:25 Frozenlock: Oh? So it's my upload-file function the problem...

21:25 johnkpaul: but the project.clj file has :dependencies [[org.clojure/clojure "1.3.0"]

21:26 ibdknox: Frozenlock: well a simple test would be to do {:as params} and (println params)

21:26 Frozenlock: ah

21:26 Frozenlock: nm, you didn't set the enc type on your form

21:26 Frozenlock: :enctype "multipart/form-data" ?

21:26 ibdknox: Frozenlock: http://stackoverflow.com/questions/1695246/why-file-upload-didnt-work-without-enctype

21:26 yep

21:27 (form-to {:enctype ...} [:post "/file"] ...)

21:27 Frozenlock: Yeah I had it in my old compojure model, but didn't know how to add it in the new form-to.

21:27 Oh!

21:27 Thanks!

21:28 ibdknox: all hiccup functions can take a map of attributes as the first args :)

21:28 * Frozenlock returns in his dark, hum, noir hole

21:28 Frozenlock: It makes sense... I was finding them quite limiting :P

21:31 ibdknox: Worked!

21:31 Thank you very much for this (and noir) :D

21:31 ibdknox: np

21:39 amalloy: simard: (into {} (for [[k v] m] [v k]))

21:45 gfredericks: amalloy: mine's shorter and syntactically simpler

21:46 simard: but is amalloy's one more efficient ?

21:46 or are they equivalent ?

21:46 gfredericks: I can't imagine why but it will probably turn out to be so just because I'm being arrogant

21:46 amalloy: syntactically simpler?

21:46 gfredericks: amalloy: nodes in parse tree

21:47 amalloy: i guess so

21:47 gfredericks: or (comp length flatten)

21:47 which I guess is the same thing

21:47 amalloy: i'm sure gfredericks's is faster, but who on earth would worry about that

21:48 i prefer the for version because it's trivial to adapt for "oh and i need to make some changes to the keys or values too", whereas the zipmap only really works for specifically this case

21:48 gfredericks: well one could conceivable be assymptotically faster, which is worth worrying about; but obviously not the case here

22:04 amalloy: assymptotically? this sounds like the symptoms of some ass disease

22:06 gfredericks: we'd better hope it is

22:15 johnkpaul: I am experiencing this issue in lein-cljsbuild - https://github.com/emezeske/lein-cljsbuild/issues/53

22:16 it explains that the issue is with having the incorrect version of clojurescript

22:16 but I'm confused about how that should be resolved in the project.clj file

22:17 sorry, clojure* not clojurescript

22:20 oakwise: johnkpaul: what does your :dependencies in project.clj look like?

22:20 johnkpaul: oakwise: http://pastebin.com/aCwptEX7

22:20 portion that I think is relevant...

22:20 :dependencies [[org.clojure/clojure "1.3.0"]

22:21 oakwise: do you get the error for every task or just certain ones?

22:21 what about just `lein cljsbuild` with no subtask?

22:22 johnkpaul: hm, so that just gives me a list of subtasks

22:22 but what I was trying to run was lein ring server-headless 3000

22:23 oakwise: johnkpaul: sounds like it's a lein-ring issue then, no?

22:24 johnkpaul: hm, potentially, to be honest, I don't really know

22:24 oakwise: and it looks like lein-ring 0.5.4 uses 1.2.1: https://github.com/weavejester/lein-ring/blob/0.5.4/project.clj

22:24 johnkpaul: oh

22:25 weavejester: That doesn't matter too much. Lein-ring is compatible with 1.2 and 1.3

22:25 johnkpaul: can you have a project split between two versions?

22:25 oh ok

22:25 so the reason that I think that it's cljsbuild is because that's what I'm trying to setup now

22:25 weavejester: But you should be using lein-ring 0.6 or above with Lein 1.7+

22:25 johnkpaul: I'm attempting to run their example project

22:25 oh, let me try that

22:25 weavejester: If you can use :plugins you shouldn't be using :dev-dependencies

22:26 Try adding in a :plugin for [lein-ring "0.6.2"]

22:26 johnkpaul: ok

22:27 :/ same error

22:27 after downloading ne wclojars

22:27 new clojars*

22:29 oakwise: can you paste the full traceback somewhere? or is it exactly the same as that cljsbuild one that you linked?

22:29 weavejester: What's the error?

22:29 johnkpaul: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args (3) passed to: cljsbuild$run-compiler (NO_SOURCE_FILE:0)

22:29 oakwise: I'll paste it, it's exactly the same except for the line numbers

22:29 weavejester: Oh, that's a cljsbuild problem then

22:30 johnkpaul: http://pastebin.com/5KiTxPaE

22:31 weavejester: yeah, probably. I am attempting to run the example lein-cljsbuild application

22:31 but they have an issue about this..

22:31 https://github.com/emezeske/lein-cljsbuild/issues/53

22:31 oakwise: hm that tracebook looks different

22:31 johnkpaul: that says "just use clojure 1.3.0"

22:32 oh really?

22:32 oh

22:32 it is

22:32 :/ that was not the case

22:33 or maybe I wasn't paying enough attention, but I think it changed after I removed dev-dependncies

22:33 weavejester: I wonder if the lein-cljsbuild plugin is injecting the wrong version of cljsbuild

22:34 johnkpaul: hm, I don' tknow

22:35 oakwise: you deleted the project.clj?

22:35 weavejester: johnkpaul: Which version are you using?

22:35 johnkpaul: weavejester: of cljsbuild? I have the master branch of the git repo and project.clj says 0.1.4

22:35 oakwise: you mean the original one? no, I dind't

22:36 I just removed the dev dependencies line and added [lein-ring "0.6.2"] to the plugin lst

22:36 list*

22:36 weavejester: johnkpaul: Try clearing the cljsbuild and lein-cljsbuild folders in ~/.m2/repository/

22:37 simard: can a clojure function return Void ? (I'm exporting static functions from a class generated with gen-class)

22:37 ie.. not return the last form

22:37 johnkpaul: weavejester: ok, trying that now

22:38 weavejester: same problem

22:38 weavejester: Hmm...

22:38 try 0.1.3?

22:38 oakwise: weavejester: johnkpaul: looks like a legit bug with the compile hook

22:39 johnkpaul: oh really? are you able to reproduce this oakwise?

22:39 weavejester: 0.1.3 causes the same error

22:40 oakwise: https://github.com/emezeske/lein-cljsbuild/commit/65a074facf98f235fe6305573a4b7d5f07420e18 changed the signature of run-compiler but didn't change the reference in compile-hook

22:41 johnkpaul: 0.1.3 should work? try cleaning project/libs, ~/.m2, and project/.lein*?

22:42 johnkpaul: oh ok, trying now

22:43 solussd_: could anyone tell me how to get the base-url in a Noir website?

22:43 ibdknox: noir.request/ring-request

22:44 johnkpaul: hm, now iffernt error oakwise

22:44 Exception in thread "main" java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to clojure.lang.IPersistentMap (NO_SOURCE_FILE:0)

22:44 oakwise: johnkpaul: I see the same issue. looking...

22:44 johnkpaul: anyway, I need to close my eyes, I've been trying to get this to work for too long

22:44 thank you so much for your help oakwise and weavejester

22:44 I'll be back

22:44 oakwise: johnkpaul: I'll file the bug or patch if I can track it down

22:44 johnkpaul: ok great, thank you again

22:45 solussd_: ibdknox: I'm building a restful webservice and I have a 'links' entity that contains an 'href' keyval that should reference the absolute path for the linked resource… can't use the ring-request at that point in the code

22:47 ibdknox: solussd_: not sure I understand

22:47 solussd_: guess that doesn't make sense, I either hard-code it, or I look in the request.

22:47 nevermind, I'm being dumb. :)

22:47 ibdknox: haha :)

22:47 solussd_: love Noir, btw, thanks!

22:48 ibdknox: :)

22:55 muhoo: wow that's freaky. if i pass a function or a reference to a function, they seem equivalent

22:57 like this: https://refheap.com/paste/1600

22:57 y dat?

22:58 ibdknox: ,#'str

22:58 clojurebot: #'clojure.core/str

22:58 ibdknox: ,(#'str "foo")

22:58 clojurebot: "foo"

22:59 muhoo: right, bit if i pass a referecne to the STRING in, it doesn't work

22:59 but if i pass a reference to a function that returns something, then it does

22:59 ibdknox: hm?

23:00 invoking a var invokes it as a function

23:00 Frozenlock: You are evaluating the function: (x)

23:00 ibdknox: strings aren't functions

23:00 ,("woot")

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

23:00 muhoo: ok, so references work differently on functions than on other data types

23:00 that's what surprised me

23:01 vars, i should use the proper terms

23:01 ibdknox: they don't work differently, they're still being invoked like other things :) It's just that invoke for them means deref

23:01 and then invoke

23:01 ,#'str

23:01 clojurebot: #'clojure.core/str

23:01 ibdknox: ,@#'str

23:01 clojurebot: #<core$str clojure.core$str@1c6f8a9>

23:01 ibdknox: ,(@#'str "foo")

23:01 clojurebot: "foo"

23:01 * muhoo needs to study more

23:02 autodidakto: amalloy: wakeful have a githubs?

23:02 muhoo: that's a great example, thanks

23:02 ibdknox: autodidakto: https://github.com/flatland/wakeful

23:03 solussd_: ibdknox: how do you grab querystring args in a defpage?

23:03 ibdknox: solussd_: same as any args, they all go into the params thing

23:03 autodidakto: ibdknox: thanks :)

23:03 ibdknox: that you destructure

23:03 solussd_: ibdknox: excellent

23:06 autodidakto: ibdknox: I saw a recent blog post/example of a one page noir/client side cljs app, and they used slurp to get the html template...

23:07 I'll find the code... but my question is, What is the best practice for using .html files in your views?

23:07 ibdknox: autodidakto: depends, are they just static?

23:07 if they are, you shouldn't have jetty serve them at all, let nginx do its magic :)

23:08 but just for locally, slurping on startup is ok

23:08 autodidakto: ibdknox: no not static. as a layout or partial

23:08 ibdknox: \oh

23:08 huh?

23:08 for something like mustache?

23:09 I meant static as in are you modifying the html at all, or is it just getting slurped and sent over the wire?

23:09 autodidakto: ibdknox: I guess my question isn't well thought out. If I do everything in hiccup, it's not a prob...

23:09 ibdknox: yeah :)

23:09 autodidakto: but what if I have html files already ready to go, by a designer, or previously done...

23:09 ibdknox: you can actually use stencil to handle this too

23:10 autodidakto: in the blog post, they slurp and send it, then use cljs and your client side tools to modify the dom

23:10 ibdknox: right

23:10 that's reasonabl-ish

23:10 you would want to cache it first

23:11 though honestly, there's likely to be so little markup there I'm not sure why you wouldn't just do it with hiccup

23:11 but slurping it at load time and then serving it from there is fine

23:11 stencil will cache the asts and such that it generates, in that case the ast would be just a giant text node, but it would also accomplish the same thing

23:11 autodidakto: the code is here -> https://github.com/eakron/wishlistd ... still looking for the blog post where they talk about it. it was a 'learning noir' kind of post..

23:12 ibdknox: I haven't checked out stencil yet. I'll do that now

23:12 muhoo: so it seems like invoking a function is an implicit deref?

23:13 autodidakto: ah here we go -> http://variadic.me/posts/2012-03-29-building-wishlisted.html

23:13 muhoo: hmm, an implicit OPTIONAL deref. because it doesn't try to deref something if it isn't a var

23:13 ibdknox: muhoo: no, think of it in terms of polymorphism, vars have their own implementation of invoke

23:14 and that implementation says deref me and then call invoke on that

23:14 functions don't need to be deref'd

23:14 they're directly invokable

23:14 muhoo: ok, thanks, that makes more sense.

23:15 all of this , for me to understand why (run-jetty #'greeting-handler ...) works

23:15 ibdknox: autodidakto: it's reasonable to do that, I would just do (def layout (slurp ...)) instead of (defn ..) because it's not going to change

23:15 autodidakto: in the post, they get hung up on the routes/views issue, but essentially, the site is one route that calls -> (slurp "resources/public/index.html")

23:15 ibdknox: autodidakto: mhm

23:15 autodidakto: I do something similar in my overtone controller example, though with hiccup

23:16 autodidakto: similar? as in slurp? or one page? or?

23:16 ibdknox: one page

23:17 autodidakto: And uses remotes? I'm trying to get my head around where everything fits in. that is, remotes, jaqy, client-side cljs, pinot, etc

23:18 ibdknox: autodidakto: http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/

23:18 autodidakto: i'll check it out

23:18 ibdknox: adding the middleware for fetch is now unnecessary

23:18 but the rest is accurate

23:19 Frozenlock: Is there pre-made functions to print to file?

23:20 ibdknox: ,(doc spit)

23:20 clojurebot: "([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."

23:22 Frozenlock: Thanks :)

23:24 autodidakto: ,(doc slurp)

23:24 clojurebot: "([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments."

23:24 muhoo: i do love the clojure way of doing web dev stuff, it's very unix-y: lots of little libraries and programs stitched together flexibly.

23:24 autodidakto: I'm afraid to lookup the history behind those functional names

23:25 muhoo: it's got a steeper learning curve though

23:25 Frozenlock: autodidakto: I must admit I would have never found it with my 'save' 'print' 'export' searched. Spit and slurp is.. somehow unique :P

23:25 *searches

23:26 autodidakto: muhoo: one way to look at the learning curve is that there is more to learn upfront. You can't get as far in 5 minutes by editting a generated files...

23:26 muhoo: Frozenlock: spit/slurp is funky, but it could be worse, could be ruby, and you'd be dealing with libraries with names like "texticle"

23:27 autodidakto: oh, i'm very comfortable wiht this. been a linux guy for a long time

23:27 autodidakto: muhoo: lol, texticle, that's not a far analogy hehe

23:27 muhoo: so i'm fine with up-front investment to save pain later

23:28 autodidakto: muhoo: i agreed. in the end, you gotta learn everything to do nontrivial stuff... and this way you can build the system you want without making tough choices between monolithic frameworks

23:29 Frozenlock: my guess is that it's a long-standing lisp thing..

23:30 muhoo: no, i think spit/slurp is an rhickey-ism

23:30 i don't remember seeing it in other lisps

23:30 Frozenlock: with-open is lipsy, but spit... ?

23:31 muhoo: i still think it should have been spit and swallow, but that'd have been too over-the-top

23:31 as it is, it's kinda on the edge a bit.

23:31 Frozenlock: No, once you spitted, you must slurp. :P

23:33 Now that I've saved a map into a file, how can I -read- it back? I've tried (read (slurp "test.txt")) but it throws an error. In addition, is there a safe way to read back data?

23:33 autodidakto: Frozenlock: a map? are you trying to serialize data to a file?

23:33 Frozenlock: Yes.

23:34 autodidakto: Frozenlock: I'm new to clojure, so I can't speak of best practices... but have you considered yaml?

23:35 https://github.com/lancepantz/clj-yaml

23:36 muhoo: the fundamental concept/question is, Where is the natural home or center of that which is slurped/spat... The stomach or the mouth?

23:36 tomoj: Raynes: is refheap.el really not usable?

23:36 Frozenlock: What would be the advantage over clojure's maps?

23:36 tomoj: I mean, who's the general public? :)

23:36 xeqi: Frozenlock: try read-string

23:37 autodidakto: Frozenlock: Serialization is putting your datastructures in a file to save them, and reading them back in later. Yaml lets you do that cleanly..

23:37 ,(doc read-string)

23:37 clojurebot: "([s]); Reads one object from the string s"

23:37 amalloy: muhoo: paredit uses slurp/barf

23:37 autodidakto: If it's quick and dirty, you might not need it. up to you

23:37 amalloy: paredit-forward-slurp-sexp, etc

23:38 Frozenlock: xeqi: worked! thanks :)

23:38 autodidakto: amalloy: slurp -> outside world to your stomach. barf -> stomach to outside world. I like the symmetry

23:38 Frozenlock: autodidakto: So it would protect from arbitrary code hidden in a file?

23:38 amalloy: whutttt. slurp is clearly a mouth-ism. you slurp soup with your lips, not your esophogas

23:39 autodidakto: Frozenlock: right. The file itself is secondary, an implementation detail

23:39 amalloy: wow, that's a word that i just realized i can't spell at all. the vowels are all total guesses

23:39 autodidakto: amalloy: i think there's a u somewhere in there. English is consonant-centric anyway :)

23:40 Frozenlock: amalloy: M-$ --> esophagus

23:40 I would be sooooo worse without Emacs :p

23:41 xeqi: Frozenlock: as far as doing it safely you might check out clojail

23:41 not sure if it is applicable here though

23:41 amalloy: M-$? i rebound that one cause i never use whatever the default is. spell check, i guess?

23:42 Frozenlock: Yup!

23:43 xeqi: I just tested read-string on a function and it didn't seem to evaluate it. Unless I use an eval on it, am I safe?

23:43 clojail: A control freak's best friend. -- Love the description

23:43 autodidakto: Frozenlock: where are you files coming from?

23:43 ,(doc sandbox)

23:43 clojurebot: Cool story bro.

23:44 autodidakto: &(doc sandbox)

23:44 lazybot: java.lang.RuntimeException: Unable to resolve var: sandbox in this context

23:44 Frozenlock: My own machine, but eventually it could come from anywhere.

23:44 xeqi: hmm, I would think so

23:44 but this is out of my knowledge area

23:45 &(read-string "{:x (#(+ 1 2))}")

23:45 lazybot: ⇒ {:x ((fn* [] (+ 1 2)))}

23:45 autodidakto: My assumption is that if you're going to eval code from unknown sources, don't assume safety

23:46 Frozenlock: I don't eval, I simply read.

23:47 Worse case scenario I suppose my functions could choke on malformed maps.

23:47 autodidakto: &(read-string "((fn [num] (str num)) 42)")

23:47 ibdknox: malformed maps will throw exceptions

23:47 lazybot: ⇒ ((fn [num] (str num)) 42)

23:47 ibdknox: the only bad thing that can happen during reading is reader macros

23:47 which is easy enough to stop

23:47 Frozenlock: ibdknox: Yes, I should make sure I put some try/catch in there.

23:47 ibdknox: (binding [*read-eval* false] (read-string ...))

23:48 oakwise: johnkpaul-afk: someone posted the same issue here https://github.com/emezeske/lein-cljsbuild/issues/68 and I submitted a fix. Hopefully it gets merged soon.

23:48 xeqi: ohh, I forgot about those

23:48 Frozenlock: ,readier-macro

23:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: readier-macro in this context, compiling:(NO_SOURCE_PATH:0)>

23:48 xeqi: think lazybot stops them

23:48 Frozenlock: ,reader-marcro

23:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reader-marcro in this context, compiling:(NO_SOURCE_PATH:0)>

23:48 Frozenlock: GOD

23:48 ibdknox: https://github.com/ibdknox/fetch/blob/master/src/noir/fetch/remotes.clj#L12

23:48 xeqi: &(read-string "{:x #=(+ 1 2)}")

23:48 lazybot: java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.

23:48 autodidakto: ,(doc *read-eval*)

23:48 clojurebot: "; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true"

23:49 Frozenlock: I can't write, I won't even try ....

23:50 * Frozenlock copy the codes

23:51 autodidakto: &(eval 42)

23:51 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

23:52 autodidakto: &(eval (read-string "((fn [num] num) 42)"))

23:52 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

23:59 autodidakto: ibdknox: what do you think of the ClojureScript One project?

Logging service provided by n01se.net