2014-03-25
| 00:00 | Frozenlock | It's very basic. I still haven't made a redo function. |
| 00:00 | zspencer | I love how clojure/script makes things like 'undo/redo' a non-issue |
| 00:01 | Frozenlock | zspencer: I want a tree undo/redo, but I don't even know where to begin :-( |
| 00:01 | bostonaholic | ^^^ that'd be killer |
| 00:01 | zspencer | Explain the use case a bit more? Tree undo/redo doesn't click immediately with me |
| 00:01 | arrdem | zspencer: you back out changes and then want them back |
| 00:01 | Frozenlock | zspencer: http://briancarper.net/blog/568/emacs-undo-trees |
| 00:03 | zspencer | Ah, interesting. |
| 00:03 | Frozenlock | I don't use it often in emacs, but when I do, I'm REALLY happy to have it. |
| 00:04 | zspencer | Never realized vim did that |
| 00:07 | zspencer | undo/redo in vim always just seemed so natural that I didn't need to think about the interactio nmodel. |
| 00:08 | Frozenlock | http://www.bestofvim.com/plugin/gundo/ |
| 00:11 | zspencer | Frozenlock: such beauty |
| 00:24 | ben_m | Anyone if there's a plugin for lazybot to enable aliases? Something like !alias add bot !echo I'm a bot |
| 00:24 | ben_m | ^Anyone^Anyone know |
| 00:26 | arrdem | ~anyone |
| 00:26 | _eric | if I have a function that takes [a & b] and I have an array, how do I pass the values of the array so that they end up in b? |
| 00:28 | Frozenlock | (apply my-fn (cons a? my-array))? |
| 00:28 | Frozenlock | a? --> whatever your `a` is. |
| 00:29 | _eric | interesting |
| 00:29 | _eric | what does the ? do? |
| 00:29 | _eric | (is there a name for it?) |
| 00:29 | Frozenlock | Nothing, it was me pointing the `a` out :p |
| 00:29 | _eric | oh |
| 00:29 | Frozenlock | (apply my-fn (cons some-argument my-array))? |
| 00:30 | _eric | got it |
| 00:31 | _eric | thanks |
| 00:32 | Guest52004 | did you write the function? |
| 00:33 | _eric | yes |
| 00:33 | bob2 | (remember you can change it to take a vector as the second arg instead) |
| 00:34 | _eric | well, most of the time I want it to not take a vector |
| 01:15 | ben_m | What's the most idiomatic way to remove a character from the start of the string, if it exists. ie. (if (= (nth s 0) \@) (subs s 1) s) |
| 01:18 | Raynes | ben_m: I'd use (first s) instead of nth, but otherwise looks fine to me. |
| 01:19 | ben_m | yeah i changed it to that |
| 01:19 | ben_m | alright |
| 01:54 | dissipate | is random number generation considered to be a 'side effect'? |
| 01:56 | ben_m | It depends where you get the seed from. |
| 01:56 | dissipate | ben_m, /dev/urandom |
| 01:57 | ben_m | Yeah, reading that is the side effect. |
| 01:59 | dissipate | ben_m, is it possible to do random number generation without side effects? |
| 01:59 | ben_m | Well you'd always get the same result. |
| 02:01 | ben_m | Pure functions are by definition deterministic, so they give the same result when you call them with the same parameters. You can see how that wouldn't work for random numbers. |
| 02:01 | Raynes | No. |
| 02:01 | Raynes | It's not really possible. |
| 02:02 | ben_m | What Haskell does, for example, is that the random number generation itself is pure. You provide it a StdGen and the generator functions return another StdGen and a value, and you thread that to the next generator, etc. |
| 02:02 | ben_m | That part is pure, and then you supply it with a StdGen you get through side effects. |
| 02:04 | dissipate | ben_m, would that be like a lazy sequence in clojure? |
| 02:04 | ben_m | I don't know how lazy sequences are implemented in clojure |
| 02:07 | ben_m | It would be something like (defn [seed] (let [[value1 seed'] (rand-float seed) [value2 _] (rand-float seed')] (+ value1 value2 )) |
| 02:08 | ben_m | Uh, don't mind the missing function name - you get the point I hope. |
| 02:10 | dissipate | ben_m, looks pure to me |
| 02:10 | dissipate | ben_m, but that's a psuedo-RNG |
| 02:10 | ben_m | Yeah that's the pure part. |
| 02:10 | ben_m | And then you'd seed it with something with side effects |
| 02:10 | ben_m | like reading /dev/urandom |
| 02:11 | ben_m | And yeah, that's just conceptual. |
| 02:11 | dissipate | ben_m, but anything reading from /dev/urandom isn't pure |
| 02:11 | ben_m | That's what I said :) |
| 02:15 | dissipate | ben_m, this is good actually. it also means no one can claim their RNG is referentially transparent |
| 02:19 | ambrosebs | holy crap the clojure/west videos are up already |
| 02:19 | dissipate | ambrosebs, from last year? |
| 02:20 | ambrosebs | https://www.youtube.com/watch?v=KhRQmT22SSg |
| 02:20 | ambrosebs | no! |
| 02:20 | ambrosebs | from yesterday! |
| 02:23 | dissipate | ambrosebs, did you see this? http://www.infoq.com/presentations/fp-languages-bug-free-fault-tolerant |
| 02:23 | ambrosebs | no? |
| 02:23 | clojurebot | no is tufflax: there was a question somewhere in there, the answer |
| 02:37 | jph- | anyone know if i can use postgres enum types with lobos migrations? |
| 02:55 | Cr8 | ambrosebs: ! |
| 02:55 | Cr8 | slides synced up and all even this is pretty wild to have already available |
| 02:57 | Cr8 | oh nice its recorded straight off the laptops i'm guessing |
| 03:06 | jph- | anyone familiar with timbre for logging? |
| 03:10 | gyim | not super familiar, but i've used it |
| 03:11 | jph- | im getting some log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog) message |
| 03:11 | jph- | i think log4j is being used by jdbc or related... but i haven't told it where to send logs |
| 03:11 | jph- | and googling has not given me any love so far |
| 03:12 | gyim | do you have a log4j.properties file? |
| 03:12 | jph- | nope, haven't needed one |
| 03:12 | jph- | for the other stuff |
| 03:12 | jph- | i dont even know what specifically is generating the com.mchange stuff |
| 03:12 | devn | queues in cljs... what do people use? |
| 03:12 | jph- | some library in my webapp |
| 03:13 | gyim | ok, then i guess it's not related to timbre |
| 03:13 | gyim | put a log4j.properties file into resources/ |
| 03:13 | devn | specifically i'm thinking of keyboard events. I want to be able to capture a kind of sliding/logging buffer of keystrokes |
| 03:13 | devn | so i can group keystrokes within, say 10ms of one another as a single vent |
| 03:13 | devn | event* |
| 03:14 | gyim | jph-: this is a simple starting point for log4j config: http://www.mkyong.com/logging/log4j-log4j-properties-examples/ |
| 03:14 | Cr8 | if you're up for core.async that'd be pretty amenable to that |
| 03:14 | jph- | gyim, i dont know how to apply the java log4j stuff in the context of a clojure project |
| 03:14 | jph- | i can figure out what to include, but not where and why i need it |
| 03:15 | jph- | i dont even know what damn library is triggering the message :P |
| 03:16 | Cr8 | that is it has sliding buffers built in, and you can do debounce-y things fairly easily with timeout channels |
| 03:16 | Cr8 | &alts |
| 03:16 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: alts in this context |
| 03:16 | Cr8 | heh |
| 03:18 | gyim | jph-: clojure is not different from java here: if one of your libraries depends on log4j, you need a log4j config. If you put a config into the resources/ directory, it will be put into your jar file => it won't complain about missing appender config |
| 03:18 | jph- | gyim, ok |
| 03:18 | jph- | i'll start there |
| 03:18 | gyim | the alternative, of course, is to find the library that depends on log4j and remove it |
| 03:18 | jph- | i think it's one of the database-related libraries |
| 03:18 | jph- | im using a luminus template, and another webapp using same template isnt complaining... so i'm trying to compare between them |
| 03:20 | jph- | looks like an older luminus template explicitly added a log4j config in project.clj, i removed it and it's fine |
| 03:20 | gyim | great |
| 03:20 | jph- | just... annoying :P |
| 03:20 | gyim | :) |
| 03:20 | jph- | debugging clojure stuff can be a real PITA sometimes |
| 03:20 | jph- | especially when it's in java land |
| 03:44 | augustl | cljs question. Does it make sense to somehow extend the cljs protocols for JVM types? The use case being running cljs in nashorn, and passing in clojure values directly |
| 03:44 | tomjack | fellow univalence amateur? |
| 03:47 | tomjack | I wonder why the query "nashorn interop" seems fruitless |
| 03:55 | tomjack | it is rather interesting to see noms in http://arxiv.org/pdf/1401.7807v1.pdf |
| 04:02 | jph- | i'm getting an exception when firing up a repl, but there's nothing in *e or (pst). Any way to make the repl more informative at launch? |
| 04:03 | cYmen_ | jph-: Have you tried lein repl in the terminal and looked at *Messages*? |
| 04:04 | cYmen_ | Wait, which environment is this? |
| 04:07 | jph- | cYmen_, i'll check |
| 04:07 | jph- | cYmen_, it's a ring handler repl |
| 04:08 | cYmen_ | jph-: But are you starting it from emacs or some other IDE? |
| 04:09 | jph- | cYmen_, command line |
| 04:09 | cYmen_ | Huh...and there is nothing in the messages about why it fails? |
| 04:10 | jph- | nope |
| 04:11 | jph- | #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.Symbol> |
| 04:11 | jph- | nREPL server started on port 47229 on host 127.0.0.1 |
| 04:11 | jph- | REPL-y 0.3.0 |
| 04:11 | jph- | ... |
| 04:12 | cYmen_ | but the repl starts? |
| 04:12 | jph- | correct |
| 04:13 | cYmen_ | hmhmhm |
| 04:14 | cYmen_ | probably something about ring trying to start the server in the background :/ |
| 04:14 | jph- | oh |
| 04:14 | jph- | ooooooooooooooh |
| 04:14 | cYmen_ | Sorry, can't really help you I'm afraid. |
| 04:14 | jph- | i found it |
| 04:14 | jph- | in my repl.clj |
| 04:14 | jph- | (:require [cheshire.core :refer :all] |
| 04:14 | jph- | [criterium.core :as :crit] |
| 04:14 | jph- | :as :crit |
| 04:14 | jph- | helpful error messages again |
| 04:15 | cYmen_ | Yeah, it is indeed a Keyword not a Symbol. |
| 04:15 | cYmen_ | Not your fault. |
| 04:15 | jph- | heh |
| 04:15 | jph- | wasnt there a clojure linter |
| 04:15 | cYmen_ | I've been complaining about exactly this kind of problem just yesterday. |
| 04:15 | jph- | i wonder if that'd pick that crap up |
| 04:16 | jph- | the other fun one... leave an empty () in your code somewhere |
| 04:16 | cYmen_ | Wait, I need to take notes. |
| 04:16 | cYmen_ | :p |
| 04:16 | jph- | yeh |
| 04:16 | jph- | for messing with your clojure colleague |
| 04:16 | clojurebot | I don't understand. |
| 04:16 | jph- | for leaving his terminal unlocked |
| 04:16 | cYmen_ | hahaha |
| 04:18 | ddellacosta | jph-: clojure linter is https://github.com/jonase/eastwood |
| 04:18 | jph- | thats the one |
| 04:19 | cYmen_ | Is it any good? |
| 04:19 | jph- | well it's complaining about a lot of stuff |
| 04:19 | jph- | so i guess i should look deeper heh |
| 04:23 | ambrosebs | jph-: there is dynalint which injects code to give better runtime errors. |
| 04:23 | ambrosebs | jph-: much less complete tho |
| 04:24 | ambrosebs | eastwood relies on code compiling correctly before linting also |
| 04:28 | atyz | Is anyone using new relic with pedestal and NOT on heroku |
| 04:28 | atyz | ? |
| 05:01 | sm0ke | so guys i have this macro where i want to evaluate form outside the usual `() |
| 05:02 | sm0ke | so my macro looks like (defmacro mm [a & body] (let [ea ~a] `(...))) |
| 05:02 | sm0ke | but this obviously fails |
| 05:02 | opqdonut | you're doing it wrong |
| 05:03 | opqdonut | do you really want to compute stuff read-time? |
| 05:03 | opqdonut | if so, you need to use eval |
| 05:03 | opqdonut | but using eval in your macros is a code smell |
| 05:03 | sm0ke | yea i am kind of not sure |
| 05:03 | gko | In Emacs nrepl-jack-in, how to make it follow :repl-options defined in project.clj, such as :init-ns? In command line, it works OK, but in nrepl-jack-in, I always land in user... |
| 05:04 | opqdonut | sm0ke: what does the macro do? |
| 05:04 | sm0ke | so i what i want is this my macro used to look like (with-objects [o1 o2 o3] (..)) |
| 05:05 | sm0ke | but now i have a new requirement where it can takes an optional object (with-objects [o1 o2 o3] o4 (..)) |
| 05:05 | sm0ke | i am not sure how to go about writing it |
| 05:05 | sm0ke | o4 can be a form as well as an object |
| 05:05 | sm0ke | it can ideally be a form returning an object |
| 05:06 | sm0ke | hurm |
| 05:06 | opqdonut | couldn't you just have two arities of your macro? 2 and 3? |
| 05:06 | opqdonut | if the body of with-objects can be multiple expressions, then you can't really disambiguate between the o4 and the normal case |
| 05:07 | opqdonut | but if it's just one expression, yay |
| 05:07 | sm0ke | opqdonut: yes but form can be multiple so this is not possible right ( [a b & body] [a & body]) |
| 05:07 | opqdonut | yeah |
| 05:07 | sm0ke | yes |
| 05:07 | opqdonut | so you can't know whether you have o4 or a body expression |
| 05:07 | opqdonut | how about just (with-objects [o1 o2 o3 o4] ...)? |
| 05:07 | sm0ke | i wish i had something like (with-objects [o1 o2] :optional o4 (...)) |
| 05:08 | opqdonut | that is doable but slightly ugly |
| 05:08 | sm0ke | opqdonut: its an entirenly different entity |
| 05:08 | opqdonut | (just check if body begins with a keyword) |
| 05:08 | sm0ke | hmm yea, ugly macro |
| 05:09 | sm0ke | seems like i would have to sacrifice & body to body |
| 05:09 | opqdonut | some suggestions: (with-objects [:objects o1 o2 o3 :the-other-thing o4] ...) (with-objects-simple [o1 o2 o3] ...) (with-objects-complex [o1 o2 o3] o4 ...) |
| 05:09 | opqdonut | or maybe (with-objects {:objects [o1 o2 o3] :other-thing o4} ...) ? |
| 05:10 | sm0ke | yep |
| 05:10 | sm0ke | sensible |
| 05:10 | opqdonut | added bonus: by using a map literal you avoid any parsing in the macro body |
| 05:11 | opqdonut | err s/body/implementation/ |
| 05:11 | sm0ke | true |
| 05:26 | atyz | Has anyone got new-relic working with a pedestal app? |
| 05:40 | tomjack` | what was the clojure in make named? |
| 05:43 | quotemstr | What's the preferred way of representing Clojure forms with Emacs sexps? |
| 06:02 | dsrx | quotemstr: i've been using (print-to-string '(whatever (quote blah blah)) t) to some success |
| 06:02 | dsrx | the t argument is crucial to avoid escaping dots |
| 06:03 | dsrx | in the wild I see a lot of clojure forms as string constants in emacs lisp... i just hate not being able to paredit them |
| 06:06 | scottj | dsrx: there's probably some fancy way to narrow the buffer to just the string area and have it in clojure-mode w/ paredit |
| 06:06 | dsrx | yeah, there is something like that in emacs I think |
| 06:07 | dsrx | ah here we go acebook.com |
| 06:07 | dsrx | err |
| 06:07 | dsrx | argh, I don't know why chrome does that all the time. anyway here we go http://www.emacswiki.org/emacs/IndirectBuffers |
| 06:09 | scottj | dsrx: just selecting the entire contents of the string (w/o quotes) and running narrow-to-region seems to allow paredit to work, though the content is all still highlighted as a string |
| 06:10 | dsrx | right, seems straightforward enough to write something that creates an indirect buffer w/ clojure-mode and then narrows to the region |
| 06:10 | dsrx | and switches to it |
| 06:44 | jph- | the penny has finally dropped re thread-first thread-last |
| 06:44 | jph- | im now in heaven |
| 06:49 | CookedGryphon | rhow do I get rid of reflection warnings in proxy-super calls? |
| 06:49 | CookedGryphon | inside a proxy, surely it should know what super is |
| 06:59 | fikusz | how could I call a series of functions on the same object? |
| 06:59 | CookedGryphon | doto |
| 07:00 | fikusz | CookedGryphon: thanks, checking |
| 07:04 | mskoud_ | In the compojure routing DSL fx (GET "/product/:id/" [id] (str "<h1>Product " id "</h1>")) the (str ...) is not evaluated right away, but is it good practice that a macro handles the quoting? It would be easy to understand it it was quoted '(str...) like "normal" code i think. |
| 07:06 | clgv | mskoud_: the macro does not necessarily do any quoting. usually macros generate code. in this case I'd assume that a function with destructuring is generated so that all symbols are bound and thus no quoting is needed (but I have not checked the code) |
| 07:07 | mskoud_ | maybe, just trying to come to terms with reading clojure :-) |
| 07:08 | clgv | mskoud_: perhaps what you mean with "the macro does the quoting" is the effect that parameters to a macro are not evaluated so that the macro is called with the original forms |
| 07:11 | mskoud_ | and thats clever, but being a noice, reading the code, it looks like a form which will be evalueated right away. |
| 07:12 | clgv | mskoud_: but that's the general principle of macros. otherwise you couldnt use them for code transformation, e.g. for new control flow macros |
| 07:13 | clgv | mskoud_: eventually it comes down to read the documentation on the macro to learn what it does - but you have to do the same for functions as well |
| 07:16 | mskoud_ | yes, i see. thanks. |
| 08:00 | kras | Hi, any good tutorial or suggested readings on zippers? |
| 08:02 | danielszmulewicz | kras: http://josf.info/blog/2014/03/21/getting-acquainted-with-clojure-zippers/ |
| 08:04 | kras | danielszmulewicz: thank you !! |
| 08:05 | danielszmulewicz | kras: you're welcome. |
| 08:48 | felher | Hey folks. Is there a way to find out whether some code is run in nrepl or not? |
| 08:54 | clgv | felher: you can check whether nrepl namespaces are loaded. but why do you want to do that? |
| 08:59 | felher | clgv: I have the problem that when I use clojure.java.shell/sh, my application won't quit anymore. I know that everything is done, though. So I thought about just invoking System.exit when everythings done. But that gets me into trouble if I launch my application from the nrepl. |
| 09:03 | felher | Another approach would be using the main function as a wrapper like (do (run-main-application) (System/exit 0)) and just run run-main-application from the nrepl, I guess. |
| 09:03 | clgv | felher: how do you use `sh` - I guess you either do something wrong or found a bug |
| 09:04 | clgv | felher: do you use agents as well? |
| 09:05 | felher | clgv: No. Just using this program http://bpaste.net/show/193414/ and doing "clojure-1.5 program" doesn't quit on my machine. |
| 09:06 | clgv | felher: what is "clojure-1.5" in that case? |
| 09:07 | felher | clgv: the clojure from my gentoo package manager 'emerge' with the version 1.5.1 |
| 09:08 | felher | clgv: which is a wrapper that executes clojure.main in the clojure jar, I guess. |
| 09:08 | clgv | felher: since clojure is a java jar what exactly is "clojure-1.5"? a bash script doing what? |
| 09:09 | clgv | felher: that `sh` scenario should work like a charm |
| 09:09 | felher | clgv: okay, i'll try it with the jar manually. Maybe it is different then. :) |
| 09:12 | felher | clgv: nope, "java -jar clojure-1.5.1.jar program" does exactly the same thing. And this is the jar from my local maven repository ( http://bpaste.net/show/193418/ ) |
| 09:12 | clgv | felher: I just tried it. seems to be a problem with that shell namespace. |
| 09:15 | clgv | felher: ok the problem is that `sh` uses futures and thus the threadpool is still alive and prevents the program from exiting |
| 09:15 | clgv | felher: you could use a dynamic binding *in-repl* which is usually true but gets bound to false in your "-main" function |
| 09:16 | felher | clgv: yeah, I think that would work. Thanks. :) |
| 09:17 | clgv | I do that for programs as well, when they need to return non-zero exit values on error but I still want to test on repl |
| 09:28 | mikerod | Is there a simple way to use 'clojure.core/load' or clojure.lang.RT#load in a way that does not affect the class path of the caller? |
| 09:29 | mikerod | I'd like to load/compile the necessary clj to calculate some result, then allow it to all be GC'ed away. If that makes sense. So on-the-fly compile clj lib in a temporary context that can be thrown away later. |
| 09:30 | mikerod | I'm skeptical that the use of the clojure.lang.DynamicClassLoader may already give me this behavior, or close to it if I set the correct context ClassLoader perhaps. |
| 09:32 | clgv | mikerod: maby with that one? https://github.com/ninjudd/classlojure |
| 09:33 | atyz | Has anyone had new relic running with pedestal? |
| 09:34 | mikerod | clgv: I forgot about this lib. It is probably somewhat applicable, but I don't actually need an "alternative" class path. I just don't want to affect the ClassLoader my lib is called from. |
| 09:34 | clgv | mikerod: well that lib would do that ;) |
| 09:34 | mikerod | I'm thinking of a scenario where a service on a long-running server calls my lib with some .clj source passed to me. I want to compile it and then calculate some return data from it. |
| 09:35 | clgv | mikerod: it is probably the easiest solution since otherwise you probably end up implementing all the behaviour yourself with the disadvantag to have to find the sparse classloader documentation ;) |
| 09:35 | mikerod | clgv: hah, ok. I'll look at it a bit more in depth then. |
| 09:35 | clgv | mikerod: another approach is to use the stuff of immutant |
| 09:36 | clgv | since you mentioned server, I remembered that they have some classloader isolation as well |
| 09:36 | verma | mikerod, isn't http://tryclj.com/ already doing sort of this? and its opensource |
| 09:37 | clgv | verma: not really it is probably only running a jail and a namespace per user |
| 09:37 | mikerod | verma: tryclj may be using the classlojure lib, I am not positive though. |
| 09:37 | mikerod | Hmm. |
| 09:37 | mikerod | Yeah, I could look at what immutant is doing too. |
| 09:37 | clgv | just guessing though.. |
| 09:38 | clgv | mikerod: yeah immutant is probably safer since they are pretty actively maintaining it |
| 09:38 | verma | hmmm |
| 09:38 | mikerod | I've dug into DynamicClassLoader a bit before, and based on what I've seen there, I'm not sure it actually adds any new class definitions to the parent ClassLoader anyways though. |
| 09:39 | mikerod | I was sort of wondering if I get this behavior for "free" from Clojure compilation. |
| 09:39 | mikerod | As long as I don't release any references to classes that were loaded during the compilation back into the wild, preventing the DynamicClassLoader to be GC'ed. |
| 09:40 | clgv | but if you require namespaces they are globally loaded and only need to be refered to in different namespaces |
| 09:40 | mikerod | I'm sure it is valuable to look at these libs to make some more sense of this. |
| 09:40 | clgv | if the files do not contain namespaces and you create the surrounding namespace on the fly it would be possible with usual clojure |
| 09:41 | mikerod | clgv: ah, you mean they would have references held via the Namespace of the Clj runtime |
| 09:41 | mikerod | Such as Namespace#namespaces |
| 09:42 | mikerod | They do contain :require's, so I would infect the Clj env around me. booo |
| 09:42 | clgv | yes you would. |
| 09:42 | clgv | you need the kind of isolation used in immutant or classlojure to prevent that |
| 09:42 | mikerod | There is the Namespace#remove option. Maybe that's how these libs are doing it. |
| 09:42 | mikerod | clgv: Yep, it seems like we are back to that. I'll take your advice on it then. :) |
| 09:43 | mikerod | I appreciate the feedback. |
| 09:45 | clgv | I should be able to override hashCode and equals in a deftype right? but it seems my implementation is not called since I do not see the printlns I added there |
| 09:46 | mikerod | clgv: how are you trying to call it? |
| 09:46 | mikerod | clojure.core/hash? |
| 09:46 | clgv | (= a b) |
| 09:47 | clgv | or directly (.equals a b) |
| 09:48 | mikerod | oh |
| 09:48 | mikerod | Hmm, I thought you could override them. |
| 09:49 | clgv | very simple example: |
| 09:49 | clgv | ,(deftype Bla [x] Object (hashCode [this] x) (equals [this, y] (= x y))) |
| 09:49 | clojurebot | sandbox.Bla |
| 09:49 | clgv | ,(= (Bla. 42) (Bla. 42)) |
| 09:49 | clojurebot | false |
| 09:49 | clgv | ,(.equals (Bla. 42) (Bla. 42)) |
| 09:49 | clojurebot | false |
| 09:49 | clgv | :/ |
| 09:50 | llasram | clgv: Well, 42 != (Bla. 42) |
| 09:50 | clgv | llasram: right and? |
| 09:50 | llasram | Um, that's what your equals method is testing :-) |
| 09:50 | clgv | ups lol |
| 09:50 | mikerod | yeah, you are falling back to Obj equals |
| 09:51 | clgv | error in the minimal example that does not translate to the actual code... |
| 09:52 | clgv | so suppose there is a println in there for debugging what could possibly prevent it from being printed? in the minimal example it works |
| 09:52 | clgv | ,(deftype Bla [x] Object (hashCode [this] x) (equals [this, y] (println "equals") (= x (.x y)))) |
| 09:52 | clojurebot | sandbox.Bla |
| 09:52 | clgv | ,(.equals (Bla. 42) (Bla. 42)) |
| 09:52 | clojurebot | equals\ntrue |
| 09:53 | clgv | guess I ask the decompiler ^^ |
| 09:55 | clgv | humm damn, restarting the repl helped after compiling |
| 10:03 | clgv | somehow redefining the deftype on the repl does not work consistently :( |
| 10:07 | mdrogalis | Wooo. 1.6 shipped |
| 10:12 | Morgawr | congratulations for Clojure 1.6! :D |
| 10:12 | Morgawr | someone has to change the topic now :P |
| 10:17 | Averell | man why is there still no update in arch? god i hate using this obsolete stuff. |
| 10:18 | AimHere | Yeah, clojure 1.6 is *minutes* old now! |
| 10:19 | clgv | Averell: you cant complain about arch before it's visible on the maven repository ;) |
| 10:34 | bhenry | why in the world is some? the name of (not (nil? x)) |
| 10:34 | bhenry | in 1.6 |
| 10:40 | mathw | 1.6! Woo |
| 10:41 | mathw | This was a great time to pay attention to the channel |
| 10:41 | TimMc | That's bizarre! |
| 10:43 | llasram | You people need to subscribe to the mailing lists :-) |
| 10:44 | llasram | (wrt to `some?`) |
| 10:44 | TimMc | Nah, it's a total opinionfest in there. |
| 10:45 | llasram | *snork* |
| 10:45 | TimMc | But seriously, what's the deal? |
| 10:48 | TimMc | That's one of the worst bits of naming I've seen in a while. :-( |
| 10:48 | llasram | It lets you write (some some? sums) |
| 10:48 | clgv | probably "some" was misnamed in the first place and now we have to live with it ;) |
| 10:49 | clgv | TimMc: the alternative suggestions on the ML have not been much better ... |
| 10:49 | llasram | I think `some` is fine. `some->` is where we lost our way. But now the Holy Names granted by Hickey may not be questioned. |
| 10:49 | cYmen_ | Should add some utf8... |
| 10:49 | cYmen_ | Like a tiny car or some klingon... |
| 10:51 | TimMc | clgv: I'll take your word for it; I can't actually search the ML. |
| 10:51 | mengu | hi. is anyone here taking care of clojure.org web site? there are no books listed at http://clojure.org/books |
| 10:53 | waf | mengu: looks like it requires javascript |
| 10:53 | waf | if you're running ghostery or something try pausing it |
| 10:53 | clgv | TimMc: https://groups.google.com/forum/#!searchin/clojure/%22some$3F%22/clojure/tseJgAi3HC4/0jyJ2BsUlB0J |
| 10:54 | mengu | which i have :) |
| 10:54 | mengu | let's check with another browser |
| 10:54 | waf | works for me in chrome with no adblock/ghostery running |
| 10:55 | mengu | ah, i got adblock |
| 10:55 | mengu | didn't even notice it blocked. |
| 10:55 | mengu | thx waf |
| 10:56 | clgv | yeah seems somehow stealthily blocked |
| 10:56 | TimMc | clgv: Thanks. |
| 10:57 | TimMc | something? and value? and even exists? look way better |
| 11:02 | TimMc | (map (comp (partial some some?) list) [true false nil 1]) ;; (true true nil true) |
| 11:13 | scgilardi | I'll be thinking "some?" means "some-value?" just like "contains?" means "contains-key?" (and consider sets a container of keys) |
| 11:33 | cored | hi |
| 11:33 | cored | is there a list resources books/articles for beginners ? |
| 11:35 | clgv | TimMc: hm ok, I forgot about "exists?". I'd use that as well^^ |
| 11:36 | cbp | cored: You can start here http://clojure-doc.org/ There are a few free books such as http://www.braveclojure.com/ and aphyr's posts are good too http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome For non free books Clojure Programming is good |
| 11:36 | cbp | cored you can also try doing exercises at 4clojure |
| 11:37 | clgv | cored: "Clojure Programming" is recommended frequently here. |
| 11:38 | cored | cbp: got it; thanks |
| 11:38 | cored | cbp: I will check that out |
| 11:38 | cored | cbp: I read Clojure Made Simple and I have Functional programming for object oriented programmers |
| 11:39 | cored | in queue; I was doing 4clojure ex. also but I want to retake it |
| 11:46 | alexyakushev_ | Hello, is there anyone proficient with core.match? |
| 11:50 | clgv | ~anyone |
| 11:50 | 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 ..." |
| 11:54 | synkte | ,(println "Good morning") |
| 11:54 | clojurebot | Good morning\n |
| 11:55 | alexyakushev_ | Yep, good point |
| 11:56 | alexyakushev_ | I have this function that refuses to be compiled: https://www.refheap.com/65410 |
| 11:56 | alexyakushev_ | Says "Invalid method Code length 72934", which means that method grew bigger than 64k |
| 11:57 | alexyakushev_ | I wonder if it is a bug, or such usage of core.match is considered an abuse |
| 11:58 | edbond | alexyakushev_, did you try macroexpand? |
| 11:59 | alexyakushev_ | edbond: Yep, gives 11k LoC |
| 12:00 | edbond | how big is the query? |
| 12:00 | TimMc | A colleague ran into this problem with some midje tests the other day. |
| 12:01 | alexyakushev_ | edbond: It doesn't matter, it fails to compile, not to run |
| 12:02 | clgv | alexyakushev_: isnt there a warning that core.match has problems with AOT? at least it was on the project site in the past |
| 12:03 | clgv | humm it is not there anymore. so maybe that one got fixed |
| 12:03 | alexyakushev_ | clgv: It might be, but my problem is not AOT-related, I can't compile it in the REPL |
| 12:04 | alexyakushev_ | It seems like the generated code just gets too big for the JVM to hold in one class |
| 12:04 | clgv | alexyakushev_: in one method I'd say. |
| 12:04 | alexyakushev_ | The question is, is it my wrong usage of core.match, or a bug somewhere |
| 12:05 | gtrak | core.match does gen a lot of code |
| 12:05 | alexyakushev_ | clgv: Pretty sure it's class limitation: http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#9279 |
| 12:05 | gtrak | but you could split things up into methods, no? |
| 12:05 | clgv | alexyakushev_: ping dnolen |
| 12:06 | clgv | alexyakushev_: but a function implementation without closures ends up in one java method, except for all the static constants |
| 12:07 | clgv | and there is definitely a limit on method implementation size on the vm. it was mentioned in the context of generated state machines |
| 12:07 | alexyakushev_ | clgv: Yes, I know. Well, it doesn't matter much since a class for function contains just one method for this function |
| 12:08 | alexyakushev_ | OK, I just have never seen this kind of error before, so only now figured out about these constraints |
| 12:08 | alexyakushev_ | gtrak: There ain't much to be split since it is just one macro |
| 12:09 | clgv | does reordering clauses in core.match has an influence on the generated code? |
| 12:09 | gtrak | alexyakushev_: the right side? |
| 12:11 | mpenet | clgv: if that's like in haskell order does matter |
| 12:11 | alexyakushev_ | gtrak: It might help a bit, but wouldn't solve the problem conceptually |
| 12:11 | gtrak | yea |
| 12:11 | mpenet | clgv: code size will prolly be very close though |
| 12:11 | alexyakushev_ | clgv: OK, it compiles now that I moved "limit" to the top |
| 12:11 | clgv | mpenet: ah ok. I just guessed in that direction since it does with performance in logic programming ;) |
| 12:12 | alexyakushev_ | Apparently the more elements there are in the clause, the lower you should put them |
| 12:12 | clgv | alexyakushev_: interesting |
| 12:12 | clgv | yeah so you got a specialization order |
| 12:13 | TimMc | That makes me sad. |
| 12:13 | alexyakushev_ | I still think I'm doing something wrong |
| 12:13 | alexyakushev_ | Or perhaps core.match is grossly inadequate for this exact task |
| 12:14 | clgv | alexyakushev_: maybe that documentation helps https://github.com/clojure/core.match/wiki/Understanding-the-algorithm |
| 12:15 | clgv | alexyakushev_: but your original code could be interesting for dnolen, maybe there is some bug causing the huge size |
| 12:15 | alexyakushev_ | clgv: It was my initial idea to write to him directly, but he's not online |
| 12:15 | alexyakushev_ | I will try to catch him later |
| 12:16 | alexyakushev_ | Thank you for your help, clgv and gtrak! |
| 12:58 | CookedGryphon | alexyakushev_: that doesn't look right... |
| 12:58 | CookedGryphon | perhaps the recur is recurring to the wrong point? |
| 13:00 | alexyakushev_ | CookedGryphon: Doesn't seem to be the case. The function works now that I reordered clauses, and it works correctly |
| 13:01 | nbeloglazov | alexyakushev_, I suggest to file a bug in this case. |
| 13:02 | alexyakushev_ | nbeloglazov: I will, probably after I ask David whether he is aware of such problem |
| 13:02 | CookedGryphon | alexyakushev_: I'm curious, what's your rewrite and what does it generate |
| 13:04 | alexyakushev_ | CookedGryphon: Now it looks like this https://www.refheap.com/65502, and macroexpanded it yields 4k loc instead of 11k in the first case |
| 13:05 | CookedGryphon | alexyakushev_: I got 790k lines when I macroexpanded and pprinted it... |
| 13:06 | CookedGryphon | but yeah, either way it's too much ! |
| 13:07 | alexyakushev_ | Yes, definitely looks excessive :) |
| 13:31 | AlwaysBCoding | Hey guys, I'm using datomic and getting an error message "Boot datoms cannot be altered" - I have absolutely no idea what this is supposed to mean and can't find a single resource on google. Anyone have any insight on what it means? |
| 13:32 | cbp | AlwaysBCoding: I don't know but you can also try asking in the #datomic channel |
| 13:32 | _Pate_ | how does the new cond-> macro work? https://github.com/clojure/clojure/blob/master/changes.md#24-new-threading-macros |
| 13:32 | _Pate_ | (cond-> 1, true inc, false (* 42), (= 2 2) (* 3)) => 6 |
| 13:33 | _Pate_ | why does that output 6? |
| 13:33 | cbp | _Pate_: because 1 is true |
| 13:33 | gtrak | it gets inc'd then multiplied by 3 |
| 13:34 | cbp | _Pate_: and also because 2 equals 2 |
| 13:34 | hyPiRion | cbp: What do you mean by 1 is true? |
| 13:34 | cbp | so it first goes through the true clause and the result of that goes through the 2 == 2 clause |
| 13:34 | _Pate_ | I see, so it threads 1 through all the expr where the clause evals to true? |
| 13:34 | hyPiRion | _Pate_: yes |
| 13:34 | cbp | er I mean because true is true.. |
| 13:34 | hyPiRion | ah |
| 13:35 | cbp | it's a pretty terrible example.. |
| 13:35 | _Pate_ | so in this case: -> 1 inc (* 3) => 6 |
| 13:35 | _Pate_ | coool |
| 13:36 | _Pate_ | I can't count the amount of verbose code I have written to conditionally execute stuff like that. |
| 13:36 | AlwaysBCoding | cbp: Is there a #datomic channel? |
| 13:36 | cbp | AlwaysBCoding: yes |
| 13:49 | sdegutis | Hi. You have (def m {"a" "y", "b" "z"}) and you want to use it to turn "bad" into "zyd". How would you do this? |
| 13:51 | cbp | sdegutis: replace? |
| 13:52 | sdegutis | Ahh yes, great! Thanks! |
| 13:52 | sdegutis | Hmm no wait, that seems wrong, completely wrong. |
| 13:53 | ToxicFrog | ,(def m {"a" "y" "b" "z"}) (->> "bad" (map str) (replace m) (apply str)) |
| 13:53 | clojurebot | #'sandbox/m |
| 13:53 | sdegutis | clojure.core/replace works on a collection, but I'm working with strings. |
| 13:53 | ToxicFrog | ,(->> "bad" (map str) (replace m) (apply str)) |
| 13:54 | clojurebot | "zyd" |
| 13:54 | ToxicFrog | sdegutis: strings are ordered collections of chars. |
| 13:54 | sdegutis | Ah yes, I see what you mean. |
| 13:54 | ToxicFrog | There's probably a better way to do it than what I just did |
| 13:54 | sdegutis | Surely there is a name for the error I made by now.. I used too specific a dataset and didn't convey how general I meant it to be. |
| 13:54 | ToxicFrog | There definitely is if you can fill your map with chars rather than single-char strings; that lets you drop the (map str) |
| 13:54 | sdegutis | I'm dealing with any-length strings anywhere a string is mentioned here. |
| 13:55 | ToxicFrog | Oh, so m might be { "foo" "FOO" "bar" " |
| 13:55 | ToxicFrog | Oh, so m might be { "foo" "FOO" "bar" "BAR" }\ |
| 13:55 | ToxicFrog | ? |
| 13:55 | sdegutis | Right. |
| 13:55 | sdegutis | Well, except that might imply that I only want capitalization ;) |
| 13:55 | TimMc | sdegutis: The question is still underspecified. What about conflicts? |
| 13:55 | sdegutis | Thus leading to another round of me clarifying :D |
| 13:56 | TimMc | (Overlaps.) |
| 13:56 | gtrak | now it's sounding like you want a lexer |
| 13:56 | sdegutis | TimMc: there won't be any |
| 13:56 | TimMc | sdegutis: Then use reduce and .replace |
| 13:56 | sdegutis | The pattern I've used before is to make a custom function for use with reduce, which takes [string [key val]] as its args, and does whatever work (this time being clojure.string/replace) to return a new [string] for use as the first argument in the next (reduce) call. |
| 13:57 | _Pate_ | I'm looking for a great image that depicts structural sharing in Clojure's memory model for an intro talk I'm doing, preferably vector-based image (like SVG). Any ideas? |
| 13:57 | sdegutis | I've just used that pattern enough times, and it's so strange looking, that I figure there surely must be a better way. |
| 13:57 | justin_smith | _eric: Frozenlock: regarding something you guys were taling about a while back |
| 13:57 | justin_smith | ,(apply + 1 '(2 3 4)) |
| 13:57 | clojurebot | 10 |
| 13:58 | justin_smith | you don't need cons to use apply on a single element and a collection at the same time |
| 13:58 | sdegutis | erc-hl-nicks is great btw |
| 13:58 | gtrak | _Pate_: people always use this one: http://www.cs.uiuc.edu/~jeffe/teaching/datastructures/Fig/clojure-trees.png |
| 13:59 | gtrak | at least it seems really familiar |
| 13:59 | _Pate_ | thank you! I just had a crummy version of that. This is a better resolution. |
| 13:59 | clgv | _Pate_: easily replicatable via LaTeX/TikZ ;) |
| 14:00 | Frozenlock | justin_smith: *mind blown* |
| 14:00 | cbp | sdegutis: I would probably just use a loop, a stringbuilder (or two) and a replacements map |
| 14:00 | arrdem | -! is for stm. so why the hell does 1.6 have assoc! and soforth as part of the transient system. |
| 14:01 | gtrak | ! is for dangerous! or mutable! |
| 14:01 | arrdem | if -! is suddenly for side-effect annotation I'm gonna be moderately annoyed |
| 14:01 | cbp | I just used ! for .. |
| 14:01 | cbp | yeah |
| 14:01 | gtrak | arrdem: see: reset! |
| 14:01 | sdegutis | Great, this works, albeit a little unreadable: (reduce (fn [s [k v]] (str/replace s (format "[%s]" k) v)) url config) |
| 14:01 | arrdem | gtrak: but that's an STM op |
| 14:01 | gtrak | reset! works on atoms |
| 14:01 | arrdem | gtrak: so far all the -!s are stm ops |
| 14:02 | gtrak | which aren't stm? |
| 14:02 | Bronsa | arrdem: isn't ! used for ops that are not safe to be used inside a dosync? |
| 14:02 | gtrak | also set! works on vars and java fields |
| 14:02 | iwilcox | I've wondered about using ! for "I generate random numbers", but I'm super-new here. |
| 14:02 | cbp | oh yeah I remember Bronsa's statement now |
| 14:02 | cbp | for non |
| 14:03 | gtrak | set-validator! 'Sets the validator-fn for a var/ref/agent/atom' |
| 14:03 | arrdem | Bronsa: maybe. that's a more sane definition if that's the case |
| 14:03 | clgv | arrdem: assoc! is as old as transients and nothing new in 1.6 ;) |
| 14:03 | arrdem | brb flipping my desk |
| 14:03 | clgv | ,(meta #'assoc) |
| 14:03 | Bronsa | given that side-effecting ops are implicitly not safe to be used within a transaction that would make sense |
| 14:03 | clojurebot | {:ns #<Namespace clojure.core>, :name assoc, :arglists ([map key val] [map key val & kvs]), :column 1, :added "1.0", ...} |
| 14:03 | clgv | ,(meta #'assoc!) |
| 14:03 | clojurebot | {:ns #<Namespace clojure.core>, :name assoc!, :arglists ([coll key val] [coll key val & kvs]), :column 1, :added "1.1", ...} |
| 14:04 | clgv | ah clojure 1.1^^ |
| 14:04 | cbp | I have a terrible memory.. |
| 14:04 | gtrak | ! means that, * means a more primitive version of the non-*, ' means I don't know what. |
| 14:05 | justin_smith | dsrx: regarding what you and scottj were talking about, there is string-edit-at-point which takes the current string the point is inside, and opens it in a secondary buffer for unescaped editing, and C-c C-c then insterts the edited version, escaped, back into the string |
| 14:05 | gtrak | if I'm doing math it would mean the next step, like x and x' |
| 14:05 | cbp | idempotent that's the word |
| 14:06 | cbp | thank you based google |
| 14:06 | gtrak | one time I used | in place of a / and my coworkers flipped out |
| 14:06 | arrdem | gtrak: in a symbol name? |
| 14:06 | gtrak | heh, yes |
| 14:07 | arrdem | haha |
| 14:07 | gtrak | (def some-domainmodel-ns|Constructor) |
| 14:07 | gtrak | or maybe it was even (def some-domainmodel-ns|->Constructor) |
| 14:07 | gtrak | to mirror the records stuff |
| 14:10 | TimMc | ☃ on the end of a symbol means congratulations, you are probably using the correct character set on your computer! |
| 14:12 | justin_smith | 🏂 <- slightly harder mode of the above |
| 14:12 | arrdem | TimMc: dat snowman... |
| 14:12 | arrdem | justin_smith: you broke emacs :c |
| 14:13 | justin_smith | snowboarder |
| 14:13 | arrdem | justin_smith: correctly identified as snowboarder, but no glyph |
| 14:13 | justin_smith | I was gonna say, M-x describe-char |
| 14:14 | justin_smith | 💩 at the end of a name means "this is terrible and should not exist" |
| 14:14 | arrdem | I'll use λ in my comments... but utf8 fn names just don't buy a lot IMO |
| 14:14 | arrdem | some days I just have to break out vim and edit from not a real editor :c |
| 14:17 | Bronsa | gtrak: at some point in a tools.analzyer pass I had pass, pass*, -pass and pass' |
| 14:17 | Bronsa | I just suck at naming |
| 14:17 | gtrak | nice |
| 14:18 | gtrak | arbitrary-construct1,2,3 |
| 14:18 | arrdem | Bronsa: so long as you don't have f, f', f'', f''' and soforth... |
| 14:18 | Bronsa | well now that you mention it.. https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj#L216-L221 |
| 14:19 | arrdem | I suppose to go along with my bro encoding I should build a tools.analyzer pass to rewrite all symbols into ([bB]ro)*... |
| 14:20 | arrdem | Bronsa: haha... I've definitely done (let [a .., a₀ ..., a₁ ...] ..) |
| 14:20 | arrdem | subscripts++ |
| 14:20 | justin_smith | ,(let [x¹ 4 x² 1 x³ 2] (* x³ (+ x² x¹))) |
| 14:20 | clojurebot | 10 |
| 14:20 | arrdem | (inc justin_smith) |
| 14:20 | lazybot | ⇒ 29 |
| 14:21 | arrdem | I need to build a latex frontend for expresso... |
| 14:22 | TimMc | justin_smith: Was that a non-BMP character? |
| 14:22 | justin_smith | ¹ <- "SUPERSCRIPT ONE" |
| 14:22 | justin_smith | works through "... NINE" |
| 14:22 | TimMc | No, 10 minutes ago. |
| 14:22 | justin_smith | ⁰works two |
| 14:23 | justin_smith | oh, the snowboarder? I dunno, depends on your font support I guess? |
| 14:24 | justin_smith | TimMc: wait, I misunderstood that question |
| 14:24 | justin_smith | yeah, I think that is definitely non-bmp |
| 14:26 | justin_smith | TimMc: it is in the block "miscellaneous symbols and pictographs" |
| 14:27 | justin_smith | inserted via M-x insert-char |
| 14:41 | mlb- | is there a well known way to shell out from Clojure, that work well on Windows? My google-fu has only revealed clojure.java.shell and clj-commons-exec |
| 14:42 | justin_smith | conch is decent |
| 14:42 | justin_smith | https://github.com/Raynes/conch |
| 14:42 | justin_smith | it has a nicer API than the other stuff, using process-builder which is nice and very powerful |
| 14:48 | mlb- | thanks, will check out =] |
| 14:50 | pyrtsa | Do people have experiences with the Quartzite library here? Any idea why it requires a specific type (created e.g. with the defjob macro) to define jobs? Why not just an IFn? |
| 14:52 | sdegutis | What's that site that lets you search for Clojure code snippets? I looked and looked and can't find it. |
| 14:53 | justin_smith | pyrtsa: I'd blame the underlying java lib http://quartz-scheduler.org/ |
| 14:54 | pyrtsa | justin_smith: I can believe that. But why wouldn't Quartzite just define a generic subtype of org.quartz.Job that helds a user-defined Clojure function? |
| 14:54 | pyrtsa | http://clojurequartz.info/articles/jobs.html |
| 14:55 | justin_smith | from that page "Unfortunately, due to certain Quartz implementation details and the way Clojure loads generated classes, many approaches to using functions do not work." |
| 14:56 | pyrtsa | Incredible. |
| 14:56 | pyrtsa | Okay, thanks. |
| 14:57 | sdegutis | Ah yes! It's http://getclojure.org/ |
| 14:59 | justin_smith | sdegutis: (fn [] (loop [i (int 0)] (recur nil))) -- what is this supposed to be exemplary of? cargo cult spin loop? |
| 15:02 | cbp | hahah (loop [] (let [recur 5] recur)) |
| 15:03 | justin_smith | at least that demonstrates something useful about clojure's binding rules |
| 15:21 | alew | pyrtsa: Immutant uses quartz underneath for scheduling and actually allows you to specify arbitrary functions |
| 15:21 | alew | pyrtsa: without doing that record stuff |
| 15:21 | alew | pyrtsa: http://immutant.org/tutorials/jobs/index.html |
| 15:23 | alew | pyrtsa: Not that you would want to pull all of immutant in for just scheduling, but it shows that it's possible |
| 16:04 | clojure-user | a |
| 16:05 | clojure-user | test |
| 16:05 | asd | Hi clojure user |
| 16:07 | clgv | what are the common pitfalls when you use a LinkedBlockingQueue in a multi producer single consumer scenario? |
| 16:07 | clgv | I seem to be loosing items in that queue |
| 16:08 | clgv | llasram: to what I said? |
| 16:08 | llasram | That you'd be losing items |
| 16:08 | llasram | Only pitfall I can think of is that it's unbounded unless you provide one |
| 16:11 | clgv | well running the whole thing in log level trace now |
| 16:11 | TimMc | I wonder what happens if you create 2 queues, fill one with stuff, and then try to drain each to the other. |
| 16:13 | Raynes | TimMc: http://i.imgur.com/5sQO8hJ.jpg |
| 16:13 | Raynes | WARNING: Snake ^ |
| 16:13 | tcrawley | pyrtsa: Immutant 2 will let you use quartz outside of the container, so you can just bring in that lib |
| 16:13 | TimMc | hee |
| 16:14 | tcrawley | and using functions with quartz means you can't use a JobStore |
| 16:15 | clojure-user | hello |
| 16:17 | clgv | llasram: I use a combination of "take" and "poll" to block until there are elements in the queue and then take as much as there are |
| 16:18 | clgv | and I do not think that I observed that problem in the past... |
| 16:23 | edw | Has anyone yet written an EDN parser in elisp? It's beginning to look like the world needs such a thing, and I may heed the call... |
| 16:24 | TimMc | Raynes: I think it's "smart" enough to only drain the number of elements that were in the queue when draining started. |
| 16:25 | TimMc | https://www.refheap.com/65637 |
| 17:02 | sdegutis | I just realized that you can't do further destructuring inside {:keys [...]} |
| 17:04 | sdegutis | I just kind of expected it allowed you to destructure infinitely deep. |
| 17:04 | brehaut | really? |
| 17:05 | justin_smith | sdegutis: but of course :keys is redundant, just more concise |
| 17:05 | brehaut | that would just make the keys, syms, strs shorthands a more complicated way of not usign those shorthands |
| 17:05 | justin_smith | regular destructuring goes very deep (arbitrarily deep?) |
| 17:05 | brehaut | yes |
| 17:06 | abp | sdegutis: how should that work? maps aren't positiional so you need some names to bind.. would basically be like what you can always do |
| 17:07 | TimMc | sdegutis: You don't have to list everything in :keys anyhow. |
| 17:11 | TimMc | &(let [{:keys [a b], [c] :c} {:a 1, :b 2, :c [3 4 5]}] [a b c]) |
| 17:11 | lazybot | ⇒ [1 2 3] |
| 17:12 | trap_exit | is (into {} (map side-effect lst)) lazy or not lazy ? |
| 17:13 | Bronsa | not lazy |
| 17:13 | brehaut | easy way to check ;) |
| 17:13 | brehaut | ,(into {} (range)) |
| 17:13 | trap_exit | how do I test? |
| 17:13 | clojurebot | #<ExceptionInfo clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Long {:instance 0}> |
| 17:13 | brehaut | ,(into {} (map + (range))) |
| 17:13 | trap_exit | ,(into {} (map (fn [x] x) (range))) |
| 17:13 | clojurebot | #<ExceptionInfo clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Long {:instance 0}> |
| 17:13 | clojurebot | #<ExceptionInfo clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Long {:instance 0}> |
| 17:13 | brehaut | oh duh |
| 17:13 | brehaut | ,(into [] (range)) |
| 17:13 | clojurebot | #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space> |
| 17:13 | trap_exit | well wait |
| 17:14 | trap_exit | ,( ... ) forces it to be printed, which is what causes it to be not lazy |
| 17:14 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Malformed member expression, expecting (.member target ...)> |
| 17:14 | trap_exit | ,(range) |
| 17:14 | clojurebot | (0 1 2 3 4 ...) |
| 17:14 | Bronsa | trap_exit: no, into is not lazy |
| 17:14 | trap_exit | ,(let [a (into {} (map vector (range) (range)))] 23) |
| 17:14 | brehaut | trap_exit: as you can see above, clojurebot has its print vars set so that it wont print an infinite sequence so no, it wont realize it all |
| 17:15 | TimMc | trap_exit: into walks the entire collection eagerly |
| 17:15 | clojurebot | Execution Timed Out |
| 17:15 | sdegutis | TimMc: fantabulous |
| 17:16 | trap_exit | Bronsa, brehaut, TimMc: I believe you now |
| 17:17 | trap_exit | thanks! |
| 17:17 | trap_exit | if we were in dogecoin, I'd tip you 10 dogecoins |
| 17:18 | brehaut | trap_exit: the other thing to think about is that into is filling a strict datastructure; those structures have no way of representing laziness so its intrinsicly going to be a strict operation |
| 17:18 | Bronsa | trap_exit: another way to notice that that was eager: the only sequences that preserve lazyness are lazyseqs and cons, there's no lazy map/vector/set in clojure |
| 17:18 | TimMc | trap_exit: One of the bots has a karma module. :-P |
| 17:18 | Bronsa | trap_exit: also, if the docstring doesn't say "returns a lazy sequence" then the operation is not lazy :) |
| 17:19 | trap_exit | hmm, wait, so are assoc/dissoc both eager ? |
| 17:19 | Bronsa | yes |
| 17:19 | trap_exit | hmm, for some dumbass reason, all these years I thought maps were lazy as were assoc/dissoc |
| 17:19 | trap_exit | I'm glad we clarified this up |
| 17:29 | arrdem | Bronsa: hum... how is infinite determined then... |
| 17:30 | arrdem | Bronsa: I know there are techniques for doing print bounding, but it seems like proving the infinite property of a lazy sequence is hard |
| 17:31 | Bronsa | arrdem: what do you mean? there's no way in clojure to determine if a non-realized lazy-seq is infinite |
| 17:31 | arrdem | oh. sorry. that was brehaut not you. |
| 17:31 | Bronsa | np |
| 17:31 | arrdem | "clojurebot has its print vars set so that it wont print an infinite sequence ..." |
| 17:32 | justin_smith | arrdem: all that means is that he only prints the first N elements |
| 17:32 | justin_smith | thus never attempting to realize an infinite sequence |
| 17:33 | justin_smith | ,(clojure.repl/doc *print-length*) |
| 17:33 | Bronsa | he was talking about *print-lenght*/*print-level* |
| 17:33 | arrdem | justin_smith: yeah I knew about that |
| 17:33 | Bronsa | print-lenght alone shouldn't suffice. suppose you have a vector with one element of infinitely nested vectors |
| 17:35 | clojurebot | "; *print-length* controls how many items of each collection the printer will print. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum number of items of each collection to print. If a collection contains more items, the printer will print items up to the limit followed by '...' to represent the remaining items. The root binding is... |
| 17:35 | justin_smith | ,(clojure.repl/doc *print-level*) |
| 17:35 | clojurebot | "; *print-level* controls how many levels deep the printer will print nested objects. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum level to print. Each argument to print is at level 0; if an argument is a collection, its items are at level 1; and so on. If an object is a collection and is at a level greater than or equal to th... |
| 17:35 | Bronsa | that was about time clojurebot |
| 17:36 | cbp | you can just (doc ..) :P |
| 17:36 | cbp | (doc inc) |
| 17:36 | clojurebot | "([x]); Returns a number one greater than num. Does not auto-promote longs, will throw on overflow. See also: inc'" |
| 17:37 | TimMc | ,(let [v [1 2 3 4 5 6 7 8]] (aset (.tail v) 0 v) v) |
| 17:37 | clojurebot | [[[[[[[[[[# 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] 2 3 4 5 ...] |
| 17:37 | arrdem | lolz |
| 17:37 | TimMc | ^ That demonstrates both print-length and print-level. |
| 17:37 | Bronsa | TimMc: don't do that ever again plz |
| 17:37 | TimMc | haha |
| 17:38 | arrdem | (inc TimMc) |
| 17:38 | lazybot | ⇒ 56 |
| 17:38 | trap_exit | (inc TimMc) |
| 17:38 | lazybot | ⇒ 57 |
| 17:38 | trap_exit | (int ardem) |
| 17:38 | TimMc | I can't believe .tail got exposed in 1.6. Just awful. |
| 17:39 | arrdem | TimMc: why? |
| 17:39 | TimMc | Shenanigans. |
| 17:39 | arrdem | clearly demonstrated above, got it... |
| 17:40 | arrdem | that you can do silly things with it I don't consider much of a STL bug tho. |
| 17:40 | TimMc | Although... I guess it's not like you could trust PV before. |
| 17:41 | TimMc | &(let [a (object-array 1) v (vec a)] (aset a 0 v) v) |
| 17:41 | lazybot | java.lang.StackOverflowError |
| 17:41 | TimMc | hum |
| 17:41 | arrdem | you've also got the self-referential promise... |
| 17:42 | TimMc | I don't have a problem with that, actually. |
| 17:42 | Bronsa | ,(let [a (object-array 1) v (vec a)] (aset a 0 v) v) |
| 17:42 | clojurebot | [[[[[[[[[[#]]]]]]]]]] |
| 17:42 | Bronsa | looks like lazybot forgot about *print-level* |
| 17:43 | rasmusto | ,[[[[[#]]]]] |
| 17:43 | Bronsa | TimMc: there's to be said that the doc for `vec` explicitely states that the array should not be modified |
| 17:47 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]> |
| 17:47 | rasmusto | (inc clojurebot) |
| 17:47 | lazybot | ⇒ 36 |
| 17:54 | TimMc | Bronsa: Huh! Looks like that warning came in on 1.5.0. |
| 17:58 | hyPiRion | TimMc: I love it, that feature is the best thing ever |
| 17:59 | hyPiRion | I don't know if I can use it in Swearjure though |
| 18:04 | TimMc | ,(let [v [0 0]] (aset (.tail v) 0 v) (aset (.tail v) 1 v) v) ;; sorry Bronsa |
| 18:04 | clojurebot | [[[[[[[[[[# #] [# #]] [[# #] [# #]]] [[[# #] [# #]] [[# #] [# #]]]] [[[[# #] [# #]] [[# #] [# #]]] [[[# #] [# #]] [[# #] [# #]]]]] [[[[[# #] [# #]] [[# #] [# #]]] [[[# #] [# #]] [[# #] [# #]]]] [[[[# #] [# #]] [[# #] [# #]]] [[[# #] [# #]] [[# #] [# #]]]]]] [[[[[[# #] [# #]] [[# #] [# #]]] [[[# #] [# #]] [[# #] [# #]]]] [[[[# #] [# #]] [[# #] [# #]]] [[[# #] [# #]] [[# #] [# #]]]]] [[[[[# #] [# #]... |
| 18:05 | Bronsa | :( |
| 18:10 | TimMc | Bronsa: I couldn't take you seriously after you used aset up there as well. :-P |
| 18:10 | TimMc | and isn't it a thing of beauty? |
| 18:11 | Anderkent | Bronsa: missed an opportunity to use [# #] as the emote there |
| 18:12 | rasmusto | ''[# #] |
| 18:12 | Bronsa | I was just thinkint that there must be a way to use this to make some cool ascii art |
| 18:24 | TEttinger | Bronsa: heh. just / and \, screenshotted and areas filled: https://dl.dropboxusercontent.com/u/11914692/AngleMazeColorful.png |
| 18:28 | dsrx | oh whoa, 1.6.0 was released? |
| 18:28 | justin_smith | is it stable? if so time to update the room topic |
| 18:29 | Averell | there needs to be consensus by top analysts |
| 18:29 | brehaut | justin_smith: it is stable, but uh, probably all the ops are at clojure/west :P |
| 18:33 | rlb | assume I'm missing something obvious -- "lein new app foo; cd foo; lein uberjar; java -jar target/uberjar/foo-0.1.0-SNAPSHOT.jar" fails with NoClassDefFoundError, but the project.clj has a :main, and core.clj has a gen-class. |
| 18:47 | mikerod | Can a Symbol only `resolve` to nil, a Var, or a Class? |
| 18:47 | Pupeno | I seem to able to run lein new luminus myapp and it works... how do I make sure I have the latest version of that luminus plug in or whatever it is that makes that possible? |
| 18:48 | justin_smith | lein new should find the latest |
| 18:50 | Pupeno | justin_smith: so, everytime I run lein new it checks for updates? |
| 18:51 | technomancy | Pupeno: it checks once every 24h |
| 18:51 | Pupeno | Cool. |
| 18:58 | storme | hi #clojure, I'm new an learning... what's the best way to iterate over a vector, pull out data from it, and add each iteration of data to a new vector? |
| 18:58 | storme | would a recursive loop work? |
| 18:59 | justin_smith | mapv? |
| 18:59 | justin_smith | ,(mapv + [0 1 2 44]) |
| 18:59 | clojurebot | [0 1 2 44] |
| 18:59 | justin_smith | ,(mapv inc [0 1 2 44]) ; better example |
| 18:59 | clojurebot | [1 2 3 45] |
| 19:00 | storme | justin_smith: that just might work |
| 19:00 | storme | thanks! |
| 19:01 | justin_smith | mind you if the output doesn't need to be a vector, and may benefit from laziness, then map is better than mapv |
| 19:01 | Pupeno | (map inc [1 2 3]) |
| 19:01 | Pupeno | ,(map inc [1 2 3]) |
| 19:01 | clojurebot | (2 3 4) |
| 19:01 | Pupeno | Ah. |
| 19:01 | Pupeno | Of course. |
| 19:02 | storme | nice |
| 19:02 | justin_smith | mapv is not lazy, it really depends on which data structure is better |
| 19:02 | storme | but I plan on iterating over the new vector for something else |
| 19:02 | justin_smith | well, that's neither here nor there as far as laziness is concerned |
| 19:02 | justin_smith | in fact laziness can speed that up by doing both maps in one go |
| 19:03 | storme | sorry still new to clojure coming from ruby, could you eli5 laziness? |
| 19:03 | justin_smith | ,(do (mapv print (range 5))) |
| 19:03 | clojurebot | 01234[nil nil nil nil nil] |
| 19:03 | rasmusto | ,(take 10 (range)) |
| 19:03 | clojurebot | (0 1 2 3 4 ...) |
| 19:03 | justin_smith | ,(do (map print (range 5))) |
| 19:03 | clojurebot | (01234nil nil nil nil nil) |
| 19:04 | justin_smith | hmm, that will show a difference with a larger range argument in your repl |
| 19:04 | justin_smith | oh wait |
| 19:04 | justin_smith | ,(do (map print (range 5)) nil) |
| 19:04 | clojurebot | nil |
| 19:04 | justin_smith | ,(do (mapv print (range 5)) nil) |
| 19:04 | clojurebot | 01234 |
| 19:04 | justin_smith | that's the difference |
| 19:04 | justin_smith | the printing of the result of print was forcing it :) |
| 19:05 | justin_smith | with laziness, if you don't use the result, no calculations are made |
| 19:05 | storme | ah |
| 19:05 | storme | id like to return the result |
| 19:05 | gfredericks | Bronsa: ping |
| 19:05 | justin_smith | and once you use it, it is calculated (it is slightly more complex than this given chunking for example, but that's the basic) |
| 19:05 | storme | so another function can evaluate over it |
| 19:05 | justin_smith | right, but that can be lazy or non lazy |
| 19:05 | Bronsa | mikerod: I can't think of anything else |
| 19:05 | Bronsa | gfredericks: pong |
| 19:06 | justin_smith | the question is does it need to be evaluated immediately, or can you wait until the value is used |
| 19:06 | Bronsa | technomancy: time to update the topic :) |
| 19:06 | justin_smith | if you can wait, laziness means the map need only walk the input once, applying both functions |
| 19:06 | mikerod | Bronsa: me neither |
| 19:07 | gfredericks | Bronsa: I'm sitting here w/ tbaldridge trying to debug an NPE thrown by tools.analyzer.jvm when using my lib on a codebase with a deftype |
| 19:07 | gfredericks | github.com/fredericksgary/clj-usage-graph |
| 19:07 | justin_smith | storme: also, it allows a style of programming where you describe how a long (or even infinite) lazy sequence is constructed, and use as much of it as you need at runtime |
| 19:07 | justin_smith | this can often replace a mutable state with walking over a lazy structure |
| 19:08 | Bronsa | gfredericks: one sec |
| 19:10 | Bronsa | gfredericks: I see one obvious problem with that code but I don't know if that's the culprit for this bug |
| 19:10 | storme | justin_smith: okay I think I understand |
| 19:10 | storme | thanks :) |
| 19:10 | justin_smith | np |
| 19:10 | Bronsa | gfredericks: actually two problems |
| 19:11 | Bronsa | gfredericks: 1- you're using the same env for every analyze |
| 19:11 | justin_smith | storme: example of state / lazy seq: a lazy seq of the lines in a file, you get the "next line" as the next element in the lazy seq, and you simple stop taking new items in order to stop reading (instead of putting *current-line* in some stateful container that mutates) |
| 19:11 | Bronsa | gfredericks: unfortunately that won't do it, you need to use a new empty-env for every top-level form since namespaces might mutate at runtime |
| 19:12 | gfredericks | Bronsa: oh interesting |
| 19:12 | gfredericks | I assumed since it was a PHM it was a value |
| 19:12 | Bronsa | gfredericks: the other problem is that you're analyzing the whole file but not evaluating the form you're evaluating as you go |
| 19:12 | Bronsa | you're analyzing* |
| 19:12 | Bronsa | jvm.tools.analyzer did that implicitely I believe |
| 19:12 | gfredericks | so I should evaluate each form before or after analying? |
| 19:13 | Bronsa | gfredericks: I helped ambrosebs writing an analyze-ns function, one sec |
| 19:14 | Bronsa | gfredericks: https://github.com/clojure/core.typed/blob/tools-analyzer/src/main/clojure/clojure/core/typed/analyze_clj.clj |
| 19:14 | Bronsa | gfredericks: the env *is* a value, but empty-env recreates it every time you invoke it |
| 19:15 | gfredericks | Bronsa: why would a value need to be recreated? |
| 19:16 | Bronsa | gfredericks: suppose you are analyzing (do (intern 'foo) foo) |
| 19:17 | Bronsa | if you 1- don't eval the first form after analysis |
| 19:17 | Bronsa | 2- don't refresh the environment to include the newly created var in the :namespaces atom |
| 19:18 | Bronsa | analyzing the second form will fail |
| 19:21 | Bronsa | gfredericks: this is a limitation inherent of how clojure works, cljs doesn't have this problems since it lacks runtime reified namespaces & "proper" macros |
| 19:21 | gfredericks | Bronsa: okay, thanks; my battery's dying so I have to go, but I'll come back to this |
| 19:21 | Bronsa | gfredericks: I will put an analyze-ns function in t.a.j in the next days btw |
| 19:25 | Bronsa | gfredericks: also c.t.a.ast already has a lazy `nodes` |
| 19:42 | Pupeno | Is there a way for lein to show which jars can be upgraded to a new version? |
| 19:43 | bob2_ | Pupeno, lein ancient? |
| 19:44 | Pupeno | bob2_: I got "'ancient' is not a task. See 'lein help'." |
| 19:46 | bob2_ | Pupeno, you'd need to install the lein ancient plugin, I mean |
| 20:04 | Bronsa | gfredericks: I just added analyze+eval that does the right thing for you, no need to rebuild the env https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L462-L485 |
| 20:34 | ivan | very pleasantly surprised to see all the talks up this early https://www.youtube.com/playlist?list=PLZdCLR02grLp__wRg5OTavVj4wefg69hM&feature=c4-feed-u |
| 20:34 | cbp | ^ |
| 20:37 | Frozenlock | There goes my productivity. Thanks ivan :p |
| 20:38 | hfaafb | best clojure web app cloud hosting go |
| 20:39 | ivan | any linux server? |
| 20:40 | ivan | at which point you're trading off normal bandwidth/cpu/memory/disk requirements |
| 20:40 | ivan | and network reliability and price |
| 20:42 | bob2 | heroku is pretty convenient |
| 20:47 | kras | ivan: glad to see instaparse video in the list |
| 21:05 | kras | Any traditional Lex/Yacc implementation in clojure? like PLY in python? |
| 21:07 | brehaut | i dont think anyone has been particularly keen; things like instaparse or perhaps the antlr bindings are more popular |
| 21:07 | brehaut | you can of course just use the java lex and yacc |
| 21:09 | kras | I have been using antlr but found it difficult since I don't completely understand Java |
| 21:09 | kras | probably I am the only one using clojure without a background in Java :-) |
| 21:09 | brehaut | unlikely |
| 21:10 | brehaut | a lot of people have come to clojure from python and ruby |
| 21:10 | brehaut | but it is worth learning at least the basics of java |
| 21:10 | kras | Thats good to know |
| 21:10 | brehaut | as interop is idiomatic |
| 21:10 | Frozenlock | kras: My only background before clojure was emacs lisp :-p |
| 21:16 | kras | Java seems to be very verbose unfortunately :-( |
| 21:17 | kras | Found a clojure wrapper for antlr called clj-antlr but again its a work in progress |
| 21:17 | hons | kras: if you already know a language wich C-ish syntax and some OOP language then Java is very easy to pick up |
| 21:17 | brehaut | looking at clj-antlr it doesnt seem like you need much java knowledge at all |
| 21:18 | arrdem | Why use clj-antlr.. we have instaparse... |
| 21:18 | brehaut | arrdem: speeeeed |
| 21:18 | brehaut | arrdem: and existing grammers |
| 21:18 | kras | yes speed |
| 21:19 | kras | antlr from my initial experiments seems to be atleast 10 times faster |
| 21:19 | arrdem | not totally shocking... but are your inputs large enough that parse time is significant? |
| 21:19 | brehaut | personally i would reach for instaparse for most small parsing tasks, and antlr for the bigger ones (larger files, or hot paths) |
| 21:20 | arrdem | brehaut: Agreed. Hence why I'm not using instaparse for my modular tools.reader rework. |
| 21:20 | kras | Yeah I have some very big files to parse and the grammar I have has several rules |
| 21:20 | brehaut | oh yeah arrdem re yesterdays discussion: seniority can shove it; interesting ideas and engaging your brain are what is important |
| 21:20 | arrdem | kras: define several.... |
| 21:21 | kras | The only issue I have with clj-antlr is I do not know how to take some actions if a rule is triggered |
| 21:22 | kras | and there is not documentation yet which explains this |
| 21:22 | arrdem | brehaut: lolz. I think `Bronsa and `Raynes are the only people younger than me in here.. and both of them out experience me. I'm over it. |
| 21:24 | brehaut | arrdem: i still dont think its important |
| 21:25 | brehaut | you can be old as the hills and worked in software all your life and still be as ignorant as someone who has never seen a line of code before |
| 21:26 | patchwork | Hmm… how do I use js `===` from cljs? |
| 21:26 | brehaut | patchwork: = i think? |
| 21:26 | patchwork | Or rather, how do I test js object equality from cljs? |
| 21:27 | patchwork | I don't want to test value equality, I want reference equality |
| 21:27 | patchwork | the dirty js kind of equality |
| 21:27 | technomancy | arrdem: did you just backquote their nicks in order to fully qualify them? |
| 21:28 | patchwork | I have two references to potentially the same js object, does regular (= obj1 obj2) work for that? |
| 21:28 | kras | request to clj-antlr developers, please put some documentation in place. Its a great project and I am guessing there are lot of people like me without java background who wnat to use this |
| 21:28 | arrdem | technomancy: I backquoted in the hope of not notifying them :P |
| 21:28 | brehaut | patchwork: do you know about https://himera.herokuapp.com/synonym.html ? |
| 21:28 | technomancy | arrdem: oh, I thought maybe you intended to resolve to bronsa.it and raynes.me or something |
| 21:28 | brehaut | (not that i know if its there or note but handy) |
| 21:29 | patchwork | brehaut: Yeah that has a lot of good comparisons |
| 21:29 | patchwork | In there equality is not the same between cljs and js |
| 21:29 | brehaut | patchwork: maybe it doesnt want you to ;) |
| 21:30 | technomancy | .us is overrated |
| 21:30 | brehaut | not as overated as .shirts |
| 21:30 | brehaut | or .drycleaning |
| 21:33 | patchwork | brehaut: That is probably true, though annoying in this case |
| 21:33 | arrdem | technomancy: says the only person I know with a .us domain :P |
| 21:36 | brehaut | that sounds like a qualification to me |
| 21:38 | ddellacosta | .to is cool |
| 21:42 | Raynes | I own raynes.sexy. |
| 21:43 | Raynes | I'm working on setting up a new blog, wanted to point that at it, but it'll inevitably be deemed inappropriate. |
| 21:43 | Raynes | Need to find some use for it that can't be turned into a Thing™. |
| 22:19 | dissipate | i figured it out |
| 22:20 | dissipate | ,(and) |
| 22:20 | clojurebot | true |
| 22:20 | dissipate | ,(or) |
| 22:20 | clojurebot | nil |
| 22:20 | dissipate | i figured out why (and) is true, but i still don't get why (or) is nil. i think it should be false. |
| 22:22 | dissipate | does anyone here know why (and) evals to 'true'? :D |
| 22:24 | brehaut | presumably the same reason (*) evaluates to 1; its the identity of true |
| 22:24 | brehaut | err, of and |
| 22:24 | brehaut | variadic and ~= (reduce binary-and identity-value args) |
| 22:24 | dissipate | brehaut, right. but why does (or) evaluate to 'nil'? |
| 22:25 | brehaut | for the same reason |
| 22:25 | dissipate | brehaut, right, but why is it 'nil' and not 'false'? |
| 22:25 | brehaut | nil and false are both falsey |
| 22:25 | brehaut | and nil punning with or is an idiomatic language thing |
| 22:26 | brehaut | or is a true and falsy operation, not a true and false op. |
| 22:26 | brehaut | it would lose its defaulting behaviour otherwise |
| 22:27 | dissipate | brehaut, i see. well, mystery solved then |
| 22:29 | brehaut | the real question is why |
| 22:29 | brehaut | ,(and 1 2) |
| 22:29 | clojurebot | 2 |
| 22:29 | brehaut | ,(and 1) |
| 22:29 | clojurebot | 1 |
| 22:29 | brehaut | ,(and) |
| 22:29 | clojurebot | true |
| 22:29 | brehaut | or is actually the more consistent version |
| 22:30 | dissipate | ,(or 1 2 |
| 22:30 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 22:30 | dissipate | ,(or 1 2) |
| 22:30 | clojurebot | 1 |
| 22:31 | brehaut | or returns the first truthy thing, or nil (nothing) |
| 22:31 | brehaut | except in the circumstance where a false is present and no truthy thing is present |
| 22:31 | dissipate | brehaut, where is the inconsistency? |
| 22:32 | brehaut | or will return nil if all its expressions evaluate to nil |
| 22:32 | brehaut | and returns the last expression if they are all truthy |
| 22:33 | dissipate | brehaut, you mean if all the expressions evaluate to nill or false? |
| 22:33 | brehaut | correct |
| 22:33 | dissipate | ,(or false false true) |
| 22:33 | clojurebot | true |
| 22:33 | dissipate | ,(or false false) |
| 22:33 | clojurebot | false |
| 22:33 | dissipate | hmm, that's somewhat inconsistent |
| 22:33 | dissipate | why not nil? |
| 22:34 | brehaut | sort of |
| 22:34 | brehaut | because and and or are both weird in the presence of actual true and false |
| 22:34 | brehaut | ,(and 1 2 false) |
| 22:34 | clojurebot | false |
| 22:34 | brehaut | ,(and 1 2 3) |
| 22:34 | clojurebot | 3 |
| 22:34 | brehaut | ,(and 1 2 nil) |
| 22:34 | dissipate | brehaut, why? |
| 22:34 | clojurebot | nil |
| 22:34 | brehaut | i presume its some kind of weird polymorphism |
| 22:35 | brehaut | if you are dealing with truth values you probably want truth values back |
| 22:35 | brehaut | otherwise you are dealing with objects and want objects back |
| 22:35 | brehaut | (and nil is the absense of an object) |
| 22:35 | dissipate | brehaut, is it the case that only predicate functions should return 'true' or 'false'? |
| 22:35 | dissipate | oh heck no. i don't want objects. maybe data structures, not objects |
| 22:36 | brehaut | its the case that predicates should return only true or false, but other functions that are not predicates may reasonably return them too |
| 22:36 | brehaut | what do you think a datastructure is? |
| 22:36 | dissipate | brehaut, are you referring to what it is in Java or in the theoretical sense? |
| 22:36 | brehaut | both |
| 22:36 | dissipate | brehaut, what non-predicate function should return true or false? |
| 22:37 | brehaut | how about get |
| 22:37 | brehaut | or first |
| 22:37 | brehaut | ,(first (repeat true)) |
| 22:37 | clojurebot | true |
| 22:37 | dissipate | brehaut, yeah, i see your point there. if you are iterating over true or false themselves |
| 22:37 | technomancy | https://lein-survey-2014.herokuapp.com <- this year's edition of the lein survey is out |
| 22:38 | technomancy | please fill it in if you use leiningen |
| 22:38 | brehaut | technomancy: are you not westing this year? |
| 22:38 | dissipate | brehaut, a data structure is definitely not an object though. an object bundles functions with data. a data structure is just data. |
| 22:38 | technomancy | brehaut: sadly not |
| 22:38 | brehaut | technomancy: sorry to hear |
| 22:39 | brehaut | dissipate: a closure bundles function and data |
| 22:39 | brehaut | is that an object? |
| 22:40 | hfaafb | a map can have keys that point to both data and functions |
| 22:41 | dissipate | brehaut, no, a closure is a function that has access to data |
| 22:41 | brehaut | dissipate: you need to get your zen on then |
| 22:41 | brehaut | closures and objects are isomorphic to each other |
| 22:41 | brehaut | there is nothing inherently evil about objects |
| 22:42 | brehaut | merely the default statefulness people use in objects |
| 22:42 | brehaut | (let [a (atom 1)] (fn [] (swap! a inc))) |
| 22:43 | dissipate | brehaut, you do have a point. in Python, an object is just a dictionary with special stuff in it. |
| 22:43 | brehaut | is exactly as dangerous and problematic as any other object with statefulness |
| 22:44 | dissipate | brehaut, i'm thinking more along the lines of classes with inheritance, polymorphism and encapsulation. the biggest fail in software ever. |
| 22:44 | brehaut | inheritance sure, encapsulation reasonable case. polymorphism definately not a fail |
| 22:45 | brehaut | in spite of technomancy’s best efforts polymorphism is a fundamental part of clojure |
| 22:45 | technomancy | I don't mind a good polymorphic function |
| 22:46 | technomancy | (as long as it's part of clojure.core) |
| 22:46 | brehaut | :) |
| 22:46 | brehaut | a little, well considered, polymorphism goes a very long way |
| 22:46 | brehaut | not to mention higher order functions are polymorphic |
| 22:47 | talios | brehaut++ |
| 22:47 | technomancy | transitive polymorphism?? |
| 22:47 | lazybot | technomancy: Uh, no. Why would you even ask? |
| 22:47 | brehaut | hi |
| 22:47 | brehaut | haha |
| 22:47 | talios | brehaut - if you don't use lein, what are you using? |
| 22:48 | brehaut | /ˈbriːəʊ/ |
| 22:48 | brehaut | haha were did you get the idea i wasnt using lein? |
| 22:48 | talios | please not be saying Make :) |
| 22:48 | brehaut | Make‽ Make!! |
| 22:48 | brehaut | make is for kids |
| 22:48 | technomancy | I wrote a makefile the other day |
| 22:48 | brehaut | real developers use batch |
| 22:48 | talios | ewps - misread the scrollbuffer :) |
| 22:48 | brehaut | are you going to recinde my ++ now? |
| 22:48 | talios | technomancy - did it just call lein? :) |
| 22:49 | technomancy | talios: nah, it was for forth |
| 22:49 | technomancy | |
| 22:49 | talios | good lord :) |
| 22:49 | technomancy | well, for a program that implements forth |
| 22:49 | talios | I'm not sure thats much better :) hah |
| 22:49 | brehaut | technomancy: apparently i have been using lein for too long “What annoys you about Leiningen?” nothing to check; have i become innerred to the problems? |
| 22:49 | talios | more hardcore for sure |
| 22:50 | dissipate | brehaut, well then clojure is doomed. might as well join the Haskellers pursuing purity at all cost. |
| 22:50 | technomancy | brehaut: I left out the "spoils me for other stuff" check, sorry |
| 22:50 | talios | dissipate: idris!! |
| 22:50 | brehaut | technomancy: lol indeed :) |
| 22:50 | brehaut | technomancy: seriously though, its been in public since 2009? |
| 22:51 | technomancy | brehaut: 1.0.0 was that december |
| 22:51 | technomancy | I think the `git init` happened on halloween |
| 22:51 | brehaut | it seems like it shouldnt be that long ago |
| 22:51 | talios | <oldname> i remember a time before leiningen - and that time was clojure-maven-plugin :) oh wait, still is. |
| 22:52 | talios | s/name/man/ |
| 22:52 | brehaut | i scrabbled stuff together with bash scripts :P |
| 22:52 | arrdem | talios: typically kicking your hands doesn't improve your touch typing |
| 22:52 | brehaut | none of this maven nonsense |
| 22:53 | talios | arrdem - true true. maybe that's the problem. |
| 22:54 | dissipate | brehaut, i want none of this Java nonsense. i'm switching to Arc |
| 22:55 | brehaut | if you wanted non of java, clojure was the wrong choice |
| 22:59 | dissipate | brehaut, how about clojure on the GHC? |
| 22:59 | brehaut | technomancy: this forth, did you day its running _on_ your keyboard? |
| 23:00 | brehaut | s/day/say/ |
| 23:00 | brehaut | apparently talios isnt the only one who cant type today. i blame the late hour |
| 23:00 | technomancy | brehaut: not yet |
| 23:00 | technomancy | brehaut: I don't have conditionals implemented yet |
| 23:00 | brehaut | yet |
| 23:00 | technomancy | well |
| 23:00 | brehaut | hah |
| 23:00 | technomancy | I have if, but not endif |
| 23:01 | talios | dissipate - how about newlisp? |
| 23:01 | technomancy | which makes things awkward |
| 23:01 | dissipate | technomancy, why are you implementing Forth? |
| 23:01 | technomancy | dissipate: because my keyboard firmware is currently written in C |
| 23:02 | technomancy | I want to hack it, but I don't like programming in languages that aren't interactive |
| 23:02 | dissipate | technomancy, interesting |
| 23:02 | technomancy | https://github.com/technomancy/orestes https://github.com/technomancy/atreus |
| 23:03 | dissipate | talios, how big is the library for newlisp? i'm guessing it is pretty small. |
| 23:03 | brehaut | technomancy: every time you name a project i feel like i am underread |
| 23:03 | technomancy | brehaut: you're in luck; these are both named from the same book |
| 23:04 | brehaut | i feel like i should recognise this; the former is some relation to agamemmnon right? |
| 23:04 | talios | dissipate - no idea, small I think. I only came across it a few months back and only briefly looked at it. |
| 23:04 | technomancy | brehaut: yeah |
| 23:04 | technomancy | both are, actually |
| 23:04 | brehaut | both parents? |
| 23:04 | technomancy | no, son and grandfather |
| 23:04 | brehaut | ah |
| 23:04 | technomancy | atreus is where we get atriedes from Dune |
| 23:05 | brehaut | oh true |
| 23:05 | brehaut | presumably also atreus from myst |
| 23:05 | technomancy | oh yeah |
| 23:05 | technomancy | the father? |
| 23:05 | brehaut | i think so yeah |
| 23:06 | technomancy | cool; I had forgotten that |
| 23:06 | brehaut | acenar and something are the sons? |
| 23:06 | technomancy | sirrius |
| 23:06 | brehaut | thats right |
| 23:06 | brehaut | i need to play riven |
| 23:06 | technomancy | it's pretty good |
| 23:06 | technomancy | I didn't get into the third one, but I didn't give it much of a chance |
| 23:07 | arrdem | technomancy: so what you're telling me is that when I try and do an embedded Clojure compiler, it's gonna be codenamed Corrino.... |
| 23:07 | tmciver | I just finisehd playing realMyst. Not bad but the 3D graphics look like they're from 10 years ago. |
| 23:07 | dissipate | talios, same problem that Graham has with his Arc language: not enough libs |
| 23:07 | brehaut | tmciver: yeah i only played realMyst a couple of years ago and frankly only look 10 years old is an improvement ;) |
| 23:07 | tmciver | I think the names were Atrus, Sirrus and Achenar. |
| 23:07 | technomancy | arrdem: you could do Ordos |
| 23:08 | technomancy | tmciver: oh, right. close enough. |
| 23:08 | brehaut | dissipate: i wonder how clojure got all libs so quickly? surely its not all this java stuff we can leverage for free… |
| 23:09 | tmciver | I was dissappointed by the 'new' Rime age. |
| 23:09 | brehaut | tmciver: the little snow place ? |
| 23:09 | tmciver | brehaut: yup |
| 23:09 | brehaut | i wasnt expecting a real age so i wasnt too disappointed |
| 23:09 | brehaut | but i had hoped it would have a bit more story in it |
| 23:10 | dissipate | brehaut, but there is actually a big cost there. there is little incentive to write enough native libs to ever escape the JVM. |
| 23:10 | tmciver | Now I'm going to have to play Riven . . . again . . . for like the fourth time. |
| 23:10 | brehaut | tmciver: sorry man |
| 23:11 | brehaut | dissipate: every tradeoff comes with costs and benefits. news at 11? |
| 23:11 | dissipate | brehaut, the goal is to eventually ditch the JVM, right? |
| 23:11 | brehaut | no |
| 23:12 | brehaut | the jvm is a serious advantage |
| 23:12 | brehaut | its not suitedto every task but when it is it kicks a lot of arse |
| 23:13 | dissipate | brehaut, we need a lighter weight VM written in clojure itself |
| 23:13 | brehaut | dissipate: perhaps you need to go aquaint yourself with the strengths of the JVM before you make such comments |
| 23:14 | dissipate | brehaut, the startup time is horrendous. that's problem enough. |
| 23:14 | technomancy | dissipate: so target racket or something |
| 23:14 | technomancy | starting from scratch is a waste of time |
| 23:15 | dissipate | technomancy, actually, clojurescript might start dominating in the future. |
| 23:15 | arrdem | dissipate: .... or not. |
| 23:15 | brehaut | lol |
| 23:15 | technomancy | heh |
| 23:16 | dissipate | brehaut, are you saying the JVM is better than the javascript VMs? |
| 23:16 | brehaut | for all tasks? no. for many tasks? yes |
| 23:16 | technomancy | not having integers or standardized file IO is kind of a deal killer for most people |
| 23:17 | brehaut | and having a memory model designed to handle concurrency is nice to have too |
| 23:17 | dissipate | brehaut, what about Parrot VM? |
| 23:18 | brehaut | rhymes with pipe dream |
| 23:18 | dissipate | brehaut, good enough for Perl 6, right? |
| 23:30 | seangrove | ~bbloom |
| 23:30 | clojurebot | bbloom is a dendrologist |
| 23:30 | seangrove | boom |
| 23:30 | brehaut | O_o |
| 23:32 | brehaut | ooooh |
| 23:32 | brehaut | ~gfredericks |
| 23:32 | clojurebot | gfredericks is polluting your memory and must be destroyed |
| 23:32 | dissipate | inc clojurebot |
| 23:33 | dissipate | ,(inc clojurebot) |
| 23:33 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: clojurebot in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 23:42 | TEttinger | (inc clojurebot) |
| 23:42 | lazybot | ⇒ 37 |
| 23:43 | zspencer | (swap! lazybot 5) |
| 23:43 | Raynes | lol |
| 23:43 | zspencer | I... I think I broke it? |
| 23:44 | dissipate | (inc clojurebot) |
| 23:44 | lazybot | ⇒ 38 |
| 23:44 | Raynes | zspencer: (inc ..) entirely fake. |
| 23:44 | Raynes | is entirely fake* |
| 23:44 | dissipate | ,(slurp 'http://www.www.com') |
| 23:44 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Cannot open <http://www.www.com'> as an InputStream.> |
| 23:44 | Raynes | It's parsed manually. The formatting is more of a joke than anything. No actual code is excuted there. :P |
| 23:45 | zspencer | Raynes: I figured; I was oping that maybe; just maybe.... |
| 23:47 | skelternet | I've encountered something I do not understand. I cannot seem to pprint an instance of java.util.GregorianCalendar |
| 23:47 | skelternet | I get an arityException |
| 23:49 | beamso | same |
| 23:49 | beamso | print works though |
| 23:50 | skelternet | nice to have company. think it's a bug? |
| 23:51 | skelternet | do I need to write a new writer function? |