#clojure logs

2013-04-28

00:08andyfingerhutI'm trying to create a Leiningen project.clj for a Clojure contrib library (data.priority-map), and not having much luck finding the right combination of options necessary to get "lein test" to work. Anyone know what might be needed besides :source-paths and :test-paths (assuming those are needed).
00:09andyfingerhutUgh. Never mind.
00:09andyfingerhut:dependencies is the answer. Shame.
00:12technomancydanneu: check stdout?
00:12technomancyandyfingerhut: do I smell a policy change in the works?
00:13andyfingerhutFrom me? No, I just want something to do experiments with different local versions of Clojure without having to learn how to edit pom.xml files.
00:13technomancygotcha
00:14andyfingerhutSeveral contrib libs already do have pom.xml and project.clj files. Maybe 3 out of 20 or so.
00:14andyfingerhutpom.xml for official releases, and project.clj created by the developer for their own use.
00:17technomancythe original reason for the mvn-only policy was because lein couldn't deploy to remote repos at the time, right?
00:17technomancywhich hasn't been true since early 2011?
00:18andyfingerhutI'm sorry to say I don't know the answer or history there.
00:20tomojmight it make sense to define a multi-tie, which is like a (reduce #(nom/tie %2 %1) body noms), but which unifies regardless of the order in which the noms are tied? i.e., in the alphakanren notation, (== (multi-tie as m) (multi-tie bs n)) iff there is a bijection between the noms as and bs such that (susp bijection m) unifies with n and (# b m) for all b in bs?
00:27dnolentomoj: yep, multi-tie would be nice
00:33dnolentomoj: actually reading more closely I don't know about that. Definitely want a tie that can bind more than one nom. What is the use case for what you're describing?
00:33tomojI'm thinking about first-order logic formulas
00:34tomojand terms
00:35tomojso maybe.. (nom/tie a (nom/tie b `(= (+ ~a ~b) (+ ~b ~a))))
00:36dnolentomoj: I need parse that some more - still, shouldn't be hard to try it out if you're willing to dig into nominal.clj
00:36dnolennominal.clj is a gentler introduction to the constraint stuff than FD, less stuff less fancy.
01:00tomoja tricky thing is that suspc requires swap to be ground
01:03dobry-denafter half a day of trying to figure out why my program only runs at 65% cpu on 8 linode cores, i learned about jvm arguments…..
01:03dobry-deni punched my couch pillows so hard when i found that out 30 min ago
01:04dobry-den-Xms512m worked
01:21rbarraudseen slava
02:23sorenmacbethanybody know how I'd do a cancellable pmap? i.e., a pmap where if any of the futures throws an exception, all the others are cancelled immediately?
02:24sorenmacbethI can't use (shutdown-agents) because I have other long running futures that I don't want to cancel
02:24sorenmacbethI only want to cancel futures launched by the pmap
02:26sorenmacbethuse case is I'm downloading a bunch of files in parallel, if any one of them fails, I want to immediately stop downloading the others, clean up and try again
03:33abphttp://euroclojure.com/ :)
03:34lynaghk`sorenmacbeth: I tried using pmap for some parallel download stuff and ended up just using java.concurrent.exeuctors directly, which were nice and explicit
03:41abplynaghk: I'd love seeing all that stuff done with some native Clojure message queues and a uniform configurable execution backend.
03:47ucblynaghk, abp: this is a modification to futures to use custom executors; this might be a good start https://gist.github.com/guv/5445115
03:49ucblynaghk, abp: there's also knit: https://github.com/mpenet/knit
03:50skavezHello, I'm trying to apply a list of functions to a string and have the string modified sequentially. I'm a newb, but I figured reduce would work in this case, but it doesn't. Is there something I'm missing? Code: http://pastebin.com/9ZX4cp0t
03:51ucbskavez: you could try (-> "my string" (transform-1) (transform-2) ...)
03:51ucb,(doc ->)
03:51clojurebot"([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."
03:54skavezucb: Thanks, I would've never found that! Is there a way to pass a vector in for the forms, instead of listing them all out?
03:54ucbskavez: don't know but I wouldn't think so
03:57skavezucb: Ah, thanks. The reason I'm trying to feed a vector of functions in is users will probably specify which text transformations they want to apply, so I won't know ahead of time.
03:57andyfingerhutskavez: Each function in your vector takes a single string as its only argument, and returns a string? You should be able to use reduce in that case.
03:58ucbyeah, that too
03:59skavezandyfingerhut: Exactly. This is what I tried, but there must be some brain fart here: http://pastebin.com/9ZX4cp0t
04:01sorenmacbethlynaghk, abp, ucb: cheers, I'll look into those.
04:02andyfingerhutskavez: Use "(fn [str f]" instead of "(fn [f str]"
04:06stytsis anyone using vim for clojure development?
04:12skavezucb / andyfingerhut: D'oh! I forgot the accumulator went first. Thanks!
04:23dobry-den((comp lower-case trim) "FOO\n")
04:27callenstyts: absolutely no one is doing that.
04:27callenstyts: it's totally unheard of and I'm gobsmacked you came up with that combo.
04:28callenstyts: what's next? peanut butter and jelly on the same sandwich?
04:28callenfucking madness.
04:30stytscallen: well, i've found out about vim-fireplace and am trying to get used to the workflow.
04:36dobry-denI ended up installing Emacs and Evil-Mode
04:40Raynesstyts: I do.
04:40RaynesOr Emacs.
04:40RaynesI use both.
04:40RaynesIt depends on which day.
04:41RaynesI'm ambideditorous.
04:41stytsso you write code in the editor and send it to the repl, right?
04:43degI'm trying to deploy my first CLJS app, and am getting a bit lost in all the possibilities.
04:44degFirst question, before I launch into details: Is Heroku a good way to go for a small app, where I want to keep costs at or near free?
04:49borkdudein compojure, if I use (context "/api" [] api-routes), what if one of the api-routes expects arguments?
04:49borkdudederived from https://github.com/weavejester/compojure/wiki/Nesting-routes
04:52borkdudeI guess better not use context in this case
04:59callendeg: not if it needs to be reliable.
05:00degAt this stage, reliable is not really important... it's for personal use and for learning the tools.
05:00callenthen it's fine but deploying clojure apps is hardly difficult
05:00callenI wrote scripts using gantry for it in like 30m
05:00degBut, if something else is more reliable and still free, I'm certainly not wed to Heroku. How unreliable is it?
05:01callenat the free tier for clojure apps, pretty damn reliable
05:01callen66% uptime
05:01degI've got the basic deployment working, but it is complaining about using too much memory. (Typically 500-600MB -- not much over their baseline limit, but still surprising).
05:01callenunreliable*
05:02callenI...didn't have any memory issues.
05:02callenwtf are you doing?
05:02callenare you fucking with the JVM heap settings?
05:02degNo, not that I know of.
05:02degMy best guess is that I'm launching int the wrong way, or have extra crap in my project.clj.
05:02callendeg: this is on heroku?
05:03degyes.
05:03callendeg: you followed their instructions for the buildpack?
05:03callendeg: it's a standard clojure/ring/jetty app?
05:04degIt's a compojure app, modeled on the tutorial at. ... (one sec)
05:04deghttps://github.com/magomimmo/modern-cljs/
05:04degI see that most of the Heroku samples launch by having an explicit -main function
05:04callen"modern" CLJS?
05:05callenshit hasn't even had a mature cycle yet, let alone the ability to have a modern setup.
05:05deg:-) I don't name 'em, I just use 'em.
05:05callendeg: first off, fuck cljsbuild
05:06degBut, copying the tuturial, I launch with lein ring server-headless
05:07degUmm, I feel your emotional pain. ( :-) ) but don't understand the problem.
05:07callenoh right, shoreleave.
05:07callendeg: are you using trampoline?
05:07degNo. I tried, but it didn't seem to work.
05:08degAnd, I wasn't seeing enough feedback in the Heroku logs to understand why not.
05:08callendeg: so try it locally?
05:08degMy Procfile is simply 'web: lein ring server-headless'
05:08degOk. So, I should locally try 'lein trampoline ring server-headless'?
05:08callenlein trampoline ring server
05:09callenit doesn't need to be headless.
05:09degI understood that "headless" here meant not to auto-launch a web browser. Oh, are you saying doesn't need to be headless on the local run?
05:11callendeg: just try both, jesus
05:11callendeg: less talk more walk
05:12degHmm, so I tried (locally) lein trampoline ring server. No error in shell, but apparently no server launched either... Browser doesn't connect.
05:12degAre any logs generated anywhere? Nothing useful was on stdout.
05:13degAnd, just verified that lein ring server works fine locally.
05:13callenattempting a repro.
05:13callenworks for me.
05:14degYou tried the magmimmo sample project?
05:15callendeg: no, his project.clj scares me.
05:15callendeg: it looks like the project.clj of somebody with 15 years of syphilis behind them.
05:16callendeg: require lein 2.0.0, see what changes.
05:16degCan you point me to a working sample project that uses Compojure?
05:16callendeg: https://github.com/bitemyapp/neubite/
05:17degThanks. Give me a few minutes to play with it, and I'll come back with success/failure. Thanks,
05:18callendeg: I don't need you to tell me it works, it's running on a 512mb DigitalOcean VPS right now.
05:19degI meant if s/f on finding the differences between your working case and my broken case.
05:22callendeg: yes. do report any conclusions there.
05:24degHeh. That project fails to compile for me with a NPE in mongodb. Something fucked in my env? I'll poke around some more.
05:33callendeg: DA, ENV COMRADE
05:33callendeg: fire up mongodb locally or use mongohq's poverty tier.
05:33callendon't need any fixture data.
05:37degYup... I was in a different window and found I was missing DATABASE_URL in my env.
05:37callenda.
05:38degBut, feels like I'm diving down the rabbit-hole here, if I now need to learn mongdb config, etc.
05:38callenmight want to fake SECRET_KEY too.
05:38callenoh for pete's sake.
05:38callendon't be such a baby.
05:38degI'm going to try to short-cut by just looking for diffs between the two project.clj files.
05:39callendeg: trying using a vanilla Luminus project.
05:39deg(afraid to ask, but) wtf is Luminus?
05:40RaynesOh my. Go people use tabs instead of spaces.
05:41callenRaynes: they're insane.
05:41callendeg: http://www.luminusweb.net/ use it, know it, love it.
05:42degYup, looking at it now, thx.
05:44degBut, before I dive in too deep... Earlier, you suggested that shoreleave was heavy. Is best practice not to use it, and to use the tools in the Luminus stack?
05:46degI'd rather spend my time working in the most-supported stack, rather than trying to debug the stack I happen to be on now. I'm certainly not wed to that tutorial... my goal is just to get this app working.
05:54ddellacostadeg, I've written a tutorial on shoreleave which is more or less my experience trying to understand what it actually does: https://github.com/ddellacosta/barebones-shoreleave
05:55ddellacostato sum up, I don't know if it is ready for prime-time. I don't have any experience with luminus but my rough sense is that it is a bit more comprehensive than shoreleave
05:56ddellacostashore leave is more just about clojurescript <-> web app using compojure interaction
05:56ddellacostashoreleave
05:57ddellacostaif you want "most-supported stack," then I'd say start with composure and understand how that works well. Then learn about using clojurescript in conjunction with that.
06:04sveduboisHow I can translate this JS to CLJS? var FizzyText = function() {this.message = 'dat.gui';};
06:13nilbertn/win10
06:14clojurebotI don't understand.
06:14nilbertsorry, wrong window :)
06:15ddellacostasvedubois: it's hard with a function that has side effects like that, unless I know what else is going on in the code
06:16sveduboisI have taken the code from here http://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage
06:18ddellacostaah, well, don't know concretely but this may help: http://stackoverflow.com/questions/15531261/accessing-this-in-clojurescript
06:37degddellacosta: Thanks. I'm taking a step back now to take a good look at Luminus, and will read your shoreleave link too.
06:37degcallen: Thanks for your help. Looks like I need to regroup, find the right foundation, and get my memory footprint down to something sane.
06:38ddellacostadeg: btw, check this post out too, by the author of luminus, features a "competitor" to shoreleave they wrote called cljs-ajax: http://yogthos.net/blog/43-Introducing+cljs-ajax
06:38degthx
07:01clojure-newHello.
07:02clojure-newI'm trying to use jogl from clojure with help of https://clojars.org/org.clojars.toxi/jogl .
07:02NeedMoreDesuWhy can't I derive class from class?
07:02clojure-newBut i can't import javax.media.opengl.GLCanvas. Can you help me?
07:02clojure-newClassNotFoundException javax.media.opengl.GLCanvas java.net.URLClassLoader$1.run (URLClassLoader.java:366)
07:02clojure-newError ^
07:03NeedMoreDesuclojure-new: http://mavenhub.com/c/javax/media/opengl/glcanvas
07:04clojure-newNeedMoreDesu: What can i do about it?
07:05NeedMoreDesuNot sure if this helps, but try to add dependency to project.clj
07:05NeedMoreDesu[groupId/artifactId "version"]
07:06NeedMoreDesu[com.projectdarkstar.ext.net.java.dev.jogl/jogl "1.1.1"]
07:08clojure-newNeedMoreDesu: Thanks a lot, it solves the prbolem.
07:09clojure-newStrange, does it means actually i need two version of jogl?
07:09clojure-new[org.clojars.toxi/jogl "2.0.0-rc11"] and [com.projectdarkstar.ext.net.java.dev.jogl/jogl "1.1.1"]
07:10NeedMoreDesuNot sure. Maybe, those clojars jogl is some sort of interface?
07:11NeedMoreDesuNever actually use it, so I don't really know.
07:11NeedMoreDesu/s/use/used
07:11clojure-newHeh, just removed that clojars dependecy and everything still works as expected.
07:12jaleyI'm considering core.logic for a problem I'm working on… anyone able to give me a quick sanity check, tell me if I'm completely barking up the wrong tree perhaps?
07:16tomojask?
07:16AimHereThe golden rule of IRC is never to ask 'can anyone help me' or 'does anyone know X', just ask the question and wait for a bit
07:16tomojanyone?
07:16clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
07:17AimHerePeople on IRC are lazy and have short attention spans. Asking them to actively prise out whatever it is you need to know is painful
07:18AimHereOn the other hand, they're often inveterate smartasses, so they'll take pride in giving you some sort of answer if you ask something (or blurt out something they think is completely wrong)
07:20AimHereMost people generally take that as a cue to ask the damn question already
07:20jaleyOK, so I want to do a kind of approximate rectangle packing type of problem, and my concern was that I don't know if core.logic will be able to pick some value fitting a continuous range style constraint?
07:20AimHereHeh, there you go
07:21jaleyI basically want to arrange a bunch of images on a canvas in a way that "looks nice"
07:22jaleyso it doesn't have to be "optimal" in the sense of a classic rectangle fitting problem, but… it's still a hard problem to solve algorithmically. Setting up a bunch of constraints and having core.logic sounds much simpler, if it's achievable...
07:26AimHerejaley, last I looked (which wasn't very recently or very deeply) core.logic needed to ask clojure proper for most things numerical, so I'd think you might have to do something similar here
07:30jaleyAimHere: hmm ok, thanks
07:58stianWould love to get a few eyes on this little piece of code, especially whether I designed the API "idiomatically" http://codereview.stackexchange.com/questions/25575/api-wrapper-for-clojure-idiomatic-style-for-libraries
08:04dobry-denI'm having trouble understand the intersection of some concepts here. Since a Var is a "mutable storage bin", if you put a stateful Java object in one as the root binding, then all threads see and mutate that same object, right?
08:05sveduboisI have a function FizzyText in a js file:
08:05sveduboishttps://lukeletters-datgui-alpha.googlecode.com/git-history/dbb4fa0ef0428380044e825470e788dec1e37b86/docs/demo.js
08:05sveduboisAnd I would like to use it in CLJS.
08:05sveduboisAfter include the js file in the html I have tried with (FizzyText. "hello")
08:05sveduboisI get a TypeError: undefined is not a function.
08:05sveduboisHow I can call FizzyText function win CLJS?
08:10clojure-newHello again.
08:10dobry-denhi
08:11clojure-newI'm trying to port this to clojure http://www.13thmonkey.org/~boris/jgame/JGame/tutorial/Example1.java .
08:11clojure-newhttps://www.refheap.com/paste/14029 And i'm got this far.
08:13clojure-newYellow text gisplays just fine but i need to rotate. In original java code it's done by mutating texttimerr variable(texttimer += 0.05; in doFrame method). How can i do that in clojure?
08:13dobry-denclojure-new: That error is often due to a forward reference in Javascript. It's silly but could that be it?
08:14clojure-newdobry-den: What error?
08:15clojure-newI'm having no errors, i'm just asking advise how to implement las two methods of http://www.13thmonkey.org/~boris/jgame/JGame/tutorial/Example1.java in clojure.
08:16sveduboisI suppose perhaps is js/FizzyText
08:16dobry-denGee, I finally noticed that I meant to type svedubois
08:18dobry-densvedubois: "undefined is not a function" is often due to a foreward reference
08:18sveduboisBut, with (js/FizzyText. "hello") I get an error: #<TypeError: Cannot call method 'appendChild' of null>
08:23dobry-denoh, i've never used cljs but i wouldnt have thought all js interop is done through js/
08:37teromclojure-new: you could use an atom to hold the value, then increment that in your method. Something like (def texttimer (atom 0)) and in the method (swap! texttimer #(+ % 0.05)). To get value of the atom, deref it like this: @texttimer
08:38sveduboisWrapping FizzyTect in a window.onload could solve the problem?
08:41clojure-newterom: Thanks, already solve it with ref. What the difference between atom and ref? Ref is more threadsafe?
08:42clojure-newsolved*
08:43teromclojure-new: http://stackoverflow.com/questions/9132346/clojure-differences-between-ref-var-agent-atom-with-examples
08:43sveduboisWhy (js/FizzyText. "hello") gives a TypeError (Cannot call method 'appendChild' of null)?
08:44clojure-newThanks.
08:48Apage43svedubois: i think that code you have expects to be called with new
08:48Apage43oh, didn't see the .
08:48Apage43nvm
08:49svedubois(new js/FizzyText "hello")
08:49sveduboisTypeError: Cannot call method 'appendChild' of null
08:49Apage43the only .appendChild in the JS you linked expects there to be an element of a specific ID on the page, if it is not there, that would cause the error
08:54clojure-newAwesome. Complete port of http://www.13thmonkey.org/~boris/jgame/JGame/tutorial/Example1.java to clojure https://www.refheap.com/paste/14030 .
08:54clojure-newText is spinning now.
08:54clojure-newAny ideas how to make it more ideomatic?
10:09maaclIs it possible to implement a structure equivalent to a Java ConcurrentHashMap using a clojure atom map? My partial atempt is here https://gist.github.com/maacl/de1bef7207ba0cee375c but not sure it is concurrency safe.
10:27icarotCan anyone explain why both the tree-recursive fibonacci algorithm and typical recursive factorial function have the same space complexity (linear)?
10:29borkdudewhat do people use in more advanced form data processing and validation. I figured: first process (parse to int, etc), then validate on that, else you get duplication of this logic
10:29Glenjaminborkdude: i'm planning on a post on that subject to the mailing list, been mulling it around in my head for a while, and it seems difficult not to complect
10:31borkdudeGlenjamin the way I'm dong it now: in a compojure POST route I send the data through a preprocessing function which does the conversion, then I validate that with noir.validation, if valid, I save the processed data to a db or smth, else I render the form again with the posted data and noir validation errors
10:32Glenjaminsounds about right, i'd be tempted to pass the raw data into the validation too
10:32borkdudeGlenjamin I could merge it with the parsed input, so validations could be made on those also
10:33Glenjaminmm, could work
10:33Glenjaminyou could even make it a three-pass validation
10:33Glenjaminraw-validation, parse-types, parsed-validation
10:34borkdudeGlenjamin yes, could also work
10:34abphttps://github.com/jkk/formative
10:34Glenjaminwhen you convert to types, you'll often want to return nil when you can't convert - but then it's tricky to give nice validation error messages off that
10:35borkdudeGlenjamin or pass two maps to the validation function: raw and processed
10:35borkdudeabp looks interesting, will look into it
10:38borkdudeabp how does this library know to what type to parse a field
10:38abpborkdude: by specification
10:38abpborkdude: :datatype on fields I think
10:38borkdudeabp ok
10:39Glenjaminthis looks like just what i was after
11:29bttfi've got a db.clj in my web app that has a var assigned to a select statement to the local db. when i :require this file in my application.clj and use the var, it does not update when the db has changed .. how can i make this behave so that it essenstially runs a select statement each time ?
11:32n_bbttf: Make it a function.
11:36bttfwhen i do that, it breaks the for loop that its used in .. i changed it to (for [x (myapp.db/all-posts)] ... )
11:37bttfdo i need to prepend the ' to pass in a list rather than result of execution
11:41n_bbttf: Can you provide a paste of the code? http://refheap.com
11:41n_band assuming it returns a seq, that for should work fine.
11:43bttfit returns a vector of maps
11:43bttfa sequence is a list, no ?
11:44tcrayfordno
11:44tcrayfordit has a list like interface (first/rest), but it isn't neccesarily constructed by cons cells
11:45n_bA Seq is anything with the ISeq interface
11:45bttfi see
11:45bttfgetting pastes up
11:48n_b,(= (seq '( 1 2 3)) (seq (vector 1 2 3)))
11:48clojurebottrue
11:49bttfhttps://gist.github.com/bttf/b76860cf70b4c1cb298f
11:49bttfline 14 in application.clj
11:49n_bAh, don't quote it.
11:50bttfright, i just did that. without it, it breaks
11:50n_bCan you expound on "it breaks"?
11:50bttfsure
11:50bttfi have lein ring running in the background
11:50bttfwhen i refresh the page, it gives me an error ...
11:50n_boh
11:51bttfclojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector, compiling:(application.clj:15:3)
11:51n_ball updates should be a function as well
11:51n_bUnless you don't expect it to change.
11:52bttfoh right
11:52bttfok
11:54sveduboisCan I write these 2 lines in only one without repeating map and models?
11:54svedubois(map #(aset obj % true) models)
11:54svedubois(map #(.add gui obj %) models)
11:55n_bsvedubois: You can probably use comp
11:55bttfn_b: i guess i just dont understand the difference between referencing a var and calling a function. it works fine with a var, but when i turn it to a function it complains
11:56n_bDid you change line 39 to be (-> (all-updates) ?
11:56bttfyup
11:59n_bsvedubois: Or do (map (. add gui obj (aset obj % true)) models)
11:59bttfi am still seeing the same error ... could it be with the for loop vector not receiving correct expressions
12:00n_bYou're trying to call a vector as a function somewhere
12:01n_bTry just rebooting the lein server or reloading the namespace
12:01bttfok now it's working ... in db.clj, i changed line 13 into (into [] (select posts))
12:01bttfwhich ... gives me the same exact output in the repl god dammit
12:02bttf(select posts) and (into [] (select posts))
12:03n_bI'm not familiar with korma, but that sounds like the REPL was forcing it to be realised while your handler wasn't, but I really don't know enough to do more than speculate
12:04bttfforcing it to be realized?
12:04n_bWhat's the value of (type (select posts))?
12:05bttfclojure.lang.PersistentVector
12:07n_bHmm; I'm really not sure and don't want to give you wrong information. I'd ask a little later when someone more knowledgeable is around
12:07bttfalright thank you for your help
12:08n_b:) Sorry I couldn't give you a more complete answer
12:09svedubois(map (. add gui obj (aset obj % true)) models)
12:09sveduboisgives and error because (aset obj % true) returns always true and not the name of each model
12:09n_bThe objects in models are being mutated, right?
12:11n_b (for [model models]
12:11n_b (do
12:11n_b (aset obj model true)
12:11n_b (.add gui obj model)
12:11n_b model))
12:13n_bI think ^ that should work and return you the objects you want
12:16sveduboisI think this is one solution: (map (juxt #(aset obj % true) #(.add gui obj %) ) models)
12:16sveduboisAt least it works
12:17n_bAh, yes. juxt will do it but I'd argue it's not very idiomatic, since you're causing side-effects
12:20noidi(doseq [model models] (aset obj model true) (.add gui obj model))
12:21noidi,(doc doseq)
12:21clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
12:42yacini only see the last line of a stacktrace on an error with nrepl in emacs. any idea on how to access the full trace?
12:43TimMcnDuff: I just saw an article in the New York Times that referred to pastebin as a "web forum for hackers" :-P
12:44TimMc(pastebin.com, although they just called it PasteBin)
12:45tcrayfordyacin: (.printStackTrace *e) in the repl
12:46tcrayford(pst *e) works as well
13:04clojure-newHello, it there a way to get rid of "this" in proxies?
13:04clojure-newTo make it implicit somehow i guess.
13:05clojure-newis there*
13:09clojure-newAnother question, how can i access this.foo from clojure proxy?
13:09clojure-newSay foo is a variable.
13:12TimMcA variable? Surely you mean a member field.
13:12clojure-newYes, member field.
13:13clojure-newTimMc: ^
14:44satch5150hi all, I included clj-crypto 0.0.4 in the project.clj of my lein project; leiningen downloaded the dependencies, but I do not know how to specify the namespace in the core.clj file in the ns macro
14:45satch5150I Know the syntax of :use or :require, but not what how to specify the namespace of clj-crypto
14:45satch5150the dependency statement in the project file is just [clj-crypto "0.0.4"]
14:45satch5150anyone help ?
14:52antares_satch5150: it should be in the project docs. If there are no docs, file an issue about it and take a look at the source. There is no other way to know.
14:56mthvedtdesign pattern question: you have a record type, and you have some common operation on the record you want to memoize, but want everything to be able to be GCed also
14:57mthvedtif you didn't want a record, you could just reify closing over the pre-calculated results, but what if you want arecord?
15:07mthvedti guess i want something like defrecord, but with reify-like lexical closures
15:12gfredericksI'm thinking of generalizing this vcr-clj library to do arbitrary I/O functions instead of just http
15:15ghengisis there a good profiling library, something that can be used like 'time' but more featureful?
15:20xeqighengis: criterium?
15:20xeqihttps://github.com/hugoduncan/criterium, more benchmarking then profiling
15:21ghengisyeah, i meant benchmarking : /
15:21ghengiscool, "statistical processing of multiple evaluations" that's what i need
15:21ghengisthanks :)
15:44n_bIs there any way to tell what could be holding onto the head of a sequence?
15:45gfredericksnot easily; sneakiest cases are closures, and closures hidden by macros in particular
15:47n_bThis is what I'm doing, so I don't think it's quite so complex as that: https://gist.github.com/9a387004e26d4b4505a3
15:48n_bWould it be the way I've built the pages+title seq up? I would've thought doseq would drop the head
15:54Morgawrhello, let's say I have two vectors of [x y z] and [x y k] and I want to use a function to return only the elements of the first vector that don't appear in the second vector (not vice-versa), so in this case I'd want [k]
15:55Morgawrhow can I do that? is there some quick one-liner?
15:55Morgawrkeep in mind that order might be different and the elements are uniques (I can use a set too)
15:55gfredericks(remove (set second-vector) first-vector)
15:55gfredericksyou could use filterv with complement if you need a vector back
15:56Morgawrgfredericks: thanks!
15:56Morgawrthat's perfet
15:56Morgawrperfect*
15:58gfredericksthere's a nil/false edge-case there you should be aware
16:07akhudekthere is nothing worse than getting a completely unhelpful stack trace error from lein :-(
16:09akhudekseems that it's coming from extract-native-deps
16:10ryan5What's a good way to startup and run http-kit on a production server? I had been runnning my webapp on jetty6, which "just runs" as a service after I 'sudo apt-get install' it. But now, I want to use http-kit instead. However I didn't see how to run http-kit as a service. Any suggestions?
16:16mpenetryan5: an uberjar+upstart (or whatever init deamon you use)
16:22ryan5ok.thank you mpenet... I just searched on those terms and found lein-init-script.
16:26amalloyn_b: nothing sneaky at all: you've defined 'dump as a var, so it is permanently reachable: no piece of it can ever be collected. same with all your other defs
16:28n_bamalloy: You are, once again, the spotlight illuminating my dumb mistakes. Thanks
16:29n_bI even remember reading about avoiding this exact pitfall in Clojure Programming >>
16:30tgoossenswhat was the fn called that could take an arbitrary amount of arguments and always return the same?
16:30gfredericksclojurebot: amalloy is the spotlight illuminating my dumb mistakes
16:30clojurebotAck. Ack.
16:31gfrederickstgoossens: constantly
16:31amalloy&(doc constantly)
16:31lazybot⇒ "([x]); Returns a function that takes any number of arguments and returns x."
16:31tgoossensyes that was it!
16:31tgoossensthanks
16:31n_bclojurebot does quotes now?
16:31gfrederickshas he ever not??
16:31lazybotgfredericks: Uh, no. Why would you even ask?
16:31n_bI'll have to be more literary in my phrasing from now on
16:32gfredericksclojurebot: amalloy?
16:32clojurebotamalloy is the spotlight illuminating my dumb mistakes
16:36n_bI'll consider that my contribution to the clj community for the week :P
16:50arohner{:post []} can break (recur)?!?
16:51gfredericks,(macroexpand-1 '(fn [x] {:post []} (recur x)))
16:51clojurebot(fn* ([x] (clojure.core/let [% (recur x)] %)))
16:52gfredericks,(fn [x] {:post []} (recur x))
16:52clojurebot#<CompilerException java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(NO_SOURCE_PATH:0:0)>
16:53amalloyhah
16:53Bronsauh
16:55amalloyarohner: write a better wrap-postconditions macro that expands to (fn [x] (let [% (f x)] (check %) %))
16:56mnemnionI'm trying to write a macro that does this (def-with-quoted-symbol 'symbol function-name)
16:56mnemnionthat expands to (def symbol function-name)
16:57mnemnionunquoting is tripping me up here
16:58mnemnionthe idea is that I can have a map like so { 'symbol1 function-1 , 'symbol2 function-2 }
16:58mnemnionthen feed it to my macro one key-value pair at a time and get a bunch of redefinitions
16:58mnemnionstoring the unquoted symbol doesn't work because the symbol doesn't resolve to anything prior to definition
17:07gfredericksmnemnion: maybe you should describe your higher use case
17:08gfredericksbased on scanning your question you might have a misconception or two about macros
17:09mnemnionit's quite possible. There's definitely a gap in my understanding of quoted symbols and their resolution
17:10mnemnionso here's what I'm trying to do. I'd like to make a map like so { symbol1 function1 symbol2 function2 } etc
17:10mnemnionso that I could seq it and repeatedly call (def symbol1 function1) on the key-value pairs.
17:11mnemnionobviously, the symbols aren't defined when I want to make the map, so I get a fail. I can make a map like so: {'symbol1 function1 'symbol2 function2}
17:12mnemnionbut this, for example, does not work: (def ~'symbol function)
17:12mthvedtmnemnion: what is the error
17:13mnemnion"First argument to def must be a Symbol"
17:13mnemnionalso get that for (def 'symbol function)
17:13mnemnionthat, I wouldn't expect to work, since the symbol is quoted
17:14mnemnionbut why (def ~'symbol function) doesn't unquote the symbol, that, I do not understand
17:14mnemnionI feel like it should be equivalent to (def symbol function) but it is not.
17:14mthvedtmnemnion: if you write {'foo bar}, you get a map containing {foo bar}
17:14mthvedt'foo returns the symbol foo
17:17arohneris there a clojure library anywhere that "properly" indents a clojure form?
17:17sw2wolf,(sqrt 1000000)
17:18clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sqrt in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:18arohneri.e. I've (read) a file and munged it, now I want to spit it out again, either 1) preserving original whitespace or 2) dumping "proper" whitespace
17:18mnemnionhmm yes, that's the case, but...
17:18Apage43mnemnion: that just passes def the literal form (clojure.core/unquote (quote foo))
17:19sw2wolf,(Math/sqrt 1000000)
17:19clojurebot1000.0
17:19xeqiarohner: clojure.pprint/pprint ?
17:19arohnerxeqi: pprint doesn't indent code
17:19mnemnion(def my-map {'foo "ignore-me"}) gives the expected key-value pair {foo ignore-me}
17:19Apage43as def is not a fn but a special form, and behaves similarly to a macro in that it takes its arguments as read, and they aren't evaled first
17:20amalloyarohner: pprint has a code-indenting mode
17:20mnemnionsomething like (first (seq (keys my-map))) does return foo in the repl
17:20amalloyclojure.pprint/code-dispatch or something
17:20mnemnionbut (def (first (seq (keys my-map))) println) complains 'first argument to def must be a symbol'
17:21mthvedttry `(def ~(first blah blah) println)
17:21mnemnionApage43: appreciated, that helps me understand why it doesn't work for sure
17:21arohneramalloy: aha, thanks
17:22Apage43mthvedt: and then you have to eval that if you want to really do that
17:22mnemnionmthvedt: that works, thanks. I'm somewhat mystified as to why.
17:22Apage43you can (eval `(def ~(first seq keys my-map) …))
17:23Apage43er
17:23mnemnionIs that really the minimum number of steps required to do this?
17:23Apage43with the proper parens
17:23mnemniongotcha
17:23mthvedtmnemnion: when you call def, you give it a symbol literal which it doesn't evaluate, and (first (seq (keys my-map))) is not a symbol
17:23Apage43mnemnion: if you want to pass the result of some evaluation as the first arg of def I think you need eval
17:23mthvedtit returns a symbol, but it isn't one
17:24mnemnionright, because I'm inside a macro.
17:24mnemnionI think that's the big thing I was missing. Thanks all.
17:35mnemnion...pity you can't map def, huh
17:36arrdemmnemnion: you can't?
17:36mnemnioni can wrap it, no big
17:36gfredericksmnemnion: metaprogramming with def isn't done very often
17:36micahmartinIs there an idiomatic way to check if the current runtime is Clojure or ClojureScript?
17:36mnemnionyeah, this is a special circumstance.
17:36hfaafbhttps://github.com/functional-koans/clojure-koans/blob/master/src/koans/10_lazy_sequences.clj#L25 can anyone help me complete the last koan on this page? I'm not sure what function it is expecting.
17:37gfredericksmnemnion: also anything you can do with def you can do with the namespace API
17:37gfrederickswithout macros
17:38gfredericksmicahmartin: are you using cljsbuild crossovers?
17:38micahmartinno
17:39gfrederickssome homespun version of that?
17:40gfredericks,(= "0.75" (/ 3 4)) ;; that should work :)
17:40clojurebotfalse
17:40micahmartinkinda… just copied code and changed extensions for now… still a work in progress
17:40gfrederickswell (str (/ 3 4)) rather
17:40micahmartinok… yeah… that'll work
17:40gfredericksI know this sort of problem is on the horizon, maybe for the next version of clj. don't know for sure though.
17:41gfredericksbut checkout cljsbuild's crossovers if you're not familiar with them
17:41gfrederickswell unless you don't plan to keep a single source file
17:42micahmartinwas hoping for something like Ruby's RUBY_PLATFORM
17:42micahmartinI'm familiar with cljsbuilds crossover.. might use it soon here.
17:42gfredericks(def RUBY_PLATFORM (if (= "0.75" (str (/ 3 4))) :js :jvm))
17:42mnemnionthe final version is actually simple and elegant
17:42mnemnion(defn def-deref [x y]
17:42mnemnion (eval `(def ~x ~y)))
17:43mnemnionthanks again
17:43micahmartingfredericks: right… whether or not that's idiomatic….
17:44gfredericksmicahmartin: I don't follow cljs too closely, but I think folk are mostly waiting for a designed approach from on high
19:03howdynihaoso i really like catnip
19:06howdynihaoit would be nice if clojars.com had some sort of popularity indicator
19:07howdynihao.org*
19:30brehauthowdynihao: clojuresphere is useful for popularity
19:58capcrunchis there a clojure library that implements matrix operations ?
19:59akhudekcore matrix
19:59akhudekhttps://github.com/mikera/matrix-api
19:59seanholmhttps://github.com/mikera/matrix-api
19:59seanholmsnap
20:39gfredericksbrehaut: probably only useful for popularity of libraries, eh? not user-level plugins?
20:39brehautgfredericks: probably true
21:09dnolenspectral_norm.cljs went from >4000KLOC pretty-printed advanced
21:09dnolen copmiled to ~1000KLOC with changes in master
21:09dnolennot sure if we can compile (js/print "hello wolrd") -> print("hello world");, but there's a lot more still we can do to improve.
21:15wmealingi'm wondering if someone could assist me in setting up midje lazytest
21:15wmealingi get a backtrace like https://gist.github.com/wmealing/655c75b72f7af0d93e04
21:15wmealingor..
21:15wmealing(just a second)
21:16wmealinghttps://gist.github.com/wmealing/bc5e33e4c4b7f33447a4
21:17xeqihowdynihao: it has a download count, but we left the popularity meter to things like clojuresphere. it needs a significant ux upgrade, so maybe I should put that in my notes to make clear
21:17wmealinghttps://gist.github.com/gists <— my ~/.lein/profiles.clj..
21:21amalloydnolen: 4000KLOC? do you really mean over four million lines of code?
21:39dnolenamalloy: oops hehe
21:57arohnerwhy does clojure.tools.reader.edn/read parse #uuid and #inst?
21:57arohnerI thought edn wasn't supposed to deal with data literals
21:58arohnerah, they're in the edn spec
21:59tomojthat's what the 'e' is for
22:02arohnertomoj: yes, but a bunch of people were worried about code execution through clojure.core/read, so then tools.reader.edn was added, to be safe
22:02arohnerso I was surprised to see it instantiating other classes
22:05gfredericksarohner: they were mostly worried about read-eval
22:05gfrederickswhich is _not_ in the edn spec
22:07micahmartinHow do you write one try/catch clause that catches everything in both Clojure and ClojureScript?
22:07arohnerAFAICR, Ruby has had it's share of remote code execution through unexpected class instantiation as well
22:07micahmartinHave done lots of research and although there doesn't seem to be a way, I'm not satisfied with that reality.
22:08gfredericksmicahmartin: I'll be surprised if you come up with something. I can't imagine that anything in clj-jvm besides (catch Throwable ...) does what you want, and I can't imagine that meaning anything in cljs
22:09xeqiI haven't see any holes in the default data readers
22:09micahmartinit doesn't compile in cljs
22:09xeqi* haven't seen
22:09gfredericksarohner: yeah class instantiation is an issue with the clojure reader too I think. But presumably not with the edn reader.
22:17arohnergfredericks: aha, missed that you can pass in data-readers, and it only includes #inst and #uuid by default
22:17arohnerwhich are presumably safe
22:24gfredericks"Presumably Safe: an optimist's lament"
23:41dnolenspectral_norm.cljs is now produces ~250 lines of code under advanced compilation
23:41dnolenhello world generates 170 lines of pretty-printed code
23:51akhudekwow, impressive
23:54dnolenakhudek: it's been a learning experience, I understand a lot better what can be eliminated by Closure and what patterns prevent it.
23:56tomojwow, 170 lines sounds so small
23:56dnolentomoj: yeah, most of that is goog utility fns
23:57dnolentomoj: the rest is extend-type on JS natives which Closure can't optimize, I might remove that stuff.