#clojure log - Mar 22 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:02 felixflores: anyone here using fireplace + vim with clojurescript?

0:11 ambrosebs: felixflores: yes

0:12 felixflores: for some odd reason when I try %Eval I get this

0:12 https://gist.github.com/felixflores/7fbfe19a7fe6cbc51bdb

0:13 this is for a cljs file

0:13 but it works perfectly well with clj files

0:13 all I'm doing is evaling this https://gist.github.com/felixflores/3c2abd611b4ad4d4575c

0:14 is there something special I need to do in order to eval cljs

0:15 I hate asking stuff like this on IRC but I've been Googling for a while now

0:18 garietyxxx: Hi, #clojure, I'm trying to compile some clojurescript with lein-cljsbuild but running into problem after problem. Any help?

0:19 bob2: would need to at least refheap.com the errors

0:20 felixflores: https://github.com/clojure/clojurescript/wiki/Vim < looking like a good source for my question

0:21 garietyxxx: bob2: 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.

0:32 bob2: garietyxxx, did you use a lein template?

0:35 vimuser2: D: finally had use for ->> amazing lol

0:35 garietyxxx: bob2: nope

0:35 bob2: garietyxxx, would guess you just put the code in the wrong place then

0:38 garietyxxx: bob2: nope, I was getting this "warning" about incompatible clojurescript version. changed it to latest r and works :-)

0:38 eraserhd: core.logic: How come everyg doesn't work like listofo (from Reasoned Schemer)?

0:39 jph-: anyone here familiar with prismatic/schema? with defn, can i still do optional & arguments? (s/defn foo [a :- [s/Str] & [b :- [s/Num]] ...)

0:56 Rosnec: what would be the simplest way to take a URL and get a seq of bytes from it?

0:57 felixflores: Okay so it turns out I was doing several things wrong to get up and running with clojurescript repl.

0:57 one: https://github.com/cemerick/austin/issues/55

0:57 and my proj needed to include [com.cemerick/austin "0.1.4"] https://gist.github.com/felixflores/fc2fdf48dcd98960c394

0:58 bob2: Rosnec, for parsing?

0:58 Rosnec: not even parsing

0:58 just sending a sequence of bytes

0:58 all I want is the raw bytes

1:01 cemerick: felixflores: sorry for the hiccup re: 2176; hopefully that'll get put to bed soon

1:02 felixflores: oh no problem. I should have done more research before crying out loud on irc :)

1:06 @cemerick thanks for putting this plugin together. it's working great now.

1:06 cemerick: felixflores: glad it's helping you, despite some early troubles

1:14 seangrove: What's a good way of expressing "this value, or min 0 or max 100"?

1:14 ,(let [v -50] (max (min 0 v) 100))

1:14 clojurebot: 100

1:14 seangrove: Obviously not that, hah

1:15 akhudek: you mean you want to clamp it to 0,100?

1:15 seangrove: akhudek: Yes, that

1:15 akhudek: (min (max 0 v) 100)

1:16 seangrove: Ah, yes, that's it. Probably a sign I should stop anyway, just thought there might be a built-in function

1:16 jph-: how would i convert (format "%s/%s" (get foo :bar) x) into a thread-first macro, or is that overkill?

1:17 im trying (-> (get foo :bar) (format "%s/%s" x)) with no love

1:17 akhudek: jph-: I think the original is best

1:17 jph-: akhudek, ok, cheers

2:09 Rosnec: is there an existing function to print to stderr, or do I have to rebind *out* and use print?

2:12 Cr8: the latter

2:19 Rosnec: Cr8 I wound up writing one myself

2:19 two, actually

2:19 print-err and println-err

3:37 abaranosky: anyone going to be at Clojure/West next week?

3:39 amalloy: abaranosky: yeah, i'll be there. Factual will be out in force

3:42 abaranosky: amalloy: you are at Factual now?

3:42 amalloy: indeed i am

