#clojure logs

2013-09-29

00:02m00nligh_chord: You're going to clone the whole game? If so, it's a big project
00:02chordm00nligh_ we are going to not clone the entire game but make what starcraft 2 should have been
00:02chordnightfly: so you gonna help?
00:03arrdemnightfly, m00nligh_: it's a trap
00:03nightflychord: no, but rather than just tell you to fuck off I'd like to least give you somewhat okay advice first.
00:04m00nligh_Does anyone ever use hadoop and hbase together, store the result in reduce phase to hbase directly?
00:04dcolishyup
00:04chordarrdem: why do you hate starcraft
00:04dcolishwell not to Hbase directly, to hfiles
00:05m00nligh_dcolish: yeah
00:05m00nligh_But then I should use another function to process the result file?
00:05dcolishyou can just bulk load it into hbase
00:05dcolishhey nightfly
00:05dcolishdidnt know you liked clojure too
00:06m00nligh_dcolish: bulk?
00:06dcolishhttp://hbase.apache.org/book/arch.bulk.load.html
00:06m00nligh_dcolish: To read a file on hdfs is different? Is it right?
00:06dcolishits how we do backfills
00:07dcolishif you've ever used copyTable, that does batched row inserts directly to hbase using mapreduce
00:07dcolishits performance is a great example reason why you dont really want to do that
00:08m00nligh_clojure-hadoop's does not support TableOutputFormat ?
00:08tshauckhi, this is a simple question, but if I have core.clj as my main file, then I have func.clj and a function in that file, how can I use that fucntion in core.clj?
00:08dcolishthat would be a huge oversight
00:10mgaarecan't tell if chord is serious
00:11chordmgaare: www.github.com/chord-rts/rts PROOF THAT I PUT IN SOME MINIMAL EFFORT
00:11m00nligh_dcolish: Do you use the clojure-hadoop package or use the Java's hadoop package?
00:11mgaaresaw that, still can't tell if serious
00:11chordmgaare: what makes you still doubt?
00:12dcolishm00nligh_: java's, the clojure-hadoop package doesnt provide any abstraction that would make that worth it
00:12m00nligh_So then, we can use any way the java's hadoop and hbase package provided to us, is it right?
00:13m00nligh_http://twitch.nervestaple.com/2012/01/12/clojure-hbase/
00:13m00nligh_like this post ?
00:13mgaarewell the whole thing is ridiculous on every level :
00:14chordI don't know if I want to hear your reasons, its better if I live in fairy tale land where I believe i can do ANYTHING
00:14callenchord: can you live in that fairy tale land outside of IRC?
00:15Apage43hm
00:15m00nligh_dcolish: So then we can actually use TableOutputFormat to store the result to hbase directly?
00:15Apage43buying groceries before 1AM
00:15Apage43is apparently a suspicious transaction
00:15Apage43and cancels my card
00:16chordmgaare so tell me your entire reasoning you were going to explain, I can handle the bad news
00:16callenApage43: lol
00:17dcolishm00nligh_: it really depends on what your goals are for loading data in hbase
00:17m00nligh_dcolish: Thank's for you kindly help. I give a detail description of my job
00:17m00nligh_What I want to do is to process some log information
00:17m00nligh_and store the result into hbase
00:18m00nligh_So I want to combine the two phase,
00:18clojurebotTitim gan éirí ort.
00:18m00nligh_when the reduce finish, the job will store the result into hbase directly
00:19chordmgaare are you stil alive?
00:20mgaarechord: Ok, I'll bite. I get the impression that you have neither shipped any game before, nor even have a basic familiarity with the tools you propose to use. Starcraft was built by hundreds of people working full time who met both of those qualifications
00:21chordmgaare: so you have experience making games, then you're perfect to help me right?
00:21mgaareI do not, I am not, I will not
00:22chordmgaare but you're an expert at clojure at least right?
00:22mgaareI'm gonna see about finding some expertise in gracefully exiting this conversation now
00:23dcolishm00nligh_: it has been my experience the bulk load approach is faster than TableOutputFormat, your results may vary. You should really explore both with tests and determine what suits your needs best
00:24chordwhy does everyone hate starcraft!!!
00:24m00nligh_dcolish: OK. Thank's for your kindly help.
00:25dcolishno problem, sorry i cant say more. either approach should be straightforward to implement
00:25m00nligh_Yes, thanks very much
00:31chordmgaare If i show you A* path finding working will you join the project
00:43chordmgaare you play dota 2 instead of starcraft?
00:59ivanhttp://youtrack.jetbrains.com/issue/CLJ-242 vote for the La Clojure highlighting bug
01:03chord`cbp help with starcraft project: www.github.com/chord-rts/rts
01:03[Neurotic]chord - how come you went with the old style OpenGL?
01:04chord[Neurotic] the what old what?
01:05[Neurotic]Looking at your OpenGL code
01:05arrdem[Neurotic]: you expected a help vampire to have reasonable code?
01:06chord[Neurotic] I just learned how to put up an opengl window
01:06[Neurotic]arrdem: well, it's not modern OpenGL, but it woul still work
01:06chord[Neurotic] if selfish guys like arrdem had taught me how to do modern opengl then it wouldn't have looked like that
01:06[Neurotic]chord: check out: http://arcsynthesis.org/gltut/
01:07[Neurotic]It'll make your head hurt, but it's a decent primer on modern OpenGL
01:07chord[Neurotic] I need to get core of rts game working before bothering to clean up opengl code
01:07`cbpdont pull me into this :P
01:07[Neurotic]But really, you should probably look into game dev frameworks.
01:07[Neurotic]actually, I kinda disagree
01:08arrdemyay 200x slowdown using a local datastore!
01:08[Neurotic]Integrate with something like http://libgdx.badlogicgames.com/ is probably a better fit anyway
01:08chord[Neurotic] so you going to help with my rts project :)
01:08[Neurotic]I just did
01:08[Neurotic]:D
01:08chord[Neurotic] fork the project
01:08chordyou know you want to
01:09[Neurotic]no thanks, got enough on my plate
01:09chordSUCH AS
01:09[Neurotic]But good luck :D
01:09chordtell me what you are working on
01:10chord[Neurotic] ANSWER ME
01:10[Neurotic]Actually, anyone got some conventions regarding what namespace they put things in when working on clojurescript for a clojure backed app?
01:10[Neurotic]Do they tend to keep them them similar? I'm trying to decide what to use.
01:11chord`cbp: why don't you want to help me?
01:12arrdem[Neurotic]: the pattern seems to be to seperate cljs source from clj, so I don't see an issue with a shared naming scheme. That said having a .client.* and a .server.* to preserve the seperation is probably a good thing.
01:14[Neurotic]arrdem: yeah, I have them in seperate source files... the server code is foo.x.y.z and since it's an angular front end, I'm going with foo.ng.x.y.z .. (I can't be bothered refactoring the server side namespace)
01:16ivanchord was banned from #gamedev, #bitcoin, #litecoin, #RubyOnRails, and #haskell-game this month
01:16arrdemwell there's a shocker...
01:16ivantruly we are buddhas
01:16ambrosebshaha
01:16chordivan how cold you possibly know that
01:16chordthats all a lie
01:16chordyou just made that shit up
01:17arrdemivan: the tranquility of this channel is bounded only by myself and callen
01:36[Neurotic]okay, this is weird (?) doing `lein cljsbuild once` is trying to compile my clojure code in src, not in src-cljs ... at least it seems to be, as it keeps falling over from not being able to find the v8 native for dieter. I'm officially confused.
01:36[Neurotic]dieter is only used in the server code
01:37[Neurotic]That's a good question - should cljs have a seperate project.clj/
01:37[Neurotic]?
01:51chordI am addicted to the idea of starcraft clone made with clojure
01:51chordyou guys need to help me make it
01:52Apage43https://www.google.com/search?q=rehabilitation+centers
01:52chordvery funny apage43
01:56chordApage43 what projects are you currently working on?
01:57Apage43psh i'm playing video games
02:03chordwhich game Apage43
02:04[Neurotic]Does anyone else create a profile specific for lein-cljsbuild, to remove unwanted/needed dependencies?
02:07jonasendnolen: core.async should work now (on cljsfiddle)
02:09Pupnik__chord: dont you think it would be better if you use haskell
02:10arrdemPupnik__: #haskell banned him
02:10arrdemPupnik__: no help comming from there
02:10Pupnik__i cant imagine why
02:17arrdemhehehe
02:18[Neurotic]So I'm starting to wonder if I should have seperate lein profiles, one for 'server', for the clojure code, and one for 'client' for the clojurescript (since they both sit under the same project.clj) - anyone see any issues with that? or am I looking at this the wrong way somehow?
02:18[Neurotic]Basically as a way to manage the dependencies of each seperately
02:30piranhawhat's the good way to do (into {} [:a "b" :c "d"])? partition returns lists rather than vectors and that seems to fail...
02:32ambrosebspiranha: (apply hash-map coll)
02:32piranhaoh!
02:32piranhaambrosebs: thanks! :)
02:32ambrosebsnp
02:33callenambrosebs: congrats on the so-far successful fund raising.
02:33ambrosebscheers callen!
02:34callenambrosebs: I look forward to seeing what you can do to make the Haskell users in my life shut up :)
02:34ambrosebshaha
02:36OtherRavenquick question for you guys: is it better to put multiple ref-set statements in the same dosync, or use a different dosync for each one?
02:36Pupnik__ambrosebs: what are you fund raising for?
02:36ambrosebsPupnik__: http://www.indiegogo.com/projects/typed-clojure/x/4545030
03:28christopherdoes anyone know of a good posix layer for clojure?
03:29christopherspecifically something that gives convenient access to unix domain sockets
04:48chordwww.github.com/chord-rts/rts
04:48chordplease help the project
04:52serycjonHello!
04:53serycjonI try to learn clojure and I am using vim with fireplace plugin for clj programming, but today it started to throw strange errors at me
04:53serycjonError detected while processing function <SNR>30_print_last..fireplace#echo_session_eval..fireplace#session_eval..<SNR>30_eval..189:
04:53serycjonline 38:
04:53serycjonE605: Exception not caught: Error running Clojure: Error: Could not find or load main class clojure.main^@
04:54serycjonWhen i try to eval simple (ns .....)
04:54serycjonAny idea what could be wrong?
04:54serycjonHow to fix it? Thanks!
04:58piranhaif I have (:require [ns1.ns2.x :as x] [ns1.ns2.y :as y]), can I make it somehow shorter and less repetetive?
04:58arrdempiranha: yes.
04:58arrdempiranha: you can rewrite it as (ns1.ns2 [x :as x] [y :as y])
04:58piranhaarrdem: thanks, let me try...
04:59piranhacan I do maybe (n1.ns2 x y z) ?
04:59arrdempiranha: not that I know of.
05:00piranhaok, something to try out :-)
05:00christopherpiranha : iirc that is equiv to [ns1.ns2.x :as ns1.ns2.x] and same for y
05:00piranhaoh :(
05:00piranhaok
05:00arrdemchristopher: yeah that's right.
05:01arrdempiranha: the :as is really a special case for renaming, by default nothing is ever aliased or renamed.
05:01piranhaI see
05:10chordso question can I actually implement efficiently the data structures used by games using a functional language like clojuer
05:12arrdemchord: no there's a reason that the games industry is C and C++ to this day.
05:13chordarrdem: so you're an expert at making games, show me the list of games you've made
05:14arrdemchord: I'd carry this conversation but it wastes my time and ups your ranking in my clojurecup submission. don't worry, I have a ticket with your name on it.
05:14hfaafbchord: depends what the requirements of your game are. you can write tic tac toe in clojure with no concern to performance
05:14indigoarrdem: Good luck in clojure cup :)
05:15mtpthe games industry is a software charnel house
05:15arrdemhfaafb: you could write tic tac toe naively for a stack machine with no registers and still get reasonable performance
05:15mtpi could write tic-tac-toe for a human
05:15mtpand still get reasonable performance
05:15arrdem(inc mtp)
05:15lazybot⇒ 1
05:15hfaafbyou can probably get away with writing some basic 2d games in clojure if you figure out where your bottlenecks are
05:15mtpperformance is fucking boring
05:15mtpnobody cares until you measure it
05:15arrdem(dec mtp)
05:15lazybot⇒ 0
05:15mtpNET GAIN: 0
05:16arrdemmtp: downvotes 'cause I just spent two hours profiling my CC submission's database crap.
05:16mtpsorry, i'm overreacting to a $WORK condition
05:16arrdemlol
05:16mtp$WORK only cares about one thing, and you'll never guess
05:16arrdem$CPU_CYCLES?
05:17mtpno, they care that the CPU_CYCLES are enough to make the PR happy
05:17mtpand i think that pr's bad
05:18mtp(we'll delay a release because the "performance numbers" don't match what they've already sold; we won't actually fix problems that (if fixed) would allow us to sell better performance)
05:18mtp((and i'm overreacting to that; carry on))
05:19chordfor an rts game like starcraft what will be the most performance intensive part?
05:19chordpathfinding?
05:19arrdemchord: no, far and away the rendering engine.
05:20chordarrdem: what do you mean, isn't that the gpu
05:20chordwhat do you mean rendering engine
05:21chordyou mean the rendering the gpu does?
05:21arrdemchord: I wish I was dead drunk, because I'd have so much fun mocking your apparent ignorance in public.
05:22chordarrdem: no one else on the channel is mocking so obviously they're all just as confused
05:22indigoOr maybe just tired
05:22arrdemchord: no everyone else is either asleep, hacking for clojurecup or smart enough to not feed the trolls.
05:22chordindigo: explain NOW
05:22indigochord: So demanding.
05:23arrdemindigo: were it not for the existance of a github repo in clojure and some other stuff I'd swear he's just a bot.
05:23mtparrdem‘ yeah i'm kinda out of words too
05:24indigoLol
05:24chordarrdem: AH HAH SO YOU ADMIT LOOKING AT www.github.com/chord-rts/rts
05:24arrdemchord: if it would save my mother's life I wouldn't read your copypasta code
05:25chordso you concede
05:25chordSO EXPLAIN RENDERING ENGINE
05:25gwschord: http://en.wikipedia.org/wiki/Rendering_engine
05:25arrdemchord: concede what? that you're a blithering idot at a desk somwhere with a script for wasting otherwise productive peoples time?
05:26chordso where does the performance go into the rendering engine
05:26gwsrendering
05:26chordthats the gpu taking the hit right?
05:26gwsThe core functionality typically provided by a game engine includes a rendering engine (“renderer”) for 2D or 3D graphics, a physics engine or collision detection (and collision response), sound, scripting, animation, artificial intelligence, networking, streaming, memory management, threading, localization support, and a scene graph.
05:27chordwe are talking about starcraft clone only
05:27chordwe don't need fancy AAA game shit
05:28chordso I am asking for a starcraft clone where is all the cpu and memory problems going to come from?
05:29chordpath finding is apparently not one of them
05:29chordso gws can you explain where the problems will be specifically for starcraft clone
05:30serycjonchord: just sit down and try to write it :) Maybe one day you will understand what we are trying to tell you...
05:30chordI asked a question, the only way I can understand an answer is if someone answers it...
05:30mtpchord‘ no
05:30mtpyou are asking the wrong question
05:31mtpand you're not listening to the answer
05:31chordnot listening to which answer
05:31mtpif you listen to the answer (which is sometimes "you are asking the wrong question"), you can learn to ask the right one, but YOU have to change
05:32mtpand i think i've made my point to enough people, so, good night :)
05:32indigoYeah, going to go sleep too
05:33arrdem99.2%...
05:34chordso you guys don't know the answer to my question in other words
05:35gwschord: i would guess, but can't prove, that it is possible to make a performant SC1 clone in clojure that's performant enough on modern hardware to be playable
05:35arrdemchord: I'd like to point out that in 718 messages to this unfortunate channel you have yet to pose a reasonable question or accept criticism. The average person gets an answer in three messages.
05:35arrdemchord: belive me I'm counting.
05:35chordgws: because of which part?
05:35gwsi don't understand the question
05:36chordteacher told me that there is no dumb question blame my teachers
05:36chordwhy is a performant sc1 clone in clojure not possible
05:36gwsdid you read what i wrote?
05:36arrdemgws: no, no he didn't
05:37arrdemdamnit I forgot the end case on my loop/recur
05:37arrdem99.98% and never gonna end.
05:37chordso which part of starcraft 2 is the problem in a reimplementation using clojure
05:38serycjonchord: the programmer...
05:38arrdem(inc serycjon)
05:38lazybot⇒ 1
05:38chordyou guys haven't actually answered whats the big deal with clojure
05:39chordshow me a benchmark
05:39arrdemchord: here's the playform you should lear.
05:39arrdemchord: https://www.usenix.org/conference/woot13/page-fault-weird-machine-lessons-instruction-less-computation
05:41chordgws you gotta help me, your'e the only one answering
05:44gwschord: it's possible to create a performant game on the JVM (see minecraft if i'm not mistaken) so it should be *theoretically* possible to create a playable SC clone in clojure
05:45piranhaarrdem: eh, it seems this "optimization" of namespaces is only possible in clojure, but on in clojurescript
05:45chorddidn't you just say the opposite
05:45gwsno
05:46callengws: calling Minecraft performant on the client or server-side is a bit of a stretch.
05:46arrdemcallen: it performs well... at wasting ram!
05:46gwsapparently plenty of people think it's playable
05:47chordgws: ok so can all of those imperative data structures be done in a performant way functionally?
05:47chordgws: that are used for games
05:47callenNobody really knows for sure.
05:47callenPapers on FRP attack the problem from one direction, industry practice from another.
05:48chordcallen: WTF HOW CAN NOBODY KNOW
05:48callenthey'll meet in the middle eventually.
05:48arrdemwe hope
05:48callenarrdem: I trust in the pain of gamedev to be a good incentive.
05:48serycjonchord: those who care are too lazy to quit irc and start programming :)
05:48arrdemcallen: gamedev has bigger issues than functional vs. imperative :|
05:48chordok but worst case scenario is that 99% of my code will be clojure and 1% will be in Java so I can do the imperative stuff?
05:51gwschord: maybe pick up a book on clojure or something
05:51chordgws: I am going to do the generic thing of winging it along the way
05:52chordserycjon and arrdem: I am going to prove you both wrong by implementing a* in clojure PROVING TO YOU THAT I CAN MAKE PROGRESS
05:52borkdudesince no-one in #emacs answers my question, I'll just try it here. This function should, after its execution show the same buffer as where I started it, right? https://www.refheap.com/19131
05:52callenarrdem: certainly.
05:52borkdudeit doesn't, points me to the archive file. what to do about it?
05:52callenarrdem: good luck telling Haskell users that.
05:52gwschord: then do it, and link the results when you're done
05:53chordgws: if I show you guys a working a* then you gys are gonna stop making fun of me right?
05:53TEttingerborkdude, I have no idea how emacs works
05:54TEttingerwe're having troll problems now, unfortunately
05:54christopherborkdude: are you trying to switch to a buffer and execute some stuff and switch back? use with-current-buffer to do that
05:55scottjborkdude: maybe save-excursion or save-window-excursion
05:55gwschord: can't speak for anyone else. good luck. i'm gonna stop chatting - just interacting with you has probably got me on a few people's /ignore
05:56borkdudechristopher scottj I didn't even needed the wrapped save-current-buffer in my previous version of emacs, but I think org-mode might have changed org-archive-subtree
05:56TEttingergws, I still care about you
05:56gwsTEttinger: means a lot *taps chest twice in quick succession*
05:56TEttinger*shies away*
05:58arrdem'night gents
05:58borkdudescottj ah, save-window-excursion is the only thing that worked thanks
06:00chordI am going to prove you all wrong by reading this http://theory.stanford.edu/~amitp/GameProgramming/
06:05callenarrdem: you're sleeping?
06:48christopheri've hacked support for nrepl to use unix domain sockets. this allows you to use unix permissions to protect embedded nrepls running on production servers. right now with tcp local ports, if any process running as any user is compromised, your nrepl can be compromised too.
06:48christopheri'd love for people to help me test it: https://github.com/monsanto/nreplds
06:52john2xI'm getting a compiler exception with this form. It seems there's something wrong with my if form? I'm blind as to what it is though. https://www.refheap.com/19132
06:54john2xis it because I'm recursively calling the function?
06:59john2xnope, tried removing the function call.
07:57oskarth(System/getENV "MYENV") returns nil in my repl / server log, but in my terminal it gives me the right value. What's wrong?
07:59christopheroften daemonizers will clear the environment, sudo does this too on some systems
08:01oskarthchristopher: I assumed that restarting with 'lein ring server' would catch up with ENV that's set. What else do I need to do to get it up to date?
08:01christopheroskarth i actually don't know much about lein ring server, when i speak of daemonizers i mean stuff like start-stop-daemon and upstart
08:01christophersorry
08:02oskarthI see, thanks for the pointers though
08:08oskarthgot it to work. The problem was that I didn't source it globally. I solved it by simply exporting it in my dev-terminal-session before running 'lein ring server'.
08:10naegwhat exact advantages does typed clojure have? except the obvious type checking before runtime
08:10Oddmananyone know if there's a nicer templating approach to HTML than hiccup?
08:12christopheroddman: have you tried enlive?
08:13OddmanI haven't, no - but had a look
08:13Oddmanwas wondering if there was one that was HTML focused?
08:13Oddmanrather than having code generate html
08:13jonasenOddman: https://github.com/davidsantiago/stencil is pretty good
08:13Oddmanwhich I've never been a huge fan of except for rather complex requirements
08:13oskarthOddman: enlive is afaik html focused
08:13squidzOddman: maybe mustache? I think there was a library out there called clostache
08:14Oddmanoh nice, that could work
08:14christopherenlive is html focused; you fill in the template using xpath style selectors
08:15Oddmanyup stencil could be what I want :)
08:15Oddmanthanks all
08:53jonasendnolen: Another core.async example: http://cljsfiddle.net/fiddle/jonase.snake (or http://cljsfiddle.net/view/jonase.snake)
08:57dnolenjonasen: nice
09:48lunkhttps://github.com/lunkdjedi/clj-ta-lib
09:48lunkfun little weekend project
09:59dobry-denhiccup takes discipline.
10:01dobry-denmuch easier to forget that you're ostensibly trying to keep your view layer dumb when it's just another clojure datastructure :(
10:02dobry-denOddman: clostache seems more recent+popular.
10:12Oddmandobry-den cheers :)
10:28john2xI'm getting a compiler exception with this form. It seems there's something wrong with my if form? I'm blind as to what it is though. https://www.refheap.com/19132
10:32dobry-denjohn2x: i think you have to bind the caught exception to something like 'e'
10:34dobry-denthink your if statement needs to be 3rd arg to catch
10:37john2xdobry-den: thanks! that was it
10:39john2xis it possible to dynamically create functions, with their names coming from a list of strings?
10:39darrickwjohn2x: yes, with a macro
10:41darrickw(defmacro defthing [s] `(defn ~(symbol s) [] 42))
10:41darrickwHey, I've got a core.logic question, or maybe a problem. I've written a simple relational parser which works ok in clojure core.logic, but has a problem in ClojureScript.
10:42john2xdarrickw: thanks!
10:42AimHerejohn2x, darrickw, for suitably static values of 'dynamically'. If the strings are generated at runtime, then that won't work, of course
10:43darrickwsure it will, as long as you aren't generating them in clojurescript...
10:43john2xAh the strings are defined by me, I think this'll do. I guess I'll be writing my first ever macro. yey
10:44darrickwRe my core.logic problem. Here is the expected result:
10:44darrickw{:type :model, :model [tweet], :child {:type :rel, :rel responses}}
10:44darrickwand here is the actual result:
10:44darrickw{:type :model, :model <lvar:value_238>, :child <lvar:child_241>}
10:45darrickwThe lvars appear only in clojurescript. If I inspect them, I can see that they were unified.
10:45darrickwHere is a gist: https://gist.github.com/pangloss/6752822
10:49ambrosebsRacket-con! http://t.co/7Up5epRa2g
10:50darrickwLive stream from an SLR?
10:50ambrosebsSLR? It's in Northeastern :)
10:50darrickwjust noticed that every now and then it does a crazy little defocus/refocus
10:51ambrosebsyea we're trying to get their attention on #racket :P
10:51ambrosebsI think the camera operator is watching the talk
10:53darrickwambrosebs: you do core.logic stuff, don't you?
10:53ambrosebsdarrickw: a bit yes
10:53ambrosebsnever in cljs tho
10:54darrickwoh yeah… still the behaviour seems strange to me. Do you think I should just file a bug on that?
10:54darrickwIs there a tracker?
10:55darrickwoh nevermind, I found it...
10:55darrickwI guess I willl just file a bug.
10:57ambrosebsdarrickw: probably yes.
10:57dobry-denI've made decent progress replicating the patterns i'm used to from Rails into my Clojure app.
10:57dobry-deni want to eventually extract it. i'll name it Clojy on Clails.
11:12juliangindiFor some reason, the function I am trying memozie (to reduce API calls) keeps hitting the API server. Could someone give this a look and see what they think: https://gist.github.com/Julian25/6748965
11:38`cbpjuliangindi: how are you telling that the server is getting hit?
11:38`cbpjuliangindi: also don't use def inside a function
11:38juliangindiI'm looking at the API's server console
11:45sverihi, i am trying to parse xml and i was able to get something running, this: http://pastebin.com/JDN6DUDj is the code that gets me one subtag of <item> however, i need all the subtags and its content of item, how would i do that?
11:49juliangindicbp: any idea what could be going wrong?
11:51`cbpjuliangindi: sec
11:51borkdudeWhere would the grep function from old string contrib be nowadays?
11:52`cbpjuliangindi: sorry give me an hour and ill get back to you
11:52juliangindicbp: no worries. Thanks! Much appreciated
11:53borkdudeI guess I can just copy it
12:05mischovsveri: you might check out enlive or laser for some examples of how they go about selecting html.
12:19vijaykiranehd: Mine is built with Pedestal
12:26`cbpjuliangindi: does (println (core-memo/memoized? attempt-request-memo)) print true?
12:28juliangindiit does
12:33sverimischov: thank you, i will try that
12:37`cbpjuliangindi: then i don't know haha. It should be getting memoized. I did an example with clojure.core.memoized/ttl and it memoized correctly. Also looked at the source and didnt find anything weird there, you must not be calling it with the same arguments
12:38juliangindicbp: yeah that might be it. I'll run a few tests. Thanks a ton for looking it over though, much appreciated
12:39`cbpnp
13:05napperwhat is a good document that'll give me a solid understanding of how clojurescript implements and compartmentalizes IJavascript. I would like to know how clojurescript makes decisions for the namespace. (ns)
13:06napperOr if you could point me to where this is beging done in the source, is equally welcome. I cannot seem to find it.
13:10seangrov`napper: You mean src/clj/cljs/closure.clj?
13:10seangrov`Javascript namespaces are basically implemented (from what I understand) via google closure's module system of `provides` and `requires`
13:14napperseangrov, something more along the lines of: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/compiler.clj#L865 - I suppose all I needed to do was pose the question. I should invest in a rubber ducky.
13:14mtp(you're the one)
13:18seangrov`napper: Yeah, that's quite a bit earlier in the process
13:33napperseangrov, I see...hum
13:35seangrov`Alright, time to do this pedestal thing
13:36seangrov`Hopefully it's less than a day to grok some of the ideas
13:45rurumatednolen: in clojurescript 0.0-1909 my code doesn't run anymore, chromium says Uncaught TypeError: Cannot call method 'call' of undefined
13:46rurumatednolen: dnolen don't know which version it was before the change, because version info was missing in project.clj
13:50bbloomrurumate: have you done a `lien cljsbuild clean` ?
13:55juliangindiWhy would stringing 'rests' together work and using 'nth' would not. (rest (rest (rest data))) works but not (nth data 3)
13:55juliangindi(nth data x) always returns nil
13:58KeletAnyone know how to compile a file with Clojure? I set my CLASSPATH to ".". I (set! *compile-path* "."). The file is word.clj in current directory, and it is (ns word). When doing (require 'word) or (compile 'word) it always tells me it can't find word.clj or word__init.clj in classpath.
13:59rurumatednolen: bbloom yup; report coming
14:00rurumatewhoops, should learn to quote
14:19muhooKelet: use lein
14:23muhooOddman: also, clabango
14:24Keletmuhoo: I do, but I also think it's silly to not know how to compile a file in a programming language.
14:24muhooKelet: clojure isn't really a language as much as it is a library for the jvm
14:25muhooit's not like it's got its own compiler.
14:25KeletI thought it compiled its code into JVM bytecode which was then interpreted by whatever JVM you have
14:25muhoothat said, there may be a way to get lein to spit out what it's doing when you do lein compile
14:26muhooit's essentially invoking javac with a massive -cp and other args
14:26muhooyes, it compiles code to jvm bytecode. but clojure "the language" is just a jar file... it's a library
14:26Raynesmuhoo: I think Selmer is probably a better bet than Clabango at this point.
14:26muhooselmer, right
14:27muhoopeople keep changing this stuff :-)
14:27RaynesGoddamn it people, stop making better things than existing things. God.
14:28muhooRaynes: did you get lured into the clojure cup insanity?
14:28Raynesmuhoo: No, despite callen's insistence. I just helped him find team members who weren't dead weight lazy people instead.
14:28Raynes:p
14:29seangrov`Ah, too bad, I could've been dead weight lazy people
14:34`cbpmm has anyone used protocol buffers recently with flatland-protobuf?
14:35muhooi'm curious to see what kind of stuff falls out of that clojure cup thingus.
14:35`cbpI seem to remember it throwing exceptions when making a protobuf with an invalid field, also stuff like (protobuf-load (protobuf-dump (protobuf type {:a 1}))) returns {}
14:36muhooi did some protobuf stuff earlier in the year, but i just used raw java interop
14:37muhooworked fine for what i needed, IIRC
14:38callenseangrov`: I would've roped you in, but you were in foreign lands in search of fortune it seemed.
14:38`cbp(protobuf-schema type) always seems to have {} for :fields :(
14:38seangrov`Yes, I would have just been dead weight
14:38callenmuhoo: Selmer is about ~1000x faster than Clabango. I'm not exaggerating.
14:39`cbpcallen: :-D
14:48`cbpnevermind i think I'm dumb and forgetting how to use protobufs correctly like usual
14:56dobry-denA naive layman's alternative to Redis would be to have a Clojure datastructure that's syncd to a file for durability. is there an efficient way to do something like this?
14:56rurumate,(format "%s" "is there no there no (format a b) in clojurescript?")
14:56clojurebot"is there no there no (format a b) in clojurescript?"
14:57`cbprurumate: I think you can use goog's format?
14:57rurumateoh, ok didn't find that one
14:58ambrosebsFirst stretch goal for Typed Clojure campaign: complete Bronsa's self-hosting Clojure compiler CinC http://www.indiegogo.com/projects/typed-clojure/x/4545030
14:59bbloomnice! congrats
15:00ambrosebsbbloom: cheers!
15:00ambrosebsI think we all want to see CinC!
15:01ambrosebsaaand passed 20k!
15:03seangrov`Yes, congrats ambrosebs, really very cool to see
15:03callenseangrov`: you and Raynes both could've contributed. Found some awesome people for the team :)
15:03ambrosebsthanks!
15:03callenambrosebs: congrats :)
15:03seangrov`How long do you expect to hack for $20k though?
15:03ambrosebsabout 6 months I think. Maybe a little longer
15:04bbloomreally depends on what city you're in :-)
15:04seangrov`Well, sure, if it works for you, it's definitely awesome. All of us will benefit
15:05seangrov`ambrosebs: How is CinC related to typed clojure?
15:05bbloomseangrov`: he made a video to talk about that on the indiegogo page
15:05seangrov`Ah, didn't realize that was a different video
15:06ambrosebsI can't wait to rewrite the checking parts of typed clojure with CinC!
15:07ambrosebsit's a compiler that can actually be changed, hallelujah!
15:08palangoIs there some sort of function to create hierarchic lists from some lists like here: https://www.refheap.com/19145
15:10bbloompalango: certainly not in core, but it's probably pretty easy to do with reduce
15:10bbloompalango: why not use maps though?
15:11bbloom,(reduce #(assoc-in %1 %2 {}) {} [[:a :b :c] [:a :b :d] [:a :c :b] [:a :d] [:b :a]])
15:11clojurebot{:b {:a {}}, :a {:d {}, :c {:b {}}, :b {:d {}, :c {}}}}
15:12seangrov`I didn't realize feature-expressions had been decided on for 1.6. Glad to see something happening around code sharing
15:13bbloomseangrov`: last i saw was this: http://dev.clojure.org/display/design/Release.Next+Planning says "post 1.6"
15:13palangobbloom: that's indeed easier than I thought, thanks
15:14seangrov`bbloom: Ah, I just saw it on the pedestal tutorial https://github.com/pedestal/app-tutorial/wiki/Testing#sharing-code
15:14bbloomseangrov`: i wouldn't read too deeply in to that
15:16seangrov`bbloom: Yeah, I was surprised by it from having read the dev.clojure.org discussion recently
15:16BronsaI want to thank ambrosebs for entrusting me with his campaign's first stretch goal, I'm obviously hoping we can make through the funding and get even more motivation to further develop CinC
15:17seangrov`Bronsa: is the $5k to "finish" CinC?
15:17ambrosebsseangrov`: it's $5k to keep developing.
15:18seangrov`Ok, makes sense
15:18ambrosebsseangrov`: Bronsa is the best person to do it, I want him doing CinC as much as he can :)
15:18Bronsaseangrov`: to keep developing it, meaning also I'll spend a good amount of time on making CinC as easy to understand as possible, meaning blog posts describing the internals, good documentation etc
15:20rurumatednolen, bbloom: oh nvm, it seems like something else was the problem
15:20rurumateCLJS-587 resolved indeed
15:20seangrov`Bronsa: What's the chance/general-timeframe of this replacing the current Java compiler?
15:22Bronsaseangrov` honestly I don't see CinC replacing the current Java compiler any time soon -- as tools.reader is not going to replace LispReader.java
15:23Bronsathe value of the project lies in its analyzer, that can be used/extended by various tools (like core.typed)
15:23seangrov`Bronsa: Curious why - tools.reader was wonderful to work with when transitioning the cljs compiler
15:23Bronsaand in making it easier to experiment with various optimizations/transformations
15:23jjidoWhat is CinC?
15:24seangrov`jjido: https://github.com/Bronsa/CinC
15:24Bronsajjido: a still experimental (but mostly working!) clojure analyzer/compiler written in clojure
15:24seangrov`CinC?
15:24seangrov`clojurebot: CinC is https://github.com/Bronsa/CinC
15:24clojurebot'Sea, mhuise.
15:26tacomanis there any way to prevent the Emacs *nrepl* buffer from autokilling if my process dies?
15:26jjidoself-hosting?
15:26seangrov`Bronsa: The other question I had was how you see it affecting the cljs compiler - the emit phas is obviously analogous to the jvm-bytecode emit phase in CinC. Are there any other benefits to cljs beyond the analyzer?
15:26tacomanjjido: as in, lein trampoline?
15:27Bronsaseangrov` actually emitting jvm bytecode requires quite some more machinery than emitting js
15:27Bronsaseangrov` the CinC analyzer uses children-keys to implement a number of passes over the "base" AST
15:27jjidotacoman: doesn't tell me anything
15:29Bronsaseangrov` virtually cljs could use CinC's analyzer with some custom passes and plug the already existing emit
15:30seangrov`Bronsa: That's more of what I was wondering
15:30tacomanjjido: sorry, I'd thought you were talking about my issue when you said "self-hosting", I'm guessing you meant the discussion here
15:31Bronsaseangrov` using CinC to emit cljs is something I want to try -- not a main objective though and not really going to happen soon
15:37cpetzoldwith core.async, is there a way to know of a channel has been closed other than trying to take?
15:37cpetzoldknow if a*
15:38dobry-dendoes @username notify someone in a Gist comment?
15:39callendobry-den: just how github works in general
15:39callenarrdem: home stretch.
15:39cpetzoldi basically have a nesting of looping channels, and i want them all to close and stop when the top level one is closed.
15:43bbloomcpetzold: no. any observation of the state of a mutable object in a concurrent world is prone to race conditions
15:43bbloomcpetzold: imagine you ask "are you closed?" get "nope", somebody else closes it, then you take a value
15:44bbloomcpetzold: a better solution to your problem is to create a control channel and multiplex on it with your other channels
15:44arrdemcallen: congrats, best of luck. I've punched out due to real life Q_Q
15:45cpetzoldbbloom: ah yeah makes sense
15:46bbloomcpetzold: are you the Charles Petzold of microsoft/windows programming book fame?
15:46cpetzoldbbloom: no :P
15:47cpetzoldConner Petzold, no affiliation with Microsoft
15:48cpetzoldno relation either, afaik
15:49bbloomOK then. I just had to ask because I wouldn't imagine anybody who has spent as much time putzing with the windows message pumps as that guy has ever asking a question about how to accidentally create a race conditions ;-)
15:49cpetzoldlol, no probably not
15:50bbloomI'm certain that guy had written WaitForMultipleObjectsEx more than a few times in his life!
15:50cpetzoldI'm also not cool enough to sport the tattoo: http://charlespetzold.com/PetzoldTattoo.jpg
15:51cpetzoldif i were more of a hipster maybe i could do it ironically
15:53cpetzoldwow, he published a book last year! that's over 20 years of writing books about windows programming
15:54bbloommost people lose money publishing tech books, but i think he's so entrenched in this msft culture that his books just sell by the truck load to bigcos
15:58dnolenfinally http://github.com/clojure/clojurescript/commit/782e10ed2be766323d2bc7560dda636e30eaa647, http://github.com/clojure/clojurescript/commit/b567bc55b54583d31256499c30c1f1a4ee30d900
16:00ambrosebsdnolen: yay!
16:03amalloyfwiw dnolen, you can make that into one url, which is easier to read: https://github.com/clojure/clojurescript/compare/7153b297...b567bc55b
16:03dnolenamalloy: too civilized
16:04dnolenheh, thanks, yeah I just always forget about that
16:04bbloomgit help revisions # super freaking useful man page
16:05bbloomsadly, github's URL scheme doesn't support arbitrary refspecs
16:11georgekhi, is there a way I can reload clojure files with jetty using emacs nrepl *while* also connected to a browser nrepl in the same app? Right now I can run the app with jetty and modify clojure files and see the results on page refresh, but once I connect the browser repl, trying to compile and load clojure files (C-c C-k) causes an error in the cljs repl, and a page refresh shows the old page of course
16:12georgekas a result I have to quit back to the clojure repl to modify clojure files, then reconnect the browser repl...I'm using Austin as the browser repl
16:12georgekI tried running two nrepls in emacs, but I think Austin needs to launch in the same context in which I run-jetty
16:15callenbbloom: aren't tech books supposed to be boosters for consulting gigs?
16:15bbloomcallen: for most people, yeah
16:16bbloomcallen: but that guy is basically the dude who writes all the mass produced msft instruction manuals given out at conferences and such
16:16bbloombasically anything he writes is a best seller in the msft community simply b/c he is the default
16:18callenbbloom: I know who Petzold is, I used to work in the .NET salt mines.
16:19callenbbloom: I once helped move a guy who was apparently a big Cisco router nerd. Wrote a bunch of books
16:19callendude had so much stuff in his house it took a team of 14 people three 12 hour days to move him.
16:19bbloomsheesh
16:20callenbbloom: yuppies man. You give 'em an inch, and they'll own every widget on the planet.
16:25callendoes the :uberjar profile in a project.clj work for anybody else?
16:25callenI still get the annoying AOT warning and it doesn't seem to use the options.
16:25callendo I need to explicitly say with-profile uberjar?
16:32ToBeReplacedcallen: it works for me, no extra work necessary
16:33bbloomhuh. I didn't realize that reference objects had metadata & it's mutable
16:38Bronsabbloom: yeah, also, suppose you have a tagged literal that returns an IRef -- ^meta syntax should overwrite the ref-meta at read-time
16:40Bronsabbloom: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L733-L737 I'm not exactly sure why it resets the meta instead of updating it though
16:40bbloomBronsa: heh, i literally just looked that up & was about to paste the precisely the same lines to you :-P
16:41bbloomcrazy
16:42bbloomthe Whitesmiths style braces still weird me out :-P
16:42Bronsabbloom: that line left me wondering for quite some time while writing tools.reader.
16:42Bronsain the end I chose to keep the behaviour, but I think it's wrong.
16:43bbloomBronsa: so it seems that some var metadata is mutated during bootstrapping of core, but other than that, i haven't seen reset-meta! or alter-meta! ever used
16:46Bronsabbloom: yeah, actually I've never seen metadata used on references other than vars -- and that is usually set automatically by def/intern
16:47bbloomBronsa: i'm trying to make some more sense of the philosophy of metadata
16:47bbloomi keep going back and forth between "metadata is awesome" and "metadata is a nightmare"
16:47bbloomi can't come up with any sort of rule on when metadata is preserved
16:47bbloom& it's so easy to write code that would violate any rule you come up with
16:47lazybotjava.lang.RuntimeException: Unable to resolve symbol: it's in this context
16:48bbloom& lazy bot is still bugged with respect to how i like to join multiple messages together :-P
16:48lazybotjava.lang.RuntimeException: Unable to resolve symbol: lazy in this context
16:48Bronsabbloom: my main complaint with metadata in clojure is its weird (and mostly undocumented) evaluation semantics
16:48bbloomBronsa: you mean with respect to the reader? or like actual runtime evaluation semantics?
16:49Bronsabbloom: regarding read-time metadata, depending on the context it may or may not get evaluated
16:49Bronsaor even get evaluated twice!
16:50bbloomBronsa: evaluated twice?
16:50Bronsatry (def ^{:foo (println "foo")} foo)
16:50bbloomlol well that seems like a bug
16:50bbloomis that only with def ?
16:51bbloomisn't def like the only remaining interpreted op?
16:51Bronsaas far as I can remember
16:51fu86hi
16:51fu86I use a lib (image-resizer) to do some image manipulation
16:52fu86unfortunately the lib sets the filename itself and I cant change this
16:53Bronsabbloom: ^{:foo (println "foo")} (do :foo) here it won't get evaluated for example
16:53fu86https://github.com/josephwilk/image-resizer/blob/master/src/image_resizer/fs.clj#L14
16:53fu86I want to replace this function
16:54fu86is there a clean way to do it in clojure?
16:55bbloomfu86: you can monkey-patch using ##(doc with-redefs)
16:55lazybot⇒ "Macro ([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the ... https://www.refheap.com/19147
16:55bbloomall the usual monkey-patching caveats apply
16:56fu86nice, thanks!
16:57piranhais there a good way to check if one vector contains all elements of other vectors?
16:58bbloom,(require clojure.set)
16:58clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>
16:58bbloom,(require 'clojure.set)
16:58clojurebotnil
16:58bbloom,(doc clojure.set/subset?)
16:58clojurebot"([set1 set2]); Is set1 a subset of set2?"
16:58bbloompiranha: use (into #{} ...)
16:59bbloomor rather just (set ...)
16:59piranhabbloom: oh, clojure.set is not available in clojurescript...
16:59piranhaah damn sorry
16:59piranhaI don't need it there %)
16:59piranhaIt's all messed up in my head already, damned clojure cup
17:00bbloompiranha: https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/set.cljs
17:00bbloomit's there
17:00piranhahmmmmm strange but ok
17:01bbloomBronsa: so the thing w/ metadata i was thinking about was stuff like metadata on lists
17:02bbloomBronsa: conj preserves metadata on lists, but not on seqs
17:03Bronsawell, conj on a seq is cons
17:03BronsaI think.
17:03bbloomBronsa: yeah, that's right
17:03bbloomand cons doesn't preserve meta
17:04bbloomassoc : conj on maps :: cons : conj on seqs
17:04bbloomthose ops on maps preserve, but not on seqs
17:05bbloombut then again :: cons (member function) : conj on lists
17:05Bronsabbloom: I feel like cons shouldn't preserve metadata
17:05bbloomok, why? and what about conj on to lists?
17:07Bronsabbloom: cons has no relationship with the original seq, when you use cons you know you're constructing a new cons with the seq as its tail
17:08gfrederickscons[truct]
17:08Bronsabbloom: I agree however that conj should preserve metadata even on seqs
17:09gfredericksthat gets you into this weird feeling situation where a whole "tree" of objects have the same metadata
17:10Bronsabbloom: an easy fix for this should probably be changing this line https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ASeq.java#L126
17:10gfrederickswhen you conj onto other things you don't inherently maintain a reference to the source object
17:10Bronsato "return new Cons(meta, o, this)"
17:12bbloomgfredericks: yeah, that's an interesting problem: when you push on to a singly linked list, you preserve the interior meta pointer
17:12bbloomif you dissoc from a map, you preserve the metadata
17:12bbloombut if you pop from a list, you get the metadata of list
17:12bbloomer of the NEXT list i mean
17:13bbloom,(-> (list 1) (with-meta {:x 1}) (conj 2) (with-meta {:y 2}) next meta)
17:13clojurebot{:x 1}
17:13gfredericksyeah you certainly don't want this behavior e.g. when using [node child child ...] tree structures
17:14gfrederickswhich seem more comparable in a way
17:14bbloomcompare:
17:14gfredericks(to lists)
17:14bbloom,(-> {:a 1} (with-meta {:x 1}) (conj [:b 2]) (with-meta {:y 2}) (dissoc :b) meta)
17:14clojurebot{:y 2}
17:14Bronsa,(meta (rest (with-meta (list 1 2) {:foo true})))
17:14clojurebotnil
17:14gfredericks,(-> [1 2] (with-meta {:x 1}) (seq) (meta))
17:14clojurebotnil
17:15gfredericks^ unrelated but interesting
17:15bbloomit almost seems like a lot of these issues would go away if you used encapsulator objects & only allowed metadata on those
17:16bbloombut then you'd have an object of overhead for every "root" in to a data structure
17:16bbloomwould greatly simplify equality, printing, dispatch, etc too
17:16bbloomit's basically the "newtype" idea from haskell
17:17bbloomwhich does plenty of compiler cleverness to eliminate those capsule objects at compile time
17:18bbloomthe seqs vs cons vs lists also makes me wonder about (= some-seq some-vec)
17:19bbloomstill don't know how i feel about that :-P
17:20Bronsabbloom: I would be ok with that if we also had a type-dependent comparator
17:20Bronsabut then we get into the CL hell of having n different equality comparators
17:22bbloomBronsa: you can get around that problem by having a special type of encapsulator that provides for custom equality semantics
17:22bbloom(= (wrap x) (wrap y))
17:22bbloomsomething like that
17:23bbloomissue comes in when you have equality buried in a data structure
17:23bbloomb/c then you can only wrap an argument & you need to have proxy objects, delegation, etc. gets complicated fast
17:23Bronsabbloom: isn't wrap just seq?
17:24bbloomthat's one concrete example of a more abstract idea, i guess
17:25bbloomin theory, you could define equality predicates that only operate on a particular type where both arguments are of the same type. then you define some coercion operators. then you can compose a general equality predicate as the composition of coercion and the type-level equality predicate
17:27bblooma -> a -> Bool vs a -> b -> Bool
17:28Bronsayes, I see what you mean
17:28bbloomhaskell kinda punts though, requiring the programmer specify a coersion explicitly, which means that general purpose heterogeneous data types are hard to do
17:28bbloomwhich basically makes 99% of my clojure programs inadmissible to a haskell type checker :-P
17:28Bronsabbloom: in clojure that would get weird with all the various seq implementations
17:29bbloomclojure's equality semantics are such a big step up from every other dynamic language i've ever seen, it's hard to complain
17:29bbloombut i can't help but feel like we're so close to something even better :-)
18:19juliangindiI keep getting this error I cannot figure out and isolate. Clojure.lang.Character cannot be cast to Clojure.lang.Named
18:19gfredericksjuliangindi: do you have a stack trace?
18:20juliangindiyeah one sec
18:20JardaIf I have a value like {:first "f", :second "s", :third "t"} is there an easy way of extracting just a part of it, like {:second "s", :third "t"}
18:20gfredericksJarda: select-keys
18:21Jardagfredericks: thanks! just what I was after
18:21juliangindigfredericks: https://gist.github.com/Julian25/6756907
18:21cddrCan the "instance expresion" part of a dot form (e.g. the "ctx"
18:21cddrin (. ctx (arc ...))) be threaded by the threading macro?
18:21gfrederickscddr: yes
18:22gfredericksyou can also (.arc ctx ...), which works just as well with threading but less parens
18:22gfredericksjuliangindi: is weatherbeacon.views.main your code?
18:22juliangindigfredericks: part of it, yes
18:22gfredericksthis looks like a (ns ...) problem
18:23gfredericksdid you put the docstring in the wrong place?
18:23juliangindihmm. I don't think so. I'm looking into it
18:24gfredericksI got that error with (ns user (:require clojure.test) "foo"), for example
18:29onefoursevenI'm getting this error with http-kit. Anybody know why? "exceed max line 4096"
18:30SrPxWhat is the linguistic/recommended way to represent data/object? For example, in JavaScript you use mostly hashes, but that is inherently slow if not optimized, obviously, because of dynamic hashing
18:32mtpi try not to care about performance, and i also try to look at the object system in the language
18:32gfredericksSrPx: we don't do object-oriented programming very much. data is still stored in hash-maps, but not "methods"
18:32mtpto answer both and neither of your questions
18:33gfredericksprotocols/records are one anwser, but they aren't used in the common case
18:33mtp"stop conflating clojure and OOP"?
18:34hyPiRionstart out with maps, then go to records if performance is an issue is probably good enough
18:35gfredericksthen go to byte-array-backed-structs and lots of macros if performance is an issue
18:35SrPxYes, I know, I mean actually just data. My worry (if you just hash maps for everything) is that it will not be as fast as, say, a struct in C (I do some heavy numerical table crunshing stuff)
18:36SrPxI love using hashes, though, so it boils down to, are them optimized to things like C-struct in the end?
18:36gfredericksclojure has somewhat of a continuum of features between hashmaps and the lowest level
18:36hyPiRionRecords are, I think?
18:39hyPiRionWell, I would guess that for small hashmaps, the difference is roughly 0
18:39mtpSrPx‘ "the first thing i said"
18:40gfrederickshyPiRion: do you mean arraymaps?
18:40mtpjust before "the object system in the language"
18:40gfredericks105 ns for singleton hashmap lookup
18:42gfredericks15 ns for keyword-lookup on a record
18:45gfredericks4 ns for dotted lookup on a record
18:45gfrederickshyPiRion: the difference is roughly 0 seconds :P
18:46hyPiRionyeah, I was right
18:47gfredericksI just had my computer do something three billion times just so I could figure out how long it takes o_O
18:48technomancygfredericks: and that just in order to have an Internet Argument
18:48clojurebotCool story bro.
18:48technomancysurely we are like gods
18:48Brand0lol
18:48gfredericksabout once a day I do a (reduce + (range 10000000)) just to show who's boss
18:48Bronsalol
18:49gfredericks123 ns for a large hash-map lookup (10000 entries)
18:49gfredericksso large hashmap and small hashmap are not much different
18:50hyPiRionyeah, O(log32 n) isn't that much
18:50hyPiRionAs we all know, log n = 1 in Clojure
18:51gfrederickslast one: small arraymap lookup
18:51gfredericks104 ns
19:02zoldarthe thing that surprised me recently is that frequencies, which has complexity of O(n) processes the same sequence in roughly the same (or even a couple times longer) time as sort which should be O(nlogn). I suppose that native array sort being highly optimized is hard to match... https://gist.github.com/zoldar/6425609
19:04AimHereMaybe log n is very close to 1 :)
19:07gfredericksasymptotics. sometimes it has something to do with how fast your code runs.
19:07hyPiRionzoldar: caching plus JVM's adaptive optimization is funny to work with
19:08hyPiRionlike, if you want to measure time
19:08zoldarhyPiRion: clojure doesn't benefit from these too ?
19:09hyPiRionzoldar: yeah, that's the exact issue. It's hard to measure or to get a good estimate on what would be faster
19:09gfrederickszoldar: given that frequencies is doing hashmap work you might argue that it should be O(nlogn) as well
19:09hyPiRionwell, not hard to measure, just a bit more involved than a binary
19:10squidzBronsa: Thanks for your work on clojure-in-clojure. Can you tell me if there are any direct benefits this has on clojurescript?
19:12chordyou guys can't stop me from implementing a*
19:14dpathakjwhy would someone wish to stop you from implementing a*?
19:16chordyou all think I will fail
19:16Jardaif I have several functions that all take a common argument. Somehint like (defn update-user-address [user-id ...] .. and (defn update-user-phone [user-id ...] (these are dummy examples)
19:16Bronsasquidz: mostly the CinC analyzer has shown that the children-keys approach works fine for implementing passes over the ast -- I'd like somewhen in the future to try and add the necessary passes in order to use it instead of the (currently) mostly monolithic clojurescript analyzer
19:17Jardais there a way to have a 'wrapping function' so that I could call like (with-user-id 123 (update-user-address ..) (update-user-phone ..))
19:17Jardato be able to call without repeating the user id
19:18squidzBronsa: what benefits does that have? I\m not familiar with the analyzers of either clojure/clojurescript/clojure-in-clojure
19:18gfredericksJarda: dynamic vars are the normal approach for that kind of thing; I think the sort of use case you're hinting at would be considered overuse by a lot of people, but it's up to you :)
19:19gfredericksthe `with-user-id` part normally ends up being a macro too
19:20Jardagfredericks: ok, reading up
19:20hyPiRionkeep two versions of the function, one with the dynamic use, and one without
19:21hyPiRionat least if you're going to open source that thing
19:21gfredericksI remember going back and forth with cemerick on those kind of tactics wrt that couchdb lib I think
19:21Bronsasquidz: both the clojure/clojurescript analyzer do all the analysys/validation/annotation in a single pass (that's not entirely true for clojure) while cinc does a "basic" analysis constructing the ast nodes and then walks the ast doing all the validation/annotations required in separate passes
19:22Jardagfredericks: yeah does clutch have some (in-database "foo" ...) stuff?
19:22hyPiRionyeah
19:22Bronsathis would allow for e.g. reusing some passes between clojure/clojurescript and possibly enable multiple compilation targets/optimizations
19:22gfredericksI haven't really used it actually
19:23Jardayeah it seems to have dynamic-scope
19:23Bronsasquidz: the short answer is: right now no direct benefit, but it's setting the ground for possible future improvements either having a single analyzer/compiler with different passes attatched or improving/simplifying the current cljs analyzer
19:23gfredericksa coworker was writing an HDFS lib recently and asked me if the config should be an explicit arg or dynamic var; I waffled for a bit and then recommended explicit; felt good about that afterwards
19:24gfredericksit seemed to make the lib really straightforward to understand
19:24squidzBronsa: cool, that sounds exciting. I know a lot of people have been dreaming of cinc for while now so thanks
19:24gfredericksbut libs and app code are different things, of course
19:25Jardahttps://github.com/clojure-clutch/clutch/blob/master/src/com/ashafa/clutch.clj#L26
19:26Bronsasquidz: the main reason for ambrose picking CinC for his campaign's first stretch goal is that having CinC's analyzer complete/easly pluggable/hackable would allow him to have better info regarding the source for core.typed
19:26Jardaoops, no, that can't be it
19:26Bronsathat's probably not clear, I'm going to explain it in a ML post tomorrow
19:27gfredericksoh he did go with the dual approach. I wonder if that was my idea.
19:27squidzML post?
19:27Bronsamailing list :)
19:27squidzoh okay. Look forward to hearing more. It's really exciting stuff
19:32chordi'm so glad that clojure cup is about to end
19:32chordso you guys can go back to helping me with my rts project
19:34mgaarewill be interesting to see if this inspires a fresh round of creative ways to say no
19:40chordmgaare why is everyone like you so negative
19:49paulsamwaysHi all. I'm attempting to build an uberjar, but I'm stuck with clj-time failing when AOT, the exception given at runtime is "java.lang.ClassNotFoundException: clj_time.coerce.ICoerce". I'm new to Clojure/Java, any one able to give some pointers to finding a solution for this?
19:58gfrederickspaulsamways: my only guess is to try `lein clean` first
20:04chordpaulsamways: you didn't add the dependency to your porject?
20:17paulsamwayschord: clj-time is in the dependencies vector in project.clj
20:21indigopaulsamways: Pastebin your project.clj
20:23allenj12hey guys ive been sruggling on this error can someone help me? https://www.refheap.com/19156
20:24allenj12i commented the error and commented problem spots
20:24paulsamwayshttp://pastebin.com/MY8x9QDN
20:30ambrosebsallenj12: line 126 looks fishy
20:30ambrosebsallenj12: the (first board-queue)
20:31ambrosebsis that guaranteed to be non-nil?
20:31allenj12ambrosebs: it seems like it should be right? since its always expanding and we should find a goal before it runs out
20:33ambrosebsallenj12: prove it, abstract it out into a let binding and use assert to ensure non-nil :)
20:34allenj12ambrosebs: hmm not quite sure what u mean like [let board =...] assert board?
20:34ambrosebsallenj12: usually it'd expect (if (seq board-queue) ...) somewhere if your solution is getting smaller, just seems like an odd condition.
20:35ambrosebssomething like this on line 126: (let [fboard (first board-queue) _ (assert fboard)] (recur .... fboard))
20:35allenj12hmm
20:36allenj12anbrosebs: kk ty also are u familiar with a* i seem to have an algorithmic problem aswell but not sure what it is
20:38ambrosebsallenj12: not comfortably
20:39allenj12ambrosebs: kk whats that underscore btw in ur example just a space?
20:39ambrosebsallenj12: it's just a convention for a throwaway binding name
20:39ambrosebs"don't ever use this binding"
20:39ambrosebsit's for side effects only
20:40TEttingerallenj12, in case your professor is up-tight about spelling, it's manhattan, not manhatten. don't want to get marked down for something silly.
20:41allenj12Tettinger: hey! and no im sure hes not lol btw can u look at my frontier expansion and check that and conditions? im not sure if thats valid
20:41allenj12ambrosebs: im confused why did u use quotes? lol dont ever use _ or use _
20:41TEttingersure. I've never implemented A* but I've done something close
20:42allenj12ambrosebs: btw wouldnt it be better to use a while loop?
20:42allenj12ambrosebs: sry not loop just term lol while not asser...
20:42allenj12Tettinger: THNX!
20:45callenoh. my. god.
20:45callenRaynes: you were the smart one
20:47TEttingerallenj12: is list defined in your code somewhere?
20:47akurilincallen, ping. Got a sec or busy with the event atm?
20:48TEttingerI'm not sure what (list {}) dos
20:48TEttinger,(doc list)
20:48clojurebot"([& items]); Creates a new list containing the items."
20:48allenj12makes it a list
20:48TEttingerso it's a list of one map?
20:48allenj12its essentially making a list of has maps
20:48TEttingerahhh
20:48metellus,(list {:a 1 :b 2})
20:48clojurebot({:a 1, :b 2})
20:48allenj12it starts off as one hash map
20:48allenj12then we see the nodes next to it and add to the list
20:49allenj12each hash map a board state
20:52TEttingerallenj12: ah. line 172, it prints nil.
20:52TEttingerthat's one of your boards that it tries to findIndex in
20:53TEttinger(sorry, in the paste)
20:53allenj12Tettinger: hmm o wow i thought for some reason remove nil? would take care of that
20:54TEttingerhm, it's the println on line 101
20:54TEttingeryou need to call remove on the *movs*
20:54TEttinger*moves*
20:55allenj12TEttinger: hmm can i just put that right next to it?
20:56TEttingerlet me check
20:58allenj12TEttinger: just tried it no luck i must admit this is a little confusing since *moves* is only of length 4 and shouldnt be running those last 2 times
20:59benkaywhat wouyld a neat, idiomatic approach to getting the second and fourth elements of each vector in a vector of vectors?
20:59benkaywould be*
21:01allenj12do you want [[1] [2] [3] [4]] ---> [2] [4]?
21:01brehaut,(map (juxt (partial nth 1) (partial nth 3)) [[1 2 3 4 5] [:a :b :c :d :e]])
21:01clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
21:01brehaut,(nth [1 2] 1)
21:01clojurebot2
21:02brehaut,(map (juxt #(% 1) #(% 3)) [[1 2 3 4 5] [:a :b :c :d :e]])
21:02clojurebot([2 4] [:b :d])
21:03benkaymore like [[1 2 3 4] [5 6 7 8]] --> [[2 4] [6 8]]
21:03brehautof course that will indexoutofbounds if you pass it a short vector
21:04benkayah
21:04benkayjuxt! how nifty.
21:04brehautso you probably want get
21:04brehaut~juxt
21:04clojurebotif you think 'complement is great, wait till you see 'juxt
21:04brehaut~juxt
21:04clojurebotjuxt is the bestest option though if it doesn't weird you out
21:05redingerEverybody should find a reason to use juxt every day
21:06benkaythanks brehaut!
21:06brehautnp
21:06mullr_In the clojurescript compiler, we have :foreign-libs to deal with non google-closure modules.
21:07mullr_But many times those modules depend on each other implicitly, and require a certain load order.
21:07mullr_Is there a way to express such dependencies with clojurescript :foreign-libs?
21:09allenj12TEttinger: tried adding a (if (not (nil? board)) imbetween fn and the other if but didnt work
21:10brehaut,(doc if-not)
21:10clojurebot"([test then] [test then else]); Evaluates test. If logical false, evaluates and returns then expr, otherwise else expr, if supplied, else nil."
21:11brehautand if board is a seqable thing then (if (seq board) …
21:15allenj12TEttinger: any luck?
21:16mullr_The answer to the above, although undocumented, appears to be that you can add a :requires clause to your foreign library definition, which can refer to the "provides" from another.
21:22allenj12made some changes https://www.refheap.com/19156 but still having the same problem not sure why some of the board print nil when its being maped to just a set of length 4
21:24jamiiztellman: http://hugoagogo.clojurecup.com/
21:24jamiiztellman: It's pretty close to 10k games / second
21:28allenj12WEIRD. if i take away the last condition history-check it runs but just goes back and forth which dosnt make sense
21:32allenj12https://www.refheap.com/19158 more changes took away the third condition in the and statement in frontier function now prints but only back and fourth move
21:41seangrov`mullr_: Looking at load-foreign-library*, it doesn't look like it
21:42mullr_@seangrov` It looks to me like it passes through the :requires data
21:42mullr_at least, that appears to work
21:43mullr_but it may have simply happened to shift the order of things to a state that works
21:46allenj12Seems to solve!!!! but dosnt give optimal path can anyone see something wrong with algorithm?
21:46allenj12https://www.refheap.com/19156
22:07john2xhow do I map a macro to a vector?
22:08allenj12so say i have a list of hash maps ( {:a 1 :b '(1 2 3)} {:a 2 :b '(1 2 3 4 5)}) and i wanted to sort the list of hash maps by first :a but then :b second if theres a tie for :a
22:09seangrov`john2x: macros can't be mapped
22:09john2xoh ok. I tried doseq but it didn't seem to work as well.
22:09seangrov`You can put it in an anonymous function, but it depends on what you're trying to do
22:20robinkWhat's the enlive syntax to replace a node with its child nodes? i.e. given (enlive/at myhiccupnode [:img] enlive/nodechildren) turn <div><img src="bigannoyingimage.png"><a href="http://foocorp.com/thisisnecessary&quot;&gt;Hey, guy, click here!</a></img></div> into <div><a href="http://foocorp.com/thisisnecessary&quot;&gt;Hey, guy, click here!</a></div>
22:21robinkSorry s/hiccup/hickory/
22:21robinkI have a hickory nested map that I'm operating on
22:21robinkSo (at myhickorynode [:img]) works, I'm just not sure how to say "turn those <img> tags into their children, without any contained text"
22:22marcopolo2What's the proper way to serialize (round trip) cljs datastructures?
22:24seangrov`marcopolo2: goog.json/parse, goog.json/generate ?
22:25seangrov`Also edn if your requirements allow for it
22:26robinkn/m got it
22:26callenI am...much more relaxed now.
22:26marcopolo2seangrov`: Thanks! :)
22:26callenakurilin: around?
22:26akurilincallen, yessir.
22:27callenakurilin: Clojure cup ended. I'm too tired to type. Google Hangout?
22:27callenakurilin: I actually had another person asking about Bulwark, so I wanted to plan some tweaks/updates and discuss them with you based on your email.
22:28akurilincallen, sure, sec,
22:28`cbpcallen: im back to doing the rethinkdb stuff would you give me contribute status or accept pull requests?
22:29callen`cbp: oh wow.
22:29callen`cbp: yeah let me add you.
22:30callen`cbp: cesarbp?
22:30callen(on gh)
22:30`cbpyeah
22:30callen`cbp: nice cactus. you're added. go for it.
22:34`cbp:)
22:43allenj12It woooooooooooooooooooorrrrrrrrrrrrrrrrrrrrrrrrrrrkkkkkkkkkkkkkkkkkkkkksssssssssssssssssssss11111111
22:44allenj12give it your worst!!!!! https://www.refheap.com/19158
22:52seangrov`allenj12: What's example input?
22:52allenj12seangrov: what do you mean run any valid input :)
22:52allenj12seangrov: o
22:52allenj12seangrov: 345126780
22:53allenj12seangrov: no spaces no chars etc
23:03bbloomallenj12: shesh. maybe you should spend a little time trying to clean up the code to look more idiomatic
23:04allenj12bbloom: i am new so any tips would be great!! i do need to hand this in soon tho lol
23:04bbloomallenj12: generally, lisp code does not leave trailing )
23:04bbloomuse 2 space indents
23:04bbloomaim for < 80 characters per line
23:05bbloomline up arguments if you indent them
23:05bbloomlearn about -> and ->>
23:05bbloomyou can learn about them with doc:
23:05bbloom(doc ->)
23:05clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
23:05allenj12bbloom: o wow cool
23:05bbloomuse (condp = …) where case doesn't help
23:06seangrov`Interesting, .indexOf will work on clj, but won't work in cljs because (I think) cljs data structures don't implement it
23:06bbloomuse not= instead of (not (=
23:06bbloomuse extra let bindings to break up long lines / expressions
23:07bbloomallenj12: avoid mixing side effects like printing with your other functions
23:07bbloomallenj12: ie instead of print-solution finding AND printing the solution, create one function that finds the solution and another one that prints the solution data
23:07allenj12bbloom: ahhh ok
23:08bbloomuse doseq instead of loop/recur for side effecting over sequences
23:08bbloomstart with those & then i'll give you some more tips :-)
23:08bbloomthat's a lot of stuff i threw at you :-P
23:10bbloomallenj12: otherwise, you're off to a good start
23:10bbloomi see some nice tricks in there like using sets as predicates ;-)
23:10seangrov`allenj12: http://cljsfiddle.net/fiddle/sgrove.eight-puzzle.core
23:10seangrov`And use cljsfiddle to share code if you'd like others to play with it a bit
23:11allenj12bbloom: thanks i always ask people alot of qustions when first starting so alot of the time i pick up some fancy stuff early
23:11allenj12seangrov: THNX!
23:11bbloomthat's good!
23:11SegFaultAXAlso, why introduce vars with earmuffs that aren't dynamic or mutable? They're just constants.
23:11bbloomallenj12: doing the puzzles at 4clojure.com is a great way to learn the stdlib and if you follow some top folks on the leaderboard you'll also learn some neat idioms
23:11bbloomsometimes you'll see golfing tricks, but other times there are really good ideas in there!
23:12seangrov`allenj12: Also, probably a good idea to use docstrings instead of the comments off to the right
23:12allenj12seangrov: yea i saw those but never did that b4 and i was in a little bit if a rush :P
23:12SegFaultAXLet allows multiple bindings (and it's recursive)
23:16bbloomallenj12: after you submit your assignment, clean it up & resubmit it if your teacher will take it
23:16bbloomor don't bother resubmitting it and enjoy the learning experience :-)
23:17hiredman
23:19allenj12bbloom: i will definatly clean it up but idk if its worth re submitting.. he has this weird hatred towards lisps
23:19allenj12bbloom: lol
23:19allenj12bbloom: definately wont appreciate the clean up as much
23:20seangrov`allenj12: Well, formatting and naming like that can't help
23:21bblooma CS professor who hates lisps is no CS professor
23:23tomjackis there no way to do case-like keyword dispatch in java?
23:23tomjackyou have to do if (key.equals(Keyword.intern(...))) else if ... ?
23:24allenj12bbloom: i know its fucking weird hes kinda joke professor tho thats why im learning new languages class is to easy
23:24tomjackI guess == works
23:24allenj12bbloom: which is also weird cause his PhD was in machine learning
23:24bbloomallenj12: this channel is always happy to educate. submit your homework & then go rock & roll w/ making it pretty :-)
23:24bbloomeh, matrix math has taken over AI :-)
23:27seangrov`All about stats now...
23:33allenj12bbloom: im very good at linear algebra but suck at everyhing else lol like the probability theory
23:33allenj12bbloom: machine learning here is more theory than algorithms
23:39seangrov`"One counter is updated every two seconds and the other every five seconds... The io.pedestal.app.util.platform ... is used in the example above to create a timeout...you could have used JavaScript interop here and called js/setTimeout instead."
23:39seangrov`Surely that should be js/setInterval?
23:40seangrov`Ah, no, setTimeout is correct, some other part of pedestal is responsible for calling the functions on an interval.
23:46ddellacostasmarter way to do this? &(filter #(= (:session-id (val %)) 2) {{:foo "foo"} {:session-id 1} {:bar "bar"} {:session-id 2}})
23:46ddellacosta&(filter #(= (:session-id (val %)) 2) {{:foo "foo"} {:session-id 1} {:bar "bar"} {:session-id 2}})
23:46lazybot⇒ ([{:bar "bar"} {:session-id 2}])
23:47ddellacostaI find myself using filter a lot, and can't help but think I'm missing out on some more declarative ways to do things
23:47TEttingerfilter seems pretty declarative?
23:48TEttingerddellacosta, is that a map of map keys to map values?
23:48ddellacostaTEttinger: hmm, feels so much like I'm processing a data structure, rather than getting a value (or nil), which is what I'd rather do.
23:49ddellacostaTEttinger: yes.
23:49TEttingerI'm wondering if one of the *-in functions would work
23:49ddellacostaTEttinger: exactly, I was thinking of get-in when I asked the question.
23:50TEttingeror update-in
23:51ddellacostaTEttinger: ah, yeah, I guess actually I should use get-in if I can provide the first key
23:51ddellacosta&(= 2 (get-in {{:foo "foo"} {:session-id 1} {:bar "bar"} {:session-id 2}} [{:bar "bar"} :session-id]))
23:51lazybot⇒ true
23:52TEttingerthat doesn't seem much clearer tbh
23:52TEttingerfilter is generally clear enough to me
23:53TEttingeris there supposed to be more than one :session-id 2 ?
23:55ddellacostaTEttinger: yeah, I guess it depends on what is going on around it (in terms of clarity). There should not be more than one session-id 2, but there may be none.
23:56TEttingerthen filter will return an empty seq or a seq of one item, right?
23:57ddellacostaTEttinger: re: filter vs. other techniques--in any case, just trying to think of all the possibilities. I just don't like it when I get stuck using one trope over and over…it makes me think I should be thinking a bit harder about the patterns I use.
23:57TEttingerI'm wondering if there's some search function in clojure that finds the first that satisfies a predicate
23:57TEttingeris that some?
23:57ddellacostaTEttinger: yes, to answer your question, although because it's a map I get a vector representing the map entry, which is kind of annoying but I guess amounts to the same thing
23:57TEttinger,(doc some)
23:57clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
23:57ddellacostaah yeah, some could be a good one to think about too
23:58TEttingererr
23:58TEttingersome returns true/false