#clojure log - Jan 25 2014

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

0:02 akurilin: technomancy: Fair enough, this sounds "good enough" for the vast majority of cases.

0:03 technomancy: I would like to move everything in the test task into a lib though

0:04 akurilin: technomancy: Any tips on reloading the app's code as you test it from a test ns? Do you just require reload?

0:05 technomancy: akurilin: I use cider

0:08 akurilin: technomancy: I see, I guess as a vim user I'm not invited to that party.

0:08 :P

0:08 technomancy: eh, fireplace should work fine

0:08 just recompile after every edit you do

0:09 akurilin: I see, so it sounds like you don't spin up a secondary repl just for the tests, right? You do everything through nrepl

0:09 I tend to nrepl into the running ring app from fireplace, and I thought it was better to have a separate repl for UTs, to minimize corruption

0:10 technomancy: hm; I wouldn't worry about that

0:10 akurilin: But I can certainly see the one less step if you already reload everything in nrepl.

0:10 technomancy: I don't think it's worth having two; just make a second fresh pass over your full suite before merging

0:11 akurilin: Fair enough, I'll try that, simple is better. Do you do Sierra's flow btw, or do you not bother?

0:12 technomancy: I haven't tried it

0:12 don't really see the appeal

0:13 akurilin: Fair enough, good to know.

0:21 JacobGood1: When I use clojure.repl/source on a function that I have redifined through the repl, it returns nothing... is there a way around this?

0:21 technomancy: JacobGood1: no, clojure.repl/source is kind of a hack

0:21 try running it on itself to see what I mean

0:22 JacobGood1: well is there anything like it that i could use to reread the source of a redifined fn?

0:23 technomancy: no, it's gone forever

0:23 koreth_: Any good ideas for learning how to shift my thinking to FP? I think I have a decent handle on Clojure syntax and am able to think in functional style for small-scale stuff (using map or reduce instead of looping, etc.) but when I start thinking about how to structure a larger application, what pops into my head are things like DAOs and service provider objects rather than whatever the idiomatic approaches would be in Clojure.

0:23 technomancy: unless you used https://github.com/technomancy/serializable-fn

0:24 JacobGood1: ok i will give that a shot thanks techno

0:25 technomancy: JacobGood1: I don't know that I'm recommending that as a practical thing

0:25 just that it's what you'd need to do if you wanted to get what you're asking

0:28 JacobGood1: oh, well I am trying something impractical anyway

0:28 technomancy: don't let me stop you

0:31 Raynes: technomancy: https://www.dropbox.com/s/x1tqocwdn0l7ter/Photo%20Jan%2024%2C%209%2023%2047%20AM.jpg Triscreen yo :3

0:31 technomancy: Das Respect

0:34 seangrove: Damnit, how can I get korma not to print out this exception? https://github.com/korma/Korma/blob/master/src/korma/db.clj#L221

0:34 I don't often want CL's restarts, but wouldn't mind it here

0:34 technomancy: Raynes: wait, does your das have labeled keycaps??

0:34 lazybot: technomancy: Definitely not.

0:35 seangrove: It's printing out a sql statement that completely fucks the terminal

0:35 This is the repl prompt after the error is thrown:

0:35 C┌⎺⎽☃┼± c⎺┼┼ec├☃⎺┼:

0:35 tomjack``: I want to stop defining things at the repl

0:35 technomancy: I thought all Dases were otaku-style

0:35 tomjack``: it's a little late for a new years resolution ,but whatever

0:35 seangrove: That's supposed to be zensight.support.repl-work:

0:35 Raynes: technomancy: Yes, and I'm getting another one with labeled caps as well.

0:36 tomjack``: or, I guess I want the repl to do something different

0:36 Raynes: technomancy: Lance polled my desk neighbors and my keys are too loud. Gotta switch to cherry reds. :p

0:36 technomancy: Raynes: noooo =(

0:36 Raynes: Gotta do what you gotta do m8

0:36 technomancy: I have reds in my shift keys

0:36 seangrove: Do I have to alter-root-var and redefine handle-exception in korma to stop it from spewing stuff out?

0:36 technomancy: they're fine for modifiers, but I wouldn't want to type on them all day

0:36 tomjack``: surely someone's built an nrepl plugin that records everything I eval somewhere

0:36 seangrove: There's no hook otherwise to control the behavior...

0:37 technomancy: Raynes: have you looked into o-rings?

0:37 Raynes: I haven't

0:37 technomancy: supposedly they damp the sound without sacrificing much of the tactile feel

0:38 Raynes: also: unless you're going to be doing a lot of gaming you should consider clears over reds

0:38 Raynes: technomancy: Das comes in browns, blues, and reds.

0:38 Browns would probably have still been too loud, and reds seem less bad than you claim :p

0:38 technomancy: oh.

0:39 Raynes: I probably would have went with clears.

0:39 seangrove: Also, what causes the shell to freak out like that - is it something being printed out that triggers a control character and sets the shell into bizarro-mode?

0:39 Raynes: But I really like das keyboards.

0:39 technomancy: I have browns in my keyboard too, for the non-modifier pinkies

0:39 they're not any louder than reds

0:39 scottj: Raynes: I'm not sure if browns are quieter, but since they're not as high pitched I find them much less annoying

0:39 technomancy: they're a lot quieter than blues

0:40 Raynes: Anyways, I think reds are still probably better than using a stock apple keyboard, and I'm not paying for it so...

0:40 :p

0:40 And the order is already out/

0:40 JacobGood1: Is there a way to make a clojure function work across all namespaces without having to type require everywhere?

0:41 technomancy: oh, sure. yeah, definitely better than giving up on das for sure

0:41 Raynes: Thankfully not really.

0:41 technomancy: JacobGood1: typically you want editor support for that

0:41 doing it inside the namespaces themselves would be a mess

0:41 ivan: never ever buy blue switches unless you like 70 dB clicking noises

0:41 Raynes: I do.

0:41 technomancy: ivan: who does'nt though?

0:42 ivan: they're high-pitched noises that raise my blood pressure, not satisfying clicks (to me, anyway)

0:42 scottj: technomancy: I can't stand the sound of blues

0:42 Raynes: technomancy: Also, this means I get to take my das home now.

0:42 :D

0:42 ivan: you can also make it activate without a click, which is kind of insulting :)

0:42 technomancy: Raynes: I predict an increase in work-from-home days for you

0:43 Raynes: I cause small earthquakes with each das keystroke, ivan.

0:44 * technomancy tries that

0:44 technomancy: is there a trick to it?

0:44 Raynes: Write Python.

0:44 technomancy: no, getting it to activate without a click

0:44 I can't get mine to od it

0:44 ivan: just hover right below the activation threshold

0:45 it worked on my quickfire pro

0:45 get it to click, then go up as little as possible

0:45 Raynes: I can definitely activate mine without clicking

0:46 kristof: Pretty soon you all are going to talk about WASD keyboards

0:46 technomancy: oh yeah, if you activate and then bring it back up; I see

0:46 Raynes: Presumably we'll talk about Clojure again one day.

0:46 kristof: Clojure? Nothing to see there :P

0:46 technomancy: not exactly something that could happen on accident

0:47 dsrx: oh, keyboard chat?

0:47 kristof: no, that's #clojure-keyboard

0:47 dsrx: the perfect time for me to be smug about my topre keyboard

0:47 scottj: btw realforce 87u 45g topre on sale right now for $199

0:47 ivan: has your topre spacebar ground your thumb to the bone yet?

0:48 technomancy: I was hacking in the library the other day; first time I've felt somewhat bad about my clicky level

0:48 dsrx: scottj: hmmm not in white/gray though

0:48 technomancy: but it was right next to the coffee shop in the seattle public library, so I don't think anyone got too worked up

0:48 scottj: dsrx: my arms are too hairy for white :)

0:49 dsrx: haha