3:42 abaranosky: I'm going to see Zach's predictably fast Clojure talk

3:42 should be useful

3:44 amalloy: did you look at the schedule? The last day is "hackfest", any ideas what that is? Or does it really mean to "do whatever"

3:44 amalloy: it's poorly defined enough that i'm not sticking around for it :P

3:45 abaranosky: yep... I feared the worst

4:52 honza: Just about every clojure project on GitHub uses the EPL license - is that a requirement since clojure is released under EPL?

4:52 wagjo: honza: no, but it is convenient

4:53 honza: wagjo: how so? so, licensing under bsd doesn't violate anything?

4:55 wagjo: well yeah, but if you want more strict license, EPL is a good fit for Clojure projects which run on top of JVM

5:07 wink: honza: to agree it's the typical laziness, usign the default I'd say

5:07 for people not thinking about it hard, the default clojure choice seems to be EPL

5:07 honza: wink: yes, the default license in new lein projects is epl

5:08 wink: honza: not what I meant, but also true

5:09 cYmen: Good morning.

5:09 wink: what I meant: in any language ecosystem people tend to have default licences, inspired by the tools they use

5:09 mostly it's BSD vs GPL

5:09 this is just guessing, but really thinking about a license: 1/4 of projects or less

5:09 honza: oh i see

5:11 also confusing https://github.com/bodil/BODOL/commit/195f38c31e787de9f47f43d8b325744f99ba74c4

5:14 wink: everytime I even think of licenses I get a headache

5:14 I'm out :P

5:15 old thread that might or might not make sense: https://groups.google.com/forum/#!topic/clojure/mGf_SuHsSGc

6:41 tgoossens: I 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

6:42 Unlike before, now my (scientific) software has to be very performant.

6:43 clgv: tgoossens: fortran? why on earth?

6:43 tgoossens: are you in a computer science program for legacy systems? ;)

6:44 tgoossens: I study mathematical engineering

6:44 clgv: ah right the math courses also use fortran sometimes

6:44 tgoossens: On subdomain of it is simulation. Aircrafts, explosions! , bridges, spaceships!

6:45 *one

6:45 bob2: fortran is still very very fast compared to other languages

6:45 even C

6:45 ddellacosta: tgoossens: clearly you now need to create clof-tran

6:45 tgoossens: ddellacosta, whats that?

6:45 well yes

6:45 i get it

6:45 ddellacosta: that, tgoossens, is a bad joke

6:45 tgoossens: I've been thinking about that :p

6:46 beamso: i'm trying to work out if i missed out by not doing fortran and cobol at uni

6:47 tgoossens: I think it is good that at least once you try to write very efficient software. I think it is a tough but worthful experience

6:47 clgv: hmm but cobol is probably only useful if you plan to maintain or migrate legacy systems ;)

6:49 tgoossens: Another reason that they teach us fortran is

6:49 no one knows it

6:49 so everyone can start at the same level

6:50 and the scientific software writing principles are of course the same. Floating point etc.

6:51 fun fact

6:51 in my project assignment I found the following sentence:

6:51 clgv: so is that an introductory course to programming?

6:52 tgoossens: "Using print statements for debugging. However, if you find a decent debugger for fortran you can let us know"

6:52 clgv: :/

6:52 tgoossens: No I had an introductory course to programming in my first year (Three years ago)

6:52 and a course on Object Oriented Programming

6:52 But that was all really high level

6:53 clgv: what's the point of choosing a language that probably no one of the students knows already, then?

6:53 tgoossens: now we have to even think about memory structure on the machine

6:53 clgv: ah ok

6:55 tgoossens: It will be a pain in the ass. But I think I will learn a lot

6:55 i noticed that fortran has a "pure function" statement :p

7:10 clgv, my book suggests to use output arguments procedure(in1,in2,out1,out2)

7:11 if for example you want to return multiple things

7:11 in clojure i would of course return a map

7:13 clgv: tgoossens: well common lisp has a way to return multiple results efficiently via the program stack^^

