2015-01-04
| 00:08 | chenglou | (count (range)) works fine in cljs but explodes in clojure? |
| 00:08 | chenglou | (clojure 1.6.0) |
| 00:09 | amalloy | what makes you think that, chenglou? |
| 00:09 | chenglou | just tried it |
| 00:10 | chenglou | in cljs it gives me MAX_NUMBER |
| 00:10 | andyf | Sounds like Clojure's behavior is closer to what is documented behavior there. |
| 00:10 | andyf | assuming you got infinite loop? |
| 00:10 | chenglou | yeah |
| 00:13 | chenglou | I kinda find it convenient to be able to to (count (drop 100 infinite-seq)) |
| 00:13 | chenglou | is that a bad pattern? |
| 00:13 | rhg135 | yes |
| 00:14 | rhg135 | imnsho |
| 00:14 | andyf | Why do you find it convenient to count sequences that are not supposed to end? |
| 00:14 | rhg135 | ^ |
| 00:14 | chenglou | because I don't know whether it's an infinite seq or not when it's passed to me |
| 00:15 | chenglou | and I'd like to do make sure its size is bigger than x, then do something with it |
| 00:16 | andyf | Then maybe try (count (take (inc x) sequence)) and see if it is bigger than x? |
| 00:17 | chenglou | that works, thanks |
| 00:18 | rhg135 | chenglou, relying on what seems like a bug is just bad |
| 00:18 | andyf | That and creating infinite loops in your code |
| 00:19 | chenglou | didn't know it was a bug actually, now I know. But it seemed kinda intuitive for me that size doesn't have to rely on the fact that you're evaluating your seq |
| 00:19 | rhg135 | well, should infinte sequences have a count besides infinity? |
| 00:20 | chenglou | no you're right, but that's what I expected to get |
| 00:20 | chenglou | infinity, which is MAX_NUMBER here |
| 00:20 | andyf | Most sequences require evaluating them to count them. |
| 00:20 | rhg135 | actually it might be a bonafide bug that it returns max_number |
| 00:21 | rhg135 | oh im not familiar with js's semantics |
| 00:21 | chenglou | andyf: eh derp, right lol. Alright thanks |
| 00:53 | amalloy | andyf: btw, instead of (>= n (count (take n xs))), instead write (nthnext xs (dec n)) |
| 00:54 | amalloy | maybe an off-by-one error in there somewhere, but that's the general idea |
| 04:14 | didasoft | what is the usage of mapcat? |
| 04:15 | luxbock | didasoft: it's the same as (apply concat (map f coll(s))) |
| 04:20 | amalloy | didasoft: see http://stackoverflow.com/a/5236194/625403 for one example usage |
| 04:24 | didasoft | thanks for the example |
| 05:43 | hellofunk | with Cursive, I'm trying to open an existing project. it says to select an SDK but there are none listed. the Getting Started docs don't mention installing an SDK. how to proceed? |
| 05:48 | justin_smith | hellofunk: by SDK I think hey just mean the jvm installation |
| 05:48 | expez | hellofunk: just install the java 8 sdk using your system's package manager |
| 05:49 | hellofunk | expez: what is my system's package manager? you mean just download the java installer for OSX? |
| 05:49 | hellofunk | it is worth noting that i already have java of course since i've been using clojure for a while with emacs |
| 05:50 | expez | hellofunk: then you just need to figure out how to point cursive to your existing java installation, installing another one probably won't help |
| 05:51 | hellofunk | expez: ok, so anyone know where this installation would be located on OS x? |
| 05:51 | mi6x3m-alt | any experts on autodoc around? how can I put a link to another function? |
| 05:52 | mi6x3m-alt | like See: (boofoo) ? |
| 05:52 | expez | hellofunk: http://stackoverflow.com/questions/18144660/what-is-path-of-jdk-on-mac tl;dr /usb/libexec/java_home seems likely |
| 05:52 | expez | s/usb/usr/ |
| 05:54 | maacl | Does anyone know of a implementation of zip/next that is breadth first instead of depth first? |
| 05:54 | hellofunk | expez: thanks.. of course on OS X by default the usr/ dir is not viewable to GUI file browsers in apps like Cursive. |
| 05:55 | luxbock | maacl: https://gist.github.com/luxbock/4a4cafdcf2522ede6575 |
| 05:56 | expez | hellofunk: Cursive is based on intellij so you might have some luck finding out how they solve that. It's likely an equivalent problem. Perhaps just setting the $JAVA_HOME variable is enough for all I know. |
| 05:57 | maacl | luxbock: Yeah, found that one :-) but I am looking for a implementation of zip/next so I can swap back and forth btw depth first and breadth first in my algorithm. |
| 05:57 | justin_smith | hiding something like /usr/ from a file system browser is so weird |
| 05:58 | maacl | luxbock: And thanks for putting it out there, it helped me solve the problem I was having, now I am trying to make it more flexible. |
| 06:07 | amalloy | maacl: i'm not 100% sure, but i don't think a breadth-first zipper makes sense |
| 06:07 | amalloy | with depth-first you're traversing each edge exactly twice, once down and once up. breadth-first you're bouncing all over the tree |
| 06:15 | maacl | amalloy: Well, that would explain why it is not out there, wnd why I cannot wrap my head around how to do it. |
| 06:16 | amalloy | you can of course traverse a tree in breadth-first order, which is not too hard, but zippers need to do more than that |
| 06:20 | maacl | amalloy: Yeah, I also found your SO answer whic shows it nicely. |
| 06:20 | amalloy | oh? |
| 06:21 | maacl | http://stackoverflow.com/a/11426326/53943 |
| 06:23 | maacl | amalloy: I assume there is just one amalloy? http://stackoverflow.com/a/11426326/53943 |
| 06:23 | amalloy | ah, for traversing it. i was pretty sure i didn't have one about doing it with zippers |
| 06:28 | maacl | amalloy: right. |
| 06:35 | hellofunk | upon installing the latest Cider, when i compile a project that previously worked fine, i get this error, any ideas? error in process filter: Symbol's value as variable is void: clojure--prettify-symbols-alist |
| 06:36 | hellofunk | actually the error happens not upon compilation but upon starting the nRepl server |
| 06:36 | justin_smith | hellofunk: that's an elisp error. I think it means you need a newer clojure-mode |
| 06:36 | justin_smith | hellofunk: I have never upgraded cider without seeing problems like that, it is a very unstable abi |
| 06:37 | justin_smith | also, if you didn't already, be sure to clear out your .elc files too, because those can be compiled against older versions leading to weird errors |
| 06:37 | hellofunk | ok, let me try a few things |
| 06:37 | hellofunk | thanks |
| 06:38 | hellofunk | justin_smith: how do i quickly remove all .elc files that in all dirs in my .emacs.d? |
| 06:39 | justin_smith | hellofunk: you can start with "find . -name *.elc" |
| 06:39 | justin_smith | likely they will be in a small predictable set of places |
| 06:40 | hellofunk | and clojure-mode should be manually uninstalled then re-installed via packages, it is not something covered by the cider installation itself? |
| 06:41 | justin_smith | hellofunk: I'm not certain. It could be your clojure-mode was updated, but cached elc caused your issue, or it could be that your clojure-mode is out of date. |
| 06:43 | hellofunk | justin_smith: does emacs require a restart after doing all this? |
| 06:43 | justin_smith | absolutely, yes |
| 06:44 | hellofunk | ok, see ya later |
| 06:47 | hellofunk | ok, progress. i can start a repl now. but i get this error: WARNING: CIDER's version (0.8.2) does not match cider-nrepl's version (not installed) |
| 06:47 | hellofunk | so i guess cider also does not manage the cider-nrepl installation? |
| 06:47 | hellofunk | i need to uninstall and re-install cider-nrepl? |
| 06:47 | justin_smith | no, that has to be manually updated |
| 06:47 | justin_smith | it's not as much "installing" as asking for the right version in your .lein/profiles.clj |
| 06:48 | hellofunk | and for this emacs ignoramus, should i go to list-packages, delete it from there, and then install again or should i just do a m-x package-install on top of it for cider-nrepl? |
| 06:48 | justin_smith | no, cider-nrepl is a clojure plugin |
| 06:48 | justin_smith | *dep |
| 06:48 | justin_smith | it is not an emacs thing, it just contains things emacs needs |
| 06:49 | justin_smith | so you specify it in your .lein/profiles.clj |
| 06:49 | hellofunk | there is no profiles.clj in my .lein dir |
| 06:49 | justin_smith | then you need to make one |
| 06:50 | hellofunk | ok, how did i live so long with it, interesting |
| 06:50 | justin_smith | if you never needed universally available deps, it probably never came up |
| 06:51 | justin_smith | quoting the README from cider-nrepl "A minimal profiles.clj for CIDER would be: {:user {:plugins [[cider/cider-nrepl "0.8.2"]]}}" |
| 06:53 | hellofunk | ok, so i just create that file, restart repl, trying now |
| 06:54 | hellofunk | i must admit the most frustrating aspect to working in Clojure (everythign else is quite nice) is that it mostly requires developers to also be IDE engineers |
| 06:54 | justin_smith | none of the other IDEs are as bad as cider |
| 06:55 | hellofunk | you mean light table, cursive, etc |
| 06:55 | justin_smith | I actually gave up on it, I use emacs because I have used emacs for over a decade, but I just run a repl via inferior lisp and fuck the rest of it because it's too much hassle |
| 06:55 | justin_smith | light table, night code, cursive, fireplace.vim, etc. |
| 06:56 | hellofunk | glad to know it bothers other also. i upgraded because it is supposed to have much improved cljs support |
| 06:56 | justin_smith | cider is the only one that is that much of a mess |
| 06:58 | hellofunk | wow now i'm getting the odd behavior of when i press enter, the line does not auto indent like it used to (when in a clojure form) |
| 06:58 | justin_smith | there will be a config variable to control that, name probably starts with "clojure-electric..." |
| 06:59 | hellofunk | great, so all my configs were reset or something when i upgraded cider? |
| 06:59 | hellofunk | because this issue didn't used to be there |
| 06:59 | justin_smith | it probably started using slightly different config variable names for some stuff |
| 06:59 | justin_smith | because as mentioned prior, their abi is very unstable |
| 06:59 | justin_smith | they rename stuff a lot |
| 06:59 | hellofunk | i am about to ditch emacs for good right this second. |
| 07:00 | justin_smith | emacs is great, most stuff in the emacs ecosystem is not developed that recklessly |
| 07:00 | hellofunk | i would still use emacs for shell, irc, org mode, etc. but editing clojure in emacs is starting to be a time suck |
| 07:19 | kungi | hellofunk: what would you use instead for clojure development? |
| 07:21 | hellofunk | kungi: trying Cursive as we speak |
| 07:21 | hellofunk | kungi: it's getting quite popular |
| 07:22 | kungi | hellofunk: I heard about it and tried it for a very short time. Then I went back to emacs. |
| 07:22 | hellofunk | Tim Baldridge and David Nolen both seem to like it, that's enough for me to give it a serious look |
| 07:23 | mi6x3m-alt | I am with CCW |
| 07:23 | kungi | hellofunk: I read there is a symbol-renaming refactoring in Cursive have you tried that? |
| 07:24 | hellofunk | kungi: there are quite a lot of refactoring tools built-in and they are increasing in number all the time. but it has other features that are compelling too. |
| 07:31 | hellofunk | justin_smith: and now i also get this odd message every now in then at my cider repl: nREPL: No response handler with id nil found [2 times] |
| 07:33 | justin_smith | weird |
| 08:24 | jonathanj | is there a more idiomatic way of writing: |
| 08:24 | jonathanj | (defn explode [t] |
| 08:24 | jonathanj | (let [mimes (:mimes t [(:mime t)])] |
| 08:24 | jonathanj | (map (partial assoc (dissoc t :mimes) :mime) mimes))) |
| 08:25 | Kristien | I'm having a bit of a pickle with core.async. |
| 08:26 | Kristien | Is there a general guideline of when some publishing service should take a channel or create and return one? |
| 08:27 | Kristien | I think taking one is more flexible. |
| 08:27 | Kristien | Esp. wrt buffering |
| 08:41 | TimMc | jonathanj: Example input/output? |
| 08:47 | jonathanj | TimMc: {:name "Python", :mimes ["text/x-python" "text/x-python-script"]} => ({:name "Python", :mime "text/x-python"} {:name "Python", :mime "text/x-python-script"}) |
| 08:56 | TimMc | jonathanj: What other invariants hold? Could there be both :mimes and :mime? |
| 09:02 | hellofunk | where does the lein executable typically reside on OS X? |
| 09:03 | hellofunk | is it the same as the lein "script" in /bin ? |
| 09:04 | scottj | hellofunk: likely |
| 09:08 | jonathanj | TimMc: yes, there might be, hence the default value for (:mimes ..) |
| 09:11 | sova | hi everyone |
| 09:12 | hellofunk | sova: and hello to you, good tidings and a merry happy new years |
| 09:13 | sova | hellofunk: thank you kind friend, happy new year to you as well (= |
| 09:14 | sova | in learning Ring (ring-clojure/ring), could someone please explain to me how something like (defn app [{:keys [uri]}] {:body (format "you requested %s" uri)}) ... handles/works with the arguments passed to app? the args portion [{:keys [uri]}] is somewhat opaque to me. |
| 09:14 | hellofunk | sova: are you familiar with clojure destructuring? is your question a syntax question or a Ring api question? |
| 09:15 | sova | i am a novice, it is a syntax question |
| 09:15 | hellofunk | ok, that is destructing, a mini-language of sorts building into clojure to allow you to pull out values from maps and vectors that are passed as args |
| 09:15 | hellofunk | in this case, the uri binding is to the value of the :uri key in the map passed to the app fn |
| 09:16 | hellofunk | sova: do a search for clojure destructing and you will get many articles on the syntgax |
| 09:16 | hellofunk | syntax |
| 09:17 | sova | Ahhh. so something like [{:keys [uri scheme query-string]}] would map the corresponding key names to the arguments uri scheme and qs? |
| 09:17 | weavejes_ | sova: Here's the official docs on destructuring: http://clojure.org/special_forms#binding-forms |
| 09:17 | sova | yes, i shall, thank you very much (= |
| 09:17 | sova | oh awesome, you're the best |
| 09:17 | TimMc | jonathanj: cooking, afk |
| 09:32 | Kristien | In (cond x ..., y ...) is it possible to access x and y in ...? |
| 09:33 | AimHere | You mean the cond analogue of if-let? |
| 09:34 | Kristien | Yeah. |
| 09:35 | AimHere | Don't think such a thing exists, but it would be a fun little exercise to write a cond-let macro that expands to nested if-lets |
| 09:40 | mearnsh | spoilers: https://github.com/clojure/clojure-contrib/blob/b8d2743d3a89e13fc9deb2844ca2167b34aaa9b6/src/main/clojure/clojure/contrib/cond.clj#L18 |
| 09:40 | visof | hi guys |
| 09:41 | sova | hey visof, welcome |
| 09:41 | visof | ,(re-find #"\(.*\)" "Hello world (x y z)") |
| 09:41 | clojurebot | "(x y z)" |
| 09:42 | visof | what is the best way to get results from any string contain substring in this format (word1 word2 word3), i want to get word1, word2 and word3 in local var |
| 09:42 | visof | and the rest of the string to another var |
| 09:43 | visof | i can do this with split and replace methods, but i'm asking if there are better ways to do this |
| 09:43 | visof | i can get the rest of the string using this: |
| 09:44 | visof | ,(clojure.string/split (re-find #"\(.*\)" "Hello world (x y z)") #" ") |
| 09:44 | clojurebot | ["(x" "y" "z)"] |
| 09:44 | visof | ,(clojure.string/split "Hello world (x y z)" #" ") |
| 09:44 | clojurebot | ["Hello" "world" "(x" "y" "z)"] |
| 09:44 | visof | ,(clojure.string/split "Hello world(x y z)" #" ") |
| 09:44 | clojurebot | ["Hello" "world(x" "y" "z)"] |
| 09:45 | visof | ,(clojure.string/split "Hello world (x y z)" #"\(.*\)") |
| 09:45 | clojurebot | ["Hello world "] |
| 09:46 | visof | is there a better ways to do this ? |
| 09:46 | Kristien | AimHere: https://gist.github.com/rightfold/0c49f29105a8d67b93ee |
| 09:50 | daGrevis | hello, lispers. how should I call channels (ones from core.async)? {noun}-chan or {verb}-chan? I'm trying to understand how to use them and probs naming would shed some light on it. |
| 09:51 | daGrevis | I have connections-chan now and it actually puts on data listener on that connection when it sees one |
| 09:54 | mearnsh | visof: not claiming this is better, but here's an idea at least https://www.refheap.com/95715 |
| 09:54 | mearnsh | (oops unnecessary nested let) |
| 10:11 | Kristien | AimHere: never mind |
| 10:11 | TimMc | jonathanj: But a map wouldn't have both :mimes and :mime on it, right? Anyway, nothing comes to mind other than possibly using a for expression instead of a map. |
| 10:19 | Kristien | AimHere: never mind the never minding; it's correct :P |
| 10:20 | sova | hehe sounds very zen "nevermind the minding" |
| 10:23 | Kristien | never mind the gap |
| 10:24 | Kristien | Nice, now I can access groups from the first matched regex. |
| 10:25 | sveri | Hi, what is the return value of a go block? |
| 10:26 | nuwanda_ | a channel |
| 10:26 | sveri | nuwanda_: even if I did not create one explicitely? |
| 10:27 | Kristien | Returns a channel which will receive the result of the body when completed |
| 10:27 | Kristien | RTFM :) |
| 10:27 | sveri | the first time I read that in this channel -.- |
| 10:29 | sveri | nuwanda_: thank you |
| 10:36 | expez | Bronsa: you around? |
| 10:39 | arkh | is there an efficient way to conj the items of a vector onto another vector? |
| 10:40 | arkh | it seems like it grows in time linearly to the number of items being conj'ed |
| 10:41 | Kristien | arkh: I can't imagine concat not being the most efficient way to concatenate two vectors. |
| 10:41 | Kristien | Oh wait it returns a lazy seq. |
| 10:42 | arkh | that'd be ok if didn't have O(n) speed |
| 10:43 | Kristien | also Vim sometimes segfaults iff I work on clojure code aargh |
| 10:43 | arkh | I have vectors I'd like to grow up to N items; maybe what I should do is pre-allocate a vector of size N and then assoc items as I go? |
| 10:44 | arkh | Kristien: are you using vim-fireplace? |
| 10:44 | expez | that would also be O(n), no? |
| 10:44 | Kristien | arkh: nope |
| 10:45 | arkh | expez: what I have is a loop that starts with a vector of 1 thing, then I want to put another item at the head of the vector, which in total is O(n!) ? |
| 10:46 | Kristien | In Scala you have VectorBuilder which is similar to StringBuilder. Doesn't Clojure have something similar? |
| 10:46 | arkh | each step is linear |
| 10:47 | arkh | Kristien: it's not part of clojure.core if there is |
| 10:48 | mi6x3m | what do you guys use for testing |
| 10:48 | mi6x3m | what can you recommend? |
| 10:48 | rweir | an army of qa people |
| 10:48 | mi6x3m | clojure.test looks good enough to me |
| 10:48 | expez | mi6x3m: clojure.test is good enough |
| 10:48 | mi6x3m | rweir: good call |
| 10:48 | nuwanda_ | arkh: wouldn't that be a good use case for transients? |
| 10:51 | arkh | nuwanda_: transients wouldn't help with the time to concatenate/push/etc., unfortunately. What they would do is not retain the intermediate data structures ... I think. |
| 10:53 | arkh | oh neat - there's clojure.rrb-vector which allows concatenation of two vectors in logarithmic time https://github.com/clojure/core.rrb-vector |
| 10:55 | arkh | I still think pre-allocation will be fastest though for my narrow use case |
| 11:16 | patrkris | hi folks! how do people here write functions that can both return a desired value but also an error if some condition is not met? do you throw an exception on error, or do you mostly do something like Go, where multiple values can be returned (the desired value and potentially an error)? maybe a third approach? |
| 11:17 | hellofunk | patrkris: all of the above, depending on case |
| 11:17 | hellofunk | personally i return maps with multiple values all the time |
| 11:17 | hellofunk | one of which is often :error key |
| 11:17 | arkh | patrkris: in simpler cases, returning nil in the case of some error conditions is commonly done |
| 11:17 | nuwanda_ | yeah, I usually return something like [:error something] or [:ok something] |
| 11:20 | patrkris | okay, thanks. by the way, how do you "return" from functions early, when some error occurs? in imperative languages, you can just return as soon as possible, but I seem to get myself into a let of nested ifs in Clojure |
| 11:21 | patrkris | *a lot of |
| 11:21 | nuwanda_ | well, usually functions shouldn't be doing a ton of actions, some of which can create an error, those should be smaller functions (sorry if that seems condescending, I know this can't always be helped) |
| 11:23 | sveri | patrkris: catching execptions is part of the answer |
| 11:24 | sveri | patrkris: as it breaks the flow and returns the last statement of (catch) |
| 11:29 | patrkris | sveri: I thought about exceptions, but somehow it just doesn't feel right as an error reporting mechanism. or maybe I've just gained a distaste for exceptions... :) |
| 11:29 | patrkris | I mean if the error condition is not exception, it doesn't feel right |
| 11:30 | patrkris | well, thanks for your answers. later. |
| 11:35 | hellofunk | patrkris the cond macro lets you return without doing other things |
| 11:45 | hellofunk | i'm noticing for the first time that when i save a clj file, it is automatically recompiling any changes without me having to manually do so. is this is a new lein feature? i upgraded to 2.5 earlier |
| 11:46 | hellofunk | or is it something inside chestnut doing this, as i'm using its template for the first time |
| 11:46 | andyf | I am almost certain it is not lein by itself doing that. |
| 11:46 | hellofunk | andyf only ask because lein does this for cljs and wondered if it had somehow added clj to this |
| 11:47 | andyf | The description of chestnut includes "instant reloading" (I've not used chestnut), so that seems more likely where that feature is implemented. |
| 11:48 | bolivier | re |
| 11:48 | andyf | I frequently use lein 2.5.0 with Clojure/JVM only projects, and there is no auto-reloading on file saves. |
| 11:49 | hellofunk | andyf ahh that's probably it. i've upgraded my whole dev workflow and tools this weekend so don't almost know what is causing a new feature |
| 11:49 | hellofunk | s/almost/always |
| 11:56 | l3dx | what am I doing wrong? Referred var fressian-cljs.fns/lookup does not exist at line 1 file:/home/thomas/.m2/repository/net/unit8/fressian-cljs/0.1.0/fressian-cljs-0.1.0.jar!/fressian_cljs/reader.cljs |
| 12:00 | muhuk | l3dx: can you paste (pastebin, dpaste etc) your code |
| 12:00 | andyf | Yeah, a link to a file on your local file system doesn't help us much. |
| 12:02 | l3dx | I was hoping someone had seen that particular error before. I tried googleing it without any luck. the file referred to is deep inside some transient dependency |
| 12:02 | l3dx | but hang on and I`ll paste some code |
| 12:03 | l3dx | https://gist.github.com/tskardal/4c149a1d8a5050b76a06 |
| 12:04 | muhuk | l3dx: that's odd, this code doesn't refer lookup or fressian. |
| 12:04 | muhuk | l3dx: paste the traceback please. |
| 12:07 | l3dx | the gist is updated |
| 12:14 | muhuk | l3dx: weird. Unless I'm missing something... See here's the import https://github.com/kawasima/fressian-cljs/blob/master/src/cljs/fressian_cljs/reader.cljs |
| 12:14 | muhuk | l3dx: and there's no lookup in https://github.com/kawasima/fressian-cljs/blob/master/src/cljs/fressian_cljs/fns.cljs |
| 12:15 | l3dx | muhuk: thanks for looking into it. I'll take some steps back and try to figure out what introduced the problem |
| 12:15 | l3dx | git stash takes me to a working state at least |
| 12:17 | muhuk | l3dx: I think there's a bug in freesian-cljs |
| 12:17 | muhuk | l3dx: not in your code. |
| 12:17 | muhuk | l3dx: (I might be wrong of course) |
| 12:25 | dnolen_ | chenglou: that's definitely a bug in Range, works by accident |
| 12:26 | dnolen_ | chenglou: and that won't be truly for many infinite lazy seqs - Range can be bounded so there's some bad arithmetic that makes that work |
| 12:26 | Glenjamin | dnolen_: do you know if there's any active work on CinC for clojurescript going on? I'd be keep to pitch in, but I have no idea where to start |
| 12:28 | andyf | Glenjamin: There are the tools.analyzer and tools.analyzer.js libraries. I haven't used tools.analyzer.js yet, but have tested tools.analyzer and tools.analyzer.jvm via my use of them from Eastwood. |
| 12:30 | andyf | If by CinC you mean "ClojureScript-in-ClojureScript" then I don't know what might be happening in that area. |
| 12:30 | Glenjamin | i did, yeah |
| 12:30 | Glenjamin | presumably there's some crossover |
| 12:32 | andyf | well, other than that most of tools.analyzer and tools.analyzer.js are likely to be valid ClojureScript code. |
| 12:32 | dnolen_ | Glenjamin: https://github.com/clojure/clojurescript/wiki/Bootstrapping-the-Compiler |
| 12:32 | dnolen_ | Glenjamin: got sick of answering this so I made a page :) |
| 12:33 | dnolen_ | Glenjamin: there's not much left to do |
| 12:34 | Glenjamin | oo, neat |
| 12:37 | Glenjamin | would a portable tools.reader need to be a fork, or some extension to the existing one that makes it work on cljs + clj ? |
| 12:40 | Bronsa | dnolen_: "Native macroexpander - currently we rely on Clojure's" huh? doesn't cljs implement its own macroexpand-1? |
| 12:40 | dnolen_ | Glenjamin: needs discussion with Bronsa, whether tools.reader.js is desirable |
| 12:41 | Bronsa | Glenjamin: dnolen_ I don't have time to port t.reader to cljs myself but if anybody wants to contribute, I'd rather keep the cljs version along the clj one, a la core.async |
| 12:42 | Glenjamin | i can certainly have a go, i do quite a lot of node so the port itself should be easy enough |
| 12:42 | Glenjamin | i don't have any exp with making a project run on clj+cljs though |
| 12:43 | Bronsa | dnolen_: or did you mean the syntax-quote auto-qualifying thing? |
| 12:43 | dnolen_ | Bronsa: oops right, removed that - yes auto-qualitfying |
| 12:43 | dnolen_ | Bronsa: though that's handleable by the reader now |
| 12:44 | Bronsa | yeah |
| 12:44 | dnolen_ | Glenjamin: so even less to do, tools.reader & parameterized source |
| 12:44 | dnolen_ | Bronsa: ok k, cool that we can keep cljs stuff in same source tree |
| 12:45 | Bronsa | dnolen_: eventually with feature expressions I'd rather have it merged -- most of the platform specific bits in t.reader are just for performance |
| 12:45 | dnolen_ | Bronsa: yep |
| 12:50 | Bronsa | there might be some hooks to add to tools.reader to support cljs auto-qualification as I don't want to have t.reader depend on cljs |
| 12:50 | Bronsa | (that could also be problematic for circular deps) |
| 12:56 | Glenjamin | any pointers for starting a tools.reader port? I'm not really sure how to start running under node |
| 12:59 | dnolen_ | Glenjamin: Glenjamin you can start by being able to read strings, then worry about reading from urls/disk etc. |
| 13:00 | jonathanj | TimMc: what about the (assoc (dissoc m :key) :new-key value) pattern? seems like there might be somet other way of spelling that |
| 13:01 | Glenjamin | dnolen_: it's more the mechanics of getting some code running i'm not clear on |
| 13:01 | Glenjamin | would the idea be to have cljs namespaces which have the same interfaces as their jvm counterparts? |
| 13:04 | dnolen_ | Glenjamin: sorry don't have time to answer these questions - also they are easily answered if you look at portable Clojure libraries |
| 13:04 | Glenjamin | ok, cheers |
| 13:04 | dnolen_ | Glenjamin: see core.match |
| 13:04 | Glenjamin | i'll have a read through |
| 13:05 | Glenjamin | right, this makes sense - should be enough to get started |
| 13:05 | Glenjamin | thanks for the pointers |
| 13:17 | dnolen_ | running CLJS REPLs w/o 3rd party runners https://github.com/clojure/clojurescript/wiki/Running-REPLs |
| 13:26 | dnolen_ | Bronsa: hrm btw what does the reader return for Ctrl-D? Trying to figure out how to support exit in ClojureScript REPLs on Ctrl-D, I'm assuming this will be read by tools.reader |
| 13:33 | dnolen_ | Bronsa: hrm, I suppose we should just read in directly and only invoke the reader when we think we have a form same as clojure.main's REPL ... |
| 13:34 | justin_smith | dnolen_: wouldn't Ctrl-D in a terminal not be a character you handle, but rather a signal you handle? |
| 13:35 | dnolen_ | justin_smith: yeah that's what I'm thinking same as the Clojure REPL |
| 13:36 | Bronsa | dnolen_: handling Ctrl-D is not really the job of t.reader |
| 13:36 | dnolen_ | Bronsa: yep figures as much, was just thrown by the default behavior of CLJS REPLs just to read directly from reader |
| 13:36 | dnolen_ | Bronsa: not behavior that I wrote |
| 13:42 | Kristien | My Clojure code works! I'm a heroine. |
| 13:45 | mpenet | core.async question: is there a way to know if a put! on a channel is queued or not, no matter the channel under the hood (it's user supplied in my case) |
| 13:45 | mpenet | seems not, but I might be wrong |
| 13:46 | justin_smith | mpenet: even if you controlled the channel, the only way to know the ocntents is to remove them |
| 13:46 | justin_smith | *contents |
| 13:47 | rlb | Kristien, arkh: another option is to just accumulate the strings, and then (apply str coll). |
| 13:47 | mpenet | I hoped I could avoid this, but well... |
| 13:48 | Kristien | rlb: another option for what? |
| 13:48 | lasergoat | mpenet: you have a callback for when it does go onto the channel |
| 13:48 | rlb | wrt stringbuilder, etc. |
| 13:48 | Kristien | About the vector concatenation? |
| 13:49 | justin_smith | rlb: they weren't talking about building a string, just using StringBuilder as an analogy |
| 13:49 | rlb | justin_smith: oh... nevermind |
| 13:50 | justin_smith | for efficient concatenation, you want a datatype that supports that, either lazy-seq or rrb-trees or finger trees I think? |
| 13:50 | mpenet | lasergoat: I know, but this is not good enough in my case, I need to know when it's queued. I need this to handle backpressure. So if put is queued, suspend reads and resume after put succeeds, hopefully without suspending everytime I try to read first, even tho this could be considered |
| 13:50 | l3dx | muhuk: I think you're right. Seems to be a problem with the library chord. I get the same error when doing a 'lein cljsbuild once' in its example project |
| 13:51 | justin_smith | mpenet: shouldn't parking behavior with channel put automatically cover this? |
| 13:51 | mpenet | I guess I ll have to dig into the java code I am hooking into and see the implications |
| 13:51 | l3dx | or, maybe not actually with chord, but in my case it was the addition of that library that caused it |
| 13:52 | mpenet | justin_smith: it's a bounded queue under the hood, so not good enough |
| 13:52 | the-kenny | dnolen_: Sorry for tweeting - are you aware that - when waiting for a browser to connect - there's no way to cancel? :cljs/quit (as mentioned) obviously doesn't work, as the repl isn't started yet, and Ctrl-c brings everything into some broken state which is neither a cljs nor a clojure repl |
| 13:52 | justin_smith | mpenet: it will still park if it is waiting on room |
| 13:52 | the-kenny | (I can't even stop the process anymore - I have to kill it) |
| 13:53 | lasergoat | mpenet: i guess i'd ask why you're using put! at all |
| 13:53 | mpenet | justin_smith: on a go block yes, but it's again a queue under the hood, after 1024 parks it starts loosing data if am not wrong |
| 13:53 | lasergoat | instead of >! or >!! |
| 13:53 | justin_smith | mpenet: you get to decide whether it's a blocking or dropping queue, blocking is the default |
| 13:53 | the-kenny | (I'm starting a browser-repl from an existing lein-repl. Cider is completely broken, but that's another topic) |
| 13:54 | mpenet | justin_smith: yeah but fixed/global nb of threads with go blocks, potentially starved easily |
| 13:55 | justin_smith | lasergoat: yeah, good point, shouldhe should use one of those |
| 13:55 | mpenet | justin_smith: I want to avoid using them in this case |
| 13:55 | justin_smith | parking does not consume a thread from the pool |
| 13:57 | lasergoat | mpenet: >! in a go block = do a put!, monitor the callback, when lands in the queue, resume where you were. it's all done by rewriting your code to use callbacks, so it's not burning threads. |
| 13:57 | justin_smith | (inc lasergoat) |
| 13:57 | lazybot | ⇒ 1 |
| 13:58 | lasergoat | mpenet: basically, what you're trying to do is exactly what go blocks are designed to do for you |
| 14:06 | lasergoat | i have a ring question. i have my server behind an ssl-unwrapping proxy, so all my ring server sees is the http request, plus an X-Forwarded-Proto header. I want to make the redirects generated by ring go to the https address. How should I handle that? |
| 14:07 | lasergoat | for example, i could ignore it and have the proxy do a second redirect. But ideally, I'd like to have a piece of middleware say "hey, this redirect should be to the https version of this url" |
| 14:07 | justin_smith | {:status 30[x] :body "https://example.com"} as your response |
| 14:08 | lasergoat | right, so i have to know my absolute url |
| 14:08 | lasergoat | which is unfortunate |
| 14:08 | justin_smith | it will be in the incoming request |
| 14:09 | mpenet | lasergoat: not really, it doesn't solve anything in this particular case (at least not to the question I asked), using a go block with a "callback" after the action or checking the callback on put! is (nearly) the same, it doesn't let me know before hand if I can try to put in the channel. I have to do some book-keeping myself, which is fine |
| 14:09 | lasergoat | justin_smith: true enough. i guess i just need a piece of middleware that makes absolutizes the request and then subs in https |
| 14:09 | lasergoat | justin_smith: ok, thanks, i'll do that |
| 14:10 | justin_smith | mpenet: in a go block, using >! why would you need to do any callback or checking at all? |
| 14:10 | lasergoat | mpenet: what do you want to happen if you can't put! on the channel? |
| 14:10 | justin_smith | the go block will park, and let go of its thread, until the data is written to the channel |
| 14:11 | mpenet | suspend reads on a socket, via an ext api |
| 14:12 | justin_smith | (go (suspend-reads) (>! c d) (resume-reads)) |
| 14:13 | justin_smith | you don't need callbacks in core.async |
| 14:13 | mpenet | I don't want to suspend on every inputs... I only want to suspend when parking occurs |
| 14:14 | AeroNotix | Which is the latest version of CIDER that isn't going to make me crazy? |
| 14:14 | mpenet | anyway, as I said, I can do it without using only core.async api, thx for the suggestions |
| 14:14 | justin_smith | AeroNotix: Mu |
| 14:14 | AeroNotix | I'm on 0.8.0-snapshot apparently. |
| 14:15 | hellofunk | AeroNotix: my experiences with a Cider upgrade today made me sit down and spend the rest of the day on Cursive instead |
| 14:15 | AeroNotix | hellofunk: put your .emacs.d in VCS, install latest => check it out => decide to keep? |
| 14:15 | AeroNotix | not a whole-day thing :) |
| 14:17 | justin_smith | AeroNotix: so you are putting compiled files into version control? |
| 14:17 | AeroNotix | justin_smith: just the .el files |
| 14:17 | mpenet | justin_smith: btw using (suspend) (put! c x (fn [] (resume))) would be the same, without requiring all the magic of go blocks, but again this is not what I was looking for |
| 14:18 | justin_smith | AeroNotix: elc files can fuck your shit up if they aren't in sync, and the package code generates them |
| 14:18 | AeroNotix | justin_smith: yes, which is why I never use elc files if I can help it. |
| 14:20 | the-kenny | For the record: There's `load-prefer-newer' in emacs24 which should get rid of most mess caused by outdated elc files |
| 14:21 | AeroNotix | the-kenny: or just, y'know, don't use elc files at all. |
| 14:21 | AeroNotix | if you're a serious emacs user and you're not using emacs --daemon, you're doinitwrong |
| 14:23 | Jaood | until it freezs and crashes |
| 14:23 | AeroNotix | systemctl --user restart emacs |
| 14:23 | AeroNotix | done :) |
| 14:23 | the-kenny | (systemd debate incoming) |
| 14:23 | AeroNotix | you can easily do the same with other init systems |
| 14:24 | the-kenny | I know, I'm just joking |
| 14:24 | AeroNotix | my point was that using emacs --daemon really is the way to go |
| 14:24 | Jaood | AeroNotix: does that sends a HUP? |
| 14:24 | justin_smith | the-kenny: proposed: systemd is the cider of init systems |
| 14:24 | AeroNotix | justin_smith: denied |
| 14:24 | the-kenny | justin_smith: I actually enjoy systemd. But I don't have that much contact with it by using NixOS. |
| 14:24 | AeroNotix | Jaood: no, the way I've got it set up it just kills the pid |
| 14:28 | dnolen_ | the-kenny: hrm, probably need to listen for kill even booting - someone should submit a patch for that - too many other things in my own queue |
| 14:29 | dnolen_ | the-kenny: there's going to be quite a bit of REPL churn for a couple of week, things have been subpar for far too long as most of the changes are bringing all official CLJS REPLs into parity with Clojure's REPL |
| 14:29 | the-kenny | dnolen_: yup, I'm aware of that. And I agree it's the right direction. I really like the startup time |
| 14:30 | dnolen_ | the-kenny: http://dev.clojure.org/jira/browse/CLJS-961 |
| 14:31 | dnolen_ | the-kenny: the same, it's funny how 30 second startup time causes people to not use it |
| 14:32 | the-kenny | I am happily using weasel right now - I just connect two sessions via cider and have one running a clojure and one a clojurescript repl. Weasel has some quirks though |
| 14:34 | lasergoat | justin_smith: better answer to my proxy question turned out to be using this: https://ring-clojure.github.io/ring-headers/ring.middleware.proxy-headers.html, which is a middleware that uses the address the proxy adds to the headers, and makes it so when i absolutize the url it just incorporates https automatically |
| 14:34 | dnolen_ | the-kenny: yeah, the recent changes should hopefully help eliminate those - Weasel is very simple |
| 14:34 | dnolen_ | the-kenny: in fact people should examine the Node.js REPL and submit a PR to Weasel, mfikes may already be working on that? |
| 14:34 | the-kenny | I think there's an WIP fork, yeah |
| 14:35 | lasergoat | my biggest issue with weasel is that it can only do one session at a time |
| 14:35 | the-kenny | hu? |
| 14:35 | lasergoat | or so it seemed, anyway |
| 14:36 | lasergoat | i got some pretty weird behavior connecting more than one JS environment to it |
| 14:37 | justin_smith | lasergoat: cool, I did not know about that particular middleware |
| 14:40 | lasergoat | justin_smith: took me a bit to realize the proxy's job was to tag the request appropriately and the server's job to use that info. until i understood that i didn't know to look for it |
| 14:41 | dnolen_ | lasergoat: that only really makes sense if all the connecting sessions represent the same build - the analysis environment needs to match |
| 14:42 | the-kenny | dnolen_: for my understanding: A running REPL will continuously check the 'current' analysis environment, right? E.g. Changing a file, reloading the browser, then evaluating stuff in the repl will work fine, right? |
| 14:43 | dnolen_ | the-kenny: that's right, REPL can now always match the state of the build efficiently |
| 14:43 | dnolen_ | the-kenny: the whole point of analysis caching |
| 14:43 | dnolen_ | keeping everything in sync always |
| 14:43 | the-kenny | Perfect :) |
| 14:44 | the-kenny | Now we just need a way to read the current :output-dir from profile.clj instead of hardcoding it ;) (which isn't pretty hard, I know) |
| 14:44 | dnolen_ | the-kenny: this is the reason Node.js REPL can boot in <1s on my work machine |
| 14:44 | the-kenny | ohhhh I need to try that |
| 14:44 | dnolen_ | it doesn't actually do anything except read some EDN |
| 14:44 | the-kenny | I just tried the browser-repl |
| 14:44 | lasergoat | dnolen_: my particular use case is a browser extension that has a "background" and "content" script. right now, i launch separate repls run weasel on a different port on each |
| 14:46 | lasergoat | dnolen_: i guess the right thing for me to do is have one build and just a thin JS wrapper that calls into different externs in the same CLJS build |
| 14:47 | lasergoat | dnolen_: if I did that, maybe i could get multiple connections to work |
| 14:47 | dnolen_ | lasergoat: or just write your own tiny bit of code that launches two weasel REPLs |
| 14:47 | dnolen_ | people need to start looking out how all this stuff actually works :) |
| 14:47 | dnolen_ | https://github.com/clojure/clojurescript/wiki/Running-REPLs |
| 14:47 | gfixler | Failed to download https://leiningen.s3.amazonaws.com/downloads/leiningen-2.3.4-standalone.jar |
| 14:48 | muhuk | l3dx: good luck. I'd take a closer look at those 2 files in fressian-cljs first and file a bug report there. |
| 14:48 | gfixler | 403 forbidden - anyone know what this is about? |
| 14:48 | lasergoat | dnolen_: yeah, i didn't realize that would work |
| 14:48 | muhuk | l3dx: perhaps also create a minimal module to reproduce the issue. |
| 14:49 | the-kenny | gfixler: 2.3.4 is quite old - it might be that the jar isn't hosted on aws anymore (given that new jars are hosted on github) |
| 14:50 | gfixler | the-kenny: where is that version specified? |
| 14:50 | gfixler | I just grabbed the lein script from the lein site, ran it, and tried lein repl |
| 14:51 | the-kenny | https://github.com/technomancy/leiningen/releases |
| 14:51 | l3dx | muhuk: I'm completely unfamiliar with that lib. I only use it as a transient dependency. However, I've reported an issue at the library I'm actually using. The example project there doesn't compile either |
| 14:51 | the-kenny | gfixler: That's a bit strange. The current lein script definitely fetches 2.5.0 |
| 14:52 | gfixler | maybe I just need to delete my .lein folder |
| 14:52 | gfixler | I upgraded recently, this is my first attempt to fire up lein again |
| 14:52 | the-kenny | also check $PATH |
| 14:52 | the-kenny | might be you have a system installed lein somewhere which overrides the downloaded |
| 14:53 | gfixler | strange - my ~/.lein folder only has self-installs/leiningen-2.5.0-standalone.jar in it |
| 14:54 | the-kenny | that really sounds like it's using a lein installed by your package manager or something |
| 14:54 | gfixler | how strange - I don't recall setting up lein or clojure since reinstalling my OS a few weeks ago |
| 14:55 | gfixler | aah, I think I see |
| 14:55 | gfixler | it's my .dotfiles, which are versioned |
| 14:56 | gfixler | yeah, that was it - I had an old lein in ~/.dotfiles/scripts - unversioned, but I dumped scripts back in there from a thumbdrive |
| 14:57 | gfixler | moved it, and now lein repl works |
| 14:57 | gfixler | thanks, the-kenny! |
| 14:57 | the-kenny | you're welcome |
| 14:57 | gfixler | for posterity, I found that out with `whereis lein` => ~/.dotfiles/scripts/lein |
| 15:00 | justin_smith | gfixler: funny - "whereis lein" returns nothing of interested for me, but "which lein" shows its location |
| 15:00 | gfixler | justin_smith: hmmm, different distros, perhaps? |
| 15:02 | justin_smith | gfixler: "BUGS ... whereis has a hard-coded path, so may not always find what you are looking for" |
| 15:02 | justin_smith | (debian based system) |
| 15:02 | gfixler | justin_smith: same |
| 15:03 | gfixler | which lein => /home/gfixler/scripts/lein; whereis lein => lein: /home/gfixler/.dotfiles/scripts/lein |
| 15:04 | gfixler | looks like whereis follows the scripts directory symlink |
| 15:15 | augustl | anything built-in to get the ex-info out of an exception where the actual IExceptionInfo exception is in the causedBy chain? |
| 15:17 | andyf | augustl: Not in core that I?m aware of |
| 15:17 | augustl | time to find a way to create a lazy seq out of the chain then :) |
| 15:18 | andyf | (take-while identity (iterate some-fn exc)) might work |
| 15:21 | augustl | just (iterate #(.getCause e) e) could work too? |
| 15:21 | augustl | or will it fail when it gets the first null cause? |
| 15:24 | andyf | augustl: Try and see :) If so, the take-while identity can help |
| 15:25 | augustl | ah, right, that's what that's for |
| 15:27 | mi6x3m | Clojure, how come 'lein test' is not counting executed tests when they are executed on another thread |
| 15:28 | augustl | (defn get-caused-exceptions-chain [^Exception e] (if (nil? e) nil (cons e (lazy-seq (get-caused-exceptions-chain (.getCause e)))))) works |
| 15:28 | augustl | the chain is typically not that long though so making it lazy is a bit silly |
| 15:30 | andyf | mi6x3m: Just a guess: the counts are maintained in some dynamic var that gets its own value in other threads? |
| 15:31 | irctc | QUESTION: CODE: (def men (db [man 'Bob][man 'John])) ---> How can I add a new value to db? tried merge and "->". Its a syntax question. Please help me. |
| 15:31 | mi6x3m | andyf: very possible |
| 15:31 | mi6x3m | this ain't good though |
| 15:34 | andyf | Look at function clojure.test/test-ns, which does a binding on dynamic var *report-counters*. That may be the root cause. |
| 15:35 | andyf | There might be a way to pass that on to other threads using bound-fn |
| 15:36 | hellofunk | how can you select a block of code and auto-indent all the lines appropriately, in Cursive? |
| 15:37 | mi6x3m | andyf: yes found report-counters also |
| 15:38 | mi6x3m | andyf: can you suggest some way of influencing that? |
| 15:40 | andyf | mi6x3m: How are you creating mutliple threads in your test suite? |
| 15:41 | justin_smith | irctc: what does that db call return? |
| 15:43 | irctc | justin_smith: says it is a PersistentArrayMap :( |
| 15:43 | mi6x3m | andyf: I am running tests on the AWT event dispatching thread |
| 15:43 | mi6x3m | because I have to |
| 15:44 | justin_smith | irctc: OK, than try (conj men [man 'Tod]) |
| 15:44 | justin_smith | irctc: or (assoc men man 'Todd) |
| 15:46 | andyf | mi6x3m: I haven't done that before, but if you can somehow pass a function to that AWT thread for execution using bound-fn, such a function should have the same dynamic vars bound as the thread where bound-fn is called. |
| 15:56 | mi6x3m | andyf: didn't quite get that :) but anyhow, this should be somewhat easier |
| 15:58 | augustl | I get an error with :source-paths and :java-source-paths. Seems my clojure code is complied first so I get a "java.lang.ClassNotFoundException" because it doesn't seem to have compile the java code when it tries to compile the clojure code |
| 15:58 | augustl | I'm trying to implement my own custom exception class |
| 15:59 | mearnsh | augustl: try adding it to :aot in your profile.clj |
| 15:59 | augustl | mearnsh: it being the java class? |
| 16:00 | mi6x3m | andyf: I might as well just define a macro deftest-awt which executes the test through invoke-now |
| 16:00 | mearnsh | augustl: the namespace |
| 16:01 | augustl | mearnsh: hmm, that didn't help |
| 16:01 | mearnsh | lein compile |
| 16:01 | augustl | mearnsh: same problem |
| 16:02 | augustl | hmm, code that refres to my java class is referred to in a clojure ns with (:gen-class) |
| 16:02 | augustl | perhaps that's the problem |
| 16:03 | mearnsh | is the java class the exception you're extending? |
| 16:05 | augustl | mearnsh: yep |
| 16:06 | mearnsh | :gen-class is fine |
| 16:07 | mearnsh | you could try calling compile on the ns |
| 16:08 | augustl | even "lein javac" failed with that error |
| 16:31 | muhuk | Should I just use hash-map here? Or does it make sense to try making a map literal? {~@(mapcat #(vector (keyword %) %) params)} |
| 16:31 | muhuk | It fails saying map literal must have even number of args. |
| 16:31 | justin_smith | I wouldn't even call that a literal |
| 16:31 | justin_smith | since the whole thing is generated |
| 16:32 | justin_smith | apply hash-map, or use into |
| 16:32 | justin_smith | or, I should say - it has none of the advantages of using a literal |
| 16:32 | andyf | Pretty sure that ~@ cannot be used that way to make maps. |
| 16:32 | justin_smith | so why hold on to the annoying part |
| 16:34 | muhuk | yeah, I'll just use hash-map |
| 16:35 | justin_smith | &`{~@[:a 0] ~@[:b 1]} ;; there is *this* sort of monstrosity |
| 16:35 | lazybot | ⇒ {:b 1, :a 0} |
| 16:35 | justin_smith | but that's messed up |
| 16:35 | andyf | Save that for the International Obfuscated Clojure Code Contest |
| 16:35 | justin_smith | yeah, seriously |
| 16:36 | justin_smith | also it only works if you have an even number of ~@[...] blocks in the {} |
| 16:37 | justin_smith | &`{~@[:a 0 :b] ~@[1 :c 2]} ;; wow, I found a way to make it even worse |
| 16:37 | lazybot | ⇒ {:c 2, :b 1, :a 0} |
| 16:38 | hellofunk | justin_smith: lol |
| 16:44 | TimMc | andyf: You just need to add a ~@[] to balance things out as necessary. |
| 16:44 | andyf | For the IOCCC, yes :) |
| 16:44 | TimMc | &`{~@(range 4) ~@[]} |
| 16:44 | lazybot | ⇒ {0 1, 2 3} |
| 16:44 | justin_smith | oh, good point |
| 16:44 | TimMc | (inc hyPiRion) ;; for that one |
| 16:44 | lazybot | ⇒ 59 |
| 16:45 | justin_smith | we should name ~@[] "sperm whale" |
| 17:07 | hyPiRion | That's how to implement hash-map in swearjure |
| 17:07 | hyPiRion | (def hash-map #([`{~@%& ~@()}](+))) |
| 17:10 | zophy | is somebody going to ban hyPiRion ? |
| 17:10 | justin_smith | ? why would they? |
| 17:11 | zophy | i think he's a radical |
| 17:11 | hyPiRion | burn the witch with the crazy non-alphanumeric solutions |
| 17:21 | hellofunk | hyPiRion: what is the point of the (+) |
| 17:24 | hyPiRion | hellofunk: ##({:foo :bar}) isn't legal because you cannot call a map with itself |
| 17:24 | lazybot | clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap |
| 17:24 | hyPiRion | so ##([{:foo :bar}](+)) is just a way of getting around that, so we can return the map itself |
| 17:24 | lazybot | ⇒ {:foo :bar} |
| 17:24 | justin_smith | &(#([{:a 0}] 0)) |
| 17:24 | lazybot | ⇒ {:a 0} |
| 17:25 | justin_smith | (slightly less obfuscated) |
| 17:25 | hyPiRion | and (+) is 0 so it'll return the first argument to the list [...] |
| 17:25 | hellofunk | ah, ok. cryptic. |
| 17:25 | ddima | hyPiRion: thanks, inspired me to dig up your post, trying to find out how that works ;) |
| 17:25 | hellofunk | reminds me of swearjure |
| 17:29 | justin_smith | because it is |
| 17:30 | ddima | hyPiRion: haven't encountered that yet, but it almost begs for some platform like bash/perl/vimgolf ;) |
| 17:43 | TimMc | ~swearjure |
| 17:43 | clojurebot | there is no do |
| 17:44 | TimMc | ... |
| 17:44 | TimMc | ~swearjure |
| 17:44 | clojurebot | there is no do |
| 17:44 | TimMc | I... see. |
| 17:44 | TimMc | hellofunk: http://www.hypirion.com/musings/swearjure |
| 18:17 | irctc | any namespace and symbols guru please PM me ) |
| 18:17 | mi6x3m | does anyone know of a larger library using midje? |
| 18:17 | Bronsa | irctc: please ask your question in channel if you want an answer |
| 18:18 | hyPiRion | ddima: yeah, it does. There is http://maurits.wordpress.com/2014/12/29/the-international-obfuscated-clojure-coding-contest/ though, hoping it will get some traction |
| 18:18 | ddima | thanks :) |
| 18:18 | irctc | i have a foo symbol as function and macro parameter all over my code. i need to replace it with "foo" (a variable). how can i do it? |
| 18:19 | irctc | i mean i need this symbol to be able to change it's name dynamicaly |
| 18:19 | irctc | all combinations of name(symbol(resolve(whatever are tryied |
| 18:20 | irctc | if clojure is a dynamic language than how can i? |
| 18:20 | AeroNotix | irctc: show example code |
| 18:20 | dweave | why do u need to do this |
| 18:22 | irctc | (db-rel likes x y) |
| 18:22 | irctc | (def facts |
| 18:22 | irctc | (db-fact likes 'Bob 'Mary) |
| 18:22 | irctc | (db-fact likes 'John 'Lucy)) |
| 18:23 | irctc | it's a core.logic library. i need this likes to be "likes" (dynamicaly changable variable, not hardcoded) |
| 18:23 | AeroNotix | irctc: use a paste service, like refheap |
| 18:24 | AeroNotix | now show the macro db-fact |
| 18:24 | AeroNotix | ,doc resolve |
| 18:24 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0:0)> |
| 18:24 | AeroNotix | ffs |
| 18:24 | irctc | https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/pldb.clj#L79 |
| 18:24 | AeroNotix | oh right, it's not your code. Well, the macro author needs to do that |
| 18:24 | justin_smith | AeroNotix: db-fact is from core.logic, it is a macro that expands to a def form |
| 18:24 | AeroNotix | you can't do it from your code |
| 18:25 | AeroNotix | because macros |
| 18:25 | justin_smith | AeroNotix: he can, it just requires using yet another macro |
| 18:25 | AeroNotix | justin_smith: yeah? |
| 18:25 | AeroNotix | oh right yeah if you want to wrap db-fact |
| 18:25 | AeroNotix | but, blegh |
| 18:25 | justin_smith | just the same way core.logic used db-fact to wrap def, yeah |
| 18:25 | justin_smith | yeah, it sucks |
| 18:25 | irctc | can anybody provide a working code? i tryied everything |
| 18:26 | trptcolin | that link doesn't look like a macro to me |
| 18:26 | trptcolin | db-rel looks like one |
| 18:26 | AeroNotix | ah you're right |
| 18:26 | irctc | guys it's all about namespace is'nt it? just need to make clojure to treat "likes" = likes |
| 18:27 | justin_smith | trptcolin: yeah, you're right- I was communicating with irctc about this early and failed to notice this was a different function this time |
| 18:27 | AeroNotix | irctc: what exactly is the error you're getting (remember use a paste service) |
| 18:27 | AeroNotix | Also, no-one is just going to drop working code into your lap. |
| 18:27 | irctc | it's sad because it's a syntax question |
| 18:28 | AeroNotix | Not by the way you've phrased the question, no. |
| 18:28 | AeroNotix | Hence me asking for example code and error output |
| 18:28 | irctc | in any dynamic language including javascript or php you can access anything by value |
| 18:28 | AeroNotix | So we can see what is really going on, sans your diagnosis |
| 18:28 | AeroNotix | sigh |
| 18:28 | Bronsa | irctc: what you're saying doesn't make much sense |
| 18:28 | AeroNotix | whatever |
| 18:29 | irctc | i mean is there any way in closure to create something with name as a string variable and then call it by this name all over the code? |
| 18:29 | trptcolin | in general, if you need something dynamic, don't use a macro. db-rel is a macro and acts on the *code* that's given to it to def that thing. you cannot change that first argument to db-rel at runtime. |
| 18:29 | irctc | *in clojure |
| 18:30 | AeroNotix | irctc: Probably there's a way to do that. But that's probably not the solution to the problem you're trying to solve. |
| 18:30 | trptcolin | as i think bbloom would say, sure: just use eval. |
| 18:30 | AeroNotix | lol, yeah. Just use eval. |
| 18:30 | AeroNotix | The worse code out there, the better. More work for me. |
| 18:32 | dweave | irctc maybe give a small example in js or something of what you are trying to do |
| 18:32 | dweave | sounds like no one knows what ur asking |
| 18:33 | AeroNotix | Exactly. |
| 18:33 | dweave | is he looking for dynamic scope or something? |
| 18:33 | AeroNotix | irctc is just assuming the same solution as they'd use in inferior languages. |
| 18:33 | AeroNotix | dweave: don't start with dynamic scope just yet :) |
| 18:33 | dweave | ok |
| 18:33 | irctc | a dynamic scope yes ) |
| 18:34 | AeroNotix | sigh |
| 18:34 | AeroNotix | dweave: see |
| 18:34 | dweave | damnit |
| 18:34 | dweave | sorry |
| 18:34 | irctc | something like var xxx='myname'; and then call window[xxx] |
| 18:34 | ticking_ | no I think he's asking for variable resolve by sting |
| 18:34 | dweave | womp |
| 18:34 | clojurebot | It's greek to me. |
| 18:35 | irctc | i mean i have a symbol. but i need it not to be hardcoded but dynamic |
| 18:35 | dweave | irctc that pattern is one of JS’s biggest problems |
| 18:35 | dweave | probably don’t want to reproduce that |
| 18:36 | irctc | ok. what if i have an array of billion of string. and i want to call (db-rel onevalue x y) |
| 18:36 | dweave | what is dynamic about xxx=‘mayname’ |
| 18:36 | irctc | i must copypaste billion strings? |
| 18:36 | AeroNotix | what |
| 18:36 | trptcolin | you don't want one billion vars to be def'ed |
| 18:36 | dweave | umm please don’t |
| 18:36 | AeroNotix | irctc: do you want a map? |
| 18:37 | dweave | AeroNotix yeah sounds like map |
| 18:37 | ticking_ | I think the main confusion comes from namespaces vs maps vs js objects |
| 18:37 | ticking_ | yeah |
| 18:37 | irctc | i want to call (db-rel with changeable, not a hardcoded parameter |
| 18:37 | AeroNotix | (def some-map {"likes" var-of-some-db}) |
| 18:37 | trptcolin | you'll have wrap it in a macro, like justin_smith said. macros are contagious like that. |
| 18:37 | AeroNotix | (db-rel (some-map "likes") 'Bill 'Ted) |
| 18:38 | AeroNotix | db-rel isn't a macro, so the above should work. |
| 18:38 | trptcolin | https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/pldb.clj#L48 |
| 18:38 | ticking_ | irctc: db-rel from core.logic? |
| 18:38 | irctc | ticking_ yes |
| 18:38 | justin_smith | AeroNotix: db-rel is a macro, db-fact isn't |
| 18:38 | AeroNotix | justin_smith: right, I was confused here. |
| 18:39 | AeroNotix | irctc: use another macro, then in that, use resolve and expand to the original db-rel call. |
| 18:39 | ticking_ | irctc: db-rel defines a db relation, is that really what you want to do or do you want do define elements of the relations? |
| 18:39 | ticking_ | AeroNotix: he will create billions of vars then because db-rel is just a wrapper around def |
| 18:40 | AeroNotix | nie moj cyrk, nie moj malpy |
| 18:40 | irctc | ticking_ i want to define elements relations but i don't want this relation name to be hardcoded (likes) but to be dynamic ("likes") |
| 18:44 | AeroNotix | irctc: how many different relation names do you want to use? |
| 18:45 | dweave | is pldb in memory? |
| 18:48 | justin_smith | dweave: yeah - and you think that the pldb namespace would at least have one docstring to that effect |
| 18:48 | justin_smith | low hanging fruit as a contribution I guess |
| 18:48 | dweave | yeah |
| 18:49 | dweave | oh wells |
| 18:49 | ticking_ | I acrually find irctc's problem interesting, because I don't see immediately how to solve it |
| 18:49 | ticking_ | it boils down to: make a def based on a string instead of symbol |
| 18:50 | AeroNotix | ticking_: easy, wrap a macro, call symbol on the string. |
| 18:50 | AeroNotix | If you want the string under a var, resolve it first. |
| 18:52 | irctc | this macro is not an only placed where it is called |
| 18:52 | irctc | a universal solution is required so clojure can know what symbol is wanted |
| 18:52 | AeroNotix | https://gist.github.com/AeroNotix/9b12798577d437cc4937 |
| 18:52 | AeroNotix | for the simplest cae |
| 18:52 | AeroNotix | case |
| 18:53 | ticking_ | AeroNotix: no you need a vanilla def |
| 18:53 | ticking_ | (def (sm "foo") 1) |
| 18:53 | ticking_ | irctc: I'd really check out a datomic database if you have the time |
| 18:53 | AeroNotix | ticking_: why do you need a vanilla def? |
| 18:54 | ticking_ | AeroNotix: irctc wants to use it on core.logic db-rel and that is already a macro wrapping a def |
| 18:54 | AeroNotix | ticking_: you need another macro above db-rel |
| 18:54 | justin_smith | ticking_: not really applicable here, but you can use intern for that |
| 18:54 | irctc | is there any way to just refer to a value by dynamic name not carrying where it is used in macro, functions or whatever? :-( |
| 18:54 | justin_smith | &(intern *ns* (symbol "foo") 42) |
| 18:54 | lazybot | java.lang.SecurityException: You tripped the alarm! intern is bad! |
| 18:55 | justin_smith | ,(intern *ns* (symbol "foo") 42) |
| 18:55 | clojurebot | #'sandbox/foo |
| 18:55 | justin_smith | ,foo |
| 18:55 | clojurebot | 42 |
| 18:55 | AeroNotix | irctc: ticking_ https://gist.github.com/AeroNotix/f04ca13a2df8aa30c176 |
| 18:55 | ticking_ | what irctc wants is to use core.logic as a solver in his/her app and then let the user define additional relations |
| 18:56 | AeroNotix | ticking_: so eval, then |
| 18:56 | AeroNotix | :) |
| 18:57 | irctc | when i use eval then there are namespace problems |
| 18:57 | AeroNotix | (I was kidding with eval) |
| 18:57 | irctc | on other defs inside eval |
| 18:57 | AeroNotix | irctc: are the relations known at compile time? |
| 18:58 | irctc | AeroNotix they aren't :( |
| 18:58 | irctc | AeroNotix i need to make those relation names dynamic |
| 18:58 | ticking__ | sorry what did I miss? |
| 18:58 | AeroNotix | ticking_ https://gist.github.com/AeroNotix/f04ca13a2df8aa30c176 |
| 18:58 | AeroNotix | I sent you that |
| 19:01 | AeroNotix | justin_smith: looking at db-rel, couldn't it create kname at runtime? https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/pldb.clj#L67 |
| 19:01 | ticking__ | AeroNotix: wow, this is really confusing, I'm struggling to get what happens at compile time and what at runtime |
| 19:02 | AeroNotix | ticking__: enjoy |
| 19:02 | justin_smith | AeroNotix: like, hypothetically, if you rewrote it to do so? yeah probably |
| 19:03 | AeroNotix | haha |
| 19:03 | AeroNotix | It's 1am, I'm not explaining things correctly. |
| 19:03 | ticking__ | irctc: how much logic solving do you actually need? |
| 19:03 | irctc | ticking__ tones of |
| 19:03 | Bronsa | AeroNotix: where are you from? we're in the same time zone |
| 19:03 | justin_smith | AeroNotix: as it is, of course, the kname is calculated when the macro is expanded and that's that |
| 19:03 | irctc | ticking__ other libs are not an option |
| 19:03 | ticking__ | irctc: why not? |
| 19:04 | AeroNotix | Bronsa: .pl |
| 19:04 | ticking__ | Bronsa, AeroNotix: me too |
| 19:04 | ticking__ | Bronsa AeroNotix: ger currently in spain :D |
| 19:04 | Bronsa | AeroNotix: italy here |
| 19:04 | irctc | ticking__ i prefer to use a top rated solutions |
| 19:05 | ticking__ | irctc: lol wat |
| 19:06 | ticking__ | irctc: your solution is not "top rate" when 4 experienced clojure people strugle to wrap their head around the way want to abuse the library :P |
| 19:06 | irctc | ticking__ LOL)))) |
| 19:06 | AeroNotix | I think I'd either hack something with eval or not use this macro at all. You can extract the essence of what db-rel is doing into a runtime function |
| 19:07 | ticking__ | irctc: and Datomic/Datascript _are_ "top rate" especially datomic |
| 19:07 | ticking__ | irctc: Datomic is the project rich hickey build with clojure |
| 19:07 | ticking__ | irctc: you won't get more top than that |
| 19:08 | ticking__ | irctc: so how much time constraint do you have, do you write an open source project, if not, what is your budget? and how much logic programming do you actually need |
| 19:08 | AeroNotix | the real questions^ |
| 19:09 | irctc | i am just learning clojure and logic programming for now |
| 19:09 | ticking__ | AeroNotix: I'm still confused, the resolve _should_ happen at runtime since the let is runtime, but the ~ should happen at compile time right? |
| 19:09 | ticking__ | irctc: so no client project? |
| 19:10 | irctc | just tryied to change a single line in example hello wolrd and now see it is impossible ) |
| 19:10 | justin_smith | ticking__ the let in db-rel happens when the macro is expanded, not at runtime |
| 19:10 | ticking__ | irctc: not impossible just hard |
| 19:10 | AeroNotix | ticking__: the resolve happens at macro expansion time, though |
| 19:11 | ticking__ | justin_smith AeroNotix: really?, but couldn't the let contain arbitrary code? or would the resolve fail then? or would it fire-missiles! at compile time and just use the value of that? |
| 19:12 | ticking__ | irctc: there is a reason this is hard, you are misusing the library |
| 19:12 | justin_smith | ticking__: arbitrary code that gets run when the form is created via macro-expansion, and does not get run again when the actual args are visible |
| 19:13 | ticking__ | justin_smith: so how would the compiler react if I turned the let into a fn? |
| 19:13 | ticking__ | throw an error because resolve doesn't work? |
| 19:13 | irctc | ticking__ you mean i can't use dynamic names of relations (only hardcoded) in a #1 world among-all-languages logic library (according to github stars)? |
| 19:14 | ticking__ | irctc: you can't do the same in prolog |
| 19:14 | justin_smith | irctc: you can, and it will be ugly, because it was not designed to work that way |
| 19:14 | ticking__ | which is a #1 logic language among all languages according to world leading experts |
| 19:14 | AeroNotix | ticking__: the let thing was a troll.. sorry about that :S |
| 19:14 | ticking__ | (inc justin_smith) |
| 19:14 | lazybot | ⇒ 164 |
| 19:14 | AeroNotix | I was messing with peeps |
| 19:16 | ticking__ | AeroNotix: throws a null pointer when used also |
| 19:16 | AeroNotix | ticking__: yes :) |
| 19:16 | AeroNotix | the example looks like it works because of the names used |
| 19:16 | justin_smith | irctc: with datomic you can create schema relations or add facts in any order you like, and there is little macro usage, it all uses vanilla data structures. |
| 19:16 | ticking__ | AeroNotix: you almost broke my head in two |
| 19:17 | AeroNotix | ticking__: haha, sorry |
| 19:17 | ticking__ | AeroNotix: Any idea if this can actually work without eval? |
| 19:17 | ticking__ | AeroNotix: no right? because it would require a macro-expansion step at runtime which can only happen at compile time a.k.a eval |
| 19:17 | AeroNotix | ticking__: right |
| 19:18 | irctc | ticking__ justin_smith datomic seems to be a better option... i was wrong |
| 19:18 | AeroNotix | you can do some level of expansion at runtime, to get vars. Which is sometimes as-good-as |
| 19:20 | justin_smith | you could hypothetically use intern instead of def in a redefinition of index-for-query that is a function rather than a macro. The tricky part I guess would be making sure things didn't break things by not having the metadata that def adds to the var. That and the ugly fact that you would be basically copy-paste rewriting the original function. |
| 19:20 | justin_smith | wait |
| 19:20 | justin_smith | s/index-for-query/db-rel |
| 19:21 | irctc | guys thanks for your help, it really made me understand that core.logic or prolog are not maid for in-memory-dynamic-things, only pre-coded |
| 19:21 | ticking__ | irctc: yeah, logic programming is not really database stugg |
| 19:21 | ticking__ | irctc: but having said that |
| 19:22 | irctc | ticking__ i'll go with datomic |
| 19:22 | ticking__ | irctc: the reason db-rel doesn't work for you that well is because it was written with that static context in ming |
| 19:22 | ticking__ | mind |
| 19:22 | irctc | ticking__ i will need to store data statically somewhere anyway |
| 19:22 | ticking__ | I vaguely think and guess that you could do what you want to do by doing the following |
| 19:24 | ticking__ | irctc: ah no sorry discovered that what I tried to do causes weird stuff to happen sorry :( |
| 19:27 | ticking__ | irctc: yeah core.logic pldb is really tailored towards programmer level stuff, they even use the namespace and variable name and pass it around |
| 19:28 | ticking__ | irctc: but tbh the pldb is something people don't use that much with core.logic it is really great at solving logic problems but not good as a database, so go with datomic and you'll enjoy it :D |
| 19:28 | arrdem | ticking__: it's not a bad poor man's datomic :P |
| 19:29 | ticking__ | arrdem: unless you want to dynamically expand the database as we've seen in the last hour :P |
| 19:33 | irctc | ok, my next question: how to treat Datomic like a Visual Foxpro database using WindowsXP build-in VBScript shell? |
| 19:34 | irctc | (a joke) |
| 19:34 | ticking__ | urgggggh |
| 19:34 | ticking__ | what is visual foxpro |
| 19:34 | arrdem | I was really worried there for a minute |
| 19:34 | arrdem | not gonna lie |
| 19:34 | ticking__ | yeah me too |
| 19:35 | justin_smith | hand was hovering over the /ignore button, not gonna lie |
| 19:35 | arrdem | lol |
| 19:35 | irctc | )) |
| 19:35 | ticking__ | my eyebrows basically formed a solid monobrow and they are normaly rather apart |
| 19:35 | arrdem | the disapproval is strong with this chan |
| 19:35 | ticking__ | (inc arrdem) |
| 19:35 | lazybot | ⇒ 41 |
| 19:36 | arrdem | okay so who thinks that reader discard is a feature worth preserving in a new lisp |
| 19:37 | ticking__ | arrdem: I think discarding the reader is a worthy feature |
| 19:37 | arrdem | ticking__: groan |
| 19:37 | ticking__ | :P |
| 19:38 | ticking__ | I still think that pretification should be done by the editor :P |
| 19:39 | ticking__ | but aside, with all these new clojure like languages popping up I wonder if there shouldn't be a clojure.kernel |
| 19:39 | arrdem | cljs.core isn't half bad |
| 19:40 | ticking__ | arrdem yeah but to have a basic set of functions or protocols and datastructures that the implementor has to provide to get a full albeit slow clojure.core |
| 19:40 | TimMc | arrdem: #_ ? |
| 19:40 | ticking__ | arrdem: like core.matrix does |
| 19:41 | ticking__ | arrdem: you only have to provide like 10 functions to get a working core.matrix implementation, because it will fallback to slow default implementaitons, but if you want to make it fast you can provide hundreds of detailed special purpose implementations |
| 19:41 | ticking__ | clojure needs that too |
| 19:42 | ticking__ | shen, while its creator is a maniac, has like 25 base functions that are really required to make it work which is really really nice |
| 19:43 | arrdem | yeah shen is really elegant just because of that |
| 19:43 | arrdem | not my cup of tea, but really really nice. |
| 19:44 | justin_smith | ticking__: yeah I think there is something like that for scheme - default impls of the fundamental stuff that you can find |
| 19:44 | ticking__ | yeah so why not for clojure |
| 19:44 | ticking__ | nice thing would be, as long as you only use things that depend on .kernel, you'd be really really portable |
| 19:44 | arrdem | well for one thing we don't have a spec.. |
| 19:45 | ticking__ | arrdem: create one? |
| 19:45 | ticking__ | arrdem: treat current .core as spec? |
| 19:45 | arrdem | ticking__: wouldn't be a spec for Clojure. Clojure is defined by Rich. |
| 19:46 | ticking__ | arrdem: yeah treat .core as spec, and reimplement the things needed on top of the .kernel stuff |
| 19:46 | ticking__ | which can have a spec since it is as of now not done by rich :D |
| 19:47 | ticking__ | common clojure lol |
| 19:48 | arrdem | ticking__: I've caught a fair bit of flack for raising that idea :P |
| 19:49 | justin_smith | we could have the cchs (pronounced sea cheese) - the common clojure hyper spec |
| 19:50 | ticking__ | yes please |
| 20:13 | zophy | hi |
| 20:14 | ticking__ | zophy: ho |
| 20:16 | irctc_ | what should I do if I want to do a sequence operations where the function depends on neighboring values? For example, if I want to partition a collection into parts where it is increasing/decreasing? |
| 20:18 | crash_ep | reduce |
| 20:19 | irctc_ | crash_ep: how would that work? |
| 20:20 | crash_ep | The function you pass to reduce takes two parameters, an accumulator and the next element in the source collection. Your accumulator would be some data structure that stores the partitions, as well as whatever state you need in order to determine which partition the next element should be added to (or perhaps it should just be held in the state). |
| 20:21 | justin_smith | [#clojure]&(map #(map first %) (partition-by #(apply > %) (partition 2 1 [1 2 3 2 1 2 3 2 1 2 3 4 5 4 3]))) |
| 20:21 | justin_smith | err |
| 20:21 | justin_smith | &(map #(map first %) (partition-by #(apply > %) (partition 2 1 [1 2 3 2 1 2 3 2 1 2 3 4 5 4 3]))) |
| 20:21 | justin_smith | :P client issues |
| 20:21 | justin_smith | &(map #(map first %) (partition-by #(apply > %) (partition 2 1 [1 2 3 2 1 2 3 2 1 2 3 4 5 4 3]))) |
| 20:21 | lazybot | ⇒ ((1 2) (3 2) (1 2) (3 2) (1 2 3 4) (5 4)) |
| 20:21 | crash_ep | justin_smith: nice |
| 20:23 | irctc_ | justin_smith: crash_ep thanks to both of you! |
| 20:23 | irctc_ | justin_smith: also thanks for helping me with my messed up quad tree earleir |
| 20:23 | justin_smith | reduce likely will get a clearer / better performing result, but I just wanted to see if I could do it with partition |
| 20:23 | justin_smith | heh, np |
| 20:23 | ticking__ | we still need a partition-at |
| 20:25 | craigglennie | Looking at clojure-toolbox.com I see 6 SQL DB migration libraries. Anyone got recommendations? I’m building a web-app (not sure on the framework, yet) if that helps. |
| 20:30 | craigglennie | Hmm, looks like Luminus defaults to using Ragtime for migrations. Maybe I should just try that. |
| 21:13 | mercwithamouth | so after upgrading to yosemite..i've had to repair a few things. when i attempt to run a nrepl i get an error zsh command could not find lein.... |
| 21:14 | mercwithamouth | i don't see how that's possible when it's included in my path. i have no issue doing 'lein new blah' under a zsh shell... |
| 21:14 | mercwithamouth | using emacs/cider... |
| 21:20 | stavros | hello |
| 21:20 | ticking__ | hi |
| 21:21 | stavros | i am trying a tutorial, and my results are checked by running "lein midje". is there a way to have it output the inputs? right now it only gives me the failed result |
| 22:14 | mercwithamouth | does anyone here use light table? |
| 22:19 | arrdem | I've tried it a few times, but didn't find it compelling for vanilla clojure |
| 22:19 | arrdem | for ClojureScript it's definitely easier to get up and going |
| 22:19 | mercwithamouth | fine... why is it if i'm calling a simple method that takes 1 argument and prints it...i get the value returned yet in light table it only returns nil |
| 22:21 | bwreilly | mercwithamouth: it is going to be printing to console. I tend to run a tab with console (control-space, start typing console I think) |
| 22:25 | mercwithamouth | bwreilly: ahh i see |
| 22:26 | mercwithamouth | ok...good enough. giving light table a second try. |
| 23:35 | AWizzArd | core.async + transducers: why the 1 in `(chan 1 (map mouse-loc->vec))`? https://github.com/cognitect/async-webinar/blob/master/src/webinar/core.cljs#L133 |
| 23:37 | AWizzArd | An event gets written into the channel when the mouse moves. There will be one single message in the chan, namely the mousemove event. |
| 23:38 | AWizzArd | mouse-loc->vec extracts the coordinates into a vector. Why does the channel need that extra space for a second object before writing to the chan blocks? |