2014-05-26
| 00:00 | Jaood | pic? |
| 02:15 | trap_exit | has anyone managed to combine clojure notation and MatLab matrix notation? |
| 03:06 | rurumate | Is there a wizard here, who can help with a macro? Thanks! https://www.refheap.com/85907 |
| 03: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 |
| 03:33 | amalloy | but don't start with a macro if you have no idea how to implement it |
| 03:33 | amalloy | 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 |
| 03:33 | amalloy | then implementing the macro will be easy for you |
| 03:41 | rurumate | amalloy: ok one moment, |
| 03:45 | rurumate | amalloy: I've added one function at the bottom, in the refheap page, to show the problem I'm trying to solve |
| 03:45 | rurumate | basically, I'm spreading the structure (positions of fields) of header around my code, which makes it very hard to maintain as it grows |
| 03:47 | amalloy | well, it looks like you've implemented (defn get-read-perms [row] (map first row)) |
| 03:47 | amalloy | 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 |
| 03:48 | rurumate | amalloy: ok, I'll add that too |
| 03:48 | rurumate | the thing is, I have some idea, but could not do it |
| 03:48 | rurumate | one moment |
| 03: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 |
| 03:49 | rurumate | I want to write a let, with the result of tap-var-vector as the bindings |
| 03:50 | rurumate | but I can not call tap-var-vector at macroexpansion time, because I don't have row yet |
| 03:50 | rurumate | so I need a macro that expands to a function |
| 03:51 | rurumate | hang on |
| 03: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 |
| 03:56 | rurumate | ok, I've added what I want the macro call to expand to, at the bottom |
| 03:56 | rurumate | from line 35 |
| 03:59 | rurumate | I feel like trying again though |
| 04:00 | quizdr | rurumate i have learned, in part thanks to amaloy |
| 04:00 | quizdr | that you do not need macros most of the time you think you do |
| 04: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? |
| 04:01 | quizdr | rurumate you mean lexical bindings within the macro? |
| 04:01 | quizdr | you can emit those as an autogensym if you need to |
| 04: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 |
| 04:02 | quizdr | you can certainly do that |
| 04:03 | quizdr | 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 |
| 04: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) |
| 04:05 | rurumate | amalloy: this is cascalog, so needs vectors |
| 04:05 | amalloy | so write a function that turns a silly vector into a map |
| 04:05 | rurumate | hm |
| 04:06 | rurumate | seems reasonable |
| 04:06 | rurumate | but really, can't write it the way I showed? what is the problem with that approach? |
| 04: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? |
| 04:07 | amalloy | your macro will receive 'header as a symbol, not a vector |
| 04: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 |
| 04:08 | rurumate | amalloy: will it help, when I pass it the var instead? like #'header |
| 04:08 | amalloy | no |
| 04:08 | amalloy | that would be passing it a list, with the symbol var and then the symbol header |
| 04:08 | rurumate | can't resolve vars within a macro? |
| 04:09 | rurumate | sounds major impediment |
| 04:09 | amalloy | you can, but it's tacky and wrong |
| 04:10 | rurumate | I think cascalog does that all over the place, I always pass my taps as vars and <- can resolve everything |
| 04:12 | rurumate | like (<- [?user ?group ?others] ((foo-tap) :>> header)) <-- assuming header = '[?user ?group ?others] |
| 04:12 | rurumate | that works fine |
| 04:13 | quizdr | rurumate well there is the function "resolve" but if you need it likely you can things a better way. |
| 04:13 | quizdr | ,(doc resolve) |
| 04:13 | clojurebot | "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)" |
| 04:13 | rurumate | I'll check whether it's used in cascalog |
| 04: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. |
| 04: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 |
| 04: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. |
| 04:18 | quizdr | it can use it in the macro's internal logic, or emit the symbol as part of the macro output |
| 04:18 | quizdr | so you can check to see how cacalog is actually using the symbols it is passed |
| 04:20 | quizdr | for example, https://www.refheap.com/85909 |
| 04: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 |
| 04:36 | quizdr | rurumate well at the very least you will learn a lot in the process |
| 05: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) |
| 05:15 | gyim | everything seems fine: the previous invocation exited (there are no active jobs), there was no exception, and the job seems to be scheduled |
| 05:15 | gyim | my-job ; => #<RecurringJob id: 6, created-at: Tue 12:20:55s, ms-period: 25000, initial-delay: 25000, desc: "", scheduled? true> |
| 05:15 | gyim | (.getActiveCount (:thread-pool @(:pool-atom my-timer-pool))) ; => 0 |
| 05:15 | gyim | (.getDelay (:job my-job) java.util.concurrent.TimeUnit/SECONDS) ; => -1096873 |
| 05:34 | xsyn | Is there a good reason that a Scala user should try Clojure? |
| 05:38 | mpenet | vague... depends on what he wants to do. But being curious is always good. |
| 05:38 | vijaykiran | clojure has a different philosophy than Scala. It also depends on what was the good reason for you to learn Scala ? |
| 05:39 | xsyn | it's not for me |
| 05:39 | xsyn | I'm doing a presentation to a Scala users group |
| 05:40 | xsyn | but I'm struggling to find a defining value proposition |
| 05:40 | vijaykiran | :) ah - okay. Simplicity |
| 05:40 | xsyn | haha |
| 05:40 | xsyn | the case for semantic elegance? |
| 05:41 | vijaykiran | that's fairly subjective, IMHO |
| 05:41 | vijaykiran | so difficult to win over arguments with that |
| 05:42 | vijaykiran | this might help - http://programming-puzzler.blogspot.nl/2013/12/clojure-vs-scala.html |
| 05:42 | xsyn | Was literally just reading though |
| 05:43 | xsyn | that* |
| 05:43 | xsyn | not thogh |
| 05:43 | xsyn | *hangs head* |
| 05:43 | xsyn | excuse me while I go out back and shoot my hand |
| 05:44 | mpenet | portability comes to mind too, scala is much more tied to the jvm it seems |
| 05:44 | mpenet | harder to port on other platforms |
| 05:45 | vijaykiran | and the tooling - just compare lein vs sbt - and they'll drool ;) |
| 05:45 | xsyn | apparently sbt is kinda complex |
| 05:46 | xsyn | http://hammerprinciple.com/therighttool/items/clojure/scala |
| 05:48 | vijaykiran | you can drop "kinda" :) |
| 06:59 | lxsameer | hi , i'm looking for a package to create a sock5 proxy, any recommendation ? |
| 08:32 | ticking_ | any thoughts on gloss vs blobbity vs buffy? I'm looking for the most elegant one, where speed comes secondary ^^ |
| 08:32 | ollivera | how to compare to dates in clojure? data1 > date2? |
| 08:34 | ticking_ | ollivera: date as in time? |
| 08:34 | ollivera | ticking, yes |
| 08: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 |
| 08:35 | ollivera | ticking, thank you |
| 08: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 |
| 08:44 | gfredericks | ,#inst "2014" |
| 08:44 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 08:44 | gfredericks | &#inst "2014" |
| 08:44 | lazybot | ⇒ #inst "2014-01-01T00:00:00.000-00:00" |
| 08:45 | gfredericks | I wonder what clojurebot is denying there |
| 08:45 | hyPiRion | &'#inst "2014" |
| 08:45 | lazybot | ⇒ #inst "2014-01-01T00:00:00.000-00:00" |
| 08:46 | hyPiRion | &(binding [*print-dup* true *print-meta* true] (pr-str #inst "2014")) |
| 08:46 | lazybot | java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad! |
| 08:46 | gfredericks | clojurebot: pop-thread-bindings is bad! |
| 08:46 | clojurebot | Ack. Ack. |
| 08:47 | gfredericks | clojurebot: You |tripped| the alarm! |
| 08:47 | clojurebot | 'Sea, mhuise. |
| 08:47 | hyPiRion | still prints out same thing though |
| 09:37 | mpenet | ollivera: if its just > you can just use getTime |
| 09:37 | mpenet | (> (.getTime (java.util.Date.)) (.getTime (java.util.Date.))) |
| 09:37 | mpenet | ,(> (.getTime (java.util.Date.)) (.getTime (java.util.Date.))) |
| 09: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 | owl-v- | *shrug* |
| 10:32 | owl-v- | (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 | powrtoc | this as my projects interface... Or C) Do something else? |
| 11:42 | noncom | powrtoc: i think that A is the way |
| 11:43 | noncom | 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 | noncom | i'd vote for keeping things as transparent as possible |
| 11:44 | noncom | 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 | powrtoc | essentially a Dataset is just a hashmap of {:column-names [a b c] :rows [[1 2 3] [:a :b :c]]} |
| 11:47 | powrtoc | so it's not exactly complex should things change |
| 11:48 | powrtoc | 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 | clgv | 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 | noncom | dnd: use defn |
| 11:51 | noncom | dnb: for explanation look at defn source |
| 11:51 | noncom | clgv: but the exception is awesome too |
| 11:52 | noncom | 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 | rkneufeld | cbp: Thanks |
| 13:21 | deadghost | is there a standard way to run $ lein cljsbuild auto $ lein garden auto $ lein ring server-headless? |
| 13:21 | deadghost | 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 | jamieenglish | 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 127.0.0.1 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 | bbloom | 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 | bbloom | akurilin: and https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java#L89-L95 |
| 15:27 | bbloom | that's it! |
| 15:28 | akurilin | bbloom: ha nice! |
| 15:29 | akurilin | 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 | bbloom | 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 | akurilin | 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 | akurilin | *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 | bbloom | that's not block-to-read |
| 15:34 | bbloom | that's wait-on-writes |
| 15:35 | bbloom | akurilin: if you want truely serialized transaction processing, including reads and writes, use a queue or similar |
| 15:35 | bbloom | 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 | PigDude | a serialize/deserialize interface |
| 15:50 | PigDude | before i go making a protocol for this |
| 15:51 | cbp | ObjectOutputStream? :-P |
| 15:51 | cbp | 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 | PigDude | 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 | dbasch | 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 | PigDude | 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 | danielcompton | 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 | andyf | e.g. Eastwood uses tools.analyzer.jvm, which in turn uses core.memoize, which uses core.cache, which uses data.priority-map |
| 17:35 | andyf | 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 | andyf | 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 | technomancy | you could replace require with something that can swap out ns with metaverse's ns, but it gets a bit hairy |
| 17:37 | technomancy | this is where I reeeeeeally with ns could contain fully-qualified clauses instead of only working with stuff in clojure.core =\ |
| 17:38 | technomancy | 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 | technomancy | 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 | technomancy | we do it all the time in lein |
| 17:40 | technomancy | 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 | technomancy | seancorfield: without the ability to use fully-qualified keywords I agree it's silly |
| 17:41 | technomancy | 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 | andyf | 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 | andyf | 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 | technomancy | or I guess it's a continuum |
| 18:34 | technomancy | 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 | catern | i want to do tail recursion in a multi-method |
| 18:42 | catern | 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 | catern | 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 | danielcompton | ? |
| 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 | Frozenlock | ,(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 | bbloom | lodin: my guess is that it is because you might want to implement IFn yourself, as i did :-) |
| 19:20 | bbloom | 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 | whomp | 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 | bbloom | 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 | bwreilly | 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 | amalloy | 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 | amalloy | (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 | bwreilly | 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 | arkh | bwreilly: maybe this is a dumb question but are you able to generate requests fast enough w/out multiple threads? |
| 20:28 | arkh | bwreilly: it's cleanly written though - I like it |
| 20:29 | bwreilly | arkh: thank you |
| 20:32 | bwreilly | 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 | bwreilly | that is, http-kit is the library, request is the function |
| 20:32 | bwreilly | 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 | amalloy | it uses non-blocking io so that it doesn't have to |
| 20:41 | amalloy | 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 | AWizzArd | 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 | dbasch | 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 | tokah | *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 | tokah | 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 | gfredericks | 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 | 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:33 | EroticFish | Anyone? |
| 23:58 | Frozenlock | Is there a an argument to force lein to reload all snapshots? |