7:13 tgoossens: :D

7:13 clgv: but out parameters probably work very similar

7:15 tgoossens: I have a lot of difficulties with accepting that my program interface will be like that :p

7:16 clgv: well, it's only for at most 5 months and one of many courses, right? ;)

7:17 I did program Visual Basic for a company for several months before my studies. in retrospective that felt like programming on hands and knees ;)

7:20 tgoossens: :)

7:20 clgv: and at that time I already knew C++ and Delphi which made the situation worse ;)

7:25 cYmen: wdwc 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?

7:27 clgv: cYmen: wdwc?

7:29 cYmen: 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

7:47 paulswilliamsesq: Hi 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

7:47 clgv: paulswilliamsesq: merge-with - but you need the attributes present in the first map or some clever use of `fnil`

7:48 paulswilliamsesq: clgv: cheers, I don't need to worry about that - I'm creating both maps. Thank you!

7:51 clgv: worked a treat - deleting code is such a good feeling :-)

7:52 clgv: paulswilliamsesq: :D

8:03 cYmen: clgv: thanks

8:03 clgv: wdwc - web development with clojure by dmitri sotnikov

8:04 clgv: cYmen: ah right that book

9:13 tgoossens: One thing I get with creating simple functions is that I usually end up having a *lot* of functions.

9:20 john123: Does anybody know how much proposals clojure got?

10:27 AeroNotix: Not sure

10:27 for what?

10:27 clgv: GSoC I guess

10:27 AeroNotix: ah

10:33 nbeloglazov: Around 30 proposals

10:39 clgv: nbeloglazov: where do you have that number from?

10:40 nbeloglazov: I'm a mentor in this year GSoC.

10:40 clgv: ah ok

10:54 sveri: hi, is it ok to use UUID as a unique random string?

10:57 hyPiRion: sveri: I would say yes

10:58 Although I would probably use the UUIDs as UUIDs (128 bit identifiers) instead of as strings

11:01 sveri: hyPiRion: ok, thank you very much

11:03 TimMc: sveri: Depending on your use-case, you may want to control the random number source.

11:09 seangrove: dnolen_: Any way to get data structures from clojurescript code compiled separately working with a mori project compiled separately?

11:10 I 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:11 dnolen_: 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:12 seangrove: dnolen_: That makes sense, thanks

12:22 speckle: Hi, 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:23 clgv: speckle: yay IDE flame war! :P

12:23 scottj_: speckle: nothing is as good as intellij for java.

12:24 clgv: speckle: the best IDE is highly opinionated and in general prettysubjective ;)

12:24 speckle: Hmm, so people moving from Java to Clojure usually sacrifice IDE quality for language quality, I guess. Okay, thanks.

12:24 scottj_: speckle: if you used emacs you probably wouldn't be asking this right? give cursive for intellij and CCW for eclipse a try.

12:25 clgv: speckle: not really. why do you think that?

12:25 scottj_: clgv: I basically said that

12:25 clgv: look at clj-refactor.el. it is brand new and has what intellij did 10 years ago

12:25 clgv: scottj_: what?

12:27 speckle: clgv: what scottj_ said implied that Clojure IDE support isn't as good as Java's, therefore I started considering the trade-off involved

12:28 Thanks for opinions, everyone! I learned about interesting IDE options I didn't know of before :)

12:28 clgv: speckle: 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:30 scottj_: 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:31 dnolen_: speckle: CursiveClojure for IntelliJ is very good, probably the best traditional IDE experience at this point.

12:32 clgv: scottj_: huh? I told you the two refactoring tools I'd like^^

12:33 scottj_: 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:34 s/common/comment

12:35 sveri: I miss some refactoring too

12:36 clgv: scottj_: 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:37 scottj_: that was about the last time I used one for Clojure too, but only because ritz stopped working for me after that :)

12:37 sveri: You 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:37 clgv: oh damn^^

