#clojure log - May 26 2014

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

0:00 Jaood: pic?

0:16 * waynr lols

2:15 trap_exit: has anyone managed to combine clojure notation and MatLab matrix notation?

3:06 rurumate: Is there a wizard here, who can help with a macro? Thanks! https://www.refheap.com/85907

3:33 amalloy: rurumate: 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

3:33 but don't start with a macro if you have no idea how to implement it

3:33 alternatively, 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

3:33 then implementing the macro will be easy for you

3:41 rurumate: amalloy: ok one moment,

3:45 amalloy: I've added one function at the bottom, in the refheap page, to show the problem I'm trying to solve

3:45 basically, I'm spreading the structure (positions of fields) of header around my code, which makes it very hard to maintain as it grows

3:47 amalloy: well, it looks like you've implemented (defn get-read-perms [row] (map first row))

3:47 but 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

3:48 rurumate: amalloy: ok, I'll add that too

3:48 the thing is, I have some idea, but could not do it

3:48 one moment

3:49 amalloy: i 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

3:49 rurumate: I want to write a let, with the result of tap-var-vector as the bindings

3:50 but I can not call tap-var-vector at macroexpansion time, because I don't have row yet

3:50 so I need a macro that expands to a function

3:51 hang on

3:52 amalloy: if 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

3:56 rurumate: ok, I've added what I want the macro call to expand to, at the bottom

3:56 from line 35

3:59 I feel like trying again though

4:00 quizdr: rurumate i have learned, in part thanks to amaloy

4:00 that you do not need macros most of the time you think you do

4:00 rurumate: amalloy: the thing is that the forms should "see" new vars that are introduced by the macro; does that mean it's not hygienic?

4:01 quizdr: rurumate you mean lexical bindings within the macro?

4:01 you can emit those as an autogensym if you need to

4:02 rurumate: quizdr: 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

4:02 quizdr: you can certainly do that

4:03 they 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

4:04 amalloy: so, 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)

4:05 rurumate: amalloy: this is cascalog, so needs vectors

4:05 amalloy: so write a function that turns a silly vector into a map

4:05 rurumate: hm

4:06 seems reasonable

4:06 but really, can't write it the way I showed? what is the problem with that approach?

4:07 mercwithamouth: does 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?

4:07 amalloy: your macro will receive 'header as a symbol, not a vector

4:07 rurumate: also (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

4:08 amalloy: will it help, when I pass it the var instead? like #'header

4:08 amalloy: no

4:08 that would be passing it a list, with the symbol var and then the symbol header

4:08 rurumate: can't resolve vars within a macro?

4:09 sounds major impediment

4:09 amalloy: you can, but it's tacky and wrong

4:10 rurumate: I think cascalog does that all over the place, I always pass my taps as vars and <- can resolve everything

4:12 like (<- [?user ?group ?others] ((foo-tap) :>> header)) <-- assuming header = '[?user ?group ?others]

4:12 that works fine

4:13 quizdr: rurumate well there is the function "resolve" but if you need it likely you can things a better way.

4:13 ,(doc resolve)

4:13 clojurebot: "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"

4:13 rurumate: I'll check whether it's used in cascalog

4:13 quizdr: rurumate 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.

4:16 rurumate: no 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

4:17 quizdr: well 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.

4:18 it can use it in the macro's internal logic, or emit the symbol as part of the macro output

4:18 so you can check to see how cacalog is actually using the symbols it is passed

4:20 for example, https://www.refheap.com/85909

4:20 rurumate: thanks 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

4:36 quizdr: rurumate well at the very least you will learn a lot in the process

5:14 gyim: hi, 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)

5:15 everything seems fine: the previous invocation exited (there are no active jobs), there was no exception, and the job seems to be scheduled

5:15 my-job ; => #<RecurringJob id: 6, created-at: Tue 12:20:55s, ms-period: 25000, initial-delay: 25000, desc: "", scheduled? true>

5:15 (.getActiveCount (:thread-pool @(:pool-atom my-timer-pool))) ; => 0

5:15 (.getDelay (:job my-job) java.util.concurrent.TimeUnit/SECONDS) ; => -1096873

5:34 xsyn: Is there a good reason that a Scala user should try Clojure?

