#clojure logs

2014-05-26

00:00Jaoodpic?
02:15trap_exithas anyone managed to combine clojure notation and MatLab matrix notation?
03:06rurumateIs there a wizard here, who can help with a macro? Thanks! https://www.refheap.com/85907
03:33amalloyrurumate: i can't figure out what this is supposed to do, but i'm pretty sure it should be a function, not a macro; if you find the implementation using a function is too repetitive, you can use a macro to alleviate that
03:33amalloybut don't start with a macro if you have no idea how to implement it
03:33amalloyalternatively, if you think a macro is what you want, sketch out an example input form or two, and what you'd like those to expand to
03:33amalloythen implementing the macro will be easy for you
03:41rurumateamalloy: ok one moment,
03:45rurumateamalloy: I've added one function at the bottom, in the refheap page, to show the problem I'm trying to solve
03:45rurumatebasically, I'm spreading the structure (positions of fields) of header around my code, which makes it very hard to maintain as it grows
03:47amalloywell, it looks like you've implemented (defn get-read-perms [row] (map first row))
03:47amalloybut also: on line 13, you've written an example usage of your macro. write what you wish that expanded to, and then you'll have some idea how to implement it
03:48rurumateamalloy: ok, I'll add that too
03:48rurumatethe thing is, I have some idea, but could not do it
03:48rurumateone moment
03:49amalloyi mean, add it to the refheap if you want, but my point is that that's how you write macros, when you're new to it. you're currently struggling because you don't know what you want your macro to do
03:49rurumateI want to write a let, with the result of tap-var-vector as the bindings
03:50rurumatebut I can not call tap-var-vector at macroexpansion time, because I don't have row yet
03:50rurumateso I need a macro that expands to a function
03:51rurumatehang on
03:52amalloyif you're bothered about repeating the order of fields throughout your app (as you should be), i'd suggest parsing it once into a map, rather than continuing to use it as a vector and using a macro to let fields out of it
03:56rurumateok, I've added what I want the macro call to expand to, at the bottom
03:56rurumatefrom line 35
03:59rurumateI feel like trying again though
04:00quizdrrurumate i have learned, in part thanks to amaloy
04:00quizdrthat you do not need macros most of the time you think you do
04:00rurumateamalloy: the thing is that the forms should "see" new vars that are introduced by the macro; does that mean it's not hygienic?
04:01quizdrrurumate you mean lexical bindings within the macro?
04:01quizdryou can emit those as an autogensym if you need to
04:02rurumatequizdr: yes lexical bindings, new symbols added by a let in the macro, that can be used in the forms that are passed to the macro
04:02quizdryou can certainly do that
04:03quizdrthey aren't really "vars" they are just "local bindings" and of course if the form is in the same scope as the bindings, they can use it
04:04amalloyso, you can't really write this in quite the way you showed, but if you modified it to look like (defcsv [user group others] [(first user) (first group) (first others)]) it would be possible. however, as i've already said: (1) i really don't think you want a macro at all; you'd be better off converting the vector to a map once; (2) get-read-perms is just (partial map first)
04:05rurumateamalloy: this is cascalog, so needs vectors
04:05amalloyso write a function that turns a silly vector into a map
04:05rurumatehm
04:06rurumateseems reasonable
04:06rurumatebut really, can't write it the way I showed? what is the problem with that approach?
04:07mercwithamouthdoes the brave clojure book have any more than the website tutorials or would the purchase just be more of a way of supporting his efforts?
04:07amalloyyour macro will receive 'header as a symbol, not a vector
04:07rurumatealso (2) yes I notice it's just (partial map first) but this is overly simplistic example code, of course the forms do more sophisticated stuff in real life
04:08rurumateamalloy: will it help, when I pass it the var instead? like #'header
04:08amalloyno
04:08amalloythat would be passing it a list, with the symbol var and then the symbol header
04:08rurumatecan't resolve vars within a macro?
04:09rurumatesounds major impediment
04:09amalloyyou can, but it's tacky and wrong
04:10rurumateI think cascalog does that all over the place, I always pass my taps as vars and <- can resolve everything
04:12rurumatelike (<- [?user ?group ?others] ((foo-tap) :>> header)) <-- assuming header = '[?user ?group ?others]
04:12rurumatethat works fine
04:13quizdrrurumate well there is the function "resolve" but if you need it likely you can things a better way.
04:13quizdr,(doc resolve)
04:13clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
04:13rurumateI'll check whether it's used in cascalog
04:13quizdrrurumate i went down this road of yours a few months back, so i know a bit about your thought process. yes, you can get it all working. but once you do, you'll realize there are far better ways to do it more idiomatically.
04:16rurumateno it seems like cascalog is only using resolve in one place, to produce a deprecation warning: https://github.com/nathanmarz/cascalog/blob/develop/cascalog-core/src/clj/cascalog/logic/def.clj#L122-128
04:17quizdrwell keep in mind that if you pass just a symbol into a macro, the macro will receive that symbol, not what that symbol binds to. it can then just use that symbol if it wants, in whatever way.
04:18quizdrit can use it in the macro's internal logic, or emit the symbol as part of the macro output
04:18quizdrso you can check to see how cacalog is actually using the symbols it is passed
04:20quizdrfor example, https://www.refheap.com/85909
04:20rurumatethanks everyone, I think I'll find a way. If all else fails I'll go with the map, but I prefer the macro way because the compiler will notice if I use a symbol that's not in the header
04:36quizdrrurumate well at the very least you will learn a lot in the process
05:14gyimhi, does anyone has experience with debugging ScheduledThreadPoolExecutor? I am using overtone/at-at for scheduling jobs, and after a few hours one of the jobs stops working (it is not called anymore)
05:15gyimeverything seems fine: the previous invocation exited (there are no active jobs), there was no exception, and the job seems to be scheduled
05:15gyimmy-job ; => #<RecurringJob id: 6, created-at: Tue 12:20:55s, ms-period: 25000, initial-delay: 25000, desc: "", scheduled? true>
05:15gyim(.getActiveCount (:thread-pool @(:pool-atom my-timer-pool))) ; => 0
05:15gyim(.getDelay (:job my-job) java.util.concurrent.TimeUnit/SECONDS) ; => -1096873
05:34xsynIs there a good reason that a Scala user should try Clojure?
05:38mpenetvague... depends on what he wants to do. But being curious is always good.
05:38vijaykiranclojure has a different philosophy than Scala. It also depends on what was the good reason for you to learn Scala ?
05:39xsynit's not for me
05:39xsynI'm doing a presentation to a Scala users group
05:40xsynbut I'm struggling to find a defining value proposition
05:40vijaykiran:) ah - okay. Simplicity
05:40xsynhaha
05:40xsynthe case for semantic elegance?
05:41vijaykiranthat's fairly subjective, IMHO
05:41vijaykiranso difficult to win over arguments with that
05:42vijaykiranthis might help - http://programming-puzzler.blogspot.nl/2013/12/clojure-vs-scala.html
05:42xsynWas literally just reading though
05:43xsynthat*
05:43xsynnot thogh
05:43xsyn*hangs head*
05:43xsynexcuse me while I go out back and shoot my hand
05:44mpenetportability comes to mind too, scala is much more tied to the jvm it seems
05:44mpenetharder to port on other platforms
05:45vijaykiranand the tooling - just compare lein vs sbt - and they'll drool ;)
05:45xsynapparently sbt is kinda complex
05:46xsynhttp://hammerprinciple.com/therighttool/items/clojure/scala
05:48vijaykiranyou can drop "kinda" :)
06:59lxsameerhi , i'm looking for a package to create a sock5 proxy, any recommendation ?
08:32ticking_any thoughts on gloss vs blobbity vs buffy? I'm looking for the most elegant one, where speed comes secondary ^^
08:32olliverahow to compare to dates in clojure? data1 > date2?
08:34ticking_ollivera: date as in time?
08:34olliveraticking, yes
08:35ticking_ollivera: clj-time provides quite a bit of interval code, you can also use (.after data1 data2) or (.before data1 data2), and go directly for the java methods
08:35olliveraticking, thank you
08:35ticking_clojure dates should be plain java dates so you can use everything documented here http://docs.oracle.com/javase/6/docs/api/java/util/Date.html
08:44gfredericks,#inst "2014"
08:44clojurebot#<SecurityException java.lang.SecurityException: denied>
08:44gfredericks&#inst "2014"
08:44lazybot⇒ #inst "2014-01-01T00:00:00.000-00:00"
08:45gfredericksI wonder what clojurebot is denying there
08:45hyPiRion&'#inst "2014"
08:45lazybot⇒ #inst "2014-01-01T00:00:00.000-00:00"
08:46hyPiRion&(binding [*print-dup* true *print-meta* true] (pr-str #inst "2014"))
08:46lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
08:46gfredericksclojurebot: pop-thread-bindings is bad!
08:46clojurebotAck. Ack.
08:47gfredericksclojurebot: You |tripped| the alarm!
08:47clojurebot'Sea, mhuise.
08:47hyPiRionstill prints out same thing though
09:37mpenetollivera: if its just > you can just use getTime
09:37mpenet(> (.getTime (java.util.Date.)) (.getTime (java.util.Date.)))
09:37mpenet,(> (.getTime (java.util.Date.)) (.getTime (java.util.Date.)))
09:37clojurebotfalse
10:24owl-v-,(conj (subvec [1 2 3] 1) 4)
10:24clojurebot[2 3 4]
10:26owl-v-is the final value a new data or a reference to old one?
10:27opqdonut,(doc subvec)
10:27clojurebot"([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."
10:28clgvowl-v-: there is likely some structural sharing
10:31owl-v-clgv: so, it's not recommended to use (subvec) like that?
10:31clgvowl-v-: why?
10:32owl-v-i don't know when i need to use either (vector) or (lisp) anymore...
10:32owl-v-*shrug*
10:32owl-v-(lisp) i mean (list)
10:33clgvrandom access in O(1) versus operations on sequences
10:57fifosineyogthos: You there?
11:05yogthosfifosine: hey what's up
11:06fifosineyogthos: hi! So I just started the liberator-service chapter of your book but I ran into a little trouble. When I change the home.clj file, I don't see my changes in the browser
11:31powrtocHey all, I'm looking at building a framework which is compatible with Incanter Datasets. Incanter defines a Dataset record but no protocols. What's the best way to proceed... Do I? A) require/import the incanter.core.Dataset record and just use it - requiring others to accept it as a visible dependency B) define my own protocol with the same interface as incanter.core.Dataset and extend the protocol to the Dataset - then advertise
11:31powrtocthis as my projects interface... Or C) Do something else?
11:42noncompowrtoc: i think that A is the way
11:43noncomhowever, if you want to create some layer over incanters API, then it would be perfectly well to define it in your own library the way you want and let users use that layer when they need it and use plain incanter dependency when they need that
11:44noncomi'd vote for keeping things as transparent as possible
11:44noncomthere is too much obscurity in the world of software alredy, don't add to it :)
11:45powrtocnoncom: Yeah, I was siding with A too... I think you're right
11:47powrtocessentially a Dataset is just a hashmap of {:column-names [a b c] :rows [[1 2 3] [:a :b :c]]}
11:47powrtocso it's not exactly complex should things change
11:48powrtocbut I should probably just use their raw record type
11:49noncompowrtoc: well, records are just a convenience over hashmaps and they also present some optimisations afaik, so if incanter wraps the maps in records, it is better to use the records..
11:49clgv,(defn f ^double [x] nil)
11:49clojurebot#'sandbox/f
11:49clgv,(f)
11:49clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/f>
11:49clgv,(f 1)
11:49clojurebot#<NullPointerException java.lang.NullPointerException>
11:49clgvawesome right?
11:50noncomOMG how does defn ever come to work within the sandbox?
11:50dnbhello
11:50clgvnoncom: since several months when clojurebot was upgrade
11:50clgvnoncom: he seems to have session that time out for defs
11:51noncomhaven't been here for a long time :D so they no longer afraid of users defining the genocide of all?
11:51dnbIs there a diffrence between (def f "doc" (fn [args] ...)) and (defn f [args] "doc" ...) ?
11:51noncomdnb: yes
11:51noncomdnd: use defn
11:51noncomdnb: for explanation look at defn source
11:51noncomclgv: but the exception is awesome too
11:52noncomclgv: i wonder why does it happen, the code seems legit..
11:53powrtocnoncom: agreed
11:53dnbnoncom: thnx
12:00cbp`dnb: (defn f [args] "doc") is wrong
12:01cbpdnb: (defn f "doc" [args])
12:02dnbcbp: Right, too much elisp lately
12:14clgvnoncom: it is a compiler error. it's visible when you decompile the function. then there is "return null.doubleValue();"
12:15noncomclgv: cool you've nailed a compiler bug!
12:17clgvnoncom: already added it to jira
12:18noncomclgv: don't you know, what plans are there for future versions of clojure?
12:20clgvnoncom: it is tracked here afaik http://dev.clojure.org/display/design/Release.Next+Planning
12:56cbpcan test.check generate tests to check for race conditions?
12:57arrdemhow could it do so deterministically?
12:58cbpuh idk. I'll prolly just use robert.bruce
13:13reiddrapercbp: it can, yes. There's nothing (yet) built-in to do that, but in general, think about generating a list of actions to take, or a nested list of actions to take concurrently
13:15cbpokies
13:19rkneufeldDid #clojure-social disappear or something?
13:19cbprkneufeld: it's #clojure-offtopic now
13:19rkneufeldGetting Ahh
13:19cbpyes it did dissapear
13:19rkneufeldAhh*
13:20rkneufeldcbp: Thanks
13:21deadghostis there a standard way to run $ lein cljsbuild auto $ lein garden auto $ lein ring server-headless?
13:21deadghostin one command
13:25Glenjaminlein do
14:00AeroNotixthey don't think it be lein it is but lein do
14:02JokerDoomwhere's a good intro to clojure for someone without a lisp background?
14:03AeroNotixJokerDoom: Joy of Clojure
14:04cbpJokerDoom: you can try this http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome
14:04JokerDoomcbp, ty :)
14:08jamieenglishAnybody have experience with noir.session and the peridot testing library?
14:09jamieenglishMy sessions don't seem to be sticking around between requests :(
14:30tolstoyjamieenglish: Probably not your problem, but I found myself messed up with Chrome and sessions using localhost or 127.0.0.1 in the URL. (I forget which one.)
14:32jamieenglishtolstoy: good call - just tried with another domain and same problem unfortunately
14:32tolstoyAlas. :)
14:35jamieenglishSeems like peridot's cookie-jar is clearing out between requests...
15:15Glenjaminjamieenglish: got some example code? as long as you chain along with (->) it should work
15:19akurilinquick question: in what situation will the STM rollback a change? Is it just when two writes occurred in the same critical section? Does it ever care about readers accessing the atom? (assuming we're working with an atom here for a sec)
15:27bbloomakurilin: atoms are very simple: they test equality of the "before" value, then if it matches, it swaps in the "after" value
15:27bbloomit's "compare and swap" semantics
15:27cbpatoms retry when their value change before another update returns, basically keep trying until compare-and-set works
15:27bbloomakurilin: see https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java#L33-L45
15:27bbloomakurilin: and https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java#L89-L95
15:27bbloomthat's it!
15:28akurilinbbloom: ha nice!
15:29akurilinMeaning you can read all you want while a swap! is being performed, right?
15:29pyrtsaakurilin: I almost never use refs but refs have a mechanism marking a value that was only read during the transaction: ensure.
15:29akurilinI'm thinking of how the different levels of isolation would be simulated in clojure with its concurrency primitives (thinking along the lines of the 3 PG levels)
15:29pyrtsaakurilin: You should do as little work as possible during the swap!
15:29akurilinThe agent would obviously be the total serialization one
15:30bbloomakurilin: no, the agent would be write committed, i beieve
15:30bbloomakurilin: total serialization will linearize reads too
15:30pyrtsaakurilin: The more work you do during the swap! the more likely it is that it retries because of another operation.
15:31akurilinbbloom: oh yes, I guess I missed the part where you don't read through the agent, for some reason I thought this was a "thing" in my head
15:31akurilinpyrtsa: very true
15:32bbloomakurilin: the pg isolation levels don't really apply to anything except refs... which would be "repeatable read" isolation in http://www.postgresql.org/docs/9.1/static/transaction-iso.html
15:32akurilinbbloom: it looks like there might be a way to perform a blocking read against an agent with some of that pai
15:32akurilin*api
15:33bbloomakurilin: huh? reading all of clojure's reference types should be a non-blocking, non-locking, instant atomic operation
15:33akurilinbbloom: there's an "await" for agent
15:34bbloom(doc await)
15:34clojurebot"([& agents]); Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred. Will block on failed agents. Will never return if a failed agent is restarted with :clear-actions true."
15:34akurilinI'm thinking that basically there's a way of simulating that serialized read/write by abstracting over the concurrency primitives, but it does look like there's nothing out of the box
15:34bbloom"until all actions dispatched thus far ... have occurred"
15:34bbloomthat's not block-to-read
15:34bbloomthat's wait-on-writes
15:35bbloomakurilin: if you want truely serialized transaction processing, including reads and writes, use a queue or similar
15:35bbloomfor example, you can use core.async to create a loop that processes messages in a loop
15:38akurilinThat's a good idea, thanks.
15:49PigDudeis there an existing serializer interface in java for something that converts an object to a string
15:50PigDudea serialize/deserialize interface
15:50PigDudebefore i go making a protocol for this
15:51cbpObjectOutputStream? :-P
15:51cbpnot a string though
15:51dbaschPigDude: it depends on what you mean by string, there are many libraries to convert objects to json for example
15:52PigDudedbasch: in my program i was going to have functions serialize/deserialize that dispatch based on type
15:52PigDudedbasch: so one would be json, another fressian, another edn, etc.
15:53dbaschPigDude: so to answer your question, there is no such thing in java
15:53PigDudeok, thanks
15:54dbaschPigDude: the best you can do in Java is implement Serializable in classes, and then write them to ObjectOutputStream
15:54dbaschor use any of the multiple libraries to convert stuff to json et al
15:55PigDudethanks for your advice dbasch . note that i am having no trouble working with json
15:55PigDudei just didn't want to make a redundant protocol/multimethod
16:06lxsameeris there any library to create a socks proxy
16:08amalloyi remember someone (technomancy?) writing some nonsense that writes objects to string by using java serialize and then base64-encoding that, but i think it was more a joke than a practical thing
16:19drninjabatmanhello
16:25lxsameerwhat is the most popular clojure networking framework ?
17:01danielcomptonlxsameer What do you mean by networking? Ring is the most popular web request framework
17:01lxsameerdanielcompton: something like twisted in python
17:03danielcomptonlxsameer maybe one of these http://clojure-libraries.appspot.com/cat/Networking
17:03danielcomptonor use Netty directly from Java
17:03lxsameerthanks
17:08amalloyif you want an event-based networking library, i think aleph is the one. unless core.async is better these days?
17:17technomancyamalloy: ayup, that was me
17:33arkhjnanomsg looks interesting (core.async networking) http://niwibe.github.io/jnanomsg/#_async_support
17:33andyfI've been thinking of how Eastwood (Clojure lint tool) could avoid conflicting with code it is linting, in the dependencies that Eastwood uses.
17:34andyfe.g. Eastwood uses tools.analyzer.jvm, which in turn uses core.memoize, which uses core.cache, which uses data.priority-map
17:35andyfI looked at technomancy's metaverse (https://github.com/technomancy/metaverse) to see if it could help me load in tools.analyzer.jvm under an alternate name, without copying all of the source files.
17:36andyfIt seems like, as written, it can do it for the top level dependencies, but unless I temporarily redefine 'ns' it cannot do it for sub-dependencies. Does that sound correct?
17:36technomancyandyf: as long as there are no Java deps, such a thing is theoretically feasible
17:37technomancyyou could replace require with something that can swap out ns with metaverse's ns, but it gets a bit hairy
17:37technomancythis is where I reeeeeeally with ns could contain fully-qualified clauses instead of only working with stuff in clojure.core =\
17:38technomancystuff like (ns my.ns (:println [any.random.stuff])) works fine but (ns my.ns (:meta.verse/require [some.other.ns :rev ab84f9])) doesn't
17:38technomancysuper annoying
17:39kenrestivochicken and egg tho. how would those ns's get imported before the ns macro runs?
17:39andyfreading and thinking ...
17:40technomancykenrestivo: just require the ns of the fully-qualified keyword
17:40technomancywe do it all the time in lein
17:40technomancythen you don't need your own ns macro
17:40seancorfieldbut why should (ns my.ns (:println [any.random.stuff])) even be allowed to work at all?
17:40technomancyseancorfield: without the ability to use fully-qualified keywords I agree it's silly
17:41technomancybut if you added in that, then stuff like https://code.google.com/p/clj-nstools/ would be way less gross
17:41andyfSo would you recommend as a less hairy option simply copying source files of dependencies into Eastwood, and renaming the namespaces?
17:41technomancyandyf: that's probably less crazy, yeah
17:41andyfI don't plan to release new versions more than a few times a year, and can track gradual changes in those 5 to 6 deps
17:41technomancyobviously not a great solution though
17:42andyfIt has the advantage that I can understand it well :)
17:42seancorfieldtechnomancy: what would be lost if ns enforced only :require, :use, and :import as legal clauses?
17:45technomancyseancorfield: nothing of value; I agree the current situation doesn't make sense. but I would rather make it egalitarian than lock it down further.
17:45andyftechnomancy: What if I temporarily alter-var-root'd clojure.core's ns, require, and use to metaverse's versions, then switched them back to the originals after loading Eastwood's deps?
17:47andyfI can check whether those deps have any keywords in ns other than :require :use :import, but I doubt they use anything else.
17:48seancorfieldtechnomancy: fair enough... the current situation is random and broken, I agree.
18:08amalloyandyf: :refer pops up in ns clauses every so often, as does :refer-clojure. and of course :gen-class
18:10cbp:load :P
18:18PigDudedo you use when-let or some-> for a single form?
18:29andyfamalloy: Yeah. I am looking to automating the steps necessary to copy in the necessary source code and renaming the namespaces. Not great, but should work with predictable results.
18:30andyfAnd as so often happens, I write sounding like the department of redundancy department.
18:34technomancyandyf: it's all a question of where you want to land on the crazy/tedious spectrum
18:34technomancyor I guess it's a continuum
18:34technomancynot sure what the difference is there
18:35andyftechnomancy: a few bash scripts make the tedious parts significantly less.
18:42caternaaaaaaargh
18:42caterni want to do tail recursion in a multi-method
18:42caternbut I can't :(
18:47dbaschcatern: https://groups.google.com/forum/#!msg/clojure/5pxJbxkCfZ4/_DMGT_s01cwJ
18:51caternis there a reason the methods in a multimethod must be treated like separate functions? why can't recur just send it back to the dispatch function?
18:52caternbut, okay, i will do this, after I read the next section in my book which describes using trampolining :)
18:54cbp~trampoline
18:54clojurebottrampoline is http://groups.google.com/group/clojure/browse_thread/thread/6257cbc4454bcb85/3addf875319c5c10?#3addf875319c5c10
18:54cbpnot the snappy remark i was expecting
18:55caterntrampolining feels like an ugly hack to me, though
18:56amalloycatern: because each body of the multimethod is necessarily a different function, which is a different jvm method
18:56caternbecause the existence of the stack is an implementation detail
18:57amalloythe jvm doesn't support tail calls, so recur can only go to someplace in the same method
18:57caternamalloy: oh, is recur just a jump?
18:57amalloyyes
18:57caternand you can't jump between jvm methods i assume?
18:58amalloyindeed
18:59danielcomptonWhat's the mathematical property where you want 0 or greater, e.g. call this on a number and if it is less than 0 it will return 0, otherwise the number
18:59danielcompton?
19:00Frozenlockmax?
19:00clojurebotNeither bot has an accurate value for the max number of users in #clojure
19:00Frozenlock(max 0 -1)
19:00Frozenlock,(max 0 -1)
19:00clojurebot0
19:00Frozenlock,(max 0 11)
19:00clojurebot11
19:00danielcomptonFrozenlock thanks!
19:00caternah, I like the ability to just prepend # to have a trampolined tail call
19:00danielcomptonFrozenlock I knew there was something really simple there
19:01FrozenlockSo many functions to learn :-p
19:13lodinIs there any profound reason why maps support both (:key data) and (data :key) but records only support the former version?
19:16seancorfieldb/c records are Java classes (and they don't implement IFn) I believe
19:17lodin... and any reason they don't implement IFn? :-)
19:20bbloomlodin: i wondered the same thing... in fact, i *assumed* they did until amalloy set me straight
19:20bbloomlodin: my guess is that it is because you might want to implement IFn yourself, as i did :-)
19:20bbloomif you don't want ILookup or whatever, then just use deftype
19:22lodinbbloom: What did you use the IFn implementation for?
19:22bwreillywould this channel be the appropriate place to get feedback/criticism on a first nontrivial clojure thing created, or is there a better place for that?
19:22whompi'm trying to use rincanter, but i get the following issue: https://github.com/jolby/rincanter/issues/4
19:22whompany ideas?
19:22bbloomlodin: i made something that behaved like a function, but had extra data with it... the extra data was nicely available as keys in a map
19:23lodinbbloom: Like a partially applied function?
19:24bbloomlodin: could be one example
19:24bbloomlodin: honestly though, i think the decision not to auto-impl IFn is relatively arbitrary
19:30amalloybwreilly: in general, irc channels have a policy of "don't ask to ask, just ask". saves effort for everyone
19:31bwreillyamalloy: understood, thanks
19:31bwreillythe thing in question: https://github.com/bwreilly/server-climb
19:32amalloybbloom: i've generally assumed it's because if you're using a record you want performance, and dispatching through IFn to look something up is a bad idea compared to keyword lookup, which can be inline-cached into just a field lookup
19:32amalloyso implementing IFn would encourage you to do something that you don't actually want
19:33bbloomamalloy: interesting, i could see that being a plausible motivation
19:37lodinamalloy: OTOH, if you have a function that uses (d :a) then you have to make your record into a map before passing it in, and I guess you still pay the IFn price?
19:38amalloyi mean, (a) there aren't a lot of functions out there that call maps as functions, and (b) if they're doing that you can just pass them (fn [k] (k m)) instead of m or watever
19:39amalloy(aside: i don't watch GoT, but i understand "paying the iron price" is a thing there. paying the IFn price sounds absurd to me in that context)
20:16arkhbwreilly: any reason you went w/ refs over an atom to store state? Just curious
20:18bwreillyarkh: thanks for looking :) I am actually unsure of the use of refs. I went with them initially because of a number of cases where I try to examine the state of what I thought were somewhat dissimilar data structures (specifically, in the callback function)
20:20bwreillya lot of the things being done are communicative - the updating of active-requests and request-log for instance
20:25humbleZ#playframework
20:25arkhbwreilly: that's cool. Using atoms like the following has been a nice experience for me: https://www.refheap.com/85947 I'll look at your project some more
20:27arkhbwreilly: maybe this is a dumb question but are you able to generate requests fast enough w/out multiple threads?
20:28arkhbwreilly: it's cleanly written though - I like it
20:29bwreillyarkh: thank you
20:32bwreillyarkh: http-kit.client/request is the library I use for generating the requests, my understanding is that it is happily creating threads for each request and returning a promise for each
20:32bwreillythat is, http-kit is the library, request is the function
20:32bwreillyhttp://http-kit.org/client.html
20:32arkhbwreilly: oh I'm sorry - that works well then
20:39amalloybwreilly: i don't think http-kit actually creates threads for each request
20:39amalloyit uses non-blocking io so that it doesn't have to
20:41amalloya quick double-check suggests that this is correct: https://github.com/http-kit/http-kit/blob/master/src/java/org/httpkit/client/HttpClient.java#L361
20:43AWizzArdIt would be really surprising if an event-based server would start new threads.
20:43AWizzArdIt is the core idea to exactly not do that.
20:47bwreillyamalloy: ah, that makes more sense. thanks
21:15numbertendoes recur have an implicit do in it?
21:17AWizzArdnumberten: can you give an example? You can think of recur as the name of a function.
21:18numbertenah okay thanks
21:19AWizzArd(defn foo [x] (when (pos? x) (recur (dec x)))) ; think of `recur` as if it were `foo`.
21:23dbaschAWizzArd: to your question, recur does evaluate the forms just like do, you could put a do in the place of the recur and it would evaluate the forms but not rebind and jump
21:23dbaschsorry, numberten I meant
21:41amalloyAWizzArd: fwiw, http-kit *does* start new threads, but only to call your callbacks (since it doesn't know how long they will take to execute)
22:04AWizzArdamalloy: yes, under the hood this makes sense. I meant that not for each incoming request is handled by a new thread.
22:19tokahI have clojure v1.6 and I can't seem to find the clojure.edn namespace is possible I
22:19tokah*I'm missing some needed dependency?
22:22gfredericks,(require 'clojure.edn)
22:22clojurebotnil
22:22dbaschtokah: do you have some code that’s not working?
22:22gfrederickstokah: I think we'll need some more context to debug that; it should work
22:24tokahI think I've figured it out. I was trying to call it without explicitly requiring it. I just had clojure.edn/read which didn't seem to work
22:27tokahIs there a specific reason why clojure.edn has to be required, but I can call clojure.java.io, or clojure.string w/o explictly requiring it?
22:27gfredericksit means some other namespace already loaded it
22:27gfrederickswhich isn't good to count on in general
22:32tokahok thanks.
22:33amalloyplus, you'd rather require it with an alias or something anyway. nobody wants to refer clojure.edn/read fully-qualified over and over
22:33gfredericksclojurebot: nobody |wants| to refer clojure.edn/read fully-qualified over and over
22:33clojurebotOk.
22:34dbasch,(all-ns)
22:34clojurebot(#<Namespace clojure.uuid> #<Namespace user> #<Namespace clojure.core> #<Namespace sandbox> #<Namespace clojure.repl> ...)
22:34gfrederickssomeday I'm going to realize that *all* sentences can be fed to clojurebot in this manner and the whole endeavor wasn't all that interesting to begin with
22:38TEttinger~nobody
22:38clojurebotnobody wants to refer clojure.edn/read fully-qualified over and over
22:38TEttinger~anyone
22:38clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
22:38TEttingervery different
22:40gfredericks~anybody
22:40clojurebotanybody is anyone
22:40gfredericks~noone
22:40clojurebotIt's greek to me.
22:41dbaschclojurebot: everybody |do| the dinosaur
22:41clojurebot'Sea, mhuise.
23:09EroticFishSSL/TSL question anyone there?
23:11dbaschEroticFish: just ask
23:21EroticFishIf I'm setting up a qasi "post data center system" to share public keys for access control and I'm securing my communication through SSL / TSL through a verified server cert that is set up when the server is set up how secure is this method ?
23:32EroticFishIf I'm setting up a qasi "post data center system" to share public keys for access control and I'm securing my communication through SSL / TSL through a verified server cert that is set up when the server is set up how secure is this method ?
23:33EroticFishAnyone?
23:58FrozenlockIs there a an argument to force lein to reload all snapshots?