#clojure logs

2012-10-03

00:00casion"IllegalArgumentException No matching field found: getInputStream for class java.util.zip.ZipFile "
00:00akhudekjcrza: Eclipse and IntelliJ both have decent clojure support.
00:00technomancyjcrza: counterclockwise is generally considered the top contender for IDEs
00:00casionthat is just insanely confusing of an error message
00:01jcrzaSweet, thanks :)
00:01technomancySgeo: reasonable enough
00:01akhudekjcrza: counterclockwise is eclipse
00:01akhudekor rather a plugin
00:01arrdemsrsly? counterclockwise over Vimclojure or SLIME?
00:01casionarrdem: on windows?
00:02arrdemyeah... I'm trying to get Cygwin set up for that but it isn't looking good
00:03akhudekarrdem: cygwin isn't worth the trouble. If you want unix that much, just run a vm. :/
00:03arrdemakhudek: right now I'
00:03arrdemm just using it to SSH to real unix machines... it's even bad at that T_T
00:04akhudekhaha, it is, putty is the goto on windows I think
00:05jcrzaPutty is the best.
00:08xeqicounterclockwise has leiningen integration and uses nrepl and is contributed to by the nrepl maintainer, seems top tier to me
00:19SgeoWhat thread do watchers (as in, fns placed by add-watch) run in?
00:40amalloySgeo: unspecified
00:45SgeoWith Aleph HTTP server, how does Ring middleware interact with handlers that are synchronous but have async bodies?
00:48arohneramalloy: is it? I thought the docstring was clear that ref watchers would run synchronously, after the ref commits
00:48arohnerbut it's in the thread pool, i.e. unspecified, for agents
00:56amalloy&(doc add-watch)
00:56lazybot⇒ "([reference key fn]); Alpha - subject to change. Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any regis... https://www.refheap.com/paste/5461
00:58amalloyarohner: i think that's probably how it's implemented, but "synchronously" does not imply "on the current thread"
00:59amalloyeg, imagine there's a worker thread that handles calling all the watch functions, to make sure you only interact with the gui on a single thread. if you give him that work to do, and then wait for him to finish, it's still synchronous
00:59arohneramalloy: sure. but 'synchronously, after the ref commits, before anything else commits' strongly implies it. Your only other alternative is 'on another thread, but it blocks the original thread while things run on an alternative thread'
01:00amalloyit definitely does not say "before anything else commits"
01:00amalloywhich would be an impossible contract anyway
01:01arohneryou're right. I should have said, before anything else sends
01:01amalloynot even that. just, before sends queued by the current transaction send
01:02amalloy(dotimes [_ 2] (add-watch r (fn [& args] (send a inc))))
01:02amalloycan't help but allow those sends through, i think; although i'm not sure on that
01:08francis21:54 <amalloy> arohner: i think that's probably how it's implemented, but "synchronously" does not imply "on the current thread"
01:57SgeoIs there a way to remove all watchers from a ...... mutable item (not sure what the formal Cloure name is) without knowing the keys?
02:05muhoois there some way to specify a bunch of forms to run whenever an nrepl connection starts up to an existing process?
02:06muhoo:profiles {:repl {:injections }} doesn't work
02:11BrainBaconWill someone help me become more familiar with vimclojure?
02:45SgeoIs there a significant difference between using Aleph solely for the ability to put a channel in the body and just using an InputStream for the body in regular Ring with Jetty?
02:49carkaleph does not do ssl
02:49carkwhich is annoying, because i really like it otherwise
02:54SgeoUh, other than the fact that implementing my own InputStreams might be painful :
02:54Sgeo:/
02:54SgeoWould it likely be
02:54SgeoWhereas I can just enqueue with Aleph, I'd need to ... make a lazy InputStream somehow
02:54Sgeo:/
02:55SgeoWait, are InputStreams as bodies allowed to block in Jetty? Is that a bad idea/
02:55carkcan't be that hard =P
03:03carkwhy do you need a lazy output for your web app ?
03:03carkdoing some kind of a commet thingie ?
03:03carkcomet*
03:04Sgeocark, yes
03:04carknice, this is something that has been missing from the clojure ecosystem
03:05cark(as far as i know)
03:05Sgeo:/
03:06carkthe top would be a library that does websockets ond falls back to comet style when not available
03:06carkon the client side and server side
03:12ForSparePartsWould anybody be able to take a quick look at my code? I'm starting my first big Clojure project, and I'd appreciate any comments on my coding style or direction...
03:12ForSparePartshttps://gist.github.com/3825501
03:15carkthe whole property-map business seems fishy to me
03:16carklooks like you're trying to do OO
03:16SgeoWhy doesn't Aleph do SSL?
03:17carkSgeo: maintainer does not want to have to maintain it
03:17carkSgeo: the ssl part i mean
03:17carkSgeo: tho it seems like it's not too hard to add that by directly using the underlying whatitsname library
03:19ForSparePartscark: you're probably right -- what would be a better, more clojure-y way to do it?
03:21SgeoWould it be a bad idea for me to rely on .getWatches?
03:21carkmove could be directly working on any structur which has x and y properties
03:21carkthen you can make a behaviour like this #(move 10 0 %)
03:22carkto apply several behaviours : (reduce apply-behaviour initial-item behaviours)
03:23carkapply behaviour woudl be (fn [result behaviour] (behaviour item))
03:23carkapply behaviour woudl be (fn [result behaviour] (behaviour result))
03:24carkso that makes (reduce #(%2 %1) initial-item behaviours)
03:25carksee what i mean ?
03:25ForSparePartscark: trying to. Functional newbie, here.
03:26carkalso in clojure you seldom need to use actual lists
03:26ForSparePartsAre you saying that move would be a function that gets applied directly to a structure with an x/y?
03:26carkright
03:26ForSparePartsAnd it would return the subset of the map that changed?
03:27ivanSgeo: seen clj-browserchannel? writing a Comet thing is harder than it looks given dropped/re-ordered HTTP requests. and many other things.
03:27cark(defn move [x y target] (-> target (update-in [:x] #(+ % x)) (update-in [:y] #(+ % y))))
03:28Sgeoivan, is that production ready?
03:28ivanno idea. but the author says he uses it in production on one site.
03:29ForSparePartscark: Thanks! I'm going to study that until it makes sense. Might be back with more questions.
03:30ivanat least the client side of BrowserChannel is definitely production ready
03:30carkok =)
03:30SgeoIs there a way to use clj-browserchannel without ClojureScript, as in, just Javascript on the client-side?
03:31ivanI would assume so. All of BrowserChannel is in Closure Library, and there's no cljs in its repo
03:31carkForSpareParts: getproperty already exists (get-in state [:ball :position :x))
03:31SgeoIs Google Closure a compiler?
03:31Sgeo:/
03:32ivanClosure Compiler is a compiler
03:32ivanClosure Library is a huge pile of JavaScript
03:32carki'd say it's a gloryfied minifier =P
03:32SgeoAh, ok
03:33ivana minifier with tree-shaking and an advanced type system ;)
03:33carkyeah it's at the boundary betwenn minifier and compiler =P
03:33ForSparePartscark: Good to know! Also glad to learn about the arrow (had seen it, but hadn't looked it up until just now) and update=in, which I suspect does something I spent a bunch of time trying to figure out how to do.
03:34carkForSpareParts: great =)
03:37carkForSpareParts: tho my sample usage of update-in was kinda wrong
03:37cark(defn move [x y target] (-> target (update-in [:x] + x) (update-in [:y] + y)))
03:37carkthat's better !
03:54kralnamaste
04:17josteinkoooh
04:17josteinkhttps://github.com/weavejester/lein-beanstalk
04:17josteinkthis makes me want to try out creating a clojure web app of sorts
04:17josteink(and AWS elastic beanstalk)
04:18josteinkwhat's the recommended clojure framework/library for web development these days?
04:24carki personally use ring, add a couple libraries, and build most stuff myself around it
04:25carkonce you've got the web server, everything else is actually rather easy, not much need for frameworks
04:26carkexcept maybe for routing, but i rolled my own for that too
04:26cark*request routing
04:28mjcthere's also compojure and noir, which are built on top of ring
04:28carkcompojure does the routing, it's not too bad !
05:05wingyis there any benefit for using "get map key" rather than "map key" or "key map" ?
05:06cark(key map) works only with keyword keys
05:06carkbut returns nil when map is nil
05:06wingyso then its "get map key" vs "map key"
05:07cark,(get nil :blah)
05:07clojurebotnil
05:07cark(nil :blah)
05:07cark,(nil :blah)
05:07clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0)>
05:07wingyi c
05:07cark(get {} :a :not-found)
05:07cark,(get {} :a :not-found)
05:07clojurebot:not-found
05:08wingy,({} :a :not-found)
05:08clojurebot:not-found
05:08wingy:)
05:08carkwingy: i didn't know that one !
05:08cark=P
05:08wingynew feature i guess
05:08wingy,(get nil :not-found)
05:08clojurebotnil
05:09wingy,(get nil :hey :not-found)
05:09clojurebot:not-found
05:09carki usually do (:key map)
05:09wingyok seems like "get" is safer .. also good since then "get-in" makes sense
05:10wingyman i love clj
05:10wingynever js again
06:22wingyhow do you loop a map to get the key and value?
06:22wingyfor each element
06:28josteinkmjc & cark: thanks. input noted
06:30algernonwingy: (map (fn [[key value]] (do-stuff key value)) (seq hash-map)) ? ; probably not the best way, though
06:30wingyhttp://stackoverflow.com/questions/6685916/how-to-iterate-over-map-keys-and-values
06:30wingyread about this
06:31wingythe answer seems logical
06:35wingy(doseq [keyval map] (prn (second keyval)))
06:40wingyit seems not working since doseq is returning nil
06:40wingya
06:41wingyi need something that returns the expression body since im using it for hiccup
06:41wingyhow do i loop a map in hiccup returning an element that is using the key/value pairs for each iteration
06:43wingy(for [keyvalue (seq {:name "foo" :age 23})] keyvalue)
06:44wingy(for [keyvalue {:name "foo" :age 23}] keyvalue)
06:44wingywow .. how come no one mentions this
06:45wingyworked like a charm
06:52cark,(seq {:name "blah" :age 40})
06:52clojurebot([:age 40] [:name "blah"])
07:04augustlis it possible to (apply some-macro a-list) to call (some-macro list-item-1 list-item-2)?
07:05carkyour list is a literal list ?
07:06carkremember that macros can't look inside a run-time list
07:07augustlcark: it's a run-time list
07:08carkthen it's not possible
07:08augustlwriting a function that takes a list and ends up calling weavejester.github.com/compojure/compojure.core.html#var-context which is a macro
07:08augustlI guess I have to write a macro instead of a function
07:09augustland it's not actually a run-time list now that I think about it
07:09carki think there must be an underlying functional interface to these macros
07:09augustlall the functions are unfortunately private
07:09carkwell if it's not, then you can unroll it
07:11carkbut i have to ask, how do you have a list bound to a name while not being a run time list
07:11augustlI'm writing it as a macro now
07:12wingytoday is the day i make a decision using ApiGee App Services or Datomic
07:12carkif it's inside a macro then you could `(some-macro ~@my-list)
07:12wingyDatomic fits clojure and is cooler but ApiGee App Services is a BAAS
07:13wingyhandling deployment and everything .. if anyone has some inputs please share
07:14carkhave you considered heroku ?
07:14wingycark: yeah heroku is PAAS .. apigee is BAAS
07:14wingya level abobe PAAS
07:15wingybut even if i choose ApiGee i still need Heroku to serve my app
07:15carkhum what is baas ?
07:15wingyi used the wrong word .. ApiGee isn't doing deployment .. i just meant that i don't have to care for their backend (softwares).. you just use their HTTP API
07:16wingybackend as a service .. PAAS is you saying "i want this and that software" BAAS is you saying "create new user…save this user"
07:16wingyIAAS handles hardware for you … PAAS handles software for you .. BAAS handles data for you
07:17wingypretty cool
07:17carkoh i see
07:17wingybut if i use Datomic i stay closer clojure .. which i like
07:17wingyhave a look at ApiGee app services, Kinvey, Parse and Stackmob
07:18wingyan emerging trend .. pretty new but already growing rapidly
07:25sundbpanyone recognize this error message trying to use ritz-swank 0.5.0 from emacs24: "Symbol's value as variable is void: slime-ritz"
07:26cmiles74sundbp: That looks like maybe the slime-ritz mode isn't actually loading.
07:27sundbpcmiles74: i'd agree. it's listed as an installed package by package manager though.
07:29sundbpcmiles74: hmm.. i seem to just have gotten it working. reinstalled packages
07:30cmiles74sundbp: I've had el-get install stuff, but it doesn't actually show up until I restart Emacs. Not all packages, just some of them.
07:30cmiles74sundp: :-)
07:31sundbpcmiles74: not sure i did anything more than reinstall. perhaps restarted emacs. not sure
07:36sundbpcmiles74: i do however get an error "5 slime-media-4e750cb9.el:1:1:Error: Cannot open load file: slime-repl"
07:52Cheiron_Hi, any libs to mock objects in clojure?
07:56sundbpcmiles74: false alarm, was missing slime-repl package. all sorted now
07:56ifesdjeenhi guys, does anyone know how to avoid Reflection Warnings when using thrush (->) operator?
07:56ifesdjeenI'm using type hints, setting explicit type, but that doesn't really help
08:04cemerickifesdjeen: pastebin, please?
08:04ifesdjeensec
08:09ifesdjeencemerick: https://gist.github.com/3826589 here it is
08:09ifesdjeenfirst example is project-specific, below one is generic
08:31cemerickifesdjeen: so, the ArrayList examples don't work as you'd expect, because .add returns a boolean, not the List
08:32cemerickYou're looking for (doto (ArrayList.) (.add 3) …) in that case
08:32ifesdjeenah, true
08:32ifesdjeenthat makes perfect sense
08:33ifesdjeenthank you cemerick
08:33cemerickI suspect the same applies to the Column example, since the methods are .setXXX
08:33ifesdjeenyup, most likely that is the error
09:41Cheiron_Hi, how to add this dependency to project.clj?
09:43Cheiron_http://mvnrepository.com/artifact/org.mockito/mockito-all/1.9.0
09:43Cheiron_how to add http://mvnrepository.com/artifact/org.mockito/mockito-all/1.9.0 as a dependency to project.clj?
09:44andrewmcveighCheiron: [org.mockito/mockito-all "1.9.0"] should do it
09:49Cheiron_andrewmcveigh: thanks!
10:05_wingywhat does sound data model mean in datomic?
10:09chouserprobably some combination of immutable, composable, good equality semantics.
10:23jcromartiedang, I feel stupid… I've been using (in-ns 'foo.bar) instead of (ns foo.bar) in the REPL all this time?
10:23jcromartieall of those wasted keystrokes! I'm sure they add up to almost as much as I just typed here to whine about it!
10:24casionjcromartie: you don't use autocomplete or something like that?
10:24jcromartiecasion: oh snap, now you're making me feel really bad
10:25casionI just hit i-tab, '<first-letter or two> tab
10:25jcromartieWhat's i-tab?
10:25jcromartieIn swank-clojure it's C-c M-p
10:25casionthe character i, follow by tab which completes to "(in-ns "
10:26jcromartieah ha
10:26jcromartieslick
10:26casionn completes to something else first
10:26BeLucidI want to not start my web server when I run my project in the repl... is there a test for if your running from lein repl or not?
10:26casionso I just use in-ns since it always is first on the list for i
10:27casionjcromartie: I assume you use emacs, it's worth checking out ac-nrepl
10:27jcromartiehm
10:27ToBeReplacedat http://clojure.org/namespaces it tells you to use in-ns instead of ns
10:29jcromartieToBeReplaced: I think that means for creating new namesakes at the repl, no?
10:29jcromartieor does it really mean for switching namespaces
10:29jcromartieI mean in-ns makes sense
10:29ToBeReplacedi have no idea; i struggle to understand the difference
10:29ToBeReplacedi just noticed that i was always using in-ns as well, and was wondering why when at a high level ns seems simpler
10:30jcromartieI'm also surprised that clojure.repl is not use'd by default in the user namespace
10:30jcromartieit used to be, no?
10:30jcromartiedoc, source, etc.
10:30jcromartiehm, well looks like doc is there but not source
10:30jcromartieweird
10:33ToBeReplaceddo you know the difference between in-ns and ns?
10:34ToBeReplacedoh i get it;
10:35ToBeReplacedif you use ns, there are additional implieds like using clojure.core... with in-ns, you don't get that, you only get the mappings defined in the namespace
10:37Cheiron_hi, why this (Mockito/mock TupleImpl.class) is generating CompilerException java.lang.ClassNotFoundException ?
10:38Cheiron_even (Mockito/mock String.class) is throwing the same exception
10:38jkkramerCheiron_: you don't need .class. Just use String or TupleImpl
10:39Cheiron_jkkramer: oh true!
10:43Cheiron_How to write this in clojure? Mockito.verify(service).commit() ?
10:45Cheiron_never mind ..
10:58mefestoI've been using nrepl and notice that sometimes while working in a nrepl session that usage of *1, *2, ... doesn't seem consistent. For example, I'll evaluate something then do `(def x *1)` but find that x is nil instead of the value i expected. Has anyone else noticed this?
10:58mefestoit happens randomly
10:59mefestook it happens always now :)
10:59mefestoeval 1 then immediately afterwards (def x *1)
11:00ToBeReplacedmefesto: that works for me in nREPL... (eval 1), then (def x *1), then x prints 1
11:01mefestohmmm im using nrepl-jack-in from emacs, you?
11:01wjlroeDoes anyone know how to 'recompile' a def in a library you've used? (emacs/slime)
11:02ToBeReplacedmefesto: lein repl from my project
11:02mefestoToBeReplaced: that works for me too
11:02mefestoI guess my issue is specific to emacs
11:03ToBeReplacedmefesto: i don't have an emacs setup, so i can't help there... gl
11:36uroborus_labsSo I like seesaw, but is there a way to create desktop based applications using html5? Or some sort of clojure/webkit setup?
11:37uroborus_labsWhere I am going with this is that I really like the Light Table Ui, but not sure the best way to go about creating a desktop app.
11:38uroborus_labsFrom what little information is on the Light Table blog, it sounds like he is using Noir and built the app using a client/servr type model
11:39wjlroeuroborus_labs: I looked into that myself - took apart the light table jar, but I can't find anything for building webkit apps easily unfortunately. Also, on Linux and Windows, Light Table just opens in chrome, so it appears there isn't an easy way to encapsulate webkit for a frontend
11:39uroborus_labsAhh, I have only tested it on OSX, wasn't aware that it was a chrome app on osx and linux.
11:39uroborus_labsHmm...
11:39wjlroeyeah it's all pretty standard web server stuff in Light Table, with lots of ClojureScript
11:39carki think there is a webkit widget in swt
11:40wjlroeyou ideally want the full V8 and all that jazz
11:40uroborus_labsI might just be better off sticking with seesaw for what I want to do then...
11:40hiredmanjavafx has a webview that is webkit
11:40carkhiredman: mhh nice
11:40carkis it possible to script it from java ?
11:40hiredmansure
11:41carkmhh
11:41carkis it portable to windows ?
11:41hiredmanhttp://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm
11:42hiredmanhttp://www.a1o1.com/java-fx20-embedding-webview-in-swing
11:42hiredmanetc
11:42uroborus_labsIt seems possible to do well...
11:42carkhiredman: awesome thanks a lot
11:43hiredmanthe main thing is you need java 7+, and you need to specifically put the javafx jar on the classpath
11:43wjlroepooh, this is worth playing with
11:43wjlroeI mean ooh
11:43wjlroenot pooh
11:43uroborus_labslol
11:45wjlroeThe reason I looked into this was for my Ludum Dare entry http://www.ludumdare.com/compo/ludum-dare-24/?action=preview&amp;uid=14189 which is ClojureScript and wanted to distribute it as if it was an app
11:45carkwell that's a whole new thing with lots of implications ...
12:09technomancyIIRC the java7 backport of javafx isn't licensed for redistribution
12:10hiredmantechnomancy: is it a backport?
12:10hiredmantechnomancy: surely you mean the java6 backport
12:11technomancyhiredman: well I mean as distinct from the javafx that will ship with java8
12:13hiredmantechnomancy: http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#10
12:15technomancyhiredman: I believe "subject to the terms and conditions of the license" means "you have to make the user click through a EULA" and thus it can't be distributed via a proper repository.
12:15technomancy"JavaFX is available under the same license and business model as Java SE" <- same reason oracle's JRE is no longer available via apt, etc.
12:16wjlroeoh. Oracle FTW
12:16SegFaultAX|workFor the wanking?
12:16wjlroeyou decide
12:17SegFaultAX|workIts got a nice ring to it. :)
12:18pipelinetechnomancy: not exactly
12:18pipelineoracle's JRE is unavailable via apt
12:18pipelinebecause java used to be available only under a VERY SMALL set of restrictions
12:19pipelineso Sun worked with open source distributors to come up with a magic special snowflake license
12:19pipelineJUST FOR a handful of linux distributions
12:19pipelinewhen openjdk came out, with a 99.9% complete java under a truly open free unencumbered license
12:19pipelineoracle shitcanned the special snowflake license
12:19pipelineand that was perfectly reasonable to do, since it had outlived its usefulness
12:19technomancypipeline: sure, I'm just saying whatever reasons prevent Oracle's JDK from being available via apt apparently also apply to JavaFX
12:20technomancyI agree that redistributing Oracle's JDK via apt doesn't make sense when you can just use OpenJDK
12:20pipelineyeah
12:20pipelineand that's true
12:20pipelinebut not a super helpful statement without context
12:21pipeline(and, like the jdk, there is a javafx project licensed under gpl)
12:21technomancyoh, now that I did not know. interesting.
12:21wjlroeI wonder - all the people using the JVM and automated orchestration of servers, do they all use the OpenJDK?
12:22technomancywjlroe: pretty much
12:22pipelinetechnomancy: it's not nearly as active because outside vendors have a lot less reason to care. e.g. no redhat interest
12:23technomancywjlroe: we use openjdk at heroku. we only recently have started to get people asking for Oracle JDK since we've started pushing "heroku for enterprises" where people are more interested in the brand name than the actual functionality.
12:23carki've redone the domonad macro ... should i keep lispy and have (<- id (slget db-next-id)) or haskellish and have (id <- (slget db-next-id)) ?
12:23carkboth a clear enough when reading the code
12:23wjlroetechnomancy: oh interesting. You corrected detected I was actually asking about Heroku
12:24technomancyhehe
12:24carktechnomancy: are you implying that openjdk is functionally equivalent or even better than oracle jdk ?
12:24wjlroetechnomancy: we use the OracleJDK, but I'm not entirely sure why. In the projects I work on, it's Clojure apps anyway
12:25technomancyhttp://enterprise.heroku.com/ <- the set of people who ask for oracle is a subset of the people who want to contact a sales representative to get started with heroku instead of just installing the command-line client and creating apps themselves =)
12:26wjlroetechnomancy: heh. Reasonable right? "git push heroku". No wait. Where's the release form?
12:26technomancycark: last I heard (~3 years ago) there were a handful of differences in the codebase surrounding font rendering engines in gui apps due to patent concerns, but for server-side code IME they are completely indistinguishable apart from licensing.
12:27TimMc"process manifold"
12:27TimMcyou're killing me
12:27carktechnomancy: there is the thing, there is a world outside the server-side
12:27wjlroetechnomancy: I would have thought lack of Safe Harbour would be a bigger concern to people than the enterprisey things
12:27carktho java isn't very well suited for it
12:28technomancyTimMc: "I've reversed the polarity of the neutron flow; it should reduce the strain on the process manifold until we can get the ship's accelerator to push us into hyperspace!!!"
12:28TimMcs/hyperspace/IPO/
12:29technomancycark: sure, understood. I don't know if the font rendering issue is still present in openjdk7; that's just the last time I heard about there being any appreciable difference.
12:30carktechnomancy: i should maybe check openjdk ... though it's always trouble and doesn't make my code grow any faster =P
12:32technomancyback when we were stuck on oracle JDK we would have to manually plop some jars into the JDK dir because they neutered the strength of their crypto algorithms in order to comply with mid-90s US trade export laws =\
12:32technomancy("we" in this case not being heroku)
12:33wjlroeI remember those days
12:33wjlroeused to be a problem with all free software
12:34technomancygo USA!
12:34wjlroeyeah, that was super effective
12:35_wingya fn body can consist of multiple forms right? just that the former ones have to have side effects
12:36wjlroetechnomancy: as much as I love the graphics on your enterprise.heroku.com I feel it needs a geek.heroku.com with emacs screen grabs instead of eclipse ;)
12:36wjlroe"Full stack Clojure"
12:37technomancywjlroe: actually internally we refer to the teams as "Hacker languages" and "Enterprise languages" =)
12:37wjlroehaha
12:40wjlroeDoes anyone know of a good Clojure style guide? I'm tired of thinking
12:42hiredman~library
12:42clojurebotlibrary is "Our class libraries have destroyed our brains." - rhickey
12:44jcrossley3wjlroe: http://dev.clojure.org/display/design/Library+Coding+Standards
12:45wjlroejcrossley3: oh thanks!
12:53CheironHi, in Mockito, how to code this in clojure? Mockito.verfiy(mock).doSomething() ?
12:53hiredman~mock
12:53clojurebotExcuse me?
12:54hiredmanclojurebot: objects?
12:54clojurebotEqual Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://www.pipeline.com/~hbaker1/ObjectIdentity.html
12:54hiredmanclojurebot: mock objects?
12:54clojurebotYour mock object is a joke; that object is mocking you. For needing it. -- rhickey
12:55goraciohello there :)
12:55Cheironhere is my attempt: http://pastie.org/4903462
12:56technomancyCheiron: just wrap the method call in a function and use with-redefs
12:56wjlroe+1 with-redefs … also https://github.com/marick/Midje
12:56Cheironmay i ask for pastie ? i'm sorry to ask
12:56technomancymockito is just a complicated workaround for shortcomings in the java programming language
12:57goracioquestion - is there any func for this : if element exist in vector ?
12:57Cheironwith midje i can do things similar to mockito?
12:57technomancyCheiron: no need for a fancy library: (let [p (promise)] (with-redefs [mocked-fn #(deliver p %)] (do-stuff)) (is (= :expected-value @p)))
12:59goracioso for example [1 2 3] i want to know if there is 3 in this vector - maybe there is some heplful func ?
12:59technomancy,(some #{3} [1 2 3])
12:59clojurebot3
12:59wjlroebeat me to it
13:00wjlroeit still irritates me that you can't use contains? for this
13:00wjlroebut chest la vie
13:00technomancycontains? is a long-troll
13:00wjlroec'est la vie .. I mean
13:00Cheirontechnomancy: i'm sorry but i don't understand the line you posted :( sorry to ask
13:01wjlroetechnomancy: you mean the authors of contains? are trolling us? heh
13:01technomancyCheiron: it redefines the mocked function to be a function that just delivers to a promise. then you check the value of the promise to see that it received what you expected.
13:02technomancywjlroe: yup
13:02technomancywjlroe: how else do you explain the fact that it hasn't been renamed to has-key? and contains? left around as a deprecated alias?
13:03technomancycontains? exists solely to trick newcomers into thinking about big-o notation
13:03wjlroetechnomancy: yeah. also confusingly you can use it to test for set membership. but not vector membership. war.
13:03wjlroes/war/wat/
13:04cemericktechnomancy: long troll ~= waging war on everything Sequential
13:05cemerickI don't think it's a coincidence that clojure.set includes a bunch of relational operations, etc.
13:06cemericknot that anyone uses them
13:06hiredmancemerick: and people reimplement it
13:07hiredmanhttps://github.com/danlarkin/subrosa/blob/master/src/subrosa/database.clj
13:07danlarkinyeah but mine is totally sweet
13:07wjlroeahaha
13:08cemerickhiredman: incompletely, I 'spose
13:08cemerick;-)
13:09pjstadigevery sufficiently large irc server has a incomplete, bug-ridden, implementation of half of clojure.set
13:09jcrossley3cemerick: default port for nrepl? 7888?
13:10cemerickjcrossley3: That's the one I've been eyeballing
13:10CheironHi, would you please have a look at this: http://pastie.org/4903537 i'm trying to mock
13:10cemerick~mock
13:10clojurebotExcuse me?
13:10cemerickno rhickey mock quote?
13:10danlarkinpshhhhhhhh subrosa's database is distinct from clojure.set
13:10technomancyCheiron: you can't redef a method, only a var
13:11wjlroewe totally haven't seen a rich hickey mock quote for 5 whole minutes
13:11cemerickoh, did I miss the fun?
13:11cemerickone of my favorites
13:11wjlroe:)
13:12Cheirontechnomancy: i'm sorry but this is an advanced topic to me. i appreciate your time but how to fix it? thanks a lot
13:12technomancyCheiron: you need to wrap the method call you want to mock in a defn
13:13joegallo_(defn to-string [s] (.toString s))
13:13joegallo_for instance
13:13joegallo_and then you can redef that
13:14Cheirontechnomancy: you mean wrap it in the vector of with-redefs bindings or with-redefs body?
13:15Cheironjoegallo_: ok , will try this, thanks
13:19FrozenlockWeird... I can't seem to require this ring middleware https://github.com/amalloy/ring-gzip-middleware
13:19Cheironjoegallo_: any idea ? http://pastie.org/4903585
13:19wjlroeFrozenlock: gist/paste?
13:20joegallo_Cheiron: on line 7, you should be calling (get-string ...) not (.getString ...), for starters.
13:21joegallo_but the problem you have is that you're calling the TupleImpl constructor wrong.
13:21Frozenlockwell I added it in my project dependencies [amalloy/ring-gzip-middleware "0.1.2"]. "Lein deps" Then in my REPL I try (use 'ring.middleware.gzip) but it says it's not on my classpath.
13:21joegallo_hence the illegalargumentexception
13:21FrozenlockOn wait, do I need to re-start the REPL?
13:22joegallo_In this case, I'm guessing that you mean "... (TupleImpl. 0))" not "... (TupleImpl.) 0)"
13:22Cheironjoegallo_: the problem is TupleImpl takes a lot of params that are heavy to create https://github.com/nathanmarz/storm/blob/master/src/jvm/backtype/storm/tuple/TupleImpl.java i only want to mock the behavior of .getString
13:23Cheironthat is why i was trying to use Mockito
13:23cemerickFrozenlock: Yes, you need to restart the REPL after adding a dependency, unless you want to try your luck with e.g. pomegranate
13:23joegallo_Cheiron: okay, i guess, but the point is that you're trying to call a constructor that doesn't exist.
13:23Cheironyes true
13:25Cheironjoegallo_: in this case i have to fallback to something like jmock or mockito?
13:26joegallo_sounds reasonable, given my highly limited view of the issue you're having
14:05wingyif Mac OS X was using functional programming instead of OOP would it be more stable?
14:06wjlroeonly if functional programming is magical pixie dust
14:06carkit is !
14:06emezeskewingy: What, you mean, like, the kernel? Or libc? Or other parts of userspace?
14:06wjlroethen yes
14:06wingyemezeske: not something specific .. was just wondering
14:07emezeskewingy: Well, your question is impossible to answer
14:07wingysaw a video from 1990 when steve jobs said they are using OOP in NEXT to make softwares faster
14:07wingyproductivity gain by 10 times faster
14:07emezeskewingy: To my knowledge, nobody has written a day-to-day-usable kernel in a functional language
14:08wingywould be cool if there was an operating system in FP heavily promoting it
14:08wingydatomic is a cool initiative
14:08nDuff...
14:08cmiles74wingy: I think they're talking about the productivity of NeXT engineers working on the product, not the product itself.
14:08emezeskewingy: There are functional kernels out there
14:09wingycmiles74: yeah i know
14:09wingyFP is so cool and simple
14:09nDuff...
14:09wingynDuff: what do you mean by ...
14:09cmiles74I'm not sure it follows that more productive engineers necessarily produce a more stable product. I mean, OOP prolly didn't make them better; mostly just more productive.
14:10wingyyepp
14:10carki think the typical fp programmer is not very interested with bit twidling, so not many are trying
14:10emezeskewingy: FP is not a panacea
14:10nDuffwingy: It's hard to come up to anything to say that isn't going to devolve into a much larger discussion.
14:10nDuffwingy: Many of the pieces of FP that actually apply to OS kernels are already practiced in the design of message-passing microkernels.
14:10nDuffwingy: ...some pieces simply don't apply by nature -- working with hardware means mutating things, by design.
14:11nDuffwingy: ...but it's a discussion that would need to happen with more grounding -- if you're asking the question at this level, it means you don't have enough background to discuss it.
14:11wingyi dont .. i was just curious
14:12emezeskewingy: The answer to your original question is: nobody has a clue, because nobody has rewritten OS X in a functional language.
14:12wingyyeah
14:15goracio@wingy
14:15goracio:wingy
14:15wingygoracio: yeah?
14:16goraciowingy:
14:16goraciotrying to insert your name :)
14:16wingyusing iPad? :)
14:16goracioXchat ubuntu
14:16wjlroewingy: the closest OS I can think of, although a research project, is Coyotos, written in BitC http://en.wikipedia.org/wiki/Coyotos
14:16wjlroebut obv nobody uses that
14:20SgeoWould it be at all sensible to use a Java implementation of socket.io with Clojure?
14:20SgeoRing etc.?
14:22wjlroeSgeo: you can probably use https://github.com/ztellman/aleph for websocket server support
14:22Sgeowjlroe, but I need a fallback for clients that don't support websockets, because the stock Android browser sucks like that :(
14:22hammerso is anybody using clojure-maven-plugin to unit test a maven project and putting the test reports in the maven site?
14:23wingydoes anyone know how to fire up a clojure shell for datomic? http://docs.datomic.com/getting-started.html
14:23duck1123Sgeo: I'd be interested to know if you ever come up with anything for socket.io for clojure
14:23wjlroeSgeo: yeah, have to work out how to fall back to long polling and all that - dunno about that
14:23TimMchammer: Nice idea. Haven't heard of anyone doing that, though.
14:24duck1123I'm using aleph, but I'm also hit by the browsers that don't support websockets
14:24wjlroeyou can just fall back to ajax for non-websockets
14:25hammeryeah my issue is the test-with-junit reports aren't readable by surefire, and i haven't figured out a way to take the old-style junit reports and get them in the site
14:27antares_technomancy: can you recommend a good S3 clojure client?
14:27Sgeowjlroe, but a library that did that for you would be nice
14:27SgeoBrowserChannel looks nice but doesn't support websockets at all :(
14:27technomancyantares_: I just call jets3t; it's got a reasonable API
14:28technomancynot sure it's worth bothering wrapping it
14:28wjlroeSgeo it would be nice, but would have a very limited shelf-life. non-websocket-capable clients won't be around forever, so it's a stopgap
14:28duck1123wjlroe: What about IE?
14:28SgeoWhy is stock Android browser non-websocket-capable :(
14:29hiredmanprops3t!
14:29technomancyhiredman: oh yeah, did you finish that?
14:30wjlroeduck1123 IE 10 has them. so limited shelf-life. basically IE lags behind the most, but at some point you can reasonably say, basically nobody uses these clients
14:30hiredmanfinish?
14:30hiredmanit works
14:30technomancyvaguely recall there was something keeping you from deploying a release
14:31hiredmangreat, the github readme drops the TODO header from the todo section
14:31hiredmanso the TODOs look like a list of features
14:31TimMchaha
14:31technomancyheh, I was wondering about that
14:31TimMcTHat's fantastic.
14:31hiredmanhttps://raw.github.com/hiredman/propS3t/master/README.org vs https://github.com/hiredman/propS3t/blob/master/README.org
14:32technomancygithub's org support is a lost cause. sorry to break it to you =\
14:32technomancyit's just rubbish
14:32hiredmanI am aware
14:35TimMcAre they using an open source module for that?
14:35technomancyyeah, a ruby gem
14:36cemerickTimMc: Don't bother. PR's were submitted for the asciidoc support, and they were ignored.
14:36cemerickMarkdown For Life, apparently.
14:37TimMcOn that note, does anyone know if it's possible to write an escape-for-markdown function?
14:37cemericks'okay, github sucks for content anyway…
14:37TimMcOr is Markdown too shitty for that?
14:37gfredericksTimMc: you're wondering if it supports all possible strings?
14:38wingybin/repl to start the clj shell
14:38cemerickTimMc: Yes is the answer to any "Is Markdown too shitty for X?"
14:50TimMcgfredericks: Something like that, yes.
14:50TimMcIt's more complicated, since you probably have to write different escapers for link text, table text, etc.
14:55gfredericksyeah that crazy
14:55Cheironit is possible to use reify to subclass and define new properties?
14:56Cheirondefine new properties for the subclass
15:01joegallo_iirc reify only works with interfaces and Object
15:01joegallo_well, and protocols
15:01joegallo_so subclassing is right out
15:01joegallo_but i could be totally wrong on that
15:02Cheironjoegallo_: yep true http://clojure.org/datatypes
15:02technomancyCheiron: somehow I get the feeling you're making things more complicated than they need to be
15:02michaelr525good evening
15:02Cheirontechnomancy: possibly :D I falled back to mockito and now i need to subclass a class a define a new property for it
15:03technomancyyou're describing a proposed solution rather than a problem
15:04Cheironwith reify i can implement an anonymous type and create and instance of it. but is it possible to define a new instance variable for the subclassed type?
15:06joegallo_you can close over any data that you want
15:06joegallo_,(let [a (atom 0) o (reify Object (toString [this] (swap! a inc) (str @a)))] [(str o) (str o)])
15:06clojurebot["1" "2"]
15:07joegallo_for instance, here i've closed over the atom a.
15:07joegallo_but i didn't need to create a new property to do that.
15:07joegallo_so i'm with technomancy on this one
15:07Cheironyep true
15:07abalonehm. i just went through a wizard for choosing an open source license and it didn't ask me whether i cared about derivative works including my name somewhere. but that's all i care about :-P
15:08abalonei guess if no one knows my name, then they can't curse me
15:08Iceland_jackdamn that abalone
15:20ForSparePartsIs there a good way to thread a value through a list of functions at runtime, analogous to the -> macro?
15:20ForSparePartsAlternate question: should I not be trying to do that?
15:21rmarianskiyou may be able to use reduce for that
15:21scriptorForSpareParts: as in if you're given a collection of functions?
15:22ForSparePartsscriptor: Yeah.
15:22scriptorI think I asked for something like that before, you'd have to create a variant of reduce
15:22ForSparePartsinteresting
15:23TimMcForSpareParts: comp
15:24ForSparePartsTimMc: Ah, yeah. That looks about right.
15:24ForSparePartsThanks!
15:24scriptoroh, right, reduce is only needed if you're going through another collection of values as well
15:24TimMc&(let [fns [inc #(mod % 3) #(* % %)] ((apply comp fns) 4)))
15:24lazybotjava.lang.RuntimeException: Unmatched delimiter: )
15:26TimMc&(let [fns [inc #(mod % 100) #(* % %)]] ((apply comp (reverse fns)) 104)) ;; reverse makes it better
15:26lazybot⇒ 25
15:30TimMc&(let [fns [inc #(mod % 100) #(* % %)]] (reduce #(%2 %1) 104 fns)) ;; using reduce
15:30lazybot⇒ 25
15:31oskarthRunning "lein ring server-headless" => could not find myapp/core.clj. The source code is in src/clj/myapp/core.clj and I've set :source-path to "src/clj" in project.clj. How do I get lein-ring to find core.clj?
15:32metajackIs ring-devel 1.1.x broken? It seems to fail to compile due to some issue in hiccup: https://gist.github.com/2427322f1de61f1811c5
15:33andrewmcveigh_oskarth: which lein version are you running?
15:33oskarthandrewmcveigh: lein2
15:34oskarth(preview6)
15:34metajackoskarth: then you want :source-paths ["src/clj"]
15:34andrewmcveigh_oskarth: then you should use the key :source-paths ["src/clj"]
15:34oskarthoh!
15:35metajackmaybe lein should yell about :source-path in lein2. that seems to trip everyone up
15:35oskarththanks metajack and andrewmcveigh
15:38wingydatomic users: is it possible to change schema dynamically?
15:39wingymy users will add attributes on the fly
15:43ordnungswidrigwingy: do you need the attributes or will a single attribute with a map value do?
15:43ordnungswidrigwingy: {:custom-attr-a "foo" :cutstom-attr-b "bar"} vs. {:custom-attrs {"a" "foo" "b" "bar"}}
15:44wingyordnungswidrig: i dont get your question
15:44wingyi c
15:44wingyhm
15:44wingyordnungswidrig: what are the pros and cons with these? or are they equivalent feature wise?
15:45wingyone thing i need is full text search working for each attribute
15:47ordnungswidrigwingy: so you need every attribute as a first class attribute then, datomic does not support map as values and text search / query. AFAIK.
15:48wingyi c .. too bad
15:48ordnungswidrigwingy: but to my understanding adding an attribute in datomic is common and leightweight.
15:48wingycool
15:48wingythats all that matters that i can add/remove attrs
15:49ordnungswidrigwingy: attributes are "installed" one by one anyways.
15:50cemerickwingy: you can't remove them
15:50cemerickOr, you can, but things go sideways somehow IIRC
15:50wingyyeah sounds logical since some entities are having those attrs
15:50wingyno probs anyway .. the most important part was adding them
15:52wingyim not familiar with java .. if i want to add a Price attribute, which of the following types should I use in Datomic: long, bugint, float, double or bigdec
15:52SegFaultAX|workHeh, bugint.
15:52SegFaultAX|workFits large numbers of insects.
15:53SegFaultAX|workOr conversely, errors out anytime you try and use it.
15:53SegFaultAX|workI'll just let myself out.
15:53wingy long, bigint, float, double or bigdec
15:55SegFaultAX|workwingy: Double or bigger.
15:55cemerickwingy: read: http://docs.datomic.com/schema.html
15:55wingyyeah im reading it
15:56wingydouble then
15:57xeqidouble for a price?
15:57wingyxeqi: something wrong?
15:57emezeskeI thought it was generally recommended to avoid use of floating point for money
15:57xeqiits inaccurate
15:57xeqisorry, double cannot accurately hold some prices
15:57xeqi(inc emezeske
15:57wingybigdec?
15:57xeqi(inc emezeske)
15:57lazybot⇒ 3
15:58SegFaultAX|workWhich would matter if it was a balance.
15:58SegFaultAX|workFor a fixed floating point value, don't you think a double is precise /enough/?
15:58SegFaultAX|work(Mixed terms there. Static floating point value eg 19.99)
15:59ToBeReplacedi would use the base unit of the currency and store in bigint if i could assume that you can't have fractional units
15:59emezeskeSegFaultAX|work: I think that's still a bad idea
15:59cemerick,(- 19.99 1.89)
15:59clojurebot18.099999999999998
15:59emezeskeSegFaultAX|work: E.g. you can't store 0.1 exactly using binary
16:00emezeskeSegFaultAX|work: Err s/using binary/using a floating point rep
16:00emezeskecemerick: Thank you.
16:00ToBeReplaced,( -1900 189) ;wink!
16:00clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
16:00SegFaultAX|workHmm, for a price I wouldn't have thought it mattered.
16:00SegFaultAX|workI'm sold though.
16:01SegFaultAX|work(See what I did there?)
16:01ToBeReplaced<3
16:01wingyso what type should i use?
16:01emezeskewingy: BigDecimal, int, or long, depending on how you want to approach the problem
16:02emezeskewingy: probably BigDecimal
16:02wingyok
16:02wingythx for the discussions
16:03cemerickwingy: You should probably try to fully grok http://docs.datomic.com/schema.html lest random irc advice doesn't pan out one of these days.
16:04emezeskewingy: Do what cemerick says ^^. It's a bad idea to blindly follow my advice (I can tell you this from firsthand experience).
16:04emezeskeEspecially when they're money involved, you want to be careful. :)
16:04wingyyeah but it says nothing about what is suitable for pricing :)
16:04wingyyepp
16:04cemerickWell, it doesn't give you the code you need to write for your app, either…
16:04SegFaultAX|work,(- (BigDecimal. 19.99) (BigDecimal. 3.99))
16:05clojurebot15.9999999999999982236431605997495353221893310546875M
16:05wingyim just doing a prototype though .. some more experienced with banking/money will handle the money part
16:05SegFaultAX|workWell, that's not what I expected.
16:05amalloydon't use bigdec
16:05wingywhat usually do people use for price then
16:05amalloyto handle money properly, use an integral number of cents (or tenths of a cent, or however low you want to go)
16:06ordnungswidrigwingy: always count in pennies
16:06wingygood idea :)
16:06SegFaultAX|workThat's how I handle balances. In pennies or fractions thereof.
16:06ordnungswidrigwingy: or, if necessary in millipennies.
16:06wingyhmm
16:06wingyor ratios?
16:06SegFaultAX|workFor simple static floating point values, I usually don't care.
16:06amalloywingy: usually they use doubles, and then someone steals from them
16:07ordnungswidrigwingy: it's like handling time. always use seconds/ms since epoch. Delay conversion into other representation until the view layer
16:07wingyyeah
16:07wingyis that how you do localization
16:07wingyone currency in system, then converts it on view layer?
16:08cemerickI'll bet pjstadig has a way to implement currency arithmetic using UUIDs…
16:08pjstadigUUIDs solve everything
16:08SegFaultAX|workIf you want to store arbitrarily precise monies, just store the denominator. 100/100 = $1 1000/100 = $10 100/1000 $0.10
16:09SegFaultAX|workThat way if some point in the future you have to change the scale, you can do it without having to guess what the original scale was.
16:09SegFaultAX|workThere was a DailyWTF on this topic I think.
16:09ordnungswidrigSegFaultAX|work: like fp-arithmetic.
16:09emezeskeSegFaultAX|work: ##(- (BigDecimal. "19.99") (BigDecimal. "1.89"))
16:09lazybot⇒ 18.10M
16:10cemerickpjstadig: you could even table every possible operation, and make all that math *really* fast
16:10emezeskeSegFaultAX|work: Your example initialized BigDecimals with doubles
16:10ordnungswidrigso a pair [381,-2] => 3.81?
16:10SegFaultAX|workemezeske: Oh is that what I did wrong? :)
16:10wingyordnungswidrig: so you use milli/pennies with long or bigint?
16:10pjstadigdefinitely floating points are wrong for prices, you want bigdecs
16:10ordnungswidrigwingy: depends on your prices ;) long should be enough.
16:10ordnungswidrigwingy: in most cases
16:10emezeskeSegFaultAX|work: The doubles lost the precision, and the bigdecs were initialized with that imprecise value
16:10pjstadigand maybe to tune the math context so you're getting the right rounding and such
16:11SegFaultAX|workemezeske: I understand. I just didn't expect it at first.
16:11emezeskeSegFaultAX|work: Sure! When I saw your example I was confused for a second too.
16:11ordnungswidrigbigdecimals are fine, depends on the memory / storage constraints.
16:11SegFaultAX|workemezeske: It's obvious once you think about it for more than 2 seconds, though. :)
16:11wingywow a lot of things to think about .. is that how java made it simple :)
16:12emezeske,(- 19.99M 1.89M)
16:12clojurebot18.10M
16:12emezeskeThere we go. I didn't know about the M suffix.
16:12wingyok bigdec :)
16:13emezeskewingy: What are you building? Some kind of shopping thing?
16:13wingyemezeske: the next amazon
16:13SegFaultAX|workwingy: So you're the guy...
16:13emezeskewingy: Ambitious! :)
16:13wingyyes
16:13ordnungswidrigoh dear, java 7 javadocs are an attack on my eyes.
16:13wingyi am
16:13wingythe one!
16:14SegFaultAX|workwingy: Good luck, Neo.
16:14ordnungswidrigand it is no complected.
16:14wingyim starting to believe...
16:14callenso, why does there seem to be enmity for macros among clojurians?
16:14SegFaultAX|workDo we actually get to use "complect" in sentences now?
16:14callenno, stop it.
16:14emezeskecallen: Because macros are harder to work with than functions
16:14callenit means to weave or plait something together using a loom.
16:15pjstadigcallen: there is no enmity, just to prefer functions first and use macros only when necessary
16:15callenemezeske: as a Lisper, that makes me intensely uncomfortable that you're not willing to embrace macros.
16:15ordnungswidrigbtw. bigdecimal uses 36+x bytes of memory (in case somebody cares)
16:15SegFaultAX|work(inc pjstadig)
16:15lazybot⇒ 3
16:15ordnungswidrigpjstadig: +1
16:15emezeskecallen: Sigh. As a lisper, you should understand the disadvantages.
16:16ordnungswidriglazybot: y u not understand my syntax?
16:16calleneverything has a trade-off, a cultural bias that is categorically against the use of macros except in some imaginary extreme case concerns me.
16:16pjstadig~55
16:16clojurebotTitim gan éirí ort.
16:16pjstadighmm
16:16amalloy~#55
16:16emezeskecallen: I don't know where you got this "categorically against the use of macros" business
16:16clojurebot55. A LISP programmer knows the value of everything, but the cost of nothing. -- Alan J. Perlis
16:16callenemezeske: I did CL, I've had my share of bad macros.
16:16emezeskecallen: The only advice I ever hear is: start with functions, only use macros if necessary
16:16pjstadigamalloy: thx
16:17nDuffcallen: It seems like solid advice to me, but then, I've had a lot of recent experience being bitten by 3rd-party libraries full of things that aren't composible on account of being implemented as macros.
16:17callenemezeske: seems reasonable on the face of it. I'm just concerned that if I ask for help with a macro, I'll just get told to not bother until I replace it with a function.
16:17nDuff...not that the extreme cases don't exist.
16:17callennDuff: we had this discussion.
16:17nDuffYes, we did.
16:17technomancycallen: why not worry about that when it happens?
16:17pjstadigcallen: you will be told that if you're doing it wrong
16:17emezeskecallen: Why don't you complain when that actually happens, rather than pre-complaining about a thing you think might happen?
16:17callennDuff: I'm still unconvinced by your unabomber reaction to that library.
16:17technomancyemezeske: jinx
16:18emezesketechnomancy: lol
16:18scriptorcallen: if the macro can be replaced with a function then people will tell you to use a function instead, yes
16:18callenemezeske: technomancy because I've had to deal with intransigent language communities before and it infuriates me.
16:18nDuffcallen: Hmm. Was the "OK, that's reasonable" response (after pointing out the lack of extensibility) a "fine, go away" then?
16:18callenemezeske: notably: #python in particular.
16:18scriptoralthough, I've seen people actually write out the function alternative on here before
16:18pjstadigif the programmer sees many different programming language communities as intransigent, then it is he who is intransigent
16:19SgeoIs using doto in a -> a reasonably idiomatic way to do a quick side-effect in a -> chain?
16:19amalloycallen: i can imagine communities becoming intrangisent when confronted with a belligerent complainer
16:19callenpjstadig: just *try* dealing with #python.
16:19technomancySgeo: sure
16:19pjstadighehe
16:19SegFaultAX|workcallen: Python are legion.
16:19amalloySgeo: yes
16:19callen#go is guilty of this too.
16:19callenamalloy: no, if you go to them with code that you need help getting to work, and if it deviates from what they perceive as being the "python way", even if there's a legitimate specific case reason for doing so, they won't help you until you change it.
16:20calleneven if you can prove it's not the origin of any bugs in that case.
16:20pjstadiganyway, no one is against macros, but i've seen people get tripped up over libraries that contain macros, and are therefore not composable
16:20cemerickI guess we're preemptively intransigent.
16:20pjstadigespecially newbs
16:20callenin contrast, #haskell and #ruby have in my experience been pretty accommodating/open-minded.
16:20SegFaultAX|workcallen: But we want you to correct /and good/ code.
16:20callenSegFaultAX|work: and #haskell doesn't?
16:20nDuffcallen: The "avoid macros" advice is something which has evolved in the community over time.
16:20callenSegFaultAX|work: they're the penultimate fascists of code correctness.
16:20nDuffcallen: If you haven't been here long enough to see that evolution -- and it's an over-the-course-of-years thing, it may seem caprecious.
16:20callenSegFaultAX|work: they're just easier to talk to than python people.
16:21pjstadigcallen: what is your macro question? do you have a macro you need help with?
16:21callennDuff: I've dipped in and out of Clojure over the years, never really immersing because I wasn't sure if I wanted to come to grips with the Java ecosystem.
16:21SgeoThere are cases in Clojure where you can use a function but in Haskell you'd be forced into a macro.
16:21callenpjstadig: I'm trying to gauge community, not code.
16:21nDuffcallen: ...that said, there's solid reasoning and experience behind it. There's was a talk at the conj on the subject a few years ago, if you're interested.
16:21technomancycallen: CLers also agree you shouldn't write a macro where a function will do, except for that subset of CLers who came starry-eyed from paul graham's tales of viaweb's 25%-macro codebase
16:21callennDuff: yeah, he's part of the reason I'm worried you guys have a bias against macros to begin with.
16:21technomancyan experienced lisper would be horrified at that kind of number
16:22callentechnomancy: I know that.
16:22cemerickcallen: cgrand gave the canonical talk on "functions first, then macros as necessary" at the first conj. I'll just presume you're not grouping him in with these "fascists" you're worried about.
16:22callentechnomancy: I only ever used CL macros as a terminal API, there were always underlying functions (90%++) that could be invoked for composability.
16:22nDuffcallen: And that's fine.
16:22technomancycallen: ok, so you're in complete agreement with the clojure community
16:22technomancynext?
16:22nDuffcallen: Nobody here, including me, is arguing against that kind of use case.
16:22pjstadigcallen: have you seen the talk? because i'm very disappointed in the way people have misinterpreted it simply from the title and a complete ignorance of its content
16:22callenfunction composition is to varying degrees the basis of my Python code, but absent the benefit of the macros to clean it up.
16:22SegFaultAX|worktechnomancy: I kind of have mixed emotions about it. It sounds like they basically built an entirely new tool for their work. So after a while it wasn't really CL... it was Viaweb lisp.
16:23callenSegFaultAX|work: it was a ton of C code too.
16:23callenSegFaultAX|work: that's one thing that seems to get ignored.
16:23SegFaultAX|worktechnomancy: Not unlike Honeywell Pascal being a specific Pascal for Honeywell automation systems.
16:23SegFaultAX|workI don't know if that's a good thing or bad thing. But it doesn't /seem/ terrible outright.
16:24SegFaultAX|workI mean, you might say they built a DSL for their business. If that provided value and expediance, where is the harm in that? Objectively speaking.
16:24SgeoFor what it's worth, I think -> is an overuse of macros, but the community seems to disagree
16:24amalloySgeo: -> isn't even a use of macros. it is a macro, and it's up to you to use it
16:25SegFaultAX|workSgeo: Dunno, I kinda wish -> wasn't syntax. Or at least a proper thrush combinator.
16:25SgeoSegFaultAX|work, yeah
16:25technomancySegFaultAX|work: because the 25% number seems insanely high and leads me to believe they're inventing their own language for the sake of being different.
16:25ToBeReplacedi just asked on SO about ->... it's driving me nuts at the moment
16:25SegFaultAX|worktechnomancy: Without looking at their code or working there, I have no opinion on that claim.
16:26SegFaultAX|worktechnomancy: But again, if it allowed them to be successful, who cares? They extended their tool around their domain.
16:26technomancySegFaultAX|work: of course it's their own business, but pg writes as if that's a normal everyday thing
16:27SegFaultAX|worktechnomancy: Hmm, that's not been my interpretation of his articles on the matter. Just my $0.02
16:27BeLucidAnyone able to help out with a noir on Heroku issue?
16:28SegFaultAX|worktechnomancy: My real question is: why is that mentality objectively wrong?
16:28BeLucidI've got a simple little app that runs fine locally... seems to start up OK on Heroku as well, but then it seems to start a 2nd instance on the same port
16:28callenI'm sorry if I caused any friction, I'm just trying to understand where the community stands on things I'm concerned about.
16:28BeLucidnot sure what's causing the second instance
16:28BeLucidhere's a gist comparing local w/ Heroku https://gist.github.com/4e2f3148c0fb4bec55d5
16:29SegFaultAX|workBeLucid: What gives you that impression?
16:29callentechnomancy emezeske sorry.
16:29ToBeReplacedSegFaultAX|work: usually, companies create languages because the market isn't meeting their needs and later discard them, like SCUMM at LucasArts... did viaweb eventually pitch their DSL or just keep running?
16:29technomancyBeLucid: I can take a look
16:29callenToBeReplaced: it kept getting used at Yahoo for a long time until the code was eventually refactored out.
16:29technomancyBeLucid: you're probably not honoring the $PORT environment var?
16:29callenToBeReplaced: supposedly, some of it still runs.
16:29callenToBeReplaced: I can't speak to the lifespan of it or what percentage lived on.
16:29ToBeReplacedinteresting
16:29BeLucidI think I am... the line I'm starting noir with is: (server/start (Integer/parseInt (or (System/getenv "PORT") "8080")))
16:29SegFaultAX|workToBeReplaced: IIRC, it was used extensively for quite some time after they were acquired by Yahoo. Is mass adoption the only measure of value?
16:30SegFaultAX|workToBeReplaced: They extended the language to create a custom tailored tool set to meet their needs.
16:30BeLucidit is ending up on 8080 from what I can tell from the output...
16:30SegFaultAX|workToBeReplaced: Which almost certainly would not map perfectly (or even well) to many or most other organizations.
16:30BeLucidwhich makes me think it's getting my default... not $PORT
16:30technomancyBeLucid: oh, I see what the problem is. you're starting the server on compile
16:30technomancyrather than putting it in -main
16:30xeqiBeLucid: its running the server during a compile, do you have some top level forms that start it?
16:31BeLucidahhh... I see
16:31ToBeReplacedSegFaultAX|work: no not at all... i'm completely in your camp here
16:31BeLucidumm... hmm
16:31BeLucidwonder what would be starting it during compile
16:32technomancyBeLucid: if you need help debugging you can pm me with the app name and I can take a closer look
16:32BeLucidok, thanks
16:32BeLucidhere is the project file...
16:32BeLucidhttps://gist.github.com/c9411f6b399ffecf3202
16:32BeLucidwhat are some candidates for me to look for? as to what would cause the startup at compile
16:33technomancyit's not the project file but the main ns that's at fault
16:33technomancysrc/cookable/main.clj
16:33SegFaultAX|workBeLucid: Your projects core.clj for example.
16:33BeLucidso... this makes some sense then
16:34BeLucidI do start the server in src/cookable/web.clj
16:34SegFaultAX|workShouldn't the buildpack do that for you?
16:34BeLucidwhich is the :main in my project file
16:34technomancyyou need to start the server inside the -main function in that ns
16:34BeLucidk
16:35BeLucidI can try that., one moment.. many thanks
16:35technomancyBeLucid: in general, all top-level forms should start with def
16:35technomancythough I guess noir kind of breaks that convention out of the box =(
16:36ordnungswidrigshouldn't clojure-mode then higligh als (def*) toplevel forms like it does with defn?
16:37SegFaultAX|worktechnomancy: What's the significance of -main over main?
16:37technomancySegFaultAX|work: it means it'll get turned into a method if it's gen-classed, which is relevant since that's the only way to launch from the CLI if you make an uberjar
16:38technomancyso lein run just re-uses the same convention that's necessary for uberjar
16:38SegFaultAX|worktechnomancy: Oh is uberjar not a term that Leiningen introduced?
16:39SegFaultAX|workIt's a thing outside of Lein?
16:39BeLucidwonderful... putting the noir server/start in -main did the trick
16:39gfredericksthere was a maven uberjar plugin at some point
16:39ordnungswidrigSegFaultAX|work: it's even a java thing
16:39BeLucidseems that it did start one up at compile time w/o it
16:39BeLucidmany, many thanks!
16:39technomancyBeLucid: cool, np
16:49SgeoI wonder if I should try bringing one of the Java socket.io implementations into Clojure
16:51SgeoAre there any stylistic guidelines on when to use a map as a function vs a keyword as a function?
16:52clj_newbHi, I always see comments like ';;' thou the comment is a single ';', is this a kind of convention?
16:53joegallo_clj_newb: emacs treats ;; as a comment on a line by itself, and a ; as a comment at the end of a line, basically.
16:53joegallo_it's just a lisp convention, though, i think.
16:53joegallo_;; the next line is tricky
16:53joegallo_(println "foo") ; see, i told you
16:54technomancyclj_newb: it's an old lisp convention that predates clojure
16:54technomancya lot of clojure people seem to be unaware of it
16:54emezesketechnomancy: I seem to remember reading that more semicolons indicated emphasis (kind of like h1, h2, h3, etc)
16:54emezesketechnomancy: Is that at all true?
16:55emezesketechnomancy: well, s/true/a common convention that you've seen
16:55joegallo_emezeske: so sayeth the stackoverflow http://stackoverflow.com/questions/6365334/lisp-commenting-convention
16:55emezeskejoegallo_: thanks!
16:57clj_newbso if I want to comment at the beginning of the line I use ;; and at the end a single ; Or it does not matter at all ?
16:57pjstadigclojure.core uses ';' in its header :(
16:58joegallo_clj_newb: there are no comment police
16:58pjstadigbasically all of clojure's clojure source
16:59amalloythere's also http://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html
16:59Frozenlockclj_newb: If you use a simple ';' on a line by itself, then press tab, it will displace it to the center of that line. ';;' will keep everything in place.
16:59pjstadigclj_newb: ;; should be used to comment out a whole line, and ; for comments at the end of a line FSVO 'should'
17:00technomancyemezeske: I think marginalia actually translates them into h3-ish things
17:01clj_newbthank you
17:01technomancyjoegallo_: does that mean the position is open?
17:02joegallo_it's stuck in committee, we're worried about who watches the watchmen.
17:03callenfor anybody else who's trying to make web apps in Clojure, this guy's articles are top-notch: http://www.vijaykiran.com/topics/programming/
17:04callensome of the best walkthrough, "survey of the landscape" intros to doing a web app in a new language I've ever seen.
17:04vijaykirancallen: :) thanks - I'm gonna update the articles to Clojure 1.4 and latest versions of library this weekend.
17:05callenvijaykiran: seriously though, it's not one of those dumb, "here's a 30 line hello-world example, kthxbai", you actually cover things like, "here's what I recommend for querying, for migrations, etc" and on down the line.
17:05callenvijaykiran: and the prose itself seems to be written with an understanding of what the learner will and will not know.
17:05callenvijaykiran: thank you so much for writing those.
17:06callenvijaykiran: if you're ever in the bay area, a beer on me :)
17:06vijaykirancallen: thanks, I'm glad that you found them useful :) if you find any problems - just add a comment, I'll try to keep them updated.
17:08gfredericksemezeske: what's the status on the cljs-version-configurability for cljsbuild? if there's work outstanding there I might like to hack at it tomorrow
17:09emezeskegfredericks: I think you can just put the clojurescript version you want in :dependencies in your project
17:09emezeskegfredericks: Someone told me that worked -- I haven't tested it myself
17:10gfredericksah interesting
17:11emezeskegfredericks: If you confirm that works, let me know. Otherwise, I'd be open to a pull request (although I think it might not be straightforward to add that feature)
17:12callenvijaykiran: you're on a roll, your post on eshell and sudo solved an old problem I had in tramp that I'd previously been solving with some egregious hacks.
17:13callenhttp://www.vijaykiran.com/2012/07/21/editing-remote-sudo-files-from-emacs/ <-- this one.
17:17callenhappy4crazy: learning clojure at hacker school eh?
17:18happy4crazycallen: mainly erlang and go, but yeah, some clojure too :)
17:30mwillhiteif I have a function like this (fn blah [^clojure.lang.Atom config] stuff)
17:30mwillhiteis the first element in the param vector a sort of type hint?
17:30mwillhitewhat is that?
17:30hiredmanmwillhite: that is amazingly silly
17:30TimMcmwillhite: It's a type hint on the config parameter.
17:30hiredman(type hinting as an atom)
17:30mwillhiteokay thanks
17:30mwillhitewhy is it silly?
17:31TimMcmwillhite: Because unless you're calling a (.method ...) on that atom, it doesn't do anything.
17:31hiredmanbecause all operations on atoms are done via clojure functions, so there is no reflection to get rid of
17:32mwillhiteah yes I see
17:32hiredmaneverytime you want to recommend reading code as a good way to learn something like that pops up
17:33hiredmanand you just sort of have to sigh
17:36joegallo_hiredman: i type hint everything and compile with --funroll-loops and --fomit-frame-pointer
17:36joegallo_it makes the lack of reflection even faster.
17:36hiredmandon't forget -fPIC
17:36joegallo_oh, yeah, i mean, of course
17:37hiredmanhah, tricked you, -fPIC will actually slow things down
17:38emezeske-funsafe-math
17:38emezeskeWhich I read as "fun, safe math."
17:39cemerickI thought -funsafe-math were JVM primitives…?
17:39ordnungswidrigcemerick: I think its -XXunsafe-math for the JVM
17:40ordnungswidrigor ist it -XX:+UnsafeMath?
17:41joegallo_hiredman: blast! now i have to recompile my whole machine!
17:41ordnungswidrigjoegallo_: ksplice will safe you from reboot.
17:42cemerickordnungswidrig: you tricked me into googling it :-P
17:42ordnungswidrigcemerick: gotcha!
17:42ordnungswidrig(inc ordnungswidrig)
17:42lazybotYou can't adjust your own karma.
17:42ordnungswidrig*duh*
17:52devthlet's say I have an alias to some fn: (def foo map). how can I do (clojure.repl/source foo) and have it tell me the source for map? some kind of syntax quoting magic?
17:52nDuffdevth: ...so, you need to copy the metadata on the var
17:53devthahh
17:54devthi might be going about this wrong. what i'm really trying to do is get the source for a function name that's passed in as a string. (source (symbol "map"))
17:54devthbut maybe i have the same problem in that case
17:55ordnungswidrigdevth: maybe the symbol is missing the namespace
17:56nDuff...so, you just need to get the var associated with that name.
17:56nDuffdo you know which namespace it's supposed to come from?
17:56devthi could require that the user pass it in. it's for use in a chatbot
17:57devthstill not quite right: (source (find-var (symbol "clojure.core/map")))
17:58ordnungswidrigdevn: have you looked at lazybot's source or clojurebot's?
17:58devthi have but i didn't think to look in this case. good idea.
17:59RaynesI'm not following.
17:59RaynesWhy would devth want to look at lazybot's source?
17:59devthdoes lazybot do source lookups?
17:59RaynesLike for functions and macros?
17:59devthyeah
18:00RaynesIt has a $source command that is completely broken because it links to github line numbers for an incorrect version of Clojure.
18:00devthah
18:00RaynesAnd I'm too lazy to update it and amalloy is too lazy to even consider thinking about updating it.
18:00devthi'm trying to use clojure.repl/source to look up fns in core, given a string fn name
18:03thorbjornDX,(flatten (repeat 10 (range 3))) ;is this as simple as it can be? (I'm probably missing out on a core fn here)
18:03clojurebot(0 1 2 0 1 ...)
18:04amalloy:(((((( flatten
18:04thorbjornDXamalloy: that's why I'm asking :). I don't like using it either
18:04amalloy&(doc cycle)
18:04lazybot⇒ "([coll]); Returns a lazy (infinite!) sequence of repetitions of the items in coll."
18:04thorbjornDXamalloy: <3
18:05Raynesamalloy: Did you even know about cycle before I showed it to you?
18:05amalloywat
18:06UrthwhyteIs there a way in lein to just have it default to the newest version of a dependency?
18:06RaynesThat's really awful.
18:07Urthwhyte?
18:08UrthwhyteIf you're just doing a one-off, or you know the library is stable it's a very sensible request
18:09BrainBaconDoes anyone know if it's possible to send an expression to the current REPL in vimclojure? It seems like when I try it opens a new window with a repl response instead of sending it to the current repl.
18:09RaynesIt's best to have a solid default. You don't know that your code will always work with new versions of things. I'm also pretty sure you'd have to use version ranges of some sort for that, http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html
18:14BrainBaconDoes anyone even use vimclojure effectively or is it better to go with lein swank + slimv?
18:14devthswank + slimv works great for me
18:14devthi messed around with vimclojure first but never really got it working
18:15thorbjornDXBrainBacon: I use vimclojure, I don't play in the REPL much though, I just edit in the file buffer and select and <leader>eb to send it to be evaluated
18:15BrainBaconYeah I got it working, but the workflow isn't quite what I thought it would b
18:15jamiiIs there an easy way to see the bytecode that clojure outputs for a function?
18:16thorbjornDXBrainBacon: I don't like how the repl behaves too much, but \el \eb \ef have been very useful.
18:16thorbjornDXBrainBacon: though you have to reload everything once in a while to make sure your file is all in the right order :p
18:16Urthwhytethe REPL is definitely a little flaky
18:17Urthwhytebut it's worth it to keep using the same environment for editing everything from clojure to class notes
18:17BrainBaconeh maybe I'll just switch to slimv then
18:22wingyim sure this is a clojure thing .. i have a datomic entity but when evaluating it it returned just a map with an id
18:22thorbjornDXApage43: evil scares me
18:22wingybut when looping it it returns all keys/values
18:22wingyhttps://www.refheap.com/paste/5491
18:22wingywhy is this? and is it possible to return the whole map instead of me having to loop?
18:22Apage43wingy: That's normal. Datomic result maps are "lazy", in that they don't actually retrieve their component parts until you use them.
18:23Apage43wingy: use (touch) to force it to realize the whole map.
18:24Apage43http://docs.datomic.com/clojure/index.html#datomic.api/touch
18:25wingyApage43: thx!
18:25Apage43Mind, the object is semantically the same object before and after touching it, so you don't need to do that to loop over it, compare it, etc.
18:26wingyyeah
18:26wingyApage43: are there more use cases to use touch besides wanting to see the properties in the repl?
18:29Apage43wingy: hm.. If pr/pr-str also print the partial representation then I guess it's also useful for shipping entities out wholesale, if you need to to spit them off somewhere over some network protocol or something
18:29Apage43I forget if that's true or not, I think it may be
18:30wingyyeah they print out the partial representation
18:31Apage43well them that's where it'd be useful
18:31wingyyepp
18:31Apage43most other things are going to iterate it and realize it when necessary
18:37cemerickUrthwhyte: there are evil ways of doing what you want, but it's just not a good idea
18:38UrthwhyteJust going to download the latest verion of a bunch of libs and then symlink them into lib path
18:38UrthwhyteWhat could go wrong ;)
18:39cemerick:-O
18:39cemerickinteresting, looks like kibit won't load at all if AOT-compiled stuffs are on the classpath
18:40ohpauleezcemerick: :( womp womp
18:42cemerickwomp?
18:43emezeskecemerick: Sad trombone.
18:43cemerickah
18:44cemerickI needed the terminal wooooonnh to catch that one. :-)
18:44emezeskeIt's totally three notes.
18:44cemerick"womping" has a particular meaning in my wife's family, which probably threw me off more than most
18:44emezeskeShould I be afraid to inquire as to that particular meaning? >:)
18:44SegFaultAX|work"Sad trombone" is so depressing.
18:45technomancyprobably shooting womp rats
18:45emezeskeSegFaultAX|work: Well, only in a melodramatic kind of way!
18:45augustlis there anything in ring to automatically handle servlet context paths somehow? I suppose not..
18:46augustland I guess it's more of a routing question anyway (compojure in my case)
18:46SegFaultAX|workaugustl: What does that even mean?
18:47cemerickaugustl: The ServletContext is in the request map if you're deployed in a container
18:47cemerickdunno if that help you
18:47SegFaultAX|workWhat is a ServletContext?
18:48cemerickIf you don't know already, don't bother. :-)
18:48augustlSegFaultAX|work: java servlets has an API to "mount" the servlet to a specific context path, so that /myapp/foo calls myapp but with /foo as the path
18:48augustlcemerick: I see
18:48augustlperhaps there's some sort of standard for "servlet compatible ring handlers"
18:49cemerickaugustl: ah, only if you're using defservice et al.: https://github.com/mmcgrana/ring/blob/master/ring-servlet/src/ring/util/servlet.clj
18:49cemerickbeen a while since I was in that neighborhood
18:50augustlnice to see that there's something built-in for servlets at least
18:50ohpauleezSide-note - You forget how great controlled concurrency is once you have to go back to no concurrency :(
18:51BrainBaconaugustl: what server are you trying to deploy to?
18:52augustlBrainBacon: haven't gotten that far :) Just investigating how good friends ring and servlets are
18:53BrainBaconaugustl: I've been deploying to glassfish with clojure, I use a handler middleware in noir and I have a context lookup for getting resources
18:54BrainBaconaugustl: https://bitbucket.org/bajesse/it354/src/79da51a2f28c/src/it354/server.clj
18:54BrainBaconaugustl: you can see the fix base url middleware there
18:55BrainBaconaugustl: https://bitbucket.org/bajesse/it354/src/79da51a2f28ccd372003b45dbad08670b74847b2/src/it354/views/utils.clj
18:56BrainBaconaugustl: there's a function to fix absolute resource path lookups called add-context
18:57augustltook me a couple of extra brain cycles to grok line 19+20 :)
18:58augustlsince the else wasn't on a separate line
19:07BrainBaconaugustl: Oh, and I almost forgot you have to register the handler with ring as well https://bitbucket.org/bajesse/it354/src/79da51a2f28c/project.clj
19:08BrainBaconaugustl: Anyway it comes out pretty nicely, you just use lein ring uberwar projectname.war and it will generate the package for you
19:21UrthwhyteSo I'm doing something very stupid and trying to map a function across a line-seq to try and parse some data
19:21Urthwhytedoseq would be preferred to doall, right?
19:25emezeskeUrthwhyte: doseq is for side-effects.
19:25Urthwhytethat was my understanding of the do* constructs
19:26Urthwhyteif I don't use some form of them my reader seems to close immediately
19:26emezeskeAre you doing something like with-open?
19:27Urthwhyteyea
19:27emezeskeA lot of people run into trouble using with-open -- the problem is if you use something like 'map, you might return a lazy sequence
19:27emezeskeAnd then elements of that lazy-seq are realized outside of the with-open, later on
19:28emezeskeAnd since you're outside with-open, the file is closed, and things blow up
19:28emezeskeSo you need to (by some means) ensure that you do all the I/O inside with-open, and don't return a lazy-seq that depends on the open file
19:28Urthwhyteahh
19:28Urthwhyteof course
19:29UrthwhyteThis is a ~10k text file where having everything in memory is fine, it's just me trying to get used to doing things idiomatically
19:29emezeskeDepending on what you're doing, doall might be appropriate for that
19:30UrthwhyteI just totally blanked on thinking map would return anything other than a lazy-seq
19:31UrthwhyteThanks for the help :)
19:31emezeskeHTH.
20:49holohi
20:49holoanyone here uses tools.cli actively?
20:50holoit's getting me crazy, this lib. i just.. don't get it
20:50emezeskeIs there a specific problem you're having, holo?
20:51holoemezeske, this doesn't work: (let [[options args banner] (cli ["-f" "--faux" "bar" "The faux du fafa"] ["--help" "-h" "Show help" :default false :flag true])])
20:52hololike most combinations, i get something like: Exception in thread "main" java.lang.RuntimeException: java.lang.Exception: '-f' is not a valid argument
20:54emezeskeThat error message is unhelpful
20:54emezeskeI notice that neither of the vectors you pass to cli seem to be in the format described in the README
20:54emezeskeIn the first vector, it looks like there are two description strings?
20:55emezeskeAnd in the second vector, the docs say the -h switch should be before the --help switch
20:55holomy observational skills suck
20:55holobut regarding the "-h", it was before, that was just an experiment to check if something would come up
20:56emezeskeDoes the error persist if you correct the two things I pointed out?
20:58holoemezeske, yes, the error still persists. anyways, that "foo".. i wonder why i put it there, it kind of pisses me off such obvious event after many hours
20:59emezeskeholo: So, the next thing I observe is that cli's first argument is supposed to be the argv vector passed to your program
21:00holooh... now the docs start to make sense
21:00holoemezeske thanks ^^"
21:00emezeskeHTH.
21:02emezeskeholo: It's kind of a bummer that the tools.cli README doesn't at least hint about where the program's arguments might come from
21:02casionwhen using a binding with &, is there a way to unroll it in place?
21:03casione.g. ((fn [& t] [[1 2] (vector t)]) 1 2 3 4) return [[1 2] 1 2 3 4]
21:03holoemezeske, actually i was kind of ovelwhelmed why there were some random "some" "--extra" "argument" in there. but my bias was strong, so i couldn't see through it
21:03emezeskeholo: :)
21:03casionthe actual code I'm dealing with is https://www.refheap.com/paste/5493 for more context
21:04emezeskecasion: ##((fn [& t] (conj t [1 2])) 1 2 3 4)
21:04lazybot⇒ ([1 2] 1 2 3 4)
21:05casionemezeske: see the refheap, I need tags to be "unrolled", I can't think of a better word atm
21:06casionI'm struggling with how to even phrase my question, apologies if I'm not being totally clear
21:06emezeskecasion: Does my snippet above not do what you want?
21:06casionemezeske: it does not
21:06casionemezeske: I guess it was a bad example to give, the refheap link makes it clearer I hope
21:06emezeskeWell, the refheap doesn't show me what you want returned
21:08casionI'd like (tag-in-track xf uid :one :two :three) to be (select xf [[:MediaTrack (has [(attr= :uid uid)])] :one :two :three])
21:08casionrather than (:one :two :three)
21:08casionI was hoping there was a way to do it without making a macro of it
21:09emezeskeMy example above is what you want, I think
21:09amalloyi think he just wants apply
21:09emezeskehaha
21:09emezeskeamalloy: I can't see the forest for the trees :)
21:11casionI don't understand how I'd use apply in this situation
21:18akhudekI've noticed that most of the clojure validation libraries simply validate a map by key and return a set of errors
21:19akhudekHowever, I've found that I often want a "fail on first error" type behaviour.
21:19akhudekHow do others solve this?
21:34casionok, so the solution was indeed conj
21:35casionI didn't realize [& x] would be a list and conj would prepend to a list, so I ended up doing it in reverse order
21:43casionI'm actually very confused as to why this works now
22:32FrozenlockLein deps fails with congomongo https://clojars.org/congomongo. Apparently the java-driver isn't found. How can I manually use it in my project?
22:33cshellwhat version are you using?
22:33Frozenlocklein or congomongo?
22:33cshellcongo
22:33Frozenlock0.1.10
22:34cshelladd [org.mongodb/mongo-java-driver "2.7.3"]
22:34cshellto your project
22:34cshellthat might not be the latest version, but it's what i use
22:38FrozenlockThanks, I'll try it immediately!
22:41FrozenlockOh wait I have that. I must have screwed somewhere; lein deps also gets me congomongo 0.1.7, which requires mongo-java-driver 2.6.5 (missing).
22:50AustinYunis there any way to get pprint as a function that returns a string?
22:52tmciverAustinYun: not sure if there's a better way, but you could use ##(doc with-out-str)
22:52lazybot⇒ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
22:52xeqi&(with-out-str (clojure.pprint/pprint {:a 1 :b 2 :c 3}))
22:52lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
22:52SgeoIf I have a library in .NET that I want to use, should I try to get a ClojureCLR environment working, or should I try to use jni4net?
22:58gertohpauleez: thanks for the quick reply to my shoreleave pubsub question!
22:59ohpauleezgert: No problem, more than happy to help
22:59ohpauleezAnd I know I've lacked a lot on the documentation
22:59gertI think shoreleave is very promising. I'm planning to use it in production. :)
22:59ohpauleezI think you may have found a bug, but it's easy enough to patch (having apply dispatch correctly)
23:00gertglad I could help by breaking it
23:00gert;)
23:00ohpauleezI have four systems in prod - two used an earlier first, two used the version that was released
23:00ohpauleezWe don't use atoms for state a lot (we just switched over to that camp actually), so there is a chance that the pubsub is choking on it
23:01gertah yeah. I started out with Clojurescript pretty much from scratch, and had my own data-binding thing going on with atoms and watchers
23:02gertnow that I have a little more understanding it's easier to start using shoreleave. I love the idea of chaining (the subscribe-> function)
23:02ohpauleezyes, it's something we have working internally, just need to polish it up
23:03ohpauleezwe inevitable do exactly what your examples does
23:03gertwhat kind of application are you using it for?
23:03ohpauleezt1 -> t2; t2 -> t3; ...
23:03ohpauleezso subscribe-> would be nice
23:03ohpauleezgert: Are you going to the conj?
23:03gertI wish!! I'm in New Zealand though
23:04ohpauleezoh right! I saw your site - ok. Here are some spoilers
23:04gertI love spoilers! :)
23:04ohpauleezthe first system we built joins Google Map queries with SOLR queries, then hits our DB and calls and API server
23:05ohpauleezto search, filter, and analyze *things* in our DB
23:05gertnice one! that sounds interesting
23:05gertare Conj talks going to be online?
23:05ohpauleezbut we wanted to test the theory: Can we put everything into dedicated servers and on a CDN, then run the app all on the client
23:05ohpauleezthey're always recorded
23:06amalloygert: eventually. last time it took around four months for them to all get up, maybe?
23:06ohpauleezand another one is a port of an existing Python system, to a mostly CLJS system, with project and code metrics
23:06gertI'll try to be patient. New Zealand is awesome, but it's so far away from where all the Clojure goodness is happening
23:07gertsounds good ohpauleez. I started building a frontend with Compojure, but client side apps are a lot more pleasant to program. Wrangling stateless http into something faux-stateful is just no fun
23:09ohpauleezI've found CLJ/CLJS to be a HUGE success - less effort, more flexibility, easy extension, shorter timelines, more dependable, better capacity
23:09gertI'm sold yes!
23:09ohpauleezthan say a standard Python app, running on wsgi behind NGINX, with raw JS on the client
23:10gertI used Sproutcore (now Ember.js) before, but yeah.. javascript. :) With a backend in Clojure it makes sense to use Clojurescript
23:12ohpauleezfor sure
23:14AustinYuni don't get why compojure.response/render takes two arguments
23:14AustinYunwait, is the second argument the request object?
23:15AustinYun(defprotocol Renderable (render [this request])) <-- why "this"?
23:17AustinYunok looks like i got it, nevermind
23:17gert"this" is a Renderable object