5:38 mpenet: vague... depends on what he wants to do. But being curious is always good.

5:38 vijaykiran: clojure has a different philosophy than Scala. It also depends on what was the good reason for you to learn Scala ?

5:39 xsyn: it's not for me

5:39 I'm doing a presentation to a Scala users group

5:40 but I'm struggling to find a defining value proposition

5:40 vijaykiran: :) ah - okay. Simplicity

5:40 xsyn: haha

5:40 the case for semantic elegance?

5:41 vijaykiran: that's fairly subjective, IMHO

5:41 so difficult to win over arguments with that

5:42 this might help - http://programming-puzzler.blogspot.nl/2013/12/clojure-vs-scala.html

5:42 xsyn: Was literally just reading though

5:43 that*

5:43 not thogh

5:43 *hangs head*

5:43 excuse me while I go out back and shoot my hand

5:44 mpenet: portability comes to mind too, scala is much more tied to the jvm it seems

5:44 harder to port on other platforms

5:45 vijaykiran: and the tooling - just compare lein vs sbt - and they'll drool ;)

5:45 xsyn: apparently sbt is kinda complex

5:46 http://hammerprinciple.com/therighttool/items/clojure/scala

5:48 vijaykiran: you can drop "kinda" :)

6:59 lxsameer: hi , i'm looking for a package to create a sock5 proxy, any recommendation ?

8:32 ticking_: any thoughts on gloss vs blobbity vs buffy? I'm looking for the most elegant one, where speed comes secondary ^^

8:32 ollivera: how to compare to dates in clojure? data1 > date2?

8:34 ticking_: ollivera: date as in time?

8:34 ollivera: ticking, yes

8:35 ticking_: 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

8:35 ollivera: ticking, thank you

8:35 ticking_: 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

8:44 gfredericks: ,#inst "2014"

8:44 clojurebot: #<SecurityException java.lang.SecurityException: denied>

8:44 gfredericks: &#inst "2014"

8:44 lazybot: ⇒ #inst "2014-01-01T00:00:00.000-00:00"

8:45 gfredericks: I wonder what clojurebot is denying there

8:45 hyPiRion: &'#inst "2014"

8:45 lazybot: ⇒ #inst "2014-01-01T00:00:00.000-00:00"

