#clojure logs

2013-04-15

00:07thm_proveranyone here using shen.clj 0.1.6 ?
00:07thm_proverI can't even define a function when trying to follow http://www.shenlanguage.org/learn-shen/tutorials/shen_in_15mins.html#shen-in-15mins
00:07thm_proversomething looks broken
00:11amalloythm_prover: that article looks kinda badly written, and last i heard the effort to implement shen in clojure is far from finished
00:12thm_proveramalloy: I have the actual book "The Shen Language"
00:12thm_proverexamples from chapter 2 there also does not work on shen.clj
00:12thm_proverI'm using https://github.com/hraberg/shen.clj
00:12thm_provershould I be using somethign else?
00:12thm_proverit appears that basica + - * / and or works fine ... but it's define that does not work
00:12thm_proverand being able to define functions is sorta important
00:12thm_proverit also seems liek a superficial problem, i.e. a namespace clash of some sort
01:15llllhttps://github.com/drcode/webfui
01:15llllseems like a serious framework
01:16RaynesHad me at wingdings.
01:16llllwingdings?
01:25callenllll: new to computers huh?
01:26callenRaynes: the new hotness is to use unicode instead of wingdings :P
03:19ucbdoes anybody know if nrepl has a who-calls function?
04:21eriktjacobsenAnyone around that knows the internals of pmap / futures well enough to debug very odd behavior?
04:22ucberiktjacobsen: I'm not that well versed but I'm happy to lend a hand
04:23eriktjacobsenok, will try to explain. (actually tbh I can't even track it 100% to threading). I'm reading from a queue using bandalore, and I have a callback function that fetches some data based off the message, and processes those
04:23ucbok
04:24eriktjacobsenNow, when I run this callback by hand, a little odd behavior happens, namely the first 2 items in the pmap get run right away, then there is a 10-20 lag in std output , then all the items get processed and work correctly
04:25eriktjacobsenHowever, when I pass the callback through this "deleting-consumer" macro (which I'll post), ONLY the first two items run, and the rest never happen.
04:25ucbok
04:26eriktjacobsen(defn deleting-consumer[client f]
04:26eriktjacobsen (fn [message](let [ret (f message)]
04:26eriktjacobsen (delete client message)
04:26eriktjacobsen ret)))
04:26eriktjacobsenNow, obviously since my first two items run correctly, I'm inside the callback
04:27eriktjacobsenI can't fathom any way for that function "deleting-consumer" to affect execution INSIDE the callback (f)
04:27ucbis (delete...) thread safe?
04:27eriktjacobsenand yet, based on using it or not, either my first 2 items run, or all 500 of my items run
04:28eriktjacobsentbh, I'm not sure it is a bandalor library app, but since it doesn't get called until f returns, I don't see how it would affect the pmap inside f
04:28eriktjacobsenCould you cover how it might do that?
04:29ucboh, no, sorry, I was just wondering
04:29ucbbecause if you're pmaping deleting-consumer, then both f and delete should be thread safe
04:29ucbotherwise bad things will happen^tm
04:29eriktjacobsenYeah, I agree… however this is even for a single message and not wrapping it in a pmap
04:29ucbgotcha
04:31ucberiktjacobsen: would you mind pasting the code that calls (deleting-consumer...)?
04:31eriktjacobsenSure… This code WORKS 100%
04:31eriktjacobsen(map (comp channel/channel-callback :body) (cemerick.bandalore/polling-receive pipeline.queue.core/client (cemerick.bandalore/create-queue pipeline.queue.core/client "eriktest") :max-wait Long/MAX_VALUE :limit 10))
04:31ucberiktjacobsen: you said that manually running the callback f runs fine, but not when running inside deleting-consumer?
04:32eriktjacobsenThis code breaks 100% of the time (only gets first 2 items inside the callback fetch)
04:32eriktjacobsen(map (cemerick.bandalore/deleting-consumer pipeline.queue.core/client (comp channel/channel-callback :body)) (cemerick.bandalore/polling-receive pipeline.queue.core/client (cemerick.bandalore/create-queue pipeline.queue.core/client "eriktest") :max-wait Long/MAX_VALUE :limit 10))
04:32eriktjacobsenexactly
04:32eriktjacobsenthe only difference in the maps is the wrapping of deleting consumer, the (comp callback :body) is identical
04:34ucbwell, and that you're using the client in both places now
04:35ucbI'm now wondering more than ever about the thread safety of all this, it could well be (I know nothing about badalore) that you're running your callback on the same message more than once
04:36eriktjacobsenwell, that usage of client / deleting consumer is provided by the docs of Bandalore
04:36eriktjacobsenEven if I was running the callback more than once, how could it short-circuit the execution inside the callback?
04:37eriktjacobsenafaik, since it is suggested by the docs, doing a (pmap deleting-consumer polling-receive) is suggested and thread safe
04:37ucbwhat do you mean by shortcircuit?
04:37eriktjacobsenWhat I mean, is that once the callback is running, it should execute over 400 items. There are no points of early entry or exit
04:38eriktjacobsenit is executing over 2, and then it just stops
04:40eriktjacobsenthe callback simply fetches a rest api which yields 400 items, which are pmapped over a database save
04:40eriktjacobsenit is basically (pmap db/save (fetch message))
04:41ucbhave you tried a simple count fn with deleting-consumer?
04:41eriktjacobsenSo whether that is wrapped, determines if the pmap *inside* runs over 2 items, or 400
04:41ucbsomething like inc and @atom or something?
04:41eriktjacobsento see if it is running twice?
04:41eriktjacobsenI would be ok if the behavior was simply running twice… it would be inefficient but easy to explain / code around
04:43ucbnot necessarily, but rather to see whether it's to do with your code or bandalore's
04:43ucbto be honest with you, your explanation and the code you've shown me calls for a simplification of everything until you find what's breaking
04:43ucbin the sense that it all seems to make sense and that it should work, and yet it doesn't :)
04:43eriktjacobsenheh this is after like 8 hours of simplifying
04:44ucboh dear :)
04:44eriktjacobsenand the fact that this is what I'm left with is not where I wanted to be… where a simple wrapping function affects the innards of callback.
04:45eriktjacobsenAlright, so you suggest I throw an atom inside deleting consumer?
04:45ucbmore like having f be something like (fn [_message] (swap! some-global-atom inc))
04:48eriktjacobsenit runs the callback once
04:48eriktjacobsenatom is incremented exactly once per message
04:48ucbhum, eh? the atom has the right number in it?
04:48ucboh, right, yeah, so the callback is run exactly once, each time
04:49ucbsorry, misread that as "callback is run only once"
04:53eriktjacobsenIf there are any like…. REALLY basic things that I'm missing, I just started with clojure about 2 weeks ago
04:53ucberiktjacobsen: I don't see any obvious issues but I could be well wrong
04:53eriktjacobsenit just boggles me that flipping deleting-consumer on and off is what breaks it
04:54ucberiktjacobsen: considering that the inc callback does the right thing, then I'd look at your original callback to see what may be broken
04:54ucberiktjacobsen: is it throwing an exception anywhere perhaps?
04:54eriktjacobsenI don't believe so, but the inputs to the callback are identical, and the first 2 items run correctly
04:55eriktjacobsenis there anything about having the return referenced in a let vs going directly to the output of the highest-map ?
04:57ucbwhat do you mean?
06:06iwohey, can anyone help me with an xml-zipper problem?
06:07iwoI'm having exactly the same problem described here:
06:07iwohttp://clojure-log.n01se.net/date/2012-09-18.html#04:23c
06:07iwothis call: (xml-> my-zipper :sometag)
06:07iwocauses a NullPointerException
06:07iwoat clojure.zip$branch_QMARK_.invoke(zip.clj:73)
06:10iwoi'm using clojure.data.zip 0.1.1
06:10iwoclojure.data.xml 0.0.7
06:13Apage43i think data.zip chokes on the data.xml output on account of it being records instead of plain hashes. What happens when you just use clojure.xml/parse ?
06:17Apage43or rather, clojure.zip/xml-zip isn't -quite- compatible with the output of data.xml
06:17Apage43you could probably modify bits, but out of the box, data.zip and data.xml don't play together, at any rate
06:25babileniwo: I use clojure.xml/parse and pl.danliejanus.tagsoup/parse-xml just fine with clojure.zip/xml-zip and clojure.data.zip.xml/xml->
06:26babilen*danieljanux that is
06:26babilendanieljanus :-D
06:33iwoApage43: sorry, i realise that i _am_ actually using clojure.xml/parse
06:34Apage43ah
06:34Apage43in that case that -is- weird
06:34iwothe strange thing is, this works perfectly well locally buy when we deploy it doesn't work
06:34iwothe only difference: java 1.6 update 31 vs java 1.6 update 24
06:35Apage43perhaps something is causing xml/parse to fail. If the XML file has a DTD and it can't fetch it perhaps
06:35Apage43can you successfully parse an xml file in the repl on that configuration?
06:37iwohmmm, not sure what would be the easiest way to create a repl on this server
06:37iwothe xml has no dtd...
06:38iwothe thing is, the parsing seems to work well but it's the zipper that has a problem
06:38iwoclojure.xml/parse completes successfully (is it lazy?)
06:38iwooh, i guess it's sax, so it's lazy
08:05_francis_(source ns-publics)
09:34berdarioHi, I was thinking of writing a test like this
09:35berdario(is (= [1 whatever 3] [1 (gensym) 3])
09:35berdariothat is, I only care about the first and third element of the vector...
09:36berdarioI could destructure it, but I think it's easier/cleaner if I just supply it a second argument "whatever", that always equals to true...
09:36berdarioI was thinking of using a mock to create "whatever", but apparently it isn't mantained anymore
09:36berdariowhat do you suggest?
09:36ro_stmidje has an anything keyword. checkout what the do?
09:37berdario"checkout what the do?" ? btw I'll look into midje, thanks
09:37ro_sts/the/they
10:33ucbcan anybody recommend a library for mock testing?
10:41cldwalkerucb: somebody's made clojure.contrib.mock https://github.com/EchoTeam/clj-mock, you could also try https://github.com/amitrathore/conjure
10:41cldwalkers/made/ported/
11:07arrdemis ^:depricated a thing?
11:08arrdems/depricated/deprecated/
11:10technomancyucb: just use with-redefs
11:33clgvarrdem: it is keyword metadata at least ;)
11:34arrdemclgv: heh it is valid metadata we'll see if it does anything tho
11:34clgvarrdem: I do not think the compiler handles it by printing warnings or surch
11:35arrdemclgv: ok that's what I was afraid of. the dev list only mentions it in the context of javadoc generation.
11:40aaelonyhey clojure community, I'm trying to use a local jar file for the Vertica database. I have the driver file locally, which I've tried to set up a local maven repo for, but still encountering "SQLException No suitable driver found for jdbc:vertica". My project.clj contains a dependency for [vertica/vertica "4.1.13"], a line for :local-repo "local_maven_repo", and also :repositories {"project" "file:local_maven_repo"}. Any help
11:40aaelonyappreciated.
11:49mefestoaaelony: i haven't used it but i hear this is the way to go: https://github.com/kumarshantanu/lein-localrepo
11:50mefestoaaelony: also you can install a local jar file using maven directly: http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html
11:50aaelonymefesto: thanks, I'll give it a try. Much appreciated!!!
11:53mefestoaaelony: and for good measure here is leinigen's view on the matter: https://github.com/technomancy/leiningen/wiki/Repeatability
11:54aaelonymefesto: yes, I've seen that before, but encountering nonpublic, proprietary jars is a part of life, unfortunately :(
11:55nDuffaaelony: Sure, but having your nonpublic, proprietary jars not be in a nonpublic, proprietary repo is a sign of sloppiness.
11:56nDuffaaelony: Repeatable builds are still important for purely in-house artifacts.
11:56aaelonynDuff: I agree. I'm just trying to connect to a data warehouse...
12:04aaelonyhmmm, no problems with the lein localrepo install command, but still getting the "SQLException No suitable driver found" error message.
12:11technomancyaaelony: setting :local-repo and :repositories to the same place doesn't really make sense
12:12aaelonytechnomancy: yeah, I'm in the dark as to what the actual setting needs to be.
12:13technomancy:local-repo is if you want to use another directory as the local cache instead of ~/.m2
12:14aaelonytechnomancy: I see. I just pointed the lein localrepo install command to the current location of the jar file
12:15aaelonyI had tried this (https://gist.github.com/stuartsierra/3062743) a few week's ago, that is how the file got there
12:16aaelonyunfortunately, it hasn't yet resolved the issue though, and doesn't find the jar file at runtime
12:30arrdem,(doc alter-var-root)
12:30clojurebot"([v f & args]); Atomically alters the root binding of var v by applying f to its current value plus any args"
12:31arrdem,#'*foo*
12:31clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: *foo* in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:33papachan,(doc pprint)
12:33clojurebotIt's greek to me.
12:33arrdempapachan: clojure.core.pprint is the namespace, /pprint is the main function
12:34papachanarrdem ok
12:34arrdempapachan: clojurebot may or may not have those symbols (:required) so I don't think he can ,(doc) em
12:34arrdems/symbols/vars
12:34SegFaultAXarrdem: The namespace is actually clojure.pprint
12:35arrdem-________-
12:35arrdemyou'd think I'd remember it for all I use it..
12:35SegFaultAX,(map resolve (apropos "pprint"))
12:35clojurebot()
12:36SegFaultAXDoesn't look like the namespace is referred.
12:36SegFaultAX,(use 'clojure.pprint)
12:36clojurebotnil
12:36juhu_chapaHi all! What is clojure's equivalent to java Object.class?
12:36SegFaultAX,(map resolve (apropos "pprint"))
12:36clojurebot(#'clojure.pprint/*print-pprint-dispatch* #'clojure.pprint/pprint-indent #'clojure.pprint/pprint #'clojure.pprint/with-pprint-dispatch #'clojure.pprint/pprint-newline ...)
12:36arrdemjuhu_chapa: &(doc class)
12:37juhu_chapaarrdem: Thank you!
12:37papachancool
12:37cmajor7is there a way to parse UNR/URI route by Compojure? e.g. "http://context/aaa:bbb:ccc&quot; to get a "ccc" as param? (Compojure uses [clout] colon internally, hence the question)
12:38abeaumontx
12:38abeaumontops, sorry
12:40SegFaultAXcmajor7: You can use regex to match any portion of the URI.
12:41SegFaultAXhttps://github.com/weavejester/compojure/wiki/Routes-In-Detail
12:41SegFaultAX["/foo/:weird" :id #
12:42SegFaultAX["/foo/:weird" :id #"\w+(:\w+){2}"]
12:42SegFaultAXExcept :id should be :weird.
12:44AnderkentSo, after the 20th time today I forgot to initialize a set to #{} and then wondered why (conj a-set :item) (contains? a-set :item) was false, did anything happen with the idea of optional typing for clojure?
12:45arrdemAnderkent: conj defaults to a sequence and (contains?) explicitly operates only on search structures not seqs
12:46AnderkentI know
12:47ucbtechnomancy: that's what I'd normally do, yet I need to mock a client inside a let, e.g. (let [c (some.ns/client)] (do-stuff c data))
12:48Anderkentarrdem: actually, if it 'explicitly only operated on search structures', I wouldn't have wasted so much time - it throws an exception 'tried to run contains? on ()', I immediately know what's wrong
12:48Anderkentbut it doesnt do that, it just returns false
12:49Anderkentmuch harder to notice you did {:id-ste #{}} instead of {:id-set #{}} somewhere else ...
12:50technomancyucb: I don't follow
12:51ucbtechnomancy: I can't really use with-redefs if the function I'm testing has the following structure: (defn f [args] (let [c (some.ns/client)] (do-stuff c args)))
12:51ucbtechnomancy: or can I?
12:52technomancyif there's a reason that won't work, it's not obvious from what you've pasted so far
12:52Anderkent(with-redefs [some.ns/client (fn [] my-mock-client)] (f)) should work
12:55ucbAnderkent: thanks for the example, for some reason I wasn't extrapolating to redef'ing ns/fn and to just redef'ing local fns
12:55ucbtechnomancy: thanks
12:55ucbAnderkent: thanks!
12:55ucbtechnomancy: here's an exclamation mark for you too: !
12:57SegFaultAXtechnomancy: Are you aware of any benchmarks for Jetty on Heroku using ring.jetty.adapter?
12:58technomancySegFaultAX: not aware of any, no
12:59SegFaultAXtechnomancy: Is that the preferred application server on Heroku?
12:59technomancySegFaultAX: yeah, jetty is your best bet
13:00technomancyI/O is pretty variable on EC2 and Heroku by extension
13:00technomancyso you'd have to have a pretty large sample size
13:00SegFaultAXDo you support other Java containers? Tomcat, for instance?
13:01Anderkent-> / #() interaction is really suboptimal :(
13:01technomancySegFaultAX: of course; anything that runs on Ubuntu and responds to HTTP requests is fair game =)
13:02technomancyI don't think any of the advantages of tomcat would actually apply on Heroku though
13:02technomancysince we do containerization on the process level
13:03technomancybut I've never used Tomcat; so who knows
13:03SegFaultAXtechnomancy: Do you pretty much always stick to Jetty? Even outside of Heroku?
13:04technomancySegFaultAX: you mean me personally? I've only deployed like two web applications in the past 5 years.
13:04SegFaultAXOh, heh. :)
13:05technomancyfrom what I gather, jetty is best unless you need 0) async or 1) integration into an existing Java ops environment
13:05technomancybut I'm not an expert on the subject
13:06cpoiletechnomancy: is there a preferred front-end http server for load balanced, port mapping, serving static resources, etc. on Heroku? (or do you even need one?)
13:07technomancycpoile: load balancing and port mapping are done for you
13:07technomancyjetty is fine for static resources, but you can use a CDN too if jetty doesn't cut it
13:08technomancynginx might be slightly better, but not enough to justify the extra complexity vs bang-for-buck of a CDN
13:08Anderkentcpoile: as a reference, we're running a heroku app with aleph by simply doing java -jar ... So unless you're worried about performance, getting started is pretty easy and you don't need a container.
13:08cpoileso, you could have a couple jvms, each running jetty, one mapped to: mydomain.net/app1, the other to mydomain.net/app2?
13:09technomancycpoile: typically you'd use separate subdomains for that
13:10kanweiis jetty event-based?
13:10cpoiletechnomancy: but then it would be on the same jetty/jvm? I'm just trying to figure out how to have apps isolated so that one misbehaved app doesn't bring down the other when I have to restart the jetty instance
13:11technomancycpoile: separate subdomains would be separate JVMs
13:12cpoileAnderkent: does that mean your app is running on, say, 8080, and everything else is handled for you by Heroku?
13:12SegFaultAXIs it viable to host multiple sites on a single Dyno given the memory limitations?
13:12Anderkentcpoile: heroku tells you which port to bind via environment
13:12cpoiletechnomancy: ah, okay
13:13Anderkentwell, I lied a little, I think aleph uses netty or whatever under the hood, so there is a container, but I'm not touching it
13:13Anderkentyou could of course do the http chitchat manually, if you wish :)
13:13technomancySegFaultAX: impossible to say without details
13:13muhooyes it uses netty whiich uses nio
13:13technomancymemory usage varies hugely
13:15cpoiletechnomancy, Anderkent: thanks
13:21noncomhi! anyone heard of official clojure -> android port? i remember Rich was saying something, and there was a REPL of clojure-1.4.0 port to android, but nothing since then.. silence.. anyone knows anything?
13:23arrdemcemerick: found your old post on binding and lazy seqs, thanks!
13:24rasmustoam I weird for trying to use the function "filtercat"?
13:28bbloomrasmusto: why would that be weird?
13:28bbloomrasmusto: although i may prefer a `clojure.core/for comprehension with a :when clause
13:29rasmustobbloom: well, filtercat wasn't defined. I guss the for comprehension does the same thing (and is more flexible)
13:29alexnixonor just use mapcat and pass a function that returns nil for some elements
13:29rasmustoalexnixon: ah, mapcat skips nil ? that's good to know
13:30alexnixon,(concat '(1 2) nil '(4 5))
13:30clojurebot(1 2 4 5)
13:30rasmustoalexnixon: cool, thanks :)
13:30Anderkentwell, nil is an empty list, it makes sense for concat '(1 2) '() '(4 5) to give you back '(1 2 4 5) :)
13:38noncom(+ 1 2)
13:38clojurebot3
13:38noncom(def bot "hi!")
13:38alexnixonAnderkent: I don't think it's quite right to call nil an empty list, though they often behave similarly
13:38arrdemnoncom: clojurebot's sandbox doesn't allow for vardecls
13:38noncom(println bot)
13:38noncomheh
13:38arrdemnoncom: also you want ,( <expression> ) for clojurebot
13:39noncomi think that all that hassle around truths, falses, nils and empty lists is because ppl can't agree on what they mean
13:39noncomarrdem: yeah, that's exactly what i was testing!
13:42alandipertnil isn't a list, but (seq nil) is nil and thus all is right in the world
13:44kanweidoes anyone have advice for refactoring a "parser" like function that has a lot of "recur"s? https://gist.github.com/kanwei/e2c0415eb118ee79e4f1
13:45kanweibecause of immutability I feel like I have to repeat myself a lot
13:45kanweisince i can't progressively "edit" a map
13:45alandipertkanwei: you can via reduce (starting w/ empty map)
13:46alandipertkanwei: could be trixty though because of data being variadic, maybe involve a first pass to group ops and their args
13:47kanweialandipert: yeah that's the problem i was having
13:47Anderkentwell, it seems like every time you're just looking at one line
13:48Anderkenta reduce should fit straightforwardingly
13:48Anderkentgive me 1 s
13:49kanweiit's a bit tricky Anderkent
13:49kanweii'm trying to parse https://gist.github.com/kanwei/eb6b7376498a7ce28035
13:49kanweithe "info" parts can easily be reduced
13:49kanweibut the "play" parts, order matters
13:49Anderkentsure
13:50Anderkentbut you're still looking at a line at a time
13:50kanweii guess i can have an accumulator inside the accumulator map
13:50kanweifor stuff that needs order
13:51Anderkenthttps://www.refheap.com/paste/13646
13:51Anderkentthat look right?
13:52Anderkentthen of course if you want to add new opps easily, you could make step-game dispatch to a multimethod based on the op
13:52Anderkentthus allowing you to add support for more commands by simply declaring extra methods
13:55kanweiwow that's a lot better Anderkent, thanks!!
13:56lynaghkcemerick: is there a nice way to just set friend's *identity* so that I don't have to walk through the authentication workflows during, e.g., tests?
13:57cemericklynaghk: binding, with-redefs, etc
13:57lynaghkcemerick: okay, yeah, I wasn't sure if that was the proper way to go about it or if you had a helper somewhere
13:57cemerickIdeally, you're passing the identity along explicitly ;-)
13:58cemerickarrdem: :-)
13:58lynaghkcemerick: yeah dude, it's in the giant config to the fn that returns the ring handler =)
13:58cemericklynaghk: nah, at runtime
13:59lynaghkcemerick: not sure I follow, then. I'm just throwing a middleware in that rebinds *friend/identity*
14:02cemericklynaghk: I mean, in your app, you should ideally not refer to *identity* ever. Its value is always in each Ring request. The more you can eliminate use of dynamic bindings like that, the easier things are to test.
14:03lynaghkcemerick: I'm only referring to it so I can rebind it. My use case is wanting to return a ring handler where all requests are already "logged in" so that I can use that handler for testing
14:04lynaghkcemerick: I can't just remove the friend middleware entirely in those cases, since my routes use friend/authorize
14:05cemericklynaghk: oh, this is full functional testing, i.e. having a dummy client tickle the app through HTTP, etc?
14:06cemerickBut, yeah, I painted people into a bit of a corner with friend/authorize
14:06lynaghkcemerick: yeah
14:06lynaghkcemerick: also doing interactive development where I'm restarting the server often and want to just have "development mode" always start the server as a logged in user
14:07lynaghkso I don't have to keep going through the form workflow
14:14kanweiis there anything more idiomatic for adding something to a vector inside a map, while returning the updated map?
14:14kanwei(assoc game :plays (conj (:plays game) data))
14:15arrdemkanwei: update-in
14:16arrdem,(update-in {:name "arrdem" :plays ["mwo" "scII" "HoTS"]} [:plays] conj "LoL")
14:16clojurebot{:name "arrdem", :plays ["mwo" "scII" "HoTS" "LoL"]}
14:17kanwei(update-in game [:plays] conj data)
14:18kanweihmm cool thanks
14:19kanweiso I can process 15Mb of csv files in less than half a second, not bad :)
14:20arrdem:D
14:20arrdem'course you could cut that down to a few tenths if you used lex and yacc... but I can't recommend it
14:24Luyt_I once made a very quick CSV parser (in C) it would load in the CSV file into a buffer, make one scan over it, and leave pointers to the fields, and place \0's in the buffer where the fields ended
14:25Luyt_so, no copying of string data involbed
14:25Luyt_involved*
14:25jweissmy code has a ref that is being watched (using add-watch) for changes. One of the fields is a promise. But delivery of the promise does not show up as a change to the ref. So now what? Do I need to remove the promise and implement polling on that place in the ref myself?
14:26arrdemLuyt_: oh cute! so you got an array of string pointer linked lists out?
14:27Luyt_arrdem: If I remember well, I realloced the string pointer arrays when necessary (doubled the number of entries). There were no linked lists involved, but you could implement it with linked lists.
14:29Luyt_also, since I had advance knowledge about the size of the CSV files, I could hint my lib to pre-allocate 'big enough' pointer arrays. The realloc mechanism was only used in unforeseen exceptional situations.
14:47noncomso no one knows anything about clojure on android?
14:48SegFaultAXnoncom: I don't really think it's viable right now.
14:48n_bnoncom: Checkout out nightweb; IIRC hte author documented his experiences
14:48SegFaultAXnoncom: Persistent data structures in particular don't jive well with the whole "don't create a shitload of temporary objects" mantra of Android land.
14:49Luyt_SegFaultAX: Does Scala suffer from the same?
14:49noncom:D
14:49Raynes$google lein-droid
14:49lazybot[alexander-yakushev/lein-droid · GitHub] https://github.com/alexander-yakushev/lein-droid
14:49SegFaultAXLuyt_: Scala has mutable variants for all of its primary data structures.
14:49SegFaultAXLuyt_: And to some extent you could use transient data structures in Clojure to ameliorate the problem.
14:49SegFaultAXLuyt_: But there are other technical limitations at play as well.
14:50trptcoline.g. the `for` macro blows the stack :)
14:50Luyt_I understand why clojure developers want to escape the Java staightjacket
14:51Luyt_Did I say 'clojure developers'? I meant 'developers who'd like to use clojure'.
14:51amalloyjweiss: you can block on the promise separately
14:52noncominterestingly enough, the nightweb project.clj depends on [android/clojure "1.5.0"]
14:52noncomthat one is on clojars
14:52dnolenSegFaultAX: from what I've heard, the GC issue on Android is less problematic than app startup time - and I know this is something under consideration for future versions of Clojure.
14:52noncomso looks like something is going on there
14:52SegFaultAXIn my opinion the main issue is that using Clojure incurs a significant amount of incidental overhead. Or at least significant WRT devices limited in CPU, memory, and most importantly of all, battery.
14:53amalloyassuming that the promise itself isn't changing also, something like (future (notify-delivery @(get @the-ref :the-promise)))
14:55stuartsierrajweiss: A watch on a Ref does not get invoked when another mutable thing contained in the Ref changes.
14:56stuartsierraWatches are only invoked when the state of the Ref itself changes, e.g. with `alter` or `ref-set`.
14:56jweissstuartsierra: yeah i know :)
14:57SegFaultAXjweiss: Your original comment indicated that this was surpising behavior to you.
14:57jweissno i am not surprised, i had just accidentally coded it that way without realizing the implication until i saw my program not doing what i expected.
14:58jweissi use the promise because other part of the code needs to block on that particular piece of data
14:59jweissso in order to get both the watcher responding to the change AND the blocking behavior, was wondering if i had to implement the polling myself\
14:59amalloyjweiss: polling is definitely crazy
14:59amalloypromises exist to block on
14:59stuartsierrajweiss: You could do that. Or you could have whatever code which fulfills the promise also modify a Ref that you're watching.
15:00SegFaultAXCan promises have watches?
15:00jweissyes
15:00jweissat least i think so
15:00SegFaultAXadd-watch only lists agent, atom, var, and ref
15:00stuartsierraClojure's Promises do not support watches.
15:00jweissah
15:00jweisswell, anyway it wouldn't make sense
15:00jweisssince it only changes once
15:01noncomso considering the problems that clojure currently faces on android, what do you think about using clojurescript instead? seems like no problems should be there..
15:01stuartsierraSome kind of callback for Promises is under discussion for Clojure 1.6.
15:01SegFaultAXjweiss: So?
15:01jweissSegFaultAX: so if you want to watch it just use a future
15:01SegFaultAXstuartsierra: Then what's the problem?
15:01SegFaultAXjweiss: ^
15:02stuartsierraSorry, not understanding your question SegFaultAX.
15:02jweissSegFaultAX: i have one ref and a large number of promises
15:02jweissi wanted to just watch the ref and get ALL the updates.
15:02cpoilenoncom: search for clojurescript phonegap, I was looking at a github repo doing this just recently
15:02jweissnot add watches to hundreds of promises
15:02stuartsierrajweiss: I have an experimental library at github.com/stuartsierra/cljque that attempts to provide this capability.
15:03stuartsierrajweiss: Google Guava also has ListenableFuture.
15:03amalloyhuh. how are you using hundreds of promises now? the only way i can think of would be to have hundreds of threads listening on them anyway
15:03jweissi guess i will have to separate the data that gets blocked on , and the data that gets watched. using stuartsierra's original suggestion
15:03SegFaultAXstuartsierra: Any idea if the callback system in 1.6 is going to be like your cljque work?
15:03stuartsierraSegFaultAX: Don't know.
15:03noncomcpoile: looks like it's bout 2 yrs old )
15:04jweissamalloy: well, not all of them get listened to immediately
15:05jweissso in reality only a handful are being watched at any given time
15:05cpoilenoncom: that's good news, because both of the core libraries (clojurescript and phonegap or whatever it's called now) have advanced a lot since then. :)
15:05jweissthis is a test execution harness, so there's promises being watched for each thread of test execution
15:06jweissso that tests that depend on the watched test can be queued
15:07stuartsierrajweiss: If all you need to do is block, you might be able to use a java.util.concurrent.CountDownLatch.
15:07jweissstuartsierra: that doesn't really solve the ref watching problem though, still a mutable object right?
15:08stuartsierrayes
15:09amalloyjweiss: i wonder if a lamina channel might be a better structure than a promise, if the project is flexible enough to make that change. you can register callbacks on those without tying up any threads
15:10jweissamalloy: i'll take a look, threads are cheap enough, but worth a shot
15:10amalloyhundreds of threads aren't cheap :P
15:11jweissamalloy: as i said, it's only a handful of threads at a time
15:11jweisswhen a test completes, the promise is delivered. that watch thread exits, a new test starts, and a new watch thread is created
15:11arrdemamalloy: the four year old laptop that hosts my blog defies you sir. I think I've dropped about 5k simultaneous futures and not managed to push it over.
15:12SegFaultAXLamina looks pretty cool!
15:12jweissi think on some systems you'll hit the process limit
15:12jweissbut that can be raised with no problem
15:13SegFaultAXJust because you can do it doesn't make it cheap.
15:14jweisshuh, thanks amalloy lamina seems pretty well suited to what i'm trying to do
15:15jweiss"Lamina also provides mechanisms to instrument code" <- seems especially interesting for a test harness that needs to track execution time, tracing, screenshots etc
15:15amalloysweet, two converts. my side business shilling for ztellman is going well
15:19SegFaultAXAnd here he is. ztellman must have known we were talking about Lamina.
15:19ztellmanha, no, should I check the logs?
15:20jweissztellman: i was trying to fix a problem in my test execution harness, lamina seems like a good solution for not only that but several other things i was trying to do.
15:21cpoilequestion for anyone: what is the current state of clojure web app development? Has much changed since: http://brehaut.net/blog/2011/ring_introduction ? (Pedestal, but is that about it?) As in most/all apps are still using the ring ecosysem? (which is fine, I'm just curious)
15:21ztellmanjweiss: well, if you have any questions, feel free to email me or the aleph mailing list
15:21Luyt_cpoile: I'm also curious how these clojure webapps are deployed. Behind nginx and gunicorn?
15:22Luyt_Does ring run compojure apps multithreaded?
15:23SegFaultAXLuyt_: Ring doesn't really anything related to running apps.
15:24cpoileLuyt_: from what I understand, any deployment scenario that works for a java servlet works for Ring-based apps (Jetty, bigger containers, behind nginx, you name it)
15:27Luyt_compojure -- ring -- jetty -- nginx -- internet <--- is that correct>
15:27Luyt_?
15:27amalloyLuyt_: ring has adapters to the various java http servers. jetty is the most common adapter to use, and so ring apps are usually run multithreaded
15:28Luyt_LIke what gunicorn does for django and flask apps, I guess?
15:29SegFaultAXLuyt_: No, gunicorn is an application container. Ring is just provides Clojure adapters for existing Java HTTP servers.
15:29Luyt_Ohhhh...
15:30SegFaultAXLuyt_: I can't really think of a good Python analog for ring. WSGI is probably the closest thing, but that's still not entirely accurate.
15:30Luyt_Suppose I've written a compojure webapp which I want to put in production. How do I do that, given that I want to suffer as little as possible under heavy configuration files?
15:31SegFaultAXhttps://github.com/ring-clojure/ring/wiki/Getting-Started
15:32SegFaultAXLuyt_: You literally just need one call to ring.adapter.jetty/run-jetty with your Compojure handler and a few options.
15:32Luyt_(run-jetty ...) will launch a production-ready webserver?
15:33SegFaultAXLuyt_: You'll probably need to tune the server based on your needs. For that, you have the :configurator option (just a normal function that receives the server instance) plus some other top level configuration.
15:33SegFaultAXLuyt_: https://github.com/ring-clojure/ring/blob/master/ring-jetty-adapter/src/ring/adapter/jetty.clj#L61
15:34Luyt_SegFaultAX: okie, and that'll make a webapp which can be reverse-proxied by something like nginx?
15:34SegFaultAXSure! Just a normal upstream {} with the correct host/port.
15:34SegFaultAXThen you can proxy to it as normal.
15:34Luyt_Cool. I knew it wouldn't be too hard ;-)
15:35Luyt_Thanks!
15:36jweissanyone seen a weird problem with nrepl.el 0.1.8-preview where it just suddenly pops up a compilation error as you are typing, even though you didn't ask it to compile or evaluate anything?
15:39jweissseems to be related to having something like (:refer-clojure :exclude (get)) in my ns decl.
15:39stuartsierrajweiss: I've seen that with older nrepl releases, but not recently.
15:40stuartsierraSomething to do with autocompletion I think.
15:40jweissyeah, just can't figure out why ac would cause compilation
15:51solussd,(cond-> "thing" string? :string)
15:51clojurebotnil
15:52solussdcond-> is part of clojure 1.5.1, right?
15:52solussdgetting this: IllegalAccessError cond-> does not exist clojure.core/refer (core.clj:3849)
16:02gfredericksis there any way to get nrepl-jack-in to do something with the :repl-options in my project.clj?
16:03SegFaultAXsolussd: Are you looking for condp?
16:04BufferUnderpantsHello
16:04BufferUnderpantsI have a question on Clojure records
16:04SegFaultAXBufferUnderpants: Ahoy
16:04gfredericks(defrecord Ahoy [])
16:04BufferUnderpantsHow do you perform apply is-a? against a record type?
16:05BufferUnderpantsFrom another namespace, I mean
16:05gfredericksrecords are regular jvm classes
16:05gfredericksso you can :import them
16:05BufferUnderpantsOh, that's how
16:05BufferUnderpantsI suspected it, because it worked if I used the fully qualified name
16:05BufferUnderpantsThanks
16:05gfredericksyeah that's the other approach
16:05SegFaultAXBufferUnderpants: But are you sure you even want a record? Is it possible a plain 'ol map will do ya?
16:06BufferUnderpantsSegFaultAX: I have some functions where I want to dispatch on type, but multimethods seem like they would obfuscate it a bit
16:07BufferUnderpantsSegFaultAX: some tree-traversal thing
16:08SegFaultAXBufferUnderpants: I'm not sure how it would obfuscate it. One nice thing about multimethods is that if someone is using your tree-traversal thingy, they can extend it with their own types trivially.
16:09bbloomSegFaultAX: that's also true of protocols
16:09SegFaultAXBufferUnderpants: That's also true of protocols!
16:09SegFaultAX:)
16:09BufferUnderpantsSegFaultAX: hadn't considered that scenario, I was thinking that having the code spread out would be less clear, besides seeming a bit overkill
16:10BufferUnderpantsAnyway, I settled on records after ending up with a mess after trying with good ol hash maps
16:10SegFaultAXOk
16:19solussdSegFaultAX: turns out it was some code I had 'requiring' cond-> from a pre-clojure 1.5 library I had.. it is, in fact, in clojure 1.4
16:19solussd*1.5
16:23SegFaultAXsolussd: Looks like they've added a whole set of pointy macros. cond->(>), some->(>), and as->
16:23solussdyeah, they're hot
16:24mthvedtthey should make a macro library to generate pointy macros
16:24TimMc"pointy macros", I love it
16:24ehaliewiczdoes anyone know of any good clojure tutorials or books for someone familiar with common lisp?
16:24SegFaultAXTimMc: I try.
16:25SegFaultAXehaliewicz: Joy of Clojure is pretty sweet. And a new version is coming out later this year!
16:25solussdthe grapist, i love it!
16:25mthvedtcond-> already looks a little like a monad
16:25mthvedtmaybe you can have something that does
16:25mthvedtmonad in, pointy macro out
16:25ehaliewiczSegFaultAX: thanks, i'll take a look at it
16:26SegFaultAXehaliewicz: Also http://www.clojurebook.com/
16:26SegFaultAXehaliewicz: Although the latter is also good for total beginners.
16:27mthvedtor just something like monad-> and monad->>
16:29SegFaultAXmthvedt: The former already has a name.
16:29SegFaultAXclojure.ago.monads/with-monad
16:29SegFaultAXalgo*
16:31mthvedtsegfaultax: yes, but with-monad isn't sufficiently pointy.
16:32ehaliewiczSegFaultAX: well, i hope it doesn't waste too much time covering the absolute basics, but again, I'll take a look at it. thanks :D
16:41gfredericksDo folk still use slingshot?
16:41SegFaultAXgfredericks: Only against interns.
16:41hiredmanyes
16:42gfrederickshiredman: I was surprised it doesn't seem very compatible with ex-info
16:42hiredmangfredericks: it should actually use ex-info if available
16:43hiredmanwhat do you mean by not very compatible?
16:43gfrederickshiredman: I was hoping the built in selectors would work against something thrown with (throw (ex-info {:foo :bar}))
16:44gfredericksah I see
16:44gfredericksthrow+ uses ExceptionInfo but wraps the object up further
16:44hiredmanyeah
16:44hiredmanwhich is kind of meh
16:44gfredericksI think I just want an ex-info-oriented try+ :/
16:44gfredericksfeels more idiomatic
16:46hiredmantalk to scgilardi
16:47gfredericksabout adding it to slingshot maybe?
16:47gfredericksshould be doable...throw+ adds metadata so it should be able to distinguish the cases
16:54solussdgfredericks: i use slingshot pretty much everywhere
16:55gfrederickshttps://github.com/scgilardi/slingshot/issues/35
17:34patbrownDoes anyone have any elastic beanstalk experience that can help me figure out how to get a hello world up, I don't think my problem is with lein-beanstalk, but rather setting up the amazon end?
17:37callenpatbrown: guess you should be in a channel for amazon stuff.
17:38patbrownYeah, I suppose so, I just prefer the weather in here.
17:39SegFaultAXpatbrown: Have you tried the EBS tutorial?
17:40patbrown:SegFaultAX The one I've seen is for eclipse, and I'm an emacs user
17:41SegFaultAXpatbrown: Huh? What does Eclipse/Emacs have to do with configuring elastic beanstalk?
17:41patbrownExactly, I click on the java tutorial and the instructions are all geared towards the integrated eclipse tool
17:42patbrownThere is no clojure tutorial, except I found http://www.ctdean.com/2012/04/10/aws-beanstalk-on-clojure.html but was missing something
17:43SegFaultAXpatbrown: You said your issue is on the AWS side. Is it just deployment or what?
17:43SegFaultAXpatbrown: I'm assuming you already have a war file.
17:44SegFaultAXpatbrown: For example: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deployment.newapp.html
17:45patbrownI've been attempting to deploy the war via cli, thanks for the link, I'll try to start over with a standalone.
17:46SegFaultAXpatbrown: FYI anything you can do from a plugin you can do via the CLI tools or API (and probably also the management console for that matter)
17:47SegFaultAXpatbrown: The plugins just integrate it into your development process. But once you understand how AWS deployment works you can wrap that up yourself with eg Capistrano or Fabric.
17:48patbrownDumb question, so I am better off ditching lein and using the ruby or python aws cli tool?
17:49SegFaultAXpatbrown: Depends, is there already a plugin that suits all your needs?
17:51SegFaultAXpatbrown: You said you looked at lein-beanstalk already. Does it not do something that you need?
17:51cljconner(take 1 (map #(do (print \.) %) (range)))
17:51cljconnerwhy does this print 32 dots?
17:51patbrownIt does everything I need, except work.
17:52patbrownWhich I assume is my fault.
17:52cljconneras in the stackoverflwo qn : http://stackoverflow.com/questions/12412038/in-clojure-are-lazy-seqs-always-chunked
17:52patbrownI'm just trying to figure out where
17:54SegFaultAXpatbrown: Can you clarify what you mean by not working? Does it provide an error message?
17:55patbrownNo, I'm not getting an error, I'm unable to update the 'current version' from the default instance to the war I deploy. I should have started with that
17:57SegFaultAXpatbrown: Were you able to do a first deploy?
17:59patbrownI didn't get an error message, but I also didn't get a new version added to my 'lein beanstalk info' response
18:00callenSegFaultAX: it's easy to confuse Elastic Beanstalk and Elastic Block Store if you spell it EBS btw.
18:00SegFaultAXcallen: I realized that the moment I typed it. :)
18:00SegFaultAXcallen: I don't know what the commonly used shorthand is, though. EBST?
18:00SegFaultAXI guess that's not really any better.
18:02SegFaultAXpatbrown: What's the output of `lein beanstalk info`?
18:14ToBeReplacedhow do people do batch getters/setters nowadays?
18:17Wild_Cat`ToBeReplaced: I'd say they don't.
18:17Wild_Cat`usually, the need for a ton of getters/setters means you're exposing the internal implementation details of your class rather than its behavior.
18:18ToBeReplacedthe issue is more for constructing new objects from existing java classes... for example a c3po ComboPooledDataSource... where there's about 20 properties you might reasonably want to set
18:21patbrown:SegFaultAX Thanks for all your help. Embarrassment ensues. It turns out that I didn't migrate from jetty to tomcat the right way. Change one function and "hello world"
18:22technomancyfun fact: did you know that Tomcat was named after the animal on the cover of the O'Reilley book on Tomcat?
18:24AimHereYou mean they wrote theO'Reilly book before they wrote the language?
18:25technomancynot really, but they picked the name because they wanted to have a book with an animal on the cover
18:26technomancyhttps://en.wikipedia.org/wiki/Apache_Tomcat#History
18:26patbrownIf I ever write an O'reilley book, the resulting technology would be called Griffin with topless sword wielding three-boobed chick.
18:26patbrownShout out to Total Recall on the triboob
18:26AimHereI always assumed that the guy who wrote 'Falcon' did it purely because he wanted an O'Reilly book
18:26AimHere*named it
18:26technomancyunfortunately another project beat them to it re: the tomcat cover, so they had to settle with a snow leopard
18:30ToBeReplacedWild_Cat`: here is what i am using now https://www.refheap.com/paste/13654
18:37Wild_Cat`ToBeReplaced: OK, disregard my previous comment, I thought you wanted to batch-*define* getters and setters, not call them
18:38Wild_Cat`"this is bad design" doesn't help you at all when the comment refers to code you didn't write and can't modify ;)
18:49SirLalalahi guys! I'm playing with the new clojure/java.jdbc. Any hints on how to include a LIMIT BY?
18:49SirLalalafrom the docs I have order-by but no limit-by :(
18:51ToBeReplacedthe dsl is deliberately minimal and doesn't have LIMIT BY atm... check out honeysql if you want a more sophisticated sl
18:52hiredmanugh
18:52hiredmanbreaking java.jdbc by replacing it with a dsl just makes me mad
18:53SirLalalaI was actually fine with using the java.jdbc the way it was, it's that everything got deprecated
18:53hiredmanyeah
18:53hiredmanjava.jdbc was great
18:54gfredericksdynamic var hatin?
18:54brehautwait waht
18:55brehautall that DSL stuff is *instead* of the old api?
18:55SirLalalabrehaut: http://clojure.github.io/java.jdbc/#clojure.java.jdbc/with-connection
18:55SirLalalaIt says deprecated
18:56gfredericksyeah corefield was talking on the mailing list about removing the old stuff altogether for 1.0
18:56hiredmanugh
18:56brehauthis SQL DSL better be completely bulletproof :(
18:56hiredmantime to fork it so it remains not non-sense
18:56SirLalalaI mean the new stuff is supposed to be easier, but now I have no clue how to add a LIMIT BY
18:57ToBeReplacedi think the point is that he did away with all of the dynamic binding stuff and emphasizes you passing around a spec
18:58amalloywait, really? it looks from his clj-dev post that he's only removing the with-* macros, and functions that rely on the dynamic variables therein. he's surely not removing the main features of the library
18:58hiredmanand he replaced all the useful bits people use with a stupid incomplete dsl
18:58ToBeReplacedwhat useful bits are those?
18:59hiredmanhttps://github.com/hiredman/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L982-994 deprecated in 0.30
18:59hiredman0.3.0
19:00ToBeReplacedyou still have that with "query" i think
19:02amalloyyeah, or with https://github.com/hiredman/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L586
19:03amalloythe only feature sean is actually deprecating is the dynamic vars like *db*
19:04technomancygetting rid of the with-connection requirement is great
19:04amalloytotally
19:04ToBeReplacedi want the same thing for carmine ;)
19:07ehaliewiczhttp://pastebin.com/FscjzTgL
19:07ehaliewiczit's a direct translation from common lisp, but it's the first significant bit of clojure i've written
19:09nDuffehaliewicz: In the future, would you mind pasting to somewhere that isn't an eyesore to folks who aren't running adblock/noscripts/...?
19:10nDuffehaliewicz: ...our local favorite is refheap.com (itself written in Clojure).
19:11ehaliewiczhold on
19:13tieTYT2i have a screenshot of this at home which would probably be the best way to explain this but, I'm making a simple app with a file chooser and shortcuts to move the selected file into certain folders
19:13tieTYT2that way I can organize my files without drag and drop
19:13tieTYT2the shortcuts are configurable (eg: this shortcut moves a file into this folder). To me that seems like mutable state. What's a good way to implement this concept of a configurable folder/shortcut
19:24ehaliewicznDuff: https://www.refheap.com/paste/13657
19:25ehaliewicznever had a problem with pastebin, sorry about that
19:25RaynesnDuff is my entire marketing team.
19:26Raynesehaliewicz: It's fine. It's just that pastebin apparently has tons of ads for people who don't use adblock and what not. It also doesn't have the best Clojure support in the world either.
19:27ehaliewiczoh, i haven't run a browser without adblock in years, so i guess i never noticed :D
19:27tieTYT2basically I need a variable of a map with shortcuts as keys and a directory as a value. Do I just make the map an atom?
19:27RaynesSame here.
19:27nDufftieTYT: Unless you have a specific reason to use a different primitive, an atom is a good default.
19:28Raynesehaliewicz: Are you after code review?
19:28tieTYT2can I use a ^dynamic for this?
19:28tieTYT2nm, I don't think I could
19:29ehaliewiczRaynes: not really, I was just posting it for the hell of it. I'm sure there are issues with the code from a clojure perspective though
19:29RaynesWell, congrats on your first Clojure code.
19:29tieTYT2nDuff: I don't plan to have any concurrency in my app. An atom is still a good default?
19:29Raynes:)
19:29ehaliewiczeven ignoring the whole parsing a string-based dsl rather than sexp
19:29ehaliewiczthanks
19:30Raynesehaliewicz: The first thing that stands out is holyshitsomanymacrosomgomgomg. But you did say this was a translation from Common Lisp.
19:31RaynesAnother thing worth mentioning is that you should avoid using 'use' without the `:only` bit. Or, if using 1.4.0+, don't use use at all. (require '[clojure.string :refer [split-lines split trim]])
19:31nDufftieTYT: If this is a transient, local value, there might be a more appropriate way to deal with it, depending on the details (accumulating values in a reducer, or loop/recur, or what-have-you). If it's something you're putting directly in a var and changing over time, an atom remains a good default choice.
19:32RaynesIf you need to use a bunch of stuff from clojure.java.io and don't want to :refer it all, you can do (require '[clojure.java.io :as io]) and then refer to things like (io/reader foo)
19:32tieTYT2nDuff: what does transient mean in your context?
19:32ehaliewiczRaynes: the first two macros are actually pretty unecessary
19:32tieTYT2i think my variable is going to be a map. I'll assoc and dissoc it a lot
19:33ehaliewiczi didn't even write them really, i was just comparing the performance with my cl implementation and looking into type hints and stuff
19:33Bronsaehaliewicz: also you probably want to use `into` instead of `reduce conj`
19:34amalloyor just vec instead of the whole thing
19:34Bronsaor even better, just `vec` instead of `into []` or `reduce conj []`
19:34Bronsayeah
20:11TimMc&(let [v [1 2 3]] (identical? v (vec v)))
20:11lazybot⇒ false
20:11patbrownAre there any instances where (type n) returns float?
20:11TimMc&(type (float 5))
20:11lazybot⇒ java.lang.Float
20:12TimMc&(class (float 5))
20:12lazybot⇒ java.lang.Float
20:13patbrownSo, only if (type n) acts directly on a newly created float?
20:13metellus,(type 5.0f)
20:13clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: 5.0f>
20:14patbrownCool, thanks, that covers my use cases.
20:15TimMcpatbrown: I may have misunderstood you.
20:15TimMcDo you mean float or Float?
20:16amalloypatbrown: no, it never will return lower-case float
20:17amalloyit will return Float if anyone passes it a Float object
20:18patbrownI meant Float
20:19patbrownI'm trying to ensure that in my dsl, if I type check for double, that I'll be cool… I believe I will
20:35TimMcpatbrown: No, there are plenty of ways.
20:35TimMc&(let [x (float 6)] (type x))
20:35lazybot⇒ java.lang.Float
20:36TimMc$findarg map % [(float 6.0) 6.0] [true false]
20:37lazybot[]
20:46patbrownInteresting, I ended up converting everything to a string and then running (read-string n) on them. I have no idea what this does for performance, but I haven't been able to break my code.
20:47patbrown:TimMc btw, it's a convenience library on top of cl-format if that fuels better insight into what I'm doing
20:55amalloypatbrown: fwiw, calling read-string on arbitrary user-created strings introduces serious security problems
20:55amalloy&(doc float?)
20:55lazybot⇒ "([n]); Returns true if n is a floating point number"
20:55amalloy&(map float? [1.0 (float 1.0) (double 1.0)])
20:55lazybot⇒ (true true true)
21:01patbrown:amalloy I'm confused, why something will return as a float with (float? 1.0) and (= (type 1.0) java.lang.Float) returns false
21:02Raynes&(type 1.0)
21:02lazybot⇒ java.lang.Double
21:02amalloybecause float? is abstractly checking "is this floating-point", whereas j.l.Float is checking for a particular concrete type of float
21:03amalloyjust like ##(vector? (first {1 2})) is true, but ##(class (first {1 2})) isn't clojure.lang.PersistentVector
21:04lazybot(vector? (first {1 2})) ⇒ true
21:04lazybot(class (first {1 2})) ⇒ clojure.lang.MapEntry
21:05patbrownSo, if I am doing my type inspection comparing to the concrete java.lang types, how would I encounter a float?
21:08patbrown:amalloy further, I think I've heard the security issue mentioned before, it's mitigated by using read-string from clojure/tools.reader ?
21:09amalloyi can't imagine a good reason to compare to concrete java.lang types
21:10amalloyand, as i said before, you will encounter a float whenever someone passes you a float
21:13patbrownHmmmm, can't imagine a good reason… What should I be doing differently?
21:13patbrownI've got this sinking feeling I've been doing it wrong for a long time now
22:42tyler_any whiteheadians in here? question: can two actual occasions happen in the same instant in time, or can there only be one actual occasion per instant in time?
22:49muhootyler_: sounds like a question for heisenberg, not whitehead
22:50tyler_yeah because whitehead never talked about time o actual occasions
22:50tyler_or*
22:55muhooRaynes: huh, a paste with a "burn after reading" setting http://0bin.net/
22:55Raynesmuhoo: Hah, nice. I could implement that easily.
22:56RaynesI certainly don't nor do I intend to encrypt pastes.
22:56muhoocool, i could think of a few people who'd make use of it.
22:57muhooyeah, it didn't seem to fit too well with the refheap model of things, but just FYI.
22:57RaynesBurn after reading would be great, just the encryption stuff I wouldn't want to do.
23:36desertmonadHi all. Is there a way to escape a semicolon in a double quoted string? I get "unsupported escape character in the repl when I try "\;"
23:40Raynesdesertmonad: Why do you need to escape a semicolon?
23:42mthvedtraynes: he's playing nethack. escaping semicolons is very difficult
23:42desertmonadI'm trying out Engleberg's instaparse (https://github.com/Engelberg/instaparse). The BNF I'm trying it out with has a semicolon as a keyword.
23:42RaynesWell, you're officially my new favorite person, mthvedt
23:42mthvedti am honored
23:43Raynesdesertmonad: Well, you're trying to escape it in Clojure, not the language that needs it to be escaped. Try \\; perhaps?
23:44desertmonadYeah, I'm not really clear on what I am trying to do, tbh. Instaparse can interpret ; as it's own keyword as an optional line ending of a rule. So my first inclination was to escape it, but then ran into clojury troubles.
23:45desertmonadI suppose I need to discuss this with Engleberg at this point
23:45mthvedtdesertmonad: you also might be able to use instaparse's combinators… but if the language can't escape it, consider opening a github issue or emailing him
23:46mthvedtalternately, you can use my favorite parser, https://github.com/mthvedt/clearley :)
23:46desertmonadI'll have a look :)
23:47desertmonadThat looks pretty nice, mthvedt. Instaparse was interesting because it interpreted strings of BNF, so I could copy and paste from a spec.
23:47desertmonadI don't think it was going to actually save me time in the end though