2013-09-29
| 00:02 | m00nligh_ | chord: You're going to clone the whole game? If so, it's a big project |
| 00:02 | chord | m00nligh_ we are going to not clone the entire game but make what starcraft 2 should have been |
| 00:02 | chord | nightfly: so you gonna help? |
| 00:03 | arrdem | nightfly, m00nligh_: it's a trap |
| 00:03 | nightfly | chord: no, but rather than just tell you to fuck off I'd like to least give you somewhat okay advice first. |
| 00:04 | m00nligh_ | Does anyone ever use hadoop and hbase together, store the result in reduce phase to hbase directly? |
| 00:04 | dcolish | yup |
| 00:04 | chord | arrdem: why do you hate starcraft |
| 00:04 | dcolish | well not to Hbase directly, to hfiles |
| 00:05 | m00nligh_ | dcolish: yeah |
| 00:05 | m00nligh_ | But then I should use another function to process the result file? |
| 00:05 | dcolish | you can just bulk load it into hbase |
| 00:05 | dcolish | hey nightfly |
| 00:05 | dcolish | didnt know you liked clojure too |
| 00:06 | m00nligh_ | dcolish: bulk? |
| 00:06 | dcolish | http://hbase.apache.org/book/arch.bulk.load.html |
| 00:06 | m00nligh_ | dcolish: To read a file on hdfs is different? Is it right? |
| 00:06 | dcolish | its how we do backfills |
| 00:07 | dcolish | if you've ever used copyTable, that does batched row inserts directly to hbase using mapreduce |
| 00:07 | dcolish | its performance is a great example reason why you dont really want to do that |
| 00:08 | m00nligh_ | clojure-hadoop's does not support TableOutputFormat ? |
| 00:08 | tshauck | hi, 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:08 | dcolish | that would be a huge oversight |
| 00:10 | mgaare | can't tell if chord is serious |
| 00:11 | chord | mgaare: www.github.com/chord-rts/rts PROOF THAT I PUT IN SOME MINIMAL EFFORT |
| 00:11 | m00nligh_ | dcolish: Do you use the clojure-hadoop package or use the Java's hadoop package? |
| 00:11 | mgaare | saw that, still can't tell if serious |
| 00:11 | chord | mgaare: what makes you still doubt? |
| 00:12 | dcolish | m00nligh_: java's, the clojure-hadoop package doesnt provide any abstraction that would make that worth it |
| 00:12 | m00nligh_ | So then, we can use any way the java's hadoop and hbase package provided to us, is it right? |
| 00:13 | m00nligh_ | http://twitch.nervestaple.com/2012/01/12/clojure-hbase/ |
| 00:13 | m00nligh_ | like this post ? |
| 00:13 | mgaare | well the whole thing is ridiculous on every level : |
| 00:14 | chord | I 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:14 | callen | chord: can you live in that fairy tale land outside of IRC? |
| 00:15 | Apage43 | hm |
| 00:15 | m00nligh_ | dcolish: So then we can actually use TableOutputFormat to store the result to hbase directly? |
| 00:15 | Apage43 | buying groceries before 1AM |
| 00:15 | Apage43 | is apparently a suspicious transaction |
| 00:15 | Apage43 | and cancels my card |
| 00:16 | chord | mgaare so tell me your entire reasoning you were going to explain, I can handle the bad news |
| 00:16 | callen | Apage43: lol |
| 00:17 | dcolish | m00nligh_: it really depends on what your goals are for loading data in hbase |
| 00:17 | m00nligh_ | dcolish: Thank's for you kindly help. I give a detail description of my job |
| 00:17 | m00nligh_ | What I want to do is to process some log information |
| 00:17 | m00nligh_ | and store the result into hbase |
| 00:18 | m00nligh_ | So I want to combine the two phase, |
| 00:18 | clojurebot | Titim gan éirí ort. |
| 00:18 | m00nligh_ | when the reduce finish, the job will store the result into hbase directly |
| 00:19 | chord | mgaare are you stil alive? |
| 00:20 | mgaare | chord: 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:21 | chord | mgaare: so you have experience making games, then you're perfect to help me right? |
| 00:21 | mgaare | I do not, I am not, I will not |
| 00:22 | chord | mgaare but you're an expert at clojure at least right? |
| 00:22 | mgaare | I'm gonna see about finding some expertise in gracefully exiting this conversation now |
| 00:23 | dcolish | m00nligh_: 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:24 | chord | why does everyone hate starcraft!!! |
| 00:24 | m00nligh_ | dcolish: OK. Thank's for your kindly help. |
| 00:25 | dcolish | no problem, sorry i cant say more. either approach should be straightforward to implement |
| 00:25 | m00nligh_ | Yes, thanks very much |
| 00:31 | chord | mgaare If i show you A* path finding working will you join the project |
| 00:43 | chord | mgaare you play dota 2 instead of starcraft? |
| 00:59 | ivan | http://youtrack.jetbrains.com/issue/CLJ-242 vote for the La Clojure highlighting bug |
| 01:03 | chord | `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:04 | chord | [Neurotic] the what old what? |
| 01:05 | [Neurotic] | Looking at your OpenGL code |
| 01:05 | arrdem | [Neurotic]: you expected a help vampire to have reasonable code? |
| 01:06 | chord | [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:06 | chord | [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:07 | chord | [Neurotic] I need to get core of rts game working before bothering to clean up opengl code |
| 01:07 | `cbp | dont 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:08 | arrdem | yay 200x slowdown using a local datastore! |
| 01:08 | [Neurotic] | Integrate with something like http://libgdx.badlogicgames.com/ is probably a better fit anyway |
| 01:08 | chord | [Neurotic] so you going to help with my rts project :) |
| 01:08 | [Neurotic] | I just did |
| 01:08 | [Neurotic] | :D |
| 01:08 | chord | [Neurotic] fork the project |
| 01:08 | chord | you know you want to |
| 01:09 | [Neurotic] | no thanks, got enough on my plate |
| 01:09 | chord | SUCH AS |
| 01:09 | [Neurotic] | But good luck :D |
| 01:09 | chord | tell me what you are working on |
| 01:10 | chord | [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:11 | chord | `cbp: why don't you want to help me? |
| 01:12 | arrdem | [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:16 | ivan | chord was banned from #gamedev, #bitcoin, #litecoin, #RubyOnRails, and #haskell-game this month |
| 01:16 | arrdem | well there's a shocker... |
| 01:16 | ivan | truly we are buddhas |
| 01:16 | ambrosebs | haha |
| 01:16 | chord | ivan how cold you possibly know that |
| 01:16 | chord | thats all a lie |
| 01:16 | chord | you just made that shit up |
| 01:17 | arrdem | ivan: 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:51 | chord | I am addicted to the idea of starcraft clone made with clojure |
| 01:51 | chord | you guys need to help me make it |
| 01:52 | Apage43 | https://www.google.com/search?q=rehabilitation+centers |
| 01:52 | chord | very funny apage43 |
| 01:56 | chord | Apage43 what projects are you currently working on? |
| 01:57 | Apage43 | psh i'm playing video games |
| 02:03 | chord | which game Apage43 |
| 02:04 | [Neurotic] | Does anyone else create a profile specific for lein-cljsbuild, to remove unwanted/needed dependencies? |
| 02:07 | jonasen | dnolen: core.async should work now (on cljsfiddle) |
| 02:09 | Pupnik__ | chord: dont you think it would be better if you use haskell |
| 02:10 | arrdem | Pupnik__: #haskell banned him |
| 02:10 | arrdem | Pupnik__: no help comming from there |
| 02:10 | Pupnik__ | i cant imagine why |
| 02:17 | arrdem | hehehe |
| 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:30 | piranha | what's the good way to do (into {} [:a "b" :c "d"])? partition returns lists rather than vectors and that seems to fail... |
| 02:32 | ambrosebs | piranha: (apply hash-map coll) |
| 02:32 | piranha | oh! |
| 02:32 | piranha | ambrosebs: thanks! :) |
| 02:32 | ambrosebs | np |
| 02:33 | callen | ambrosebs: congrats on the so-far successful fund raising. |
| 02:33 | ambrosebs | cheers callen! |
| 02:34 | callen | ambrosebs: I look forward to seeing what you can do to make the Haskell users in my life shut up :) |
| 02:34 | ambrosebs | haha |
| 02:36 | OtherRaven | quick 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:36 | Pupnik__ | ambrosebs: what are you fund raising for? |
| 02:36 | ambrosebs | Pupnik__: http://www.indiegogo.com/projects/typed-clojure/x/4545030 |
| 03:28 | christopher | does anyone know of a good posix layer for clojure? |
| 03:29 | christopher | specifically something that gives convenient access to unix domain sockets |
| 04:48 | chord | www.github.com/chord-rts/rts |
| 04:48 | chord | please help the project |
| 04:52 | serycjon | Hello! |
| 04:53 | serycjon | I 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:53 | serycjon | Error detected while processing function <SNR>30_print_last..fireplace#echo_session_eval..fireplace#session_eval..<SNR>30_eval..189: |
| 04:53 | serycjon | line 38: |
| 04:53 | serycjon | E605: Exception not caught: Error running Clojure: Error: Could not find or load main class clojure.main^@ |
| 04:54 | serycjon | When i try to eval simple (ns .....) |
| 04:54 | serycjon | Any idea what could be wrong? |
| 04:54 | serycjon | How to fix it? Thanks! |
| 04:58 | piranha | if I have (:require [ns1.ns2.x :as x] [ns1.ns2.y :as y]), can I make it somehow shorter and less repetetive? |
| 04:58 | arrdem | piranha: yes. |
| 04:58 | arrdem | piranha: you can rewrite it as (ns1.ns2 [x :as x] [y :as y]) |
| 04:58 | piranha | arrdem: thanks, let me try... |
| 04:59 | piranha | can I do maybe (n1.ns2 x y z) ? |
| 04:59 | arrdem | piranha: not that I know of. |
| 05:00 | piranha | ok, something to try out :-) |
| 05:00 | christopher | piranha : iirc that is equiv to [ns1.ns2.x :as ns1.ns2.x] and same for y |
| 05:00 | piranha | oh :( |
| 05:00 | piranha | ok |
| 05:00 | arrdem | christopher: yeah that's right. |
| 05:01 | arrdem | piranha: the :as is really a special case for renaming, by default nothing is ever aliased or renamed. |
| 05:01 | piranha | I see |
| 05:10 | chord | so question can I actually implement efficiently the data structures used by games using a functional language like clojuer |
| 05:12 | arrdem | chord: no there's a reason that the games industry is C and C++ to this day. |
| 05:13 | chord | arrdem: so you're an expert at making games, show me the list of games you've made |
| 05:14 | arrdem | chord: 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:14 | hfaafb | chord: depends what the requirements of your game are. you can write tic tac toe in clojure with no concern to performance |
| 05:14 | indigo | arrdem: Good luck in clojure cup :) |
| 05:15 | mtp | the games industry is a software charnel house |
| 05:15 | arrdem | hfaafb: you could write tic tac toe naively for a stack machine with no registers and still get reasonable performance |
| 05:15 | mtp | i could write tic-tac-toe for a human |
| 05:15 | mtp | and still get reasonable performance |
| 05:15 | arrdem | (inc mtp) |
| 05:15 | lazybot | ⇒ 1 |
| 05:15 | hfaafb | you can probably get away with writing some basic 2d games in clojure if you figure out where your bottlenecks are |
| 05:15 | mtp | performance is fucking boring |
| 05:15 | mtp | nobody cares until you measure it |
| 05:15 | arrdem | (dec mtp) |
| 05:15 | lazybot | ⇒ 0 |
| 05:15 | mtp | NET GAIN: 0 |
| 05:16 | arrdem | mtp: downvotes 'cause I just spent two hours profiling my CC submission's database crap. |
| 05:16 | mtp | sorry, i'm overreacting to a $WORK condition |
| 05:16 | arrdem | lol |
| 05:16 | mtp | $WORK only cares about one thing, and you'll never guess |
| 05:16 | arrdem | $CPU_CYCLES? |
| 05:17 | mtp | no, they care that the CPU_CYCLES are enough to make the PR happy |
| 05:17 | mtp | and i think that pr's bad |
| 05:18 | mtp | (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:18 | mtp | ((and i'm overreacting to that; carry on)) |
| 05:19 | chord | for an rts game like starcraft what will be the most performance intensive part? |
| 05:19 | chord | pathfinding? |
| 05:19 | arrdem | chord: no, far and away the rendering engine. |
| 05:20 | chord | arrdem: what do you mean, isn't that the gpu |
| 05:20 | chord | what do you mean rendering engine |
| 05:21 | chord | you mean the rendering the gpu does? |
| 05:21 | arrdem | chord: I wish I was dead drunk, because I'd have so much fun mocking your apparent ignorance in public. |
| 05:22 | chord | arrdem: no one else on the channel is mocking so obviously they're all just as confused |
| 05:22 | indigo | Or maybe just tired |
| 05:22 | arrdem | chord: no everyone else is either asleep, hacking for clojurecup or smart enough to not feed the trolls. |
| 05:22 | chord | indigo: explain NOW |
| 05:22 | indigo | chord: So demanding. |
| 05:23 | arrdem | indigo: 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:23 | mtp | arrdem‘ yeah i'm kinda out of words too |
| 05:24 | indigo | Lol |
| 05:24 | chord | arrdem: AH HAH SO YOU ADMIT LOOKING AT www.github.com/chord-rts/rts |
| 05:24 | arrdem | chord: if it would save my mother's life I wouldn't read your copypasta code |
| 05:25 | chord | so you concede |
| 05:25 | chord | SO EXPLAIN RENDERING ENGINE |
| 05:25 | gws | chord: http://en.wikipedia.org/wiki/Rendering_engine |
| 05:25 | arrdem | chord: concede what? that you're a blithering idot at a desk somwhere with a script for wasting otherwise productive peoples time? |
| 05:26 | chord | so where does the performance go into the rendering engine |
| 05:26 | gws | rendering |
| 05:26 | chord | thats the gpu taking the hit right? |
| 05:26 | gws | The 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:27 | chord | we are talking about starcraft clone only |
| 05:27 | chord | we don't need fancy AAA game shit |
| 05:28 | chord | so I am asking for a starcraft clone where is all the cpu and memory problems going to come from? |
| 05:29 | chord | path finding is apparently not one of them |
| 05:29 | chord | so gws can you explain where the problems will be specifically for starcraft clone |
| 05:30 | serycjon | chord: just sit down and try to write it :) Maybe one day you will understand what we are trying to tell you... |
| 05:30 | chord | I asked a question, the only way I can understand an answer is if someone answers it... |
| 05:30 | mtp | chord‘ no |
| 05:30 | mtp | you are asking the wrong question |
| 05:31 | mtp | and you're not listening to the answer |
| 05:31 | chord | not listening to which answer |
| 05:31 | mtp | if 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:32 | mtp | and i think i've made my point to enough people, so, good night :) |
| 05:32 | indigo | Yeah, going to go sleep too |
| 05:33 | arrdem | 99.2%... |
| 05:34 | chord | so you guys don't know the answer to my question in other words |
| 05:35 | gws | chord: 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:35 | arrdem | chord: 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:35 | arrdem | chord: belive me I'm counting. |
| 05:35 | chord | gws: because of which part? |
| 05:35 | gws | i don't understand the question |
| 05:36 | chord | teacher told me that there is no dumb question blame my teachers |
| 05:36 | chord | why is a performant sc1 clone in clojure not possible |
| 05:36 | gws | did you read what i wrote? |
| 05:36 | arrdem | gws: no, no he didn't |
| 05:37 | arrdem | damnit I forgot the end case on my loop/recur |
| 05:37 | arrdem | 99.98% and never gonna end. |
| 05:37 | chord | so which part of starcraft 2 is the problem in a reimplementation using clojure |
| 05:38 | serycjon | chord: the programmer... |
| 05:38 | arrdem | (inc serycjon) |
| 05:38 | lazybot | ⇒ 1 |
| 05:38 | chord | you guys haven't actually answered whats the big deal with clojure |
| 05:39 | chord | show me a benchmark |
| 05:39 | arrdem | chord: here's the playform you should lear. |
| 05:39 | arrdem | chord: https://www.usenix.org/conference/woot13/page-fault-weird-machine-lessons-instruction-less-computation |
| 05:41 | chord | gws you gotta help me, your'e the only one answering |
| 05:44 | gws | chord: 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:45 | piranha | arrdem: eh, it seems this "optimization" of namespaces is only possible in clojure, but on in clojurescript |
| 05:45 | chord | didn't you just say the opposite |
| 05:45 | gws | no |
| 05:46 | callen | gws: calling Minecraft performant on the client or server-side is a bit of a stretch. |
| 05:46 | arrdem | callen: it performs well... at wasting ram! |
| 05:46 | gws | apparently plenty of people think it's playable |
| 05:47 | chord | gws: ok so can all of those imperative data structures be done in a performant way functionally? |
| 05:47 | chord | gws: that are used for games |
| 05:47 | callen | Nobody really knows for sure. |
| 05:47 | callen | Papers on FRP attack the problem from one direction, industry practice from another. |
| 05:48 | chord | callen: WTF HOW CAN NOBODY KNOW |
| 05:48 | callen | they'll meet in the middle eventually. |
| 05:48 | arrdem | we hope |
| 05:48 | callen | arrdem: I trust in the pain of gamedev to be a good incentive. |
| 05:48 | serycjon | chord: those who care are too lazy to quit irc and start programming :) |
| 05:48 | arrdem | callen: gamedev has bigger issues than functional vs. imperative :| |
| 05:48 | chord | ok 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:51 | gws | chord: maybe pick up a book on clojure or something |
| 05:51 | chord | gws: I am going to do the generic thing of winging it along the way |
| 05:52 | chord | serycjon and arrdem: I am going to prove you both wrong by implementing a* in clojure PROVING TO YOU THAT I CAN MAKE PROGRESS |
| 05:52 | borkdude | since 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:52 | callen | arrdem: certainly. |
| 05:52 | borkdude | it doesn't, points me to the archive file. what to do about it? |
| 05:52 | callen | arrdem: good luck telling Haskell users that. |
| 05:52 | gws | chord: then do it, and link the results when you're done |
| 05:53 | chord | gws: if I show you guys a working a* then you gys are gonna stop making fun of me right? |
| 05:53 | TEttinger | borkdude, I have no idea how emacs works |
| 05:54 | TEttinger | we're having troll problems now, unfortunately |
| 05:54 | christopher | borkdude: are you trying to switch to a buffer and execute some stuff and switch back? use with-current-buffer to do that |
| 05:55 | scottj | borkdude: maybe save-excursion or save-window-excursion |
| 05:55 | gws | chord: 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:56 | borkdude | christopher 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:56 | TEttinger | gws, I still care about you |
| 05:56 | gws | TEttinger: means a lot *taps chest twice in quick succession* |
| 05:56 | TEttinger | *shies away* |
| 05:58 | arrdem | 'night gents |
| 05:58 | borkdude | scottj ah, save-window-excursion is the only thing that worked thanks |
| 06:00 | chord | I am going to prove you all wrong by reading this http://theory.stanford.edu/~amitp/GameProgramming/ |
| 06:05 | callen | arrdem: you're sleeping? |
| 06:48 | christopher | i'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:48 | christopher | i'd love for people to help me test it: https://github.com/monsanto/nreplds |
| 06:52 | john2x | I'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:54 | john2x | is it because I'm recursively calling the function? |
| 06:59 | john2x | nope, tried removing the function call. |
| 07:57 | oskarth | (System/getENV "MYENV") returns nil in my repl / server log, but in my terminal it gives me the right value. What's wrong? |
| 07:59 | christopher | often daemonizers will clear the environment, sudo does this too on some systems |
| 08:01 | oskarth | christopher: 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:01 | christopher | oskarth 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:01 | christopher | sorry |
| 08:02 | oskarth | I see, thanks for the pointers though |
| 08:08 | oskarth | got 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:10 | naeg | what exact advantages does typed clojure have? except the obvious type checking before runtime |
| 08:10 | Oddman | anyone know if there's a nicer templating approach to HTML than hiccup? |
| 08:12 | christopher | oddman: have you tried enlive? |
| 08:13 | Oddman | I haven't, no - but had a look |
| 08:13 | Oddman | was wondering if there was one that was HTML focused? |
| 08:13 | Oddman | rather than having code generate html |
| 08:13 | jonasen | Oddman: https://github.com/davidsantiago/stencil is pretty good |
| 08:13 | Oddman | which I've never been a huge fan of except for rather complex requirements |
| 08:13 | oskarth | Oddman: enlive is afaik html focused |
| 08:13 | squidz | Oddman: maybe mustache? I think there was a library out there called clostache |
| 08:14 | Oddman | oh nice, that could work |
| 08:14 | christopher | enlive is html focused; you fill in the template using xpath style selectors |
| 08:15 | Oddman | yup stencil could be what I want :) |
| 08:15 | Oddman | thanks all |
| 08:53 | jonasen | dnolen: Another core.async example: http://cljsfiddle.net/fiddle/jonase.snake (or http://cljsfiddle.net/view/jonase.snake) |
| 08:57 | dnolen | jonasen: nice |
| 09:48 | lunk | https://github.com/lunkdjedi/clj-ta-lib |
| 09:48 | lunk | fun little weekend project |
| 09:59 | dobry-den | hiccup takes discipline. |
| 10:01 | dobry-den | much easier to forget that you're ostensibly trying to keep your view layer dumb when it's just another clojure datastructure :( |
| 10:02 | dobry-den | Oddman: clostache seems more recent+popular. |
| 10:12 | Oddman | dobry-den cheers :) |
| 10:28 | john2x | I'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:32 | dobry-den | john2x: i think you have to bind the caught exception to something like 'e' |
| 10:34 | dobry-den | think your if statement needs to be 3rd arg to catch |
| 10:37 | john2x | dobry-den: thanks! that was it |
| 10:39 | john2x | is it possible to dynamically create functions, with their names coming from a list of strings? |
| 10:39 | darrickw | john2x: yes, with a macro |
| 10:41 | darrickw | (defmacro defthing [s] `(defn ~(symbol s) [] 42)) |
| 10:41 | darrickw | Hey, 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:42 | john2x | darrickw: thanks! |
| 10:42 | AimHere | john2x, darrickw, for suitably static values of 'dynamically'. If the strings are generated at runtime, then that won't work, of course |
| 10:43 | darrickw | sure it will, as long as you aren't generating them in clojurescript... |
| 10:43 | john2x | Ah the strings are defined by me, I think this'll do. I guess I'll be writing my first ever macro. yey |
| 10:44 | darrickw | Re my core.logic problem. Here is the expected result: |
| 10:44 | darrickw | {:type :model, :model [tweet], :child {:type :rel, :rel responses}} |
| 10:44 | darrickw | and here is the actual result: |
| 10:44 | darrickw | {:type :model, :model <lvar:value_238>, :child <lvar:child_241>} |
| 10:45 | darrickw | The lvars appear only in clojurescript. If I inspect them, I can see that they were unified. |
| 10:45 | darrickw | Here is a gist: https://gist.github.com/pangloss/6752822 |
| 10:49 | ambrosebs | Racket-con! http://t.co/7Up5epRa2g |
| 10:50 | darrickw | Live stream from an SLR? |
| 10:50 | ambrosebs | SLR? It's in Northeastern :) |
| 10:50 | darrickw | just noticed that every now and then it does a crazy little defocus/refocus |
| 10:51 | ambrosebs | yea we're trying to get their attention on #racket :P |
| 10:51 | ambrosebs | I think the camera operator is watching the talk |
| 10:53 | darrickw | ambrosebs: you do core.logic stuff, don't you? |
| 10:53 | ambrosebs | darrickw: a bit yes |
| 10:53 | ambrosebs | never in cljs tho |
| 10:54 | darrickw | oh yeah… still the behaviour seems strange to me. Do you think I should just file a bug on that? |
| 10:54 | darrickw | Is there a tracker? |
| 10:55 | darrickw | oh nevermind, I found it... |
| 10:55 | darrickw | I guess I willl just file a bug. |
| 10:57 | ambrosebs | darrickw: probably yes. |
| 10:57 | dobry-den | I've made decent progress replicating the patterns i'm used to from Rails into my Clojure app. |
| 10:57 | dobry-den | i want to eventually extract it. i'll name it Clojy on Clails. |
| 11:12 | juliangindi | For 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 | `cbp | juliangindi: how are you telling that the server is getting hit? |
| 11:38 | `cbp | juliangindi: also don't use def inside a function |
| 11:38 | juliangindi | I'm looking at the API's server console |
| 11:45 | sveri | hi, 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:49 | juliangindi | cbp: any idea what could be going wrong? |
| 11:51 | `cbp | juliangindi: sec |
| 11:51 | borkdude | Where would the grep function from old string contrib be nowadays? |
| 11:52 | `cbp | juliangindi: sorry give me an hour and ill get back to you |
| 11:52 | juliangindi | cbp: no worries. Thanks! Much appreciated |
| 11:53 | borkdude | I guess I can just copy it |
| 12:05 | mischov | sveri: you might check out enlive or laser for some examples of how they go about selecting html. |
| 12:19 | vijaykiran | ehd: Mine is built with Pedestal |
| 12:26 | `cbp | juliangindi: does (println (core-memo/memoized? attempt-request-memo)) print true? |
| 12:28 | juliangindi | it does |
| 12:33 | sveri | mischov: thank you, i will try that |
| 12:37 | `cbp | juliangindi: 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:38 | juliangindi | cbp: yeah that might be it. I'll run a few tests. Thanks a ton for looking it over though, much appreciated |
| 12:39 | `cbp | np |
| 13:05 | napper | what 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:06 | napper | Or if you could point me to where this is beging done in the source, is equally welcome. I cannot seem to find it. |
| 13:10 | seangrov` | napper: You mean src/clj/cljs/closure.clj? |
| 13:10 | seangrov` | Javascript namespaces are basically implemented (from what I understand) via google closure's module system of `provides` and `requires` |
| 13:14 | napper | seangrov, 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:14 | mtp | (you're the one) |
| 13:18 | seangrov` | napper: Yeah, that's quite a bit earlier in the process |
| 13:33 | napper | seangrov, I see...hum |
| 13:35 | seangrov` | Alright, time to do this pedestal thing |
| 13:36 | seangrov` | Hopefully it's less than a day to grok some of the ideas |
| 13:45 | rurumate | dnolen: in clojurescript 0.0-1909 my code doesn't run anymore, chromium says Uncaught TypeError: Cannot call method 'call' of undefined |
| 13:46 | rurumate | dnolen: dnolen don't know which version it was before the change, because version info was missing in project.clj |
| 13:50 | bbloom | rurumate: have you done a `lien cljsbuild clean` ? |
| 13:55 | juliangindi | Why would stringing 'rests' together work and using 'nth' would not. (rest (rest (rest data))) works but not (nth data 3) |
| 13:55 | juliangindi | (nth data x) always returns nil |
| 13:58 | Kelet | Anyone 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:59 | rurumate | dnolen: bbloom yup; report coming |
| 14:00 | rurumate | whoops, should learn to quote |
| 14:19 | muhoo | Kelet: use lein |
| 14:23 | muhoo | Oddman: also, clabango |
| 14:24 | Kelet | muhoo: I do, but I also think it's silly to not know how to compile a file in a programming language. |
| 14:24 | muhoo | Kelet: clojure isn't really a language as much as it is a library for the jvm |
| 14:25 | muhoo | it's not like it's got its own compiler. |
| 14:25 | Kelet | I thought it compiled its code into JVM bytecode which was then interpreted by whatever JVM you have |
| 14:25 | muhoo | that said, there may be a way to get lein to spit out what it's doing when you do lein compile |
| 14:26 | muhoo | it's essentially invoking javac with a massive -cp and other args |
| 14:26 | muhoo | yes, it compiles code to jvm bytecode. but clojure "the language" is just a jar file... it's a library |
| 14:26 | Raynes | muhoo: I think Selmer is probably a better bet than Clabango at this point. |
| 14:26 | muhoo | selmer, right |
| 14:27 | muhoo | people keep changing this stuff :-) |
| 14:27 | Raynes | Goddamn it people, stop making better things than existing things. God. |
| 14:28 | muhoo | Raynes: did you get lured into the clojure cup insanity? |
| 14:28 | Raynes | muhoo: No, despite callen's insistence. I just helped him find team members who weren't dead weight lazy people instead. |
| 14:28 | Raynes | :p |
| 14:29 | seangrov` | Ah, too bad, I could've been dead weight lazy people |
| 14:34 | `cbp | mm has anyone used protocol buffers recently with flatland-protobuf? |
| 14:35 | muhoo | i'm curious to see what kind of stuff falls out of that clojure cup thingus. |
| 14:35 | `cbp | I 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:36 | muhoo | i did some protobuf stuff earlier in the year, but i just used raw java interop |
| 14:37 | muhoo | worked fine for what i needed, IIRC |
| 14:38 | callen | seangrov`: 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:38 | seangrov` | Yes, I would have just been dead weight |
| 14:38 | callen | muhoo: Selmer is about ~1000x faster than Clabango. I'm not exaggerating. |
| 14:39 | `cbp | callen: :-D |
| 14:48 | `cbp | nevermind i think I'm dumb and forgetting how to use protobufs correctly like usual |
| 14:56 | dobry-den | A 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:56 | rurumate | ,(format "%s" "is there no there no (format a b) in clojurescript?") |
| 14:56 | clojurebot | "is there no there no (format a b) in clojurescript?" |
| 14:57 | `cbp | rurumate: I think you can use goog's format? |
| 14:57 | rurumate | oh, ok didn't find that one |
| 14:58 | ambrosebs | First stretch goal for Typed Clojure campaign: complete Bronsa's self-hosting Clojure compiler CinC http://www.indiegogo.com/projects/typed-clojure/x/4545030 |
| 14:59 | bbloom | nice! congrats |
| 15:00 | ambrosebs | bbloom: cheers! |
| 15:00 | ambrosebs | I think we all want to see CinC! |
| 15:01 | ambrosebs | aaand passed 20k! |
| 15:03 | seangrov` | Yes, congrats ambrosebs, really very cool to see |
| 15:03 | callen | seangrov`: you and Raynes both could've contributed. Found some awesome people for the team :) |
| 15:03 | ambrosebs | thanks! |
| 15:03 | callen | ambrosebs: congrats :) |
| 15:03 | seangrov` | How long do you expect to hack for $20k though? |
| 15:03 | ambrosebs | about 6 months I think. Maybe a little longer |
| 15:04 | bbloom | really depends on what city you're in :-) |
| 15:04 | seangrov` | Well, sure, if it works for you, it's definitely awesome. All of us will benefit |
| 15:05 | seangrov` | ambrosebs: How is CinC related to typed clojure? |
| 15:05 | bbloom | seangrov`: he made a video to talk about that on the indiegogo page |
| 15:05 | seangrov` | Ah, didn't realize that was a different video |
| 15:06 | ambrosebs | I can't wait to rewrite the checking parts of typed clojure with CinC! |
| 15:07 | ambrosebs | it's a compiler that can actually be changed, hallelujah! |
| 15:08 | palango | Is there some sort of function to create hierarchic lists from some lists like here: https://www.refheap.com/19145 |
| 15:10 | bbloom | palango: certainly not in core, but it's probably pretty easy to do with reduce |
| 15:10 | bbloom | palango: why not use maps though? |
| 15:11 | bbloom | ,(reduce #(assoc-in %1 %2 {}) {} [[:a :b :c] [:a :b :d] [:a :c :b] [:a :d] [:b :a]]) |
| 15:11 | clojurebot | {:b {:a {}}, :a {:d {}, :c {:b {}}, :b {:d {}, :c {}}}} |
| 15:12 | seangrov` | I didn't realize feature-expressions had been decided on for 1.6. Glad to see something happening around code sharing |
| 15:13 | bbloom | seangrov`: last i saw was this: http://dev.clojure.org/display/design/Release.Next+Planning says "post 1.6" |
| 15:13 | palango | bbloom: that's indeed easier than I thought, thanks |
| 15:14 | seangrov` | bbloom: Ah, I just saw it on the pedestal tutorial https://github.com/pedestal/app-tutorial/wiki/Testing#sharing-code |
| 15:14 | bbloom | seangrov`: i wouldn't read too deeply in to that |
| 15:16 | seangrov` | bbloom: Yeah, I was surprised by it from having read the dev.clojure.org discussion recently |
| 15:16 | Bronsa | I 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:17 | seangrov` | Bronsa: is the $5k to "finish" CinC? |
| 15:17 | ambrosebs | seangrov`: it's $5k to keep developing. |
| 15:18 | seangrov` | Ok, makes sense |
| 15:18 | ambrosebs | seangrov`: Bronsa is the best person to do it, I want him doing CinC as much as he can :) |
| 15:18 | Bronsa | seangrov`: 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:20 | rurumate | dnolen, bbloom: oh nvm, it seems like something else was the problem |
| 15:20 | rurumate | CLJS-587 resolved indeed |
| 15:20 | seangrov` | Bronsa: What's the chance/general-timeframe of this replacing the current Java compiler? |
| 15:22 | Bronsa | seangrov` 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:23 | Bronsa | the value of the project lies in its analyzer, that can be used/extended by various tools (like core.typed) |
| 15:23 | seangrov` | Bronsa: Curious why - tools.reader was wonderful to work with when transitioning the cljs compiler |
| 15:23 | Bronsa | and in making it easier to experiment with various optimizations/transformations |
| 15:23 | jjido | What is CinC? |
| 15:24 | seangrov` | jjido: https://github.com/Bronsa/CinC |
| 15:24 | Bronsa | jjido: a still experimental (but mostly working!) clojure analyzer/compiler written in clojure |
| 15:24 | seangrov` | CinC? |
| 15:24 | seangrov` | clojurebot: CinC is https://github.com/Bronsa/CinC |
| 15:24 | clojurebot | 'Sea, mhuise. |
| 15:26 | tacoman | is there any way to prevent the Emacs *nrepl* buffer from autokilling if my process dies? |
| 15:26 | jjido | self-hosting? |
| 15:26 | seangrov` | 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:26 | tacoman | jjido: as in, lein trampoline? |
| 15:27 | Bronsa | seangrov` actually emitting jvm bytecode requires quite some more machinery than emitting js |
| 15:27 | Bronsa | seangrov` the CinC analyzer uses children-keys to implement a number of passes over the "base" AST |
| 15:27 | jjido | tacoman: doesn't tell me anything |
| 15:29 | Bronsa | seangrov` virtually cljs could use CinC's analyzer with some custom passes and plug the already existing emit |
| 15:30 | seangrov` | Bronsa: That's more of what I was wondering |
| 15:30 | tacoman | jjido: sorry, I'd thought you were talking about my issue when you said "self-hosting", I'm guessing you meant the discussion here |
| 15:31 | Bronsa | seangrov` using CinC to emit cljs is something I want to try -- not a main objective though and not really going to happen soon |
| 15:37 | cpetzold | with core.async, is there a way to know of a channel has been closed other than trying to take? |
| 15:37 | cpetzold | know if a* |
| 15:38 | dobry-den | does @username notify someone in a Gist comment? |
| 15:39 | callen | dobry-den: just how github works in general |
| 15:39 | callen | arrdem: home stretch. |
| 15:39 | cpetzold | i basically have a nesting of looping channels, and i want them all to close and stop when the top level one is closed. |
| 15:43 | bbloom | cpetzold: no. any observation of the state of a mutable object in a concurrent world is prone to race conditions |
| 15:43 | bbloom | cpetzold: imagine you ask "are you closed?" get "nope", somebody else closes it, then you take a value |
| 15:44 | bbloom | cpetzold: a better solution to your problem is to create a control channel and multiplex on it with your other channels |
| 15:44 | arrdem | callen: congrats, best of luck. I've punched out due to real life Q_Q |
| 15:45 | cpetzold | bbloom: ah yeah makes sense |
| 15:46 | bbloom | cpetzold: are you the Charles Petzold of microsoft/windows programming book fame? |
| 15:46 | cpetzold | bbloom: no :P |
| 15:47 | cpetzold | Conner Petzold, no affiliation with Microsoft |
| 15:48 | cpetzold | no relation either, afaik |
| 15:49 | bbloom | OK 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:49 | cpetzold | lol, no probably not |
| 15:50 | bbloom | I'm certain that guy had written WaitForMultipleObjectsEx more than a few times in his life! |
| 15:50 | cpetzold | I'm also not cool enough to sport the tattoo: http://charlespetzold.com/PetzoldTattoo.jpg |
| 15:51 | cpetzold | if i were more of a hipster maybe i could do it ironically |
| 15:53 | cpetzold | wow, he published a book last year! that's over 20 years of writing books about windows programming |
| 15:54 | bbloom | most 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:58 | dnolen | finally http://github.com/clojure/clojurescript/commit/782e10ed2be766323d2bc7560dda636e30eaa647, http://github.com/clojure/clojurescript/commit/b567bc55b54583d31256499c30c1f1a4ee30d900 |
| 16:00 | ambrosebs | dnolen: yay! |
| 16:03 | amalloy | fwiw dnolen, you can make that into one url, which is easier to read: https://github.com/clojure/clojurescript/compare/7153b297...b567bc55b |
| 16:03 | dnolen | amalloy: too civilized |
| 16:04 | dnolen | heh, thanks, yeah I just always forget about that |
| 16:04 | bbloom | git help revisions # super freaking useful man page |
| 16:05 | bbloom | sadly, github's URL scheme doesn't support arbitrary refspecs |
| 16:11 | georgek | hi, 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:12 | georgek | as 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:12 | georgek | I tried running two nrepls in emacs, but I think Austin needs to launch in the same context in which I run-jetty |
| 16:15 | callen | bbloom: aren't tech books supposed to be boosters for consulting gigs? |
| 16:15 | bbloom | callen: for most people, yeah |
| 16:16 | bbloom | callen: but that guy is basically the dude who writes all the mass produced msft instruction manuals given out at conferences and such |
| 16:16 | bbloom | basically anything he writes is a best seller in the msft community simply b/c he is the default |
| 16:18 | callen | bbloom: I know who Petzold is, I used to work in the .NET salt mines. |
| 16:19 | callen | bbloom: I once helped move a guy who was apparently a big Cisco router nerd. Wrote a bunch of books |
| 16:19 | callen | dude had so much stuff in his house it took a team of 14 people three 12 hour days to move him. |
| 16:19 | bbloom | sheesh |
| 16:20 | callen | bbloom: yuppies man. You give 'em an inch, and they'll own every widget on the planet. |
| 16:25 | callen | does the :uberjar profile in a project.clj work for anybody else? |
| 16:25 | callen | I still get the annoying AOT warning and it doesn't seem to use the options. |
| 16:25 | callen | do I need to explicitly say with-profile uberjar? |
| 16:32 | ToBeReplaced | callen: it works for me, no extra work necessary |
| 16:33 | bbloom | huh. I didn't realize that reference objects had metadata & it's mutable |
| 16:38 | Bronsa | bbloom: yeah, also, suppose you have a tagged literal that returns an IRef -- ^meta syntax should overwrite the ref-meta at read-time |
| 16:40 | Bronsa | bbloom: 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:40 | bbloom | Bronsa: heh, i literally just looked that up & was about to paste the precisely the same lines to you :-P |
| 16:41 | bbloom | crazy |
| 16:42 | bbloom | the Whitesmiths style braces still weird me out :-P |
| 16:42 | Bronsa | bbloom: that line left me wondering for quite some time while writing tools.reader. |
| 16:42 | Bronsa | in the end I chose to keep the behaviour, but I think it's wrong. |
| 16:43 | bbloom | Bronsa: 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:46 | Bronsa | bbloom: yeah, actually I've never seen metadata used on references other than vars -- and that is usually set automatically by def/intern |
| 16:47 | bbloom | Bronsa: i'm trying to make some more sense of the philosophy of metadata |
| 16:47 | bbloom | i keep going back and forth between "metadata is awesome" and "metadata is a nightmare" |
| 16:47 | bbloom | i can't come up with any sort of rule on when metadata is preserved |
| 16:47 | bbloom | & it's so easy to write code that would violate any rule you come up with |
| 16:47 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: it's in this context |
| 16:48 | bbloom | & lazy bot is still bugged with respect to how i like to join multiple messages together :-P |
| 16:48 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: lazy in this context |
| 16:48 | Bronsa | bbloom: my main complaint with metadata in clojure is its weird (and mostly undocumented) evaluation semantics |
| 16:48 | bbloom | Bronsa: you mean with respect to the reader? or like actual runtime evaluation semantics? |
| 16:49 | Bronsa | bbloom: regarding read-time metadata, depending on the context it may or may not get evaluated |
| 16:49 | Bronsa | or even get evaluated twice! |
| 16:50 | bbloom | Bronsa: evaluated twice? |
| 16:50 | Bronsa | try (def ^{:foo (println "foo")} foo) |
| 16:50 | bbloom | lol well that seems like a bug |
| 16:50 | bbloom | is that only with def ? |
| 16:51 | bbloom | isn't def like the only remaining interpreted op? |
| 16:51 | Bronsa | as far as I can remember |
| 16:51 | fu86 | hi |
| 16:51 | fu86 | I use a lib (image-resizer) to do some image manipulation |
| 16:52 | fu86 | unfortunately the lib sets the filename itself and I cant change this |
| 16:53 | Bronsa | bbloom: ^{:foo (println "foo")} (do :foo) here it won't get evaluated for example |
| 16:53 | fu86 | https://github.com/josephwilk/image-resizer/blob/master/src/image_resizer/fs.clj#L14 |
| 16:53 | fu86 | I want to replace this function |
| 16:54 | fu86 | is there a clean way to do it in clojure? |
| 16:55 | bbloom | fu86: you can monkey-patch using ##(doc with-redefs) |
| 16:55 | lazybot | ⇒ "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:55 | bbloom | all the usual monkey-patching caveats apply |
| 16:56 | fu86 | nice, thanks! |
| 16:57 | piranha | is there a good way to check if one vector contains all elements of other vectors? |
| 16:58 | bbloom | ,(require clojure.set) |
| 16:58 | clojurebot | #<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:58 | bbloom | ,(require 'clojure.set) |
| 16:58 | clojurebot | nil |
| 16:58 | bbloom | ,(doc clojure.set/subset?) |
| 16:58 | clojurebot | "([set1 set2]); Is set1 a subset of set2?" |
| 16:58 | bbloom | piranha: use (into #{} ...) |
| 16:59 | bbloom | or rather just (set ...) |
| 16:59 | piranha | bbloom: oh, clojure.set is not available in clojurescript... |
| 16:59 | piranha | ah damn sorry |
| 16:59 | piranha | I don't need it there %) |
| 16:59 | piranha | It's all messed up in my head already, damned clojure cup |
| 17:00 | bbloom | piranha: https://github.com/clojure/clojurescript/blob/master/src/cljs/clojure/set.cljs |
| 17:00 | bbloom | it's there |
| 17:00 | piranha | hmmmmm strange but ok |
| 17:01 | bbloom | Bronsa: so the thing w/ metadata i was thinking about was stuff like metadata on lists |
| 17:02 | bbloom | Bronsa: conj preserves metadata on lists, but not on seqs |
| 17:03 | Bronsa | well, conj on a seq is cons |
| 17:03 | Bronsa | I think. |
| 17:03 | bbloom | Bronsa: yeah, that's right |
| 17:03 | bbloom | and cons doesn't preserve meta |
| 17:04 | bbloom | assoc : conj on maps :: cons : conj on seqs |
| 17:04 | bbloom | those ops on maps preserve, but not on seqs |
| 17:05 | bbloom | but then again :: cons (member function) : conj on lists |
| 17:05 | Bronsa | bbloom: I feel like cons shouldn't preserve metadata |
| 17:05 | bbloom | ok, why? and what about conj on to lists? |
| 17:07 | Bronsa | bbloom: 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:08 | gfredericks | cons[truct] |
| 17:08 | Bronsa | bbloom: I agree however that conj should preserve metadata even on seqs |
| 17:09 | gfredericks | that gets you into this weird feeling situation where a whole "tree" of objects have the same metadata |
| 17:10 | Bronsa | bbloom: 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:10 | gfredericks | when you conj onto other things you don't inherently maintain a reference to the source object |
| 17:10 | Bronsa | to "return new Cons(meta, o, this)" |
| 17:12 | bbloom | gfredericks: yeah, that's an interesting problem: when you push on to a singly linked list, you preserve the interior meta pointer |
| 17:12 | bbloom | if you dissoc from a map, you preserve the metadata |
| 17:12 | bbloom | but if you pop from a list, you get the metadata of list |
| 17:12 | bbloom | er of the NEXT list i mean |
| 17:13 | bbloom | ,(-> (list 1) (with-meta {:x 1}) (conj 2) (with-meta {:y 2}) next meta) |
| 17:13 | clojurebot | {:x 1} |
| 17:13 | gfredericks | yeah you certainly don't want this behavior e.g. when using [node child child ...] tree structures |
| 17:14 | gfredericks | which seem more comparable in a way |
| 17:14 | bbloom | compare: |
| 17:14 | gfredericks | (to lists) |
| 17:14 | bbloom | ,(-> {:a 1} (with-meta {:x 1}) (conj [:b 2]) (with-meta {:y 2}) (dissoc :b) meta) |
| 17:14 | clojurebot | {:y 2} |
| 17:14 | Bronsa | ,(meta (rest (with-meta (list 1 2) {:foo true}))) |
| 17:14 | clojurebot | nil |
| 17:14 | gfredericks | ,(-> [1 2] (with-meta {:x 1}) (seq) (meta)) |
| 17:14 | clojurebot | nil |
| 17:15 | gfredericks | ^ unrelated but interesting |
| 17:15 | bbloom | it almost seems like a lot of these issues would go away if you used encapsulator objects & only allowed metadata on those |
| 17:16 | bbloom | but then you'd have an object of overhead for every "root" in to a data structure |
| 17:16 | bbloom | would greatly simplify equality, printing, dispatch, etc too |
| 17:16 | bbloom | it's basically the "newtype" idea from haskell |
| 17:17 | bbloom | which does plenty of compiler cleverness to eliminate those capsule objects at compile time |
| 17:18 | bbloom | the seqs vs cons vs lists also makes me wonder about (= some-seq some-vec) |
| 17:19 | bbloom | still don't know how i feel about that :-P |
| 17:20 | Bronsa | bbloom: I would be ok with that if we also had a type-dependent comparator |
| 17:20 | Bronsa | but then we get into the CL hell of having n different equality comparators |
| 17:22 | bbloom | Bronsa: you can get around that problem by having a special type of encapsulator that provides for custom equality semantics |
| 17:22 | bbloom | (= (wrap x) (wrap y)) |
| 17:22 | bbloom | something like that |
| 17:23 | bbloom | issue comes in when you have equality buried in a data structure |
| 17:23 | bbloom | b/c then you can only wrap an argument & you need to have proxy objects, delegation, etc. gets complicated fast |
| 17:23 | Bronsa | bbloom: isn't wrap just seq? |
| 17:24 | bbloom | that's one concrete example of a more abstract idea, i guess |
| 17:25 | bbloom | in 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:27 | bbloom | a -> a -> Bool vs a -> b -> Bool |
| 17:28 | Bronsa | yes, I see what you mean |
| 17:28 | bbloom | haskell kinda punts though, requiring the programmer specify a coersion explicitly, which means that general purpose heterogeneous data types are hard to do |
| 17:28 | bbloom | which basically makes 99% of my clojure programs inadmissible to a haskell type checker :-P |
| 17:28 | Bronsa | bbloom: in clojure that would get weird with all the various seq implementations |
| 17:29 | bbloom | clojure's equality semantics are such a big step up from every other dynamic language i've ever seen, it's hard to complain |
| 17:29 | bbloom | but i can't help but feel like we're so close to something even better :-) |
| 18:19 | juliangindi | I keep getting this error I cannot figure out and isolate. Clojure.lang.Character cannot be cast to Clojure.lang.Named |
| 18:19 | gfredericks | juliangindi: do you have a stack trace? |
| 18:20 | juliangindi | yeah one sec |
| 18:20 | Jarda | If 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:20 | gfredericks | Jarda: select-keys |
| 18:21 | Jarda | gfredericks: thanks! just what I was after |
| 18:21 | juliangindi | gfredericks: https://gist.github.com/Julian25/6756907 |
| 18:21 | cddr | Can the "instance expresion" part of a dot form (e.g. the "ctx" |
| 18:21 | cddr | in (. ctx (arc ...))) be threaded by the threading macro? |
| 18:21 | gfredericks | cddr: yes |
| 18:22 | gfredericks | you can also (.arc ctx ...), which works just as well with threading but less parens |
| 18:22 | gfredericks | juliangindi: is weatherbeacon.views.main your code? |
| 18:22 | juliangindi | gfredericks: part of it, yes |
| 18:22 | gfredericks | this looks like a (ns ...) problem |
| 18:23 | gfredericks | did you put the docstring in the wrong place? |
| 18:23 | juliangindi | hmm. I don't think so. I'm looking into it |
| 18:24 | gfredericks | I got that error with (ns user (:require clojure.test) "foo"), for example |
| 18:29 | onefourseven | I'm getting this error with http-kit. Anybody know why? "exceed max line 4096" |
| 18:30 | SrPx | What 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:32 | mtp | i try not to care about performance, and i also try to look at the object system in the language |
| 18:32 | gfredericks | SrPx: we don't do object-oriented programming very much. data is still stored in hash-maps, but not "methods" |
| 18:32 | mtp | to answer both and neither of your questions |
| 18:33 | gfredericks | protocols/records are one anwser, but they aren't used in the common case |
| 18:33 | mtp | "stop conflating clojure and OOP"? |
| 18:34 | hyPiRion | start out with maps, then go to records if performance is an issue is probably good enough |
| 18:35 | gfredericks | then go to byte-array-backed-structs and lots of macros if performance is an issue |
| 18:35 | SrPx | Yes, 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:36 | SrPx | I love using hashes, though, so it boils down to, are them optimized to things like C-struct in the end? |
| 18:36 | gfredericks | clojure has somewhat of a continuum of features between hashmaps and the lowest level |
| 18:36 | hyPiRion | Records are, I think? |
| 18:39 | hyPiRion | Well, I would guess that for small hashmaps, the difference is roughly 0 |
| 18:39 | mtp | SrPx‘ "the first thing i said" |
| 18:40 | gfredericks | hyPiRion: do you mean arraymaps? |
| 18:40 | mtp | just before "the object system in the language" |
| 18:40 | gfredericks | 105 ns for singleton hashmap lookup |
| 18:42 | gfredericks | 15 ns for keyword-lookup on a record |
| 18:45 | gfredericks | 4 ns for dotted lookup on a record |
| 18:45 | gfredericks | hyPiRion: the difference is roughly 0 seconds :P |
| 18:46 | hyPiRion | yeah, I was right |
| 18:47 | gfredericks | I just had my computer do something three billion times just so I could figure out how long it takes o_O |
| 18:48 | technomancy | gfredericks: and that just in order to have an Internet Argument |
| 18:48 | clojurebot | Cool story bro. |
| 18:48 | technomancy | surely we are like gods |
| 18:48 | Brand0 | lol |
| 18:48 | gfredericks | about once a day I do a (reduce + (range 10000000)) just to show who's boss |
| 18:48 | Bronsa | lol |
| 18:49 | gfredericks | 123 ns for a large hash-map lookup (10000 entries) |
| 18:49 | gfredericks | so large hashmap and small hashmap are not much different |
| 18:50 | hyPiRion | yeah, O(log32 n) isn't that much |
| 18:50 | hyPiRion | As we all know, log n = 1 in Clojure |
| 18:51 | gfredericks | last one: small arraymap lookup |
| 18:51 | gfredericks | 104 ns |
| 19:02 | zoldar | the 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:04 | AimHere | Maybe log n is very close to 1 :) |
| 19:07 | gfredericks | asymptotics. sometimes it has something to do with how fast your code runs. |
| 19:07 | hyPiRion | zoldar: caching plus JVM's adaptive optimization is funny to work with |
| 19:08 | hyPiRion | like, if you want to measure time |
| 19:08 | zoldar | hyPiRion: clojure doesn't benefit from these too ? |
| 19:09 | hyPiRion | zoldar: yeah, that's the exact issue. It's hard to measure or to get a good estimate on what would be faster |
| 19:09 | gfredericks | zoldar: given that frequencies is doing hashmap work you might argue that it should be O(nlogn) as well |
| 19:09 | hyPiRion | well, not hard to measure, just a bit more involved than a binary |
| 19:10 | squidz | Bronsa: Thanks for your work on clojure-in-clojure. Can you tell me if there are any direct benefits this has on clojurescript? |
| 19:12 | chord | you guys can't stop me from implementing a* |
| 19:14 | dpathakj | why would someone wish to stop you from implementing a*? |
| 19:16 | chord | you all think I will fail |
| 19:16 | Jarda | if 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:16 | Bronsa | squidz: 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:17 | Jarda | is 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:17 | Jarda | to be able to call without repeating the user id |
| 19:18 | squidz | Bronsa: what benefits does that have? I\m not familiar with the analyzers of either clojure/clojurescript/clojure-in-clojure |
| 19:18 | gfredericks | Jarda: 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:19 | gfredericks | the `with-user-id` part normally ends up being a macro too |
| 19:20 | Jarda | gfredericks: ok, reading up |
| 19:20 | hyPiRion | keep two versions of the function, one with the dynamic use, and one without |
| 19:21 | hyPiRion | at least if you're going to open source that thing |
| 19:21 | gfredericks | I remember going back and forth with cemerick on those kind of tactics wrt that couchdb lib I think |
| 19:21 | Bronsa | squidz: 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:22 | Jarda | gfredericks: yeah does clutch have some (in-database "foo" ...) stuff? |
| 19:22 | hyPiRion | yeah |
| 19:22 | Bronsa | this would allow for e.g. reusing some passes between clojure/clojurescript and possibly enable multiple compilation targets/optimizations |
| 19:22 | gfredericks | I haven't really used it actually |
| 19:23 | Jarda | yeah it seems to have dynamic-scope |
| 19:23 | Bronsa | squidz: 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:23 | gfredericks | a 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:24 | gfredericks | it seemed to make the lib really straightforward to understand |
| 19:24 | squidz | Bronsa: cool, that sounds exciting. I know a lot of people have been dreaming of cinc for while now so thanks |
| 19:24 | gfredericks | but libs and app code are different things, of course |
| 19:25 | Jarda | https://github.com/clojure-clutch/clutch/blob/master/src/com/ashafa/clutch.clj#L26 |
| 19:26 | Bronsa | squidz: 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:26 | Jarda | oops, no, that can't be it |
| 19:26 | Bronsa | that's probably not clear, I'm going to explain it in a ML post tomorrow |
| 19:27 | gfredericks | oh he did go with the dual approach. I wonder if that was my idea. |
| 19:27 | squidz | ML post? |
| 19:27 | Bronsa | mailing list :) |
| 19:27 | squidz | oh okay. Look forward to hearing more. It's really exciting stuff |
| 19:32 | chord | i'm so glad that clojure cup is about to end |
| 19:32 | chord | so you guys can go back to helping me with my rts project |
| 19:34 | mgaare | will be interesting to see if this inspires a fresh round of creative ways to say no |
| 19:40 | chord | mgaare why is everyone like you so negative |
| 19:49 | paulsamways | Hi 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:58 | gfredericks | paulsamways: my only guess is to try `lein clean` first |
| 20:04 | chord | paulsamways: you didn't add the dependency to your porject? |
| 20:17 | paulsamways | chord: clj-time is in the dependencies vector in project.clj |
| 20:21 | indigo | paulsamways: Pastebin your project.clj |
| 20:23 | allenj12 | hey guys ive been sruggling on this error can someone help me? https://www.refheap.com/19156 |
| 20:24 | allenj12 | i commented the error and commented problem spots |
| 20:24 | paulsamways | http://pastebin.com/MY8x9QDN |
| 20:30 | ambrosebs | allenj12: line 126 looks fishy |
| 20:30 | ambrosebs | allenj12: the (first board-queue) |
| 20:31 | ambrosebs | is that guaranteed to be non-nil? |
| 20:31 | allenj12 | ambrosebs: it seems like it should be right? since its always expanding and we should find a goal before it runs out |
| 20:33 | ambrosebs | allenj12: prove it, abstract it out into a let binding and use assert to ensure non-nil :) |
| 20:34 | allenj12 | ambrosebs: hmm not quite sure what u mean like [let board =...] assert board? |
| 20:34 | ambrosebs | allenj12: usually it'd expect (if (seq board-queue) ...) somewhere if your solution is getting smaller, just seems like an odd condition. |
| 20:35 | ambrosebs | something like this on line 126: (let [fboard (first board-queue) _ (assert fboard)] (recur .... fboard)) |
| 20:35 | allenj12 | hmm |
| 20:36 | allenj12 | anbrosebs: kk ty also are u familiar with a* i seem to have an algorithmic problem aswell but not sure what it is |
| 20:38 | ambrosebs | allenj12: not comfortably |
| 20:39 | allenj12 | ambrosebs: kk whats that underscore btw in ur example just a space? |
| 20:39 | ambrosebs | allenj12: it's just a convention for a throwaway binding name |
| 20:39 | ambrosebs | "don't ever use this binding" |
| 20:39 | ambrosebs | it's for side effects only |
| 20:40 | TEttinger | allenj12, 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:41 | allenj12 | Tettinger: 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:41 | allenj12 | ambrosebs: im confused why did u use quotes? lol dont ever use _ or use _ |
| 20:41 | TEttinger | sure. I've never implemented A* but I've done something close |
| 20:42 | allenj12 | ambrosebs: btw wouldnt it be better to use a while loop? |
| 20:42 | allenj12 | ambrosebs: sry not loop just term lol while not asser... |
| 20:42 | allenj12 | Tettinger: THNX! |
| 20:45 | callen | oh. my. god. |
| 20:45 | callen | Raynes: you were the smart one |
| 20:47 | TEttinger | allenj12: is list defined in your code somewhere? |
| 20:47 | akurilin | callen, ping. Got a sec or busy with the event atm? |
| 20:48 | TEttinger | I'm not sure what (list {}) dos |
| 20:48 | TEttinger | ,(doc list) |
| 20:48 | clojurebot | "([& items]); Creates a new list containing the items." |
| 20:48 | allenj12 | makes it a list |
| 20:48 | TEttinger | so it's a list of one map? |
| 20:48 | allenj12 | its essentially making a list of has maps |
| 20:48 | TEttinger | ahhh |
| 20:48 | metellus | ,(list {:a 1 :b 2}) |
| 20:48 | clojurebot | ({:a 1, :b 2}) |
| 20:48 | allenj12 | it starts off as one hash map |
| 20:48 | allenj12 | then we see the nodes next to it and add to the list |
| 20:49 | allenj12 | each hash map a board state |
| 20:52 | TEttinger | allenj12: ah. line 172, it prints nil. |
| 20:52 | TEttinger | that's one of your boards that it tries to findIndex in |
| 20:53 | TEttinger | (sorry, in the paste) |
| 20:53 | allenj12 | Tettinger: hmm o wow i thought for some reason remove nil? would take care of that |
| 20:54 | TEttinger | hm, it's the println on line 101 |
| 20:54 | TEttinger | you need to call remove on the *movs* |
| 20:54 | TEttinger | *moves* |
| 20:55 | allenj12 | TEttinger: hmm can i just put that right next to it? |
| 20:56 | TEttinger | let me check |
| 20:58 | allenj12 | TEttinger: 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:59 | benkay | what wouyld a neat, idiomatic approach to getting the second and fourth elements of each vector in a vector of vectors? |
| 20:59 | benkay | would be* |
| 21:01 | allenj12 | do you want [[1] [2] [3] [4]] ---> [2] [4]? |
| 21:01 | brehaut | ,(map (juxt (partial nth 1) (partial nth 3)) [[1 2 3 4 5] [:a :b :c :d :e]]) |
| 21:01 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number> |
| 21:01 | brehaut | ,(nth [1 2] 1) |
| 21:01 | clojurebot | 2 |
| 21:02 | brehaut | ,(map (juxt #(% 1) #(% 3)) [[1 2 3 4 5] [:a :b :c :d :e]]) |
| 21:02 | clojurebot | ([2 4] [:b :d]) |
| 21:03 | benkay | more like [[1 2 3 4] [5 6 7 8]] --> [[2 4] [6 8]] |
| 21:03 | brehaut | of course that will indexoutofbounds if you pass it a short vector |
| 21:04 | benkay | ah |
| 21:04 | benkay | juxt! how nifty. |
| 21:04 | brehaut | so you probably want get |
| 21:04 | brehaut | ~juxt |
| 21:04 | clojurebot | if you think 'complement is great, wait till you see 'juxt |
| 21:04 | brehaut | ~juxt |
| 21:04 | clojurebot | juxt is the bestest option though if it doesn't weird you out |
| 21:05 | redinger | Everybody should find a reason to use juxt every day |
| 21:06 | benkay | thanks brehaut! |
| 21:06 | brehaut | np |
| 21:06 | mullr_ | In the clojurescript compiler, we have :foreign-libs to deal with non google-closure modules. |
| 21:07 | mullr_ | But many times those modules depend on each other implicitly, and require a certain load order. |
| 21:07 | mullr_ | Is there a way to express such dependencies with clojurescript :foreign-libs? |
| 21:09 | allenj12 | TEttinger: tried adding a (if (not (nil? board)) imbetween fn and the other if but didnt work |
| 21:10 | brehaut | ,(doc if-not) |
| 21:10 | clojurebot | "([test then] [test then else]); Evaluates test. If logical false, evaluates and returns then expr, otherwise else expr, if supplied, else nil." |
| 21:11 | brehaut | and if board is a seqable thing then (if (seq board) … |
| 21:15 | allenj12 | TEttinger: any luck? |
| 21:16 | mullr_ | 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:22 | allenj12 | made 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:24 | jamii | ztellman: http://hugoagogo.clojurecup.com/ |
| 21:24 | jamii | ztellman: It's pretty close to 10k games / second |
| 21:28 | allenj12 | WEIRD. if i take away the last condition history-check it runs but just goes back and forth which dosnt make sense |
| 21:32 | allenj12 | https://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:41 | seangrov` | mullr_: Looking at load-foreign-library*, it doesn't look like it |
| 21:42 | mullr_ | @seangrov` It looks to me like it passes through the :requires data |
| 21:42 | mullr_ | at least, that appears to work |
| 21:43 | mullr_ | but it may have simply happened to shift the order of things to a state that works |
| 21:46 | allenj12 | Seems to solve!!!! but dosnt give optimal path can anyone see something wrong with algorithm? |
| 21:46 | allenj12 | https://www.refheap.com/19156 |
| 22:07 | john2x | how do I map a macro to a vector? |
| 22:08 | allenj12 | so 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:09 | seangrov` | john2x: macros can't be mapped |
| 22:09 | john2x | oh ok. I tried doseq but it didn't seem to work as well. |
| 22:09 | seangrov` | You can put it in an anonymous function, but it depends on what you're trying to do |
| 22:20 | robink | What'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">Hey, guy, click here!</a></img></div> into <div><a href="http://foocorp.com/thisisnecessary">Hey, guy, click here!</a></div> |
| 22:21 | robink | Sorry s/hiccup/hickory/ |
| 22:21 | robink | I have a hickory nested map that I'm operating on |
| 22:21 | robink | So (at myhickorynode [:img]) works, I'm just not sure how to say "turn those <img> tags into their children, without any contained text" |
| 22:22 | marcopolo2 | What's the proper way to serialize (round trip) cljs datastructures? |
| 22:24 | seangrov` | marcopolo2: goog.json/parse, goog.json/generate ? |
| 22:25 | seangrov` | Also edn if your requirements allow for it |
| 22:26 | robink | n/m got it |
| 22:26 | callen | I am...much more relaxed now. |
| 22:26 | marcopolo2 | seangrov`: Thanks! :) |
| 22:26 | callen | akurilin: around? |
| 22:26 | akurilin | callen, yessir. |
| 22:27 | callen | akurilin: Clojure cup ended. I'm too tired to type. Google Hangout? |
| 22:27 | callen | akurilin: 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:28 | akurilin | callen, sure, sec, |
| 22:28 | `cbp | callen: im back to doing the rethinkdb stuff would you give me contribute status or accept pull requests? |
| 22:29 | callen | `cbp: oh wow. |
| 22:29 | callen | `cbp: yeah let me add you. |
| 22:30 | callen | `cbp: cesarbp? |
| 22:30 | callen | (on gh) |
| 22:30 | `cbp | yeah |
| 22:30 | callen | `cbp: nice cactus. you're added. go for it. |
| 22:34 | `cbp | :) |
| 22:43 | allenj12 | It woooooooooooooooooooorrrrrrrrrrrrrrrrrrrrrrrrrrrkkkkkkkkkkkkkkkkkkkkksssssssssssssssssssss11111111 |
| 22:44 | allenj12 | give it your worst!!!!! https://www.refheap.com/19158 |
| 22:52 | seangrov` | allenj12: What's example input? |
| 22:52 | allenj12 | seangrov: what do you mean run any valid input :) |
| 22:52 | allenj12 | seangrov: o |
| 22:52 | allenj12 | seangrov: 345126780 |
| 22:53 | allenj12 | seangrov: no spaces no chars etc |
| 23:03 | bbloom | allenj12: shesh. maybe you should spend a little time trying to clean up the code to look more idiomatic |
| 23:04 | allenj12 | bbloom: i am new so any tips would be great!! i do need to hand this in soon tho lol |
| 23:04 | bbloom | allenj12: generally, lisp code does not leave trailing ) |
| 23:04 | bbloom | use 2 space indents |
| 23:04 | bbloom | aim for < 80 characters per line |
| 23:05 | bbloom | line up arguments if you indent them |
| 23:05 | bbloom | learn about -> and ->> |
| 23:05 | bbloom | you can learn about them with doc: |
| 23:05 | bbloom | (doc ->) |
| 23:05 | clojurebot | "([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:05 | allenj12 | bbloom: o wow cool |
| 23:05 | bbloom | use (condp = …) where case doesn't help |
| 23:06 | seangrov` | Interesting, .indexOf will work on clj, but won't work in cljs because (I think) cljs data structures don't implement it |
| 23:06 | bbloom | use not= instead of (not (= |
| 23:06 | bbloom | use extra let bindings to break up long lines / expressions |
| 23:07 | bbloom | allenj12: avoid mixing side effects like printing with your other functions |
| 23:07 | bbloom | allenj12: 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:07 | allenj12 | bbloom: ahhh ok |
| 23:08 | bbloom | use doseq instead of loop/recur for side effecting over sequences |
| 23:08 | bbloom | start with those & then i'll give you some more tips :-) |
| 23:08 | bbloom | that's a lot of stuff i threw at you :-P |
| 23:10 | bbloom | allenj12: otherwise, you're off to a good start |
| 23:10 | bbloom | i see some nice tricks in there like using sets as predicates ;-) |
| 23:10 | seangrov` | allenj12: http://cljsfiddle.net/fiddle/sgrove.eight-puzzle.core |
| 23:10 | seangrov` | And use cljsfiddle to share code if you'd like others to play with it a bit |
| 23:11 | allenj12 | bbloom: thanks i always ask people alot of qustions when first starting so alot of the time i pick up some fancy stuff early |
| 23:11 | allenj12 | seangrov: THNX! |
| 23:11 | bbloom | that's good! |
| 23:11 | SegFaultAX | Also, why introduce vars with earmuffs that aren't dynamic or mutable? They're just constants. |
| 23:11 | bbloom | allenj12: 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:11 | bbloom | sometimes you'll see golfing tricks, but other times there are really good ideas in there! |
| 23:12 | seangrov` | allenj12: Also, probably a good idea to use docstrings instead of the comments off to the right |
| 23:12 | allenj12 | seangrov: yea i saw those but never did that b4 and i was in a little bit if a rush :P |
| 23:12 | SegFaultAX | Let allows multiple bindings (and it's recursive) |
| 23:16 | bbloom | allenj12: after you submit your assignment, clean it up & resubmit it if your teacher will take it |
| 23:16 | bbloom | or don't bother resubmitting it and enjoy the learning experience :-) |
| 23:17 | hiredman | |
| 23:19 | allenj12 | bbloom: i will definatly clean it up but idk if its worth re submitting.. he has this weird hatred towards lisps |
| 23:19 | allenj12 | bbloom: lol |
| 23:19 | allenj12 | bbloom: definately wont appreciate the clean up as much |
| 23:20 | seangrov` | allenj12: Well, formatting and naming like that can't help |
| 23:21 | bbloom | a CS professor who hates lisps is no CS professor |
| 23:23 | tomjack | is there no way to do case-like keyword dispatch in java? |
| 23:23 | tomjack | you have to do if (key.equals(Keyword.intern(...))) else if ... ? |
| 23:24 | allenj12 | bbloom: i know its fucking weird hes kinda joke professor tho thats why im learning new languages class is to easy |
| 23:24 | tomjack | I guess == works |
| 23:24 | allenj12 | bbloom: which is also weird cause his PhD was in machine learning |
| 23:24 | bbloom | allenj12: this channel is always happy to educate. submit your homework & then go rock & roll w/ making it pretty :-) |
| 23:24 | bbloom | eh, matrix math has taken over AI :-) |
| 23:27 | seangrov` | All about stats now... |
| 23:33 | allenj12 | bbloom: im very good at linear algebra but suck at everyhing else lol like the probability theory |
| 23:33 | allenj12 | bbloom: machine learning here is more theory than algorithms |
| 23:39 | seangrov` | "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:39 | seangrov` | Surely that should be js/setInterval? |
| 23:40 | seangrov` | Ah, no, setTimeout is correct, some other part of pedestal is responsible for calling the functions on an interval. |
| 23:46 | ddellacosta | smarter way to do this? &(filter #(= (:session-id (val %)) 2) {{:foo "foo"} {:session-id 1} {:bar "bar"} {:session-id 2}}) |
| 23:46 | ddellacosta | &(filter #(= (:session-id (val %)) 2) {{:foo "foo"} {:session-id 1} {:bar "bar"} {:session-id 2}}) |
| 23:46 | lazybot | ⇒ ([{:bar "bar"} {:session-id 2}]) |
| 23:47 | ddellacosta | I 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:47 | TEttinger | filter seems pretty declarative? |
| 23:48 | TEttinger | ddellacosta, is that a map of map keys to map values? |
| 23:48 | ddellacosta | TEttinger: 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:49 | ddellacosta | TEttinger: yes. |
| 23:49 | TEttinger | I'm wondering if one of the *-in functions would work |
| 23:49 | ddellacosta | TEttinger: exactly, I was thinking of get-in when I asked the question. |
| 23:50 | TEttinger | or update-in |
| 23:51 | ddellacosta | TEttinger: ah, yeah, I guess actually I should use get-in if I can provide the first key |
| 23:51 | ddellacosta | &(= 2 (get-in {{:foo "foo"} {:session-id 1} {:bar "bar"} {:session-id 2}} [{:bar "bar"} :session-id])) |
| 23:51 | lazybot | ⇒ true |
| 23:52 | TEttinger | that doesn't seem much clearer tbh |
| 23:52 | TEttinger | filter is generally clear enough to me |
| 23:53 | TEttinger | is there supposed to be more than one :session-id 2 ? |
| 23:55 | ddellacosta | TEttinger: 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:56 | TEttinger | then filter will return an empty seq or a seq of one item, right? |
| 23:57 | ddellacosta | TEttinger: 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:57 | TEttinger | I'm wondering if there's some search function in clojure that finds the first that satisfies a predicate |
| 23:57 | TEttinger | is that some? |
| 23:57 | ddellacosta | TEttinger: 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:57 | TEttinger | ,(doc some) |
| 23:57 | clojurebot | "([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:57 | ddellacosta | ah yeah, some could be a good one to think about too |
| 23:58 | TEttinger | err |
| 23:58 | TEttinger | some returns true/false |