1:01 cnl: if i use defrecord or deftype to create nodes for my tree would I expect them to take less space or more then if I use maps? I ended up writing a thing like {child1: '(value {2ndlevelchild: ...})} but its taking massive (gb) space with my data set

1:02 technomancy: cnl: yeah, records take up less memory

1:03 however, if it's possible to express things lazily, that's usually a better way of consuming less memory

1:04 cnl: well, im indexing names from a file (line per article name) and i want fast lookups, ended up with https://www.refheap.com/27168 (I am new yet so not very good)

1:04 so i probably have to load them all into memory

1:04 akurilin: technomancy: made a post on the mailing list to poll the community a little bit about people's UTing flow habits, curious to see what folks say.

1:04 included the flow you recommended in there.

1:05 technomancy: cnl: at first glance: use swap! instead of reset

1:05 cnl: or better yet, use reduce instead of an atom

1:06 cnl: i tried that initially but was having problems calling reduce on the line-seq, ended up with stack overflows

1:06 although i might of just been doing somthing stupid

1:07 technomancy: cnl: reduce is conceptually similar to doseq changing an atom every time

1:08 akurilin: my talk proposal to clojurewest is kind of about writing tools like that in a cross-editor way

1:08 http://p.hagelb.org/clojurewest-2014.org.html

1:08 so if it gets accepted I'll probably polish off that lib some more

1:29 akurilin: technomancy: sounds like a very worthwhile goal

1:31 technomancy: the holy grail for clojure would be what the old scheme / CL farts always talk about when they say they used to have some of the most advanced and convenient step-through debuggers of the time with all sorts of ways of exploring the context.

1:31 I'm personally ok with something like Chrometools for Clojure

1:31 technomancy: CL-level interactivity will probably never be feasible on the JVM

1:32 but we can sure do a lot better than what we have now

1:34 cnl: so i end up with stack overflows if I use reduce (https://www.refheap.com/27173)

1:35 ahh, for a different reason though

1:36 dsrx: funny how when we end up with stack overflows, that's also where we end up ;)

1:39 akurilin: zing!

2:41 quizdr: A little trip to the grocery store brought to my attention a most fascinating revelation about clojure.

2:46 xuser: quizdr: are you going to tell us? :)

2:50 quizdr: yes i am

2:51 please allow 30 seconds for completion

2:51 so, the revelation and answer to a common question, "Clojure is awesome, but what happens if I combine Clojure with Clojure itself?" And the answer is... that it is always fluffy and pure.

2:51 https://www.dropbox.com/s/a5gbhhtpqg0hra3/Clojure%20Times%20Two.jpg

3:31 koreth_: Is there a non-hacky way to create a var at the root level whose name is dynamically computed? My naive attempt using (def (make-the-name) ...) just gives me a "PersistentList cannot be cast to Named" error. This isn't for anything serious, just a programming puzzle whose test case wants zillions of near-identical helper functions and I am too lazy to type them all out by hand.

3:32 fredyr: koreth_: yes i think so

3:32 koreth_: (And yes, make-the-name returns a Symbol, not a string)

3:32 fredyr: koreth_: https://github.com/swannodette/om/blob/master/src/om/dom.clj

3:32 koreth_: here's an example

3:32 koreth_: Sweet, thanks.

3:37 rurumate_: is there something like doseq-indexed?

3:38 because I'm tired of creating let-scoped atoms for counting line numbers

3:38 fredyr: hmm i think ive seen something like that

3:39 ,(doc map-indexed)

3:39 clojurebot: "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."

3:39 fredyr: not really the same

3:39 rurumate_: almost but map is not quite the same as doseq

3:40 fredyr: apparently there was an indexed in contrib

3:40 https://gist.github.com/halgari/4136116

3:41 rurumate_: splendid

3:44 I would prefer it like this: https://www.refheap.com/27189

3:47 michaniskin: (def indexed (partial map-indexed vector))

3:48 i use that all the time

3:49 rurumate_: cool michanis

3:49 that's even more concise

3:49 Bracki: Very dumb question. I do a 'lein new default some-stuff'. In src/some_stuff/core.clj I find a (def foo...). How do I execute this in the repl?

3:50 lein repl always tells me about CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context

3:50 logic_prog: holy shit lighttable is awesome; I do have one concern now: how will light table make $ / ensure future development of light table?

3:50 Bracki: So what exactly do I need to type once i started the repl?

3:53 Hm, so when do I use - or _?

3:53 Or what's the reason that the directory leiningen contains _ instead of an -, yet the namespace is still with a -?

3:54 michaniskin: Bracki: did you do (require 'some-stuff.core) first?

3:54 quizdr: logic_prog what have you used before trying lighttable?

3:54 michaniskin: Bracki: the _ is because java

3:54 Bracki: michaniskin: no I tried some_stuff first

3:54 logic_prog: quizdr: emacs

3:55 hmm, and the instarepl is broken

3:55 michaniskin: Bracki: i mean, when you get a repl do: (require 'some-stuff.core) and then (in-ns 'some-stuff.core)

3:56 Bracki: then you should be able to evaluate (foo) or whatever

3:56 quizdr: logic_prog you like it more than emacs?

3:56 logic_prog: quizdr: it's programmable in clojure rather than, say elisp

3:56 quizdr: i tried it and found various things rough around the edges. it's beautiful but not very functional for me at this point after using emacs

3:57 logic_prog: yeah, it's slightly rough around the edgers for me too

3:57 i.e. the instarepl is broken

3:57 quizdr: i had a number of problems

3:57 logic_prog: however, I thikn it's the future

3:58 quizdr: i agree it has potential

3:58 i also think justin bieber has a lot of potential but he needs to be careful first

3:59 auser: hello all

4:00 fredyr: ello!

4:01 quizdr: auser, allow me to join fredyr and wishing you a bon jolly hello, good sir or madame

4:01 auser: I'm a bit newish to clojure... I feel like I'm struggling a bit with a relatively trivial problem

4:01 quizdr: join the club

4:01 fredyr: auser: don't be shy!

4:01 auser: I am reading a bunch of files in a directory and want to grab a sequence of all the words in the file

4:02 rather, a list of them

4:02 I'm recursively walking a directory and able to get the lines in the file, but not split into words

4:03 I feel like that can't be that difficult to do

4:03 quizdr: if you can post a gist of what you have (using github gist or refheap.com) it might be easier to assist

4:03 auser: I'll do it!

4:04 https://www.refheap.com/d6a107cf9426ecdd15ea6bed6

4:04 so basically I want to open each file in each directory and pull out the words in each file

4:05 fredyr: auser: if you want you can read files even more easily with slurp

4:06 ,(doc slurp)

4:06 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."

4:06 auser: interesting

4:06 doesn't that load the entire file into memory tho

4:06 fredyr: it does?

4:07 it returns the entire file as a string

4:07 auser: the files are variable in size, so that could be reading a huge file

4:07 fredyr: sure

4:07 auser: okay, so I might be able to simplify it with slurp, true

4:08 fredyr: so you need to decide on the use case if it is suitable

4:08 auser: totally

4:08 fredyr: i'm just suggesting alternatives

4:08 clojure.string/split seems fine to get the words also

4:08 auser: sure, so that's not complete, btw

4:08 still trying to split the lines into words

4:09 fredyr: auser: where is it that you run into trouble

4:09 auser: a few places

4:09 well... two

4:09 so

4:09 in the index-file function, I want to get a list of all the words in the file, which is why I started to use reduce

4:09 fredyr: (clojure.string/split (slurp "/Users/fredyr/afile.txt") #"\s") gets me there :)

4:09 auser: in some cases, I get nil

4:10 oh

4:10 really?

4:10 fredyr: yeah

4:10 quizdr: (inc fredyr)

4:10 lazybot: ⇒ 3

4:10 fredyr: wee

4:10 quizdr: i'm just getting warmed up mister!

4:11 auser: so I forgot, the actual error right now is: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.CharSequence from line 21

4:11 is that because (doall) is returning a lazy sequence?

4:12 I thought it makes it non-lazy

4:12 fredyr: map is lazy

4:12 auser: which begs the question, why am I using it in the first place

4:12 oh

4:12 michaniskin: doall ensures that it's not returning a lazy seq

4:12 auser: reduce*

4:12 fredyr: ,(doc map)

4:12 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

4:12 auser: got it

4:13 metellus: auser: it's because string/split takes a string, but get-lines gives a seq of strings

4:13 michaniskin: ,(doc doseq)

4:13 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

4:13 michaniskin: (doseq [item coll] (prn item))

4:14 fredyr: auser: are you using some kind of repl when testing?

4:14 auser: I am, cider/nrepl

4:14 quizdr: i would image things are not wise to try doseq on an infinite lazy collection, yeah?

4:16 fredyr: auser: its usually helpful to run and verify the results of each function in the repl

4:16 auser: yah

4:16 good idea

4:17 fredyr: auser: out of curiosity, are you @auser on twitter?

4:24 auser: fredyr: yep

4:24 I am

4:25 fredyr: auser: i recognized it frmo there, youre one of my few followers :)

4:25 auser: oh yeah?

4:25 I am?

4:25 nifty

4:25 fredyr: i'm @lexicallyscoped

4:25 auser: ah cool

4:26 ah there you are

4:26 quizdr: fredyr now you gots even more followers

4:26 fredyr: yay

4:27 quizdr: sweden eh? cold there this time of year? i was in berlin in September. I think I'd enjoy living Europe

4:27 fredyr: the cold actually just got here

4:28 we've had a lousy winter before that

4:28 but now its like -5 and we've got some snow

4:28 quizdr: nice. good times.

4:28 i noticed that while i'm on your site, i can read your content, but as soon as I leave your site, the content is no longer available when I'm on other sites. i think your site must be lexically scoped.

4:29 fredyr: lol

4:29 (inc quizdr)

4:29 lazybot: ⇒ 3

4:29 auser: hah hah haha

4:29 quizdr: yay

4:50 auser: is it possible to get the position in a file that file-seq is currently in?

4:59 fredyr: do you mean like the index or something?

4:59 auser: yeah

4:59 exactly

5:01 fredyr: there was some discussions earlier here on doseq with index

5:02 (def indexed (partial map-indexed vector)) was suggested

5:02 auser: oh interesting

5:02 fredyr: ,(def indexed (partial map-indexed vector))

5:02 clojurebot: #'sandbox/indexed

5:03 fredyr: ,(indexed [1 2 3 4 5 6])

5:03 clojurebot: ([0 1] [1 2] [2 3] [3 4] [4 5] ...)

5:06 auser: perhaps it would help for me to pastie

5:06 I could actually use some help understanding how I'd implement that

5:06 in my specific use-case

5:07 https://www.refheap.com/d6a107cf9426ecdd15ea6bed6

5:07 I want to parse that on line 23, I think

5:09 fredyr, mind taking a quick gander at that real quick?

5:16 oh nm

5:16 docs

5:43 TEttinger: auser, there's also ##(map vector (range) [1 2 3 4 5])

5:43 lazybot: ⇒ ([0 1] [1 2] [2 3] [3 4] [4 5])

5:52 fredyr: auser: sorry time's up -- family calls

5:52 auser: np

5:52 I got it

5:52 enjoy!

5:52 fredyr: ty

5:52 u2

5:52 :D

6:32 quizdr: here's an odd one:

6:33 ,((juxt inc dec) 6)

6:33 clojurebot: [7 5]

6:33 quizdr: well, i guess clojurebot doesn't like that one

6:34 what's odd is that it returns a vector, which is expected, but if you map this across a vector, it instead returns a sequence of functions? i.e. (map #(juxt inc dec %) [1 2 3 4 5])

6:35 ahh it should have been (map #((juxt inc dec) %) [1 2 3 4 5]) forgot to next the juxt

6:36 *nest

6:39 that was a hard one clojurebot eh? i also stared at it for 3 minutes when I first saw it

7:35 voldyman: can someone suggest a library for websocket client?

7:35 (with some documentation)

7:35 AeroNotix: aleph?

7:36 voldyman: AeroNotix: couldn't find the docs for it

8:15 hyPiRion: ,(map (juxt inc dec) [1 2 3 4 5]) ;; quizdr

8:15 clojurebot: ([2 0] [3 1] [4 2] [5 3] [6 4])

8:15 hyPiRion: oh, he left

8:32 coventry: cljs question: I'm trying to install austin in bhauman's dotster game, and I'm getting "JSC_MISSING_PROVIDE_ERROR. required "cemerick.austin.repls" namespace never provided" during compilation. Any suggestions for how I might fix this? The one of the project.clj I've tried is https://www.refheap.com/27258 . I've also tried excluding each of the [com.cemerick/austin "0.1.3"] vectors in there

8:33 Austin's example project compiles just fine for me, but I can't see what the key difference is.

8:37 Never mind, silly mistake.

9:37 scape_: using korma, or probably any jdbc, my mysql connection times out over time-- what's the typical method for keeping this alive?

9:38 otherwise when doing a query, korma barks back with a printed error statement-- not exactly great for a lnng running web app

9:50 rurumate_: scape_: I don't know about korma. In general your connection pool should take care of preventing timeouts

9:50 scape_: korma uses c3p0 and looks like it has a connection pool, but after a while of idle throws an error

9:51 rurumate_: ok, with c3p0 this should not happen. then it's a question of configuring c3p0 correctly

9:51 scape_: oh, interesting ok

9:54 max idle time is 10800, I should do some research on c3p0 :) here's my current connection setup for c3p0 http://pastebin.com/nJdTfD1Z

9:59 rurumate_: scape_: maxConnectionAge is 0, try a positive value like 14400

10:00 also set idleConnectionTestPeriod to 3600 or something

10:02 you can set the preferredTestQuery to something explicit like "select 1" or "select now()", not sure if it matters

10:07 john2x: i'm trying to use Friend, but I can't seem to get my :credential-fn to be called. https://www.refheap.com/create my :login-failure-handler is working correctly, but credential-fn never gets called. (i.e. println doesn't happen)

10:08 what am I missing?

10:16 scape_: rurumate_: ok thanks, i'll try those settings

10:17 AeroNotix: ugh, calling variadic functions?

10:18 quite painful, huh

10:45 how would I make an array of http://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchEvent.Kind.html

10:47 Cr8: (into-array java.nio.file.WatchEvent$Kind [kind1 kind2])

10:47 AeroNotix: ok, $Kind

10:47 lemme try it

10:47 Cr8: yeah, "Inner" classes and interfaces are named by $

10:48 AeroNotix: Gotcha, what's $ named?

10:48 Cr8: hm?

10:48 I don't think you can have a java class with a $ in it, which is why it can internally use it as a separator

10:48 AeroNotix: Cr8: but I mean, what can I refer to the symbol as?

10:49 Dollar sign sounds stupid

10:49 Cr8: oh, *shrug*

10:50 llasram: You can use '$' in Java classes just fine

10:50 Cr8: really

10:50 llasram: It's not common, but Java doesn't complain

10:51 Cr8: ah yep

10:51 and if you have a class called A$B and a class A with inner class B.. they just conflict and it'll yell at you

10:51 fun

10:52 llasram: "fun" yes

10:56 hyPiRion: Even better, you can use the same variable name for different types according to the JVM spec.

10:57 not legal in Java, but you can do it if you emit bytecode yourself

10:59 llasram: neat

11:00 Local variables, for reference vs the prim times?

11:00 types even

11:00 Actually, what am I talking about -- locals are just slots

11:01 I learned just enough JVM bytecode to accomplish one thing I needed via ASM and haven't gone back yet for a deep-dive :-)

11:41 teslanick: I have a string with a bunch of substrings I want to replace with their index. So my substrings are delimited by backticks, so "The `quick` brown fox `jumps` over…" would be replaced with "The `0` brown fox `1` over …"

11:42 I'm not sure how to attack this problem with the regex/string manipulation functions given.

11:42 AeroNotix: https://github.com/AeroNotix/awizo

11:42 something quick for fs events

12:56 shiranaihito: is there a standard way to share an instance of X with several modules? .. suppose i instantiate one X but want to use the same instance from other code in other modules.. what's the right way to do this? (yeah, i'm still pretty much a beginner at clojure :p)

12:58 noonian: if you define a variable in a namespace, other namespaces that require your namespace will have access to that variable

12:59 shiranaihito: noonian: hm.. sounds good, but is there no trouble with the time of instantiation? i mean, if namespace A has the thing i want, and namespace B wants to use it too, what if namespace B gets evaluated before A.. ? is that possible?

13:00 steckerhalter: is there a prog1 in clojure?

13:01 dnolen: steckerhalter: no

13:02 steckerhalter: dnolen: ok, thanks

13:03 llasram: steckerhalter: It's pretty easy to define yourself. But you don't need it as often as you might think

13:03 noonian: shiranaihito: it will be initialized if namespace B requires namespace A, from the first sentence of requires docstring: "Loads libs, skipping any that are already loaded."

13:04 so namespace A will be evaluated the first time a file that requires it is evaluated

13:04 shiranaihito: noonian: alright, thanks.. i realized i should probably just experiment with stuff, but couldn't resist the temptation to ask first :p

13:04 steckerhalter: llasram: yes, I just discovered it in elisp a few weeks ago and found it pretty handy for some cases

13:05 shiranaihito: ok, good

13:05 noonian: np

13:05 shiranaihito: :)

