#clojure logs

2013-11-30

00:19brainproxyis there an option for the cljs compiler to include the sources in the generated .map file?
00:36technomancyyaaay sweet new slamhound release with a fancy screencast from mr. guns: http://vimeo.com/80650659
00:36technomancy<3
00:42majykyeah that was impressive, I want to use slamhound now!
00:47bitemyapp(inc guns)
00:47lazybot⇒ 1
01:17bitemyapp`cbp: boo
01:19ivanthat was impressive, I am using slamhound now
03:03logic_progin core.async, is there any _non_blocking_ put? (a channel with 10 elements might still buffer/cause a wait)
03:05amalloylogic_prog: the point of >! is that it doesn't actually block, it just sorta registers a callback so that when there's room it can start back up
03:05logic_progwell no, suppose I need a "multiplexer of sorts"
03:05logic_progwhere on a update, I need to message 1000 different ports
03:05logic_progI think, if the first >! on the first port blocks, the other 999 don't receive their messages
03:05logic_progso >! doesn't block a java-thread, but it blocks the go-thread, no?
03:06amalloyso start a thousand go blocks. they're cheap, right?
03:06logic_progso I start a new go block for every message I need to send?
03:06logic_progfrom within a go block?
03:06logic_progI have never thought about coding like this
03:06nightflywelcome to erlang!
03:07logic_progthis is like saying: you need to go from LA to NY? dig your own tunnel from LA to NY, labor is cheap
03:07amalloyif you want to send to a thousand of them all at once, and you worry some of them may be unwilling to receive the message, that's the solution that jumps out at me; but i'm not a core.async expert
03:07logic_progare go blocks in core.async as cheap as erlang threads?
03:07amalloylogic_prog: that seems like a totally irrelevant analogy?
03:07logic_progit's a bad analogy
03:07logic_progbut something I previously thought was expensive
03:07logic_progis apparently now very very cheap
03:07logic_progand this is now warping my thinking
03:09logic_progalright, one more dumbass question
03:09logic_progis there something like "gops" where it lists all go processes/threads ?
03:10logic_progs/go/core.async/
03:11amalloyi'm pretty sure there isn't; i don't think it would be possible in cljs, and i'm not sure on the jvm
03:12logic_progso I'm writing multiple go blocks that while (while true ... blocks in them)
03:12logic_progand it's not clear to me when they'll get gc-ed
03:14amalloyi mean, never, right? you told them to work forever, and there's no way to stop that other than throwing an exception
03:18bitemyapplogic_prog: set up control channels with alts!
03:19bitemyapplogic_prog: or promises
03:19bitemyapplogic_prog: short-circuit the loops if you send something down those channels.
03:22amalloybitemyapp: promises? doesn't blocking on a promise go against everything core.async stands for?
03:22bitemyappamalloy: you don't block on the promise.
03:22bitemyappyou check realized?
03:22bitemyappcontrol channel is better.
03:23amalloyi guess that's okay, but it does seem like just a bad way of doing a control channel
03:23bitemyapplets you short-circuit without waiting for a run of the loop
03:23bitemyappamalloy: the suggestion was an artifact of something I did that didn't involve core.async
03:23bitemyappI'm just putting options out there
03:23bitemyappif I have to hold the standards of everything I toss out there to perfection, nobody gets any help
03:24bitemyappso it's best not to be petty and disincentivize contribution when they're really not that bad or far off and the trade-offs are understood.
03:32logic_progamalloy: do you have a blog? your insight of "create a new go block" is changing the way I think about core.async/cloojure
03:33amalloyhaven't blogged anything for like three years. also haven't written any core.async
03:33logic_progi've been playing with erlang recently, and this allows me to work in some erlang style error techniques
04:00bitemyapplogic_prog: http://github.com/michaeldrogalis/dire/
04:00logic_progyeah
04:00logic_progsaw that today
04:01logic_progvery nice
04:30makkalothi, having to use global variables when doing testing in clojure seems broken to me, can't i just pass arguments from fixture to testing function ?
04:38bitemyappmakkalot: let
04:39makkalotwhen i do let, variables are not passed from fixture to test , any example ?
04:39bitemyappmakkalot: let inside the test
04:40makkalotbitemyapp, then what is the purpose of fixture ?
04:40amalloyfixtures can only perform side effects, really
04:40bitemyappyou're the one complaining about using fixtures.
04:41makkalotbitemyapp, not complaining trying to figure out the way of proper testing without defining lots of globals
04:42makkalotamalloy, that makes more sense
04:43yedibitemyapp, are you callen
04:44logic_progI would like to validate a string vs a regex. In particular, I want to take a string, and strip out all characters taht does not satisfy [a-zA-Z0-9]. So for example "../foo" becomes "foo"
04:44logic_progHow do I do this in clojure/java ?
04:46Rhymor_,(apply str (re-seq #"[a-zA-Z0-9]" "../foo"))
04:46clojurebot"foo"
04:47Rhymor_don't know bout performance
04:49logic_progthis is fine
04:49logic_progit's amking sure no one is doing funky things in their username
04:49logic_progthanks for the code line
04:52amalloyyedi: yes
04:53alsmThis is probably really simple but how can I replace the whole content of a vector in an atom when doing a swap! ?
04:53yedino wonder i was so entertained by their msgs
04:54alsmI have a two value vector and a function that returns two values, I want to change the original with the two values from the function
04:55Rhymor_alsm: does your function return a vector, or a sequence? Do you want to pass the old vector as a parameter?
04:58alsmlet me just check, I think I return a vector and I do pass the elements of the old one as parameters
04:58Rhymor_alsm then that's just what swap! does.
04:58alsm(swap! me (next-location (first @me) (second @me) (second robo-info) 15.0)) is the line
04:59alsmand I get Exception in thread "main" java.lang.IllegalArgumentException: Key must be integer
05:00alsmreferencing that line in my code
05:00Rhymor_,(doc swap!)
05:00clojurebot"([atom f] [atom f x] [atom f x y] [atom f x y & ...]); Atomically swaps the value of atom to be: (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects. Returns the value that was swapped in."
05:01Rhymor_I take it next-location does not return a function?
05:01alsmnope
05:01Rhymor_You want something like (swap! me #(next-location (first %) (second %) ...
05:02alsmprintln on it's output shows a vector; [-0.20089877715863735 51.49498633535638]
05:02Rhymor_In your line you are passing the result of the next-location call to swap! instead of a function
05:03pepijndevosIs Docjure still maintained? It seems to have a lot of unmerged pull requests
05:03alsmahh, ok, thanks
05:03francis_wolkehttp://common-lisp.net/project/bknr/static/lmman/toc.html
05:04francis_wolkeIs anyone able to see the contents of the links on that page?
05:04francis_wolkeWait.
05:04francis_wolkenevermind
05:18alsmRhymor_: thanks, sorted that now.
05:18Rhymor_yw
05:27makkalothow do you unit test core.async on clojurescript ?
05:31amalloyi think that's still in the "banging rocks together" phase, makkalot, although maybe dnolen knows of something
05:33makkalotamalloy, take! doesnt work on clojurescript right ?
05:34amalloyisn't that blocking? if so, it clearly wouldn't be implemented for js
05:35makkalotamalloy, yeah
05:36makkalotamalloy, my tests are finishing before my go block finish
05:37amalloyi have no idea how to test cljs, let alone core.async
05:37makkalotamalloy, thanks
05:45yedi(inc bitemyapp)
05:45lazybot⇒ 15
05:53dsrxwas going to suggest makkalot look at the core.async cljs tests for inspiration
05:55solidus_why is pprint throwing exception: RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:219)
05:55solidus_it happens when i try to pprint expandmacro output
06:01modulusHi there. Is there a way to do conditional binding, so if x is true, y gets bound to z, otehrwise to w, and then code runs using the value of y?
06:03Rhymormodulus: (let [y (if x z w)] ())
06:03PupenoIs the book The Joy of Clojure still good or is it out of date?
06:03modulusah, so i'm allowed to use if expressions on let bindings...
06:04modulusshould have guessed, thanks a lot!
06:04arcatanyou can use any expressions there
06:05modulusbecause of the vector form of it i had the impression that i could not
06:06modulusthat's going to simplify my code some, i was going to put the post-binding code on an anon function and do (if x (let [y z] (anon) etc
06:09jph-does clojure handle open paths like "~/.config"
06:10jph-or do i have to lookup $HOME and create/expand the path string?
06:11llasramEmpiricism will answer many questions :-)
06:11llasramBut turning `~` into the user home directory is a shell feature, not an OS feature
06:12jph-yeh i know, i wasnt sure if there was any automagic baked in
06:12arcatani don't think there's a function do that in the standard library
06:13jph-guess i'll lookup $HOME then
06:13llasramClojure just uses the Java facilities there on the JVM. The older File class I don't believe does, but the Java 7 Path class may
06:13jph-yeh i come from rubyland, i dont know the java std library yet
06:14arcatanjph-: i guess the java way of looking it up would be (System/getProperty "user.home")
06:15jph-yeh i just figured i'd ask here instead of googling for a change
06:15jph-:)
06:27alsmDoes anyone know why the following loop might work once then get a null pointe exception?
06:27alsm(while (not (empty? @robots))
06:27alsm (do (let [[robo-id robo-info] (first @robots)]
06:27alsmI haven't included the rest of the body
06:28alsmrobots is an atom with a priority-map
06:28amalloymodulus: generally in clojure every expression has a value (even if it's nil), and you can use any expression in a context where a value is expected. if, let, and so on aren't special "statements"
06:28amalloyalsm: because all the code you decided not to include mangles robots in some way
06:29alsmpretty sure it doesn't, although something outside it does update it
06:29xificurCHi, I am working through some code from 'Clojure in Action' but I have trouble with the simplest things. I have a lein project with two files in src/chapter08 - date_operations.clj and date_operations_spec.clj . However when trying to evaluate (ns chapter08.date-operations-spec (:use chapter08.date-operations)) I get an error saying the file is not on my classpath
06:30amalloymodulus: eg, you can even use another let inside the right-hand side of a let: ##(let [coords (let [xs [-1 0 1]] (for [x xs, y xs] [x y]))] coords)
06:30lazybot⇒ ([-1 -1] [-1 0] [-1 1] [0 -1] [0 0] [0 1] [1 -1] [1 0] [1 1])
06:30alsmis there not a way for it to reevaluate reference when it loops?
06:30amalloy(that's usually not the most readable choice, but sometimes it can be nice)
06:31llasramxificurC: FYI, /Clojure in Action/ is quite out of date. Are you sure the "not found" is for the included source namespace, and not for a missing obsolete contrib namespace?
06:33xificurCllasram: I know its a bit out of date but I thought it might be a nice start. I only have that one :use inside the ns, so it has to be it
06:34llasramxificurC: refheap the full stack trace?
06:35llasramxificurC: And it's really, really out of date. Principles haven't changed, but you'll have a struggle to get any big chunks of example code working due to the contrib changes
06:37xificurCllasram: https://www.refheap.com/21366
06:38xificurCllasram: really? well thats a shame
06:39llasramI think Amit said at the Conj that he's working on a new edition, but understandably has his hands full with other things
06:41llasramHuh, yeah, totally just can't find `chapter08/date_operations.clj`. Double-checking filenames is the only concrete suggestion I have ATM :-/
06:41xificurCllasram: so is there another book/resource with some real code examples (that preferably arent 10 lines long)?
06:42llasramAre you just looking for larger chunks of code to read?
06:42xificurCllasram: well, some explanation of the code would be nice too
06:43xificurCthe names are ok, can there be something wrong with my setup?
06:43llasramAssuming you launched your REPL from inside the Leiningen project, nothing obvious comes to my mind
06:44azsxdcfvgbhnjmciao a tutti
06:45llasramxificurC: If you want a book, /Clojure Programming/ (Emerick, Carper, & Grand) has a few longer examples
06:46xificurCllasram: I launched it from a project's subfolder I think.. restarting it helped.. I feel like IT Crowd'd
06:46llasramHeh
06:46llasramxificurC: But there's plenty of readable code in real projects. I actually think Leiningen is a good place to start. It's well designed, the code is clear, and is something you're already actually using :-)
06:48xificurCso theres 'Clojure Programming' and 'Programming Clojure', nice
06:48llasramYeah... May actually be worse than Scala's /Programming Scala/ vs /Programming in Scala/
06:49xificurCllasram: thanks for the tips. I am not just learning the language but also trying to learn how to program, ehm, right?
06:49xificurCmy daily job is VBA coding which holds me pretty far from right :)
06:49llasramAhhhh
06:50llasramWell, I think reading real well-designed code is going to be the biggest help there. That's been my experience anyway!
06:53xificurCllasram: yeah thanks :) If you feel like giving more pointers, here is what I played around with yesterday https://www.refheap.com/21367 based on this http://rosettacode.org/wiki/Flipping_bits_game
06:57llasramxificurC: Cool! I don't have the attention to dig too deeply, but one comment: I see you calling `recur` (and `loop`) several times. In practice, you can usually avoid explicit recursion/looping by using `map` etc or `reduce`, usually making your code clearer and more flexible in the process
06:59llasramOh, and just because I both love and hate `>`/`<` in lisps: (and (> fst-int 47) (< fst-int 58)) -> (< 47 fst-int 58)
07:02amalloyxificurC: it's not clearly "better", but you might note that (if x (grid-indices grid :row foo) (grid-indices grid :col bar)) could be written as (apply grid-indices (if x [:row foo] [:col bar]))
07:03xificurCllasram: thanks for the < > tip! I try to use map/filter/reduce all the time so when you see a loop/recur it means i didnt know how to write it otherwise
07:03amalloythat pattern seems to come up a few times in your code, so surely at least once it would help to switch to my way :)
07:05amalloyxificurC: line 59 looks kinda like (let [goal (first (drop-while #{grid} (iterate shuffle grid)))])
07:07amalloythe loop in line 28 is another iterate: you want (nth (iterate (fn [grid] ...) grid) (* 3 n))
07:11xificurCamalloy: thanks for the tips! On the last note - what you suggest creates a list of steps of the shuffled grids and then taking the nth of it, correct?
07:11amalloyyeah
07:11xificurCwouldnt think of that in a year
07:11amalloyit's a handy pattern to keep in mind
07:11amalloycomes up a lot
07:12xificurCI was thinking more in the terms of repeat first but that doesnt work (or wouldnt know how it would)
07:12xificurCthe imperative mind
07:12amalloyfwiw i'd probably actually write it as (-> grid (->> iterate (fn ...)) (nth (* 3 n)))
07:13amalloybut if you're not comfortable with all the arrows yet, the original way is fine
07:13amalloyer, (-> grid (->> (iterate (fn ...))) (nth (* 3 n))). all these parens are tricky to get right in irc sometimes
07:14xificurCamalloy: arrows are nice
07:14xificurCthanks for the tips
07:14xificurCnested arrows, thats a bit trickier
07:15xificurCI'll have to dwelve on that for a day
07:15xificurCdoes the overall design make sense though?
07:16amalloyeh, i dunno. i was looking through a microscope
07:16amalloydidn't look atrocious, but i didn't try to figure out what the overall goal is
07:18xificurCamalloy: okay, thanks a lot
07:18xificurC
08:12dsrxamalloy_: enable paredit in ERC, problem solved ;)
08:16jph-gotta say, coming from ruby, clojure feels like a functional ruby
08:16jph-at least it's dead easy to pickup
08:28jph-what's the sexy web framework of the moment with clojure?
08:41heizHello! Tell me please how I can enable leiningen profile by default. I expect I need override default profile or something like that...
08:42cYmenGood morning!
08:43justin_smithheiz: maybe you want lein with-profile :something ...
08:45heizI have some profile, but I don't want run "lein with-profile some-profile" each time.
08:45hyPiRionheiz: Just place stuff directly in the project.clj profile, or if you want to have this on a user-default basis, put the details within the :user profile in ~/.lein/project.clj
08:46hyPiRionI meant ~/.lein/profiles.clj
08:46cYmenoohh..could I use that to always have clojure/tools.trace available in my repl?
08:47justin_smithcYmen: for that use ~/.lein/profile.clj :plugins
08:47llasramcYmen: That sort of thing is pretty much what the :user profile is for :-)
08:47justin_smiththat is how I make sure I always have criterium at dev time
08:47heizBut what if I have two profiles which I want to be able to switch.
08:47hyPiRioncYmen: sure thing, but be a bit careful when doing that in a project which either has some stuff tools.trace depends on, or tools.trace itself
08:48cYmenWhy?
08:48clojurebotWhy is why
08:48justin_smithversioning for example
08:48justin_smithor things working locally and not on deploy
08:48heizIndeed I don't understant the line "The :default profile is defined to be a composite of [:base :system :user :provided :dev], but you can change this in your project.clj just like any other profile." from leiningen tutorial
08:49justin_smithheiz: it merges all of those profiles to construct default
08:49hyPiRioncYmen: It may break the project because you enforce some other version of the dependency
08:50heizHow can I add my profile to this list of profiles?
08:52justin_smithheiz: lein with-profile takes a comma separated list of profiles to use
08:52justin_smithyou can make a shell script if you find that tedious
08:52hyPiRionjustin_smith: or lein aliases :)
08:53justin_smithhyPiRion: a shell alias? or is there a lein alias command I have not upgraded to yet?
08:53hyPiRionhttps://github.com/hyPiRion/dotfiles/blob/master/.lein/profiles.clj <- lein math sets up some dependencies and imports their names
08:53justin_smithahh cool, so much to learn
08:58cYmenGeneral question: Do you usually create a leiningen project for repl experiments?
08:58stdev@cYmen yes because vim-fireplace
08:59justin_smithI usually start with an existing project with similar enough dependencies, up to a certain complexity
08:59stdev(equally applicable to M-x nrepl connect, non)
08:59justin_smithstdev you likely mean nrepl-jack-in
09:00stdev@jph- looks like compojure and mustache to me
09:00justin_smithI prefer to start repls from the terminal regardless, and connect by port
09:00stdev@justin_smith yeah that one
09:00stdevbeen bouncing between emacs+nrepl, slimv, and fireplace tring to find what i like
09:00justin_smithalso you can nrepl-jack-in from a non-project dir, you just get a default non-project repl iirc
09:01stdevkeeo forgetting whats what
09:01jph-stdev: im trying out caribou atm, seems interesting
09:01stdevbut you don't get dep-management, right?
09:01stdev@jph- sweet, will peek
09:01jph-stdev: http://let-caribou.in/
09:01jph-comes with a nice video
09:02justin_smithstdev: yeah, lein just gives it a projectless repl
09:02jph-and admin/migrations/etc baked in
09:02justin_smithso another option is not making a project yet, and using pomegranate to load dependencies
09:02justin_smithbut I find the pomegranate syntax a little clumsy, easier to edit a project.clj
09:02stdevooh! today i learned and it's not even 9 here yet
09:02justin_smithjph-: oooh you're talking about the thing I helped write
09:02stdevthank you @justin_smith, @jph-
09:03jph-justin_smith: i'm used to padrino in rubyland, and caribou feels very familiar
09:03jph-i lvoe the web-based model generation, perfect for a lazy dev like me
09:03rubber-duckis there a naming convention for async functions (ie. functions that return aync channels) ?
09:04justin_smiththe lineage is that the senior partner at my company made a rapid website builder with a cms in php - and hammered out lots of websites real fast and built a company. Then they upgraded to ruby because php can get hard to maintain. Then they upgraded from ruby to clojure because ruby inflates hosting costs
09:05justin_smithjph-: cool. glad you like it.
09:05jph-justin_smith: it'll be interesting to see how it works as i get further in
09:05jph-i haven't had to learn a whole bunch of weird rake tasks (or equivalent) to do anything yet
09:05cYmenamalloy_: Is there any way to view solutions with low code golc scores on 4clj?
09:06justin_smithjph-: keeping things simple and frictionless to use is a big priority
09:06rubber-duckis something like (<! (xhr-async)) or some variant prefered over standard (<! (xhr)) :\
09:06justin_smithjph-: I have coworker that are hired for their creative / visual skills and ability to translate that to html, and they need to be able to use caribou
09:07justin_smith*coworkers
09:07jph-justin_smith: if it stays like padrino (ie, a bit more helpful than sinatra, without bloat of rails) i'll be very happy
09:07justin_smithjph-: if you find issues or suggestions, feel free to get in touch
09:07jph-im very new to clojure so i was curious which frameworks had mindshare and active dev
09:07jph-so first up is caribou :)
09:07jph-the tutorial video really sells it
09:07jph-simplicity wise
09:08jph-reminds me of the rails "make a blog" tutorial 5+ years ago, only better
09:08justin_smithI don't know about mindshare, but we have a couple of us working at my company that use it nearly full time, and work on the project itself when not using it to do client stuff
09:08justin_smiththanks
09:09justin_smithwe had a big todo list about things to streamline to make things that turnkey
09:09justin_smithit was worth it
09:09jph-if you havent heard of padrino, take a look, it's awesome and incredibly unfortunate so few know about it
09:09jph-i love padrino since it hits the sweet spot
09:10jph-caribou kinda looks like it's similar
09:12justin_smithyeah looks like we have some similar priorities (keeping compatibility and flexibility with other libs, providing a nearly complete stack of functionality out of the box, easy to create and insert template helpers)
09:12jph-yep
09:12justin_smithI think my next todo is non-sql storage
09:12jph-why it feels so familiar :)
09:12justin_smithfor datomic, neo4j, etc.
09:12jph-yah
09:12jph-that's the other nice thing with padrino, lots of ORMs, lots of backends
09:13jph-basically sinatra with lots of cool stuff pinched from rails
09:13jph-and elsewhere
09:13justin_smithwe support h2 / mysql / postgres
09:13jph-yep
09:13jph-how soon should i ditch h2?
09:13jph-heh
09:14jph-is it the equivalent of sqlite?
09:14jph-never used it before
09:14justin_smithit is a local in-process sql
09:14justin_smithwith a single file on disk
09:14jph-only for dev then
09:14justin_smithyeah - it is there to make first bootup and experimentation seamless
09:14jph-what's the right approach for serving a caribou site? reverse proxy via nginx or straight to web
09:14glosolihmm caribou does look interesting
09:14justin_smithso the first step of the tutorial isn't "install and configure mysql or postgres"
09:15jph-justin_smith: yeh that's perfect
09:15jph-the padrino equiv defaults to sqlite
09:15stdev(that said it holds up shockingly well for single/low user envs)
09:15stdev(h2, that is)
09:15jph-yep
09:15justin_smithjph-: we have been using war inside tomcat behind nginx and varnish
09:15jph-justin_smith: oh packaging up the webapp as a war?
09:15justin_smithbut I think we can use http-kit and drop tomcat and nginx out of the stack
09:16jph-is there any doco on that on the caribou site?
09:16justin_smithit is a feature of ring
09:16jph-or jsut track down generic clojure/war/tomcat serving info should be ok?
09:16justin_smithlein ring uberwar
09:16jph-ahh
09:16jph-yes i've seen that mentioned
09:16justin_smithit should be mentioned on the caribou docs if it isn't
09:17justin_smiththe thing is, I was looking at some benchmarks, and directly using ring+httpkit without the tomcat layer would boost performance
09:17justin_smithbut that means replicating the other things tomcat does
09:17jph-ahh
09:17justin_smithlogrotate, service interface
09:17justin_smithetc.
09:17jph-whatever is nice and simple
09:17stdevwar protocol is p solid despite the computational overhead
09:18stdevi wanted to hate it
09:18justin_smithsimple is a variable of scale - for a one of java -jar is simple, for a big project, service tomcat restart is invaluable
09:18stdevbut couldn't
09:18noncomwhat is the clojure equivalent for javas MyClass.class
09:18noncom?
09:18justin_smith*one off
09:18jph-justin_smith: just keep it simple, that's what is attractive
09:18jph-dont take it to the dark side of java
09:19justin_smithnoncom: maybe (. Class forName "MyClass") ?
09:19justin_smith,(Class/forName "java.lang.Integer")
09:19clojurebotjava.lang.Integer
09:20noncomyes, looks like it is
09:21justin_smithnoncom: wait
09:21justin_smith,(class [])
09:21clojurebotclojure.lang.PersistentVector
09:21justin_smithI think that is what you want
09:21noncomthat's getting a class of an instance
09:21justin_smithahh, right
09:21noncombut the first one you said is more like MyClass.class
09:23xificurCjavadoc opens a window with really small and unreadable documentation, is that normal?
09:23xificurCI dont even see how to zoom in or anything
09:23pepijndevosWhat was this nice idiom to append to a key in a map or create it if it doesn;t exist?
09:24justin_smithxificurC: what UI?
09:24xificurCjustin_smith: hm?
09:24xificurCI am running nrepl inside emacs if thats what you asked
09:25justin_smith,(update-in {:a [0]} [:a] conj 1) ; pepijndevos
09:25clojurebot{:a [0 1]}
09:25justin_smithxificurC: does the javadoc open in an emacs buffer or a browser?
09:25xificurCjustin_smith: it opens in a jframe i guess
09:25xificurC#<JFrame javax.swing.JFrame[frame1,32,32,700x900,invalid,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,5,25,690x870,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]>
09:25pepijndevos&(update-in {:a [0]} [:b] conj 1)
09:25lazybot⇒ {:b (1), :a [0]}
09:25pepijndevosah ok
09:26justin_smith,(conj nil 1) ; pepijndevos
09:26clojurebot(1)
09:26justin_smiththat is what it is effectively doing
09:26pepijndevosgot it
09:27pepijndevosI did Python for a while so now my head is fille with {}.setdefault and other crazynes
09:27hyPiRioneventually use fnil to set type of list
09:27hyPiRion,(update-in {:a [0]} [:b] (fnil conj []) 1)
09:27clojurebot{:b [1], :a [0]}
09:27hyPiRion,(update-in {:a [0]} [:a] (fnil conj []) 1)
09:27clojurebot{:a [0 1]}
09:27xificurC,(doc javadoc)
09:27clojurebotexcusez-moi
09:27justin_smith,(update-in {:a [0]} [:b] (fnil conj []) 1)
09:27clojurebot{:b [1], :a [0]}
09:28justin_smithxificurC: I bet there is some env variable that would tell the jframe to use a better font
09:30xificurCjustin_smith: any tips where to search for it?
09:30justin_smithhmm
09:31justin_smithfor me, javadoc opens a window in chrome
09:31pepijndevos<3 fnil
09:31xificurCjustin_smith: I'd appreciate FF too
09:32justin_smithxificurC: I think mine is using my default browser
09:33justin_smithit looks like it is calling browse-url
09:33cYmenhmpf
09:33cYmensometimes I think all those fancy modern IDEs have left me unable to remember the most common and simple argument orders
09:34justin_smithxificurC: (when *open-url-script* (sh/sh *open-url-script* (str url)) true)
09:34justin_smithxificurC: I bet you that is a dynamic binding that you can shadow
09:34justin_smiththe fallback is open-url-in-swing, which is clearly what is being called in your case
09:37xificurCjustin_smith: so how would you get it to open in firefox or even inside emacs?
09:37justin_smithxificurC: first, we have to find out where *open-url-script* is resolved
09:37justin_smiththen, bind it in a binding form
09:37justin_smithpointing at the shell script to call
09:40xificurCI did (use 'clojure.java.browse) and then (binding [*open-url-script* "firefox"] (javadoc SimpleDateFormat)) which opened it in firefox
09:40xificurChow can I make that the default binding on start?
09:41justin_smithhmm
09:41justin_smithit is using xdg-open-loc
09:41justin_smithhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/java/browse.clj#L21
09:43justin_smithoh!
09:44justin_smith*open-url-script* should be an atom
09:44justin_smithso you can use reset
09:45justin_smiththat is, reset!
09:45justin_smithxificurC: what OS are you on?
09:46xificurCSlackware 14.0
09:46justin_smithI wonder if the xdg stuff does not work with your desktop
09:46xificurCso you meant something like (reset! *open-url-script* "firefox") ?
09:46justin_smithyeah, it looks like it should be an atom, so that should work
09:46justin_smithI had not realized before it would be an atom
09:46xificurCgetting a NullPointerException
09:47justin_smithyeah me too
09:49xificurC`which xdg-open' returns /usr/bin/xdg-open
09:49justin_smithweird
09:49justin_smithyeah, there is some magic going on with that dynamic atom that I don't get
09:49xificurCheh
09:52xificurC(clojure.lang.Reflector/invokeStaticMethod "java.awt.Desktop"
09:52xificurC "isDesktopSupported" (to-array nil)) from open-url-in-browser returns false
09:53justin_smithxificurC: returns true here
09:53justin_smiththat is our difference
09:54justin_smithhttp://stackoverflow.com/questions/8258153/how-to-get-desktop-class-supported-under-linux
09:54justin_smithseems you need gnome installed
09:54justin_smitheven if you don't have gnome running?
09:54xificurCjustin_smith: yes but why can't i just rebind *open-url-script*
09:54justin_smithI have no clue
09:55justin_smiththere is something weird going on there
09:55justin_smithit is a special var, not bound in my thread
09:55justin_smithwhich is not too abnormal for something declared :dynamic
09:58justin_smithlikely your options are to fork javadoc so you can get something simpler and controllable, or get java to recognize xdg on your system (likely involving gnome installation)
10:00xificurCjustin_smith: I did this: (defmacro jdoc [sym] `(binding [*open-url-script* "firefox"] (javadoc ~sym)))
10:00justin_smithcool
10:01xificurCjustin_smith: but I'll lose that the moment I close emacs or nrepl, where could I put it so it auto-loads?
10:03justin_smithyou could put it in a project and lein install that project, and make it a deps in your profiles.clj under the :user key
10:03justin_smithor make it an :injections task to evaluate that macro def
10:03justin_smiththe former probably makes more sense
10:04xificurCsounds like ten things I have never done yet, so let's try it!
10:04justin_smiththat's the spirit!
10:17xificurCjustin_smith: I created a new project and put the macro in its core.clj but when I eval it and try to run it in nrepl it doesnt seem to treat it as a macro
10:17xificurCit tries to evaluate the argument and fails
10:17justin_smithwell that's weird
10:19xificurCjustin_smith: https://www.refheap.com/21369
10:20justin_smithtrying switching to that ns
10:21justin_smithhttp://sprunge.us/YdFQ
10:21justin_smithit kinda worked here, but it got me the URL in crome instead of firefox
10:32xificurCjustin_smith: it works for me with java.lang.Integer but doesn't work if I simply put SimpleDateFormat, which worked before
10:32justin_smithare you providing the full class name?
10:32xificurCprobably because I had it in the ns I was calling it
10:33xificurCyeah, java.text.SimpleDateFormat works as expected
10:33justin_smithso the next step is lein install
10:33justin_smiththen add it as a dep under :user in ~/.lein/profiles.clj
10:34xificurCwhat does lein install do exactly? creates a jar?
10:35justin_smithcreates a jar
10:35justin_smithputs it in ~/.m2
10:35justin_smithmakes it available to other projects
10:35justin_smiththen the user dep gets merged with your normal deps
10:35justin_smithand then you can use jdoc in any of your projects (locally)
10:35justin_smithbut it won't ship with uberjars
10:36sverianyone using lighttable here? i am looking for an overview over the basic shortcuts
10:36xificurCjustin_smith: i dont have profiles.clj under ~/.lein/
10:37justin_smithyou could :)
10:38justin_smith{:user {:dependencies [[your-grou/jdoc "version"]]}}
10:38justin_smiththat can be the entire file if you don't have one yet
10:38justin_smithit gets merged with project.clj
10:39justin_smiththough it may make more sense to add it to :dev or :repl
10:39justin_smithrather than :user
10:39xificurCi never used those yet and didnt know they exist
10:40xificurCwhat do you mean by `your-grou'?
10:40justin_smithwhatever your group is in your project.clj for jdoc
10:40justin_smithI missed the p
10:40xificurCstill, what would you mean by that :)
10:40justin_smithso (defproject your-group/jdoc ...) in your project.clj
10:40justin_smithfor jdoc
10:41justin_smithif it is just (defproject jdoc ...) then you can just specify jdoc in the profiles file
10:41justin_smithmaybe your-org would be more idiomatic than your-group
10:42justin_smithhttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L11
10:42justin_smithin the example project it is org.example/
10:42xificurChm, got an error when starting nrepl
10:43justin_smithwhat is the error?
10:43xificurCnow it loaded
10:43xificurCcouldnt find the file
10:43xificurCI had "0.1.0" as version and changed it to "0.1.0-SNAPSHOT"
10:44justin_smithyeah, you have to require the version you lein installed
10:44justin_smith:)
10:44xificurCso now I should be able to go (jdoc java.lang.Integer) ?
10:44justin_smithyou still need to require the ns
10:45justin_smith(require '[jdoc.core :refer [jdoc]]) or somesuch
10:45justin_smithand that part you could make an injection
10:45justin_smithif you really want it to run for every repl
10:45justin_smiththe example project.clj also shows how to do injections
10:47xificurCjustin_smith: and I have to write that every time manually in my project.clj?
10:47justin_smithno, that can go in profiles.clj
10:48justin_smithjust as you can add dependencies there, you can add injections
10:50xificurCjustin_smith: and that finishes your whirlwind tour through creating and installing a project successfully. Thanks!
10:50justin_smith{:user {:dependencies [[your-grou/jdoc "version"]] :injections [(require '[jdoc.core :refer [jdoc]])]}}
10:50justin_smithnp
10:51justin_smithglad we sorted this out!
10:51xificurCits still strange, but yeah
10:51xificurCatoms
10:51justin_smith:dynamic
10:51justin_smitheven more weird
10:51justin_smithatoms are not that bad, but ^:dynamic can do weird things
10:51xificurCI only wished to check 2 java classes and look where I got :)
10:52justin_smithwe are all the wiser for it
10:53xificurCyes, I hope I wont forget everything in a day!
10:53xificurC(because I don't remember anymore which 2 classes I wanted to check :D )
10:53justin_smithI need to learn most things 7 or 8 times before they stick
10:54xificurCwell at least I'll have a working mini-project on my machine that I can check for the basics
10:54xificurC(and javadoc "working")
11:06pepijndevosCan I pass clojure datastrucutres as command-line arguments?
11:08gunspepijndevos: Yes, just supply EDN strings as your argv or stdin, then read with clojure.edn/read-string
11:08justin_smith-main gets the args with lein run
11:08pepijndevosright
11:25xeqibrainproxy: no flag to include sourceContent for compiled js that I know of. The ability to do so for repl interactions was just added yesterday
12:16pepijndevosIs htere any non-ugly way to iterate over 2 seqs at the same time using for?
12:17llasrampepijndevos: You mean like (for [[a b] (map vector as bs)] ...) ?
12:18pepijndevosI guess that's the best you can get. Other alternative is to do a loop over a range and use get.
12:20S11001001pepijndevos: which only works well if you have good seq indexing on both
12:20pepijndevosPython has eaten my brain. So maybe there is a better way to do all of this, but I think this is okay.
12:21justin_smithpepijndevos: there is also just using map, which takes multiple sequences and moves through them in parallel
12:21pepijndevosjustin_smith, I know, but this code would look really bad in a map
12:22pepijndevosI think 7 LOC is acceptable for several levels of doseq.
12:26xificurCjustin_smith: what if I want to adjust my installed project?
12:26justin_smithxificurC: you could edit it and run lein install again
12:27justin_smithof course if you share with others you would also change the version, but locally that should be less of a concern
12:27xificurCok thanks
12:27clojurebotexcusez-moi
12:38xificurCjustin_smith: javadoc, unlike doc throws me in stacktrace when providing an unknown class. How can I force it to just return nil?
12:39justin_smithhmm
12:39justin_smithyou could use a try catch?
12:39justin_smiththe thing is, it is something you would only normally call from the top level, so the exception isn't breaking other code
12:39xificurCI have but it doesnt seem to work
12:39justin_smithjust very verbosely saying it can't find the calss
12:39justin_smith*class
12:39justin_smithhmm
12:39justin_smithfeel free to paste what you have
12:40xificurCtry doing (try (javadoc fda) (catch Exception e nil))
12:40justin_smithis the thing thrown a subclass of Exception?
12:40xificurCI thought everything is
12:40xificurCCompilerException java.lang.RuntimeException: Unable to resolve symbol: dfa in this context, compiling:(/tmp/form-init8412589436928102776.clj:1:6)
12:41justin_smithso try catching RuntimeException
12:41xificurCstill a no
12:41justin_smithoh
12:41xificurCisnt there a way to catch all exceptions?
12:42justin_smiththe exception is happening at the read stage
12:42justin_smiththat happens before the try block happens
12:42justin_smithxificurC: yeah, Throwable, though catching Throwable can make bad things happen
12:42justin_smithbut the issue here is that the exception happens before the try form is entered
12:42xificurCok but good to know, thanks
12:43xificurCso you cannot override it?
12:43justin_smith(try (javadoc (Class/forName "fda")) (catch Throwable e nil))
12:43justin_smithif you use Class/forName it does not resolve the class at read time
12:44justin_smithbut don't use Throwable, oops!
12:44xificurCheh
12:44srrubyIs clojure getting much traction in the real world of jobs ?
12:44justin_smith(try (javadoc (Class/forName "fda")) (catch ClassNotFoundException e nil))
12:44justin_smithbest to be as specific as you can
12:44justin_smithsrruby: I do clojure at work
12:44llasramditto
12:45xificurCjustin_smith: that works, thanks!
12:45xificurClucky you guys
12:45xificurClucky you
12:45srrubyThanks.
12:45xificurCtry workin with Excel's wonderful VBA for a year
12:46justin_smithI'd rather not, thanks
12:46xificurCthat language gives no guarantees the code you write will run the way you wrote it
12:47xificurCor the same way on another machine
12:49xificurCit still throws me a runtime exception after saving and doing lein install
12:49justin_smithand you restarted the repl that is using it?
12:49xificurCyes
12:50justin_smiththat is weird
12:52xificurC(macroexpand-1 '(jdoc fa)) shows
12:52xificurC(clojure.core/binding [clojure.java.browse/*open-url-script* "firefox"] (try (clojure.java.javadoc/javadoc (java.lang.Class/forName (clojure.core/str fa))) (catch java.lang.ClassNotFoundException jdoc.core/e nil)))
12:52justin_smithit tries to resolve fa before making a string out of it
12:53xificurCugh
12:53justin_smithtry putting a quote in there, so the class name is treated as a literal symbol
12:53justin_smithand not resolved
12:53justin_smith(class 'java.lang.Integer)
12:53justin_smith,(class 'java.lang.Integer)
12:53clojurebotclojure.lang.Symbol
12:54justin_smith,(class 'java.lang.ThisDoesNotExist)
12:54clojurebotclojure.lang.Symbol
12:54xificurChah
12:54xificurCthat doesnt seem right
12:56xificurCnow I get
12:56xificurCCompilerException java.lang.RuntimeException: Can't bind qualified name:jdoc.core/e, compiling:(/tmp/form-init8836743777557140171.clj:1:1)
12:57xificurCworks now
12:59xificurClike this https://www.refheap.com/21373
12:59justin_smithnice
13:01justin_smithalso, fyi catch has an implicit do, so technically the nil is redundant
13:01justin_smithbut looks like we are all set, until you want to change where it looks up the doc :)
13:02justin_smithafter that a "make stackoverflow best answers write my code" macro
13:03justin_smithhttp://gkoberger.github.io/stacksort/
13:05xificurCheh
13:06cYmenI don't quite get where to put dots and where to put slashes when I want to use a function from a package...
13:06cYmenIs clojure.contrib.math/round right?
13:06justin_smithcYmen the package name is composed of directory names separated by dots
13:07justin_smiththe slash goes between the name of the file it is in, and that function
13:07justin_smithit is easier if you do (require '[clojure.contrib.math :as cmath]) and call cmath/round
13:07cYmenhm...okay
13:07justin_smithor similar
13:07justin_smith(in the repl)
13:07justin_smithin a file you would use the :require subform in the ns declaration
13:09cYmenneed a lein project to get those deps
13:09cYmenno idea how to do it manually
13:09justin_smithor you can use pomegranate
13:09justin_smithlein project is easier
13:09justin_smithhttps://github.com/cemerick/pomegranate
13:10cYmenAnyway, if I need to get it with lein I won't be able to use it on 4clojure anyway.
13:10justin_smithyou can put it in your user profile in profiles.clj
13:10justin_smithahh, you want to use the library in 4clojure
13:10justin_smithlikely they won't even let you load any libraries
13:10justin_smithbeyond things like clojure.string and such
13:11justin_smithdon't use pomegranate in 4clojure problems
13:11justin_smithlol
13:14bender_so i tried to write a permutations function, but it blows up the heap after around 9 items. any idea what i can do to prevent that? http://pastebin.com/y9bx9JTh
13:14bender_this is just a learning exercise, i know there's already a lib for it :)
13:22justin_smithbender_: I think what you need is to use lazy-seq around each of your calls to cons
13:22justin_smithnot just on the outside sequence
13:22justin_smithwhich is being called on a mapcat, which is already lazy
13:25justin_smithactually: (first (perms (range 70)))
13:25justin_smiththat works just fine
13:25justin_smiththe heap blowup is likely because you are holding onto a head you don't need somewhere
13:29chouserbender_: well, the normal approach is to use an accumulator so that you can move the recursion to the tail position, and then use 'recur'
13:29chouserThis is not necessarily easy to do.
13:30justin_smithwell he said it blew up the heap
13:30justin_smithmaybe he meant stack
13:30bender_nah, it was an OOM
13:30chouseroh, really. well then my advice is no good.
13:30justin_smithyeah, that sounds like holding onto the head to me
13:31bender_holding onto the head in the function or in the actual call to it?
13:31justin_smithcould be either
13:32justin_smithI can run (first (perms (range 70))) with no issues
13:32justin_smithI do get a stack overflow with (first (perms (range 700))) though :)
13:33bender_interesting do you start your repl with a bigger heap?
13:34bender_i just did a lein repl, pasted that function in and got:
13:34bender_user=> (first (perms (range 70)))
13:34bender_OutOfMemoryError Java heap space
13:36chouser(last (perms (range 10))) works for me. Eventually.
13:37coventry,(. (Runtime/getRuntime) totalMemory)
13:37clojurebot#<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>
13:38coventrybender: What does that tell you in the repl?
13:38coventryMine says ~0.5G. (first (perms (range 70))) works for me.
13:41coventryActually, I guess you want maxMemory, not totalMemory.
13:47bender_thanks, i bumped up my heap size and it does complete. but i think that's just a bandaid, sounds like there is something that's not getting GC'd properly, but since its such a simple function there are only so many places it could be :/
13:52sm0keguys, i was asking this before couldnt still figure it out
13:52sm0ke,```y
13:52clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (quote sandbox/y))))
13:52sm0ke,'''y
13:52clojurebot(quote (quote y))
13:52sm0kewhat is it with syntax-quote evalutaion?
13:53rplacasm0ke: the syntax quote version namespaces symbols by default
13:53rplacato support more hygenic macro creation
13:53justin_smithit namespaces things to avoid all the stupid bugs macros would cause in common lisp
13:53sm0kerplaca: yes but its seem much more than simple namespace resolution
13:54rplacasm0ke: how so?
13:54sm0keshouldnt it be look like just ##''`y
13:54lazybot⇒ (quote (quote clojure.core/y))
13:54justin_smithit is turning (quote whatever) into its expansion
13:54Rhymor,'(:a)
13:54clojurebot(:a)
13:54Rhymor,`(:a)
13:54clojurebot(:a)
13:54Rhymor,``(:a)
13:54clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list :a)))
13:55rplacasm0ke: the rules are here: http://clojure.org/reader
13:56RhymorI think I never quite understood the syntax quote.
13:56sm0keyea its beyond me too
13:56sm0kealthough i am just a newbie
13:58rplacasm0ke: it's expanding to be what's necessary to create the structure (quote y)
13:58rplacabut I agree that that's more than I expected it to do there
13:59RhymorWithout the namespaces it turns ```y into (seq (concat (list 'quote) (list 'y)))
13:59rplacabut remember that the idea is that that whole structure will be evaluated at compile time and, therefore, simplified
14:00RhymorWhich of course would return (quote y)
14:01sm0keRhymor: is the (seq) form necessary?
14:01sm0keand does 'quote 'y really need to be in a list, to be concated
14:02sm0kemay be its the way internal algorithm handles it
14:02rplacasm0ke: think about it this way: every "extra" layer of ` requires an extra "eval" to undo it
14:02sm0kecant really argure without much knowledge of how it works
14:03rplaca,`y
14:03clojurebotsandbox/y
14:03rplaca`(eval `y)
14:03rplaca,`(eval `y)
14:03clojurebot(clojure.core/eval (quote sandbox/y))
14:03rplaca,(eval `y)
14:03clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
14:04rplacayeah, that sandbox won't let me do that
14:04rplacabut
14:04rplacatry (eval ``y)
14:04rplaca(eval (eval ```y))
14:04rplacaetc.
14:04rplacaand you'll seee
14:04sm0kewhats the point? i dont see it
14:04rplacain practice you don't nest `
14:05rplacaunless there's a ~ escape in between
14:05brainproxyxeqi: thanks for the clarif
14:05rplacathe only reason you might is if you were writing a macro to write macros
14:05Rhymorsm0ke: the backquote allows for ~ and ~@ while quote doesn't. So quote can simply return whatever is quoted while the backquote needs to create the quoted list so it could insert unquoted content
14:05rplacawhich is not a common case
14:06rplacasm0ke: +1 for Rhymor
14:06sm0keRhymor: makes sense i guess
14:07rplacaconsider:
14:08rplaca,(let [a 12] `[y ~a])
14:08clojurebot[sandbox/y 12]
14:08brainproxyanyone working on a runner/wrapper that would provide integration for karma and clojurescript.test?
14:08sm0keyes,but the same argument should hold for ##``y
14:08lazybot⇒ (quote clojure.core/y)
14:08sm0kei expected some list there
14:09zerokarmaleftcan imports be reversed with ns-unmap?
14:09rplacasm0ke: there are some nice uses for ` for various kinds of templating but it probably makes the most sense at first just to think about them wrt to writing macros
14:09sm0kebtw did you guys noticed that y resolved to clojure.core?! weird
14:10rplacasm0ke: that resolves to user/y in my repl
14:10Rhymorit resloves to the current namespace.
14:10sm0keyes but look at the lazybot response
14:10RhymorSo clojure.core is just an artefact of clojurebot which runs in the clojure.core namespace for whatever reason
14:10rplacalaybot efaults to running in clojure.core? interesting
14:11sm0ke,`y
14:11clojurebotsandbox/y
14:11rplaca*defaults
14:11RhymorOk, now I'm puzzled
14:11RhymorI'll just shut up and let the grown ups talk :)
14:11sm0keclojurebot is playing mindgames here
14:11rplacaright, you're using two different bots there
14:11sm0ke,``y
14:11clojurebot(quote sandbox/y)
14:11sm0keaha!
14:12Rhymor:D
14:12rplacasm0ke: why are you fixated on the nested ` case?
14:13rplacayou're basically going double meta there and things get weird :)
14:13Rhymorwanting to understand something is reason enough
14:13rplacayes it is, but there's a lot to understand about the actual use cases for that model that I think would make it clearer
14:14rplacaas in: what's the context in which that makes sense?
14:14rplacaand that context is macro writing macros or similar double meta things
14:15sm0kewell to be honest i was just playing around, no conrete usecase
14:15RhymorYea, but I for one was able to use the syntax quote in macros without actually understanding how it works. I think I know now more than I did 10 minutes ago.
14:15rplacahah! :)
14:16rplacamy advice: file this conversation until you have reason to try something double meta, then reexamine the behavior in that context
14:16slateveroNoob question: What's the idiomatic way of creating a list with N items each resulting from a function call?
14:16rplacait *is* good to understand and you may be able to do something crazy powerful with it when you get the chance
14:17rplacaslatevero: calling the same function over and over with the same (or no) arguments?
14:17slateverosame function, same args
14:18rplacaslatevero: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/repeatedly
14:18slateveroany then something like (take N (repeatedly f)) ?
14:18justin_smith,(repeatedly 4 #(println "hello"))
14:18clojurebot(hello\nhello\nnil hello\nnil hello\nnil nil)
14:18rplaca(repeatedly n #(f a1 a2 a3))
14:19rplacawill do it
14:19slateveroahh, ok cool
14:19justin_smithslatevero: repeatedly takes a count argument
14:19Rhymorslatevero: why does the function return different things when called?
14:19slateverothank you
14:19rplacaRhymor: common reasons are reading I/O and generating random values
14:19slateveroit returns the same thing, like for creating a pool of connections
14:19justin_smith,(repeatedly 3 rand)
14:19clojurebot(0.06532742636001476 0.8633735928031471 0.5121772655897804)
14:19RhymorOk, that makes sense
14:20sm0kedoes rand should be renamed to rand!
14:20sm0kehaha
14:20justin_smith! is for things that are unsafe in a dosync
14:20binskiis this kind of SQL possible with sqlkorma? http://stackoverflow.com/questions/2334712/update-from-select-using-sql-server
14:20llasramThat's not strictly true
14:20sm0keoh i thought any function with side effect/ unpure
14:21llasramIt's mostly just conventionally for operations which have side-effects
14:21justin_smiththen we would have print! slurp! spit! ...
14:21llasramrand isn't a pure function, but it doesn't have (strictly observable) side effects
14:21coventryI've heard the dosync story, too, but if it's true, I think the convention ought to change. Because, who uses dosync that much?
14:21RhymorI guess it is to mark functions where it is not immediately obvious that they have side effects
14:22llasramjustin_smith: It's not a strict thing. When the point of a function is the side-effect, doesn't seem as useful to indicate it :-)
14:22sm0kewell ! is just a convetion, so it wouldnt be idiomatic to have something like i-mutate-myself! kind of name, the name itself tell enough
14:23sm0kehmm i was the one who started this i guess :P
14:24sm0keall people seem to have same point of view, win win!!
14:25gfredericks!! for functions that are totally surprising. (defn identity!! [x] (System/exit 42))
14:25llasramheh
14:26llasramI think I'd make that one `identity!!!11one!`
14:26Rhymor!? for functions which have a side effect and return a boolean for success or failure
14:27sm0kewe should have tight ffi integration with C, and convention of having every function suffixed with !!!
14:27justin_smith,(->> 'clojure.core ns-publics (map first) (map str) (filter #(re-matches #".*!" %)))
14:27clojurebot("set-agent-send-executor!" "pop!" "assoc!" "conj!" "alter-meta!" ...)
14:27justin_smiththese are only things unsafe in a dosync
14:28coventryI like to name my vars after Daily WTF URLs.
14:28gfredericks,'http://gfredericks.com
14:28clojurebothttp://gfredericks.com
14:28gfrederickso_O
14:28llasramNice symbol you've got there
14:28gfredericksI honestly hadn't expected that
14:28justin_smithoh wait - persistent! is in there
14:29gfredericks,(let [http://gfredericks.com 42] http://gfredericks.com)
14:29clojurebot#<CompilerException java.lang.RuntimeException: Can't let qualified name: http://gfredericks.com, compiling:(NO_SOURCE_PATH:0:0)>
14:29llasram,(namespace 'http://gfredericks.com)
14:29clojurebot"http:/"
14:29sm0kehaha reminds me of the C trick, where http://gfredericks.com is valid code
14:29coventryCan you really not build up a transient in a dosync?
14:29justin_smithno, that's were I realized it wasn't true
14:30llasramOh, entirely w/in the dosync. That makes senes
14:30justin_smith,(dosync (let [a (transient [])] a))
14:30gfredericks,(dosync (into [] (range 5)))
14:30clojurebot#<TransientVector clojure.lang.PersistentVector$TransientVector@50646c>
14:30clojurebot[0 1 2 3 4]
14:31justin_smithso it seems core uses it for transients, metadata, and dosync-unsafeness
14:31llasrammetadata?
14:31justin_smithalter-meta!
14:32llasramOh, but that actually mutates the metadata for something
14:32llasramvary-meta is unexcited :-)
14:33justin_smith,((juxt identity meta) (alter-meta! #'alter-meta! assoc :wow "really?"))
14:33clojurebot[{:arglists ([iref f & args]), :ns #<Namespace clojure.core>, :name alter-meta!, :column 1, :added "1.0", ...} nil]
14:33justin_smithtruncated, but it does work
14:33justin_smithoh, returns the meta and not the var
14:34justin_smith(get (meta #'alter-meta) :wow)
14:34justin_smith,(get (meta #'alter-meta) :wow)
14:34clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: alter-meta in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:34justin_smitherr
14:34justin_smith,(get (meta #'alter-meta!) :wow)
14:34clojurebot"really?"
14:35llasramOh my
14:35justin_smithvery similar to the common lisp practice of proplists on symbols
14:35llasramThe "oh my" was that clojurebot allows it
14:36coventryHmm, that looks like a potential hole in the sandbox.
14:36justin_smithyeah, you could do some sneaky stuff that way
14:36llasram,(alter-meta! #'alter-meta! assoc :doc "A very safe function.")
14:36clojurebot{:arglists ([iref f & args]), :ns #<Namespace clojure.core>, :name alter-meta!, :column 1, :added "1.0", ...}
14:36llasram,(doc alter-meta!)
14:36clojurebot"([iref f & args]); A very safe function."
14:36justin_smithROFL
14:37sm0kecats are out of the bag!
14:38coventry(alter-meta! #'deliver assoc :macro true)
14:38justin_smith,(alter-meta! #'juxt update-in [:doc] #(str % "\n\nAND IS TOTALLY AWESOME!"))
14:38clojurebot{:ns #<Namespace clojure.core>, :name juxt, :arglists ([f] [f g] [f g h] [f g h & fs]), :column 1, :added "1.1", ...}
14:38coventry,(alter-meta! #'deliver assoc :macro true)
14:38clojurebot{:arglists ([promise val]), :ns #<Namespace clojure.core>, :name deliver, :column 1, :added "1.1", ...}
14:38coventry,(deliver 1)
14:38clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$deliver>
14:38justin_smith(doc juxt)
14:38clojurebot"([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)] AND IS TOTALLY AWESOME!"
14:39llasramcoventry: My mind when the same place...
14:39llasrams,when,went, even
14:40justin_smith,@(deliver (promise) 1)
14:40coventry(alter-meta! #'deliver dissoc :macro)
14:40clojurebot1
14:40coventryI wonder how often it resets.
14:41coventry,(do (alter-meta! #'deliver assoc :macro true) @(deliver (promise) 1))
14:41clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$deliver>
14:48xificurCwriting after losing connection and wondering why noone is answering, hehe
14:48xificurCI found that you can get the methods of a Java class via (:members
14:48xificurC (clojure.reflect/reflect foo)). Is this still actual and precise?
14:48xificurCand why is January 0 in a Java Calendar?
14:54justin_smiththere is also bean - sometimes useful
14:54justin_smith(bean java.lang.String)
14:54justin_smith,(bean java.lang.String)
14:54clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
14:54justin_smith,(bean "hello")
14:54clojurebot#<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class sun.awt.AppContext>
14:55justin_smith,1
14:55clojurebot1
15:00xificurCjustin_smith: thanks
15:04sm0ke,(bean (java.util.Date.))
15:04clojurebot#<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class sun.awt.AppContext>
15:06sm0ke,(java.util.Date.)
15:06clojurebot#inst "2013-11-30T20:09:53.828-00:00"
15:06sm0ke,(doc bean)
15:06clojurebot"([x]); Takes a Java object and returns a read-only implementation of the map abstraction based upon its JavaBean properties."
15:06sm0kewth
15:07llasramSeems to be a sandbox thing
15:08`cbp##(bean (java.util.Date.))
15:08lazybot⇒ {:seconds 5, :date 30, :class java.util.Date, :minutes 21, :hours 12, :year 113, :timezoneOffset 480, :month 10, :day 6, :time 1385842865021}
15:12rplacaif you're messing around with dates and times, I highly recomend you look at clj-time which is a wrapper for joda time. It makes everything more sane.
15:18llasramThe irony of someone using the handle `rplaca` talking about API sanity is pretty awesome :-D
15:18justin_smithlol
15:36glosolihmm is there some way to check in REPL if custom stack size was applied ? (I set it in project.clj, but want to make sure)
15:38sm0keglosoli: i think gettting stack size is not very sriaghtforward, you can try using jconsole to connect to your repl to get an idea of usage however
15:40glosolism0ke thanks
15:48sm0kehttps://github.com/clojure/java.jmx can also be used at repl i guess
15:48sm0kenice, that makes jmx pretty easy!
15:48xificurCrplaca: thanks, I was using the Java Calendar only because of a book example
15:49xificurCbut I will remember clj-time
15:49justin_smiththere is also jvisualvm for tracking resource usage
15:56seangroveWait, is it not possible to do ajax PUT requests?
15:57seangroveyogthos|away: Trying to make a :put request with cljs-ajax, but getting an error that such a method doesn't exist
16:13grncdrdoes anybody else wish if-let allowed multiple bindings?
16:14justin_smithso, what, the first binding would be magic?
16:15hiredmanthe compiler needs magic to automatically chain let with things
16:15hiredmanlet-try
16:15hiredmantry-let
16:15hiredmanetc
16:16grncdrjustin_smith: the bindings would be implicitly "and"ed
16:16justin_smithoh, so you want and-let
16:16grncdroh, is and-let a thing?
16:16grncdr,(doc and-let)
16:16clojurebotHuh?
16:16justin_smithno
16:17seangrovegrncdr: It's been suggested before, but then you don't know where the failure is
16:17justin_smithjust saying, if you are doing and on all the bindings, that isn't if, that's and
16:17seangroveProbably an easy enough macro to write if you feel strongly about it, grncdr
16:18grncdryeah, I haven't had a case where I've felt that strongly about it yet
16:18grncdrbut it's been at least 2-3 times I've expected it to work and it hasn't
16:18grncdrat least the error is good :)
16:18seangrovegrncdr: Yeah, I agree. I understand the tradeoff though, so I'm not too upset about it
16:19grncdrhm, I don't know if I do...
16:19seangroveGenerally just a (let [multiple bindings] (if (and all the bindings) ...))
16:20grncdrthe tradeoff is that you don't know which binding is falsy… but doesn't that also happen when you do it manually?
16:20grncdre.g. (and x y z), you don't know if x or y or z was nil/false
16:21grncdranyways, this is straight-up yak-shaving so I understand if it's not that interesting to anybody else ;)
16:21seangrovegrncdr: But an if-and-let is a pretty coarse level of control
16:22seangroveIt's rare that you want to do multiple bindings and fail if any of them fail... usually you have multiple bindings and different branches based on various combinations
16:22seangroveMaybe a cond-let would be cool
16:22seangrove,(doc cond-let)
16:22clojurebotCool story bro.
16:22grncdrhah
16:22hiredmanare you familiar with maybe?
16:22grncdrno
16:23seangrovehiredman: Scala's Option?
16:23llasramI pull in algo.monads all the time just for the maybe monad
16:23grncdrah, yeah, in my case I'm not really looking for a maybe monad
16:23hiredmanugh, I would like to the tests for algo.monads for examples, but the formatting is horrible and if you don't already know what maybe does they are not clear at all
16:23llasramgrncdr: I actually think you are looking for Clojure's version of it
16:24hiredmanlink
16:24llasramIt's basically an if-let with any number of bindings, which returns `nil` when the first one returns `nil`, and in which you can intersperse other (non-tested) lets and arbitrary boolean tests
16:24grncdrhm, well, I could see it being implemented using a maybe monad...
16:26seangrovellasram: Definitely would like to see a good example of it
16:26seangroveSounds like I'm missing out on a useful pattern
16:28grncdrI thought I understood the maybe monad, and I can see the similarity between what I'm asking and what it *could* do, but I feel like I was after something simpler
16:28llasramHere's an example from the code I'm working on right now: https://gist.github.com/llasram/7724741
16:28llasramThe details are certain to be incomprehensible
16:29llasramBut hopefully the structure is clear
16:30grncdrso I'm seeing the conditions (:when …) but not how to bind the result of a test
16:31llasramOh, you can do arbitrary bindings with :let [...]
16:31llasramThose results aren't checked for the nil-ness
16:31llasramAll the top-level bindings are though
16:31grncdryeah, I was (slowly) realizing that after I asked
16:31grncdr"right, it's the maybe-monad"
16:32grncdrok, that's actually pretty nuts
16:33llasramIt keeps "bail with nil if something goes wrong at any point" type functions nice and flat
16:33grncdr(inc llasram)
16:33lazybot⇒ 13
16:33grncdryeah
16:34grncdrso… now the dumb question: what namespace is `am` ?
16:34grncdrcontrib.monads?
16:34llasramOh, https://github.com/clojure/algo.monads
16:34grncdrah
16:34grncdrnot a dumb question after all :)
16:34llasramIt's the "new" name for contrib.monads, but yeah
16:35rubber-duckcan I reference vars not bound in ns by using full names (with ns) in clojurescript ? ie. is this code : (ns foo) (defn x [] ..,) (ns bar) (foo/x) - valid ?
16:36grncdrshould be
16:36grncdryou could try it on cljsfiddle if you're not sure
16:36grncdrbut I'm pretty sure I do that in this code I'm working on...
16:36rubber-duckI'm just worried about optimization not working if there are no references in ns declaration
16:37grncdrhm, that is a good point...
17:19alsois there a reason cljs.nodejs set!s string-print instead of set-print-fn! ?
17:21alsosimply requiring cljs.nodejs and calling enable-console-print! means you get no newlines
17:25noncom|2what is the common way to dynamically load jars in a running clojure program?
17:26noncom|2* new jars
17:26justin_smithpomegranate
17:26alsohttps://github.com/cemerick/pomegranate
17:26llasramFrom the REPL? You can directly use pomegranate, or use alembic for a slightly more convenient interface
17:27llasramhttps://github.com/pallet/alembic
17:28noncom|2cool! i'll check up both, thank you
17:28xcthulhuWhat is the correct term to use for someone who programs clojure?
17:28xcthulhu...is it a clojuror?
17:29llasramI'd just go with "Clojure programmer"
17:29noncom|2i've heard about clojurians
17:29noncom|2in several different places
17:29noncom|2clawjuror
17:30justin_smithclojerk
17:30noncom|2ahaha
17:30noncom|2clojerker
17:30`cbpclojodyte
17:30justin_smiththe meetup group here in town is clojerks pdx
17:31xcthulhuhehe
17:33RaynesOh man, Python can eat me with its explicit returns.
17:33llasramIt wouldn't be so bad if it didn't implicitly return None without one...
17:35brainproxyhow do I include a "preamble" (e.g. licensing info) in the cljs compiler's output such that the generated source map still points to the correct line numbers
17:35brainproxysimplying prepending such text messes up the line numbers
17:36grncdrbrainproxy: I don't know, but I don't think it would be possible currently
17:37brainproxygrncdr: i was gueesing it's not but figured I would ask :)
17:37grncdryou could probably write something that modifies the sourcemaps themselves after the fact without too much fuss, if you need a quick & dirty solution
17:37brainproxynever know what subtle option I missed when looking over the source
17:37brainproxygrncdr: i was experimenting with uglifyjs for that purpose
17:38brainproxybut I think I'll make a feature request in any case
17:38grncdranother q&d would be to just throw your license into a giant string literal at the top of the file :P
17:38brainproxyhaha, nice
17:38justin_smithisn't the point of the sourcemap that it translates from a place in an uglified concatenated file to an original file and line? if so wouldn't prepending a chunk of text leave those references accurate?>
17:39brainproxyjustin_smith: i tried it an indeed the line numbers got foobar'd
17:39justin_smithoh
17:39arrdemRaynes: I mean... if you find that an attractive prospect whatever. Personally I like explicit returns more than Scala's implicit return shit
17:39grncdrjustin_smith: the sourcemap maps from positions in the compiled output, so if you add data to the start of that, things get messed up
17:40justin_smithok, I didn't think it would work that way
17:45alsobrainproxy: i wonder if something like this would work: https://github.com/thlorenz/combine-source-map
17:49dnolenbrainproxy: preamble enhancement patch welcome - it looks like your preamble comment just needs a @preserve annotation for it to work - http://developers.google.com/closure/compiler/docs/js-for-compiler
17:50brainproxydnolen: if I knew how to write the patch I would do it, I'm not sure I can dive off into that atm, but maybe my feature request will inspire someone with the know how
17:52brainproxyor even an example of a patch that did something broadly similar w.r.t. enchancing the cljs compiler
17:52dnolenbrainproxy: open a minor enhancement ticket in JIRA - I'm unlikely to tackle this myself anytime soon, too many other fish to fry - it would require a fairly simple modifications to closure.clj
17:52brainproxydnolen: I'll take it on if there is an example I can learn from
17:52Raynesarrdem: Yeah, it's just that I keep forgetting to do it.
17:52dnolenbrainproxy: if you look at how we do the :output-wrapper you'll see it's not a particularly difficult enahancement
17:52RaynesIt's more my problem than Python's.
17:53alsodnolen: how does the output wrapper work with sourcemaps?
17:54dnolenalso: this is a case where's it informative to look at the source ;), see cljs.closure/build
17:55brainproxydnolen: do I need to do the CLA stuff to be able to submit to JIRA
17:55brainproxythat's not a problem, just never crossed that bridge
17:55dnolenbrainproxy: not to open a ticket, but to submit a patch yes
17:55brainproxydnolen: hmm, what's the access point for submitting ticket
17:55brainproxygoogling jira clojurescript took me to something which required a login
17:56dnolenbrainproxy: http://dev.clojure.org/jira/browse/CLJS
17:56brainproxyok
17:56dnolenbrainproxy: you might need to create an account but anyone can
17:56brainproxyah
17:56alsodnolen: yeah, i was looking at the source. it just wasn't clear to me how the newline added by add-wrapper was accounted for by the source map
17:57dnolenalso: lines 1099-1105 in cljs/closure.clj
17:57dnolenalso: the source map is generated *after* we constructed the final concatenated source
17:57brainproxydnolen: are there any plans to support sourceContent in the cljs compiler's source map output, or would the .map files be so huge that it would be silly?
17:57dnolenalso: oh actually it's not!
17:57also:)
17:57dnolenalso: so that's a bug
17:59dnolenalso: or actually I'm not sure ... simple and advanced are likely to remove the wrapping function?
17:59alsodnolen: no, it sticks around
18:00dnolenalso: so Closure never removes a top level function that's immediately invoked?
18:01dnolenalso: yeah it'll get removed in advanced
18:01alsodnolen: well, stripping the function can change the value of this
18:01dnolenalso: I'm now less convinced this an issue
18:02dnolenalso: if you're using source maps and :simple or :none there's little reason for the wrapper
18:02dnolenalso: and for production code people generally won't expose the source map
18:02alsodnolen: yeah, i'm not super concerned about it. but it's the same as brainproxy's issue
18:03bellkevSay, I was just reading through the clojure.test source, and I was wondering if anybody knows why they went with the :test metadata scheme to run through all the tests in a namespace. Was there a reason not to just use a :test true flag in the metadata instead of put the whole test body in the metadata?
18:03darklord5question(sorry to interrupt): I am trying to map a function: (-> :content clojure.string/capitalize) to a list of maps structure like so: ({:tag :tt, :content ("305")})...but the problem is clojure attempts to evaluate ("305") before being passed to capitalize. So I tried to pass ("305") to quote via: (-> :content quote clojure.string/capitalize) but this isn't working either. What am i doing wrong here?
18:05amalloydarklord5: you've mis-identified the problem. and you can't really "call" quote on something at runtime, because all the compilation and quoting is already done
18:06amalloyi mean, it seems to me like the issue is that (-> :content capitalize) isn't a function at all (in fact evaluating it will throw an exception), so everything after that assumption is broken
18:07amalloyconceivably you might have meant #(-> % :content capitalize), which is IMO a less-clear way to write (comp capitalize :content)
18:08alsodnolen: i still see the wrapper with :advanced
18:08dnolenalso: yes because we add it afterwards to avoid problems
18:09dnolenalso: so you're right it would through of course maps, but I'm not convinced anyone should use :output-wrapper true w/ source maps enabled
18:09dnolens/through of/throw off
18:10seangrove"through of course maps"
18:10seangrovego home dnolen, you're drunk.
18:11dnolenseangrove: haha
18:11seangrovednolen: Thinking about coming out west for clojure/west?
18:12dnolenseangrove: likely if I submit a talk and it gets accepted :)
18:15seangrovednolen: Well, get on it then ;)
18:16dnolenseangrove: haha
18:16brainproxydnolen: to clarify, at present combining the output wrapper and source maps will result in a problem?
18:17dnolenbrainproxy: a problem insofar as they are incompatible options
18:17dnolenbrainproxy: and likely will always be
18:17brainproxyyikes okay
18:18dnolenbrainproxy: which is not true for preamble feature
18:18brainproxyi understand, but I was going to combine the two
18:18dnolenbrainproxy: they are orthogonal
18:19brainproxydon't necessarily have to, but wanted my test build output to essentially look exactly like the release output
18:19brainproxyand there are projects that are distributing source maps with release code
18:19brainproxyso that devs don't have to have a non-minified build onhand
18:20dnolenbrainproxy: and the source map links to a non-minified version on a CDN or something?
18:21brainproxywell two that come to mind are jquery and polymer
18:21brainproxyand no, they point to a .map file that's included in, say, the bower distribution
18:21seangroverkneufeld: Are there any docs on pedestal 3.0's approach to UI? I'm working on some stuff similar and would like to see how you're approaching it
18:21brainproxyothers do it as well, those two just jumped to my mind right away
18:22brainproxydnolen: however, I do see your point, and I can live w/o it for sure
18:22brainproxythe :preamble being a still desired and different issue, as you noted
18:30seangroveHrm, can't get ajax requests to show up in the network tab of chrome devtools.
18:31alsodnolen: lein-cljsbuild 1.0 now adds :output-wrapper with :advanced
18:32amalloyseangrove: as long as the network tab is open before the ajax request starts, i've never had that happen. i speculate you're failing to send the ajax request
18:33alsodnolen: so some source-map examples upgraded from lein-cljsbuild 0.3.2 will probably run into the issue
18:33seangroveamalloy: It's hitting the server, and showing up in the js console, just not the network tab
18:33amalloycheck for ghosts
18:33amalloyonly an exorcist can help you now
18:33seangroveamalloy: Phew, I was wondering if there was a term "ghosts" I wasn't familiar with...
18:33Deadronlol
18:34amalloyyeah, i realized that would sound confusing, so i added that second one
18:34dnolenalso: yeah, I don't really agree w/ that default, not a CLJS issue in any case
18:36grncdrdnolen: random question but, who's responsible for mix having :solo and :mute be the names used by mix/toggle ?
18:36grncdrbecause that is awesome
18:53munderwoHi all, new to clojure. Trying to make a simple web app. and I'm getting an exception while trying to use selmer? https://www.refheap.com/21377 I'm sure I'm doing something stupid here, but I'm not sure what.
18:54coventrymunderwo: render-file is not in the ns. You might want selmer.parser/render-file, if that's where render-file lives.
18:55mattmossIs there a function f such that (f #'x) gives me 'x ?
18:55mattmossSeems like I'm just missing something obvious.
18:55`cbpmunderwo: either use selmer.parser/render-file
18:55`cbpor change your ns declaration to refer that symbol
18:56munderwolike (:use [selmer.parser :only [render-file]]) ??
18:56lazybotmunderwo: Definitely not.
18:56coventrygood boy, lazybot. :-)
18:56alsohaha
18:56munderwoahhh… whats lazybot and what did it tell me not to do?
18:56`cbpmunderwo: change use for require and only for refer and we're in business
18:57coventry(doc var-get) <-- mattmoss
18:57clojurebot"([x]); Gets the value in the var object"
18:57mattmosscoventry: I don't want the value, I want the name.
18:58munderwo`cbp: so In the code examples I've been using there is a :use for compojure.core and ring.adapter.jetty… should I not be doing that either? should it all be require?
18:58`cbpmunderwo: they are outdated, use require
18:58justin_smithmattmoss: quote, but it only works at compile time
18:59justin_smithbecause looking at names only works at compile time
18:59munderworighto. cheers! and refer instead of only?
18:59`cbpmunderwo: yes
18:59mattmoss,(quote #'x)
18:59clojurebot(var x)
18:59coventry,(-> #'inc meta :name)
18:59clojurebotinc
19:00coventryThat's not totally reliable, though. Depends on how the var is created.
19:00akurilinuhm actually don't answer that just yet, connection is going nuts for a sec.
19:00mattmossBasically, doing some macros, returning value from a def (which is a var), want the name.
19:00`cbpthere is no question!
19:00justin_smith,(alter-meta! #'inc assoc :name 'dec)
19:00clojurebot{:ns #<Namespace clojure.core>, :name dec, :file "clojure/core.clj", :column 1, :line 874, ...}
19:00justin_smith,(:name (:meta inc))
19:00clojurebotnil
19:00coventrymattmoss: You get the name (a symbol) in a macro for free.
19:00justin_smith,(:name (meta #'inc))
19:00clojurebotdec
19:00mattmoss,(:name (meta inc))
19:00clojurebotnil
19:01also,(.sym #'inc)
19:01clojurebotinc
19:01coventrymattmoss: Worst case, you can grovel in the form which produces the def to get the name, if you're in a macro.
19:01mattmosscoventry: Perhaps... I'm still figuring that out, since it's clojure macros being used from cljs. Which means you may be correct, but my brain is rather warped at this point to fully realize that.
19:01alsoprobably not that
19:02rkneufeldseangrove: No docs on Pedestal 0.3.0's UI approach exist yet.
19:03seangroverkneufeld: Would you be up to talk about it sometime? Would definitely like to hear about it from a high level view
19:04seangrove,(= {:a 10} {:a 10 :b nil})
19:04clojurebotfalse
19:04rkneufeldseangrove: I actually haven't even had a chance to catch up on the dataflow engine changes yet–been heads down on the book for months :S. I'm expecting to dig in a little mid-December and over the holidays.
19:07seangrovellasram: This look like the place to use the maybe monad? https://www.refheap.com/21378
19:07mlb-Where might I find information on impementing a new host target for Clojure? This is from purely academic, self-educational curiosity.
19:08seangroverkneufeld: Sure, no problem
19:08rkneufeldseangrove: what are you working on?
19:09seangroverkneufeld: Working on a ui layer for clojurescript, trying to bring together declarative web-components-like markup, core.async internal widget behaviors, and pedestals' funcational-as-long-as-possible approach
19:10rkneufeldNeat! I know Tim and Brenton have been mulling over some stuff in this vain the last few months, but there isn't much concrete on the ground yet.
19:10seangroveI've found myself independently recreating a lot of pedestal's ideas, so I'd like to have a high-bandwidth talk with someone who knows what they're doing (not me) and see if this is worth the time
19:11munderwohmm.. is there a reason that a tutorial is telling me I can do lein ring server , but it seems like I only have lein run ?
19:11rkneufeldTim or Brenton would probably be the best people to talk to then.
19:11munderwoI seem to have something called lein-ring installed?
19:11seangroverkneufeld: tbaldridge? I don't know Brenton...
19:12rkneufeldseangrove: Tim Ewald–though he has a vanishingly small online presence.
19:12munderwooh wait… maybe Im stupid :)
19:12rkneufeldseangrove: If you want to ping the whole gang, drop an email to pedestal@cognitect.com
19:13hiredmanmlb-: clojure isn't like a lot of schemes or lisps, it isn't a self contianed system to be ported, it places a lot of emphasis on host integration
19:13seangroverkneufeld: Well, don't want to take up too much of their time. I'll keep going at it independently until I have something with more substance
19:13rkneufeldseangrove: It's a slow season right now, so don't expect us to beat you to the finish ;)
19:14akurilinI accidentally stumbled upon the last question shalloway ever answered on SO back 2+ years ago, heh.
19:14seangroverkneufeld: No problem, maybe with a bit of luck that'll be my ticket to give a talk at clojure/west ;)
19:14hiredmanmlb-: there have been a few ports of clojurescript to different targets, but (and opinions differ on this) I don't think clojurescript is clojure, in my experience it is a cut down set of functionality
19:15hiredmanI don't know if any of the clojurescript ports (like the lua one?) are active
19:15mlb-hiredman: I'd figured any development on a new target should start as a subset. I'm curious at which parts of the subset are necessary to implement first, etc.
19:17hiredmanmost of the big differences between clojurescript and clojure stem from clojurescript having very distinct compilation and runtime phases
19:17hiredmanwhere clojure doesn't
19:18hiredmanso for example macros in clojurescript are written in clojure, because the clojurescript language isn't really available at compile time, and compilation happens upfront before runtime
19:19hiredmansimilarly clojure has a very nice reified linking construct (vars) which clojurescript doesn't have, it has the same sort of implicit linking the target has
19:21mlb-these certainly tell me a lot about differences between Clojure and ClojureScript, but not where one might begin to implement a new Clojure target
19:21hiredmanmlb-: that information doesn't really exist
19:22alsomlb-: check out some of cemerick's ports of clojure libraries to clojurescript libraries
19:22hiredmanthe only other clojure target is the clr port
19:22tbaldridgemlb-: If you want to talk sometime about this, feel free to contact me. I wrote clojure-py and learned a lot doing it. Mostly I learned how it was way harder than I thought.
19:22mlb-ah, alas. I was hoping given clojurescript, clojurec, clojureclr, clojurepy, etc. there might be more information
19:22hiredmanand that wasn't done via a manual of how to port clojure
19:22tbaldridgemlb-: there's about 20 different ways to do "a port". Each is done a bit differently.
19:23mlb-tbaldridge: haha. You admitted what I was most afraid of, but had an intuitve assumption was the case.
19:25hiredmanthe other thing is there isn't a clojure standard, so while I have spent a lot of time reading and writing clojure and have strong opinions about what clojure is, other people have other opinions
19:26grncdrhm, does anybody know a good pattern for creating a "bus" in core.async without feedback issues?
19:26hiredmanyou mean an unbounded queue?
19:27grncdrnot exactly… longer explanation forthcoming...
19:28grncdrI want a mult channel that carries application state, and various go-loop blocks that tap that channel so they each have a view of the latest application state… that much is straightforward
19:29grncdrwhat gets tricky, is I want some of those go-loops to have other inputs, and put a new version of the application state back on "bus" channel based on those inputs
19:30hiredmanuse an atom
19:30grncdrit seems to me that by doing that, the new state is going to show up as a new input
19:30tbaldridgegrncdr: just store the app state in an atom.
19:30grncdrcrap
19:30grncdrI was doing that before ;)
19:30chouseris it safe to interact with atoms from inside go blocks in ClojureScript?
19:32chouserI guess I can't think of any reason why it wouldn't be, but without some channel involved somewhere, no go block will ever give up control to another.
19:33hiredmanchouser: (go ((fn foo [] … (go (foo)))))
19:43coventryCan slamhound be configured to refuse to pick when there are multiple options?
19:45amalloyhiredman: does that really work, though? (go ((fn ...))) doesn't allow you to use <! and so on from inside the ..., because the core.async transformer doesn't reach inside lambdas, right?
19:49hiredmanamalloy: depends I guess, the idea is just to get a control loop that yields to other go blocks without using channels
19:51hiredmanyou could move … in to the (go …) and get the go transform of …, and then you would get rid of the outer (go …)
20:02rovarhey all.. I'm trying to understand what #' does.
20:02rovarI saw http://stackoverflow.com/questions/10945187/is-pound-quote-in-clojure-running-the-resolve-and-symbol-functions
20:02rovarbut the thing is that (foo 10) will return the same result as (#'foo 10)
20:02justin_smith,#'+
20:02clojurebot#'clojure.core/+
20:02rovar,+
20:02clojurebot#<core$_PLUS_ clojure.core$_PLUS_@78f49c>
20:03justin_smith,(map type [#'+ +])
20:03clojurebot(clojure.lang.Var clojure.core$_PLUS_)
20:03justin_smithone is the var, the other is the value of the var
20:04rovarso if I'm trying to pass a handler.. for instance in http-kit. I see some examples pass #'myhandler and others define the handler with fn
20:04rovarso one is passing a var, and one is passing a fn
20:04justin_smiththe difference is when you pass the var in, it sees the new value if you rebind the var
20:04rovarso i should be able to pass myhandler directly without supplying the var, yes?
20:04rovarah
20:04justin_smithbecause defining a new function does not replace the old one - both exist
20:04rovarbut when executing a var is implicit?
20:04justin_smithbut the var will point at the new one
20:05justin_smiththe implicit thing is that symbols, unless quoted, get treated as vars
20:05rovarso its dereferencing the var automagically
20:05justin_smithyeah
20:05rovarmeh
20:05rovarI mean.. I'm sure it makes things simpler
20:05justin_smithand you pass in the var if you want it to see new values of the var when you change it
20:05rovarsure..
20:06justin_smithyou just use the symbol if you want it to resolve once and continue using that value
20:06rovarso in the example: https://github.com/http-kit/chat-websocket/blob/master/src/main.clj#L44
20:07rovarthey pass in the var, in case someone decides to redefine msg-received at some point
20:07justin_smithright
20:07justin_smithit is useful during development
20:07rovarseems kind of janky. I'd rather pass the the function directly so noone can go and change it,
20:07rovarhow would you make use of it during dev?
20:08rovarredefine it in the repl after you've launched the server?
20:08justin_smithyeah
20:08justin_smithI usually start a repl from within the server actually
20:08justin_smithso I can redefine things as I work without restarting
20:08rovaryea..
20:09rovarI've done a fair amount of scala and haskell and chicken scheme. Having a hard time with the fuzzy typing
20:10rovarbeing able to change methods as I'm running seems useful, though..
20:11rovarunrelated question: is there a timeout for doseq?
20:11justin_smithnope, if you hand it an infinite list it will go until you interrupt it or it runs out of heap
20:12rovarso I'd need a way to interrupt the generator, in such cases..
20:12justin_smithright
20:13justin_smithyou could have a reduce, with a condition that calls reduced
20:13justin_smithreduce is eager
20:13rovarok.. last question.. what is the postfix * operator?
20:13justin_smiththere are no operators
20:13rovaroh.. nm
20:14justin_smith* in a name indicates something is internal
20:14justin_smithusually
20:14justin_smithif it is the end of the name
20:14rovaryea.. it's like prime
20:14justin_smithright
20:14rovarthey're just making the next version of the hash and then reassigning it
20:14justin_smithso let expands to let*
20:14justin_smithfn expands to fn*
20:14justin_smithI just use prime
20:15justin_smith,(reduce (fn [x x'] (if (= x' x) (reduced :OK))) [0 1 2 3 3 4])
20:15clojurebotnil
20:15justin_smitherr
20:15justin_smith,(reduce (fn [x x'] (if (= x' x) (reduced :OK) x)) [0 1 2 3 3 4])
20:15clojurebot0
20:16Bronsa,(reduce (fn [x x'] (if (= x' x) (reduced :OK) x')) [0 1 2 3 3 4])
20:16clojurebot:OK
20:16justin_smiththat's what I wanted :)
20:16justin_smiththanks
20:18hyPiRionor like
20:18hyPiRion,(some (fn [[x y]] (= x y)) (partition 2 1 [0 1 2 3 3 4]))
20:18clojurebottrue
20:18arrdem(inc brehaut)
20:18lazybot⇒ 21
20:19justin_smithhyPiRion: the point was more the usage of prime', but yeah :)
20:19hyPiRionoh
20:19pdk,(doc reduced)
20:19clojurebot"([x]); Wraps x in a way such that a reduce will terminate with the value x"
20:20justin_smithit is basically a return statement for reduce
20:20hyPiRionI just tend to see clojure expressions and attempt to make different variations of them
20:20justin_smithfair enough
20:20hyPiRionThat is not always what people want though :p
20:21andyfBronsa: Continuing thanks for all of the tools.analyzer work. When you say "it is trivial to use a custom macroexpander that passes as &env a localsym->localbinding map", is there an example of that somewhere?
20:21justin_smithhyPiRion: yours is definitely the better example of finding a duplicate, if that was what I were demonstrating
20:23Bronsaandyf: basically just replacing env with (:locals env) here https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L128 should work for the core.async use case
20:23amalloyit occurs to me that (if (= x' x) (reduced :OK) x) can be rewritten as ({x' (reduced :OK)} x x). i don't think this is actually better, but it's a funny little thing
20:24justin_smithindeed it is
20:24Bronsaandyf: however if some library is using the value part of &env it's going to be trickier, you should transform the tools.analyzer map representation of a local to a Compiler$LocalBinding
20:24andyfBronsa: I will give that a try. Is there any reason not to do such a thing when analyzing any Clojure code at all? I can make it an option for eastwood, if necessary, but better if the default works for most cases.
20:24justin_smithamalloy: wait, is that how reduced works?
20:25amalloyer, what, justin_smith? it's a generic conversion, which would work as well if we replaced (reduced :OK) with foo
20:25hyPiRionI find it more interesting that you can have the reduced outside of the reduction function
20:25justin_smithamalloy: I guess I thought calling it did the short circuit, but you have to return it?
20:25Bronsaandyf: the problem is that essentially there's no way &env is going to be 100% compatible, so I prefered to keep it different instead of making it maybe work and maybe not
20:26amalloyoh man, if calling it short circuited as a side effect, i think rich would spontaneously combust
20:26justin_smithyeah, I didn't understand, clearly
20:26amalloyreduced is just a one-arg deftype
20:26justin_smithcool
20:26andyfBronsa: Is the goal that eventually tools.analyzer will be used as part of a Clojure compiler? If so, were you thinking of supporting &env in a different way than Clojure currently does, or not at all?
20:27amalloy(deftype Reduced [x]) is actually the whole body, i think? i guess there's probably a protocol like IReduced
20:27amalloyah, it's written in java, and implements IDeref
20:27amalloybut it's like five lines long
20:28justin_smithcool
20:28hyPiRionheh, hm
20:29akurilinI'm still astounded by how much fun certain tasks can become with Clojure. I'm playing with instaparse, and between REPL-driven development, tests and functional programming the task becomes pure play.
20:29justin_smithakurilin: definitely
20:30hyPiRion,(reduce #(deref %2) (map (comp reduced reduced) (range)))
20:30clojurebot1
20:30justin_smithin the future zinga will be the worlds leading software development company, when they train all their users to write clojure code that passes unit tests in order to see colorful explosions
20:30Bronsaandyf: doubtfully tools.analyzer will be part of the clojure compiler anytime soon, &env is (I think) an undefined feature and is currently implementation specific
20:31akurilinjustin_smith, lol what is that a reference to?
20:31Bronsas/undefined/undocumented
20:31justin_smithakurilin: quick iteration, short term reward, that's what makes games successful
20:31justin_smithzinga is a very successful casual game company
20:31hyPiRionIsn't like... Clojure itself implementation specific? I haven't seen any implementation/design paper
20:31akurilinjustin_smith, oh, very good point.
20:32justin_smithalso a joke :)
20:32Bronsaandyf: the thing is, if I wanted to macroexpand using a &env compatible with Compiler.java's one I'd have to change the AST representation to use Compiler.java classes -- and avoiding that is one of the goals of tools.analyzer
20:32akurilinjustin_smith, one of my biggest lessons from working with instaparse was making veeeeery small incremental changes, the more trivial the better, otherwise you lose your sanity. Combine these hundreds of "tiny victories" over a long stretch of time, and you're addicted.
20:33justin_smithright
20:33justin_smithunit-test farmville!
20:33hiredmanI've only ever used the keys of &env
20:33andyfBronsa: OK. I am not familiar with the gory details there yet (and may never be), but I was hoping to use tools.analyzer on as large a variety of existing code bases as possible, and core.async definitely uses &env
20:33amalloyit's very hard to use the vals of &env correctly
20:33akurilinjustin_smith, i bet you there's a team doing that already :)
20:35Bronsaandyf: well, I've made macroexpand-1 to be an extension point of tools.analyzer so as I've said, just rebinding ana/macroexpand-1 to a macroexpand-1 similar to jvm/macroexpand-1 but that applies the macro using (:locals env) instead of env *should* be enough for most use-cases (I've never seen anybody use the values of &env)
20:35andyfSo far most of the contrib libraries analyze without errors, and I've tested another 2 dozen or so Clojure libraries that are not contrib libs today. Things are looking fairly good.
20:36andyfBronsa: WIll try that out soon. Need to go run an errand now, but will let you know how my testing goes. Thanks again.
20:36Bronsaandyf: you've done an invaluable job at testing tools.analyzer on those libraries I, Thank you!
20:37Bronsaamalloy: TBH I never seen anybody use &env vals, I cannot even think of a use-case where that would be needed
20:38rovar,(reduce (fn [x x'] (if (= x' x) (reduced (str "duplicate:" x')) x')) [0 1 2 3 3 4])
20:38clojurebot"duplicate:3"
20:38amalloyoh wait, actually, i think i may have seen the vals used effectively once. let me check
20:39Bronsamaybe the only useful information they expose is whether the local is a fn arg or not?
20:39amalloyBronsa: no, you can actually get at the types the compiler knows about
20:39Bronsaright
20:40amalloyhttps://github.com/flatland/useful/blob/develop/src/flatland/useful/datatypes.clj#L62 uses vals of &env to generate typehinted record-manipulation code
20:42rovar,(reduce (fn [x x'] (if (= x' x) (reduced (str "duplicate:" x')) x')) (repeatedly #(rand-int 20)))
20:42clojurebot"duplicate:4"
20:42rovarhurray #
20:42rovar:)
20:44Bronsaamalloy: clever
20:51bbloomalex asked me to add some perf tests to CLJ-1200, but i ran in to something kinda strange & was wondering if somebody could verify that i'm not crazy
20:51bbloomif you've got a clojure.jar lying around, run `java -jar clojure.jar` and then eval this expression:
20:52bbloom(dotimes [n 10] (time (dotimes [i 5000000] ((fn [& args]) 1 2 3 4))))
20:52Bronsabbloom: http://sprunge.us/FFdO
20:52bbloomon my box, the first time i do that, it averages about 2msecs, but if i eval it again, it averages 55ms
20:52bbloomafter that it averages 130ms each time
20:52bbloomi'm wondering why it slows down after evals
20:53bbloomchanging the number of times doesn't seem to impact it
20:53hiredmanhttps://gist.github.com/hiredman/7727659 not entirely unlike bronsa's in shape
20:54bbloomBronsa: hiredman: ok now eval that expression again
20:54hiredmanhuh, interesting
20:54coventrybbloom: I see the behavior you describe.
20:54Bronsabbloom: http://sprunge.us/WNjO
20:54bbloomhttps://gist.github.com/brandonbloom/7727665
20:54hiredmanheh
20:54hiredmanit is slower everytime
20:54bbloomweird, right?
20:54Bronsaok bbloom me too now
20:55bbloomso strange....
20:55amalloysame here. that's really weird
20:55bbloomone of you geniuses figure that one out while i try to benchmark the original issue lol
20:58slateverowhat are the conventions for style when making a long function call? i've read Batsov's style guide but it doesn't really address this.
20:58slateveroEx: (create-channels (if channel-per-consumer consumer-count consumer-cxn-count) consumer-connections)
20:58slateverowould you break that kind of thing into multiple lines?
20:59Bronsabbloom: I don't see that behaviour with -XX:+TieredCompilation
20:59bbloomBronsa: do you see the faster or slower speed? :-P
20:59Bronsathey keep around 50ms
20:59Bronsathere's no slowdown after evaluations
21:00bbloomhm ok
21:00bbloomwtf does that flag do?
21:00bbloomis there a good guide on what to do when benchmarking?
21:00clojurebotGabh mo leithscéal?
21:00amalloyslatevero: i probably would, yes. one newline, after the if-expr
21:00justin_smithTieredCompilation sets the hotspot optimization level
21:01slatevero@amalloy tnx
21:01amalloyi guess i would put some inside the if-expr as well; i forgot that. but it's optional
21:01justin_smithbbloom: criterium makes it pretty easy, I just added as a dep in my dev profile
21:02coventryBut you don't want to run criterium under leiningen because of the TieredCompilation issue, IIRC.
21:02slateverois it typical to leave the first function argument on the same line as the function?
21:02slatevero..and put additional arguments on newlines if they're long?
21:03justin_smithslatevero: not everybody likes this, but it mostly reflects the norms https://github.com/bbatsov/clojure-style-guide
21:04slatevero@justin_smith - thanks. i read through it but it didn't really mention much about newlines for long function calls so i thought i'd ask
21:05bbloomis there a description of the tieredcompilation thing anywhere?
21:06justin_smithhttp://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html
21:06Bronsabbloom: http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html
21:06Bronsaduh.
21:06justin_smithlol, I think we got the same link
21:08bbloomanyone have a library that 1) makes heavy use of "&"-style variadic functions 2) has a benchmark suite?
21:08bbloomBronsa: thanks
21:16CaptainLexHey Clojure room, I have some architecture questions
21:18scapehow am I supposed to keep an nrepl connection consistent? i tried holding on to the connection and client references, but when re-evaluating the namespace it seems to always default to user; I can't seem to figure out how to get it to keep the namespace it's in
21:19justin_smithscape: are you using defonce to bind the connection?
21:19justin_smithor maybe I should ask, how are you storing the connection
21:19scapeno, but i am placing it in a ref and it's not getting over written there
21:20scapeas in: (dosync (alter buffers conj {bid {:ch ch, :nrepl (nrepl/client (nrepl/connect :port 7888) 1000)}} ;;bid is buffer id
21:20hiredmanscape: you need to have session middleware and keep the session key to send back and forth
21:20hiredmanscape: you should not do io in a transaction
21:20scapeoh, so it's not necessarily the client or connection information, but the session?
21:21scapei placed that for brevity, would a let suffice?
21:24scapehiredman: would it make more sense then to have a single nrepl connection and hang on to the session keys? i want to be able to evaluate separately, from different threads
21:25CaptainLexDoes anyone here know about shaders for OpenGL programming? The basic idea is I want to write shaders in Clojure instead of GLSL. This means "compiling" Clojure to GLSL. What should I use for the compilation steps. Would "simple" macros suffice? Should I invoke the reader somehow?
21:26CaptainLexs/steps./steps?
21:27scapecheck out shadertone CaptainLex
21:27CaptainLexscape: Whoa thanks dude, I shall do this
21:31CaptainLexscape: Do you know how I can contact that Roger Allen guy?
21:31scapeI do not, sorry :\
21:32CaptainLexscape: No problem, I'll figure it out. He's on Twitter!
21:32CaptainLexThanks so much!
21:32creeseWhat is the idiomatic way to open a database connection (and keep it open) using java.jdbc?
21:33justin_smithcreese: best is probably to use a c3p0 pool
21:33clojurebotIk begrijp
21:34justin_smithotherwise, if you are only going to be single threaded with your queries, you can reuse a connection by either passing it to each query, or have helpers that provide it to each jdbc function
21:34justin_smiththen you can store it in an atom (if you really only need one connection / one pool) or have some other method for finding it
21:34justin_smithyou could use a let surrounding an fn to capture it lexically
21:35justin_smith(let [connection (get-connection)] (defn query ...))
21:36hiredman:(
21:37creesejustin_smith: does 'query' take a connection or config map?
21:38hiredmanbad on many levels, a. hiding things b. global connection objects c. I am sure I could come up with more
21:39justin_smithhiredman: so would you go for the pass the connection to every function that uses the db route?
21:42hiredmanjustin_smith: depends
21:42hiredmanbut definitely don't do a closed over let
21:44creeseI need the connection for the entire request-response cycle, and I don't want to close it when the request is done
21:44hiredmancreese: use c3p0
21:47hiredmanone way to approach this is to create db "workers" tasks that run on their own threads that take in queries and return responses from the database, so the db workers have to worry about re-connections, etc, but that has issues with handling errors and resource ownership
21:49hiredmanc3p0 sort of does this behind a jdbc interface, but c3p0 can be painful to configure, although once we got everything tuned at work I don't think we've had further problems with it
21:55creesethanks, I'll take a look
22:17doug_Hi all. I'm just getting started, and trying to get the core.logic library working. I am getting "unresolved symbol" errors but I am not sure why.
22:19justin_smithdoug_: that usually means you are naming things that are not defined, or trying to name something not visible yet from the current namespace
22:19bbloomdoug_: are you trying to introduce new logic variables? maybe you want the "fresh" macro?
22:19coventrydoug_: Can you post the code and the stacktrace you're getting to refheap.com
22:20doug_All I'm trying to do is "(defrel man x)" and getting an error
22:20coventryWhat's your ns form?
22:20doug_I used lein, and added the core.logic to my deps, and confirm it downloaded. Then lein repl, and type (use 'clojure.core.logic
22:21doug_other commands, like (run) work finee
22:21hiredmandoug_: can you pastebin the exception you get?
22:22hiredmandoug_: I believe defrel has been removed from the latest core.logic release
22:23doug_hiredman: thanks... wouldn't have even thought of that
22:26bbloomdoug_: it's pretty easy to experiment for this sort of thing. more so with functions (which are applicative, and evaluate all their arguments), but also possible for macros too: you just try to eval the component parts
22:26bbloom,(let [x y] z)
22:26clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: y in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:26bbloom,y
22:26clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: y in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:26bbloom,let
22:26clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/let, compiling:(NO_SOURCE_PATH:0:0)>
22:27bbloomnote "can't take the value of a macro"
22:27bbloomit found it! but it can't get it's value :-P
22:27bbloomfunctions are easier:
22:27bbloom,(+ x y)
22:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:27bbloom,+
22:27clojurebot#<core$_PLUS_ clojure.core$_PLUS_@c1e9ba>
22:27bbloom,x
22:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:27bbloomtry experimenting that way for undefined symbols in the future!
22:28doug_OK, I posted it on the refheap with my errors https://www.refheap.com/21383
22:29hiredmanyeah, there is some new thing that replaces defrel, I don't really know anything about it (not that I ever knew anything about defrel)
22:29coventryHmm, defrel is still in the tutorial: https://github.com/swannodette/logic-tutorial#question--answer
22:29doug_coventry: my error from core.logic https://www.refheap.com/21383
22:31coventrydefrel has been replaced by pldb, apparently. (Never heard of it.) https://github.com/clojure/core.logic/blob/master/CHANGES.md#changes
22:32coventryIf you're going through that tutorial, I would downgrade to version 0.8.4.
22:32doug_coventry: thank you I will give that a try
22:37doug_coventry: THANK YOU! I should have asked about 2 hours ago.. it was driving me nuts :)
22:44bbloomanother good trick: download the code and run `git grep defrel` and if that doesn't produce any results, run `git log -p` and then type `/defrel` to search for the most recent change that mentions it
22:45bbloomi use those two tricks all the time whenever a readme or blogpost seems out of date :-)
22:46doug_bbloom: nice idea
22:47bbloom`git log -p` is like a magic cheat code for being the fastest team member to find what change introduced a bug :-P
22:47coventrydoug_: NP. You might want to post an issue about it. https://github.com/swannodette/logic-tutorial/issues
22:47doug_BTW, pldb function appears to be "persistent logic database" but I'm not sure of all the implications
22:47doug_coventry: yes, great idea
22:48doug_avoid others from being as confused as I am :)
22:58doug_thanks all for the help... issue submitted on the tutorial
23:22beppu,(let [bigfn identity] (eval '(bigfn 1)))
23:22clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
23:22beppuI get this: CompilerException java.lang.RuntimeException: Unable to resolve symbol: bigfn in this context, compiling:(NO_SOURCE_PATH:1:30)
23:23beppuWhy doesn't bigfn resolve to the identify function that was assigned to it when used with eval?
23:23coventryI don't think eval gets the local bindings from the context in which it's called.
23:23coventrybeppu: What are you trying to do?
23:24beppucoventry: http://www.4clojure.com/problem/58
23:26justin_smithyou really don't need eval for that
23:26coventryHint: Do you know the syntax for a variadic function signature?
23:27beppu[& args] ?
23:27coventryHint 2: and do you know how to loop over a list?
23:27beppuI was trying to loop with reduce in this case.
23:28beppuI'll figure it out.
23:28beppu..
23:28beppuI was just curious about eval's behavior.
23:29justin_smitheval usually isn't what you need
23:46madisjcDoes anyone know where clojure.java.io moved to?
23:47justin_smithwhat, it moved?
23:47madisjceverything I see looks out of date
23:47RaynesIt hasn't moved anywhere.
23:47hiredmanmadisjc: clojure.java.io is where it as has always been
23:48Raynesmadisjc: http://clojure.github.io/clojure/clojure.java.io-api.html
23:48madisjcah great
23:48madisjcthanks for the link Raynes