#clojure logs

2014-03-22

00:02felixfloresanyone here using fireplace + vim with clojurescript?
00:11ambrosebsfelixflores: yes
00:12felixfloresfor some odd reason when I try %Eval I get this
00:12felixfloreshttps://gist.github.com/felixflores/7fbfe19a7fe6cbc51bdb
00:13felixfloresthis is for a cljs file
00:13felixfloresbut it works perfectly well with clj files
00:13felixfloresall I'm doing is evaling this https://gist.github.com/felixflores/3c2abd611b4ad4d4575c
00:14felixfloresis there something special I need to do in order to eval cljs
00:15felixfloresI hate asking stuff like this on IRC but I've been Googling for a while now
00:18garietyxxxHi, #clojure, I'm trying to compile some clojurescript with lein-cljsbuild but running into problem after problem. Any help?
00:19bob2would need to at least refheap.com the errors
00:20felixfloreshttps://github.com/clojure/clojurescript/wiki/Vim < looking like a good source for my question
00:21garietyxxxbob2: no errors. The compilation finishes successfully, but the output is just a bit of the closure library, none of my code. lein-cljsbuild also isn't generating a target directory.
00:32bob2garietyxxx, did you use a lein template?
00:35vimuser2D: finally had use for ->> amazing lol
00:35garietyxxxbob2: nope
00:35bob2garietyxxx, would guess you just put the code in the wrong place then
00:38garietyxxxbob2: nope, I was getting this "warning" about incompatible clojurescript version. changed it to latest r and works :-)
00:38eraserhdcore.logic: How come everyg doesn't work like listofo (from Reasoned Schemer)?
00:39jph-anyone here familiar with prismatic/schema? with defn, can i still do optional & arguments? (s/defn foo [a :- [s/Str] & [b :- [s/Num]] ...)
00:56Rosnecwhat would be the simplest way to take a URL and get a seq of bytes from it?
00:57felixfloresOkay so it turns out I was doing several things wrong to get up and running with clojurescript repl.
00:57felixfloresone: https://github.com/cemerick/austin/issues/55
00:57felixfloresand my proj needed to include [com.cemerick/austin "0.1.4"] https://gist.github.com/felixflores/fc2fdf48dcd98960c394
00:58bob2Rosnec, for parsing?
00:58Rosnecnot even parsing
00:58Rosnecjust sending a sequence of bytes
00:58Rosnecall I want is the raw bytes
01:01cemerickfelixflores: sorry for the hiccup re: 2176; hopefully that'll get put to bed soon
01:02felixfloresoh no problem. I should have done more research before crying out loud on irc :)
01:06felixflores@cemerick thanks for putting this plugin together. it's working great now.
01:06cemerickfelixflores: glad it's helping you, despite some early troubles
01:14seangroveWhat's a good way of expressing "this value, or min 0 or max 100"?
01:14seangrove,(let [v -50] (max (min 0 v) 100))
01:14clojurebot100
01:14seangroveObviously not that, hah
01:15akhudekyou mean you want to clamp it to 0,100?
01:15seangroveakhudek: Yes, that
01:15akhudek(min (max 0 v) 100)
01:16seangroveAh, yes, that's it. Probably a sign I should stop anyway, just thought there might be a built-in function
01:16jph-how would i convert (format "%s/%s" (get foo :bar) x) into a thread-first macro, or is that overkill?
01:17jph-im trying (-> (get foo :bar) (format "%s/%s" x)) with no love
01:17akhudekjph-: I think the original is best
01:17jph-akhudek, ok, cheers
02:09Rosnecis there an existing function to print to stderr, or do I have to rebind *out* and use print?
02:12Cr8the latter
02:19RosnecCr8 I wound up writing one myself
02:19Rosnectwo, actually
02:19Rosnecprint-err and println-err
03:37abaranoskyanyone going to be at Clojure/West next week?
03:39amalloyabaranosky: yeah, i'll be there. Factual will be out in force
03:42abaranoskyamalloy: you are at Factual now?
03:42amalloyindeed i am
03:42abaranoskyI'm going to see Zach's predictably fast Clojure talk
03:42abaranoskyshould be useful
03:44abaranoskyamalloy: did you look at the schedule? The last day is "hackfest", any ideas what that is? Or does it really mean to "do whatever"
03:44amalloyit's poorly defined enough that i'm not sticking around for it :P
03:45abaranoskyyep... I feared the worst
04:52honzaJust about every clojure project on GitHub uses the EPL license - is that a requirement since clojure is released under EPL?
04:52wagjohonza: no, but it is convenient
04:53honzawagjo: how so? so, licensing under bsd doesn't violate anything?
04:55wagjowell yeah, but if you want more strict license, EPL is a good fit for Clojure projects which run on top of JVM
05:07winkhonza: to agree it's the typical laziness, usign the default I'd say
05:07winkfor people not thinking about it hard, the default clojure choice seems to be EPL
05:07honzawink: yes, the default license in new lein projects is epl
05:08winkhonza: not what I meant, but also true
05:09cYmenGood morning.
05:09winkwhat I meant: in any language ecosystem people tend to have default licences, inspired by the tools they use
05:09winkmostly it's BSD vs GPL
05:09winkthis is just guessing, but really thinking about a license: 1/4 of projects or less
05:09honzaoh i see
05:11honzaalso confusing https://github.com/bodil/BODOL/commit/195f38c31e787de9f47f43d8b325744f99ba74c4
05:14winkeverytime I even think of licenses I get a headache
05:14winkI'm out :P
05:15winkold thread that might or might not make sense: https://groups.google.com/forum/#!topic/clojure/mGf_SuHsSGc
06:41tgoossensI have to learn fortran at university now. I see it as a challenge to use as much as possible from clojure's philosophy. Not sure where I will end out :p
06:42tgoossensUnlike before, now my (scientific) software has to be very performant.
06:43clgvtgoossens: fortran? why on earth?
06:43clgvtgoossens: are you in a computer science program for legacy systems? ;)
06:44tgoossensI study mathematical engineering
06:44clgvah right the math courses also use fortran sometimes
06:44tgoossensOn subdomain of it is simulation. Aircrafts, explosions! , bridges, spaceships!
06:45tgoossens*one
06:45bob2fortran is still very very fast compared to other languages
06:45bob2even C
06:45ddellacostatgoossens: clearly you now need to create clof-tran
06:45tgoossensddellacosta, whats that?
06:45tgoossenswell yes
06:45tgoossensi get it
06:45ddellacostathat, tgoossens, is a bad joke
06:45tgoossensI've been thinking about that :p
06:46beamsoi'm trying to work out if i missed out by not doing fortran and cobol at uni
06:47tgoossensI think it is good that at least once you try to write very efficient software. I think it is a tough but worthful experience
06:47clgvhmm but cobol is probably only useful if you plan to maintain or migrate legacy systems ;)
06:49tgoossensAnother reason that they teach us fortran is
06:49tgoossensno one knows it
06:49tgoossensso everyone can start at the same level
06:50tgoossensand the scientific software writing principles are of course the same. Floating point etc.
06:51tgoossensfun fact
06:51tgoossensin my project assignment I found the following sentence:
06:51clgvso is that an introductory course to programming?
06:52tgoossens"Using print statements for debugging. However, if you find a decent debugger for fortran you can let us know"
06:52clgv:/
06:52tgoossensNo I had an introductory course to programming in my first year (Three years ago)
06:52tgoossensand a course on Object Oriented Programming
06:52tgoossensBut that was all really high level
06:53clgvwhat's the point of choosing a language that probably no one of the students knows already, then?
06:53tgoossensnow we have to even think about memory structure on the machine
06:53clgvah ok
06:55tgoossensIt will be a pain in the ass. But I think I will learn a lot
06:55tgoossensi noticed that fortran has a "pure function" statement :p
07:10tgoossensclgv, my book suggests to use output arguments procedure(in1,in2,out1,out2)
07:11tgoossensif for example you want to return multiple things
07:11tgoossensin clojure i would of course return a map
07:13clgvtgoossens: well common lisp has a way to return multiple results efficiently via the program stack^^
07:13tgoossens:D
07:13clgvbut out parameters probably work very similar
07:15tgoossensI have a lot of difficulties with accepting that my program interface will be like that :p
07:16clgvwell, it's only for at most 5 months and one of many courses, right? ;)
07:17clgvI did program Visual Basic for a company for several months before my studies. in retrospective that felt like programming on hands and knees ;)
07:20tgoossens:)
07:20clgvand at that time I already knew C++ and Delphi which made the situation worse ;)
07:25cYmenwdwc claims that stopping a server and starting a server should clear session variables but I actually have to restart the repl for that. Does anybody know what's going on?
07:27clgvcYmen: wdwc?
07:29clgvcYmen: i'd say that behavior depends on the lib you use. afaik some libs like lib-noir use global state for sessions so you either have to clear those manually or restart the repl
07:47paulswilliamsesqHi all, is there a simple function, or idiomatic way to combine two maps by adding the values of matching keys ala -> https://www.refheap.com/63331
07:47clgvpaulswilliamsesq: merge-with - but you need the attributes present in the first map or some clever use of `fnil`
07:48paulswilliamsesqclgv: cheers, I don't need to worry about that - I'm creating both maps. Thank you!
07:51paulswilliamsesqclgv: worked a treat - deleting code is such a good feeling :-)
07:52clgvpaulswilliamsesq: :D
08:03cYmenclgv: thanks
08:03cYmenclgv: wdwc - web development with clojure by dmitri sotnikov
08:04clgvcYmen: ah right that book
09:13tgoossensOne thing I get with creating simple functions is that I usually end up having a *lot* of functions.
09:20john123Does anybody know how much proposals clojure got?
10:27AeroNotixNot sure
10:27AeroNotixfor what?
10:27clgvGSoC I guess
10:27AeroNotixah
10:33nbeloglazovAround 30 proposals
10:39clgvnbeloglazov: where do you have that number from?
10:40nbeloglazovI'm a mentor in this year GSoC.
10:40clgvah ok
10:54sverihi, is it ok to use UUID as a unique random string?
10:57hyPiRionsveri: I would say yes
10:58hyPiRionAlthough I would probably use the UUIDs as UUIDs (128 bit identifiers) instead of as strings
11:01sverihyPiRion: ok, thank you very much
11:03TimMcsveri: Depending on your use-case, you may want to control the random number source.
11:09seangrovednolen_: Any way to get data structures from clojurescript code compiled separately working with a mori project compiled separately?
11:10seangroveI suppose that isn't the intended use case, but I'm looking for a bridge between cljs->js, allowing js-lang to work with cljs data structures in little sections, and then pass it back to cljs land
11:11dnolen_seangrove: hmm, not sure about compiled separately, but if mori was a dep of your project you would expose the mori api to JS users.
11:12seangrovednolen_: That makes sense, thanks
12:22speckleHi, what is the current state of Clojure IDEs? How does IntelliJ for Clojure compare to IntelliJ for Java? What's the best IDE for Clojure: SLIME, IntelliJ, or something else?
12:23clgvspeckle: yay IDE flame war! :P
12:23scottj_speckle: nothing is as good as intellij for java.
12:24clgvspeckle: the best IDE is highly opinionated and in general prettysubjective ;)
12:24speckleHmm, so people moving from Java to Clojure usually sacrifice IDE quality for language quality, I guess. Okay, thanks.
12:24scottj_speckle: if you used emacs you probably wouldn't be asking this right? give cursive for intellij and CCW for eclipse a try.
12:25clgvspeckle: not really. why do you think that?
12:25scottj_clgv: I basically said that
12:25scottj_clgv: look at clj-refactor.el. it is brand new and has what intellij did 10 years ago
12:25clgvscottj_: what?
12:27speckleclgv: what scottj_ said implied that Clojure IDE support isn't as good as Java's, therefore I started considering the trade-off involved
12:28speckleThanks for opinions, everyone! I learned about interesting IDE options I didn't know of before :)
12:28clgvspeckle: honestly you dont need that much refactoring for clojure as for java. extracting functions would be nice sometimes or not renaming functions via search/replace... but that's probably the only things I noticed
12:30scottj_speckle: clgv's last response is very common. you don't need refactoring, debuggers, intellisense in clojure, they say. but then tons of clojure users 1) try to implement/use these with clj-refactor.el, ritz, ac-nrepl, lighttable, etc. 2) are crazy happy when an awesome solution, normally inferior to the intellij one, comes out.
12:31dnolen_speckle: CursiveClojure for IntelliJ is very good, probably the best traditional IDE experience at this point.
12:32clgvscottj_: huh? I told you the two refactoring tools I'd like^^
12:33scottj_clgv: sorry, I was focusing too much on the first part of your common and probably responding to things people have said in the past more than you.
12:34scottj_s/common/comment
12:35sveriI miss some refactoring too
12:36clgvscottj_: I have experienced the difference in what tools you need with Java/C#/C++ compared to clojure. due to the big change to repl based development a debugger (e.g. for stepping through code) isnt needed. I could use one since CCW supports that. but the last time I used it is probably sometime at the end of 2012 ;)
12:37scottj_that was about the last time I used one for Clojure too, but only because ritz stopped working for me after that :)
12:37sveriYou are right, everything has advantages and tradeoffs, the fact that i can use lighttable like a repl with instant evaluation is such a huge speed gain while developing algorithms, is much more worth than refactoring in java
12:37clgvoh damn^^
12:40felherIs there a special reason that (every-pred) doesn't return (constantly true)? It strikes me as a bit inconsistent. (Also, it bit me in the but ;) )
12:40specklelighttable? interesting, that looks like another good IDE, thanks!
12:43dnolen_clgv: scottj_: definitely do not agree with that. There are times when you want a debugger even in Clojure. Having step debugging support in ClojureScript has been awesome - and the fact that IDEs like CursiveClojure offer step debugging REPLs is pretty awesome.
12:44scottj_dnolen_: I meant that I want a stepping debugger in clojure but ritz stopped working for me, not that I don't miss it :)
12:44dnolen_scottj_: yeah I never got ritz to work - CursiveClojure is the only thing for Clojure that I've used that has a great experience that doesn't require reading instructions.
12:53dimsuzhello guys! noobie needs hint. ([0 (0 1)] [3 (1 2)]) => ((0 0) (0 1) (3 1) (3 2)), i.e unroll. any seq fns which will help me achieve that?
12:54bufferlossI’m trying to follow this https://github.com/clojure/clojurescript/wiki/Quick-Start and when I run `cljsc hello.cljsc '{:optimizations :advanced}' > hello.js` I get “Exception in thread "main" java.io.FileNotFoundException: out/constants_table.js (No such file or directory)”
12:54bufferlossany idea what’s up with that?
12:54bufferlossI have $CLOJURESCRIPT_HOME set
12:54bufferlossand its bin folder is in my path
12:54napper2bufferloss: drop the c
12:55bufferlossnapper2: from what?
12:55napper2$ mv hello.cljsc hello.cljs
12:55bufferlossnapper2: ok did that, still the same error
12:56napper2I'm out of ideas, I thought the cljsc would only target cljs files. :P
12:57bufferlossI don’t see how that makes any sense, it’s a file name, it shouldn’t care what the file name is, it’s not like it’s searching glob patterns or something to “auto find” my cljs files, I’m passing the name right on the command line
12:58bufferlossanyway, ergh, so far clojure has been a giant fail, (well, at least clojurescript)
12:58bufferlossclojurescript one doesn’t work at all, it’s instructions are conflicting, neither version of the “one” instructions work correctly, and now the cljsc doesn’t work from outside the cljsc repo apparently, even though I did everything they said
12:59bufferlossI set my $CLOJURESCRIPT_HOME environment variable, added its bin folder to my path, as evidenced by the fact that I can handily run the compiler, it just gives an error
12:59dark_elementbufferloss, have you tried this https://github.com/magomimmo/modern-cljs ?
12:59bufferlossdark_element: nope, I figured I’d start with what seemed like the canonical clojurescript thingermajigger, which seemed to be the official clojurescript repo
13:01dark_elementbufferloss, mordern-cljs is a good place to start
13:01`szxdimsuz: ##(mapcat (fn [[a b]] (for [k [a] v b] [k v])) '([0 (0 1)] [3 (1 2)]))
13:01lazybot⇒ ([0 0] [0 1] [3 1] [3 2])
13:02bufferlossdark_element: it looks like far more than I want, I just want to be able to literally run the cljsc compiler so I can start working with clojurescript in my own project immediately
13:02bufferlossI don’t want to have to work inside someone elses repo, which this looks like it requires
13:02bufferlossas does the “one” tutorial
13:03bufferlosslol @ clojurescript one because “look at how nice our web page looks, joke’s on you cuz our shit doesn’t work!"
13:03dark_elementbufferloss, then follow the first chapter https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-01.md
13:05cYmenIn emacs, how do I reevaluate all open files?
13:12dnolen_bufferloss: ClojureScript One is dead
13:12dnolen_bufferloss: better starting point http://swannodette.github.io/2013/11/07/clojurescript-101/
13:12bufferlossdnolen_: nice of them to not indicate that on their website then :/
13:13seangrovebufferloss: Chill out.
13:13bufferlossif by chill out you mean “stop being annoyed by things that could legitimately be expected to annoy a person” then I’ll try
13:13dnolen_bufferloss: yes, but last commit was 2 years ago https://github.com/brentonashworth/one which is always a good indicator of abandon-ware
13:14bufferlossdnolen_: the last commit of https://github.com/clojure/clojurescript was 5 days ago but its instructions also didn’t work for me
13:15dnolen_bufferloss: using the compiler directly is not recommend the getting started instructions say this
13:15bufferlossthat’s not a good excuse for it to not work
13:15bufferlossI like to be thorough usually and try to understand things from the bottom most basic versions upward, so I tried the compiler
13:16bufferlossthey should just omit any instructions on its usage at all if A) it’s not recommended and B) the instructions don’t work
13:19dnolen_bufferloss: then open an issue in JIRA w/ the precise steps that you could not get to work including detailed platform information. Even better if there is a real issue that you submit a corresponding patch.
13:19bufferlossdnolen_: I may open the issue, I certainly don’t yet have the knowlege to even think about submitting a patch
13:20dnolen_bufferloss: we get plenty of patches that don't require any knowledge of the compiler or it's internals. Sometimes it's as simple as fixing a bash script.
13:20bufferlossstill something I’m not interested in doing as much as I’m interested in first actually understanding and using clojurescript
13:21bufferlossi’m going through the tut you pointed me too, hopefully that’ll yield better results
13:21dnolen_bufferloss: let me know if you run into issues, many people have tried it w/ good results.
13:23bufferlossdnolen_: Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: reader/*alias-map* in this context, compiling:(cljs/analyzer.clj:1213:9)
13:23bufferlossfrom using lein cljsbuild once
13:24dnolen_bufferloss: oops I actually sent you the wrong link, start with http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/
13:25bufferlossdnolen_: oh hmm, apparently I wasn’t using the link you sent me, I was using the link dark_element sent me
13:25bufferlossI guess I’ll try yours now
13:26clgvdnolen_: is "Mies" your clojurescript leiningen template?
13:26dnolen_clgv: yes I just use it for tutorials
13:26bufferlossso, after fail number 3
13:27bufferlosshere goes my probably last and final attempt before giving up on this clojurescript idea and going back to backbone
13:27bufferlossit seriously should not be this difficult to get going with clojurescript if the community expects the rest of the world to take it seriously
13:27bufferlossdon’t get me wrong, I currently have high hopes for it, but they are consistently being dashed :(
13:28dnolen_bufferloss: ClojureScript is primarily for Clojure users, we try our best to make it simpler for other people as well, but it's a lot of work of course.
13:28bufferlossdnolen_: I have written at least a small-ish clojure project already, so I’m not a total noob to clojure
13:28dnolen_bufferloss: anyways, if you're bored some other time - https://github.com/swannodette/lt-cljs-tutorial, then you don't have to do anything but install LT and lein
13:29bufferlossand I don’t mind if something is complex, I do mind when I try 3 separate seemingly canonical sources of how to get started and they all fail in some way
13:29dnolen_bufferloss: I just tried my link it just worked, so I have no idea what's going wrong w/ your setup
13:29bufferlossI am mostly a noob to clojure, but not a total noob, I’ve set up a ring/compojure/incanter/postgres/jdbc app
13:29dnolen_bufferloss: accounting for different environment sucks everywhere
13:29bufferlossdnolen_: yeah I haven’t tried yours yet
13:29bufferlossit’s the last stop
13:31bufferlossdnolen_: so here’s the crux of the issue, http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/ is how to set up a new app, I want to integrate clojurescript in to the above/afforementioned app so I can add a UI
13:32clgvbufferloss: just try it and the copy the needed configuration over to your project ^^
13:32clgv*then
13:32clgvif it might not work on its own there is no use to integrate anything into your existing project, right?
13:33bufferlossclgv: well I basically have done that alread
13:33bufferlossy and I got the most recent error I pasted above
13:33bufferlossI’ll pastebin my project.clj maybe you guys can see what I missed
13:33clgv"git checkout ."
13:33clgv;)
13:35bufferlossclgv: not sure what you mean by that
13:35bufferlossdnolen_ clgv https://gist.github.com/anonymous/9711155
13:36dnolen_bufferloss: specify [lein-cljsbuild "1.0.2"] and [org.clojure/clojurescript "0.0-2173"]
13:36bufferlossk
13:36dnolen_clojurescript needs to go in :dependencies
13:37bufferlosshey! fuck yeah :)
13:37bufferlossthanks
13:37dnolen_bufferloss: here I'll fork and make the changes I think you should use
13:38bufferlossI got it, it seems to work now
13:38bufferlossgonna try out the actual generated JS now
13:39bufferlossnice, yeah the js appears to have been invoked as I would expect
13:39bufferlossfinally! now to actually try learning clojurescript itself
13:39dnolen_bufferloss: https://gist.github.com/swannodette/9711228
13:39dnolen_bufferloss: faster compile settings (use lein cljsbuild auto), and source maps enabled
13:39dnolen_bufferloss: will work best in Chrome/Safari
13:40bufferlosseh, will work best in Chrome :P
13:40bufferlossFF and Safari are almost the bane of my normal working day existence as IE
13:41bufferlossI only use chrome for dev, can’t stand the dev tools in firefox or firebug, and who actually uses safari ;)
13:42malyndnolen_: Does output-to just concat all of the (unoptimized, in this case) js files together? Haven't seen that one before...
13:42speckleI thought that the point of Clojure was to leverage the Java platform with a better language. It's interesting to see ClojureScript catch on over other Lisps that compile to JS
13:43dnolen_speckle: ClojureScript has the best compile to JS story I'm aware of as far as Lisps go
13:43speckleAh, so I guess Clojure is a nice Lisp to compile to arbitrary platforms in general, perhaps
13:44bufferlossdnolen_: what is the purpose of output-dir ?
13:44malynOh, wait, I use that all the time. :) I guess I just don't use that and output-dir together.
13:44dnolen_malyn: it just specifies where individual compiled JS files go, will default to "out" which isn't what you want in a server setup
13:44dnolen_also critical if you want source maps to work in server setup
13:45bufferlossspeckle, malyn, also the clojurescript output is compatible with the google closure js compiler
13:45dnolen_speckle: well, less that, rahter Java & JavaScript are everywhere so Clojure targets them
13:45malynI'm just trying to work my head around the combination of output-to and output-dir... I guess I need to mess around with that in a few of my projects and see what happens.
13:46bufferlossdnolen_: yeah I’m wondering what’s the purpose of output-dir ?
13:46dnolen_malyn: output-to and output-dir make more sense if you use :optimizations :none
13:46dnolen_malyn: no single source is produced in this case (i.e. Google Closure Compiler never touches any generated code)
13:47malyndnolen_: Yeah, that's what I was thinking. I never use :optimizations :none because then I have (?) to include a ton of different js files in my .html. Maybe I'm just doing that wrong though...
13:47dnolen_this enables subsecond recompiles
13:47malyn^^ That is exactly why I am all over this at the moment. :)
13:47dnolen_malyn: I only use :optimizations :none for dev, I find anything else tedious
13:48malynOkay, so the many-script-tags thing is just the way it goes when you use :optimizations :none then? I guess I'm not doing it wrong. Bummer.
13:49malynOh, I think that I misunderstood; you're saying that :optimizations :none is good for dev because it's so much faster, not because of the annoyance of the separate files.
13:50dnolen_malyn: yes you have to write several script tags in your markup (you could easily automate this in your server setup), this beats waiting for recompiles IMO, since during dev you're optimizing for ... dev.
13:50dnolen_malyn: I find REPL + fast recompiles to be the most productive
13:50dnolen_setup
13:51malyndnolen_: Yep, I'm seeing that need to do some tweaking here. I'm starting to automate more of my script tags anyway now that I am using Austin, so I might as well automate this as well.
13:52malynThanks for the info!
13:52dnolen_malyn: np
13:58bufferlossmalyn: I don’t personally mind including js files, when using requirejs it becomes relatively easy and natural to do
13:59bufferlossspeaking of which, is there anything akin to requirejs in clojurescript? or is there any reason to use something at all similar? and or can I just use requirejs like “normal” ?
14:11jstewGreetings.
14:12jstewIs there an easy way to get the current path when running lein test? I've got a fixture file in test/proj/test/fixtures/ that I want to load
14:15jstewI'm thinking about just doing (slurp "test/xxx/test/fixtures/foo.json")
14:26divyyyou can do exactly that
14:27divyylein test runs in your project root, independent from where you execute it
14:38jstewdivyy: Great, thanks.
14:48bufferlossFileNotFoundException Could not locate cljs/clojure__init.class or cljs/clojure.clj on classpath: clojure.lang.RT.load (RT.java:443)
14:48bufferlossI get that when running (require '[cljs.clojure :as cljsc])
14:48bufferlossfrom my lein project repl
14:48bufferloss(require '[cljs.repl :as repl]) for example seems to work fine, and I can run lein cljsbuild once and that works as expected
14:49bufferlossdnolen_: how do you compile from your repl? you were talking about subsecond compile times
14:49bufferlossI’m trying to get those sub second compile times
15:07sdegutisWhat's a reasonable way to include another project's jar file along with my jar file when compiling my Clojure web app (via `lein ring ubarjar`)?
15:07sdegutisSpecifically, I want to install nrepl.jar on the remote server as well.
15:08bufferlossso I am trying to use lein cljsbuild and it does compile things, and I’ve added a script tag for goog/base.js and a script tag for the generated output file which runs good.deps etc, but I still can’t get my super basic message to show up
15:08bufferlossshows up fine when not using output-dir
15:08bufferlossdnolen_: ^ any ideas what I might be missing?
15:09dnolen_bufferloss: are you using auto building?
15:09bufferlossdnolen_: I’m just running lein cljsbuild once
15:10dnolen_bufferloss: subsecond compile times are only possible w/ auto
15:10bufferlossis that different aside from autorecognizing changes?
15:10bufferlossI don’t care about subsecond at the moment, i just want to get the build to work with output-dir
15:10bufferlossI’ll worry about subsecond in a moment
15:10bufferlosscuz, if I can’t get the build to even run, then subsecond build times are a moot point
15:11bufferlosss/run/give me the expected output aka “work”/
15:11dnolen_bufferloss: sorry I'm a bit busy with something else at the moment, ask in #clojurescript or ask on the ClojureScript ML
15:18daddywhois gignosko
15:18daddyexit
15:19seangrove~quit
15:19clojurebotseangrove: We'll never let you leave.
15:19daddyquit
15:19seangroveWish quit and exit could be triggered without the tilde
15:19daddyhate being a newbie. Grrr.
15:19seangroveHeh, no worries
15:19seangrove /quit
15:19seangroveThat'll do it
15:19daddythanks
15:19seangrove~exit
15:19clojurebotGabh mo leithscéal?
15:20seangroveclojurebot: exit is There is no exit
15:20clojurebot'Sea, mhuise.
15:20seangrove~exit
15:20clojurebotexit is There is no exit
15:24bufferlossergh, so now that I’ve added output-dir to my project.clj it seems that lein won’t forget that I did so and insists on doing everything with goog instead of compiling a monolithic file
15:24bufferlossis there some kind of leinengen cache or something that I need to clear?
15:25Rosnecmaybe `lein clean` will do it?
15:25dbaschwhere does Friend store the authentication data for the session?
15:25Rosnecnot totally sure what clean does, but I try it whenever something like that happens
15:26bufferlossRosnec: nope, nothing has changed
15:27Rosnecbufferloss: figures. I think clean might just be for cleaning up unused dependencies
15:27bufferlosswtf, this worked fine the first time I ran lein cljsbuild once, it generated modern.js and I opened my page in chrome and I got the js message on the page
15:27bufferlossnow after adding and removing output-dir, modern.js refuses to compile as it did before
15:27bufferlossit insists on compiling as if output-dir were still there
15:30bufferlossthis is a fucking horrible user experience for anyone new to clojurescript, I’m sorry
15:30bufferlossbut it’s the truth
15:34cmdrdatsI have an initial.edn that I'm trying to read in a dataset for datomic, but it's giving me "Record construction syntax can only be used when *read-eval* == true"
15:34cmdrdatsbecause of the #db.id[…]
15:37cmdrdatsI have : (binding [clojure.tools.reader/*read-eval* true] (Util/readAll (io/reader f)))
15:39cmdrdatsnevermind - I had a db.id instead of db/id
15:44bufferlossdnolen_: yeah so I think I’ve *sort-of* gotten it back to working order, in that I can use the default settings outputting to a monolithic file, but I still can’t get the output-dir directive to work, meaning that when I add the output dir directive, my basic alert message no longer appears in my browser
15:44bufferlossand I do have a <script> tag that includes the generated goog/base.js
15:45bufferlossand immediately after that I have a script tag that includes the main file, modern.js
15:45bufferlosswithout touching my html, this works fine as long as I do not make use of output-dir, otherwise simply “nothing happens"
15:46bufferlossthis is without changing the actual .cljs file itself at all, and without changing the html at all
15:46bufferlossso I don’t get it, what am I missing, I don’t get any errors in chrome console
15:46bufferlossI only have a single .cljs file rightn ow
15:58noonianbufferloss: i think you may need to have your :output-to path be a sibling of the directory you specify with :output-dir if you include that directive
15:58bufferlossnoonian: it is already, actually I figured it out finally
15:59bufferlossthere really should be a good tutorial written on how to just jump in to integrating clojurescript into an existing project
16:00noonianyeah, i think most people have a similar experience getting it set up, but then once its up and running you lose most of the motivation to write that documentation since chances are you won't run into these problems anymore
16:24s0x_hey guys ... how do you write your tests when it comes to precision. e.g. i've a simulation of a robot moving like a square. While im using angle and distance even a square with a step width of 1 eventually results in something like [0.0 1.00...2].
16:32rovarwhat's a good way to make sure that a hash-map only contains a list of keys that I specify and no others?
16:32divyynaive: you could check if every item of the list is in the map and compare the sizes of the list and the map
16:33divyyis at least O(n), so not soo bad
16:33rovarhttp://clojuredocs.org/clojure_core/1.2.0/clojure.core/select-keys
16:33rovarman they thought of everything
16:57gfrederickszipmap is a pretty weird function
16:58gfredericksmy guess is for 96% of its uses there is a conceptually simpler way of creating the map
16:59jcromartiezipmap seems pretty nice to me
16:59jcromartie,(let [m {:x 1 :y 2}] (zipmap (keys m) (map inc (vals m))))
16:59clojurebot{:x 2, :y 3}
16:59jcromartieseems quite concise
17:00gfrederickssure, but conceptually what you're doing is really weird
17:00gfredericksyou have a map, and you're separating it into a sequence of keys and a sequence of values, while the whole process is really sensitive to the positions of the items in each sequence
17:00gfredericksthe two sequences are highly entangled
17:01gfredericks(into {} (for [[k v] m] [k (inc v)])) avoids that weird situation entirely
17:01gfredericks(but is gross to read)
17:01jcromartieit's not that rare to have a pair of sequences like that.
17:02jcromartiehm, yeah I like that into/for approach
17:02Bronsaor you could use reduce-kv
17:02gfredericksbut I think you only end up having sequences like that because you used to have pairs and you split them apart
17:03gfredericksBronsa: in reality I use plumbing.core/map-vals
17:03gfredericksI was just realizing how little use I had for zipmap
17:08amalloygfredericks: zipmap is okay for like...csv files. (map (partial zipmap [:name :age]) (read-csv-rows))
17:08gfredericksamalloy: yeah that's a good one
17:09gfredericks(defn zipmap "A function for making maps out of CSV rows." [ks vs] ...)
17:10gfredericksspeaking of which is it a bad thing that data.csv doesn't do this for you?
17:13amalloygfredericks: i think it would be pretty silly to put in data.csv
17:14amalloylike, there needs to be a version that doesn't deal with column labels *anyway*: the csv file format doesn't mandate anything about having the same labels at all, or even the same width in each row
17:15amalloyand given that exists, do you really need data.csv to include its own version of zipmap?
17:16eraserhdIn core.logic, when is it conventional to end a function with 'o' and when is it conventional to use 'g'? I can't see the distinction
17:17dnolen_eraserhd: just a convention I adopted for goals that are not really relational
17:18eraserhddnolen_: Oh. I thought there were g's in the Reasoned Schemer.
17:18eraserhdThat makes sense.
17:29gfredericksamalloy: it's own version of zipmap, no; I'm just thinking 97% of CSV reading use cases have columns labels in the first row, so a helper function might be nice
17:43seangroveOh ffs, css transform-translate is from the offset of the parent even if the the parents is absolutely positioned. Think I'm going to have to bypass almost everything the browser provides
17:44whodidthisis there a function that returns {:cool cool :yay yay} from cool yay
17:45seangrove,(let [s ['cool 'yay]] (zipmap (map keyword s) s))
17:46clojurebot{:yay yay, :cool cool}
18:08dnolen_seangrove: ping
18:38seangrovednolen_: What's up?
19:31eraserhdI'm writing lots of basic things on top of core.logic. Does core.logic want them? Am I doing it wrong? So far: listofo, ntho, get-ino, now someo
19:37amalloyeraserhd: i have trouble imagining functions that fit most of those names. like, they can't really be relational, right? so at best you have someg
19:38amalloyntho can be relational, of course
19:43eraserhdOh, because of goals as arguments. Right.
19:44_ericwhat would be the simplest way to turn an array of arrays into a map?
19:44_ericfor instance ((host nil) (service "ser")) into {host nil, service "ser"}
19:44_ericI came up with (apply hash-map (flatten (map rest my-list)))
19:44_ericbut that seemed overly complicated
19:45noonian,(into {} [[:one 1] [:two 2]])
19:45clojurebot{:one 1, :two 2}
19:45_erichah
19:45amalloy1flatten
19:45amalloy~flatten
19:45clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
19:45_erichmmmmm
19:46_ericI get a strange error:
19:46_ericClassCastException clojure.lang.Symbol cannot be cast to java.util.Map$Entry
19:46amalloy_eric: into is usually right, but note that it requires vectors, not lists
19:46noonianif you have (
19:46_ericah
19:47noonianhmm, it really requires vectors?
19:48amalloywell, for putting things into a map
19:48amalloy&(into {} '[(a 1)])
19:48lazybotjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
19:48amalloy&(into {} '[[a 1]])
19:48lazybot⇒ {a 1}
19:48noonianjust the pair has to be a vector
19:49noonian,(into {} (list [1 2] [3 4]))
19:49clojurebot{1 2, 3 4}
19:49noonian,(into {} (list (list 1 2) (list 3 4)))
19:49clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>
19:51_ericso I guess I just need to call vec on the things?
19:54amalloyright, (into {} (map vec things)) probably
19:56_ericsweet
19:59amalloyand of course there are a multitude of silly ways to do it: (reduce (partial apply assoc) {} things)
20:02noonianbut if you have a lazy seq from mapping a fn onto it you can just use mapv to keep things concise
20:16_ericis there a simpler way to say this?
20:16_eric(if (and (contains? eq-map 'host) (contains? eq-map 'service))
20:17_ericI'm trying to ensure that both keys exist in the map before I get the values out
20:17_eric(because I need to distinguish between a key not being there and a value being nil
20:22amalloy(every? #(contains? eq-map %) '(host service))
20:23amalloy_eric: but if you just need to tell the difference between a key not being there and being nil, you can use the three-arg version of get: (get m k default)
20:23_ericah! thanks for the (every?) trick
20:40nopromptRaynes: gah, just discovered lein-pdo
21:11krasWhen using clj-antlr (a port of antlr to clojure), the parse gives me back a CONS? Is there a way I can make it return a lazy-seq instead?
21:13amalloyi doubt it. antlr probably parses all at once
21:17krasThinking about my question ... I guess its not possible to give out a lazy-seq when you have already parsed the whole file
21:24_ericif I reify an interface, can I call one implemented method from another?
21:25amalloyof course. when you reify, you get a java object like any other
21:25amalloy(reify IFooBar (foo [this] (.bar this)) (bar [this] 1))
21:25_ericah, of course
21:25_ericthanks
21:26_ericthat was obvious but I didn't think about it that way
22:31akurilinRandom comment: just wanted to thank whoever came up with partition, being able to specify partition size and step is brilliant.
22:31akurilinwow such leverage
22:32Rosnecyeah, partition is pretty brilliant
22:46eraserhdIn core.logic, I'm struggling with how to phrase a problem. I have a graph with cycles, and I want to find connected components.
22:48eraserhdWithout core.logic, I could do a DFS or BFS with a set of seen items... Oh, can I use distincto on the output variable first?
22:50eraserhdCan I translate a relation with multiple results to a relation with one list result?
23:03gfredericksbrehaut was just trying to do that the other day; I can't remember if he succeeded or if I was correct that it suggests he was modeling the problem wrong
23:11john2xhow do I test my noir ring handler functions? It's throwing an exception on noir.validation methods, I think because when I run the test I don't start a ring server..
23:11nopromptjohn2x: you shouldn't be using noir.
23:12nopromptjohn2x: you should just use compojure. noir's been deprecated for a long time.
23:12nopromptjohn2x: but if you *want* to use it, test it with ring.mock
23:15john2xnoprompt: i mean lib-noir, from luminus
23:16john2xi think it's still maintained by yogthos
23:16eraserhdgfredericks: I may be modelling the problem in a way that core.logic doesn't like. But not _wrong_ :D
23:16nopromptjohn2x: ring-mock should be able to help you.
23:17john2xah right, ring.mock.. hmm not as simple as I thought it would be. thanks!
23:31gfrederickseraserhd: wrong relative to relational programming I meant
23:40blakeAnyone here able to help me connect to sqlite3? I keep getting "missing required paramter".
23:42devnah, airplanes
23:43devnen route to clojure/west -- got lucky with a new 737 that has a power adapter and usb plug per seat
23:43devnit still has that "new plane" smell
23:52dsrxwow, usb plug?