13:37 afhammad: what does <! do?

13:38 bbloom: afhammad: use (doc <!) or read the docstrings in the src: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj

13:39 afhammad: thanks

13:55 auser: hey all... question... what does this syntax mean: (concat val [::val])

13:56 bbloom: auser: which syntax? the double colon?

13:56 auser: yes, the double colon

13:56 sorry

13:56 bbloom: cmd+f on the reader page <http://clojure.org/reader> for "::"

13:57 AimHere: ,(type ::val)

13:57 auser: kk

13:57 clojurebot: clojure.lang.Keyword

13:57 auser: interesting

13:57 bbloom: turns out to be pretty damn useful :-)

13:57 auser: so then I don't understand the statement: (assoc-in trie (concat word [::val]) word))

13:57 bbloom: actually, those docs are a little dated. doesn't mention ::alias/keywords

13:58 AimHere: auser, it's a trie lookup, 'word', here, is treated as a sequence of keys to an associative structure

13:59 ::val is just the key to find the value at a node, rather than a subtree

13:59 bbloom: auser: what don't you understand about it?

14:00 auser: well... The output of the structure is a trie, obviously ({\H {\e {\l {\l {\o {:terminal true, :val "Hello"}}}}}}), but I'm not sure how it got there, over every character

14:00 Missing that piece

