2014-07-27
| 00:36 | lpvb | I'm sorry I asked this question before but had to afk, |
| 00:36 | lpvb | do swap! reset! compare-and-set! block? |
| 00:37 | jeremyheiler | lpvb: do you mean block as in sync/async, or block as in locking? |
| 00:38 | lpvb | um, I think locking, if that's the one where the function doesnt return until it's completed |
| 00:39 | jeremyheiler | ok, so atoms don't block in the sense that they don't lock up a thread. but they do return synchronously. i believe you mean the latter. |
| 00:39 | jeremyheiler | that is, they complete their action before returning |
| 00:40 | lpvb | oh |
| 00:40 | lpvb | yea that's what I meant |
| 00:40 | lpvb | whats the difference between locking |
| 00:42 | Fare | is there a builtin equivalent of CL's ignore-errors, or do I have to define it with a try / catch all |
| 00:43 | Fare | how do I catch all? |
| 00:43 | jeremyheiler | lpvb: locking specifically has to do with thread coordination. so, if it were a locking mechinism, another thread that tries to change that atom concurrently will block until the original unlocks it. however, it doesn't do it that way. |
| 00:44 | lpvb | jeremyheiler: oh I knew that one, I was just confused from the wording |
| 00:44 | jeremyheiler | yeah, i suppose the word "blocking" is overloaded :-/ |
| 00:45 | jeremyheiler | ... or at least can imply different things at a high level |
| 00:46 | Fare | is there a standard way to strip a string's prefix? |
| 00:46 | jeremyheiler | Fare: you catch Exception (or Throwable if you want to catch even fatal jvm errors) |
| 00:46 | jeremyheiler | Fare: clojure.core/subs ? |
| 00:59 | john2x | why is subs in clojure.core, and not in clojure.string? |
| 01:00 | TEttinger | it's probably used in clojure.core internally? |
| 01:00 | TEttinger | macro whatnot? |
| 01:02 | jeremyheiler | hmm... it is used internally, but so is .substring |
| 01:03 | jeremyheiler | looks like subs was introduced in 1.0, but clojure.string was in 1.2 |
| 01:07 | Fare | jeremyheiler, yes, that's what I do. Just wanted to know if there were builtins for the same. |
| 01:09 | jeremyheiler | Fare: nope :-/ |
| 01:10 | Fare | I'm slowly but surely developing a collection of random small utilities. |
| 01:53 | kristof | Fare: Wrong channel but are you familiar with subject-oriented programming? |
| 01:54 | kristof | Fare: Your discussion on multiple "views" of the same essential object using composition of interfaces reminded me of it, and I believe you wrote that you were looking for good examples of such uses |
| 01:55 | kristof | Fare: I was going to suggest that the papers on SOP would surely yield such examples and I was even thinking of rewriting many of them myself using LIL just as an exercise |
| 01:58 | Fare | kristof, not super-familiar |
| 01:59 | Fare | do you mean something similar to urbit or nominine? |
| 01:59 | kristof | Not in the slightest, I have no idea how urbit could relate |
| 01:59 | kristof | Isn't urbit dead in the water while Curtis figures out his jets or whatever? |
| 02:50 | tuft | o |
| 02:51 | tuft | hmm, momentarily tmux confused there |
| 02:56 | Fare | kristof, didn't slate implement subject-oriented programming? |
| 02:57 | Fare | and/or AspectL ? |
| 02:58 | Fare | you can of course reimplement it using Interface-Passing Style. |
| 02:59 | Fare | where your interfaces can be seen as the subject |
| 03:17 | ProTip | Anyone familair with using om? |
| 05:23 | daGrevis | hi! how could i say something like if “x“ is in ["x" "y" "z"] ? |
| 05:25 | daGrevis | looks like im looking for contains? |
| 05:29 | TEttinger | ,(#{"x" "y" "z"} "x") |
| 05:29 | clojurebot | "x" |
| 05:29 | TEttinger | ,(#{"x" "y" "z"} "a") |
| 05:29 | clojurebot | nil |
| 05:29 | TEttinger | sets are functions, daGrevis |
| 05:30 | daGrevis | i didn't have set though |
| 05:30 | TEttinger | ,(doc contains?) |
| 05:30 | clojurebot | "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'." |
| 05:30 | TEttinger | there's that too |
| 05:30 | daGrevis | yep, did that with contains? |
| 05:30 | TEttinger | haha I thought you were asking a question at first |
| 05:30 | TEttinger | the ? at the end threw me off |
| 05:30 | H4ns | daGrevis: only that it does not work, as contains? checks for the index range, not the values |
| 05:31 | H4ns | daGrevis: ((set ["x" "y" "z"]) "x") |
| 05:31 | daGrevis | TEttinger, ha :) |
| 05:32 | TEttinger | you're right, H4ns -- "key is present" not "value is present" |
| 05:32 | daGrevis | H4ns, right. good catch |
| 05:33 | TEttinger | (inc H4ns) |
| 05:33 | lazybot | ⇒ 1 |
| 05:34 | daGrevis | any idea how could i check that something is a English word or isn't? |
| 05:34 | daGrevis | want to filter out stuff like “anc2iwv9wh“ |
| 05:35 | daGrevis | i have idea myself. get entropy of that |
| 05:58 | hyPiRion | daGrevis: sliding window + dictionary? |
| 05:59 | hyPiRion | If you just want to check if something is an English word, you only need to look it up in a map. |
| 05:59 | daGrevis | i want to let through words with mistakes etc. |
| 06:01 | hyPiRion | uh. I'd go with Levensthein-Damerau then |
| 06:01 | daGrevis | okay, I will read about it |
| 06:01 | daGrevis | is there something like take-while that includes the element that returned false? |
| 06:03 | daGrevis | ,(take-while #(== % 2) [1 2 3 4]) |
| 06:03 | clojurebot | () |
| 06:03 | daGrevis | oh well ignore that |
| 06:04 | farhaven | daGrevis: do you only want to know _if_ something is an english word or do you want to offer translations? |
| 06:04 | farhaven | for the former, a bloom filter could be a nice idea |
| 06:04 | daGrevis | farhaven, i want only to know |
| 06:05 | hyPiRion | farhaven: bloom filters would be reasonable if daGrevis didn't want words which may be mistakes to pass through |
| 06:06 | daGrevis | well i think that i can fix problem in the root |
| 06:06 | farhaven | make the filter large enough and errors become almost impossible :P |
| 06:06 | daGrevis | u see i get those words from twitter |
| 06:06 | daGrevis | and i parse them by simple regex |
| 06:06 | farhaven | heh, good luck finding any english in there |
| 06:07 | daGrevis | i get links inside them too and I don't want stuff like t.co/abc123 there |
| 06:07 | daGrevis | actually it's more like t.co and abc123 based on my current regex |
| 06:07 | daGrevis | farhaven, :) |
| 06:09 | daGrevis | might as well parse some book |
| 07:41 | gfixler | How would one achive (map vector [1 2 3] [4 5 6] [7 8 9]) if the vectors were infinite? |
| 08:24 | AeroNotix | gfixler: take |
| 08:25 | AeroNotix | gfixler: https://gist.github.com/AeroNotix/a45de619ad2d4245cd53 |
| 08:25 | AeroNotix | map returns a lazy seq |
| 08:25 | hyPiRion | gfixler: do you mean an infinite number of vectors? |
| 08:41 | expez | I'm trying to read a file in a macro but the form (io/file some-file) barfs complaining that some-file is a symbol. How do I fix this? |
| 08:41 | AeroNotix | expez: show macro |
| 08:43 | expez | (defmacro my-macro [my-file] (println (slurp (io/file my-file)))) would be a minimal example |
| 08:43 | AeroNotix | so you need to splice the my-file variable |
| 08:43 | AeroNotix | and also, you need to return a syntax quoted form |
| 08:44 | AeroNotix | since that body will be evaluated at compile-time |
| 08:44 | AeroNotix | and thus, my-file is literally a symbol |
| 08:44 | expez | right, I want to use the content of the file to build the source, but I'm having problems reading the file at compile time |
| 08:46 | expez | Perhaps it's easier if I just wrap the macro in a function which reads the file? |
| 08:46 | AeroNotix | expez: show how you're calling this |
| 08:47 | AeroNotix | because if you want the file to be read at compile-time, you need to pass something which has a value at compile-time |
| 08:47 | AeroNotix | so that would be a string in the case of io/file |
| 08:47 | AeroNotix | It only operates on the raw syntactic elements, not the values they may represent at runtime |
| 08:48 | AeroNotix | expez: look |
| 08:48 | AeroNotix | https://gist.github.com/AeroNotix/cba1855cc8bf18f0b612 |
| 08:48 | AeroNotix | because the macro gets the symbol 'c |
| 08:48 | AeroNotix | not the string it represents |
| 08:49 | AeroNotix | because at macroexpansion time, this is all it has |
| 08:49 | AeroNotix | Unfortunately Macros are not covered in as much depth as they should be |
| 08:50 | expez | Might be a blessing in disguise |
| 08:50 | expez | In cl I found the need to write a macro a lot more often |
| 08:51 | AeroNotix | That's probably not the case |
| 08:51 | AeroNotix | Macros are overused |
| 08:51 | AeroNotix | but, perhaps you need one here -- what are you trying to do? |
| 08:52 | expez | I'm writing a small library that records the arg => result pairs for certain functions and then creates mocks using the arg => result pairs it squirreled away |
| 08:52 | expez | well, I'm trying :) |
| 08:52 | AeroNotix | expez: so the first part is taken care of by memoization |
| 08:53 | AeroNotix | expez: http://clojuredocs.org/clojure_core/clojure.core/memoize |
| 08:53 | expez | I want to persist this to disk, so my tests don't hit external services |
| 08:54 | AeroNotix | IIRC memoize puts the mapping as part of its metadata |
| 08:54 | AeroNotix | you could run your tests once, read out the memoize data |
| 08:54 | AeroNotix | TBH -- this seems like a lot of work just to not write mocks yourself |
| 08:55 | llasram | expez: So the goal is a more general version of something like the Ruby VCR library? |
| 08:55 | expez | That's what I thought, but when the external services keep changing I found myself manually capturing a lot of data for use in mocks |
| 08:56 | expez | llasram: yeah, that's the idea |
| 08:57 | expez | Figured this would be pretty easy to write, but that project has 1.7k commits Oo |
| 08:57 | AeroNotix | For something basic it'd be pretty easy |
| 08:58 | llasram | expez: My suggestion for approaching this would be to write a very small macro which uses `with-redefs` |
| 08:58 | AeroNotix | yeah^ |
| 08:58 | AeroNotix | and having your body executed by logging the args and values to disk |
| 08:59 | AeroNotix | And your macro would also generate code for reading a specific file (this can be done at runtime) |
| 08:59 | llasram | Well |
| 08:59 | llasram | Having trouble phrasing for some reason |
| 08:59 | llasram | But I think it'd be easier if the macro did nothing but the `with-redefs` |
| 08:59 | expez | yeah, this is the part I got stuck on, trying to read the bindings for with-redefs from file |
| 08:59 | llasram | And the main body of the work happened in the generated function you redef too |
| 08:59 | AeroNotix | llasram: this^ |
| 08:59 | llasram | Interesting |
| 08:59 | AeroNotix | There's no reason it needs to read the file at compile time |
| 09:00 | AeroNotix | macroexpansion time* |
| 09:00 | AeroNotix | just generate the code for it |
| 09:00 | expez | mhmm :) |
| 09:00 | expez | Thanks guys! |
| 09:00 | llasram | expez: Why do you need to specify the bindings in a file? |
| 09:00 | AeroNotix | llasram: to persist across runs |
| 09:00 | AeroNotix | they want to run their tests, get initial values, run tests again using the values from the previous run |
| 09:01 | AeroNotix | for some functions |
| 09:01 | llasram | I guess I'm thinking of the VCR style, where you write your test, it captures data the first time you run it, then it regurgitates the captured data on subsequent runs |
| 09:01 | llasram | In that model, you'd specify the functions to wrap in your test |
| 09:01 | AeroNotix | llasram: sure -- but it needs to persist this data somewhere, right? |
| 09:02 | llasram | Sure. I'm just talking about specifically "then bindings for with-redefs" |
| 09:02 | llasram | s,then,the, |
| 09:02 | AeroNotix | not sure what they meant by that |
| 09:02 | llasram | Indeed |
| 09:02 | llasram | And now we may never know... |
| 09:03 | AeroNotix | This doesn |
| 09:03 | AeroNotix | This doesn't seem like a difficult task for Lisp |
| 09:03 | AeroNotix | I'd probably make something like defn-recorded |
| 09:05 | AeroNotix | expez: https://github.com/ifesdjeen/vcr-clj |
| 09:05 | AeroNotix | there's this |
| 09:06 | AeroNotix | I have the same reservations as Alex there |
| 09:06 | AeroNotix | Mocking stuff is notoriously difficult to do properly |
| 09:09 | expez | yup |
| 11:18 | mi6x3m-alt | hey guys, what would you call a function returning the page size of a webbrowser page? |
| 11:18 | mi6x3m-alt | page-size [browser] ? |
| 11:20 | jeremyheiler | mi6x3m-alt: do you not like page-size? |
| 11:22 | mi6x3m-alt | jeremyheiler: nah, just asking :) |
| 11:22 | mi6x3m-alt | without or with verb |
| 11:25 | jeremyheiler | it seems fine, given the context you gave |
| 11:28 | vdmit11 | Hi folks. I need to define a type whose interface and semantics almost exactly matches to list. The only difference I need is a different class name and perhaps a custom toString method. How can I do that? |
| 11:30 | vdmit11 | In other words, I need to inherit list. I know inheritance is bad, but in this case it helps to avoid boilerplate code. |
| 11:31 | bbloom | vdmit11: do you really mean list? or seq? |
| 11:32 | dnolen_ | vdmit11: if you're talking about deftype not possible, you just have to write the code |
| 11:32 | dnolen_ | or defrecord for that matter |
| 11:36 | vdmit11 | well, generally I need a sequence, but the list is the most suitable thing for me |
| 11:38 | Glenjamin | why cant you just use an actual list? |
| 11:43 | vdmit11 | Well, I collect actions into lists. And there is two slightly different kinds of such list: one means "actions are done in sequence", another means "actions are done in parallel". They may be nested to each other and so on. And I would like to distinguish them, and I think it is not really a metadata, so I think perhaps I can just make two classes with the same behavior but different names. |
| 11:45 | H4ns | use a hash with a type and a list key. the type indicates whether it is parallel or sequential. |
| 11:45 | bbloom | yes, what H4ns said |
| 11:45 | bbloom | or, use a vector and a set |
| 11:46 | bbloom | [do this and then this] vs #{do all these in any order} |
| 11:47 | H4ns | no need for a "type", that is the message. just combine the existing data strutures in the way that you require. |
| 11:47 | TimMc | vdmit11: Yes, as others have said, the correct answer is to lift the tagging from the virtual machine level (class-tagged objects) to the "userspace" level -- tag/list pairs. |
| 11:48 | vdmit11 | set looks more suitable because the order of parallel actions doesn't matter, but it requires the elements to be unique, and I think I may have duplicate actions done in parallel |
| 11:50 | vdmit11 | tagging in a hash-map looks a bit redundant, but if there is no cleaner way, I'll use it |
| 12:01 | bbloom | i'm sure there's a multiset out there somewhere :-) |
| 12:03 | myguidingstar | Someone please help with this strange Clojurescript compilation error: https://gist.github.com/myguidingstar/ad29083023130817eb01 |
| 12:08 | gfredericks | myguidingstar: that's definitely a weird use of macros |
| 12:08 | gfredericks | i.e., calling macroexpand |
| 12:09 | gfredericks | myguidingstar: are you sure you need a macro here? |
| 12:09 | myguidingstar | gfredericks, I know it, but I need an abstraction over javascript |
| 12:10 | gfredericks | myguidingstar: what are you trying to do exactly? |
| 12:10 | myguidingstar | gfredericks, please consider it a playground. I don't understand why the compiler yelled that message |
| 12:14 | gfredericks | I don't either. |
| 12:14 | gfredericks | and I don't have a cljs setup so I can't try reproducing outside of vanilla clojure |
| 12:18 | gfredericks | (and macroexpanding that in vanilla clojure doesn't give anything suspicious) |
| 12:19 | dnolen_ | ,{{}} |
| 12:19 | clojurebot | #<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms> |
| 12:19 | dnolen_ | hrm, anyways myguidingstar my guess is that you have a malformed map based on the error |
| 12:20 | dnolen_ | ,(hash-map {}) |
| 12:20 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {}> |
| 12:21 | dnolen_ | but also those macros don't make sense I can't really understand them |
| 12:28 | myguidingstar | dnolen_, I've just updated the explanation |
| 12:28 | myguidingstar | btw, do you think it's a bug? |
| 12:30 | dnolen_ | myguidingstar: I still have no idea what you are trying to do or why you trying to do it |
| 12:30 | gfredericks | myguidingstar: line 26 should fail the read regardless |
| 12:30 | dnolen_ | if I can determine the above then maybe we can talk about bugs |
| 12:30 | dnolen_ | that said ... I doubt it |
| 12:31 | myguidingstar | dnolen_, I'm trying to make a Compojure-like abstraction over a javascript request handler |
| 12:32 | dnolen_ | myguidingstar: but what is the macro doing for you here? |
| 12:32 | dnolen_ | it seems to serve no purpose |
| 12:32 | myguidingstar | dnolen_, user can use Clojure map to define what a request return |
| 12:33 | myguidingstar | (instead of imperatively calling Javascript) |
| 12:33 | gfredericks | myguidingstar: why can't you do that with a function? |
| 12:33 | dnolen_ | myguidingstar: what gfredericks said |
| 12:34 | myguidingstar | gfredericks, yes of course, but a macro should produce shorter javascript at runtime |
| 12:35 | myguidingstar | anw, please consider it a playground |
| 12:36 | dnolen_ | myguidingstar: remember, you have Google Closure Compiler working for you - anything you might do by hand will be trivial compared to that. |
| 12:36 | myguidingstar | dnolen_, thanks. I didn't think about it |
| 12:37 | myguidingstar | anw, I want to learn an other thing about this mess, too |
| 12:38 | mi6x3m-alt | is there a version of doto that returns nil? |
| 12:38 | myguidingstar | (sorry for being so annoying) |
| 12:38 | gfredericks | mi6x3m-alt: no |
| 12:38 | gfredericks | myguidingstar: maybe try to produce a more minimal case? |
| 12:39 | gfredericks | extra points if it involve just one macro |
| 12:39 | mi6x3m-alt | gfredericks: thanks |
| 12:39 | myguidingstar | gfredericks, I did, and that one worked |
| 12:42 | gfredericks | myguidingstar: e.g., try it without the map, or with fewer keys in the map |
| 12:42 | gfredericks | without the pr-str |
| 12:42 | gfredericks | etc etc |
| 12:43 | dnolen_ | ,(let [{:keys [foo]} '(foo [] {})] foo) |
| 12:43 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {}> |
| 12:43 | dnolen_ | myguidingstar: ^ |
| 12:43 | dnolen_ | myguidingstar: my-response is getting (end [] {}) unevaluated and you're trying to destructure that |
| 12:43 | dnolen_ | er (end [] {}) |
| 12:44 | myguidingstar | dnolen_, you're right. But I tried with (macroexpand ...) |
| 12:44 | myguidingstar | and it still failed |
| 12:44 | gfredericks | oh geez I didn't know you could map-destructure a not-map |
| 12:44 | dnolen_ | myguidingstar: if you need to call macroexpand in a macro ... game over |
| 12:44 | dnolen_ | myguidingstar: so the only good that will come of this is understanding how macros work ... fine if that's your goal |
| 12:45 | myguidingstar | gfredericks, I've just comment a more minimal code that works |
| 12:46 | myguidingstar | dnolen_, absolutely I want to |
| 12:46 | myguidingstar | dnolen_, any suggestion to make it work? |
| 12:47 | dnolen_ | myguidingstar: macroexpand doesn't work for different reasons |
| 12:47 | dnolen_ | + isn't defined for collections |
| 12:47 | dnolen_ | you want str not + |
| 12:47 | gfredericks | dnolen_: that shouldn't fail at macroexpand time though? |
| 12:48 | gfredericks | ,(macroexpand `(+ ~{} ~[])) |
| 12:48 | clojurebot | (clojure.core/+ {} []) |
| 12:48 | dnolen_ | gfredericks: it's not failing at macroexpand |
| 12:48 | dnolen_ | failing at runtime |
| 12:48 | gfredericks | ooh okay |
| 12:48 | myguidingstar | dnolen_, I use [] and {} to make sure it's evaluated in javascript |
| 12:49 | dnolen_ | myguidingstar: macroexpand and changing + to str makes it work |
| 12:49 | dnolen_ | myguidingstar: I don't know what you are saying |
| 12:49 | dnolen_ | if it's a http response it's just text |
| 12:49 | dnolen_ | nothing to do w/ JavaScript |
| 12:51 | myguidingstar | (+ [] {}) is just to make sure the code is executed in javascript environment, not Clojure (macro expansion) |
| 12:51 | dnolen_ | myguidingstar: yes this statement does not compute |
| 12:51 | dnolen_ | (+ [] {}) is not legal Clojure or ClojureScript |
| 12:52 | myguidingstar | yes, you'll get a type warning for that |
| 12:52 | myguidingstar | hmm, that's a bit off track |
| 12:52 | gfredericks | dnolen_: I think he means he can tell where + is running based on whether he gets an exception from the jvm or the js runtime |
| 12:54 | dnolen_ | gfredericks: well ClojureScript has inference enough for obvious problem like this one - compiler warning |
| 12:55 | myguidingstar | dnolen_, I learnt that trick from clojurescript.test README https://github.com/cemerick/clojurescript.test |
| 12:58 | dnolen_ | myguidingstar: anyways this works https://gist.github.com/swannodette/332c574cb4d9df41aa35 |
| 13:00 | dnolen_ | myguidingstar: but as I said before you can abstract over some JS lib w/o any of this macro stuff, it just creates more problems to do it this way. |
| 13:01 | myguidingstar | dnolen_, that's quite strange. I think I was unsuccessful with such code |
| 13:01 | myguidingstar | dnolen_, that's the best lesson for me today, thanks |
| 13:01 | gfredericks | mo macros mo problems |
| 13:01 | myguidingstar | rule #1 ;) |
| 13:02 | SagiCZ1 | hey guys.. i want to assert that there is only zero or one element in a collection, if there is more, i want clojure to throw runtime exception, how do i do that? |
| 13:02 | dnolen_ | SagiCZ1: assert |
| 13:02 | dnolen_ | ,(doc assert) |
| 13:02 | clojurebot | "([x] [x message]); Evaluates expr and throws an exception if it does not evaluate to logical true." |
| 13:03 | SagiCZ1 | dnolen_: wow.. that was hard.. |
| 13:03 | SagiCZ1 | dnolen_: thanks :) |
| 13:03 | dnolen_ | np |
| 13:04 | gfredericks | SagiCZ1: assert is only appropriate for guarding against programmer errors |
| 13:07 | whigmaleerie | dnolen_: opinion of assert vs the built-in precondition meta data? |
| 13:08 | dnolen_ | whigmaleerie: just depends |
| 13:09 | bbloom | i've kinda given up on :pre |
| 13:09 | bbloom | every time i use it, i shortly later discover i need to do something to an input before i assert something about it |
| 13:09 | bbloom | and wind up rewriting it to an assert |
| 13:11 | SagiCZ1 | bbloom: how would i get the only element of a list? is (first '(5)) the correct way? |
| 13:11 | SagiCZ1 | ,(first '(3)) |
| 13:11 | clojurebot | 3 |
| 13:12 | bbloom | SagiCZ1: seems like a question for the room, not for me specifically... |
| 13:12 | bbloom | but yes, that's fine |
| 13:13 | SagiCZ1 | sorry about that bbloom |
| 13:13 | SagiCZ1 | and thanks |
| 13:31 | gfredericks | okay so I feel like transit has to have an ambiguity on the JS side |
| 13:32 | gfredericks | between ints and floats |
| 13:32 | gfredericks | 42 encodes to JSON as "[\"~#'\",42]", and 42.0 to "[\"~#'\",42.0]" |
| 13:32 | gfredericks | but javascript's JSON parser parses those two identically |
| 13:47 | schmee | how do I destructure a map with a key called `time`? It errors since `time` is also a core function |
| 13:49 | hyPiRion | schmee: ##(let [{t :time} {:time "foo"}] t) ? |
| 13:49 | lazybot | ⇒ "foo" |
| 13:49 | hyPiRion | or do you mean the symbol `time`? |
| 13:50 | hyPiRion | ,(let [{t 'time} {'time "foo"}] t) |
| 13:50 | clojurebot | "foo" |
| 13:51 | gfredericks | ,(let [{:keys [time]} {:time "foo"}] [time time]) |
| 13:51 | clojurebot | ["foo" "foo"] |
| 13:51 | bbloom | schmee: it absolutely should not give that error because it does not evaluate the destructuring expression |
| 13:51 | gfredericks | ,(let [{:syms [time]} {'time "foo"}] [time time]) |
| 13:51 | clojurebot | ["foo" "foo"] |
| 13:51 | bbloom | you've got a syntax error somewhere |
| 13:52 | schmee | I see, thanks! |
| 13:52 | gfredericks | ,(let [{t time} {time :foo}] t) |
| 13:52 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/time, compiling:(NO_SOURCE_PATH:0:0)> |
| 13:52 | gfredericks | ,(let [{t +} {+ :foo}] t) |
| 13:52 | clojurebot | :foo |
| 13:52 | gfredericks | nice |
| 13:53 | dnolen_ | gfredericks: yes Transit doesn't address the problem of roundtripping floats, but that's way bigger issue than JS anyway |
| 13:53 | dnolen_ | gfredericks: and for the design space - not particularly important to address |
| 13:54 | bbloom | it's really quite amusing how bad of a trade off floats are for most use cases :-/ |
| 13:55 | gfredericks | dnolen_: rich seemed to say that everything roundtrips perfectly, so this surprises me |
| 13:55 | dnolen_ | gfredericks: was likely speaking about tagged values specifically (perhaps implicitly) |
| 13:55 | dnolen_ | so if you don't have a handler so someone's custom type, doesn't matter |
| 13:55 | gfredericks | gotcha |
| 13:56 | gfredericks | right |
| 13:56 | dnolen_ | gfredericks: if for some reason you need to roundtrip floats you can override BigDec and deal w/ it yourself. |
| 13:56 | gfredericks | dnolen_: what do you mean by roundtripping floats being a big issue? something about string representations of floats in general? |
| 13:57 | dnolen_ | gfredericks: floating point reps have problems between languages |
| 13:57 | gfredericks | that's not an inherent problem is it? just divergent interpretations? |
| 13:58 | dnolen_ | gfredericks: I already said you can solve this yourself if it's important ^ |
| 13:59 | gfredericks | dnolen_: right, I'm just trying to understand how things work; sorry for the bother |
| 14:00 | gfredericks | if anybody else knows what dnolen_ meant I would be interested |
| 14:01 | hyPiRion | gfredericks: Well, for C/C++, it is both OS and compiler-dependent. |
| 14:02 | gfredericks | hyPiRion: IEEE 64-bit floating points in particular? |
| 14:05 | hyPiRion | gfredericks: Oh, it's about 64-bit specifically? |
| 14:05 | gfredericks | well in this context we're talking about JSON, so I figured so |
| 14:06 | gfredericks | I guess they're not very specific about that |
| 14:06 | bbloom | gfredericks: floats are basically 100% broken for data interchange |
| 14:06 | gfredericks | bbloom: what I'm trying to understand is if that's justa coordination issue, i.e. lack of an adhered-to standard, or if it's something inherent to FP |
| 14:07 | bbloom | gfredericks: fundamentally, there are multiple floating point values that have the same string representation, but may produce different results when computed with |
| 14:08 | bbloom | even within the same language, round-tripping to text can change is not an identity operation |
| 14:08 | bbloom | s/can change/ |
| 14:08 | bbloom | / |
| 14:08 | gfredericks | bbloom: can't you solve that with more decimal places? |
| 14:08 | bbloom | gfredericks: no |
| 14:08 | bbloom | floats aren't encoded in decimal |
| 14:08 | gfredericks | or are we talking about 0/infinity edge cases? |
| 14:08 | bbloom | no |
| 14:08 | gfredericks | I know they aren't |
| 14:08 | bbloom | http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html |
| 14:09 | bbloom | in short: floats are a friggin mess |
| 14:10 | hyPiRion | Best used in banking systems if you want to maximise damage. |
| 14:11 | gfredericks | based on what I know about decimal and binary numbers, I have a hard time making sense of this |
| 14:11 | gfredericks | if there were an example of two floats that print the same way, that'd be extremely helpful |
| 14:12 | gfredericks | the set of floating point numbers (excl the weird ones) should just be a subset of the ratios |
| 14:12 | gfredericks | and you should be able to use decimal representations to get arbitrarily close to any given rational number |
| 14:12 | hyPiRion | gfredericks: +0 and -0? |
| 14:13 | hyPiRion | oh, that's probably a weird one. |
| 14:13 | gfredericks | hyPiRion: bbloom said it wasn't a 0/infinity/nan issue |
| 14:13 | gfredericks | yeah definitely weird |
| 14:13 | bbloom | gfredericks: i meant to say it's not JUST a 0/inf/nan issue |
| 14:13 | gfredericks | sure, either way |
| 14:13 | gfredericks | I'm ignoring the weird numbers for the moment since you said the normal ones have this problem too |
| 14:15 | bbloom | gfredericks: trying to find an article, hold on |
| 14:16 | gfredericks | I'm scanning through the one you already pasted |
| 14:16 | bbloom | sheesh, there's so many problems w/ floating point i don't even know where to start :-P |
| 14:17 | gfredericks | yeah I'm familiar with why they're problematic, I just didn't think they had the problem you were describing :) |
| 14:18 | bbloom | http://www.drdobbs.com/cpp/even-simple-floating-point-output-is-com/240165594 |
| 14:18 | hyPiRion | gfredericks: they are represented on the form sign * significand * 2^(exponent - c) |
| 14:18 | bbloom | http://www.drdobbs.com/cpp/floating-point-input-and-output-are-not/240165984 |
| 14:18 | bbloom | http://www.drdobbs.com/cpp/accurate-floating-point-input-several-co/240166140 |
| 14:18 | bbloom | (the drdobbs site is atrociously difficult to navigate and for some reason breaks cmd-click in many places) |
| 14:19 | gfredericks | bbloom: I think this quote from your first link supports my hunch |
| 14:19 | gfredericks | "When a binary IEEE single precision number is converted to the closest eight digit decimal number, it is not always possible to uniquely recover the binary number from the decimal one. However, if nine decimal digits are used, then converting the decimal number to the closest binary number will recover the original floating-point number." |
| 14:19 | bbloom | gfredericks: if you read the rest, you'll see you that the standard printing mechanism does not have that property |
| 14:19 | bbloom | it tries to create "nice" looking values |
| 14:19 | bbloom | which is in line with the use cases where floats are actually valid: when accuracy doesn't matter really |
| 14:20 | gfredericks | bbloom: yeah, I can imagine real life serialization having ambiguities, I just didn't think decimal reps inherently had that problem |
| 14:20 | bbloom | gfredericks: i was talking about the *printed* reps |
| 14:20 | gfredericks | me too |
| 14:20 | bbloom | as spec'ed |
| 14:20 | gfredericks | there's printing in the IEEE spec? |
| 14:20 | bbloom | i thought so |
| 14:20 | gfredericks | probably so |
| 14:21 | gfredericks | so it's a spec problem then; I'm just saying it's easy enough to imagine a similar printing strategy that has no ambiguity |
| 14:21 | bbloom | yes, conversions to and from strings are in the spec according to wikipedia |
| 14:21 | gfredericks | i.e., it's not an inherent base 10 vs base 2 thing |
| 14:21 | bbloom | yes, but that printing strategy would produce reaaallly long decimal strings |
| 14:22 | gfredericks | hardly longer than the longest normal ones, no? |
| 14:22 | hyPiRion | use binary, be happy |
| 14:22 | gfredericks | :) |
| 14:22 | bbloom | well the standard string conversions include rounding, truncation, handle repeated decimals, etc |
| 14:23 | bbloom | if you can't reinterpret cast a float to a bit string, you can't possibly round trip it correctly without intrinsic support |
| 14:23 | bbloom | but the whole purpose of floats is to optimize when you don't care about losing some precision here or there |
| 14:24 | gfredericks | yeah; when I hear people complain about FP problems I usually assume it's related to the floating point magma |
| 14:25 | gfredericks | or base 2 vs base 10 |
| 14:25 | bbloom | they basically only make any sense during the very last stage of a pipeline |
| 14:25 | gfredericks | whereas it sounds like this is the fact that rounding is in the serialization spec |
| 14:25 | bbloom | like colors in a rasterization buffer :-P |
| 14:26 | gfredericks | bbloom: hyPiRion: thanks |
| 14:31 | arrdem | $seen john2x |
| 14:31 | lazybot | john2x was last seen quitting 2 hours and 49 minutes ago. |
| 14:31 | arrdem | :/ |
| 14:33 | gfredericks | in any case, my original question about transit wasn't about roundtripping particular floating points, it was about even roundtripping types in the first place |
| 14:35 | gfredericks | e.g., if I start with a long and a double in clojure, and I send it to JS and back, I'll get two numbers of the same type |
| 14:35 | bbloom | gfredericks: i think numerics are a problem & i've mentioned to dnolen_ that i'd like to be able to force longs |
| 14:35 | bbloom | at least for js interop's sake |
| 14:35 | gfredericks | bbloom: yeah at worst you have to avoid the ground types |
| 14:36 | bbloom | i think this is a case of "now you're talking about the real problems" |
| 14:36 | gfredericks | that just requires cooperation across the system, you can't fix it only in the user JS code |
| 14:36 | bbloom | that is, you already had these problems w/ edn, json, etc |
| 14:36 | bbloom | but now that you have a tool that papers over the (retroactively) obviously broken bits, you can see the underlying issues more lcearly |
| 14:37 | bbloom | it's like when people hear that datomic doesn't need to touch the network to get the current database, and their first thought is "isn't the data stale then?" ... yes... but so is the data you get back from a SQL query! |
| 14:37 | bbloom | same idea: once you eliminate stupid problems, the real struggles become clear... even if they are just more stupid problems :-P |
| 14:38 | arrdem | will cljs allow you to perform bitwise operations on the sign bit or does it hide bit 63 like the JVM does. |
| 14:39 | arrdem | because one option... albeit a shitty one, is to just write a Double -> BitString -> Double pipeline. |
| 14:39 | bbloom | arrdem: would defeat the performance goals.... |
| 14:39 | arrdem | bbloom: fair |
| 14:39 | bbloom | if you *need* exact representations: don't use floats. |
| 14:40 | bbloom | full stop. with or without any network transport of any kind |
| 14:42 | gfredericks | bbloom: datomic analogy is a good one |
| 14:42 | gfredericks | bbloom: it's not exactness, it's type preservation |
| 14:43 | bbloom | gfredericks: if you lift a type/value tuple in to the domain of dynamic values, then you've got value exactness ;-) |
| 14:43 | gfredericks | yep |
| 14:44 | gfredericks | I'm not saying it was a bad design choice, I'm just interested in what the unadvertised edge cases are |
| 14:45 | bbloom | well numerics are always a good place to go splunking for edge cases! |
| 14:45 | gfredericks | when you have a lot of clojure usage at a large company, it's useful to have somebody familiar with such things |
| 14:46 | bbloom | pack on your door: Gary Fredricks -- Purveyor Of Fine Edge Cases |
| 14:46 | bbloom | s/pack/plaque/ # i wasn't even close |
| 14:46 | gfredericks | ha |
| 14:51 | vdmit11 | Hi folks. When I define a protocol, I would like to specify pre/post conditions like I can do with functions. I would like to assert that all method implementations may assume that the input will be so and so, and they all shall return a value that follows certain constraints. Is there a way to do that? |
| 14:52 | schmee | Does anyone know how to use an Thread/UncaughtExceptionHandler in clojure? |
| 14:53 | mi6x3m-alt | vdmit11: ehm, not that I know of, also the pre and post condition thing is seldomly used |
| 14:53 | schmee | I tried adding this to the top of the file but it doesn't work for me, http://www.paullegato.com/blog/uncaught-exceptions-in-clojure/ |
| 14:53 | gfredericks | vdmit11: defprotocol doesn't support that, but I think you can wrap the generated function via alter-var-root |
| 14:53 | bbloom | vdmit11: just define a wrapper functions for your protocol methods |
| 14:53 | gfredericks | schmee: in what way does it not work? |
| 14:54 | bbloom | (defprotocol P (-foo [this x y z])) (defn foo [p x y z] {:pre ...} (-foo p x y z)) |
| 14:54 | gfredericks | I like bbloom's idea better |
| 14:54 | vdmit11 | wrappers are boilerplate and they are not abstract |
| 14:54 | vdmit11 | I would like to specify interface, not implementation |
| 14:55 | schmee | gfredericks: well, I found a bug in a future I'm using, and now I've reintroduced the bug and added that handler thingy with a print |
| 14:55 | arrdem | well you can't have an interface with pre/post conditions... pre/post conditions are an implementation detail handled by the fn macro |
| 14:55 | gfredericks | vdmit11: I don't think you're specifying the impl in any sense |
| 14:55 | schmee | but it just hangs and doesn't print anything |
| 14:55 | bbloom | vdmit11: clojure does not have a notion of pre/post conditions are part of interface |
| 14:55 | gfredericks | schmee: futures catch exceptions |
| 14:55 | gfredericks | schmee: you'd want to deref the future |
| 14:56 | schmee | oh! |
| 14:56 | bbloom | vdmit11: and wrapper functions really aren't all that much boilerplate... they are frequently necessary to decouple argument handling, pre/post processing, from the service interface of the objects |
| 14:56 | schmee | I'm just using the future for dispatch only, so I can't actually access the value once I've sent it off |
| 14:56 | bbloom | vdmit11: in general, you should be defining so few protocols that the "boilerplate" should be an essential part of the work you're doing |
| 14:57 | gfredericks | schmee: well it's up to you where you want to handle it I guess |
| 14:57 | bbloom | vdmit11: if you need *the same* boilerplate many times, then you can define a macro to generate it |
| 14:57 | gfredericks | ,(defmacro elsewhere [& body] `(.start (Thread. (fn [] ~@body)))) |
| 14:57 | clojurebot | #'sandbox/elsewhere |
| 14:57 | schmee | hmm yeah, I just want to print exceptions without wrapping my entire program in try/catch statements |
| 14:57 | gfredericks | schmee: ^ an alternative to future that should hit your handler |
| 14:58 | schmee | gfredericks: sweet, I'll try it out! |
| 14:59 | schmee | gfredericks: worked like a charm, thanks! |
| 15:00 | vdmit11 | bbloom: well, I'm talking about readability when I say "boilerplate", when you see some pre/post conditions in the interface specification, you can understand better what kind of data must be passed to the method and what kind of value it returns, and you may assume that these assertions are always true and rely on these assumptions and write less code |
| 15:00 | vdmit11 | bbloom: for me it just would be nicer to read an interface that gives some idea about inputs/outputs of a method |
| 15:01 | bbloom | vdmit11: protocols define java-style interfaces. that's just what they do. if you want a more powerful contractual programing mechanism, you'll have to look elsewhere or define it yourself |
| 15:01 | bbloom | vdmit11: i'm also telling you the community accepted approach: just define a function |
| 15:02 | vdmit11 | ok, thanks, I just wanted to know the conventional way |
| 15:03 | schmee | is there any way to list the currently running threads in the repl? |
| 15:03 | bbloom | vdmit11: that's the very first thing i told you :-P |
| 15:05 | gfredericks | schmee: http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#getAllStackTraces%28%29 |
| 15:05 | gfredericks | ,(Thread/getAllStackTraces) |
| 15:05 | clojurebot | #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission getStackTrace)> |
| 15:05 | gfredericks | I've never tried it; looks promising |
| 15:06 | gfredericks | sun.misc.Unsafe.park |
| 15:06 | gfredericks | is apparently a popular method on my jvm |
| 15:07 | schmee | gfredericks: it worked great. now I just gotta prettyprint it... |
| 15:08 | gfredericks | w00t |
| 15:09 | gfredericks | ,(.getStackTrace (Thread/currentThread)) |
| 15:09 | clojurebot | #<StackTraceElement[] [Ljava.lang.StackTraceElement;@f8deca> |
| 15:09 | gfredericks | ,(str (firsrt (.getStackTrace (Thread/currentThread)))) |
| 15:09 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: firsrt in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 15:09 | gfredericks | ,(str (first (.getStackTrace (Thread/currentThread)))) |
| 15:09 | clojurebot | "java.lang.Thread.getStackTrace(Thread.java:1495)" |
| 15:10 | gfredericks | ,(str (rand-nth (.getStackTrace (Thread/currentThread)))) |
| 15:10 | clojurebot | "clojure.core$eval74$fn__75.invoke(NO_SOURCE_FILE:0)" |
| 15:14 | gfredericks | I can't believe I didn't know about that...that will be super useful for when things are hung in the repl. |
| 15:25 | andyf | bbloom: I saw your message in the :pre/:post error message clojure-dev thread, and am wondering if I am missing something when you say "it requires non-local analysis". Do you mean it requires resolving whether the symbol number? resolves to the Var #'clojure.core/number? vs. resolving to number? in some other namespace? |
| 15:26 | bbloom | andyf: more simply: |
| 15:26 | bbloom | (def x false) |
| 15:26 | bbloom | (defn f [] {:post [x]}) |
| 15:26 | bbloom | ,(def x false) |
| 15:26 | clojurebot | #'sandbox/x |
| 15:26 | bbloom | ,(defn f [] {:post [x]}) |
| 15:26 | clojurebot | #'sandbox/f |
| 15:26 | bbloom | ,(f) |
| 15:26 | clojurebot | {:post [false]} |
| 15:26 | bbloom | ,(defn f [] {:post [x]} nil) |
| 15:26 | clojurebot | #'sandbox/f |
| 15:26 | bbloom | ,(f) |
| 15:26 | clojurebot | #<AssertionError java.lang.AssertionError: Assert failed: x> |
| 15:27 | bbloom | andyf: does that make my comment clear? |
| 15:28 | andyf | Eastwood can look at number?, see that it should resolve to #'clojure.core/number?, and I can bake into Eastwood that such a Var is by default a function, but it is uncomputable to determine whether its current value is a boolean or not. |
| 15:28 | andyf | Eastwood makes best guesses at times like that, based on usual practice. |
| 15:28 | bbloom | andyf: right, which is why that's a good analysis for a linter, but the vector vs not vector analysis is doable in the standard defn macro, hence my patch & comment |
| 15:29 | andyf | ok, makes sense. Thanks. |
| 15:30 | bbloom | getting formal: the analysis you just described is neither sound nor complete |
| 15:30 | bbloom | but i'm an advocate for ignoring soundness and completeness ;-) |
| 15:37 | andyf | in lint tools, at least :) |
| 15:38 | bbloom | for sure |
| 15:38 | bbloom | ...at least :) |
| 16:07 | augustl | how do I add a http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/handler/ResourceHandler.html to my ring.adapter.jetty handler? |
| 16:11 | augustl | seems I can just .getHandler and go from there, in a :configurator |
| 16:21 | jeremyheiler | augustl: i've had to do that before; seems like the "best way" given how it's all set up. |
| 16:28 | fifosine1 | Is it faster to consistently use tail on a sequence or to reverse it first and grab the head over and over? |
| 16:29 | gfredericks | fifosine1: the former |
| 16:29 | gfredericks | er |
| 16:29 | bbloom | no |
| 16:29 | gfredericks | unless you mean |
| 16:29 | bbloom | fifosine1: do you need to be able to push on to the front of the list? |
| 16:29 | fifosine1 | no |
| 16:29 | bbloom | use a vector |
| 16:29 | bbloom | (doc peek) |
| 16:29 | clojurebot | "([coll]); For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil." |
| 16:30 | fifosine1 | when do I want to use sequences vs. vectors? I've structured my code so that it's only using sequences. Should I probably be using vectors? |
| 16:31 | gfredericks | fifosine1: you're getting the last element repeatedly? |
| 16:31 | fifosine1 | gfredericks: Yea, recurring on the last element of a list |
| 16:31 | gfredericks | fifosine1: why? what sort of collection is this? |
| 16:31 | fifosine1 | a sequences |
| 16:32 | fifosine1 | sequence |
| 16:32 | gfredericks | but why do you need the last thing? what else do you do with the sequence? |
| 16:32 | andyf | fifosine1: Many Clojure functions produce sequences as results, regardless of the kind of collection they are given, so trying to structure your code to use vectors "everywhere" is probably impossible, and using them everywhere that you return values from functions would require converting from sequences to vectors a lot. |
| 16:33 | andyf | I believe many people's Clojure code uses sequences where they do not present a performance problem, e.g. they only need to access it from first to last, and vectors if they have a special need for fast random access. |
| 16:35 | bbloom | fifosine1: use seqs whenever you're doing stuff to the left side of the collection, or when you're walking *the entire* collection linearly |
| 16:35 | bbloom | fifosine1: otherwise, use vectors |
| 16:35 | andyf | that is fairly generic advice, though. If you have performance problems in particular parts of your code, profiling can help find those places and other data structures might help speed up those parts. |
| 16:35 | bbloom | there are other cases, of course, but that's a good rule of thumb |
| 16:45 | gfredericks | ~gfredericks: Yes. The file name |
| 16:45 | clojurebot | gfredericks: Yes. The file name is the interface to implement, and the content is a newline-separated list of the names of the concrete implementations |
| 16:46 | gfredericks | ~sadness and spaghetti |
| 16:46 | clojurebot | <amalloy> weeping willows with cold pasta draped over their limbs, marinara sauce dripping forlornly to the ground, silent splats nobody can hear |
| 16:47 | gfredericks | clojurebot picks up the weirdest things by accident |
| 16:47 | gfredericks | ~tutysara: sorry, not sure what |
| 16:47 | clojurebot | tutysara: sorry, not sure what is up, I'm getting the same thing. May take me some time to figure out and I can't do so now--I'll put something in github issues and update it ASAP. |
| 16:47 | hyPiRion | by accident? |
| 16:48 | hyPiRion | oh right, like the random "this is to me" messages it reads |
| 16:48 | gfredericks | exactly |
| 16:48 | gfredericks | lynaghk: map unification |
| 16:48 | gfredericks | ~lynaghk: map unification |
| 16:48 | clojurebot | lynaghk: map unification is quite simple - it should be easy to see how it should be changed to do what you want for this new type. |
| 16:49 | gfredericks | ~tbaldridge: this |
| 16:49 | clojurebot | tbaldridge: this is why I think tick maybe an OK compromise, allow work to be done in the natural order, pick a respectable granularity, yield for timeout |
| 16:50 | gfredericks | okay last one |
| 16:50 | sveri | Hi, using compojure is there a way to get the request variable and some destructured post variables like this: (POST "/uri" [param1 param2] req (index param1 param2 req))? |
| 16:50 | gfredericks | ~arrdem: There |
| 16:50 | clojurebot | arrdem: There is a refheap API call to edit a paste. I'd happily take a pull request to add this functionality in refheap.el. |
| 16:51 | jeremyheiler | sveri: (POST "/uri" [param1 param2 & req] ...) |
| 16:52 | jeremyheiler | ooops |
| 16:52 | jeremyheiler | sveri: (POST "/uri" [p1 p2 :as req] ...) |
| 16:52 | jeremyheiler | sveri: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax |
| 16:52 | tbaldridge | ~gfredericks: what the? |
| 16:52 | clojurebot | No entiendo |
| 16:53 | tbaldridge | ~gfredericks: this |
| 16:53 | clojurebot | Titim gan éirí ort. |
| 16:55 | sveri | jeremyheiler: thank you, didn't see that one |
| 16:55 | jeremyheiler | sveri: np! |
| 16:55 | gfredericks | tbaldridge: :P |
| 16:57 | gfredericks | ~b: , |
| 16:57 | clojurebot | b: , is white space |
| 16:58 | SagiCZ1 | ~SagiCZ1 |
| 16:58 | clojurebot | Excuse me? |
| 17:00 | arrdem | what the heck.. |
| 17:03 | lxsameer | hey guys, does any one uses emacs + cider ? |
| 17:05 | catern | nope |
| 17:05 | augustl | lxsameer: don't ask to ask, just ask :) |
| 17:05 | catern | everyone here uses Eclipse |
| 17:05 | lxsameer | augustl: ok then |
| 17:05 | arrdem | catern lies like a dog |
| 17:05 | catern | :D |
| 17:06 | arrdem | lxsameer: the last estimate I saw is that Emacs+{Cider,Slime} and Vim+Fireplace is ~75% of Clojure hackers |
| 17:07 | lxsameer | arrdem: really ? I'm new to clojure or any JVM lang, but as far as I see most of jvm related people use Eclipse |
| 17:07 | catern | lxsameer: I was joking |
| 17:07 | catern | I use Emacs+cider |
| 17:07 | augustl | lxsameer: in my experience most jvm peeps use intellij |
| 17:07 | arrdem | lxsameer: depends on how much Java interop you're having to do... if you're using Clojure to wrap a huge Java app of course you'll do better with a strong Java IDE |
| 17:08 | arrdem | lxsameer: if you're just handling a boatload of Clojure code, then the other tools do it better |
| 17:08 | catern | i personally hate Java and wouldn't be caught dead using an IDE |
| 17:08 | catern | (someone reaaaaaaaaally needs to write a guide to Java for Clojure programmers) |
| 17:08 | gfredericks | I thought of that back in the day and then I promptly didn't do it |
| 17:10 | technomancy | a time-honored tradition |
| 17:12 | lxsameer | catern: cool, I setup up cider with clojure mode but i get this error opening a clojure file http://dpaste.com/3G9CCGF do know about it ? |
| 17:12 | lxsameer | arrdem: thanks |
| 17:12 | catern | lxsameer: have you enabled the cider-nrepl lein plugin? |
| 17:12 | lxsameer | catern: yeah I added it to ~/.lein |
| 17:13 | catern | speaking of configuring leiningen... it really should obey the XDG-hierarchy and put its config under .config/leiningen/ |
| 17:14 | lxsameer | catern: really ? but mine is in ~/.lein, and I'm installed lein using the conventional way |
| 17:15 | lxsameer | catern: how can I make sure that leiningen used my conf files ? |
| 17:15 | catern | oh no |
| 17:15 | catern | i was just saying |
| 17:15 | catern | in general |
| 17:16 | catern | totally not specific to you |
| 17:21 | arrdem | tbaldridge: has Bronsa done two or three years of GSoC now? |
| 17:21 | arrdem | I forget |
| 17:22 | tbaldridge | 2 afaik |
| 17:22 | tbaldridge | last year was clojure-in-clojure which resulted in tools.analyzer |
| 17:23 | arrdem | kk |
| 19:07 | sdegutis | What's a good way to name a library? |
| 19:20 | catern | UUIDs |
| 19:22 | sdegutis | Well played sir-or-madam. |
| 19:22 | AeroNotix | sdegutis: I usually just use http://online-generator.com/name-generator/project-name-generator.php |
| 19:22 | sdegutis | Thanks. |
| 19:23 | sdegutis | I'll try doing the whole metaphor thing that the Ruby people do. |
| 19:23 | sdegutis | Aha! "Computer Program." |
| 19:23 | sdegutis | Oh wait. |
| 19:23 | AeroNotix | sdegutis: meta |
| 19:23 | AeroNotix | what does the program do? |
| 19:23 | sdegutis | AeroNotix: I'm sure that's taken. |
| 19:23 | sdegutis | AeroNotix: Oh it like, well... |
| 19:23 | sdegutis | I don't know. |
| 19:23 | sdegutis | It's cool though. |
| 19:24 | gfixler | sdegutis: I named a tool like that once. I called it "MultiTool" |
| 19:24 | AeroNotix | unknownjure |
| 19:24 | sdegutis | LOL got "Metaphor Essential" from http://online-generator.com/name-generator/project-name-generator.php |
| 19:24 | gfixler | sdegutis: then I was going to rename it later; I never did |
| 19:24 | sdegutis | gfixler: Perfect! |
| 19:24 | sdegutis | gfixler: Ah nope, trademarked: http://www.trademarkia.com/trademarks-search.aspx?tn=multitool |
| 19:24 | AeroNotix | sdegutis: I just got "disappointed toothbrush" |
| 19:24 | gfixler | sdegutis: MultipleTool! |
| 19:25 | gfixler | sdegutis: SoManyTool! |
| 19:25 | sdegutis | Ah nice call. |
| 19:25 | sdegutis | Yes that last one works great. Thanks! |
| 19:25 | sdegutis | I'll rename my app to that. Thanks! |
| 19:25 | gfixler | WowSuchUtil |
| 19:25 | sdegutis | Even better. |
| 19:26 | sdegutis | This is my app btw http://hackhydra.com/ |
| 19:26 | sdegutis | Go buy some of it. |
| 19:26 | AeroNotix | I don't own an iProduct |
| 19:26 | gfixler | iDontEither |
| 19:26 | AeroNotix | Who would? Chumps |
| 19:27 | gfixler | I have gridding in Ubuntu |
| 19:27 | gfixler | c/o Compiz |
| 19:27 | gfixler | although I'm really looking into this xmonad thing now |
| 19:27 | AeroNotix | gfixler: I use xmonad -- wanted to use stumpwm |
| 19:27 | AeroNotix | but stumpwm shares groups across screens |
| 19:27 | AeroNotix | so individual screens don't have individual groups, kind of annoying |
| 19:27 | AeroNotix | apparently it can be hacked around |
| 19:28 | gfixler | AeroNotix: you use stumpwm with xmonad? |
| 19:28 | gfixler | or xmonad in place of stumpwm |
| 19:28 | AeroNotix | gfixler: no, stumpwm and xmonad are separate window managers |
| 19:28 | gfixler | right, that's why I was confused :) |
| 19:28 | gfixler | I parsed wrong |
| 19:29 | AeroNotix | xmonad is fine, really. I just really like Lisp and the idea of being able to hack on my WM from emacs and have it evaluated straight away |
| 19:29 | gfixler | I'm learning Haskell, slowly but surely, and I want power over my wm |
| 19:29 | AeroNotix | Haskell doesn't interest me |
| 19:29 | gfixler | whoa, that's what stumpwm does? |
| 19:29 | AeroNotix | Yeah, it's a CL process you can connect to |
| 19:30 | AeroNotix | so you just use SLIME like you would any other CL process |
| 19:30 | gfixler | suddenly stumpwm has become interesting |
| 19:30 | AeroNotix | it's great if you don't mind the way it handles groups |
| 19:30 | gfixler | by 'screens' do you mean monitors? |
| 19:30 | AeroNotix | highly recommend |
| 19:30 | AeroNotix | yeah |
| 19:31 | gfixler | btw, thanks for the answer like 10 hours ago re: (take) |
| 19:31 | AeroNotix | gfixler: no wakkas |
| 19:31 | gfixler | that was locking up on me, but it turns out I was passing it a vector of infinite expressions |
| 19:31 | gfixler | they needed to be separate things to map |
| 19:31 | AeroNotix | gotcha |
| 19:31 | gfixler | obvious, now that it's not 4AM |
| 19:31 | AeroNotix | :) |
| 19:31 | gfixler | man, now I don't know which wm I like more |
| 19:32 | catern | i've never tried stumpwm |
| 19:32 | AeroNotix | I'd definitely give stumpwm a go |
| 19:32 | gfixler | Haskell is super interesting to me, but CL is really awesome, too |
| 19:32 | catern | but AeroNotix has made me interested in CL |
| 19:32 | AeroNotix | catern: every lisper should try CL out :) |
| 19:32 | AeroNotix | it's the most "mature" of the lisps I've used |
| 19:32 | catern | i've never actually used CL, just scheme and clojure |
| 19:32 | gfixler | I made it halfway through PCL, and I like CL quite a bit |
| 19:32 | gfixler | although I prefer Lisp-1s now |
| 19:32 | AeroNotix | gfixler: PCL is a great book :) |
| 19:32 | catern | it appears enterprisey |
| 19:33 | AeroNotix | catern: enterprisey lisp, good one :) |
| 19:33 | gfixler | AeroNotix: I only stopped because it was turning into giant projects |
| 19:33 | AeroNotix | gfixler: lisp1 > lisp2 |
| 19:33 | gfixler | I'd like to revisit them at some point |
| 19:33 | sdegutis | welp |
| 19:33 | catern | AeroNotix: inasmuch as that's possible |
| 19:33 | gfixler | we made sdegutis sad |
| 19:34 | AeroNotix | catern: it's definitely a large lisp |
| 19:34 | gfixler | AeroNotix: is it, or do you think it's possible to have a window over top of a window in stump or xmonad? |
| 19:34 | AeroNotix | and it suffers its "design by committee" roots |
| 19:35 | AeroNotix | gfixler: floating windows are possible in both |
| 19:35 | gfixler | catern: CL has crazy names for everything |
| 19:35 | arrdem | eh.. the Lisp2 argument that "well a bunch of the good names are needed for functions, and locals vs. globals isn't obvious" does make sense to some extent |
| 19:36 | AeroNotix | disagree wholeheartedly, but whatevs, it is what it is |
| 19:36 | catern | i actually prefer shared-workspaces-between-monitors to independent-set-of-workspaces-per-monitor |
| 19:36 | catern | so it sounds good |
| 19:36 | arrdem | you just need an editor that can interface with the analyzer and highlight locals and globals differently :P |
| 19:36 | scottj | gfixler: you can have windows over top of windows in several ways in stumpwm. one is a workspace that's all floating windows. another is multiple windows in the same tiling frame, where one window is limited size like maybe a dialog or a movie window with a different ratio. another way is if you have one window fullscreen, like a video, you can have windows in tiled frames appear over the top of it. |
| 19:36 | AeroNotix | catern: you caveman1 |
| 19:36 | AeroNotix | ! |
| 19:36 | catern | (er, assuming you can mix workspaces) |
| 19:36 | AeroNotix | catern: wdym mix workspaces? |
| 19:37 | catern | AeroNotix: nonsense! it's powerful to be able to move my emacs and terminal workspace to my large monitor or to my small monitor |
| 19:37 | catern | AeroNotix: like, i can independently choose workspaces for the two monitors. the workspace doesn't span across both monitors |
| 19:37 | AeroNotix | catern: exactly -- stumpwm doesn't do this |
| 19:37 | AeroNotix | and I want that behaviour |
| 19:37 | catern | what does it do? |
| 19:38 | catern | one big workspace covering both monitors? |
| 19:38 | AeroNotix | exactly |
| 19:38 | catern | aw, lame |
| 19:38 | AeroNotix | yeah, biggest killer for me |
| 19:38 | AeroNotix | I spent all weekend setting it up getting nerdily exicited (single monitor at home) |
| 19:38 | AeroNotix | got to my multi monitor setup at work and then had a sad |
| 19:38 | catern | hack it yo |
| 19:39 | AeroNotix | X code (even in lisp) makes me puke |
| 19:39 | gfixler | AeroNotix: yeah, that's lame |
| 19:39 | catern | huh, surely it's plenty abstracted already |
| 19:39 | AeroNotix | apparently if stumpwm isn't in xinerama mode then it works with separate groups |
| 19:40 | scottj | catern: not really (having viewed my fair share of stumpwm code) |
| 19:40 | catern | (if clojure wasn't hosted on the jvm we could have a clojure TWM) |
| 19:40 | gfixler | AeroNotix and scottj - I meant that I'd like to have 2 fullscreen windows with the front one a bit transparent |
| 19:40 | AeroNotix | catern: there's no reason why not -- I assume you mean the long startup time/ |
| 19:40 | scottj | gfixler: I think you could do that fine |
| 19:40 | gfixler | e.g. I've had code fullscreened over Autodesk Maya, sending commands through from Vim, and watching things change in the 3D scene |
| 19:41 | gfixler | scottj: transparency levels is a thing? |
| 19:41 | catern | AeroNotix: it just feels wrong to have to boot up a memory-huge JVM just for my window manager |
| 19:41 | AeroNotix | catern: I agree |
| 19:43 | scottj | gfixler: handled by compositor like compton, not window manager. |
| 19:43 | catern | not for long! |
| 19:43 | catern | (wayland) |
| 19:44 | catern | (and that separation is dead in all the DEs anyway) |
| 19:44 | gfixler | scottj: understood - I am a newb in the field of window layout |
| 19:45 | gfixler | DE, WM, compositor... these are just words, really |
| 19:46 | gfixler | Compiz has logical monitors, which I've needed, as I use the Matrox GoofyName TripleHead2Go Digital Edition |
| 19:46 | gfixler | i.e. I have one DVI cable from the card to the Matrox box, and 3 from there to each of my 19" screens |
| 19:46 | gfixler | the computer sees one, 4' wide monitor |
| 19:47 | gfixler | so fullscreen and maximize do their thing across all displays |
| 19:47 | gfixler | I wrangle that with Compiz's "Outputs" |
| 19:47 | gfixler | i.e. with geo strings - 0x0+0+0 |
| 19:48 | gfixler | but with something like xmonad, I think I could make all manner of splits and such |
| 19:49 | gfixler | I'm curious about nesting of logical things - like could I split the 1 group into 3 parts, and then sub-split those in a useful way |
| 19:51 | AeroNotix | gfixler: just try it out |
| 19:51 | AeroNotix | it's easier to see what's possible when you use it |
| 19:52 | gfixler | Ah, the old "Dive Into X" approach |
| 19:59 | catern | hmm |
| 20:25 | justin_smith | gfixler: I've run into issues with some wms and not others, in my experience xmonad and i3 are better behaved than most |
| 20:26 | justin_smith | gfixler: what made me stick with i3 is the fact that when a monitor disappears, it doesn't reshuffle windows that were on that monitor, the "frame" of things that was on that monitor is just detached (and then attachable to any other monitor but configured as it was before in terms of window placement within the monitor) |
| 22:06 | myguidingstar | Hi all, I'm doing TDD with cljx but cljsbuild tends to compile before cljx finishes |
| 22:07 | myguidingstar | as a result, the final javascript is a mix of old and new clojure(script) source |
| 22:09 | myguidingstar | I mean I run "cljbuild auto" and "cljx auto" at the same time |
| 23:16 | allenj12_ | is anyone here familiar with overtone? |