#clojure logs

2014-01-25

00:02akurilintechnomancy: Fair enough, this sounds "good enough" for the vast majority of cases.
00:03technomancyI would like to move everything in the test task into a lib though
00:04akurilintechnomancy: Any tips on reloading the app's code as you test it from a test ns? Do you just require reload?
00:05technomancyakurilin: I use cider
00:08akurilintechnomancy: I see, I guess as a vim user I'm not invited to that party.
00:08akurilin:P
00:08technomancyeh, fireplace should work fine
00:08technomancyjust recompile after every edit you do
00:09akurilinI see, so it sounds like you don't spin up a secondary repl just for the tests, right? You do everything through nrepl
00:09akurilinI 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
00:10technomancyhm; I wouldn't worry about that
00:10akurilinBut I can certainly see the one less step if you already reload everything in nrepl.
00:10technomancyI don't think it's worth having two; just make a second fresh pass over your full suite before merging
00:11akurilinFair enough, I'll try that, simple is better. Do you do Sierra's flow btw, or do you not bother?
00:12technomancyI haven't tried it
00:12technomancydon't really see the appeal
00:13akurilinFair enough, good to know.
00:21JacobGood1When I use clojure.repl/source on a function that I have redifined through the repl, it returns nothing... is there a way around this?
00:21technomancyJacobGood1: no, clojure.repl/source is kind of a hack
00:21technomancytry running it on itself to see what I mean
00:22JacobGood1well is there anything like it that i could use to reread the source of a redifined fn?
00:23technomancyno, it's gone forever
00:23koreth_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.
00:23technomancyunless you used https://github.com/technomancy/serializable-fn
00:24JacobGood1ok i will give that a shot thanks techno
00:25technomancyJacobGood1: I don't know that I'm recommending that as a practical thing
00:25technomancyjust that it's what you'd need to do if you wanted to get what you're asking
00:28JacobGood1oh, well I am trying something impractical anyway
00:28technomancydon't let me stop you
00:31Raynestechnomancy: https://www.dropbox.com/s/x1tqocwdn0l7ter/Photo%20Jan%2024%2C%209%2023%2047%20AM.jpg Triscreen yo :3
00:31technomancyDas Respect
00:34seangroveDamnit, how can I get korma not to print out this exception? https://github.com/korma/Korma/blob/master/src/korma/db.clj#L221
00:34seangroveI don't often want CL's restarts, but wouldn't mind it here
00:34technomancyRaynes: wait, does your das have labeled keycaps??
00:34lazybottechnomancy: Definitely not.
00:35seangroveIt's printing out a sql statement that completely fucks the terminal
00:35seangroveThis is the repl prompt after the error is thrown:
00:35seangroveC┌⎺⎽☃┼± c⎺┼┼ec├☃⎺┼:
00:35tomjack``I want to stop defining things at the repl
00:35technomancyI thought all Dases were otaku-style
00:35technomancytomjack``: it's a little late for a new years resolution ,but whatever
00:35seangroveThat's supposed to be zensight.support.repl-work:
00:35Raynestechnomancy: Yes, and I'm getting another one with labeled caps as well.
00:36tomjack``or, I guess I want the repl to do something different
00:36Raynestechnomancy: Lance polled my desk neighbors and my keys are too loud. Gotta switch to cherry reds. :p
00:36technomancyRaynes: noooo =(
00:36RaynesGotta do what you gotta do m8
00:36technomancyI have reds in my shift keys
00:36seangroveDo I have to alter-root-var and redefine handle-exception in korma to stop it from spewing stuff out?
00:36technomancythey're fine for modifiers, but I wouldn't want to type on them all day
00:36tomjack``surely someone's built an nrepl plugin that records everything I eval somewhere
00:36seangroveThere's no hook otherwise to control the behavior...
00:37technomancyRaynes: have you looked into o-rings?
00:37RaynesI haven't
00:37technomancysupposedly they damp the sound without sacrificing much of the tactile feel
00:38technomancyRaynes: also: unless you're going to be doing a lot of gaming you should consider clears over reds
00:38Raynestechnomancy: Das comes in browns, blues, and reds.
00:38RaynesBrowns would probably have still been too loud, and reds seem less bad than you claim :p
00:38technomancyoh.
00:39RaynesI probably would have went with clears.
00:39seangroveAlso, 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?
00:39RaynesBut I really like das keyboards.
00:39technomancyI have browns in my keyboard too, for the non-modifier pinkies
00:39technomancythey're not any louder than reds
00:39scottjRaynes: I'm not sure if browns are quieter, but since they're not as high pitched I find them much less annoying
00:39technomancythey're a lot quieter than blues
00:40RaynesAnyways, I think reds are still probably better than using a stock apple keyboard, and I'm not paying for it so...
00:40Raynes:p
00:40RaynesAnd the order is already out/
00:40JacobGood1Is there a way to make a clojure function work across all namespaces without having to type require everywhere?
00:41technomancyoh, sure. yeah, definitely better than giving up on das for sure
00:41RaynesThankfully not really.
00:41technomancyJacobGood1: typically you want editor support for that
00:41technomancydoing it inside the namespaces themselves would be a mess
00:41ivannever ever buy blue switches unless you like 70 dB clicking noises
00:41RaynesI do.
00:41technomancyivan: who does'nt though?
00:42ivanthey're high-pitched noises that raise my blood pressure, not satisfying clicks (to me, anyway)
00:42scottjtechnomancy: I can't stand the sound of blues
00:42Raynestechnomancy: Also, this means I get to take my das home now.
00:42Raynes:D
00:42ivanyou can also make it activate without a click, which is kind of insulting :)
00:42technomancyRaynes: I predict an increase in work-from-home days for you
00:43RaynesI cause small earthquakes with each das keystroke, ivan.
00:44technomancyis there a trick to it?
00:44RaynesWrite Python.
00:44technomancyno, getting it to activate without a click
00:44technomancyI can't get mine to od it
00:44ivanjust hover right below the activation threshold
00:45ivanit worked on my quickfire pro
00:45ivanget it to click, then go up as little as possible
00:45RaynesI can definitely activate mine without clicking
00:46kristofPretty soon you all are going to talk about WASD keyboards
00:46technomancyoh yeah, if you activate and then bring it back up; I see
00:46RaynesPresumably we'll talk about Clojure again one day.
00:46kristofClojure? Nothing to see there :P
00:46technomancynot exactly something that could happen on accident
00:47dsrxoh, keyboard chat?
00:47kristofno, that's #clojure-keyboard
00:47dsrxthe perfect time for me to be smug about my topre keyboard
00:47scottjbtw realforce 87u 45g topre on sale right now for $199
00:47ivanhas your topre spacebar ground your thumb to the bone yet?
00:48technomancyI was hacking in the library the other day; first time I've felt somewhat bad about my clicky level
00:48dsrxscottj: hmmm not in white/gray though
00:48technomancybut it was right next to the coffee shop in the seattle public library, so I don't think anyone got too worked up
00:48scottjdsrx: my arms are too hairy for white :)
00:49dsrxhaha
01:01cnlif 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
01:02technomancycnl: yeah, records take up less memory
01:03technomancyhowever, if it's possible to express things lazily, that's usually a better way of consuming less memory
01:04cnlwell, 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)
01:04cnlso i probably have to load them all into memory
01:04akurilintechnomancy: 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.
01:04akurilinincluded the flow you recommended in there.
01:05technomancycnl: at first glance: use swap! instead of reset
01:05technomancycnl: or better yet, use reduce instead of an atom
01:06cnli tried that initially but was having problems calling reduce on the line-seq, ended up with stack overflows
01:06cnlalthough i might of just been doing somthing stupid
01:07technomancycnl: reduce is conceptually similar to doseq changing an atom every time
01:08technomancyakurilin: my talk proposal to clojurewest is kind of about writing tools like that in a cross-editor way
01:08technomancyhttp://p.hagelb.org/clojurewest-2014.org.html
01:08technomancyso if it gets accepted I'll probably polish off that lib some more
01:29akurilintechnomancy: sounds like a very worthwhile goal
01:31akurilintechnomancy: 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.
01:31akurilinI'm personally ok with something like Chrometools for Clojure
01:31technomancyCL-level interactivity will probably never be feasible on the JVM
01:32technomancybut we can sure do a lot better than what we have now
01:34cnlso i end up with stack overflows if I use reduce (https://www.refheap.com/27173)
01:35cnlahh, for a different reason though
01:36dsrxfunny how when we end up with stack overflows, that's also where we end up ;)
01:39akurilinzing!
02:41quizdrA little trip to the grocery store brought to my attention a most fascinating revelation about clojure.
02:46xuserquizdr: are you going to tell us? :)
02:50quizdryes i am
02:51quizdrplease allow 30 seconds for completion
02:51quizdrso, 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.
02:51quizdrhttps://www.dropbox.com/s/a5gbhhtpqg0hra3/Clojure%20Times%20Two.jpg
03:31koreth_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.
03:32fredyrkoreth_: yes i think so
03:32koreth_(And yes, make-the-name returns a Symbol, not a string)
03:32fredyrkoreth_: https://github.com/swannodette/om/blob/master/src/om/dom.clj
03:32fredyrkoreth_: here's an example
03:32koreth_Sweet, thanks.
03:37rurumate_is there something like doseq-indexed?
03:38rurumate_because I'm tired of creating let-scoped atoms for counting line numbers
03:38fredyrhmm i think ive seen something like that
03:39fredyr,(doc map-indexed)
03:39clojurebot"([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."
03:39fredyrnot really the same
03:39rurumate_almost but map is not quite the same as doseq
03:40fredyrapparently there was an indexed in contrib
03:40fredyrhttps://gist.github.com/halgari/4136116
03:41rurumate_splendid
03:44rurumate_I would prefer it like this: https://www.refheap.com/27189
03:47michaniskin(def indexed (partial map-indexed vector))
03:48michaniskini use that all the time
03:49rurumate_cool michanis
03:49rurumate_that's even more concise
03:49BrackiVery 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?
03:50Brackilein repl always tells me about CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context
03:50logic_progholy shit lighttable is awesome; I do have one concern now: how will light table make $ / ensure future development of light table?
03:50BrackiSo what exactly do I need to type once i started the repl?
03:53BrackiHm, so when do I use - or _?
03:53BrackiOr what's the reason that the directory leiningen contains _ instead of an -, yet the namespace is still with a -?
03:54michaniskinBracki: did you do (require 'some-stuff.core) first?
03:54quizdrlogic_prog what have you used before trying lighttable?
03:54michaniskinBracki: the _ is because java
03:54Brackimichaniskin: no I tried some_stuff first
03:54logic_progquizdr: emacs
03:55logic_proghmm, and the instarepl is broken
03:55michaniskinBracki: i mean, when you get a repl do: (require 'some-stuff.core) and then (in-ns 'some-stuff.core)
03:56michaniskinBracki: then you should be able to evaluate (foo) or whatever
03:56quizdrlogic_prog you like it more than emacs?
03:56logic_progquizdr: it's programmable in clojure rather than, say elisp
03:56quizdri 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
03:57logic_progyeah, it's slightly rough around the edgers for me too
03:57logic_progi.e. the instarepl is broken
03:57quizdri had a number of problems
03:57logic_proghowever, I thikn it's the future
03:58quizdri agree it has potential
03:58quizdri also think justin bieber has a lot of potential but he needs to be careful first
03:59auserhello all
04:00fredyrello!
04:01quizdrauser, allow me to join fredyr and wishing you a bon jolly hello, good sir or madame
04:01auserI'm a bit newish to clojure... I feel like I'm struggling a bit with a relatively trivial problem
04:01quizdrjoin the club
04:01fredyrauser: don't be shy!
04:01auserI am reading a bunch of files in a directory and want to grab a sequence of all the words in the file
04:02auserrather, a list of them
04:02auserI'm recursively walking a directory and able to get the lines in the file, but not split into words
04:03auserI feel like that can't be that difficult to do
04:03quizdrif you can post a gist of what you have (using github gist or refheap.com) it might be easier to assist
04:03auserI'll do it!
04:04auserhttps://www.refheap.com/d6a107cf9426ecdd15ea6bed6
04:04auserso basically I want to open each file in each directory and pull out the words in each file
04:05fredyrauser: if you want you can read files even more easily with slurp
04:06fredyr,(doc slurp)
04:06clojurebot"([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."
04:06auserinteresting
04:06auserdoesn't that load the entire file into memory tho
04:06fredyrit does?
04:07fredyrit returns the entire file as a string
04:07auserthe files are variable in size, so that could be reading a huge file
04:07fredyrsure
04:07auserokay, so I might be able to simplify it with slurp, true
04:08fredyrso you need to decide on the use case if it is suitable
04:08ausertotally
04:08fredyri'm just suggesting alternatives
04:08fredyrclojure.string/split seems fine to get the words also
04:08ausersure, so that's not complete, btw
04:08auserstill trying to split the lines into words
04:09fredyrauser: where is it that you run into trouble
04:09ausera few places
04:09auserwell... two
04:09auserso
04:09auserin 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
04:09fredyr(clojure.string/split (slurp "/Users/fredyr/afile.txt") #"\s") gets me there :)
04:09auserin some cases, I get nil
04:10auseroh
04:10auserreally?
04:10fredyryeah
04:10quizdr(inc fredyr)
04:10lazybot⇒ 3
04:10fredyrwee
04:10quizdri'm just getting warmed up mister!
04:11auserso I forgot, the actual error right now is: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.CharSequence from line 21
04:11auseris that because (doall) is returning a lazy sequence?
04:12auserI thought it makes it non-lazy
04:12fredyrmap is lazy
04:12auserwhich begs the question, why am I using it in the first place
04:12auseroh
04:12michaniskindoall ensures that it's not returning a lazy seq
04:12auserreduce*
04:12fredyr,(doc map)
04:12clojurebot"([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."
04:12ausergot it
04:13metellusauser: it's because string/split takes a string, but get-lines gives a seq of strings
04:13michaniskin,(doc doseq)
04:13clojurebot"([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."
04:13michaniskin(doseq [item coll] (prn item))
04:14fredyrauser: are you using some kind of repl when testing?
04:14auserI am, cider/nrepl
04:14quizdri would image things are not wise to try doseq on an infinite lazy collection, yeah?
04:16fredyrauser: its usually helpful to run and verify the results of each function in the repl
04:16auseryah
04:16ausergood idea
04:17fredyrauser: out of curiosity, are you @auser on twitter?
04:24auserfredyr: yep
04:24auserI am
04:25fredyrauser: i recognized it frmo there, youre one of my few followers :)
04:25auseroh yeah?
04:25auserI am?
04:25ausernifty
04:25fredyri'm @lexicallyscoped
04:25auserah cool
04:26auserah there you are
04:26quizdrfredyr now you gots even more followers
04:26fredyryay
04:27quizdrsweden eh? cold there this time of year? i was in berlin in September. I think I'd enjoy living Europe
04:27fredyrthe cold actually just got here
04:28fredyrwe've had a lousy winter before that
04:28fredyrbut now its like -5 and we've got some snow
04:28quizdrnice. good times.
04:28quizdri 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.
04:29fredyrlol
04:29fredyr(inc quizdr)
04:29lazybot⇒ 3
04:29auserhah hah haha
04:29quizdryay
04:50auseris it possible to get the position in a file that file-seq is currently in?
04:59fredyrdo you mean like the index or something?
04:59auseryeah
04:59auserexactly
05:01fredyrthere was some discussions earlier here on doseq with index
05:02fredyr(def indexed (partial map-indexed vector)) was suggested
05:02auseroh interesting
05:02fredyr,(def indexed (partial map-indexed vector))
05:02clojurebot#'sandbox/indexed
05:03fredyr,(indexed [1 2 3 4 5 6])
05:03clojurebot([0 1] [1 2] [2 3] [3 4] [4 5] ...)
05:06auserperhaps it would help for me to pastie
05:06auserI could actually use some help understanding how I'd implement that
05:06auserin my specific use-case
05:07auserhttps://www.refheap.com/d6a107cf9426ecdd15ea6bed6
05:07auserI want to parse that on line 23, I think
05:09auserfredyr, mind taking a quick gander at that real quick?
05:16auseroh nm
05:16auserdocs
05:43TEttingerauser, there's also ##(map vector (range) [1 2 3 4 5])
05:43lazybot⇒ ([0 1] [1 2] [2 3] [3 4] [4 5])
05:52fredyrauser: sorry time's up -- family calls
05:52ausernp
05:52auserI got it
05:52auserenjoy!
05:52fredyrty
05:52fredyru2
05:52fredyr:D
06:32quizdrhere's an odd one:
06:33quizdr,((juxt inc dec) 6)
06:33clojurebot[7 5]
06:33quizdrwell, i guess clojurebot doesn't like that one
06:34quizdrwhat'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])
06:35quizdrahh it should have been (map #((juxt inc dec) %) [1 2 3 4 5]) forgot to next the juxt
06:36quizdr*nest
06:39quizdrthat was a hard one clojurebot eh? i also stared at it for 3 minutes when I first saw it
07:35voldymancan someone suggest a library for websocket client?
07:35voldyman(with some documentation)
07:35AeroNotixaleph?
07:36voldymanAeroNotix: couldn't find the docs for it
08:15hyPiRion,(map (juxt inc dec) [1 2 3 4 5]) ;; quizdr
08:15clojurebot([2 0] [3 1] [4 2] [5 3] [6 4])
08:15hyPiRionoh, he left
08:32coventrycljs 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
08:33coventryAustin's example project compiles just fine for me, but I can't see what the key difference is.
08:37coventryNever mind, silly mistake.
09:37scape_using korma, or probably any jdbc, my mysql connection times out over time-- what's the typical method for keeping this alive?
09:38scape_otherwise when doing a query, korma barks back with a printed error statement-- not exactly great for a lnng running web app
09:50rurumate_scape_: I don't know about korma. In general your connection pool should take care of preventing timeouts
09:50scape_korma uses c3p0 and looks like it has a connection pool, but after a while of idle throws an error
09:51rurumate_ok, with c3p0 this should not happen. then it's a question of configuring c3p0 correctly
09:51scape_oh, interesting ok
09:54scape_max idle time is 10800, I should do some research on c3p0 :) here's my current connection setup for c3p0 http://pastebin.com/nJdTfD1Z
09:59rurumate_scape_: maxConnectionAge is 0, try a positive value like 14400
10:00rurumate_also set idleConnectionTestPeriod to 3600 or something
10:02rurumate_you can set the preferredTestQuery to something explicit like "select 1" or "select now()", not sure if it matters
10:07john2xi'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:08john2xwhat am I missing?
10:16scape_rurumate_: ok thanks, i'll try those settings
10:17AeroNotixugh, calling variadic functions?
10:18AeroNotixquite painful, huh
10:45AeroNotixhow would I make an array of http://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchEvent.Kind.html
10:47Cr8(into-array java.nio.file.WatchEvent$Kind [kind1 kind2])
10:47AeroNotixok, $Kind
10:47AeroNotixlemme try it
10:47Cr8yeah, "Inner" classes and interfaces are named by $
10:48AeroNotixGotcha, what's $ named?
10:48Cr8hm?
10:48Cr8I 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:48AeroNotixCr8: but I mean, what can I refer to the symbol as?
10:49AeroNotixDollar sign sounds stupid
10:49Cr8oh, *shrug*
10:50llasramYou can use '$' in Java classes just fine
10:50Cr8really
10:50llasramIt's not common, but Java doesn't complain
10:51Cr8ah yep
10:51Cr8and 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:51Cr8fun
10:52llasram"fun" yes
10:56hyPiRionEven better, you can use the same variable name for different types according to the JVM spec.
10:57hyPiRionnot legal in Java, but you can do it if you emit bytecode yourself
10:59llasramneat
11:00llasramLocal variables, for reference vs the prim times?
11:00llasramtypes even
11:00llasramActually, what am I talking about -- locals are just slots
11:01llasramI learned just enough JVM bytecode to accomplish one thing I needed via ASM and haven't gone back yet for a deep-dive :-)
11:41teslanickI 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:42teslanickI'm not sure how to attack this problem with the regex/string manipulation functions given.
11:42AeroNotixhttps://github.com/AeroNotix/awizo
11:42AeroNotixsomething quick for fs events
12:56shiranaihitois 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:58noonianif you define a variable in a namespace, other namespaces that require your namespace will have access to that variable
12:59shiranaihitonoonian: 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:00steckerhalteris there a prog1 in clojure?
13:01dnolensteckerhalter: no
13:02steckerhalterdnolen: ok, thanks
13:03llasramsteckerhalter: It's pretty easy to define yourself. But you don't need it as often as you might think
13:03noonianshiranaihito: 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:04noonianso namespace A will be evaluated the first time a file that requires it is evaluated
13:04shiranaihitonoonian: alright, thanks.. i realized i should probably just experiment with stuff, but couldn't resist the temptation to ask first :p
13:04steckerhalterllasram: yes, I just discovered it in elisp a few weeks ago and found it pretty handy for some cases
13:05shiranaihitook, good
13:05nooniannp
13:05shiranaihito:)
13:37afhammadwhat does <! do?
13:38bbloomafhammad: 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:39afhammadthanks
13:55auserhey all... question... what does this syntax mean: (concat val [::val])
13:56bbloomauser: which syntax? the double colon?
13:56auseryes, the double colon
13:56ausersorry
13:56bbloomcmd+f on the reader page <http://clojure.org/reader&gt; for "::"
13:57AimHere,(type ::val)
13:57auserkk
13:57clojurebotclojure.lang.Keyword
13:57auserinteresting
13:57bbloomturns out to be pretty damn useful :-)
13:57auserso then I don't understand the statement: (assoc-in trie (concat word [::val]) word))
13:57bbloomactually, those docs are a little dated. doesn't mention ::alias/keywords
13:58AimHereauser, it's a trie lookup, 'word', here, is treated as a sequence of keys to an associative structure
13:59AimHere::val is just the key to find the value at a node, rather than a subtree
13:59bbloomauser: what don't you understand about it?
14:00auserwell... 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:00auserMissing that piece
14:00AimHereA string is a sequence of characters
14:00bbloomauser: did you (doc assoc-in) ? :-)
14:00bbloomsee also get-in and update-in
14:00AimHere,(second "Wibble")
14:00clojurebot\i
14:00auseryeah, I've been staring at the docs
14:01auserhttp://clojuredocs.org/clojure_core/clojure.core/assoc-in
14:01auseroh
14:01auserwait, it's iterating over the word
14:01AimHere(concat word [:val]) just turns a string into a sequence of characters terminated by ::val
14:01auseryeah, got it
14:01auserI think
14:01auseryeah
14:02ausermakes sense
14:02AimHereIs the value at the end really necessary? If you know how you got there, you already have the sequence of keys you need!
14:03auserso 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:03ausernow i need to think about that one
14:03bbloomAimHere: it's cheaper to hold on to it than to recreate it
14:04AimHereWell the way it's done there is more expensive memorywise
14:04auserwhat would be more efficient AimHere ?
14:04bbloomAimHere: no it isn't, not if you're going to reconstruct the same string multiple times
14:05bbloomAimHere: each time you construct the string, you'll get a new object (sans string interning)
14:05bbloomAimHere: depends on the use case
14:06bbloomAimHere: 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:07auseractually, my usecase is having an object at the end of each path
14:08AimHereYou're not reimplementing scribblenauts in Clojure are you?
14:08auseroh no, but that sounds like fun
14:09auserI'm trying to make the most dead-simple search engine ever
14:09auserto learn clojure
14:11AimHereYou want something like: (grep-urls (slurp (str "http://www.google.com/search?q=&quot; (read-string)))
14:11auserokay, not THAT Simple
14:11auserthat was line 1
14:13auserhm, can you create an assoc atom?
14:13auser(def *trie* (atom {}))
14:13Anderken1sure you can
14:13auserI keep getting an odd error
14:13Anderken1refheap it?
14:13auserAtom cannot be cast to clojure.lang.Associative
14:13auseroh good idea
14:13Anderkentah, you need to deref it to read from it
14:13ausero
14:13Anderkentor use swap! to modify
14:14ausergot it
14:14auserwell, I understand
14:14auserjust not sure I *get* it in language yet
14:14Anderkentatoms dont care what's inside of them
14:14auserhttps://www.refheap.com/cd5132fd82df4e8a517bd0711
14:14Anderkentthey're just dumb containers
14:15auseroh, perhaps the swap! needs to be outside the anonymouse fn
14:15ausergr, fingers
14:15auseranonymous*
14:15auseralthough anony-mousee sounds delicious
14:18AnderkentI think what you ment to do is one of these two things: https://www.refheap.com/27393
14:18Anderkentbasically, the atom is *not* your map, your map lives inside the atom
14:19Anderkentyou 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:19auserhm, lemme look over it
14:20auserwell... I think I want to do the former for each "Add" operation
14:21auseryeah, that makes sense
14:21auserwith the swap
14:21auserbut I doubt that'll work for multiple words
14:21auseroh
14:21auserI guess it does
14:21auserfun
14:22auserAnderkent thanks for your help
14:22Anderkentno prob
14:32auserhm
14:33auserAnderkent mind if I ask one more quick q?
14:45joshuafcoleHow can I turn an arbitrary form (supplied dynamically) into a string?
14:45joshuafcoleThe form is bound to a variable.
14:57dnolen,pr-str
14:57clojurebot#<core$pr_str clojure.core$pr_str@1a111fd>
14:57dnolen,(doc pr-str)
14:58clojurebot"([& xs]); pr to a string, returning it"
14:58dnolenjoshuafcole: ^
14:58joshuafcoleFantastic, thanks
14:58joshuafcoleIt was tough to google because everybody mentioning s-expressions and strings is trying to read them from strings instead of printing them. :p
15:00Anderkentauser: you should just ask your question, someone will see it and answer eventually ;p
15:01auseroh yes, of course
15:01auserI'm trying to understand why the (concat) is in there
15:02Anderkentin where?
15:02auserhttps://www.refheap.com/27420
15:03ausernot sure why we have that concat in there
15:03auserthat's all
15:04AnderkentI just took it from your original example ;p
15:04auserno I know I know
15:04auserI found that example online and am just trying to parse it
15:04Anderkentit's just a question of what do you want your key to be
15:04Anderkenti agree the concat doesnt make much sense there
15:05auserI want to store an object as the terminal
15:05auserso right now
15:05auser{\h {\e {\l {\l {\o {:trie-add/val "hello"}}}}}}
15:05auserbut I want to add keys to that terminal object
15:07Anderkentwell 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:10AeroNotixI think I implemented a trie in Common Lisp, let me dig it out
15:11AeroNotixit'll be way different because mutability but you might see some similarities
15:11AeroNotixhttps://github.com/AeroNotix/algostructure/blob/master/Common%20Lisp/prefixtrie.lisp
15:14ausersorry, had a phone call, back
15:14auserI see
15:14auserAeroNotix so basically, I need to store associated information with the word
15:15AeroNotixUhh, I dunno what you mean by that.
15:15auserright, sorry... let me try again
15:15auserI'm reading a file and I want to store where in the file the word is located
15:16AeroNotixwhere according to what?
15:16auserso I want to be able to store the word and the line number
15:16AeroNotixso just loop your file and process the lines?
15:16auserin the file, so it's more of a node than a single word entry
15:16auseryeah, I'm doing that, I mean in the trie
15:16AeroNotixWhy do you need a trie for this?
15:17auserfor search
15:17auserso I am building an index of words in a file
15:18AeroNotixDoes this have to be an in-memory datastructure?
15:18auseror perhaps I can store a secondary map that holds object information, but I still need to add additional information to the trie
15:18AeroNotixcan't you use something like elasticsearch to do this for you?
15:18AeroNotixit's perfect for textual search
15:19auserwell, how does es do this then?
15:19gtraktpope: ping
15:19auserI'd prefer to do it without extra deps
15:19AeroNotixauser: why?
15:19AeroNotixsmells like NIH
15:20AeroNotixif this is server-side.....
15:20auserReally, I just want to be able to associate extra information at the terminal node of the trie
15:20AeroNotixotherwise, you just make a regular prefix trie but store line number as well
15:20AeroNotixYeah, what's hard about this?
15:20ausernot trying to solve a business problem, but a thought problem
15:21AeroNotixNode: {:char c :line 123 :pos N :subnode { ... }}
15:21AeroNotixor subnode(s)
15:21AeroNotixI'd use subnodes
15:21auserah yeah
15:23auserthanks
15:25auserI think I found a way, doing the operation slightly differently
15:25AeroNotixkeigh
15:28auserif it works, I'll update you AeroNotix, if you're interested
15:28AeroNotixauser: I'm not. But thanks
15:28auseroh, okay
15:39BrackiAnybod familiar with vim-fireplace? Once I press cqq to get the command-line window how do I execute code?
15:39Brackiy
15:48BrackiOr maybe anybody familiar with Korma can explain how exec-raw is supposed to work?
15:48bridgethillyercpp
15:50bridgethillyerI just execute in place in the source file (with cpp) instead of using the command line window
15:51BrackiOk.
15:51BrackiI was missing a (use foo)
15:51BrackiHence nothing worked.
15:52bridgethillyerThat 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:53AeroNotixsomething something cider-mode
15:53AeroNotixreally impressed with cider-mode, it's better than SLIME in some ways imho
15:54auserhm
15:55BrackiDoes clojure support multiline strings?
15:56tpopegtrak: sup
15:56fredyrBracki: not yet
15:56gtraktpope: 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:56gtrakseems like the design works out
15:56BrackiSo what's the way to have a longish string?
15:57tpopestill no
15:58gtraktpope: I might start one up then.
15:58tpopeokay
15:58tpopeyeah, waiting on me is not your best bet
15:58gtraknp :-), just curious if you had any more thoughts on it.
16:02RaynesBracki: Hit return.
16:02fredyrBracki: yes sorry, i was thinking about this one: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes
16:02RaynesBracki: https://www.refheap.com/27451
16:02RaynesThis works just fine.
16:03fredyrBracki: you can just have newlines in the string literals
16:03RaynesBracki: I think fredyr thought you were asking for heredocs.
16:04fredyrim blaming the whishey
16:04fredyrwhishkeyeys
16:04fredyr:)
16:04devnbtw, re: alternate quote syntaxes, does anyone, literally anyone who has been doing clojure for awhile
16:04devnthink that <<HEREDOC ... HEREDOC is a good idea?
16:04devnbecause it makes me ill just thinking about it
16:05devn"""""" is a big win because it would work for docstrings nicely.
16:05BrackiIs there any alternative to Korma for SQL stuff?
16:05dobry-dendatomic ;)
16:05devnBracki: http://www.clojure-toolbox.com/
16:06devnsee "SQL Abstraction"
16:06Raynesclojure.java.jdbc
16:07AeroNotixdevn: is anyone actually thinking about <<HEREDOC
16:07aaronj1335hey folks does anyone know where clojure.contrib.seq went in 1.3
16:07aaronj1335?
16:07devnaaronj1335: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
16:07devnit went nowhere.
16:07dobry-denWhen 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:07aaronj1335yea i saw it didn't have a listing, didn't know if that meant it was officially gone
16:07Brackidevn: 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:08devnAeroNotix: i dont know, but someone actually added it to Bracki: you can just have newlines in the string literals
16:08aaronj1335but it sounds like yes, yes it is
16:08aaronj1335thanks
16:08fredyrAeroNotix: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes
16:08devnBracki: can't you just batch your selects yourself?
16:08devnget the count and batch it
16:08devnwoops, thanks fredyr
16:08BrackiHow?
16:10devnBracki: select * from mytable limit 10000 offset 10000
16:10BrackiThe mysqldb lib in Python has a notion of a server side cursor, looking for something like that
16:11devni have no idea what that is
16:11Brackidevn: dealing with a weird query with lot's of left joins so it's hard to use LIMIT properly
16:11Brackihttp://dev.mysql.com/doc/refman/5.0/en/cursor-restrictions.html
16:12devnmysql is such a bummer dude
16:16BrackiAH, http://niwibe.github.io/clj.jdbc/api/jdbc.html#var-with-query
16:16BrackiThat's what I was looking for...
16:16BrackiWeird that Korma doesn't support it
16:20BrackiAlso, why isnt clj.jdbc on the toolbox site?
16:20tpopegtrak: is the public cljs-complete library at a point where I can try hooking it up?
16:21gtraktpope: I think you want nrepl-complete, cljs-complete is just the backend that parses the cljs analyzer.
16:21gtrakI'm working on releasing that now, but you can use it from git.
16:22tpopeokay cool
16:22gtrakI 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:22gtrakthen the nrepl client creates the "complete" op
16:23gtrakhere's that code, maybe helpful: https://github.com/clojure-emacs/cider/blob/master/cider-interaction.el#L547
16:24tpopegtrak: perfect
16:27devnBracki: make a PR to clojure-toolbox.com get jdbc added there
16:27devni actually wondered the same thing
16:27devnthere are some extremely outdated libs on the toolbox site also
16:28devnBracki: there's also http://www.clojuresphere.com/
16:47aaronj1335hey folks is there a way to do the {:keys [local1 local2]} trick outside the context of function args
16:48aaronj1335like if i want to return {:foo foo :bar bar} from a function
16:49shep-homeIs there an established pattern / library / function for polling a key of an atom until it is a certain value?
16:49michaelr525hello
16:49TEttingeraaronj1335, so you want the value of evaling foo and the key is :foo ?
16:50aaronj1335what up michaelr525
16:50aaronj1335TEttinger yea
16:50aaronj1335kinda like the let binding allows {:keys [foo bar]}
16:50michaelr525aaronj1335: everything is great. i've actually came here tonight to ask a question :)
16:50aaronj1335michaelr525 well i'm new to clojure, but who knows i might b able to help :)
16:51michaelr525a kid told me that he wants to get into programming, so immediately thought of my favorite language
16:52michaelr525i wonder are there resources for teaching kids to program in clojure (as first programming languages)
16:52aaronj1335c#??!!?!
16:52aaronj1335srsly tho that's a great question
16:52gfredericksask technomancy why he uses racket instead ;-)
16:52aaronj1335i've always thought of python as the easiest to learn, tho it's not my fav
16:52michaelr525i'm sure i'm not the first one to ask it too
16:53gfredericksI don't think I would recommend clojure for kids; it's elbow-deep in real-world-engineering-dirt
16:53michaelr525yea, i've seen many recommendations for python, but I'm hesitating to recommend it since I don't know python myself
16:54aaronj1335honestly michaelr525 as much as i hate to say it (cause i like clojure), it may not b a good one to learn on
16:54gtraktpope: any luck? I'm writing up some docs and releasing soon.
16:54aaronj1335i'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:55michaelr525technomancy: why do you use racket for teaching kids programming?
16:56michaelr525i'm actually going to ask him what he would like to program first, and i suspect it's mobile apps
16:57michaelr525in that case i'm pretty limited in the choice of languages
16:58aaronj1335michaelr525 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:58aaronj1335maybe that's a good approach for programming too
16:59michaelr525yeah well, but learning java as first language is kinda sad ;)
16:59TEttingermichaelr525, there's a few JS derivatives that are meant to be good for teaching IIRC
17:00michaelr525I actually like c# but java always feels so cumbersome and inellegant
17:00TEttingerand those are probably much easier to get running on a phone
17:01michaelr525TEttinger: like in a web browser one a phone?
17:01Bracki"Don't know how to create ISeq from: clojure.lang.Symbol" hm, how do I figure out where the symbol is returned...?
17:02TEttingerJack is a scripting language aimed at kids learning to program as well as professionals who yearn for a simpler language (like me).
17:02TEttingerhttps://github.com/creationix/jack
17:03michaelr525TEttinger: thanks i'll check that
17:04TEttingerit 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:05tpopegtrak: heading out soon, not going to get to it today
17:05gtraktpope: no worries, it's released though.
17:06gtrakI'll start work on var-info sometime.
17:06tpopecool, I'll let you know how it goes on my end
17:06gtrakwaiting to hear back from cider folks on what they might want
17:09TEttingermichaelr525, I'm kinda surprised that I'm surprised this exists http://zachbruggeman.me/dogescript/
17:11michaelr525TEttinger: ..
17:11TEttingermichaelr525, I'm just going through this list https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS
17:12michaelr525TEttinger: ok
17:17aaronj1335michaelr525 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:22gfredericksBracki: that particular error is often something in the (ns) form
17:22BrackiYeah just found it
17:22gfredericksbut in general those kinds of errors can be arbitrarily difficult
17:22michaelr525aaronj1335: hmm..
17:22BrackiClojure and JDBC integration is basically a mess.
17:22gfredericksit is?
17:22michaelr525aaronj1335: looks interesting
17:23dobry-denMaking an avatar upload system, how can you prevent users from uploading more than X bytes?
17:23BrackiAll the examples i found use the "old" API, but suddenly there's a new more "idiomatic" api.
17:23gfredericksyeah that happens when APIs change
17:23BrackiHalf is deprecated, requiring the dprecated one leads to weird errors etc..
17:23aaronj1335michaelr525 yea i went thru it, the first hour was basically just conditionals and loops. but seemed like a good start. i dunno.
17:23BrackiAs a newbie that kind of sucks.
17:23gfredericksBracki: the new API is somewhat easier
17:24BrackiNo not at all
17:24BrackiThe new API is undocumented
17:24gfredericksI learned it from the docstrings
17:25BrackiI don't even understand half of it.
17:26BrackiI'll just stick to Python in this case...
17:27BrackiI think it's weird for a major library to not include an example on how things work.
17:27gfredericksBracki: 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:27BrackiEsp. when all the search hits you get are polluted with the old one.
17:28gfredericksI saw a good set of examples the other day
17:28gfrederickslooking for them now
17:29Brackigfredericks: Thanks, I appreciate that
17:29Bracki.
17:29gfredericksBracki: the main ns docstring links here: http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
17:29gfrederickswhich is what I was remembering
17:32dobry-denI'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:32dobry-denHas anyone already done this?
17:33dobry-denBecause I'm fetching my shears
17:44BrackiArgh, java.lang.IllegalArgumentException: Don't know how to create ISeq from: com.mysql.jdbc.JDBC4ResultSet
17:45BrackiThese examples are great: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#SELECT
17:45inklesspenis clojurescript discussed here as well?
17:45BrackiBut they don't work with new API and I just can't get them to work.....
17:47tbaldridgeinklesspen: sure, all the time :-)
17:50inklesspenI saw an article about Om and decided I have to learn this system. But I have a couple of questions.
17:50inklesspenIf you need a library, do you look first for a JS library or a Clojure library?
17:50tbaldridgeinklesspen: well the author of Om (dnolen) hangs out here a lot.
17:52gfredericksBracki: check out the docstring for the query function
17:52tbaldridgeinklesspen: often a clojure lib, but wrapping JS libs isn't hard
17:53gfredericksBracki: the link I gave you before has query examples
17:53BrackiWhat does # and % mean?
17:54deadghost# function % interpolate
17:55mischov#(inc %) = (fn [x] (inc x))
17:55gfredericks# means various things
17:55gfredericks#() is a function
17:55dnoleninklesspen: there's an active #clojurescript channel now, but you can ask questions here too
17:56dnoleninklesspen: you can use JS libs, that's how Om works w/ React, but you lose the Google dead code elimination juice
17:57deadghostwhat is Google dead code elimination juice
17:57inklesspendnolen: 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:57inklesspendeadghost: the Closure js compiler can remove code which will never run
17:57gfredericksclojurebot: Google dead code elimination juice is part of this complete breakfast
17:57clojurebotYou don't have to tell me twice.
17:57dnoleninklesspen: 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:57deadghostwhoa whoa whoa
17:57deadghostso you're saying
17:58deadghostit can remove unused jquery
17:58dnolendeadghost: no only code that follows the Google Closure coding standards
17:58dnolendeadghost: so it works for Google Closure, and ClojureScript (we do the hard work for you)
17:58ivanhttps://developers.google.com/closure/compiler/docs/api-tutorial3#dangers
18:14aaronj1335i'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:15aaronj1335or do i just need to do (fn [arg] {:foo arg}) ?
18:15tpopeyes
18:16Cr8aaronj1335: remember that #(foo %) expands to something like (fn [x] (foo x)), not (fn [x] foo x)
18:16S11001001,'#(foo %)
18:16clojurebot(fn* [p1__25#] (foo p1__25#))
18:16Cr8so #({:foo %1}) == (fn [x] ({:foo x}))
18:16S11001001aaronj1335: you can do that to see what your #() thing expands to
18:17S11001001,'#({:foo %1})
18:17clojurebot(fn* [p1__50#] ({:foo p1__50#}))
18:18aaronj1335Cr8 ah i see, that's why the error was talking about function arity, b/c it was trying to apply {}
18:18aaronj1335,''#({:foo %1})
18:18clojurebot(quote (fn* [p1__75#] ({:foo p1__75#})))
18:20S11001001,'#(do {:foo %1})
18:20clojurebot(fn* [p1__100#] (do {:foo p1__100#}))
18:23Cr8,({:foo :a})
18:23clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
18:23Cr8,({:foo :a} :a)
18:23clojurebotnil
18:23Cr8,({:foo :a} :foo)
18:23clojurebot:a
18:26deadghost>look over clojurescript for the first time
18:26deadghostsweet jesus
18:26deadghostis it really as good as it looks?
18:30S11001001well ambrosebs hasn't ported core.typed to it yet, so
18:30hyPiRionis it???
18:30lazybothyPiRion: How could that be wrong?
18:30hyPiRion^
18:35Morgawrfor 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:41bbloomMorgawr: a screenshot would be nice :-)
18:43NotteWhy doesn't this function get realized even with doall? http://hastebin.com/gevuvobitu.lisp
18:43Morgawrbbloom: http://www.morgawr.eu/p/1390693226.png not much to show when it's not in motion
18:44Morgawryou 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:45dnolenNotte: doall is not recursive
18:46Nottednolen: i think i don't understand your point, but that fn doesn't realize with take also and doseq etc
18:47dnolenNotte: take is lazy
18:47bbloomMorgawr: oh, it uses the browser/system color picker. neat
18:47Morgawrbbloom: yeah, I started out thinking of making my own then realized html5 has input type as color picker
18:47Morgawrso.. why not :)
18:47dnolenNotte: doseq won't help you're producing a tree not a sequence
18:47Morgawrmade my work much much easier
18:48rm764Anyone 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:48MorgawrLightTable plugin system is pretty crazy, I love it so much
18:48dnolenNotte: ever result from tuples (which recursively produces a tree) is a lazy seq
18:48dnolens/ever/every
18:48Morgawrrm764: at which part do you get it?
18:48Morgawrusually you position the cursor over some code and eval it with ctrl/cmd+enter
18:48dnolenMorgawr: agreed, good stuff
18:49Morgawrdnolen: 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:49Nottednolen: but the first fn isn't lazy, is it?
18:50rm764Morgawr: 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:50dnolenNotte: it is since it delegates to the next arity
18:50dnolenwhich returns a lazy seq
18:53Morgawrrm764: heh, sorry I can't help, I've never used Om nor tried that tutorial :(
18:53Notteok, thanks dnolen
18:54bbloomMorgawr: 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:55rm764Okay, 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:58Morgawrbbloom: 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:03bbloomMorgawr: that black bar == the color swatch
19:03bbloomMorgawr: yeah, fire the click event immediately
19:04Morgawrbbloom: 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:17akurilinRandom question: do you guys use github over bitbucket for small teams with dozens of repos?
19:17akurilinI'm trying to figure out what people pay the $50-100/mo for
19:17akurilinJust the less-terrible UX?
19:18shep-homeIf I define a protocol in namespace A, and that protocol defines function `send`
19:18shep-homeWhy do I get warnings about redefining `send` when I do `(:require [A :as something])` ?
19:19shep-homeshouldn't it be underneath A, and not clobbering the define?
19:20OlegYchbitbucket repos are much slower than github
19:20dnolenshep-home: did you exclude `send` on namespace *A*
19:20dnolens/on/in
19:21OlegYchin 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:22shep-homednolen: 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:23shep-homeso the implementation `send` is overwriting it
19:23dnolenshep-home: yes, you need to exclude `send` from namespace `A` before defining your own
19:24shep-homednolen: In my case, I really want my defrecord to be in its own ns.
19:24shep-homeI'm just in the process of splitting an overly large file
19:24shep-homeand I guess I'm halfway though
19:27Morgawrbbloom: 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:27Morgawralso pinging dnolen cause I know he knows a lot about clojurescript/javascript :P
19:27dnolenMorgawr: like you want to generate a synthetic browser event?
19:28Morgawrwell, 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:28Morgawrbut when I call (.click myelement) it doesn't open the window
19:28Morgawr(if I add the :click event with my own lambda, like a println on console, it fires)
19:29shep-homednolen: apologies - I now get what you are trying to explain to me :-)
19:30warzMorgawr, perhaps there's a focus event or something that actually triggers the dialog
19:30warzinstead of click?
19:30Morgawrhttps://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement I'm checking this page
19:30Morgawrthe only relevant methods seem to be click() and focus()
19:30Morgawrmaybe select()?
19:31Morgawrnope, select doesn't work
19:38dnolenMorgawr: there is no such thing as a click method, you want synthetic events
19:38Morgawrdnolen: that mozilla page says there's a .click() method for InputElement :|
19:39Morgawrbut yeah, I want to raise the window for the color picker as if the user had clicked on the element itself, yeah
19:39rhg135i have a pretty fundamental question, if ISeqable is an interface how does String implement seq if it's a final class?
19:42dnolenMorgawr: if there's a way to raise the window w/o faking an event it will be a lot simpler for you
19:43Morgawrdnolen: I'd love to find out but I have no idea where to look, it's a standard HTML input element :(
19:43bbloompresumably light table has some dom operations in it somehow somewhere?
19:44Morgawrthis is not a LightTable problem, I'm really just writing javascript
19:44MorgawrI 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:45bbloomah, well triggering a click is possible, but i think it's kinda browser quirky
19:45bbloomfor security reasons, they might not show the dialog on a forced click
19:46Morgawrugh, so there might not be a solution to have the color wheel show without manually clicking? :(
19:47bbloompotentially :-(
19:47bbloomdunno for sure
19:47dnolenMorgawr: http://stackoverflow.com/questions/249192/how-can-you-programmatically-tell-an-html-select-to-drop-down-for-example-due
19:47bbloomoh chrome only is fine tho :-)
19:47dnolenMorgawr: would never do this normally because it would only work in Chrome but you're in LT so no big deal
19:47bbloomlight table uses webkit
19:47bbloomhurray singular platforms!
19:47dnolenblooberr__: well it's chromium I think it may work
19:48Morgawrdnolen: thanks! I'll check it out :D
19:48dsrxrhg135: 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:48Morgawrthis looks like such a dirty hack that it almost makes me feel excited :D
19:48dsrx,(instance? clojure.lang.Seqable "foo")
19:48clojurebotfalse
19:49rhg135figured as such
19:49rhg1350.0
19:50dnolenMorgawr: correction it doesn't appear to work in Chrome anymore, but the basics appear to work in LT
19:50rhg135damn
19:51rhg135so much for extansability lol
19:51rhg135in interfaces anyway
19:51dsrxrhg135: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L498
19:52rhg135ooh
19:52Morgawrdnolen: the basics? but yeah, I just tried and it doesn't seem to work.. lemme see if I made some mistakes
19:52rhg135it's hardcoded in the RT? wow
19:53bbloomrhg135: that's not that surprising when you consider protocols didn't come until much later
19:53rhg135i know but wow
19:54rhg135now i know why protocols exist
20:01bbloomrhg135: 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:03rhg135hmm
20:03rhg135bbloom, ya, i want to make strings represent http requests</dumb-idea>
20:04carkwhat's the predicate to know if an object is a function in clojurescript ?
20:05bbloomcark: either fn? or ifn? depending on what you want
20:05nooniancark: fn? and ifn?
20:05carkahyes, thanks
20:05bbloomit's basically fn-object? and callable? respectively
20:07rhg135hmm i should make a list of things that should not be iseqs
20:12Morgawralright 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:14edem_hi
21:02andyf_Bronsa: ping
21:03Bronsaandyf_: hi
21:03andyf_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:05andyf_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:05andyf_I can dig some more if that sounds incorrect
21:06Bronsaandyf_: 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:07andyf_double-checking ...
21:07Bronsaandyf_: might be that the new snapshot hasn't been published yet?
21:07andyf_false alarm -- I didn't update properly
21:08Bronsaoh, ok :)
21:09andyf_I do still see tag-kind in file validate.clj
21:11Bronsa... I'm an idiot andyf_
21:11andyf_Bronsa: I was an idiot first :-)
21:11BronsaI did not push the commit.
21:12dsrxI don't trust anyone who claims to be anything other than an idiot
21:13Bronsaandyf_: there, pushed now
21:13andyf_Bronsa: OK, I will actually update both of my local repos and retest
21:13chchjesusdsrx: But I'm a super genius
21:37carkhow can I tell if an object is a core.async chan ?
21:37cark(in clojruescript)
21:40nooniancark: looking at the source, you could probably use (satisfies? cljs.core.async.impl.protocols/Channel a-chan)
21:40carknoonian: yes, that's what i'm doing now, but this is easily breakable if the implementation changes
21:41carkthere really shoudl be a chan? function in the API
21:41noonianyeah, agree there should be a chan? fn
21:46dsrxadd it to your async-utils namespace that you copy between every project until it's inevitably added to the api :D
21:46kristofEvery day, someone is talking about core.async
21:46kristofpeople really like it, I guess
21:46carkit's really good =)
21:47carkdsrx: yes, i guess i'm up for that
21:47noonianespecially in cljs where everything uses callbacks
21:48kristofnoonian: 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:49carkkristof: i have a good use case, won't bother you with the whole story, but it's good
21:49kristofcark: the gist, then
21:49kristofcark: I was actually just referring to noonian's comment "especially in cljs where everything uses callbacks"
21:50carkahwell ...there it goes. I'm doing a routing library (just like url routing). if you consider an url my.domain/movies/1123
21:50carkmy routing is hierachical
21:50carkso movies is easy, it requires just a string comparison
21:51carkbut the movie id thing, it must matched with movie id's in a
21:51carkfrom a web service
21:51carkthis is asynchroneous
21:51nooniankristof: 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:51carkso my matching function sometimes takes strings an sometimes channels
21:52nooniani'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:53carki 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:54carkthe thing is, there could be more like this : my.domain/customers/12/invoices/5
21:54carkthere i need to match the string customer, then the chan customerid, then invoices (string) and again a chan for invoiceid
21:55carkmaybe some more data will come from other requests while i parse the url
21:55carkor apply the url really
21:55kristofnoonian: Ah, that makes sense.
21:55carkin the end, i have a nice map, with all the data required to display the page
21:56kristofcark: That also makes sense.
21:57carkand with all this asynchronicity going on, my calls look very much like regular code, no callback anywhere
21:58cark(go (display (<! (parse-url url))))
22:01ToBeReplacedcark: you might be able to do one better (take! (parse-url url) display)
22:01carkah indeed =)
22:03carki could make everything channels, wrap my string matcher in a channel too .... but that seems a bit overkill
22:07maravillascark: the uniformity might be nice, but barring that, why not just use string? instead of the satisfies? call?
22:08carkmaravillas: i might want to compare some data type that i din't think of
22:09kristofmaravillas: because string? is not the thing that doesn't exist, it's chan?
22:09carki'm not really parsing URLs, but a representation of these
22:09maravillasi see
22:09carkso the last case is the = matcher
22:27nooniani'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:27dsrxmust fight urge to prematurely refactor
22:27carknoonian: i'm actually trying it in a new branch, see how it performs
22:29dsrxcan i get around the 'protocol reloading in a repl' problem if i just defer protocol implementations to outside functions?
22:29dsrxe.g. (deftype Foo ISomething -whatever (foo-whatever))
22:29dsrxrather than inlining foo-whatever into the protocol implementation
22:32dsrxs/deftype/defrecord
23:05dissipateTrying to convince others to use Haskell is permitted between 0200 and 0500 UTC <---- is that a joke?
23:06kristofdissipate: blame ~bitemyapp for it
23:06kristofdissipate: but yes, it's a joke
23:17gfredericks,(doc aset)
23:17clojurebot"([array idx val] [array idx idx2 & idxv]); Sets the value at the index/indices. Works on Java arrays of reference types. Returns val."
23:17gfredericks"Works on Java arrays of reference types."
23:17gfredericksis that supposed to imply it doesn't work with primitive arrays?
23:18lemonodori'm having trouble getting my :test dependencies loaded. Am i doing something wrong? https://gist.github.com/wiseman/8628331
23:19lemonodor(lein 2.3.4)
23:19riley526So 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:19dnolenriley526: not yet written
23:20riley526dnolen: haha ok
23:20gfrederickslemonodor: you have two :profiles entries
23:20gfrederickspresumably the first one is being overridden
23:20lemonodoroh :) of course it would be something verrry simple. thanks!
23:21gfredericksnp
23:21lemonodorI guess it would be difficult for leoin to issue a warning in this situation, too.
23:22gfredericksI was about to say the exact opposite
23:22gfredericksI don't know for sure but I suspect it'd be an easy patch
23:23riley526dnolen: 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:24dissipatei know this might be OT but does anyone know the relationship between relevance and cognitect? is relevance a subset of cognitect?
23:24dnolenriley526: that's the way React people do it, so that's a valid solution
23:24riley526dnolen: feels very roundabout though
23:25riley526I'm not opposed to going with that
23:25dnolenriley526: some things in React are more work so other things can be easy
23:25riley526alright then
23:26riley526thanks for your input
23:26gfrederickslemonodor: if you feel like patching leiningen, I see the defproject macro uses map destructuring and you could modify that to check for dupes ;-)
23:26dsrxreact binds one-way from owner to child right?
23:29devnRE: kovas' post on the list. Is this any better?
23:29devn,(ns-resolve *ns* (symbol (str "map->" 'fooBar)))
23:29devni know it's still string munging, but his example seemed much more complex
23:29clojurebotnil
23:32devnor is there a way to track when the other constructors are created?
23:38gfredericksdevn: why would *ns* be the correct value?
23:38gfredericksprobably it's just user
23:45d11wtqAre there any clojure (or java) libraries that can convert fuzzy strings like "3pm tomorrow" into actual Date objects?
23:47d11wtqAh, found one! http://natty.joestelmach.com/
23:47devn_gfredericks: fair enough
23:47devn_gfredericks: simpler still:
23:48devn_,(defrecord fooBar [x y z])
23:48clojurebotsandbox.fooBar
23:48devn_,`~map->fooBar
23:48clojurebot#<sandbox$eval26$map__GT_fooBar__46 sandbox$eval26$map__GT_fooBar__46@10035f0>