14:00 AimHere: A string is a sequence of characters

14:00 bbloom: auser: did you (doc assoc-in) ? :-)

14:00 see also get-in and update-in

14:00 AimHere: ,(second "Wibble")

14:00 clojurebot: \i

14:00 auser: yeah, I've been staring at the docs

14:01 http://clojuredocs.org/clojure_core/clojure.core/assoc-in

14:01 oh

14:01 wait, it's iterating over the word

14:01 AimHere: (concat word [:val]) just turns a string into a sequence of characters terminated by ::val

14:01 auser: yeah, got it

14:01 I think

14:01 yeah

14:02 makes sense

14:02 AimHere: Is the value at the end really necessary? If you know how you got there, you already have the sequence of keys you need!

14:03 auser: so then one follow-up question now that I kinda get it... is it possible to append a data structure at the end of the sequence?

14:03 now i need to think about that one

14:03 bbloom: AimHere: it's cheaper to hold on to it than to recreate it

14:04 AimHere: Well the way it's done there is more expensive memorywise

14:04 auser: what would be more efficient AimHere ?

14:04 bbloom: AimHere: no it isn't, not if you're going to reconstruct the same string multiple times

14:05 AimHere: each time you construct the string, you'll get a new object (sans string interning)

14:05 AimHere: depends on the use case

14:06 AimHere: although i guess if you're using a prefix trie in the first place, it's likely that your usecase only involves having a small number of elements from the trie being used at a time... since the point of the trie is to compress space... so nevermind ignore me :-P

14:07 auser: actually, my usecase is having an object at the end of each path

14:08 AimHere: You're not reimplementing scribblenauts in Clojure are you?

14:08 auser: oh no, but that sounds like fun

14:09 I'm trying to make the most dead-simple search engine ever

14:09 to learn clojure

14:11 AimHere: You want something like: (grep-urls (slurp (str "http://www.google.com/search?q=" (read-string)))

14:11 auser: okay, not THAT Simple

14:11 that was line 1

14:13 hm, can you create an assoc atom?

14:13 (def *trie* (atom {}))

14:13 Anderken1: sure you can

14:13 auser: I keep getting an odd error

14:13 Anderken1: refheap it?

14:13 auser: Atom cannot be cast to clojure.lang.Associative

14:13 oh good idea

14:13 Anderkent: ah, you need to deref it to read from it

14:13 auser: o

14:13 Anderkent: or use swap! to modify

14:14 auser: got it

14:14 well, I understand

14:14 just not sure I *get* it in language yet

14:14 Anderkent: atoms dont care what's inside of them

14:14 auser: https://www.refheap.com/cd5132fd82df4e8a517bd0711

14:14 Anderkent: they're just dumb containers

14:15 auser: oh, perhaps the swap! needs to be outside the anonymouse fn

14:15 gr, fingers

14:15 anonymous*

14:15 although anony-mousee sounds delicious

14:18 Anderkent: I think what you ment to do is one of these two things: https://www.refheap.com/27393

14:18 basically, the atom is *not* your map, your map lives inside the atom

14:19 you either tell the atom 'update your contents with (assoc-in <contents> ...) for every word, or you build a map for all your words and then tell the atom to merge it into its content

14:19 auser: hm, lemme look over it

14:20 well... I think I want to do the former for each "Add" operation

14:21 yeah, that makes sense

14:21 with the swap

14:21 but I doubt that'll work for multiple words

14:21 oh

14:21 I guess it does

14:21 fun

14:22 Anderkent thanks for your help

14:22 Anderkent: no prob

14:32 auser: hm

14:33 Anderkent mind if I ask one more quick q?

14:45 joshuafcole: How can I turn an arbitrary form (supplied dynamically) into a string?

14:45 The form is bound to a variable.

14:57 dnolen: ,pr-str

14:57 clojurebot: #<core$pr_str clojure.core$pr_str@1a111fd>

14:57 dnolen: ,(doc pr-str)

14:58 clojurebot: "([& xs]); pr to a string, returning it"

14:58 dnolen: joshuafcole: ^

14:58 joshuafcole: Fantastic, thanks

14:58 It was tough to google because everybody mentioning s-expressions and strings is trying to read them from strings instead of printing them. :p

15:00 Anderkent: auser: you should just ask your question, someone will see it and answer eventually ;p

15:01 auser: oh yes, of course

15:01 I'm trying to understand why the (concat) is in there

15:02 Anderkent: in where?

15:02 auser: https://www.refheap.com/27420

15:03 not sure why we have that concat in there

15:03 that's all

15:04 Anderkent: I just took it from your original example ;p

15:04 auser: no I know I know

15:04 I found that example online and am just trying to parse it

15:04 Anderkent: it's just a question of what do you want your key to be

15:04 i agree the concat doesnt make much sense there

15:05 auser: I want to store an object as the terminal

15:05 so right now

15:05 {\h {\e {\l {\l {\o {:trie-add/val "hello"}}}}}}

15:05 but I want to add keys to that terminal object

15:07 Anderkent: well the thing is if you make it {\h {\e {\l {\l {\o "hello"}}}}} then you can't store 'hell' or 'helloes'. Thus the ::val, to allow you to have {\h {\e {\l {\l {::val "hell" \o {::val "hello"

15:10 AeroNotix: I think I implemented a trie in Common Lisp, let me dig it out

15:11 it'll be way different because mutability but you might see some similarities

15:11 https://github.com/AeroNotix/algostructure/blob/master/Common%20Lisp/prefixtrie.lisp

15:14 auser: sorry, had a phone call, back

15:14 I see

15:14 AeroNotix so basically, I need to store associated information with the word

15:15 AeroNotix: Uhh, I dunno what you mean by that.

15:15 auser: right, sorry... let me try again

15:15 I'm reading a file and I want to store where in the file the word is located

15:16 AeroNotix: where according to what?

15:16 auser: so I want to be able to store the word and the line number

15:16 AeroNotix: so just loop your file and process the lines?

15:16 auser: in the file, so it's more of a node than a single word entry

15:16 yeah, I'm doing that, I mean in the trie

15:16 AeroNotix: Why do you need a trie for this?

15:17 auser: for search

15:17 so I am building an index of words in a file

15:18 AeroNotix: Does this have to be an in-memory datastructure?

15:18 auser: or perhaps I can store a secondary map that holds object information, but I still need to add additional information to the trie

15:18 AeroNotix: can't you use something like elasticsearch to do this for you?

15:18 it's perfect for textual search

15:19 auser: well, how does es do this then?

15:19 gtrak: tpope: ping

15:19 auser: I'd prefer to do it without extra deps

15:19 AeroNotix: auser: why?

15:19 smells like NIH

15:20 if this is server-side.....

15:20 auser: Really, I just want to be able to associate extra information at the terminal node of the trie

15:20 AeroNotix: otherwise, you just make a regular prefix trie but store line number as well

15:20 Yeah, what's hard about this?

15:20 auser: not trying to solve a business problem, but a thought problem

15:21 AeroNotix: Node: {:char c :line 123 :pos N :subnode { ... }}

15:21 or subnode(s)

15:21 I'd use subnodes

15:21 auser: ah yeah

15:23 thanks

15:25 I think I found a way, doing the operation slightly differently

15:25 AeroNotix: keigh

15:28 auser: if it works, I'll update you AeroNotix, if you're interested

15:28 AeroNotix: auser: I'm not. But thanks

15:28 auser: oh, okay

15:39 Bracki: Anybod familiar with vim-fireplace? Once I press cqq to get the command-line window how do I execute code?

15:39 y

15:48 Or maybe anybody familiar with Korma can explain how exec-raw is supposed to work?

15:48 bridgethillyer: cpp

15:50 I just execute in place in the source file (with cpp) instead of using the command line window

15:51 Bracki: Ok.

15:51 I was missing a (use foo)

15:51 Hence nothing worked.

15:52 bridgethillyer: That happens to me all the time; something is broken in the code, so nothing runs. Then I just assume I forgot how to use vim-fireplace. :)