12:40 felher: Is 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:40 speckle: lighttable? interesting, that looks like another good IDE, thanks!

12:43 dnolen_: 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:44 scottj_: 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:44 dnolen_: 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:53 dimsuz: hello 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:54 bufferloss: I’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:54 any idea what’s up with that?

12:54 I have $CLOJURESCRIPT_HOME set

12:54 and its bin folder is in my path

12:54 napper2: bufferloss: drop the c

12:55 bufferloss: napper2: from what?

12:55 napper2: $ mv hello.cljsc hello.cljs

12:55 bufferloss: napper2: ok did that, still the same error

12:56 napper2: I'm out of ideas, I thought the cljsc would only target cljs files. :P

12:57 bufferloss: I 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:58 anyway, ergh, so far clojure has been a giant fail, (well, at least clojurescript)

12:58 clojurescript 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:59 I 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:59 dark_element: bufferloss, have you tried this https://github.com/magomimmo/modern-cljs ?

12:59 bufferloss: dark_element: nope, I figured I’d start with what seemed like the canonical clojurescript thingermajigger, which seemed to be the official clojurescript repo

13:01 dark_element: bufferloss, mordern-cljs is a good place to start

13:01 `szx: dimsuz: ##(mapcat (fn [[a b]] (for [k [a] v b] [k v])) '([0 (0 1)] [3 (1 2)]))

13:01 lazybot: ⇒ ([0 0] [0 1] [3 1] [3 2])

13:02 bufferloss: dark_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:02 I don’t want to have to work inside someone elses repo, which this looks like it requires

13:02 as does the “one” tutorial

13:03 lol @ clojurescript one because “look at how nice our web page looks, joke’s on you cuz our shit doesn’t work!"

13:03 dark_element: bufferloss, then follow the first chapter https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-01.md

13:05 cYmen: In emacs, how do I reevaluate all open files?

13:12 dnolen_: bufferloss: ClojureScript One is dead

13:12 bufferloss: better starting point http://swannodette.github.io/2013/11/07/clojurescript-101/

13:12 bufferloss: dnolen_: nice of them to not indicate that on their website then :/

13:13 seangrove: bufferloss: Chill out.

13:13 bufferloss: if by chill out you mean “stop being annoyed by things that could legitimately be expected to annoy a person” then I’ll try

13:13 dnolen_: bufferloss: yes, but last commit was 2 years ago https://github.com/brentonashworth/one which is always a good indicator of abandon-ware

13:14 bufferloss: dnolen_: the last commit of https://github.com/clojure/clojurescript was 5 days ago but its instructions also didn’t work for me

13:15 dnolen_: bufferloss: using the compiler directly is not recommend the getting started instructions say this

13:15 bufferloss: that’s not a good excuse for it to not work

13:15 I like to be thorough usually and try to understand things from the bottom most basic versions upward, so I tried the compiler

13:16 they should just omit any instructions on its usage at all if A) it’s not recommended and B) the instructions don’t work

13:19 dnolen_: 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:19 bufferloss: dnolen_: I may open the issue, I certainly don’t yet have the knowlege to even think about submitting a patch

13:20 dnolen_: 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:20 bufferloss: still something I’m not interested in doing as much as I’m interested in first actually understanding and using clojurescript

13:21 i’m going through the tut you pointed me too, hopefully that’ll yield better results

13:21 dnolen_: bufferloss: let me know if you run into issues, many people have tried it w/ good results.

13:23 bufferloss: dnolen_: Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: reader/*alias-map* in this context, compiling:(cljs/analyzer.clj:1213:9)

13:23 from using lein cljsbuild once

13:24 dnolen_: bufferloss: oops I actually sent you the wrong link, start with http://swannodette.github.io/2013/10/27/the-essence-of-clojurescript/

13:25 bufferloss: dnolen_: oh hmm, apparently I wasn’t using the link you sent me, I was using the link dark_element sent me

13:25 I guess I’ll try yours now

13:26 clgv: dnolen_: is "Mies" your clojurescript leiningen template?

13:26 dnolen_: clgv: yes I just use it for tutorials

13:26 bufferloss: so, after fail number 3

13:27 here goes my probably last and final attempt before giving up on this clojurescript idea and going back to backbone

13:27 it 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:27 don’t get me wrong, I currently have high hopes for it, but they are consistently being dashed :(

13:28 dnolen_: 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:28 bufferloss: dnolen_: I have written at least a small-ish clojure project already, so I’m not a total noob to clojure

13:28 dnolen_: 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:29 bufferloss: and 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:29 dnolen_: bufferloss: I just tried my link it just worked, so I have no idea what's going wrong w/ your setup

13:29 bufferloss: I am mostly a noob to clojure, but not a total noob, I’ve set up a ring/compojure/incanter/postgres/jdbc app

13:29 dnolen_: bufferloss: accounting for different environment sucks everywhere

13:29 bufferloss: dnolen_: yeah I haven’t tried yours yet

13:29 it’s the last stop

13:31 dnolen_: 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:32 clgv: bufferloss: just try it and the copy the needed configuration over to your project ^^

13:32 *then

13:32 if it might not work on its own there is no use to integrate anything into your existing project, right?

13:33 bufferloss: clgv: well I basically have done that alread

13:33 y and I got the most recent error I pasted above

13:33 I’ll pastebin my project.clj maybe you guys can see what I missed

13:33 clgv: "git checkout ."

13:33 ;)

13:35 bufferloss: clgv: not sure what you mean by that

13:35 dnolen_ clgv https://gist.github.com/anonymous/9711155

13:36 dnolen_: bufferloss: specify [lein-cljsbuild "1.0.2"] and [org.clojure/clojurescript "0.0-2173"]

13:36 bufferloss: k

13:36 dnolen_: clojurescript needs to go in :dependencies

13:37 bufferloss: hey! fuck yeah :)

13:37 thanks

13:37 dnolen_: bufferloss: here I'll fork and make the changes I think you should use

13:38 bufferloss: I got it, it seems to work now

13:38 gonna try out the actual generated JS now

13:39 nice, yeah the js appears to have been invoked as I would expect

13:39 finally! now to actually try learning clojurescript itself

13:39 dnolen_: bufferloss: https://gist.github.com/swannodette/9711228

13:39 bufferloss: faster compile settings (use lein cljsbuild auto), and source maps enabled

13:39 bufferloss: will work best in Chrome/Safari

13:40 bufferloss: eh, will work best in Chrome :P

13:40 FF and Safari are almost the bane of my normal working day existence as IE

13:41 I only use chrome for dev, can’t stand the dev tools in firefox or firebug, and who actually uses safari ;)

13:42 malyn: dnolen_: Does output-to just concat all of the (unoptimized, in this case) js files together? Haven't seen that one before...

13:42 speckle: I 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:43 dnolen_: speckle: ClojureScript has the best compile to JS story I'm aware of as far as Lisps go

13:43 speckle: Ah, so I guess Clojure is a nice Lisp to compile to arbitrary platforms in general, perhaps

13:44 bufferloss: dnolen_: what is the purpose of output-dir ?

13:44 malyn: Oh, wait, I use that all the time. :) I guess I just don't use that and output-dir together.

13:44 dnolen_: 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:44 also critical if you want source maps to work in server setup

13:45 bufferloss: speckle, malyn, also the clojurescript output is compatible with the google closure js compiler

13:45 dnolen_: speckle: well, less that, rahter Java & JavaScript are everywhere so Clojure targets them

13:45 malyn: I'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:46 bufferloss: dnolen_: yeah I’m wondering what’s the purpose of output-dir ?

13:46 dnolen_: malyn: output-to and output-dir make more sense if you use :optimizations :none

13:46 malyn: no single source is produced in this case (i.e. Google Closure Compiler never touches any generated code)

13:47 malyn: dnolen_: 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:47 dnolen_: this enables subsecond recompiles

13:47 malyn: ^^ That is exactly why I am all over this at the moment. :)

13:47 dnolen_: malyn: I only use :optimizations :none for dev, I find anything else tedious

13:48 malyn: Okay, 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:49 Oh, 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:50 dnolen_: 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:50 malyn: I find REPL + fast recompiles to be the most productive

13:50 setup

13:51 malyn: dnolen_: 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:52 Thanks for the info!

13:52 dnolen_: malyn: np

13:58 bufferloss: malyn: I don’t personally mind including js files, when using requirejs it becomes relatively easy and natural to do

13:59 speaking 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:11 jstew: Greetings.

14:12 Is 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:15 I'm thinking about just doing (slurp "test/xxx/test/fixtures/foo.json")

14:26 divyy: you can do exactly that

14:27 lein test runs in your project root, independent from where you execute it

14:38 jstew: divyy: Great, thanks.

14:48 bufferloss: FileNotFoundException Could not locate cljs/clojure__init.class or cljs/clojure.clj on classpath: clojure.lang.RT.load (RT.java:443)

14:48 I get that when running (require '[cljs.clojure :as cljsc])

14:48 from my lein project repl

14:48 (require '[cljs.repl :as repl]) for example seems to work fine, and I can run lein cljsbuild once and that works as expected

14:49 dnolen_: how do you compile from your repl? you were talking about subsecond compile times

14:49 I’m trying to get those sub second compile times

15:07 sdegutis: What'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:07 Specifically, I want to install nrepl.jar on the remote server as well.

15:08 bufferloss: so 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:08 shows up fine when not using output-dir

15:08 dnolen_: ^ any ideas what I might be missing?

15:09 dnolen_: bufferloss: are you using auto building?

15:09 bufferloss: dnolen_: I’m just running lein cljsbuild once

15:10 dnolen_: bufferloss: subsecond compile times are only possible w/ auto

15:10 bufferloss: is that different aside from autorecognizing changes?

15:10 I don’t care about subsecond at the moment, i just want to get the build to work with output-dir

15:10 I’ll worry about subsecond in a moment

15:10 cuz, if I can’t get the build to even run, then subsecond build times are a moot point

15:11 s/run/give me the expected output aka “work”/

15:11 dnolen_: bufferloss: sorry I'm a bit busy with something else at the moment, ask in #clojurescript or ask on the ClojureScript ML

15:18 daddy: whois gignosko

15:18 exit

15:19 seangrove: ~quit

15:19 clojurebot: seangrove: We'll never let you leave.

15:19 daddy: quit

15:19 seangrove: Wish quit and exit could be triggered without the tilde

15:19 daddy: hate being a newbie. Grrr.

15:19 seangrove: Heh, no worries

15:19 /quit

15:19 That'll do it

15:19 daddy: thanks

15:19 seangrove: ~exit

15:19 clojurebot: Gabh mo leithscéal?

15:20 seangrove: clojurebot: exit is There is no exit

15:20 clojurebot: 'Sea, mhuise.

15:20 seangrove: ~exit

15:20 clojurebot: exit is There is no exit

15:24 bufferloss: ergh, 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:24 is there some kind of leinengen cache or something that I need to clear?

15:25 Rosnec: maybe `lein clean` will do it?

15:25 dbasch: where does Friend store the authentication data for the session?

15:25 Rosnec: not totally sure what clean does, but I try it whenever something like that happens

15:26 bufferloss: Rosnec: nope, nothing has changed

15:27 Rosnec: bufferloss: figures. I think clean might just be for cleaning up unused dependencies

15:27 bufferloss: wtf, 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:27 now after adding and removing output-dir, modern.js refuses to compile as it did before

15:27 it insists on compiling as if output-dir were still there

15:30 this is a fucking horrible user experience for anyone new to clojurescript, I’m sorry

15:30 but it’s the truth

15:34 cmdrdats: I 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:34 because of the #db.id[…]

15:37 I have : (binding [clojure.tools.reader/*read-eval* true] (Util/readAll (io/reader f)))

15:39 nevermind - I had a db.id instead of db/id

15:44 bufferloss: dnolen_: 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:44 and I do have a <script> tag that includes the generated goog/base.js

15:45 and immediately after that I have a script tag that includes the main file, modern.js

15:45 without touching my html, this works fine as long as I do not make use of output-dir, otherwise simply “nothing happens"

15:46 this is without changing the actual .cljs file itself at all, and without changing the html at all

15:46 so I don’t get it, what am I missing, I don’t get any errors in chrome console

15:46 I only have a single .cljs file rightn ow

15:58 noonian: bufferloss: 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:58 bufferloss: noonian: it is already, actually I figured it out finally

15:59 there really should be a good tutorial written on how to just jump in to integrating clojurescript into an existing project

16:00 noonian: yeah, 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:24 s0x_: 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:32 rovar: what's a good way to make sure that a hash-map only contains a list of keys that I specify and no others?

16:32 divyy: naive: you could check if every item of the list is in the map and compare the sizes of the list and the map

16:33 is at least O(n), so not soo bad

16:33 rovar: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/select-keys

16:33 man they thought of everything

16:57 gfredericks: zipmap is a pretty weird function

16:58 my guess is for 96% of its uses there is a conceptually simpler way of creating the map

16:59 jcromartie: zipmap seems pretty nice to me

16:59 ,(let [m {:x 1 :y 2}] (zipmap (keys m) (map inc (vals m))))

16:59 clojurebot: {:x 2, :y 3}

16:59 jcromartie: seems quite concise

17:00 gfredericks: sure, but conceptually what you're doing is really weird

17:00 you 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:00 the two sequences are highly entangled

17:01 (into {} (for [[k v] m] [k (inc v)])) avoids that weird situation entirely

17:01 (but is gross to read)

17:01 jcromartie: it's not that rare to have a pair of sequences like that.

17:02 hm, yeah I like that into/for approach

17:02 Bronsa: or you could use reduce-kv

17:02 gfredericks: but I think you only end up having sequences like that because you used to have pairs and you split them apart

17:03 Bronsa: in reality I use plumbing.core/map-vals

17:03 I was just realizing how little use I had for zipmap

17:08 amalloy: gfredericks: zipmap is okay for like...csv files. (map (partial zipmap [:name :age]) (read-csv-rows))

17:08 gfredericks: amalloy: yeah that's a good one

17:09 (defn zipmap "A function for making maps out of CSV rows." [ks vs] ...)

17:10 speaking of which is it a bad thing that data.csv doesn't do this for you?

17:13 amalloy: gfredericks: i think it would be pretty silly to put in data.csv

17:14 like, 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:15 and given that exists, do you really need data.csv to include its own version of zipmap?

17:16 eraserhd: In 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:17 dnolen_: eraserhd: just a convention I adopted for goals that are not really relational

17:18 eraserhd: dnolen_: Oh. I thought there were g's in the Reasoned Schemer.

17:18 That makes sense.

17:29 gfredericks: amalloy: 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:43 seangrove: Oh 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:44 whodidthis: is there a function that returns {:cool cool :yay yay} from cool yay

17:45 seangrove: ,(let [s ['cool 'yay]] (zipmap (map keyword s) s))

17:46 clojurebot: {:yay yay, :cool cool}

18:08 dnolen_: seangrove: ping

18:38 seangrove: dnolen_: What's up?

19:31 eraserhd: I'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:37 amalloy: eraserhd: 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:38 ntho can be relational, of course

19:43 eraserhd: Oh, because of goals as arguments. Right.

19:44 _eric: what would be the simplest way to turn an array of arrays into a map?

19:44 for instance ((host nil) (service "ser")) into {host nil, service "ser"}

19:44 I came up with (apply hash-map (flatten (map rest my-list)))

19:44 but that seemed overly complicated

19:45 noonian: ,(into {} [[:one 1] [:two 2]])

19:45 clojurebot: {:one 1, :two 2}

19:45 _eric: hah

19:45 amalloy: 1flatten

19:45 ~flatten

19:45 clojurebot: flatten 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 _eric: hmmmmm

19:46 I get a strange error:

19:46 ClassCastException clojure.lang.Symbol cannot be cast to java.util.Map$Entry

19:46 amalloy: _eric: into is usually right, but note that it requires vectors, not lists

19:46 noonian: if you have (

19:46 _eric: ah

19:47 noonian: hmm, it really requires vectors?

19:48 amalloy: well, for putting things into a map

19:48 &(into {} '[(a 1)])

19:48 lazybot: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry

19:48 amalloy: &(into {} '[[a 1]])

19:48 lazybot: ⇒ {a 1}

19:48 noonian: just the pair has to be a vector

19:49 ,(into {} (list [1 2] [3 4]))

19:49 clojurebot: {1 2, 3 4}

19:49 noonian: ,(into {} (list (list 1 2) (list 3 4)))

19:49 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>

19:51 _eric: so I guess I just need to call vec on the things?

19:54 amalloy: right, (into {} (map vec things)) probably

19:56 _eric: sweet

19:59 amalloy: and of course there are a multitude of silly ways to do it: (reduce (partial apply assoc) {} things)

20:02 noonian: but if you have a lazy seq from mapping a fn onto it you can just use mapv to keep things concise

20:16 _eric: is there a simpler way to say this?

20:16 (if (and (contains? eq-map 'host) (contains? eq-map 'service))

20:17 I'm trying to ensure that both keys exist in the map before I get the values out

20:17 (because I need to distinguish between a key not being there and a value being nil

20:22 amalloy: (every? #(contains? eq-map %) '(host service))

20:23 _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 _eric: ah! thanks for the (every?) trick

20:40 noprompt: Raynes: gah, just discovered lein-pdo

21:11 kras: When 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:13 amalloy: i doubt it. antlr probably parses all at once

21:17 kras: Thinking about my question ... I guess its not possible to give out a lazy-seq when you have already parsed the whole file

21:24 _eric: if I reify an interface, can I call one implemented method from another?

21:25 amalloy: of course. when you reify, you get a java object like any other

21:25 (reify IFooBar (foo [this] (.bar this)) (bar [this] 1))

21:25 _eric: ah, of course

21:25 thanks

21:26 that was obvious but I didn't think about it that way

22:31 akurilin: Random comment: just wanted to thank whoever came up with partition, being able to specify partition size and step is brilliant.

22:31 wow such leverage

22:32 Rosnec: yeah, partition is pretty brilliant

22:46 eraserhd: In 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:48 Without 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:50 Can I translate a relation with multiple results to a relation with one list result?

23:03 gfredericks: brehaut 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:11 john2x: how 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:11 noprompt: john2x: you shouldn't be using noir.

23:12 john2x: you should just use compojure. noir's been deprecated for a long time.

23:12 john2x: but if you *want* to use it, test it with ring.mock

23:15 john2x: noprompt: i mean lib-noir, from luminus

23:16 i think it's still maintained by yogthos

23:16 eraserhd: gfredericks: I may be modelling the problem in a way that core.logic doesn't like. But not _wrong_ :D

23:16 noprompt: john2x: ring-mock should be able to help you.

23:17 john2x: ah right, ring.mock.. hmm not as simple as I thought it would be. thanks!

23:31 gfredericks: eraserhd: wrong relative to relational programming I meant

23:40 blake: Anyone here able to help me connect to sqlite3? I keep getting "missing required paramter".

23:42 devn: ah, airplanes

23:43 en route to clojure/west -- got lucky with a new 737 that has a power adapter and usb plug per seat

23:43 it still has that "new plane" smell

23:52 dsrx: wow, usb plug?

Logging service provided by n01se.net