2011-03-14
| 00:01 | mec | Anyone happen to know where that talk is by rich about clojure being made up of simples? |
| 00:05 | technomancy | tomoj: if you're looking at doing a lucene wrapper you could extract something from https://github.com/technomancy/usable-az |
| 00:06 | technomancy | it's quite schemaless |
| 00:07 | brehaut | mec its stuart halloways talk i believe |
| 00:08 | mec | ah hah, maybe thats why i cant find it |
| 00:08 | brehaut | mec http://clojure.blip.tv/file/4824610/ |
| 00:08 | mec | brehaut: thanks |
| 00:08 | brehaut | mec: and slides https://github.com/downloads/stuarthalloway/clojure-presentations/Clojure-Simplicity.pdf |
| 00:49 | sattvik | Hmmm... Given a protocol defined in namespace A, and extended in namespace B, is there any way for users of B to refer to the protocol function without including A as well? |
| 00:50 | amalloy | sattvik: no. the protocol function is named A/myfn, so they have to at least (require 'A) |
| 00:52 | sattvik | Thanks, that's what I thought. I was hoping to find someway around that problem. |
| 00:56 | amalloy | what for? |
| 00:59 | tomoj | I think there are some dirty tricks that will work |
| 00:59 | tomoj | like potemkin? |
| 01:00 | sattvik | Well, I'm developing a library. I designed a protocol with a few implementations in one namespace. In another, I extend the protocol in such a way that it depends on some vars defined in the new namespace. It would be nice if users of the second namespace could use the protocol function without needing to load the first explicitly. |
| 01:00 | tomoj | emphasis on "dirty" |
| 01:01 | sattvik | I figured it'd have to be dirty. But I just haven't found the right way to do it, yet. |
| 01:12 | sattvik | Ah, I think I got it worked out… In the second namespace, I exclude the protocol function in my ns declaration, then I extend the protocol, and, finally, (def foo A/foo). |
| 01:14 | amalloy | sattvik: wait, why not just defalias? |
| 01:14 | amalloy | if you're going to go that route |
| 01:14 | amalloy | (disclaimer: no idea if defalias will solve this) |
| 01:17 | sattvik | amalloy: Well, I am trying to reduce dependencies as this is an Android library. Unfortunately, adding a new def also creates the problem of conflicting names if both namespaces are used. |
| 01:17 | tufflax | Hm, I notice that the example at the end here http://clojure.org/atoms didn't work as I first expected. I thought that calling ((memoize fib) 40) was gonna be fast, because the memoized version would use the memoized version in the recurisve calls. But that is apparently not what is happening. So I wanted to understand why that is not happening. Is it because "fib" in the (defn fib ...) body is like a local variable? Or, can someone explain |
| 01:19 | amalloy | tufflax: (memoize f) returns a new version of f, such that each call to this new function is memoized, without changing the underlying function |
| 01:20 | amalloy | f cannot know that it has been memoized, so unless it is calling through something like a global var (which often it is), it won't pass through the cache again for recursive calls |
| 01:20 | amalloy | (def fib (memoize fib)) causes the recursive calls to *also* go through the memoization cache |
| 01:22 | tufflax | amalloy: Excuse me, I shoud have said that even if I did (def fib (memoize fib)) it is not fast the first time. |
| 01:26 | amalloy | weird |
| 01:26 | sattvik | tufflax: It won't be fast the first time since it hasn't cached any values. It's only on subsequent calls that you'll see the improvement. |
| 01:26 | tufflax | So, it seems you are wrong about that the recursive calls go through the memoization cache in that case. It seems that the recursive fibs don't refer to the global fib, but to the local one being defined in the defn. |
| 01:27 | tufflax | sattvik if the recursive fibs did refer to the gobal var, then it would be fast the first time too. |
| 01:27 | sattvik | tufflax: Yes, I think I see what you mean. |
| 01:28 | amalloy | tufflax: (defn fib [] (fib)) macroexpands to (def fib (.withMeta (clojure.core/fn fib ([] (fib))) (.meta (var fib)))) |
| 01:28 | amalloy | so it looks like it does indeed name the function fib rather than make it look up the var |
| 01:31 | tufflax | Hm, I'm not sure I understand what's happening there... :P |
| 01:32 | sattvik | This works as expected (from the REPL): (defn fib [n] (if (<= n 1) n (+ (user/fib (dec n)) (user/fib (- n 2))))) |
| 01:32 | amalloy | tufflax: (fn fib []) defines an anonymous function, but gives it a "local name" of fib so that it can be self-recursive if necessary |
| 01:32 | tufflax | I mean, (clojure.core/fn fib ([] (fib))) looks just like it did previosuly |
| 01:32 | amalloy | as opposed to (fn [] (fib)) |
| 01:32 | tufflax | oh, yeah |
| 01:34 | sattvik | An interesting quirk. |
| 01:34 | tufflax | So, the documentation here http://clojure.org/atoms is inaccurate :P |
| 01:35 | tufflax | The example at least |
| 01:35 | sattvik | Although, apparently it may not be necessary (def fib (fn [] (fib)) sitll works. |
| 01:36 | amalloy | a shorthand for sattvik's user/fib workaround is just #'fib |
| 01:47 | tufflax | amalloy: Hm, I'm not following that last thing you said. Where should I put #'fib? |
| 01:47 | amalloy | (defn fib [n] (+ (#'fib (dec n)) (#'fib (- 2 n))) |
| 01:49 | tufflax | Ah ok. Hm... I find that a bit strange. #'something and something isn't generally the same thing, right? |
| 01:50 | amalloy | right |
| 01:50 | amalloy | &[#'first first] |
| 01:50 | sexpbot | ⟹ [#'clojure.core/first #<core$first clojure.core$first@849ba2>] |
| 01:50 | amalloy | "#'fib" is the global var holding the function "fib" |
| 01:51 | amalloy | &(identical? @#'first first] |
| 01:51 | sexpbot | ⟹ true ; Adjusted to (identical? (clojure.core/deref (var first)) first) |
| 01:54 | sattvik | It just so happens that vars are functions that will deref themselves and execute the result. |
| 01:54 | sattvik | ,[(ifn? #'first) (.fn #'first)] |
| 02:03 | amalloy | sattvik: not sure what you're hoping .fn will do |
| 02:04 | tufflax | Hm, I thought of names like 'fib' as some kind of reference to a var that holds the "value" of 'fib'. Is that a correct mental model? Or how should I think about the relationship between the name 'fib' and the var? |
| 02:06 | clojurebot | anonymous functions are functions with no names |
| 02:06 | clojurebot | [true #<core$first clojure.core$first@47193>] |
| 02:08 | amalloy | clojurebot: wb bro |
| 02:08 | clojurebot | you have to watch twbray, if you take your eye off him for a second he is likely to blog post |
| 02:09 | amalloy | hiredman: any way to find out what caused him to tell us about anonymous functions? it's surprisingly relevant but delayed by like half an hour |
| 02:10 | amalloy | tufflax: rather than "names", "symbols" is appropriate. and you are correct that symbols are basically holders for values |
| 02:10 | tomoj | I see "are functions" and "wb" and am also curious |
| 02:11 | amalloy | the var #'fib is the value bound to 'fib, but it is a special reference type, referring to the value (fn ...) |
| 02:11 | tufflax | So, when evaluating 'fib', say, in the REPL, there is some kind of look-up from symbol to var going on? And then the var is derefed? |
| 02:12 | amalloy | yeah, that's about right |
| 02:12 | tufflax | ok... btw should I report the small bug I found in the documentation somewhere? :P |
| 02:12 | amalloy | check out (ns-map *ns*). warning, that prints a lot, so you may want to ##(take 10 (ns-map *ns*)) |
| 02:12 | sexpbot | java.lang.SecurityException: You tripped the alarm! ns-map is bad! |
| 02:12 | amalloy | feh |
| 02:12 | amalloy | ,(take 10 (ns-map *ns*)) |
| 02:12 | clojurebot | ([sorted-map #'clojure.core/sorted-map] [read-line #'clojure.core/read-line] [re-pattern #'clojure.core/re-pattern] [keyword? #'clojure.core/keyword?] [val #'clojure.core/val] [ProcessBuilder java.lang.ProcessBuilder] [chunked-seq? #'clojure.core/chunked-seq?] [Enum java.lang.Enum] [find-protocol-impl #'clojure.core/find-protocol-impl] [SuppressWarnings java.lang.SuppressWarnings]) |
| 02:13 | amalloy | when the repl needs to find the value for a symbol, it first looks to see if there are any lexical bindings (eg (let [fib 1] fib)) |
| 02:13 | amalloy | if there are none, it looks in the ns-map, and uses the value it finds there |
| 02:14 | amalloy | vars have the unusual behavior that, unless you specifically request the var object (with #'fib or (var fib)), they evaluate to the value they hold |
| 02:14 | tufflax | oh, yeah, i read about that order somewhere. I'm working my way through the docs, but apparently I don't remeber everything |
| 02:15 | amalloy | so (first x) first fails to find a local named first, then finds a var associated with the symbol 'first, then finally resolves to the value of that var, (fn first [s] ...) |
| 02:16 | amalloy | which it finally calls with the argument x |
| 02:16 | tufflax | Yeah ok. Thank you very much! I'm trying to get a good mental model of how everything works. Lacking such a model feels bad. :P |
| 02:17 | amalloy | tufflax: no matter how many times i write out my model i find bits that are fuzzy |
| 02:17 | amalloy | if you instead write (#'first x), you're intentionally bypassing the first step |
| 02:17 | amalloy | (more or less) |
| 02:17 | tufflax | I see |
| 02:23 | amalloy | tufflax: this only works because of the trickery sattvik mentioned: if you attempt to call a var object directly, it delegates to the value it's holding |
| 02:23 | tufflax | Yeah |
| 02:25 | tufflax | Ideally all such little things should be documented somewhere.I don't think I've seen any mention of that in the docs, and I don't think it is going to be in the parts I have left. :p |
| 02:25 | amalloy | heh |
| 02:25 | amalloy | well, depending on the quality of docs you require |
| 02:25 | amalloy | you could say it's documented in Var.java |
| 02:26 | tufflax | Hehe yeah maybe |
| 02:27 | tufflax | Well, I'm going to get some food. Thank you again! |
| 04:06 | Matt324 | In a macro, is it possible to access the precise source location of what you get passed? |
| 04:13 | tomoj | looks like &form has line metadata, but not file |
| 04:17 | tomoj | I suppose the line number isn't a precise location, though? |
| 04:18 | Matt324 | I was hoping to be able to get a precise character range in the source |
| 04:20 | tomoj | don't think you can get that without hacking clojure's guts |
| 04:22 | Matt324 | Fair enough ;-) |
| 04:59 | ejackson | Morning all |
| 05:31 | TobiasRaeder | morning |
| 05:40 | robink | TobiasRaeder: Morning. |
| 06:44 | tsdh | Hi. |
| 06:51 | tsdh | I tried adding IEditableCollection support to ninjudd's PersistentOrderedSet class. But when using a jar with that version in my clojure code, I get wrong results. I don't use `transient' directly, but I frequently merge an arbitrary number of sets using `into', which by default goes transient if the datastructure supports that. |
| 06:52 | tsdh | If someone wants to check my implementation of TransientOrderedSet (and PersistentOrderedSet.asTransient()) starting at line 202 at http://pastebin.com/H2k9q75u that would be awesome. |
| 06:54 | tsdh | Of course, I tried some debugging at the repl, but for all simple cases, the results are fine. |
| 07:07 | tsdh | Hm, for testing, I've redefined the standard `into' in order not to go transient, and then it works with my patched version, too. So at least I can exclude that I accidentially broke the persistent version... |
| 07:32 | robink | OK, I'm using Quassel. |
| 07:34 | robink | oops, ww |
| 07:38 | kumarshantanu | hi |
| 07:38 | kumarshantanu | is there a way to discover all namespaces in a given/current classpath? |
| 07:49 | angerman | I need some help with desinging an api. |
| 07:50 | kumarshantanu | angerman: go ahead |
| 07:50 | angerman | I have a `geometry` record. that has nodes, vertices, edges and faces |
| 07:50 | angerman | And I have accessor methods like add-vertex / get-vertex / set-vertex / remove-vertex |
| 07:51 | angerman | right now (yes, it's a mess), the geometry record is bound globally, and thus (add-vertex),… do not need to be fed the geometry structure. |
| 07:51 | angerman | that is quite convinient, e.g. you don't want to write: (add-vertex my-geometry a b c) each time. |
| 07:52 | kumarshantanu | angerman: are the fns add-vertex, get-vertex etc part of the record? (as in from a protocol?) |
| 07:54 | angerman | kumarshantanu: not yet. it's pretty bare-bones no protocols yet |
| 07:55 | angerman | I'm wondering if some (with-geometry my-geometry … ) is the right choice |
| 07:55 | kumarshantanu | angerman: an idea - create a protocol having those fns and use (doto my-geometry (add-vertex vertex-arg)) |
| 07:56 | kumarshantanu | ,(doc doto) |
| 07:56 | clojurebot | "([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))" |
| 07:58 | kumarshantanu | angerman: if (with-geometry ..) only binds the global var then it's probably not too different from the current approach |
| 07:59 | angerman | kumarshantanu: yes. I guess I'll have to use multimethods and multi arity fns. |
| 08:01 | angerman | e.g. what I'd like to have is (add-vertex a b c) (add-vertex [a b c]) (add-vertex geometry a b c) and (add-vertex geometry [a b c]) |
| 08:01 | angerman | the latter two look like protocol fns. right? |
| 08:02 | angerman | while the first two are regular multi arity fns. |
| 08:02 | angerman | I just wonder if I can mix them. |
| 08:02 | kumarshantanu | angerman: IMHO it is generally a good practice to separate a function from what operand it works on, so I would strongly advise against relying on a global var (even when used with (binding ...)) |
| 08:03 | kumarshantanu | you can mix them of course, as long as you have only one multi-arity version for each fn |
| 08:05 | angerman | kumarshantanu: I'm somewhat undecided. but (add-vertex-to-geometry geometry …) just gets too long :/ |
| 08:05 | angerman | I know that the idea feels a little like magic. :/ |
| 08:05 | kumarshantanu | angerman: doto might be useful |
| 08:06 | angerman | kumarshantanu: doto only works as long as there is a successive choice. but you would usually do a lot of different things, with the same backing geometry. |
| 08:07 | angerman | and they are not all directly associated with the geometry. E.g. there are flights of near perpendicular code to the geometry. It just fits there better for understanding. :/ |
| 08:08 | naeu | How might I reset an atom and get its previous value atomically? |
| 08:09 | angerman | neau (swap! atom (fn [_] val)) |
| 08:09 | angerman | ahh, you want the val as well. |
| 08:09 | angerman | hmm. |
| 08:09 | naeu | yup |
| 08:10 | angerman | I guess you want a ref then |
| 08:10 | kumarshantanu | naeu: consider STM for that |
| 08:10 | naeu | hmm, ok |
| 08:10 | naeu | perhaps I must be doing something wrong then |
| 08:10 | naeu | it felt like all I wanted was a version of reset! that returned the value that was swapped out |
| 08:11 | naeu | I mean, I already know the value I'm going to swap in as I have it |
| 08:11 | kumarshantanu | angerman: i see your point (re successive choice) |
| 08:12 | angerman | neau: atoms and refs are for different things. I assume what you really want is a ref. |
| 08:12 | naeu | angerman: but i don't want to coordinate over a bunch of shared state |
| 08:19 | naeu | ok, so perhaps I'm asking the wrong question |
| 08:20 | naeu | so what might be the best way of looking at the values of a list, calling a fn with the vals and then resetting the list to the empty list all atomically? |
| 08:21 | angerman | so basically the list needs /not to change/ during the operation? |
| 08:22 | naeu | angerman: exactly |
| 08:22 | naeu | perhaps I should use an agent |
| 08:22 | angerman | make the list a ref |
| 08:22 | angerman | and then dosync on it. |
| 08:22 | naeu | angerman: then my 'calling a fn with the vals' part might get repeated |
| 08:23 | naeu | i guess i could return the vals from the dosync |
| 08:23 | naeu | and call the fn immediately after the transaction has completed |
| 08:24 | angerman | if you don't need to know the result of the fn, prior to resetting the list to empty. yes. |
| 08:25 | naeu | angerman: no i don't |
| 08:25 | naeu | i just don't want to lose the result |
| 08:25 | naeu | (prior to resetting it) |
| 08:26 | angerman | (dosync (let [list @my-list] (ref-set! my-list '()) list)) |
| 08:26 | angerman | no? |
| 08:31 | naeu | angerman: yup, that's exactly what i ended up doing :-) |
| 08:31 | naeu | it just seems like overworking the STM for this simple usecase |
| 08:32 | chouser | nah. Until we have a version of swap that returns the old value, that's about as good as it gets |
| 08:33 | chouser | I think you'll find that unless there's a lot of contention on that ref, that it performs quite well enough. |
| 08:45 | angerman | so I cannot have [ & rest] fn in a record? |
| 08:46 | angerman | err type? |
| 08:47 | kumarshantanu | is there a way to discover all namespaces in a given/current classpath? (this is a repeat question) |
| 08:53 | mprokos | Just getting started with clojure. I was thinking of using it in place of xml for a configuration file. |
| 08:59 | mprokos | How do I modify a java object's member variable's w/o using the object's methods? |
| 09:00 | fliebel | mprokos: set! I think. |
| 09:01 | mprokos | nice! perfect |
| 09:20 | kumarshantanu | ,(doc set!) |
| 09:20 | clojurebot | excusez-moi |
| 09:20 | kumarshantanu | fliebel: mprokos: there seems to be nothing called set! |
| 09:21 | fliebel | kumarshantanu: It's a secial form ;) |
| 09:21 | fliebel | *special |
| 09:27 | mprokos | (set! (. obj membervar) value) worked for me |
| 09:30 | kumarshantanu | fliebel: mprokos: cool |
| 09:31 | kumarshantanu | do you need a setter to carry out the change? |
| 09:32 | fliebel | mprokos: I think obj/memvar is the preferred form. |
| 11:36 | talladam | hi guys, does anyone here use mongo from clojure? |
| 11:36 | chouser | talladam: yes |
| 11:36 | talladam | chouser: do you use congomongo, or the native java client? |
| 11:36 | chouser | congomongo uses the native java client |
| 11:37 | talladam | chouser: I know, but it seems to be less efficient |
| 11:37 | talladam | chouser: I was wondering if the 'fetch' functionality returned a lazy-seq of the results? |
| 11:37 | chouser | I started with congomongo, but eventually found its connection-handling API to be awkward for our usage. For that and other reasons we now have our own (not open-source, I'm afraid) wrapper. |
| 11:38 | talladam | chouser: seems the way I'm going - don't like the singleton connection stuff |
| 11:38 | chouser | but in fact we're finding some performance issues with the native java driver as well, so I'm working on a solution for that right now. |
| 11:38 | talladam | chouser: also using reduce in the fetch will make the lazy-seq a non-lazy-seq (diligent-seq?) |
| 11:39 | chouser | seems to me the js shell should do *anything* faster than the java driver. :-P |
| 11:39 | chouser | talladam: opposite of lazy is usually "eager". :-) |
| 11:40 | talladam | chouser: I really want a lazy-seq because it fits with the cursor abstraction so nicely |
| 11:41 | chouser | yes, it does. Calling seq on a DBCursor directly actually works. |
| 11:41 | chouser | unfortunately, DBObjects are a bit of a mess from a Clojure point of view. |
| 11:42 | talladam | chouser: brilliant - thanks for the seq tip |
| 11:42 | chouser | I'm pretty sure the thing congomongo returns for fetch is a lazy seq |
| 11:43 | talladam | chouser: wouldn't reduce make it eager? |
| 11:43 | chouser | it lazily converts the DBObjects to clojure maps, vectors, etc. |
| 11:43 | chouser | talladam: where is reduce used? |
| 11:44 | talladam | chouser: you're right, its not - got confused in the source |
| 11:45 | chouser | fair enough. |
| 11:45 | talladam | chouser: uses vec which is lazy |
| 11:45 | chouser | congomongo helped me get up to speed quickly on the Java driver API, and get working code out there. |
| 11:45 | talladam | chouser: thanks for the help - didn't know #clojure existed - this is my first time here :) |
| 11:46 | chouser | vec is not lazy. |
| 11:46 | talladam | chouser: it isn't? |
| 11:46 | chouser | no, it returns a vector which is never lazy |
| 11:47 | talladam | chouser: right- well its used in the congo coersion code |
| 11:47 | chouser | so congomongo converts DBLists (which aren't lazy) to vectors (which aren't lazy) |
| 11:47 | chouser | but the cursor is wrapped in a lazy seq |
| 11:48 | talladam | you mean the native driver cursor? |
| 11:49 | talladam | chouser: thanks for the tips - will use seq and see if my problems go away |
| 11:49 | chouser | yes, congomongo returns a lazy seq with a DBCursor inside |
| 11:58 | mabes | I don't suppose it would be possible for me to define a private method (writeObject) on a record, would it? |
| 11:59 | sattvik | mabes: No, unfortunately not. |
| 11:59 | mabes | didn't think so... I would never think I would want to, and then I needed to tweak our our records are being serialized.. |
| 12:00 | sattvik | As far as I know, there is no way to create a private method in Clojure. |
| 12:02 | naeu | if I want to be able to start and stop a thread worker, what's the best way to achieve it? |
| 12:02 | naeu | it seems that the docs say resume() and stop() are deprecated |
| 12:02 | sattvik | You could always create a Java object that can help serialize/deserialize a record. |
| 12:03 | sattvik | naeu: I think you have to do it manually. Create some sort of flag that gets checked and a means to set/unset it. |
| 12:03 | mabes | sattvik: that would involve me wrapping the record in the java object, wouldn't it? |
| 12:04 | naeu | sattvik: you mean create a keep-working atom and deref it continuously in the worker loop? |
| 12:04 | naeu | sattvik: or is it ok to destroy() a thread? |
| 12:06 | sattvik | mabes: I think so. I haven't fully thought it out, but I am guessing it'd be done with some sort of simple wrapper object with a transient record field and your custom readObject/writeObject methods. |
| 12:07 | sattvik | naeu: The atom is more the way to go. If you are not interested in restarting, interrupt() is the preferred way to interrupt a thread. destroy is deprecated. |
| 12:10 | naeu | sattvik: I'm worried about performance. I just implemented a worker that used the STM and it's horribly slow :-( |
| 12:10 | sattvik | naeu: What are you trying to do? |
| 12:10 | naeu | I'm trying to write a simple wrapper around RxTx |
| 12:11 | naeu | so I have an InputStream that I want to process |
| 12:13 | sattvik | Well, read() on an input stream is blocking... so it will respond to interrupt(), I believe. |
| 12:14 | naeu | sattvik: does that mean that if i interrupt a thread blocked on a read that it will close the input stream? |
| 12:16 | sattvik | Well, not necessarily. Depending on the input stream, it may cause the read to throw some sort of InterruptedException. It's up to the thread to catch the exception and handle it (possibly closing the stream). |
| 12:17 | naeu | ah ok |
| 12:17 | sattvik | Not sure if the following link helps: http://stackoverflow.com/questions/3843363/thread-interrupt-not-ending-blocking-call-on-input-stream-read |
| 12:20 | naeu | sattvik: super, thanks |
| 12:21 | sattvik | No problem. |
| 12:23 | amalloy | or something similar that actually compiles, i guess :P |
| 12:26 | naeu | amalloy: haha |
| 12:33 | angerman | what tool to use for testing? |
| 12:37 | rata_ | hi |
| 12:37 | raek | naeu: socket (and possibly file) operations do not respond to interruption |
| 12:37 | TimMc | angerman: clojure.test |
| 12:38 | rata_ | is there any function that takes predicates and returns #(or (pred1 %) (pred2 %) ...)? |
| 12:39 | TimMc | Like a reversed `some`. |
| 12:39 | rata_ | a reversed some? but some doesn't take many predicates |
| 12:40 | TimMc | some applies one predicate to many inputs. You want many predicates and one input. |
| 12:40 | amalloy | rata_: sure it does: (let [x ...] (some #(% x) [pred1 pred2...])) |
| 12:41 | amalloy | anyway this does not already exist, and you are not the only one to want it. there was some talk about it on clj-dev a while ago, and it's getting added at some point. in the meantime, ninjudd's clj-useful library has it already |
| 12:41 | amalloy | er, clojure-useful |
| 12:41 | _fogus_ | Indeed. I implemented some-fn to do this very thing... but it will not be in until 1.3 |
| 12:42 | sattvik | rata_: I don't think so, not yet. There is an open issue on it: http://dev.clojure.org/jira/browse/CLJ-729 |
| 12:43 | rata_ | oh nice to know I'm not the only one to want it |
| 12:44 | rata_ | it'd be cool if 'or' could also be 'and' or 'xor' |
| 12:44 | rata_ | well, xor doesn't exist in core, right? |
| 12:44 | amalloy | rata_: xor is the same as not= |
| 12:44 | amalloy | vaguely |
| 12:44 | TimMc | amalloy: or odd? :-P |
| 12:44 | tsdh | What does a ":static true" metadata entry mean at defns? |
| 12:44 | amalloy | TimMc: wut |
| 12:45 | TimMc | amalloy: n-ary XOR is true iff an odd number of inputs are true |
| 12:45 | naeu | so i'm really struggling to wrap RxTx nicely. I seem to be able to handle each byte or n bytes efficiently enough. However, dealing with separators in an efficient manner is proving to be tricksy. My attempt is on-bytes-with-sep here: https://gist.github.com/869423 It has *horrible* performance and I'm pretty sure I shouldn't be using the STM at such a low level. Does anyone have any advice? |
| 12:46 | raek | naeu: if you have Java Concurrency in Practice (or know a library that has it), I recommend reading chapter 7, which is about cancellation and interruption |
| 12:46 | amalloy | (defn xor [a b] (not= (boolean a) (boolean b))) |
| 12:46 | amalloy | (def xor (comp (partial apply not=) #(map boolean &%))) ; disgustingly point-free |
| 12:47 | raek | naeu: if some operation is blocking on a socket, interrupting the trhead will not cause it to stop. however, closing the socket will |
| 12:47 | amalloy | TimMc: plz fix the latter to use odd? so i can claim credit |
| 12:47 | angerman | TimMc: thanks, will have a look |
| 12:47 | rata_ | amalloy: it's disgusting because it's not completely point-free =P |
| 12:48 | naeu | raek: in the example i just popped in a gist i'm not using threads explicitly, rather RxTx's event handler stuff |
| 12:48 | amalloy | rata_: i couldn't figure out how to get the &% behavior otherwise |
| 12:48 | naeu | I think the problem is more with how I'm using the STM |
| 12:48 | rata_ | amalloy: partial does it |
| 12:48 | TimMc | amalloy: Never seen &% -- is it for varargs in #() ? |
| 12:48 | amalloy | er, i meant %& |
| 12:49 | amalloy | TimMc: yes |
| 12:49 | TimMc | Sweet. |
| 12:49 | amalloy | rata_: no it doesn't. (map boolean a b) is very different from (map boolean [a b]) |
| 12:49 | amalloy | i guess the point-free way would be (comp (partial map boolean) vector) |
| 12:49 | TimMc | ew |
| 12:50 | amalloy | TimMc: rest assured none of us plan to use this code. just golfing :P |
| 12:50 | TimMc | indeed |
| 12:50 | rata_ | amalloy: mmm yes you're right |
| 12:50 | raek | naeu: ok, I don't know abut the RxTx stuff. I just wanted to inform you that it indeed is possible to cancel a task that is blocking on a socket, even though it might not seem so |
| 12:50 | naeu | raek: thanks :-) |
| 12:51 | rata_ | amalloy: anyway, the point-free version is better in this case because it handle any amount of args |
| 12:51 | amalloy | rata_: uh. it always returns false for 3+ args |
| 12:51 | amalloy | so if that counts as "handling" for you, that's cool |
| 12:53 | TimMc | amalloy: (defn xor [& xs] (odd? (count (filter boolean xs)))) |
| 12:53 | sattvik | naeu: From a visual inspections, there may be a couple of things that may be impacting performance, but I haven't tested to see if they do. |
| 12:53 | TimMc | That's my first approximation. |
| 12:54 | naeu | sattvik: what seems odd from first inspections? |
| 12:55 | amalloy | (def xor (comp odd? count (partial filter boolean) list)) |
| 12:55 | amalloy | TimMc: your version had too many points |
| 12:55 | TimMc | haha |
| 12:55 | sattvik | One: Is it possible that a ref is overkill for your function? buffered-bytes seems to be lexically bound, and so should not suffer from concurrent access? Perhaps an atom may be lighter weight? |
| 12:56 | rata_ | mmmm right... didn't thought of taht |
| 12:56 | naeu | sattvik: yeah, i tried that but it didn't make much difference |
| 12:57 | sattvik | Two: I think there's a lot of boxing/unboxing possibly going on. Instead of [], does (vector-of :byte) help? |
| 12:57 | rata_ | another pattern I found in my little lib is #(if (pred %) (f %) %) |
| 12:58 | naeu | sattvik: taht might be helpful |
| 12:58 | sattvik | Granted, at least in 1.2, it will still box/unbox across function calls, I believe. |
| 12:59 | angerman | does it look `clean'? https://gist.github.com/869449 |
| 12:59 | dnolen | fliebel: logos.minikanren is fixed. no more stack overflows, arithmetic stuff works. |
| 13:00 | amalloy | rata_: i have that too! i call it transform-if |
| 13:01 | amalloy | https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/transform.clj |
| 13:04 | fliebel | dnolen: Fantastic! |
| 13:39 | mattmitchell | i have a few vars in a namespace that i'd like to resolve dynamically: (resolve "*my-var*") |
| 13:39 | mattmitchell | th |
| 13:39 | mattmitchell | this returns: #'user/*my-var* |
| 13:39 | mattmitchell | how can i resolve to the actual value of *my-var* ? |
| 13:40 | amalloy | &[#'first @#'first] |
| 13:40 | sexpbot | ⟹ [#'clojure.core/first #<core$first clojure.core$first@849ba2>] |
| 13:40 | raek | mattmitchell: @, deref, or var-get |
| 13:40 | sattvik | mattmitchell: deref |
| 13:40 | mattmitchell | oh ok |
| 13:42 | rata_ | what does a "no matching ctor found for class ...$fn__1234" means in a for? |
| 13:42 | rata_ | I'm not doing any java interop |
| 13:42 | fliebel | dnolen: Where is the code? Or is it local still? |
| 13:42 | dnolen | fliebel: local still, one moment |
| 13:43 | raek | rata_: I suspect mismatching versions of a AOT compiled lib and clojure |
| 13:45 | fliebel | dnolen: I think I screwed my fork of Logos. So I'll have to study some more git before I can do Logos :) |
| 13:45 | rata_ | raek: weird... I'm not using any lib besides c.c.generic.math-functions and it's not in that part |
| 13:45 | amalloy | rata_: it's definitely something AOTed |
| 13:45 | amalloy | blow away any jars you have hanging around |
| 13:46 | amalloy | s/definitely/probably (but i like sounding definitive)/ |
| 13:46 | dnolen | fliebel: 0.5 pushed. |
| 13:46 | fliebel | dnolen: Great :) |
| 13:47 | raek | rata_: does you project use any kind of AOT? do you have old class files lying around in class/? |
| 13:49 | dnolen | fliebel: one thing is that I still see duplicates in yr earlier example, but I'm pretty convinced that's not a bug in logos.minikanren anymore, but rather that the miniKanren algorithm has changed since TRS. |
| 13:50 | fliebel | dnolen: But your arithmetic.clj is based on the newer implementation, isn't it? Does that make any difference? |
| 13:51 | rata_ | raek: no, it's just one file, 135 lines and it uses only c.c.generic.math-functions... I'll make a gist of it... maybe should I restart the persistent jvm? |
| 13:53 | fliebel | dnolen: :( Noooooo, still overfloooooow! https://gist.github.com/863180 |
| 13:54 | dnolen | fliebel: heh, gimme a second, checking your other arithmetic examples. |
| 13:54 | fliebel | okay |
| 13:58 | rata_ | raek: sorry, got disconnected |
| 13:59 | TallAdam | Chouser: can I ask you a quick question? |
| 14:00 | TallAdam | anyone here? |
| 14:00 | clojurebot | Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help. |
| 14:02 | amalloy | high five, clojurebot |
| 14:02 | TallAdam | I am using mongo and pmap'ing a function that connects to the db. This quickly chomps through the maximum possible connections - how should I throttle that? should I someone block the connections? is there connection pooling that I can enable? Using a mixture of the native java driver and congomongo |
| 14:03 | TallAdam | amalloy: sorry :p |
| 14:03 | amalloy | TallAdam: split the 10,000 small tasks into 10 large tasks and then pmap those |
| 14:03 | amalloy | is the usual answer |
| 14:03 | amalloy | ~o/ |
| 14:03 | clojurebot | \o ... High five! |
| 14:04 | amalloy | heehee, he does give high fives. i love you, clojurebot |
| 14:09 | rata_ | raek: https://gist.github.com/869563 line 120 |
| 14:10 | rata_ | I get a "No matching ctor found for class mca.gillespie$make_perturbation$fn__2604" exception |
| 14:10 | rata_ | when running the commented code at the end of the gist |
| 14:13 | amalloy | rata_: the error message indicates that a function expects more (or fewer) closed-around bindings than it's getting |
| 14:14 | amalloy | so the class file for the anonymous function in make-perturbations is out of sync with the rest of your code somehow or other |
| 14:16 | rata_ | amalloy: but make-pertubations is just the transform-if we're talking about |
| 14:16 | amalloy | yes. the code itself is clearly fine |
| 14:16 | amalloy | but you have old versions of something lying around somewhere |
| 14:16 | raek | you shouldn't be able to get into this situation normally, right? |
| 14:17 | amalloy | raek: that is certainly true depending on what you mean by "normally" |
| 14:17 | raek | when compiling everything from source |
| 14:17 | raek | at the same time |
| 14:18 | raek | rata_: what happens if you restart clojure? |
| 14:18 | rata_ | raek: I get the same error |
| 14:18 | raek | this is weird |
| 14:19 | rata_ | I've just run cake kill && cake swank |
| 14:19 | rata_ | then (require '[mca.gillespie :as g]) |
| 14:19 | rata_ | and executed the commented code at the end of the gist |
| 14:21 | amalloy | rata_: $ find . \( -name '*.jar' -or -name '*.class' \) -delete |
| 14:21 | amalloy | then re-get your deps and try again :P |
| 14:22 | rata_ | ok |
| 14:22 | rata_ | amalloy: cake clean does that? |
| 14:22 | amalloy | i dunno |
| 14:22 | amalloy | i don't AOT-compile often |
| 14:23 | rata_ | I'm just require'ing it, is that AOT-compile it? |
| 14:23 | amalloy | no, but you said you're "compiling everything from source" |
| 14:23 | rata_ | no, I didn't say that |
| 14:23 | amalloy | sorry, raek did |
| 14:24 | amalloy | i confess it's a bit puzzling |
| 14:24 | amalloy | but it's an error i've only seen before with out-of-sync classfiles so i'm trying to eliminate that possibility |
| 14:24 | sattvik | rata_: Could it be the fact that case is a macro be messing things up? Just a hunch, but it may be that the anonymous functions with #() sugar could be a cause. |
| 14:25 | dnolen | fliebel: looking now |
| 14:25 | rata_ | sattvik: but that's handled by the reader, which afaik runs before the compiler |
| 14:28 | fliebel | dnolen: So what is fixed and what isn't now? |
| 14:29 | dnolen | fliebel: fixing your stack overflow is easy, your program is problematic tho. |
| 14:30 | sattvik | Well, it's definitely not an AOT problem. I got a similar exception trying to run it. |
| 14:30 | fliebel | dnolen: Oh? What is problematic about it? |
| 14:30 | dnolen | fliebel: one second, pushing fix, so stackoverflow doesn't occur on your program. |
| 14:32 | dnolen | fliebel: fix pushed, 81 lvars though is gonna take LONG time |
| 14:32 | dnolen | the way your program is written. |
| 14:33 | dnolen | digit-o creates 9 possible searches, each lvar spawns another 9 possible searches. 9^81 power. |
| 14:33 | fliebel | dnolen: I guess so :) |
| 14:34 | dnolen | fliebel: but thanks, your program will run, not sure if you'll get your answer in this lifetime tho ;) |
| 14:34 | fliebel | dnolen: I havn't played with it much. I'll try to come up with improvements. |
| 14:37 | rata_ | sattvik: thanks for confirming the problem =) |
| 14:37 | rata_ | it's not a set-up problem then |
| 14:42 | amalloy | rata_: try macro-expanding the call to simulate |
| 14:42 | fliebel | dnolen: Does logos really go into all of these 9^81paths? I thought that since I want only 1 result, and the first cond-e line succeeds, it would initially only do these. |
| 14:43 | amalloy | observe that it contains {:perturbations (#<make-perturbation...> ...)} instead of {:perturbations (make-perturbation ...)}, which is what you want |
| 14:43 | amalloy | ie, you are embedding the function object in the expansion code instead opf expanding to code that will create a function object |
| 14:45 | dnolen | fliebel: look at your logic. (== empty-board []) will fail |
| 14:46 | chouser | why must converting between proxy and reify be so painful? |
| 14:46 | dnolen | fliebel: so it's going to traverse all 81 lvars. |
| 14:46 | rata_ | amalloy: shouldn't I be able to include the fn object in the expansion? |
| 14:47 | amalloy | no |
| 14:47 | amalloy | i mean, it will work sometimes, but it's not guaranteed |
| 14:47 | rata_ | that makes mixing macros and fns harder |
| 14:48 | fliebel | dnolen: Yea, all those 81, but why all 9 of these 81? there is no reason any cell of empty-board can't be 1, right? |
| 14:48 | fliebel | (note that I finished it when I was already way to tired) |
| 14:51 | amalloy | rata_: even if you could do it, you'd have issues. macros shouldn't expand into lists if you want the resulting code to have lists rather than function calls |
| 14:52 | amalloy | because it was expanding to (#<make-perturbation> ...), recall, which is a function call, not a list |
| 14:53 | dnolen | fliebel: miniKanren while it make some improvements over Prolog, also has issues with clause order. |
| 14:54 | fliebel | dnolen: Are you saying that my methodology is right, but the order wrong? |
| 14:55 | dnolen | fliebel: make digit-o come last, and you'll get an answer right away. |
| 14:55 | rata_ | amalloy: right... probably the best way to get rid of this problem is to do (parse-opts ~opts) instead of ~(parse-opts opts) |
| 14:55 | amalloy | rata_: yes, something along those lines |
| 14:56 | amalloy | i was trying to do that, but with no understanding of your problem domain or other functions it was proving kinda difficult to debug :P |
| 14:56 | fliebel | dnolen: Hm, I was thinking recursion should go last. |
| 14:57 | amalloy | i did get it to expand into a vector of stuff like (mca.gillespie/make-pred (quote when) (quote [X0 = 990])), though |
| 14:58 | rata_ | made it! =) it was (parse-opts '~opts) instead |
| 14:58 | rata_ | got immediatly to the next bug though =S |
| 14:59 | fliebel | Help, my cake is taking parts of seconds to respond to keystrokes, like half a second. And it's not like it's running 100% cpu or memory. |
| 15:00 | dnolen | fliebel: I can't provide much insight about solving sudoku since I haven't thought about it much. The rule is not so much recursion should come last, but important unifications should come before recursion. |
| 15:01 | dnolen | fliebel: but your recursive call doesn't even use the unification from digit-o |
| 15:01 | amalloy | rata_: string can't be cast to function? |
| 15:01 | rata_ | amalloy: yes |
| 15:02 | amalloy | i think it's encode-rxn-set |
| 15:02 | amalloy | it's returning a list instead of a vector |
| 15:02 | fliebel | dnolen: Okay. That works. Now my permutation-o is not doing what it is supposed to do, I think because of what you said about rember-o just going on. |
| 15:02 | rata_ | and if I call the resulting code by hand, it gives me another error... because I'm calling (simulate* ... {:foo ...}) instead of (simulate* ... :foo ...) |
| 15:03 | dnolen | fliebel: what you want to avoid is recursive calls that have (== (cons-o a b) c)) where a b c are all fresh variables. |
| 15:03 | amalloy | rata_: don't make an internal function like simulate* take syntax-sugared arguments with & |
| 15:03 | amalloy | just let it demand a map, and have the macro do the magic of turning keyword args into a map |
| 15:05 | rata_ | amalloy: the problem with that is that simulate* isn't intended to be an internal fn so you can create chemical systems programatically and simulate them with simulate* |
| 15:07 | fliebel | dnolen: scrape my last comment, my permutation-o is total bogus. |
| 15:07 | rata_ | that's also why I convert every symbol into a string in the macro, because strings are easier to manipulate programatically |
| 15:08 | pdk | but they always taught me in cl land to work with strings as lists of symbols! |
| 15:08 | pdk | my life is a lie :( |
| 15:08 | amalloy | lists of symbols? CL doesn't have the notion of a character? |
| 15:10 | pdk | it should i think |
| 15:10 | pdk | though lots of old code shows you doing stuff like '(hello world) |
| 15:10 | pdk | hell i have land of lisp on hand and the first few chapters teach you to handle strings that way |
| 15:11 | pdk | while graham acl at least used real strings |
| 15:15 | rata_ | good bye guys, see you soon |
| 15:15 | rata_ | and thanks a lot amalloy =) |
| 15:16 | dnolen | fliebel: working on pattern matching now ... this is gonna be fun :) |
| 15:22 | fliebel | dnolen: :) and then tabling? |
| 15:22 | dnolen | fliebel: yeah. |
| 15:24 | fliebel | dnolen: You said clojure.core.unfiy takes a different approach to unification, how is it different? From the short look I threw at it it even toes tabling and patternmatching. |
| 15:24 | fliebel | *does |
| 15:27 | dnolen | fliebel: unify isn't a logic programming library at the moment as far I can tell. It just does unification. |
| 15:28 | amalloy | hm. (subvec v -1) doesn't work, even though it could in cases like: (subvec (subvec [1 2 3] 1) -1) |
| 15:29 | fliebel | dnolen: True, but Logos has its own custom unification. What prevents you from using clojure.core.unify instead? |
| 15:31 | romanroe | Just found an old discussion on the mailing list about "generalizing -> and ->>" and introducing something like -$>, pipe, pipe-as etc. Was anything like this ever implemented in core or contrib? |
| 15:31 | chouser | romanroe: I think Rich has never been a fan, but people certainly have created and used sugh things |
| 15:32 | chouser | such |
| 15:32 | romanroe | chouser: mmh, ok. thanks |
| 15:35 | dnolen | fliebel: clojure.core.unify is a bit slow. logos extends all the core Clojure datatypes that represent source to IUnify. clojure.core.unify does return a unification map, but it represents logic vars as symbols instead of separate type. |
| 15:36 | fliebel | dnolen: I see... |
| 15:37 | fliebel | dnolen: Does Logos use all my cores, or does it have the potential to? |
| 15:39 | fliebel | dnolen: Sudoku works! but filling in 3 holes takes a minute. |
| 15:40 | dnolen | fliebel: it doesn't currently. But it has the potential to, since you can't write a program that takes advantage of the order of how results are returned. |
| 15:40 | dnolen | fliebel: nice! |
| 15:41 | fliebel | dnolen: Is that kind of execution time expected, or do I need to shuffle things around a bit more? |
| 15:42 | dnolen | fliebel: probably. But I can give much advice beyond looking for a fast Prolog solution. You should be able to use the same kind of optimizations. |
| 15:43 | fliebel | dnolen: Meh, got it down to 2 secs already :) |
| 15:43 | dnolen | fliebel: Prolog speeds things up with pruning. In logos.nonrel you'll find cond-u and cond-a which do pruning. |
| 15:43 | dnolen | fliebel: sick! |
| 15:43 | fliebel | dnolen: I realized the whole board-o stuff is redundant, and already enforce by permutation-o and the exist statement. |
| 15:45 | dnolen | fliebel: I'm glad this stuff is actually finally working for you :) sorry for the long delay. I spent about 2 weeks realizing that most of what I'd written was broken. I actually took Logos back to the design I had in November! (with fixes now that I have a better understanding). |
| 15:45 | dnolen | well the goals stuff, not the unification stuff. |
| 15:46 | fliebel | dnolen: I'm happy we're both learning :) |
| 15:51 | fliebel | (I'm now running a real board, see what it takes to solve it) |
| 15:56 | fliebel | dnolen: One thing I notice with Logos and miniKanren that it is hard to name stuff, so I end up with vars named x y and z, and lose track of them. I suppose patter matching will end much of that as well? |
| 15:56 | dnolen | fliebel: exactly. |
| 15:59 | tsdh | Is it correct, that ((ITransientSet)PersistentHashSet.EMPTY.asTransient()).contains(foo) returns true for any Object foo? How can an empty set contain anything? |
| 15:59 | fliebel | dnolen: I am trying to read rember-o. I figured out you can get only the "expected" value by using member-o with the same params. I wonder if I can combine that into one run. |
| 16:00 | dnolen | fliebel: ? |
| 16:01 | fliebel | dnolen: In other words, I want something that for 3 [1 2 3 4] returns only [1 2 4], and if there is no 3 in it, returns nothing at all. |
| 16:04 | mattmitchell | any paredit ninjas out there? |
| 16:04 | dnolen | fliebel: so remember what I said about rember-o keeps going. Pruning is about stopping that. With cond-a a goal can only succeed once, all the remaining clauses are ignored. |
| 16:04 | mattmitchell | a white belt will do actually |
| 16:04 | dnolen | fliebel: Thin Ice chapter in TRS talks about cond-a cond-u. |
| 16:05 | fliebel | dnolen: ah! *looks up cond-a and u* I remember TRS talking about them vaguely indeed. |
| 16:05 | fliebel | I dismissed it as ramping up to the real cond-e. |
| 16:06 | rata_ | hi |
| 16:11 | spewn | &(.contains (.asTransient #{}) :foo) |
| 16:11 | sexpbot | ⟹ true |
| 16:11 | spewn | tsdh: Not sure what that means. |
| 16:12 | tsdh | spewn: Yeah, that's totally strange, isn't it? |
| 16:12 | tsdh | I'm just writing a mail to the mailinglist. |
| 16:13 | rfgpfeiffer | ,(contains? #{} :foo) |
| 16:13 | clojurebot | false |
| 16:13 | rfgpfeiffer | ,(contains? (transient #{}) :foo) |
| 16:13 | clojurebot | false |
| 16:13 | spewn | ,(contains? (.asTransient #{}) :foo) |
| 16:13 | clojurebot | false |
| 16:15 | tsdh | Yes, contains? works fine. But I'm implementing another clojure collection type in java, and there I had to check if an object was contained in a TransientHashSet. |
| 16:16 | amalloy | mattmitchell: ask your real paredit question; that'll get a lot more help than "help with paredit" |
| 16:17 | tsdh | spewn: As a workaround, I made my check "transientHashSet.count()!=0 && transientHashSet.contains(obj)", but that's far from obvious... |
| 16:20 | rata_ | is there any easy way to make to make a map's default return value for a non-existent key other than nil? |
| 16:20 | mattmitchell | amalloy: good point. well I have a string like: "value here (move out of string)" -- I want to move the (move out of string) out of the string. |
| 16:20 | sattvik | ,(doc get) |
| 16:20 | clojurebot | "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present." |
| 16:20 | mattmitchell | so i tried paredit-forward-barf-sexp but no luck |
| 16:21 | amalloy | mattmitchell: C-k |
| 16:21 | amalloy | with point before (move |
| 16:21 | amalloy | not ideal, but it will kill the part you want |
| 16:21 | mattmitchell | amalloy: awesome i'll give it a shot |
| 16:21 | sattvik | ,(get {:a 1 :b 2} :c :not-found) |
| 16:21 | clojurebot | :not-found |
| 16:22 | sattvik | rata_: ^ |
| 16:23 | raek | ,[(:c {:a 1, :b 2} :not-found) ({:a 1, :b 2} :c :not-found)] |
| 16:23 | clojurebot | [:not-found :not-found] |
| 16:23 | naeu | does anyone know how cake determines your OS arch? |
| 16:24 | rata_ | sattvik: I forgot to say that I need a different return value for update-in also |
| 16:24 | amalloy | rata_: fnil |
| 16:24 | naeu | when I do a cake deps, it seems to pull out the wrong native lib - it pulls the lib from x86 rather than x86_64 |
| 16:24 | amalloy | &(update-in {} [:a] (fnil inc 0)) |
| 16:24 | sexpbot | ⟹ {:a 1} |
| 16:27 | spewn | naeu: Check https://github.com/ninjudd/cake/blob/master/bake/bake/core.clj#L82 |
| 16:27 | naeu | spewn: ah, thanks |
| 16:27 | naeu | spewn: looks like cake is forcing 32 bit mode |
| 16:29 | amalloy | tsdh: weird. i've been reading the source (badly, apparently) and i can't see what's causing that |
| 16:30 | amalloy | oooo i think i do see actually |
| 16:30 | amalloy | check out TransientHashMap.doValAt, in PersistentHashMap.java |
| 16:31 | amalloy | it looks like when there are no elements, (get m k not-found) returns nil instead of not-found |
| 16:32 | tufflax | (.instanceMember Classname args*) Hm, instanceMember of a class? And I can't find getName in the Javadocs ((.getName String) is an example in the clojuredocs.) I'm confused. |
| 16:33 | tsdh | amalloy: Indeed, it seems the root == null case is false... |
| 16:34 | amalloy | tufflax: your question confuses me |
| 16:34 | tufflax | Hehe ok. First of all, do classes have instance members? I thought only instances had instance members. |
| 16:35 | amalloy | it's not the best terminology. if you like, you can consider a class's "instance members" to be its static members |
| 16:35 | tufflax | Isn' that what this is for? Classname/staticField |
| 16:36 | amalloy | ,(macroexpand '(String/name)) |
| 16:36 | clojurebot | (. String name) |
| 16:36 | amalloy | tufflax: the former is convenient for people. it's much easier to write macros that expand into the latter |
| 16:38 | tufflax | ,(macroexpand '(.getName String)) |
| 16:38 | clojurebot | (. (clojure.core/identity String) getName) |
| 16:40 | amalloy | tsdh: i'll submit a patch for that |
| 16:41 | tsdh | amalloy: Cool, thank you. Could you also reply to my mail on the list, in order to indicate it's solved? |
| 16:41 | nickik | whats an easy to use profiler for java (clojure) |
| 16:41 | tsdh | nickik: I like VisualVM. |
| 16:42 | chouser | yourkit is very nice. visualvm is free. :-) |
| 16:42 | nickik | I just need something that is as simple as possible |
| 16:43 | tsdh | nickik: I think VisualVM is your friend then. It's very intuitive yet powerful. |
| 16:44 | nickik | looking into it right now. |
| 16:44 | tufflax | amalloy: They don't seem to do the same thing. (If you were talking about Classname/field and (.field Classname)). |
| 16:45 | tufflax | Maybe that's not what you meant |
| 16:46 | nickik | is there a way in clojure 1.3 to make all math operations unchecked? |
| 16:48 | tsdh | Too bad. I've just realized that using transients doesn't give me any performance improvement at all. Seems like merging sets of sizes between 0 and 1000 using `into' is only minor effort in comparison to the other calculations. :-( |
| 16:49 | Chousuke | into uses transients :) |
| 16:50 | tsdh | Chousuke: Yes, exactly. And I've implemented transient support for the collection type I use in my app. ;-) |
| 16:50 | Chousuke | ah, I see |
| 16:51 | Chousuke | I realised a bit too late I misread you. never mind. :P |
| 16:51 | tufflax | amalloy: Oh, now I see. (.instanceMember Classname args*) calls members of java.lang.Class |
| 16:51 | amalloy | right |
| 16:52 | tsdh | Anyway, it was a good exercise studying parts of the clojure internals. Pretty non-idiomatic java code, but cool. :-) |
| 16:54 | nickik | is visualvm the write tool if I have a relativly short running clojure benchmark |
| 16:54 | nickik | ? |
| 17:01 | angerman | anyone mind telling me if https://github.com/angerman/planarity is actually runnable outside of my home system? |
| 17:01 | fliebel | My cake is doing strange things. It is very, very slow in responding. It also seems to continue it's job after a ^C and cake repl -r |
| 17:05 | angerman | fliebel: you can always check if there is still a running jvm process |
| 17:05 | fliebel | angerman: running kill inbetween solves the continuing thing, but the slow responding stays. |
| 17:06 | angerman | I'm actually not at all experience with cake |
| 17:07 | angerman | but, that sounds to me like cake is starting up something that's eating resources on mass. |
| 17:07 | fliebel | angerman: Not at all, when I start cake fresh, it does not consume much memory and cpu at all. |
| 17:07 | amalloy | fliebel: tried #cake.clj, i imagine? |
| 17:07 | fliebel | I would rather think it is communicating with my computer over my external IP, if that was possible. |
| 17:08 | fliebel | amalloy: No, but I will. |
| 17:12 | angerman | (ask again) If someone has, like 3minutes or so and could $ git clone git@github.com:angerman/planarity.git && cd planarity && lein deps && lein native-deps && lein run -m scripts.demo-catmull-clark that would be great. |
| 17:12 | amalloy | angerman: well i *know* that won't work because i don't have ssh access to your private clone url :P |
| 17:13 | angerman | args. github |
| 17:13 | angerman | $ git clone git://github.com/angerman/planarity.git && cd planarity && lein deps && lein native-deps && lein run -m scripts.demo-catmull-clark |
| 17:15 | amalloy | angerman: it might work after it's done with all this stuff, but [WARNING] POM for 'org.clojars.angerman:jreality-native-deps:pom:2011-01-29:compile' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM |
| 17:16 | angerman | ah, yea. that's probably because I don't know how to create clojures correctly yet. |
| 17:16 | amalloy | angerman: yeah, it works |
| 17:17 | amalloy | i get a 3d diagram i can move around with the mouse |
| 17:17 | angerman | and it should do some subdivision |
| 17:17 | amalloy | though somewhat disconcertingly it keeps changing shapes even if i'm moving it |
| 17:17 | fliebel | dnolen: cond-a does not work for me: (run 1 [q] (cond-a (s#) (u#))) => IllegalArgumentException No implementation of method: :bind of protocol: #'logos.minikanren/IBind found for class: clojure.lang.PersistentList |
| 17:17 | amalloy | i assume that's just "this is a demo" |
| 17:17 | chouser | perhaps there is some function language that has figured out better debugging names for anonymous functions. |
| 17:17 | angerman | yes, it cycles through a few shapes. Starting with a cube and ending with a T shape. |
| 17:17 | chouser | better than, you know, this: utils$proxy-STAR-$iter--3068--3072$fn--3073$iter--3140--3144$fn--3145$fn |
| 17:18 | angerman | amalloy: the code for the clojar builder is in mkjr/Makefile. Maybe we can go over that tomorrow? |
| 17:18 | angerman | chouser: full ack. |
| 17:19 | dnolen | fliebel: ah yeah, I need to update them. |
| 17:19 | amalloy | oh noes, "we"? how did i get involved in this |
| 17:19 | fliebel | dnolen: I was thinking that :) |
| 17:22 | jeffthink | this is a bigtime noob question, but I've tried a few different built in methods and I haven't found one that does what I want...essentially, I just want to create a list by merging two existing lists...what is the builtin method for this? |
| 17:23 | brehaut | &(concat (list 1 2 3) (list :a :b :c)) |
| 17:23 | sexpbot | ⟹ (1 2 3 :a :b :c) |
| 17:25 | fliebel | dnolen: What are the typical causes for a relation being non-deterministic(if there are any)? I wrote a relation, but it never finishes if you ask for more results than it can provide. |
| 17:26 | jeffthink | thanks guys...was trying cons, conj, list, etc. but didn't see concat in the docs where I was looking...now I see it though |
| 17:26 | rata_ | $('= 1 2) |
| 17:26 | rata_ | &('= 1 2) |
| 17:26 | sexpbot | ⟹ 2 |
| 17:26 | rata_ | why is that? |
| 17:27 | amalloy | rata_: you're looking up the symbol = in the map 1, returning 2 if it's not found |
| 17:27 | dnolen | the stream may contain no more results, but the program is written in such a way that the search continues. Or you have a something like (== (cons-o a b) c)) in a recursion where all vars remain fresh. |
| 17:27 | amalloy | 1 isn't a map, sooo.... |
| 17:27 | dnolen | fliebel: ^ |
| 17:27 | technomancy | ,(get '= {'- :minus} :not-found) |
| 17:27 | clojurebot | :not-found |
| 17:28 | rata_ | what's the best way to get the fn = from '=? |
| 17:28 | amalloy | resolve |
| 17:29 | fliebel | dnolen: Okay, I'll try to think about that. These are hte last 6 rules in my sudoku that do not function correctly. |
| 17:29 | dnolen | fliebel: 1) all goals fail, recursive goals is called, all goals fail, ... |
| 17:31 | dnolen | fliebel: 2) (defn recursive-goal [fresh-c] (exist [fresh-a fresh-b] (cons-o fresh-a fresh-b fresh-c) (recursive-goal b))) |
| 17:31 | rata_ | &(resolve '=) |
| 17:31 | sexpbot | java.lang.SecurityException: You tripped the alarm! resolve is bad! |
| 17:33 | rata_ | nice, thank you amalloy |
| 17:34 | fliebel | dnolen: 1) how can all goals fail and still call a recursive function? (if the function consist of one cond-e statement, that is) |
| 17:35 | dnolen | fliebel: I meant if the recursive goal is the last goal of a cond-e expression, and none of the other clauses produces answers. |
| 17:45 | fliebel | dnolen: pen en paper show that such is the case. |
| 17:46 | fliebel | dnolen: or… hm. if I do (all s# u# s#), is the last goal ever considered, or does it just stop at the u#? |
| 17:46 | dnolen | fliebel: stops at u# |
| 17:49 | fliebel | dnolen: But that is not the case either. hm… my relation just leaves its last arg fresh in case it is not a match, so that means it will indeed recur on a fresh var. |
| 17:50 | dnolen | fliebel: it's ugly as hell, but it works, https://github.com/swannodette/logos/blob/match/src/logos/match.clj#L70, will cleanup later. |
| 17:51 | dnolen | fliebel: recur on fresh var is ok as long _some_ goal is producing answers in the recursive call. |
| 17:51 | fliebel | dnolen: I need to do more pen and paper to figure that out :( |
| 17:55 | fliebel | dnolen: What I'm basically doing is taking 2 seqs, take the first item from one, and remove it from the other, then recur on the rest and result after removal, until both are equal. But if nothing gets removed(e.g. seqs are not permutations), it will run and run and run. (cool, the destructuring, btw) |
| 17:58 | waxrose | greetings all |
| 18:00 | dnolen | fliebel: so when they are equal, nothing gets removed? and that's the degenerate case? |
| 18:01 | fliebel | dnolen: when they are equal, that means they are the same, with the worst case being the same after all items have been removed. But when nothing gets removed because they are not permutations... |
| 18:03 | dnolen | fliebel: meaning they share nothing ? |
| 18:03 | dnolen | fliebel: gist? |
| 18:04 | fliebel | dnolen: basically, yes. Consider [1 2 3] [1 2 4], it will first remove 1 and 2, and then continue to remove.. wait! I got it! |
| 18:06 | fliebel | dnolen: No matter what, the first list will get shorter, so by binding that to a cons, I make sure we did not run out of one list. |
| 18:07 | dnolen | fliebel: nice. |
| 18:22 | fliebel | dnolen: Not really… I feel like I nearly got it though… |
| 18:22 | dnolen | fliebel: so that doesn't work? |
| 18:22 | fliebel | I think I mixed up my a b c x y z somewhere... |
| 18:24 | fliebel | dnolen: I'll let you in on the fun: https://gist.github.com/870001 |
| 18:26 | fliebel | hm, now it depends on the order of the arguments whether or not it finishes or not. |
| 18:27 | fliebel | or if it finishes or not if it not finishes not |
| 18:28 | fliebel | Ah, I understand why, and it is okay this way. |
| 18:30 | fliebel | entering [a b c] vs just q made the difference, because for q, it will check (_.0 _.1 _.2 . etc) |
| 20:12 | phenom_ | hmmm, I find myself doing this alot: http://pastie.org/1672445 ... is there anyway to make it an atom rather than a reff? |
| 20:15 | amalloy | phenom_: ##(let [a (atom '[x [y z]])] (first (swap! a (fn [[_ [f & more]]] [f more])))) |
| 20:15 | sexpbot | ⟹ y |
| 20:15 | amalloy | &(let [a (atom '[x [y z]])] [(first (swap! a (fn [[_ [f & more]]] [f more]))) @a]) |
| 20:15 | sexpbot | ⟹ [y [y (z)]] |
| 20:16 | amalloy | so you get the atom containing originally [x [y z]], then change it to [y [z]] and get the first element from its new state |
| 20:21 | amalloy | that's a pretty disgusting number of square brackets though, so feel free to find a cleaner way |
| 20:28 | phenom_ | amalloy: cool :) out of curiosity ... the @a at the end may be stale right? |
| 20:29 | amalloy | yes |
| 20:29 | amalloy | it was just for clarifying what's going on. only (first (swap! ...)) is atomic |
| 20:29 | phenom_ | cool, thnx :) |
| 20:31 | aamar | okay, struggling with this one: java.lang.StackOverflowError -> 1000s of lines of "at clojure.lang.Keyword.intern(Keyword.java:39)" |
| 20:31 | technomancy | aamar: it's a known bug |
| 20:31 | technomancy | aamar: clojure 1.2.1 will fix it |
| 20:32 | aamar | Oh I see, I saw some references about it being fixed in master, thought it made it into 1.2.0. |
| 20:32 | aamar | technomancy: thanks for clarifying |
| 20:32 | hiredman | 1.2.0 is old |
| 20:32 | aamar | anyone know an acceptable workaround? |
| 20:32 | hiredman | master is an alpha of 1.3 |
| 20:32 | brehaut | aamar: i run my jvm in -server |
| 20:33 | brehaut | and it stops it taking out my JVM |
| 20:33 | brehaut | but its not 'fixed' |
| 20:33 | technomancy | aamar: it's not deterministic |
| 20:33 | technomancy | so you should be able to just retry whatever you were doing |
| 20:33 | hiredman | if you are calling the keyword function a lot, you can memoize keyword |
| 20:33 | technomancy | actually 1.2.1 is in build.clojure.org already: http://build.clojure.org/releases/org/clojure/clojure/1.2.1/ |
| 20:33 | technomancy | so you can use it |
| 20:33 | hiredman | basically just stop generating keywords |
| 20:35 | aamar | brehaut, hiredman, technomancy: thanks, great things to try |
| 20:35 | aamar | jvm -server sounds like the quick fix for me, and I'll test my app in 1.2.1 asap as well |
| 20:36 | brehaut | aamar: im not convinced -server actually fixes it, it just drops the frequency of complete JVM obliteration to a value so low ive not encountered it |
| 20:37 | aamar | good caveat; I'll make sure to port over to 1.2.1 pretty fast (should have been running in server mode anyway, really) |
| 20:37 | brehaut | aamar: if its your own code calling keyword you do need to reevaluate if you need it. i understand its going to consume your JVMs permgen |
| 20:39 | brehaut | aamar: and if that is true, and your code is passing untrusted values to keyword (eg from user input) then you have a potential DOS vector |
| 20:41 | aamar | hm, my app appears to only have one meaningful use of keyword, and it's safe. I guess it could be a problem. |
| 20:42 | Znudzon | Hi all. How i can run my clojure program from emacs ? I have Clojure Box (emacs with SLIME and other stuff) and i know how to compile it but not run. |
| 20:42 | aamar | More likely it's clutch & json libraries |
| 20:42 | brehaut | aamar: yes thats highly likely; its what does it in my app |
| 20:49 | aamar | Znudzon: you can execute code in emacs using the SLIME -> Evaluation menus |
| 20:50 | aamar | after running lein swank, then slime-connect, then e.g. select some code and then run slime-compile-region (C-r C-c for me) |
| 20:50 | aamar | actually slime-eval-region, sorry |
| 20:51 | TimMc | When 1.2.1, how can I ensure all my projects get it? 1.2.0 is currently hardcoded in my project.clj files. |
| 20:51 | TimMc | *When 1.2.1 lands |
| 20:51 | Znudzon | compiling in clojure allways take so much time ? |
| 20:52 | brehaut | Znudzon: AOT is relatively slow, but its pretty fast otherwise |
| 20:55 | Znudzon | brehaut: |
| 20:55 | Znudzon | Is there any kind of trick that i may use to icrease speed of compiling ? |
| 20:56 | brehaut | Znudzon: in what sense? |
| 20:57 | TimMc | Znudzon: Are you sure you aren't running any heavy calculations at compile time? I once accidentally had a top-level def that created and rendered GUI components, for instance. |
| 20:57 | hiredman | Znudzon: most likely it isn't compiling taking up time, just emacs doing stuff it doesn't need to do |
| 20:57 | Znudzon | brehaut: i have some piece of code : (. javax.swing.JOptionPane (showMessageDialog nil "Witaj, Clojure!")) and it takes me about 30 sec to compile and run this . |
| 20:57 | hiredman | Znudzon: I doubt that |
| 20:58 | Znudzon | I tryed campile it on other computer(linux) 3 gb of ram and it still takes 30 sec |
| 20:58 | hiredman | Znudzon: no it doesn't |
| 20:58 | brehaut | Znudzon: run the same thing from a bare repl, it should be basicly instant |
| 21:00 | brehaut | (javax.swing.JOptionPane/showMessageDialog nil "Hello, world!") |
| 21:00 | brehaut | i just ran that in my repl: instant |
| 21:01 | brehaut | a fresh repl (which includes jvm start time, and loading apple swing) is still under 3 seconds |
| 21:01 | Znudzon | brehaut: Yes you have right. Hmm i will try reinstall everything and maybe this will help. Thank you for help. I thought that i have problem with my clojure not emacs :) |
| 21:01 | hiredman | emacs tends to print stuffing about fontifying in the minibuffer, but that is totally useless |
| 21:02 | Znudzon | Then what is the best editor for clojure ? |
| 21:02 | brehaut | emacs |
| 21:02 | hiredman | emacs |
| 21:03 | amac | emacs |
| 21:03 | Znudzon | How about NetBeans ,Eclipse or InteliJ ? |
| 21:04 | brehaut | Eclipse has a very nice mode (counter clockwise), but it also giant, and still isnt as good for straight clojure as emacs |
| 21:04 | tomoj | giant! |
| 21:04 | brehaut | if you were doing very java heavy stuff with a smidge of clojure, then eclipse might make sense |
| 21:04 | brehaut | tomoj: ? |
| 21:06 | cemerick | Znudzon: I use Eclipse all day every day. |
| 21:06 | tomoj | I wonder if it's my computer or my window manager that makes eclipse unusable |
| 21:06 | brehaut | Znudzon: i use the technomancy's emacs-starter-kit (https://github.com/technomancy/emacs-starter-kit) |
| 21:06 | cemerick | And my day is 98% clojure, FWIW. |
| 21:07 | cemerick | tomoj: I wouldn't be surprised if esoteric WMs mess with SWT and such. |
| 21:08 | tomoj | I quickly took the opportunity to blame eclipse and drop it :/ |
| 21:09 | brehaut | cemerick: i'll revise my opinion then; if you use eclipse for only clojure but dont use it all day, its not so good. |
| 21:10 | cemerick | tomoj: I do the same thing with emacs every time I start it up, for reasons passing understanding. ;-) |
| 21:11 | sritchie_ | hey all -- if I wrote the following function -- https://gist.github.com/870147 -- before realizing that the return value of each threading macro needs to be passed into the next iteration of doseq, in the place of request |
| 21:11 | amalloy | TimMc: you can depend on "[1.2.0,)" |
| 21:11 | cemerick | brehaut: If you're used to X, tinkering with Y will often be unpleasant or strange or uncomfortable. *shrug* |
| 21:12 | TimMc | amalloy: Any way to indicate 1.2.* ? |
| 21:12 | amalloy | "[1.2.0,1.3.0)" |
| 21:12 | TimMc | ah! |
| 21:12 | brehaut | cemerick: im used to textmate; and i tinkered with emacs and eclipse. im in a foreign land nomatter what. theres no way textmate is going to be a good clojure enviroment any time soon |
| 21:13 | amalloy | brehaut: so you settled on textmate 2? |
| 21:13 | brehaut | amalloy: ahahaha yeah i hear its bundled with duke |
| 21:13 | cemerick | brehaut: ouch. Sorry, man. |
| 21:14 | amalloy | duke? |
| 21:14 | waxrose | brehaut, Including StumpWM into the mix seems to make it an even interesting environment with Emacs. |
| 21:14 | cemerick | amalloy: nukem |
| 21:14 | brehaut | amalloy:duke nukem |
| 21:14 | cemerick | brehaut: I've been demoing sublime text for a while. It's a very capable potential TM replacement IMO. |
| 21:14 | clojurebot | context is the essence of humor |
| 21:15 | sritchie_ | here's my new try -- https://gist.github.com/870147. is there a nicer way to write this? |
| 21:15 | waxrose | TimMc, Hello, btw. |
| 21:15 | brehaut | cemerick: thanks for the pointer |
| 21:15 | amalloy | brehaut: i was referring to www.textmate2.com |
| 21:15 | TimMc | hey, waxrose |
| 21:15 | cemerick | what a wise-ass domain name that is |
| 21:15 | brehaut | amalloy: oh. haha |
| 21:16 | amalloy | cemerick: and i discovered just now that .org redirects to vim |
| 21:16 | amalloy | so you can be neutral |
| 21:16 | TimMc | I cut a non-SNAPSHOT release of feedback. It's <v1.0.0 until I use it successfully in a project. |
| 21:17 | brehaut | cemerick: does sublime look like it could be decent for clojure (could it support a paredit frinstance?) |
| 21:17 | TimMc | amalloy: though the title is incorrect for the latter |
| 21:18 | cemerick | brehaut: yes, its extensions are *far* more powerful than TM bundles AFAICT. Highlighting and actions are bound to python code -- none of this regex + shell BS. |
| 21:18 | brehaut | cemerick: BS is right. that sounds a lot more sane |
| 21:19 | cemerick | The problem is UI -- there are no provisions for e.g. programmatically opening sidebars, panels, etc., so a proper in-window REPL would be tough. |
| 21:19 | cemerick | That's all AFAICT. |
| 21:19 | brehaut | i guess i'll just keep an eye on it |
| 21:19 | jcromartie | What's a good way to pick out a few keywords from a map |
| 21:19 | jcromartie | err, a few keys |
| 21:20 | cemerick | Honestly, I don't expect an editor to be a reasonable Clojure environment. |
| 21:20 | brehaut | &(take 2 (shuffle (keys {:a 1 :b 2 :c 3}))) |
| 21:20 | sexpbot | ⟹ (:c :b) |
| 21:20 | amalloy | jcromartie: juxt or destructuring |
| 21:21 | jcromartie | I mean to create a new map |
| 21:21 | amalloy | brehaut: way to go. between the two of us we've covered two plausible meanings of his question, but not the one he wanted |
| 21:21 | amalloy | select-keys |
| 21:21 | brehaut | amalloy: …again |
| 21:21 | jcromartie | amalloy: thanks |
| 21:21 | amalloy | i'd like to take credit though. juxt seems closer than any of the others were |
| 21:21 | jcromartie | :) |
| 21:22 | jcromartie | juxt would be good |
| 21:22 | jcromartie | if that's what I needed |
| 21:22 | jcromartie | but it's not so... |
| 21:22 | jcromartie | phew, it's late and I'm not feeling well so I'm just going to keep quiet and enjoy my select-keys |
| 21:22 | jcromartie | thanks |
| 21:22 | brehaut | any solution where juxt is not appropriate hasnt got the right problem yet |
| 21:23 | amalloy | hah |
| 21:24 | jcromartie | I tried explaining juxt in one sentence the other day. |
| 21:24 | brehaut | cemerick: you mean that a proper IDE is needed? or something else ? |
| 21:26 | tomoj | sritchie_: there must be |
| 21:26 | tomoj | what's "phase"? |
| 21:27 | sritchie_ | a macro that writes (fn [request] (-> request ...)) |
| 21:27 | sritchie_ | inserting its arguments into ... |
| 21:27 | tomoj | did you consider hygiene and decide against? |
| 21:28 | sritchie_ | I didn't write phase, I'm writing a pallet crate |
| 21:28 | tomoj | pallet has phase? :O |
| 21:29 | sritchie_ | so, I have to funnel request through these other functions, which an operation to the request map and pass the modified map back |
| 21:29 | hiredman | ,(do comp) |
| 21:29 | clojurebot | #<core$comp clojure.core$comp@dc5b6a> |
| 21:29 | hiredman | ,(doc comp) |
| 21:29 | clojurebot | "([f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc." |
| 21:29 | sritchie_ | hiredman: that's what I'm using in my gist |
| 21:29 | sritchie_ | https://gist.github.com/870147 |
| 21:29 | cemerick | brehaut: "proper" is a semantic tar pit. But I'm generally a disbeliever of all things lightweight when it comes to development tools, yes. |
| 21:30 | tomoj | oh, phase is hygienic |
| 21:32 | tomoj | sritchie_: does it not matter in which order you compose the functions? |
| 21:32 | sritchie_ | tomoj: nope, not in this case |
| 21:33 | sritchie_ | the function currently adds the creation of three remote config files to the request |
| 21:36 | tomoj | your latest attempt doesn't look bad actually |
| 21:36 | sritchie_ | tomoj: the first attempt was based on my assumption that nothing was added to the request, and that remote-file had side effects, and returned nil |
| 21:36 | tomoj | when you originally asked the question I thought it was a reduce, and it could be, but I think it'd just be uglier |
| 21:36 | sritchie_ | hence the doseq |
| 21:37 | sritchie_ | tomoj: I was trying to fumble it into reduce first, actually |
| 21:38 | sritchie_ | tomoj: I guess I could bind the result of the (apply comp ... ) to a local var in let, and then write (create-configs request) as the body, to make it cleaner |
| 21:38 | sritchie_ | I guess I'm asking for style advice, here |
| 21:42 | jcromartie | yay for (mapcat vals x) |
| 21:42 | jcromartie | cemerick: what do you define as "lightweight?" |
| 21:44 | cemerick | jcromartie: having limited degrees of extensibility freedom? |
| 21:44 | jcromartie | ah |
| 21:44 | jcromartie | so like, Scite or something |
| 21:44 | jcromartie | I'd call Emacs "lightweight" compared to Visual Studio or Eclipse |
| 21:44 | cemerick | e.g. not being able to have long-running processes in, say, TextMate or vi is a big problem if you want to support richer editing and tooling use cases |
| 21:45 | cemerick | jcromartie: Maybe only if you're talking about resource utilization. |
| 21:45 | cemerick | I don't think that's germane, tho. |
| 21:45 | jcromartie | in all senses of resource usage |
| 21:45 | jcromartie | space and time |
| 21:46 | jcromartie | but would you say TextMate is lightweight? |
| 21:46 | cemerick | I don't follow. Emacs is far more easily extensible than either VS or Eclipse. Hardly "lightweight", at least as I've defined it so far. :-) |
| 21:46 | cemerick | absolutely |
| 21:46 | cemerick | text munging features, and that's about it. |
| 21:47 | waxrose | Emacs 24 + Slime + StumpWM + Sunrise Commander = Fun |
| 21:48 | jcromartie | yeah I suppose, TextMate only really allows insertion or replacement |
| 21:50 | cemerick | I take my cues largely from things like lispworks and whatever they call the Racket IDE these days. Incredibly rich environments. |
| 21:51 | jcromartie | DrRacket |
| 21:51 | cemerick | I figured they must have renamed it. |
| 21:52 | jcromartie | so I think I missed some earlier stuff but are you talking about building a Clojure environment in Clojure? |
| 21:52 | cemerick | no, I wasn't talking about that earlier today |
| 21:53 | cemerick | My ideal would be to get a good interop layer on top of the eclipse APIs so that it could be extended and modified as dynamically as emacs is today. |
| 21:54 | cemerick | That might be a pipe dream, and maybe not even necessary/desirable. Sounds fun though, anyway. |
| 21:54 | TimMc | I haven't exactly studied the Java security model, but it seems to provide sandboxing in such a way that a program can be run in a normal-privileged JVM but be prevented from accessing, say, user files. |
| 21:54 | TimMc | Can Clojure provide for this too, given rebinding and such? |
| 21:54 | brehaut | TimMc: i believe thats true if you are willing to accept a large bag of caveats |
| 21:55 | cemerick | Really, just a few more iterations on ccw as it stands will essentially surpass what swank/emacs offer, at least in terms of Clojure support. |
| 21:55 | brehaut | ccw is really great |
| 21:55 | TimMc | I'm thinking for instance of how Java makes String a final class to enforce immutability of data passed in to core security classes. |
| 21:56 | TimMc | brehaut: What species of caveats? |
| 21:56 | brehaut | TimMc: im not up on the security model, but i have heard [citation needed] that its not as successful as hoped |
| 21:57 | TimMc | The Clojure one? |
| 21:57 | brehaut | Java one |
| 21:57 | TimMc | Ah! OK. |
| 21:57 | brehaut | clojure is even harder to secure than java |
| 21:57 | jcromartie | really? |
| 21:57 | jcromartie | I'd imagine you could strictly control the namespace that something is evaluated in |
| 21:58 | hiredman | namespaces have nothing to do with security |
| 21:58 | jcromartie | but I guess Java interop is kind of out of bounds |
| 21:58 | brehaut | &(clojure.lang.Compiler/maybeResolveIn *ns* (symbol "eval")) |
| 21:58 | sexpbot | ⟹ #'clojure.core/eval |
| 21:58 | jcromartie | you leet hax0r |
| 21:59 | cemerick | brehaut: I'd be very interested in that citation. The Java security model is overly complicated, but well-implemented AFAIK. |
| 21:59 | hiredman | https://github.com/hiredman/Arkham |
| 21:59 | brehaut | cemerick: im digging, im pretty sure i saw something very recently |
| 21:59 | brehaut | hiredman: best name ever |
| 21:59 | hiredman | I know |
| 21:59 | tomoj | brehaut: ouch! |
| 22:00 | TimMc | hiredman: I approve of "evil". |
| 22:00 | tomoj | better report it |
| 22:00 | brehaut | tomoj: i have done |
| 22:00 | hiredman | if clojure's compiler provided a few hooks you could sandbox very easily |
| 22:00 | brehaut | amalloy grumbled at me |
| 22:00 | tomoj | I knew there had to be more holes for vars to fall through |
| 22:01 | jcromartie | hiredman: that's a great solution, actually |
| 22:01 | brehaut | clojure is in a much better place than other dynamic languages |
| 22:01 | hiredman | man, maybe thats what I should do for clojurebot instead of Arkham |
| 22:01 | brehaut | like say python or javascript |
| 22:01 | hiredman | for clojure and add the hooks I need to the compiler |
| 22:01 | hiredman | fork |
| 22:01 | hiredman | oh man |
| 22:02 | amalloy | (inc hiredman) |
| 22:02 | sexpbot | ⟹ 2 |
| 22:02 | amalloy | plz do all my work for me. i like this plan |
| 22:02 | hiredman | too bad, time for dinner |
| 22:03 | TimMc | brehaut: window.undefined = 5; |
| 22:03 | brehaut | ever seen http://ha.ckers.org/xss.html ? its depressing |
| 22:04 | TimMc | brehaut: Sure, but only depressing in the sense that WHEN WILL PEOPLE STOP USING BLACKLISTS. |
| 22:04 | brehaut | never |
| 22:05 | brehaut | i feel confident in saying that people will stop writing code that stores passwords in clear before they stop using blacklists |
| 22:05 | jcromartie | hah |
| 22:06 | brehaut | cemerick: i cant find what i was looking for. consider my comments retracted |
| 22:07 | cemerick | brehaut: I have no particular bias, outside of having no memory of hearing of any problems with its implementation. |
| 22:07 | TimMc | brehaut: Wrong: ##(< Double/POSITIVE_INFINITY Double/POSITIVE_INFINITY) |
| 22:07 | sexpbot | ⟹ false |
| 22:07 | brehaut | cemerick: neither do i, but i dont trust my memory enoguh to make some claim like that |
| 22:07 | TimMc | Neither will ever happen. ;.; |
| 22:08 | brehaut | TimMc: my statement holds! |
| 22:08 | TimMc | ,(>= Double/POSITIVE_INFINITY Double/POSITIVE_INFINITY) |
| 22:08 | clojurebot | true |
| 22:09 | TimMc | I suppose if you phrase it that way... |
| 22:09 | TimMc | hmm |
| 22:15 | amalloy | brehaut: i found their use of disgusting non-xhtml constructs more depressing than the actual xss |
| 22:16 | brehaut | amalloy: whats wrong with html! |
| 22:16 | amalloy | evvvverything |
| 22:18 | brehaut | your well argued case has swayed me :P |
| 22:19 | TimMc | The parens are all messed up. |
| 22:21 | amalloy | brehaut: would you accept "highly irregular grammar leads browsers to 'do their best', leading to xss issues all over"? |
| 22:22 | brehaut | amalloy: half marks; even with a highly regular grammer, browsers still 'do their best' |
| 22:23 | amalloy | i'm inclined to believe this is because they have to be compatible with pages that are used to leniency |
| 22:23 | amalloy | but i believe a lot of false things, so ymmv |
| 22:24 | TimMc | It's the downside of what's-his'face's law |
| 22:24 | brehaut | amalloy: if you are sending your xhtml with xml application mimetype allowing them to run through a proper xml parser rather than a standards mode xhtml parser, however, you'd be right |
| 22:24 | TimMc | Postel |
| 22:25 | TimMc | brehaut: Browsers have broken behavior for xml+xhtml -- the slightest error causes the page to be completely unrenderable. |
| 22:26 | brehaut | if you send it with application/xml or whatever it is. they employ the draconian error handling that is specified by the xml spec |
| 22:26 | brehaut | if you dont, then you get 'browsers best guess' |
| 22:26 | pdk | that's the beauty of markup langs today |
| 22:26 | brehaut | oh and the other caveat for the proper xml mimetype is that IE would choke on it completely up to (maybe including?) IE7 |
| 22:27 | pdk | xml makes you bend over backwards and says right in its spec that complying implementations aren't allowed to do basic error correction that wouldn't even introduce ambiguity |
| 22:27 | TimMc | brehaut: That's the good news. :-P |
| 22:27 | pdk | while it's anyone's guess how a malformed html document will come out |
| 22:27 | amalloy | +1 for xml |
| 22:27 | brehaut | pdk: the best guess of most browsers is remarkably consistent these days |
| 22:28 | brehaut | ie6 being stagnant for so long had one good side effect |
| 22:28 | pdk | people standardizing on "make it show old pages geared for ie6 well?" |
| 22:29 | brehaut | pdk: not exactly; webkit and gecko had more time to improve their heuristics in general. a lot of ie6's rendering deviations are from incorrect implementation of the box model (they did what most people consider the intuitively sane model) |
| 22:29 | brehaut | so you just cant copy them with out breaking your rendering completely |
| 22:30 | pdk | hm |
| 22:30 | cemerick | brehaut: I forgot about GAE. Surely they use the Java security model for their sandbox? http://code.google.com/appengine/docs/java/runtime.html |
| 22:30 | pdk | fill me in, what makes it bad yet still "intuitively correct" |
| 22:30 | pdk | is that code for how goto used to be the obvious right way to structure code for people who learned programming on basic in the 80s :p |
| 22:30 | brehaut | cemerick: i guess so? |
| 22:31 | brehaut | pdk you have 4 width and height effecting properties in CSS (on block level elements): width, padding, border and margins |
| 22:32 | brehaut | in css the actual box that the element creates is width + padding + border widths + margin |
| 22:32 | brehaut | in ie6 its width + margin, with the content width of the element being width - borders - padding |
| 22:33 | waxrose | You shouldn't even support IE6 anymore anyways. |
| 22:33 | cemerick | the alternative being that they implemented their own security model and/or JVM. Not out of reach, but… |
| 22:34 | brehaut | cemerick: is everything in the app engine for a customer within one jvm process? |
| 22:34 | brehaut | cemerick the issues i think i had heard were to do with a jvm having two different security contexts |
| 22:35 | cemerick | it's a clustered environment, so I presume requests to a single app could easily be on two different JVMs |
| 22:35 | brehaut | pdk: im not even sure if the IE model is bad; its certainly useful that you can say 'this element is 100% wide, has a border and has 1 em of padding' |
| 22:36 | waxrose | brehaut, It's not like IE follows standards anyways. |
| 22:37 | TimMc | waxrose: They're getting better. |
| 22:37 | brehaut | waxrose: im not an IE or MS fan by any stretch but that BS; they didnt but they have picked up their game a lot |
| 22:37 | TimMc | The IE 9 team was instructed to shape up. |
| 22:37 | waxrose | TimMc, Yeah, IE 9 supports Html 5 standards 100%.............................. 100% of the features implemented into IE9. |
| 22:37 | brehaut | TimMc: I have less trouble with IE8 than FFx for some things |
| 22:38 | TimMc | Or more accurately, told that quality should yield less to timing pressures than in the past, I suppose. |
| 22:38 | brehaut | waxrose: an incomplete implementation of the spec is significantly different to a deviation from the spec for the same features |
| 22:38 | TimMc | waxrose: Oh, I still despise IE, don't get me wrong. And they're nowhere near ready to be considered a serious browser. |
| 22:39 | waxrose | Fx 4 beta 13 pre follows more web standards than IE 9 does. Besides, if you want a better standards compliant browser you would have to look at Opera. |
| 22:39 | pdk | i haven't grabbed the 9 beta yet |
| 22:39 | pdk | i thought they were told SHAPE UP ALREADY back with 7 |
| 22:39 | brehaut | pdk it took a long time to get trident into anything like reasonable shape |
| 22:39 | TimMc | pdk: Er, yes. That's what I meant. |
| 22:39 | pdk | so in short |
| 22:39 | pdk | 7 was a marginal polish job over 6 and 8 slightly more so? |
| 22:40 | waxrose | brehaut, True, but claiming they have the most advanced, HTML 5 compliant browser is another trick being spread as a rumor from MS. |
| 22:40 | pdk | while 9 is ideally throwing out the termite mound of a foundation |
| 22:40 | TimMc | They did some serious improvements. |
| 22:40 | waxrose | MS is forced to roll out a better IE because no one takes their browser serious in my opinion. |
| 22:41 | waxrose | Unless it's for a corporation I assume. |
| 22:42 | TimMc | waxrose: That's the install base of IE 6. |
| 22:43 | waxrose | Fx, Safari, Opera, hell even broken Fennec serve better over standards than IE 9. I just think that with all their 800lb Gorilla funds they have, they would be a little more advanced than what they currently are. But I'll end my rant haha. |
| 22:43 | waxrose | overall* |
| 22:44 | waxrose | TimMc, Yeah, I had to do a few contract project for Baylor Univ. two years ago and it was a horrible experience trying to get around their IE6 demands. |
| 22:44 | waxrose | projects* |
| 22:45 | arohner | has anyone used cron4j? Good experiences? Is there a better library? |
| 22:46 | pdk | have they at least rearranged their priorities with standards compat a bit |
| 22:46 | pdk | i recall people lameting how standards were only bumped up a teeny little notch from "we don't give even half a shit, pal" as it was with 6 |
| 22:46 | TimMc | Bedtime! G'night. |
| 22:47 | pdk | er bumped up with 7 from 6 |
| 22:47 | waxrose | pdk, Haha, yeah. |
| 22:47 | waxrose | TimMc, night |
| 22:48 | waxrose | Nearly all of my friends are Web Designers/Developers and I have to go through this argument of 508 and compliance all the time. |
| 22:48 | brehaut | pdk my understanding is that the team working on IE9 do care about the standards, and making a great browser. whether that is a concern shared by management types is another matter |
| 22:48 | TimMc | brehaut: Indeed. |
| 22:49 | waxrose | brehaut, I will admit though, they HAVE greatly improved from the transition of IE7 -> 8 -> 9. |
| 22:50 | waxrose | The interface of IE9 though is a bit awkward to me but I assume will play in the hand of Win 8. meh |
| 23:03 | pdk | is there any ui info on win8 then |
| 23:03 | pdk | like mockups/proposed features |
| 23:05 | waxrose | I haven't really looked since I only use Windows in a VirtualBox .vdi for school. |
| 23:06 | pdk | i don't think that affects your ability to find news on an os that is still years from release :p |
| 23:06 | jcromartie | strange things happen when realizing an element of a lazy seq throws an exception but you just abort that thread and run it again? |
| 23:07 | waxrose | The only thing I heard about Windows 8 is that it will be dropping 32 bit. |
| 23:08 | waxrose | And will support x64 and x128. |
| 23:08 | pdk | criminy |
| 23:08 | pdk | well |
| 23:08 | pdk | just so long as you can recompile doom source to x128 |
| 23:08 | pdk | srsly! |
| 23:09 | waxrose | x128 just sounds crazy to me but it's going to be interesting when it's common. |
| 23:09 | waxrose | pdk, And yes, it will effect me to find news on it since I'm a Linux advocate. lol |
| 23:10 | waxrose | If I didn't require it for my silly college, I wouldn't be using it. |
| 23:11 | jcromartie | x128... who cares? we're so far off from filling up the 64-bit address space |
| 23:11 | jcromartie | I'm not trying to be shortsighted |
| 23:12 | pdk | the mainframe guys aren't |
| 23:12 | pdk | then again |
| 23:13 | jcromartie | I guess so |
| 23:13 | pdk | the mainframe guys could give two about windows |
| 23:13 | jcromartie | but this is the first I've ever heard of 128-bit |
| 23:13 | pdk | (they're also gearing up for ipv8) |
| 23:13 | waxrose | I don't really care, but I love to live on the edge so once I see x128 I'll install it. lol |
| 23:13 | pdk | (you heard it here first) |
| 23:14 | pdk | (ps my dad works at nintendo) |
| 23:15 | pdk | (he showed me storyboard sketches for some cutscenes from mario party 12) |
| 23:16 | jcromartie | is it april 4? |
| 23:16 | jcromartie | I mean 1 |
| 23:16 | waxrose | lol |