15:53 AeroNotix: something something cider-mode

15:53 really impressed with cider-mode, it's better than SLIME in some ways imho

15:54 auser: hm

15:55 Bracki: Does clojure support multiline strings?

15:56 tpope: gtrak: sup

15:56 fredyr: Bracki: not yet

15:56 gtrak: tpope: I'm about to finish up cider integration with the nrepl-complete stuff, was wondering if you've got a middleware started for var-info?

15:56 seems like the design works out

15:56 Bracki: So what's the way to have a longish string?

15:57 tpope: still no

15:58 gtrak: tpope: I might start one up then.

15:58 tpope: okay

15:58 yeah, waiting on me is not your best bet

15:58 gtrak: np :-), just curious if you had any more thoughts on it.

16:02 Raynes: Bracki: Hit return.

16:02 fredyr: Bracki: yes sorry, i was thinking about this one: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes

16:02 Raynes: Bracki: https://www.refheap.com/27451

16:02 This works just fine.

16:03 fredyr: Bracki: you can just have newlines in the string literals

16:03 Raynes: Bracki: I think fredyr thought you were asking for heredocs.

16:04 fredyr: im blaming the whishey

16:04 whishkeyeys

16:04 :)

16:04 devn: btw, re: alternate quote syntaxes, does anyone, literally anyone who has been doing clojure for awhile

16:04 think that <<HEREDOC ... HEREDOC is a good idea?

16:04 because it makes me ill just thinking about it

16:05 """""" is a big win because it would work for docstrings nicely.

16:05 Bracki: Is there any alternative to Korma for SQL stuff?

16:05 dobry-den: datomic ;)

16:05 devn: Bracki: http://www.clojure-toolbox.com/

16:06 see "SQL Abstraction"

16:06 Raynes: clojure.java.jdbc

16:07 AeroNotix: devn: is anyone actually thinking about <<HEREDOC

16:07 aaronj1335: hey folks does anyone know where clojure.contrib.seq went in 1.3

16:07 ?

16:07 devn: aaronj1335: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go

16:07 it went nowhere.

16:07 dobry-den: When a user registers, I want to hit an avatar-generating API endpoint and download the avatar into a local /avatars folder. What's the general approach to this?

16:07 aaronj1335: yea i saw it didn't have a listing, didn't know if that meant it was officially gone

16:07 Bracki: devn: Any of those support lazy selects? I have a huge result set (10 mio rows) and Korma just get's everything in one go

16:08 devn: AeroNotix: i dont know, but someone actually added it to Bracki: you can just have newlines in the string literals

16:08 aaronj1335: but it sounds like yes, yes it is

16:08 thanks

16:08 fredyr: AeroNotix: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes

16:08 devn: Bracki: can't you just batch your selects yourself?

16:08 get the count and batch it

16:08 woops, thanks fredyr

16:08 Bracki: How?

16:10 devn: Bracki: select * from mytable limit 10000 offset 10000

16:10 Bracki: The mysqldb lib in Python has a notion of a server side cursor, looking for something like that

16:11 devn: i have no idea what that is

16:11 Bracki: devn: dealing with a weird query with lot's of left joins so it's hard to use LIMIT properly

16:11 http://dev.mysql.com/doc/refman/5.0/en/cursor-restrictions.html

16:12 devn: mysql is such a bummer dude

16:16 Bracki: AH, http://niwibe.github.io/clj.jdbc/api/jdbc.html#var-with-query

16:16 That's what I was looking for...

16:16 Weird that Korma doesn't support it

16:20 Also, why isnt clj.jdbc on the toolbox site?

16:20 tpope: gtrak: is the public cljs-complete library at a point where I can try hooking it up?

16:21 gtrak: tpope: I think you want nrepl-complete, cljs-complete is just the backend that parses the cljs analyzer.

16:21 I'm working on releasing that now, but you can use it from git.

16:22 tpope: okay cool

16:22 gtrak: I load up the project in a repl, then I connect with another nrepl client and run (cemerick.piggieback/cljs-repl) to start up the cljs repl.

16:22 then the nrepl client creates the "complete" op

16:23 here's that code, maybe helpful: https://github.com/clojure-emacs/cider/blob/master/cider-interaction.el#L547

16:24 tpope: gtrak: perfect

16:27 devn: Bracki: make a PR to clojure-toolbox.com get jdbc added there

16:27 i actually wondered the same thing

16:27 there are some extremely outdated libs on the toolbox site also

16:28 Bracki: there's also http://www.clojuresphere.com/

16:47 aaronj1335: hey folks is there a way to do the {:keys [local1 local2]} trick outside the context of function args

16:48 like if i want to return {:foo foo :bar bar} from a function

16:49 shep-home: Is there an established pattern / library / function for polling a key of an atom until it is a certain value?

16:49 michaelr525: hello

16:49 TEttinger: aaronj1335, so you want the value of evaling foo and the key is :foo ?

16:50 aaronj1335: what up michaelr525

16:50 TEttinger yea

16:50 kinda like the let binding allows {:keys [foo bar]}

16:50 michaelr525: aaronj1335: everything is great. i've actually came here tonight to ask a question :)

16:50 aaronj1335: michaelr525 well i'm new to clojure, but who knows i might b able to help :)

16:51 michaelr525: a kid told me that he wants to get into programming, so immediately thought of my favorite language

16:52 i wonder are there resources for teaching kids to program in clojure (as first programming languages)

16:52 aaronj1335: c#??!!?!

16:52 srsly tho that's a great question

16:52 gfredericks: ask technomancy why he uses racket instead ;-)

16:52 aaronj1335: i've always thought of python as the easiest to learn, tho it's not my fav

16:52 michaelr525: i'm sure i'm not the first one to ask it too

16:53 gfredericks: I don't think I would recommend clojure for kids; it's elbow-deep in real-world-engineering-dirt

16:53 michaelr525: yea, i've seen many recommendations for python, but I'm hesitating to recommend it since I don't know python myself

16:54 aaronj1335: honestly michaelr525 as much as i hate to say it (cause i like clojure), it may not b a good one to learn on

16:54 gtrak: tpope: any luck? I'm writing up some docs and releasing soon.

16:54 aaronj1335: i've lectured at my university on python, and for some reason it seems like ppl really struggle when we get to functional-ish paradigms

16:55 michaelr525: technomancy: why do you use racket for teaching kids programming?

16:56 i'm actually going to ask him what he would like to program first, and i suspect it's mobile apps

16:57 in that case i'm pretty limited in the choice of languages

16:58 aaronj1335: michaelr525 that's not a bad idea. when i was trying to learn guitar, the first thing i tried was playing the music i liked, and from there i actually learned stuff like theory

16:58 maybe that's a good approach for programming too

16:59 michaelr525: yeah well, but learning java as first language is kinda sad ;)

16:59 TEttinger: michaelr525, there's a few JS derivatives that are meant to be good for teaching IIRC

17:00 michaelr525: I actually like c# but java always feels so cumbersome and inellegant

17:00 TEttinger: and those are probably much easier to get running on a phone

17:01 michaelr525: TEttinger: like in a web browser one a phone?