8:46 hyPiRion: &(binding [*print-dup* true *print-meta* true] (pr-str #inst "2014"))

8:46 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

8:46 gfredericks: clojurebot: pop-thread-bindings is bad!

8:46 clojurebot: Ack. Ack.

8:47 gfredericks: clojurebot: You |tripped| the alarm!

8:47 clojurebot: 'Sea, mhuise.

8:47 hyPiRion: still prints out same thing though

9:37 mpenet: ollivera: if its just > you can just use getTime

9:37 (> (.getTime (java.util.Date.)) (.getTime (java.util.Date.)))

9:37 ,(> (.getTime (java.util.Date.)) (.getTime (java.util.Date.)))

9:37 clojurebot: false

10:24 owl-v-: ,(conj (subvec [1 2 3] 1) 4)

10:24 clojurebot: [2 3 4]

10:26 owl-v-: is the final value a new data or a reference to old one?

10:27 opqdonut: ,(doc subvec)

10:27 clojurebot: "([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:28 clgv: owl-v-: there is likely some structural sharing

10:31 owl-v-: clgv: so, it's not recommended to use (subvec) like that?

10:31 clgv: owl-v-: why?

10:32 owl-v-: i don't know when i need to use either (vector) or (lisp) anymore...

10:32 *shrug*

10:32 (lisp) i mean (list)

10:33 clgv: random access in O(1) versus operations on sequences

10:57 fifosine: yogthos: You there?

11:05 yogthos: fifosine: hey what's up

11:06 fifosine: yogthos: 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:31 powrtoc: Hey 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:31 this as my projects interface... Or C) Do something else?

11:42 noncom: powrtoc: i think that A is the way

11:43 however, 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:44 i'd vote for keeping things as transparent as possible

11:44 there is too much obscurity in the world of software alredy, don't add to it :)

11:45 powrtoc: noncom: Yeah, I was siding with A too... I think you're right

11:47 essentially a Dataset is just a hashmap of {:column-names [a b c] :rows [[1 2 3] [:a :b :c]]}

11:47 so it's not exactly complex should things change

11:48 but I should probably just use their raw record type

11:49 noncom: powrtoc: 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:49 clgv: ,(defn f ^double [x] nil)

11:49 clojurebot: #'sandbox/f

11:49 clgv: ,(f)

11:49 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/f>

11:49 clgv: ,(f 1)

11:49 clojurebot: #<NullPointerException java.lang.NullPointerException>

11:49 clgv: awesome right?

11:50 noncom: OMG how does defn ever come to work within the sandbox?

11:50 dnb: hello

11:50 clgv: noncom: since several months when clojurebot was upgrade

11:50 noncom: he seems to have session that time out for defs

11:51 noncom: haven't been here for a long time :D so they no longer afraid of users defining the genocide of all?

11:51 dnb: Is there a diffrence between (def f "doc" (fn [args] ...)) and (defn f [args] "doc" ...) ?

11:51 noncom: dnb: yes

11:51 dnd: use defn

11:51 dnb: for explanation look at defn source

11:51 clgv: but the exception is awesome too

11:52 clgv: i wonder why does it happen, the code seems legit..

11:53 powrtoc: noncom: agreed

11:53 dnb: noncom: thnx

12:00 cbp`: dnb: (defn f [args] "doc") is wrong

12:01 cbp: dnb: (defn f "doc" [args])

12:02 dnb: cbp: Right, too much elisp lately

12:14 clgv: noncom: it is a compiler error. it's visible when you decompile the function. then there is "return null.doubleValue();"

12:15 noncom: clgv: cool you've nailed a compiler bug!

12:17 clgv: noncom: already added it to jira

12:18 noncom: clgv: don't you know, what plans are there for future versions of clojure?

12:20 clgv: noncom: it is tracked here afaik http://dev.clojure.org/display/design/Release.Next+Planning

12:56 cbp: can test.check generate tests to check for race conditions?

12:57 arrdem: how could it do so deterministically?

12:58 cbp: uh idk. I'll prolly just use robert.bruce

13:13 reiddraper: cbp: 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:15 cbp: okies

13:19 rkneufeld: Did #clojure-social disappear or something?

13:19 cbp: rkneufeld: it's #clojure-offtopic now

13:19 rkneufeld: Getting Ahh

13:19 cbp: yes it did dissapear

13:19 rkneufeld: Ahh*

13:20 cbp: Thanks

13:21 deadghost: is there a standard way to run $ lein cljsbuild auto $ lein garden auto $ lein ring server-headless?

13:21 in one command

13:25 Glenjamin: lein do

14:00 AeroNotix: they don't think it be lein it is but lein do

14:02 JokerDoom: where's a good intro to clojure for someone without a lisp background?

14:03 AeroNotix: JokerDoom: Joy of Clojure

14:04 cbp: JokerDoom: you can try this http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome

14:04 JokerDoom: cbp, ty :)

14:08 jamieenglish: Anybody have experience with noir.session and the peridot testing library?

14:09 My sessions don't seem to be sticking around between requests :(

14:30 tolstoy: jamieenglish: Probably not your problem, but I found myself messed up with Chrome and sessions using localhost or in the URL. (I forget which one.)

14:32 jamieenglish: tolstoy: good call - just tried with another domain and same problem unfortunately

14:32 tolstoy: Alas. :)

14:35 jamieenglish: Seems like peridot's cookie-jar is clearing out between requests...

15:15 Glenjamin: jamieenglish: got some example code? as long as you chain along with (->) it should work

15:19 akurilin: quick 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:27 bbloom: akurilin: atoms are very simple: they test equality of the "before" value, then if it matches, it swaps in the "after" value

15:27 it's "compare and swap" semantics

15:27 cbp: atoms retry when their value change before another update returns, basically keep trying until compare-and-set works

15:27 bbloom: akurilin: see https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java#L33-L45

15:27 akurilin: and https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java#L89-L95

15:27 that's it!

15:28 akurilin: bbloom: ha nice!

15:29 Meaning you can read all you want while a swap! is being performed, right?

15:29 pyrtsa: akurilin: I almost never use refs but refs have a mechanism marking a value that was only read during the transaction: ensure.

15:29 akurilin: I'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:29 pyrtsa: akurilin: You should do as little work as possible during the swap!

15:29 akurilin: The agent would obviously be the total serialization one

15:30 bbloom: akurilin: no, the agent would be write committed, i beieve

15:30 akurilin: total serialization will linearize reads too

15:30 pyrtsa: akurilin: The more work you do during the swap! the more likely it is that it retries because of another operation.

15:31 akurilin: bbloom: 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:31 pyrtsa: very true

15:32 bbloom: akurilin: 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:32 akurilin: bbloom: it looks like there might be a way to perform a blocking read against an agent with some of that pai

15:32 *api

15:33 bbloom: akurilin: huh? reading all of clojure's reference types should be a non-blocking, non-locking, instant atomic operation

15:33 akurilin: bbloom: there's an "await" for agent

15:34 bbloom: (doc await)

15:34 clojurebot: "([& 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:34 akurilin: I'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:34 bbloom: "until all actions dispatched thus far ... have occurred"

15:34 that's not block-to-read

15:34 that's wait-on-writes

15:35 akurilin: if you want truely serialized transaction processing, including reads and writes, use a queue or similar

15:35 for example, you can use core.async to create a loop that processes messages in a loop

15:38 akurilin: That's a good idea, thanks.

15:49 PigDude: is there an existing serializer interface in java for something that converts an object to a string

15:50 a serialize/deserialize interface

15:50 before i go making a protocol for this

15:51 cbp: ObjectOutputStream? :-P

15:51 not a string though

15:51 dbasch: PigDude: it depends on what you mean by string, there are many libraries to convert objects to json for example

15:52 PigDude: dbasch: in my program i was going to have functions serialize/deserialize that dispatch based on type

15:52 dbasch: so one would be json, another fressian, another edn, etc.

15:53 dbasch: PigDude: so to answer your question, there is no such thing in java

15:53 PigDude: ok, thanks

15:54 dbasch: PigDude: the best you can do in Java is implement Serializable in classes, and then write them to ObjectOutputStream

15:54 or use any of the multiple libraries to convert stuff to json et al

15:55 PigDude: thanks for your advice dbasch . note that i am having no trouble working with json

15:55 i just didn't want to make a redundant protocol/multimethod

16:06 lxsameer: is there any library to create a socks proxy

16:08 amalloy: i 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:19 drninjabatman: hello

16:25 lxsameer: what is the most popular clojure networking framework ?

17:01 danielcompton: lxsameer What do you mean by networking? Ring is the most popular web request framework

17:01 lxsameer: danielcompton: something like twisted in python

17:03 danielcompton: lxsameer maybe one of these http://clojure-libraries.appspot.com/cat/Networking

17:03 or use Netty directly from Java

17:03 lxsameer: thanks

17:08 amalloy: if you want an event-based networking library, i think aleph is the one. unless core.async is better these days?

17:17 technomancy: amalloy: ayup, that was me

17:33 arkh: jnanomsg looks interesting (core.async networking) http://niwibe.github.io/jnanomsg/#_async_support

17:33 andyf: I've been thinking of how Eastwood (Clojure lint tool) could avoid conflicting with code it is linting, in the dependencies that Eastwood uses.

17:34 e.g. Eastwood uses tools.analyzer.jvm, which in turn uses core.memoize, which uses core.cache, which uses data.priority-map

17:35 I 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:36 It 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:36 technomancy: andyf: as long as there are no Java deps, such a thing is theoretically feasible

17:37 you could replace require with something that can swap out ns with metaverse's ns, but it gets a bit hairy

17:37 this is where I reeeeeeally with ns could contain fully-qualified clauses instead of only working with stuff in clojure.core =\

17:38 stuff 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:38 super annoying

17:39 kenrestivo: chicken and egg tho. how would those ns's get imported before the ns macro runs?

17:39 andyf: reading and thinking ...

17:40 technomancy: kenrestivo: just require the ns of the fully-qualified keyword

17:40 we do it all the time in lein

17:40 then you don't need your own ns macro

17:40 seancorfield: but why should (ns my.ns (:println [any.random.stuff])) even be allowed to work at all?

17:40 * seancorfield wonders why it is useful...

17:40 technomancy: seancorfield: without the ability to use fully-qualified keywords I agree it's silly

17:41 but if you added in that, then stuff like https://code.google.com/p/clj-nstools/ would be way less gross

17:41 andyf: So would you recommend as a less hairy option simply copying source files of dependencies into Eastwood, and renaming the namespaces?

17:41 technomancy: andyf: that's probably less crazy, yeah

17:41 andyf: I 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:41 technomancy: obviously not a great solution though

17:42 andyf: It has the advantage that I can understand it well :)

17:42 seancorfield: technomancy: what would be lost if ns enforced only :require, :use, and :import as legal clauses?

17:45 technomancy: seancorfield: 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:45 andyf: technomancy: 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:47 I can check whether those deps have any keywords in ns other than :require :use :import, but I doubt they use anything else.

17:48 seancorfield: technomancy: fair enough... the current situation is random and broken, I agree.

18:08 amalloy: andyf: :refer pops up in ns clauses every so often, as does :refer-clojure. and of course :gen-class

18:10 cbp: :load :P

18:18 PigDude: do you use when-let or some-> for a single form?

18:29 andyf: amalloy: 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:30 And as so often happens, I write sounding like the department of redundancy department.

18:34 technomancy: andyf: it's all a question of where you want to land on the crazy/tedious spectrum

18:34 or I guess it's a continuum

18:34 not sure what the difference is there

18:35 andyf: technomancy: a few bash scripts make the tedious parts significantly less.

18:42 catern: aaaaaaargh

18:42 i want to do tail recursion in a multi-method

18:42 but I can't :(

18:47 dbasch: catern: https://groups.google.com/forum/#!msg/clojure/5pxJbxkCfZ4/_DMGT_s01cwJ

18:51 catern: is 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:52 but, okay, i will do this, after I read the next section in my book which describes using trampolining :)

18:54 cbp: ~trampoline

18:54 clojurebot: trampoline is http://groups.google.com/group/clojure/browse_thread/thread/6257cbc4454bcb85/3addf875319c5c10?#3addf875319c5c10

18:54 cbp: not the snappy remark i was expecting

18:55 catern: trampolining feels like an ugly hack to me, though

18:56 amalloy: catern: because each body of the multimethod is necessarily a different function, which is a different jvm method

18:56 catern: because the existence of the stack is an implementation detail

18:57 amalloy: the jvm doesn't support tail calls, so recur can only go to someplace in the same method

18:57 catern: amalloy: oh, is recur just a jump?

18:57 amalloy: yes

18:57 catern: and you can't jump between jvm methods i assume?

18:58 amalloy: indeed

18:59 danielcompton: What'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:59 ?

19:00 Frozenlock: max?

19:00 clojurebot: Neither bot has an accurate value for the max number of users in #clojure

19:00 Frozenlock: (max 0 -1)

19:00 ,(max 0 -1)

19:00 clojurebot: 0

19:00 Frozenlock: ,(max 0 11)

19:00 clojurebot: 11

19:00 danielcompton: Frozenlock thanks!

19:00 catern: ah, I like the ability to just prepend # to have a trampolined tail call

19:00 danielcompton: Frozenlock I knew there was something really simple there

19:01 Frozenlock: So many functions to learn :-p

19:13 lodin: Is there any profound reason why maps support both (:key data) and (data :key) but records only support the former version?

19:16 seancorfield: b/c records are Java classes (and they don't implement IFn) I believe

19:17 lodin: ... and any reason they don't implement IFn? :-)

19:20 bbloom: lodin: i wondered the same thing... in fact, i *assumed* they did until amalloy set me straight

19:20 lodin: my guess is that it is because you might want to implement IFn yourself, as i did :-)

19:20 if you don't want ILookup or whatever, then just use deftype

19:22 lodin: bbloom: What did you use the IFn implementation for?

19:22 bwreilly: would 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:22 whomp: i'm trying to use rincanter, but i get the following issue: https://github.com/jolby/rincanter/issues/4

19:22 any ideas?

19:22 bbloom: lodin: 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:23 lodin: bbloom: Like a partially applied function?

19:24 bbloom: lodin: could be one example

19:24 lodin: honestly though, i think the decision not to auto-impl IFn is relatively arbitrary

19:30 amalloy: bwreilly: in general, irc channels have a policy of "don't ask to ask, just ask". saves effort for everyone

19:31 bwreilly: amalloy: understood, thanks

19:31 the thing in question: https://github.com/bwreilly/server-climb

19:32 amalloy: bbloom: 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:32 so implementing IFn would encourage you to do something that you don't actually want

19:33 bbloom: amalloy: interesting, i could see that being a plausible motivation

19:37 lodin: amalloy: 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:38 amalloy: i 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:39 (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:16 arkh: bwreilly: any reason you went w/ refs over an atom to store state? Just curious

20:18 bwreilly: arkh: 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:20 a lot of the things being done are communicative - the updating of active-requests and request-log for instance

20:25 humbleZ: #playframework

20:25 arkh: bwreilly: 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:27 bwreilly: maybe this is a dumb question but are you able to generate requests fast enough w/out multiple threads?

20:28 bwreilly: it's cleanly written though - I like it

20:29 bwreilly: arkh: thank you

20:32 arkh: 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:32 that is, http-kit is the library, request is the function

20:32 http://http-kit.org/client.html

20:32 arkh: bwreilly: oh I'm sorry - that works well then

20:39 amalloy: bwreilly: i don't think http-kit actually creates threads for each request

20:39 it uses non-blocking io so that it doesn't have to

20:41 a 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:43 AWizzArd: It would be really surprising if an event-based server would start new threads.

20:43 It is the core idea to exactly not do that.

20:47 bwreilly: amalloy: ah, that makes more sense. thanks

21:15 numberten: does recur have an implicit do in it?

21:17 AWizzArd: numberten: can you give an example? You can think of recur as the name of a function.

21:18 numberten: ah okay thanks

21:19 AWizzArd: (defn foo [x] (when (pos? x) (recur (dec x)))) ; think of `recur` as if it were `foo`.

21:23 dbasch: AWizzArd: 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:23 sorry, numberten I meant

21:41 amalloy: AWizzArd: 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:04 AWizzArd: amalloy: yes, under the hood this makes sense. I meant that not for each incoming request is handled by a new thread.

22:19 tokah: I have clojure v1.6 and I can't seem to find the clojure.edn namespace is possible I

22:19 *I'm missing some needed dependency?

22:22 gfredericks: ,(require 'clojure.edn)

22:22 clojurebot: nil

22:22 dbasch: tokah: do you have some code that’s not working?

22:22 gfredericks: tokah: I think we'll need some more context to debug that; it should work

22:24 tokah: I 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:27 Is 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:27 gfredericks: it means some other namespace already loaded it

22:27 which isn't good to count on in general

22:32 tokah: ok thanks.

22:33 amalloy: plus, you'd rather require it with an alias or something anyway. nobody wants to refer clojure.edn/read fully-qualified over and over

22:33 gfredericks: clojurebot: nobody |wants| to refer clojure.edn/read fully-qualified over and over

22:33 clojurebot: Ok.

22:34 dbasch: ,(all-ns)

22:34 clojurebot: (#<Namespace clojure.uuid> #<Namespace user> #<Namespace clojure.core> #<Namespace sandbox> #<Namespace clojure.repl> ...)

22:34 gfredericks: someday 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:38 TEttinger: ~nobody

22:38 clojurebot: nobody wants to refer clojure.edn/read fully-qualified over and over

22:38 TEttinger: ~anyone

22:38 clojurebot: Just 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:38 TEttinger: very different

22:40 gfredericks: ~anybody

22:40 clojurebot: anybody is anyone

22:40 gfredericks: ~noone

22:40 clojurebot: It's greek to me.

22:41 dbasch: clojurebot: everybody |do| the dinosaur

22:41 clojurebot: 'Sea, mhuise.

23:09 EroticFish: SSL/TSL question anyone there?

23:11 dbasch: EroticFish: just ask

23:21 EroticFish: If 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:32 If 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:33 Anyone?

23:58 Frozenlock: Is there a an argument to force lein to reload all snapshots?

Logging service provided by n01se.net