17:01 Bracki: "Don't know how to create ISeq from: clojure.lang.Symbol" hm, how do I figure out where the symbol is returned...?

17:02 TEttinger: Jack is a scripting language aimed at kids learning to program as well as professionals who yearn for a simpler language (like me).

17:02 https://github.com/creationix/jack

17:03 michaelr525: TEttinger: thanks i'll check that

17:04 TEttinger: it seems pretty early, for more practical stuff... heck just JS on its own can probably be decent for beginners, though the HTML and CSS might be a hurdle.

17:05 tpope: gtrak: heading out soon, not going to get to it today

17:05 gtrak: tpope: no worries, it's released though.

17:06 I'll start work on var-info sometime.

17:06 tpope: cool, I'll let you know how it goes on my end

17:06 gtrak: waiting to hear back from cider folks on what they might want

17:09 TEttinger: michaelr525, I'm kinda surprised that I'm surprised this exists http://zachbruggeman.me/dogescript/

17:11 michaelr525: TEttinger: ..

17:11 TEttinger: michaelr525, I'm just going through this list https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

17:12 michaelr525: TEttinger: ok

17:17 aaronj1335: michaelr525 yea java as a first language may be less-than inspiring. khan academy (which is pretty good at teaching) employs john resig (pretty good ad JS), so have you thought about http://www.khanacademy.org/hour-of-code/hour-of-code-tutorial/v/welcome-hour-of-code ?

17:22 gfredericks: Bracki: that particular error is often something in the (ns) form

17:22 Bracki: Yeah just found it

17:22 gfredericks: but in general those kinds of errors can be arbitrarily difficult

17:22 michaelr525: aaronj1335: hmm..

17:22 Bracki: Clojure and JDBC integration is basically a mess.

17:22 gfredericks: it is?

17:22 michaelr525: aaronj1335: looks interesting

17:23 dobry-den: Making an avatar upload system, how can you prevent users from uploading more than X bytes?

17:23 Bracki: All the examples i found use the "old" API, but suddenly there's a new more "idiomatic" api.

17:23 gfredericks: yeah that happens when APIs change

17:23 Bracki: Half is deprecated, requiring the dprecated one leads to weird errors etc..

17:23 aaronj1335: michaelr525 yea i went thru it, the first hour was basically just conditionals and loops. but seemed like a good start. i dunno.

17:23 Bracki: As a newbie that kind of sucks.

17:23 gfredericks: Bracki: the new API is somewhat easier

17:24 Bracki: No not at all

17:24 The new API is undocumented

17:24 gfredericks: I learned it from the docstrings

17:25 Bracki: I don't even understand half of it.

17:26 I'll just stick to Python in this case...

17:27 I think it's weird for a major library to not include an example on how things work.

17:27 gfredericks: Bracki: it's mostly like the old one but with the db info passed in as the explicit first arg rather than implicitly/magically via with-connection

17:27 Bracki: Esp. when all the search hits you get are polluted with the old one.

17:28 gfredericks: I saw a good set of examples the other day

17:28 looking for them now

17:29 Bracki: gfredericks: Thanks, I appreciate that

17:29 .

17:29 gfredericks: Bracki: the main ns docstring links here: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html

17:29 which is what I was remembering

17:32 dobry-den: I'm writing my own file store for ring's multi-param upload so that I can replace io/copy with a loop that stops if the stream is larger than X bytes. https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/multipart_params/temp_file.clj#L45

17:32 Has anyone already done this?

17:33 Because I'm fetching my shears

17:44 Bracki: Argh, java.lang.IllegalArgumentException: Don't know how to create ISeq from: com.mysql.jdbc.JDBC4ResultSet

17:45 These examples are great: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#SELECT

17:45 inklesspen: is clojurescript discussed here as well?

17:45 Bracki: But they don't work with new API and I just can't get them to work.....

17:47 tbaldridge: inklesspen: sure, all the time :-)

17:50 inklesspen: I saw an article about Om and decided I have to learn this system. But I have a couple of questions.

17:50 If you need a library, do you look first for a JS library or a Clojure library?

17:50 tbaldridge: inklesspen: well the author of Om (dnolen) hangs out here a lot.

17:52 gfredericks: Bracki: check out the docstring for the query function

17:52 tbaldridge: inklesspen: often a clojure lib, but wrapping JS libs isn't hard

17:53 gfredericks: Bracki: the link I gave you before has query examples

17:53 Bracki: What does # and % mean?

17:54 deadghost: # function % interpolate

17:55 mischov: #(inc %) = (fn [x] (inc x))

17:55 gfredericks: # means various things

17:55 #() is a function

17:55 dnolen: inklesspen: there's an active #clojurescript channel now, but you can ask questions here too

17:56 inklesspen: you can use JS libs, that's how Om works w/ React, but you lose the Google dead code elimination juice

17:57 deadghost: what is Google dead code elimination juice

17:57 inklesspen: dnolen: cool. it lacked a topic (and any conversation in the last half hour) so I didn't know if it was an active channel

17:57 deadghost: the Closure js compiler can remove code which will never run

17:57 gfredericks: clojurebot: Google dead code elimination juice is part of this complete breakfast

17:57 clojurebot: You don't have to tell me twice.

17:57 dnolen: inklesspen: if I can find the functionality in Google Closure I'll usually for for that, or a CLJS lib. But lots of people rely on JS libs, it works OK.

17:57 deadghost: whoa whoa whoa

17:57 so you're saying

17:58 it can remove unused jquery

17:58 dnolen: deadghost: no only code that follows the Google Closure coding standards

17:58 deadghost: so it works for Google Closure, and ClojureScript (we do the hard work for you)

17:58 ivan: https://developers.google.com/closure/compiler/docs/api-tutorial3#dangers

18:14 aaronj1335: i'd like to define #({:foo %1}), that is a function that returns a hash map w/ the 'foo' key set to the first arg passed in, but i get an error. what's the right way to do this?

18:15 or do i just need to do (fn [arg] {:foo arg}) ?

18:15 tpope: yes

18:16 Cr8: aaronj1335: remember that #(foo %) expands to something like (fn [x] (foo x)), not (fn [x] foo x)

18:16 S11001001: ,'#(foo %)

18:16 clojurebot: (fn* [p1__25#] (foo p1__25#))

18:16 Cr8: so #({:foo %1}) == (fn [x] ({:foo x}))

18:16 S11001001: aaronj1335: you can do that to see what your #() thing expands to

18:17 ,'#({:foo %1})

18:17 clojurebot: (fn* [p1__50#] ({:foo p1__50#}))

18:18 aaronj1335: Cr8 ah i see, that's why the error was talking about function arity, b/c it was trying to apply {}

18:18 ,''#({:foo %1})

18:18 clojurebot: (quote (fn* [p1__75#] ({:foo p1__75#})))

18:20 S11001001: ,'#(do {:foo %1})

18:20 clojurebot: (fn* [p1__100#] (do {:foo p1__100#}))

18:23 Cr8: ,({:foo :a})

18:23 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>

18:23 Cr8: ,({:foo :a} :a)

18:23 clojurebot: nil

18:23 Cr8: ,({:foo :a} :foo)

18:23 clojurebot: :a

18:26 deadghost: >look over clojurescript for the first time

18:26 sweet jesus

18:26 is it really as good as it looks?

18:30 S11001001: well ambrosebs hasn't ported core.typed to it yet, so

18:30 hyPiRion: is it???

18:30 lazybot: hyPiRion: How could that be wrong?

18:30 hyPiRion: ^

18:35 Morgawr: for all the LightTable users + web developers, I wrote a plugin to choose color codes and embed them in your code, https://github.com/Morgawr/lt-color-picker please try it out if you're interested so I can squash out bugs :)

18:41 bbloom: Morgawr: a screenshot would be nice :-)

18:43 Notte: Why doesn't this function get realized even with doall? http://hastebin.com/gevuvobitu.lisp

18:43 Morgawr: bbloom: http://www.morgawr.eu/p/1390693226.png not much to show when it's not in motion

18:44 you add it under your cursor, click on the color bar and select the color you want, then the color is added at the cursor's position

18:45 dnolen: Notte: doall is not recursive

18:46 Notte: dnolen: i think i don't understand your point, but that fn doesn't realize with take also and doseq etc

18:47 dnolen: Notte: take is lazy

18:47 bbloom: Morgawr: oh, it uses the browser/system color picker. neat

18:47 Morgawr: bbloom: yeah, I started out thinking of making my own then realized html5 has input type as color picker

18:47 so.. why not :)

18:47 dnolen: Notte: doseq won't help you're producing a tree not a sequence

18:47 Morgawr: made my work much much easier

18:48 rm764: Anyone have an idea why I might get a NullPointerException in LightTable when I try to Cmd+Enter? (Running through Om tutorial https://github.com/swannodette/om/wiki/Tutorial)

18:48 Morgawr: LightTable plugin system is pretty crazy, I love it so much

18:48 dnolen: Notte: ever result from tuples (which recursively produces a tree) is a lazy seq

18:48 s/ever/every

18:48 Morgawr: rm764: at which part do you get it?

18:48 usually you position the cursor over some code and eval it with ctrl/cmd+enter

18:48 dnolen: Morgawr: agreed, good stuff

18:49 Morgawr: dnolen: the editor itself is also really well coded, I spent the last few days fixing bugs and browsing the code and it's amazing how simple it is to get into it without any prior knowledge of the editor itself

18:49 Notte: dnolen: but the first fn isn't lazy, is it?

18:50 rm764: Morgawr: After appending the "swap!" command to core.cljs and typing Cmd+Enter. However, I get it even when I Cmd+Enter the fresh file as pulled by lein.

18:50 dnolen: Notte: it is since it delegates to the next arity

18:50 which returns a lazy seq

18:53 Morgawr: rm764: heh, sorry I can't help, I've never used Om nor tried that tutorial :(

18:53 Notte: ok, thanks dnolen

18:54 bbloom: Morgawr: experience is a bit wonky on OSX where a big color swatch pops up, but not the color picker dialog itself. you need to click this large ugly black bar to get the dialog

18:55 rm764: Okay, thanks anyway. I thought it might be something general about the LightTable Instarepl that I don’t get. (Screenshot btw http://cl.ly/image/380G443D1f2D)

18:58 Morgawr: bbloom: the black bar is intentional (I should probably fire the "click" event upon creation, now that I think about it), what do you mean with "big color swatch"? I don't have OSX so I can't test, can you show a screenshot?

19:03 bbloom: Morgawr: that black bar == the color swatch

19:03 Morgawr: yeah, fire the click event immediately

19:04 Morgawr: bbloom: that also saves me a lot of trouble because I wanted to have it appear directly under the cursor but, now that you point it out, it doesn't make sense to have to click on the color chooser to open it. I'll patch in a few :) thanks

19:17 akurilin: Random question: do you guys use github over bitbucket for small teams with dozens of repos?

19:17 I'm trying to figure out what people pay the $50-100/mo for

19:17 Just the less-terrible UX?

19:18 shep-home: If I define a protocol in namespace A, and that protocol defines function `send`

19:18 Why do I get warnings about redefining `send` when I do `(:require [A :as something])` ?

19:19 shouldn't it be underneath A, and not clobbering the define?

19:20 OlegYch: bitbucket repos are much slower than github

19:20 dnolen: shep-home: did you exclude `send` on namespace *A*

19:20 s/on/in

19:21 OlegYch: in my experience i only got like a couple of connection resets from github in years, and i'm experiencing this like every day with bitbucket

19:22 shep-home: dnolen: I think it figured it out... it's not the protocol definition that is the problem, it's the fact that I implement it too

19:23 so the implementation `send` is overwriting it

19:23 dnolen: shep-home: yes, you need to exclude `send` from namespace `A` before defining your own

19:24 shep-home: dnolen: In my case, I really want my defrecord to be in its own ns.

19:24 I'm just in the process of splitting an overly large file

19:24 and I guess I'm halfway though

19:27 Morgawr: bbloom: mm.. I'm trying to open the color chooser window automatically but when I fire the "click" event nothing happens... I think this is a standard HTML/Javascript problem, how do I open the color chooser window for an input type?

19:27 also pinging dnolen cause I know he knows a lot about clojurescript/javascript :P

19:27 dnolen: Morgawr: like you want to generate a synthetic browser event?

19:28 Morgawr: well, I have an HTML.InputElement, when I click on it (with my mouse) it opens the color chooser window (it's an input of type color)

19:28 but when I call (.click myelement) it doesn't open the window

19:28 (if I add the :click event with my own lambda, like a println on console, it fires)

19:29 shep-home: dnolen: apologies - I now get what you are trying to explain to me :-)

19:30 warz: Morgawr, perhaps there's a focus event or something that actually triggers the dialog

19:30 instead of click?

19:30 Morgawr: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement I'm checking this page

19:30 the only relevant methods seem to be click() and focus()

19:30 maybe select()?

19:31 nope, select doesn't work

19:38 dnolen: Morgawr: there is no such thing as a click method, you want synthetic events

19:38 Morgawr: dnolen: that mozilla page says there's a .click() method for InputElement :|

19:39 but yeah, I want to raise the window for the color picker as if the user had clicked on the element itself, yeah

19:39 rhg135: i have a pretty fundamental question, if ISeqable is an interface how does String implement seq if it's a final class?

19:42 dnolen: Morgawr: if there's a way to raise the window w/o faking an event it will be a lot simpler for you

19:43 Morgawr: dnolen: I'd love to find out but I have no idea where to look, it's a standard HTML input element :(

19:43 bbloom: presumably light table has some dom operations in it somehow somewhere?

19:44 Morgawr: this is not a LightTable problem, I'm really just writing javascript

19:44 I have an HTML.InputElement and I need to click on it to raise the window but if I use .click it doesn't raise the window (although it fires the onclick event if I add a function to print to console to it)

19:45 bbloom: ah, well triggering a click is possible, but i think it's kinda browser quirky

19:45 for security reasons, they might not show the dialog on a forced click

19:46 Morgawr: ugh, so there might not be a solution to have the color wheel show without manually clicking? :(

19:47 bbloom: potentially :-(

19:47 dunno for sure

19:47 dnolen: Morgawr: http://stackoverflow.com/questions/249192/how-can-you-programmatically-tell-an-html-select-to-drop-down-for-example-due

19:47 bbloom: oh chrome only is fine tho :-)

19:47 dnolen: Morgawr: would never do this normally because it would only work in Chrome but you're in LT so no big deal

19:47 bbloom: light table uses webkit

19:47 hurray singular platforms!

19:47 dnolen: blooberr__: well it's chromium I think it may work

19:48 Morgawr: dnolen: thanks! I'll check it out :D

19:48 dsrx: rhg135: i think strings are special cased somehow, you can see here that strings do not implement clojure.lang.Seqable https://github.com/clojure/clojure-contrib/blob/b8d2743d3a89e13fc9deb2844ca2167b34aaa9b6/src/main/clojure/clojure/contrib/core.clj#L78

19:48 Morgawr: this looks like such a dirty hack that it almost makes me feel excited :D

19:48 dsrx: ,(instance? clojure.lang.Seqable "foo")

19:48 clojurebot: false

19:49 rhg135: figured as such

19:49 0.0

19:50 dnolen: Morgawr: correction it doesn't appear to work in Chrome anymore, but the basics appear to work in LT

19:50 rhg135: damn

19:51 so much for extansability lol

19:51 in interfaces anyway

19:51 dsrx: rhg135: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L498

19:52 rhg135: ooh

19:52 Morgawr: dnolen: the basics? but yeah, I just tried and it doesn't seem to work.. lemme see if I made some mistakes

19:52 rhg135: it's hardcoded in the RT? wow

19:53 bbloom: rhg135: that's not that surprising when you consider protocols didn't come until much later

19:53 rhg135: i know but wow

19:54 now i know why protocols exist

20:01 bbloom: rhg135: heh, yeah. the problem is that it's unreasonable to assume the type designer will figure out every polymorphic thing you may ever want to do with that type :-)

20:03 rhg135: hmm

20:03 bbloom, ya, i want to make strings represent http requests</dumb-idea>

20:04 cark: what's the predicate to know if an object is a function in clojurescript ?

20:05 bbloom: cark: either fn? or ifn? depending on what you want

20:05 noonian: cark: fn? and ifn?

20:05 cark: ahyes, thanks

20:05 bbloom: it's basically fn-object? and callable? respectively

20:07 rhg135: hmm i should make a list of things that should not be iseqs

20:12 Morgawr: alright dnolen & bbloom, looks like this javascript stuff is not really possible... the ugly color bar thing will have to stay (at least until I decide to embed my own form in a div or something)

20:14 edem_: hi

21:02 andyf_: Bronsa: ping

21:03 Bronsa: andyf_: hi

21:03 andyf_: Bronsa: Howdy. You said in your recent comment the following phrase: "This means that that we're not throwing any :tag-kind anymore since it all got unified."

21:05 I just ran Eastwood on the crucible again after updating to latest t.a(.jvm), and it seems that it does still sometimes throw exceptions with :tag-kind, since Eastwood is still printing error messages that it only prints when it finds such keys.

21:05 I can dig some more if that sounds incorrect

21:06 Bronsa: andyf_: I just did a git grep "tag-kind" in t.a.j to check if I forgot to remove it from somewhere but it returned no matches

21:07 andyf_: double-checking ...

21:07 Bronsa: andyf_: might be that the new snapshot hasn't been published yet?

21:07 andyf_: false alarm -- I didn't update properly

21:08 Bronsa: oh, ok :)

21:09 andyf_: I do still see tag-kind in file validate.clj

21:11 Bronsa: ... I'm an idiot andyf_

21:11 andyf_: Bronsa: I was an idiot first :-)

21:11 Bronsa: I did not push the commit.

21:12 dsrx: I don't trust anyone who claims to be anything other than an idiot

21:13 Bronsa: andyf_: there, pushed now

21:13 andyf_: Bronsa: OK, I will actually update both of my local repos and retest

21:13 chchjesus: dsrx: But I'm a super genius

21:37 cark: how can I tell if an object is a core.async chan ?

21:37 (in clojruescript)

21:40 noonian: cark: looking at the source, you could probably use (satisfies? cljs.core.async.impl.protocols/Channel a-chan)

21:40 cark: noonian: yes, that's what i'm doing now, but this is easily breakable if the implementation changes

21:41 there really shoudl be a chan? function in the API

21:41 noonian: yeah, agree there should be a chan? fn

21:46 dsrx: add it to your async-utils namespace that you copy between every project until it's inevitably added to the api :D

21:46 kristof: Every day, someone is talking about core.async

21:46 people really like it, I guess

21:46 cark: it's really good =)

21:47 dsrx: yes, i guess i'm up for that

21:47 noonian: especially in cljs where everything uses callbacks

21:48 kristof: noonian: Why? I suppose I just don't understand where this would be useful but if you're unsure if something is a chan, you shouldn't be putting or taking from it anyway

21:49 cark: kristof: i have a good use case, won't bother you with the whole story, but it's good

21:49 kristof: cark: the gist, then

21:49 cark: I was actually just referring to noonian's comment "especially in cljs where everything uses callbacks"

21:50 cark: ahwell ...there it goes. I'm doing a routing library (just like url routing). if you consider an url my.domain/movies/1123

21:50 my routing is hierachical

21:50 so movies is easy, it requires just a string comparison

21:51 but the movie id thing, it must matched with movie id's in a

21:51 from a web service

21:51 this is asynchroneous

21:51 noonian: kristof: you can convert api's that use callbacks to return channels instead which allows you to write code that feels synchronous inside a go block

21:51 cark: so my matching function sometimes takes strings an sometimes channels

21:52 noonian: i'm not sure when you'd need a chan? fn but it seems reasonable since most things in clojure provide a predicate like that

21:53 cark: i need a chan? function so that i can tell if i'm matching a string (which i can do directly) or a value that will come later via a chan

21:54 the thing is, there could be more like this : my.domain/customers/12/invoices/5

21:54 there i need to match the string customer, then the chan customerid, then invoices (string) and again a chan for invoiceid

21:55 maybe some more data will come from other requests while i parse the url

21:55 or apply the url really

21:55 kristof: noonian: Ah, that makes sense.

21:55 cark: in the end, i have a nice map, with all the data required to display the page

21:56 kristof: cark: That also makes sense.

21:57 cark: and with all this asynchronicity going on, my calls look very much like regular code, no callback anywhere

21:58 (go (display (<! (parse-url url))))

22:01 ToBeReplaced: cark: you might be able to do one better (take! (parse-url url) display)

22:01 cark: ah indeed =)

22:03 i could make everything channels, wrap my string matcher in a channel too .... but that seems a bit overkill

22:07 maravillas: cark: the uniformity might be nice, but barring that, why not just use string? instead of the satisfies? call?

22:08 cark: maravillas: i might want to compare some data type that i din't think of

22:09 kristof: maravillas: because string? is not the thing that doesn't exist, it's chan?

22:09 cark: i'm not really parsing URLs, but a representation of these

22:09 maravillas: i see

22:09 cark: so the last case is the = matcher

22:27 noonian: i'd just put everything in a channel, if it's a string the channel will already have a value and it should make the code a little cleaner

22:27 dsrx: must fight urge to prematurely refactor

22:27 cark: noonian: i'm actually trying it in a new branch, see how it performs

22:29 dsrx: can i get around the 'protocol reloading in a repl' problem if i just defer protocol implementations to outside functions?

22:29 e.g. (deftype Foo ISomething -whatever (foo-whatever))

22:29 rather than inlining foo-whatever into the protocol implementation

22:32 s/deftype/defrecord

23:05 dissipate: Trying to convince others to use Haskell is permitted between 0200 and 0500 UTC <---- is that a joke?

23:06 kristof: dissipate: blame ~bitemyapp for it

23:06 dissipate: but yes, it's a joke

23:17 gfredericks: ,(doc aset)

23:17 clojurebot: "([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."

23:17 gfredericks: "Works on Java arrays of reference types."

23:17 is that supposed to imply it doesn't work with primitive arrays?

23:18 lemonodor: i'm having trouble getting my :test dependencies loaded. Am i doing something wrong? https://gist.github.com/wiseman/8628331

23:19 (lein 2.3.4)

23:19 riley526: So I'm reading this https://github.com/swannodette/om/wiki/Tutorial and at the end it says "proceed to the next section and we'll show how to do it." Where's the next section? (cc dnolen)

23:19 dnolen: riley526: not yet written

23:20 riley526: dnolen: haha ok

23:20 gfredericks: lemonodor: you have two :profiles entries

23:20 presumably the first one is being overridden

23:20 lemonodor: oh :) of course it would be something verrry simple. thanks!

23:21 gfredericks: np

23:21 lemonodor: I guess it would be difficult for leoin to issue a warning in this situation, too.

23:22 gfredericks: I was about to say the exact opposite

23:22 I don't know for sure but I suspect it'd be an easy patch

23:23 riley526: dnolen: for clearing the contents of an input, so far the only way I'm aware of how to do that is to bind the field value to my app state and change the state back to "". I assume that's wrong though, can you hint at how it should be done?

23:24 dissipate: i know this might be OT but does anyone know the relationship between relevance and cognitect? is relevance a subset of cognitect?

23:24 dnolen: riley526: that's the way React people do it, so that's a valid solution

23:24 riley526: dnolen: feels very roundabout though

23:25 I'm not opposed to going with that

23:25 dnolen: riley526: some things in React are more work so other things can be easy

23:25 riley526: alright then

23:26 thanks for your input

23:26 gfredericks: lemonodor: if you feel like patching leiningen, I see the defproject macro uses map destructuring and you could modify that to check for dupes ;-)

23:26 dsrx: react binds one-way from owner to child right?

23:29 devn: RE: kovas' post on the list. Is this any better?

23:29 ,(ns-resolve *ns* (symbol (str "map->" 'fooBar)))

23:29 i know it's still string munging, but his example seemed much more complex

23:29 clojurebot: nil

23:32 devn: or is there a way to track when the other constructors are created?

23:38 gfredericks: devn: why would *ns* be the correct value?

23:38 probably it's just user

23:45 d11wtq: Are there any clojure (or java) libraries that can convert fuzzy strings like "3pm tomorrow" into actual Date objects?

23:47 Ah, found one! http://natty.joestelmach.com/

23:47 devn_: gfredericks: fair enough

23:47 gfredericks: simpler still:

23:48 ,(defrecord fooBar [x y z])

23:48 clojurebot: sandbox.fooBar

23:48 devn_: ,`~map->fooBar

23:48 clojurebot: #<sandbox$eval26$map__GT_fooBar__46 sandbox$eval26$map__GT_fooBar__46@10035f0>

Logging service provided by n01se.net