2015-12-15
| 00:00 | pyon | Does the suffix "-SNAPSHOT" have any particular meaning in package versions? |
| 00:00 | justin_smith | yes, it means it's experimental, and a new version could be released at any time |
| 00:01 | pyon | Ah, thanks. |
| 00:01 | justin_smith | if it's been more than 24 hours since lein last checked, it will check for a newer version of the SNAPSHOT |
| 00:01 | pyon | Ah, smart. :-) |
| 00:02 | justin_smith | in general, I avoid SNAPSHOT releases, they are big sources of weirdness |
| 00:02 | justin_smith | since you can have code that works one day but is broken the next due to the auto-update |
| 00:32 | ben_vulpes | so uh what's the best way to get a bower/npm shitshow package wired into my clojurescript project; clone it locally and stick src/* into my cljapp resources/js/ folder? |
| 00:40 | ben_vulpes | oh man i wish it were this easy. GRUNT UP. |
| 00:41 | tolstoy | Are you integrating CLJS into a node project, or trying to use random libs in a basically full CLJS project? |
| 00:44 | Seylerius | tolstoy: Well, damn. I just looked at that cluj thing you linked. Shiny. |
| 00:44 | Seylerius | Very shiny |
| 00:44 | tolstoy | It's fun! ;) |
| 00:45 | tolstoy | I'm actually using it now to create a repl with datomic stuff to try and explore a model. Which is not what I intended. ;) |
| 00:56 | tolstoy | Cider's getting really nice. Even has that thing where the function has the font-lock applied if it has been defined, not if not. One of those old IDE features. |
| 01:20 | ben_vulpes | tolstoy: the latter |
| 01:20 | ben_vulpes | and the answer turned out to be "grunt build" and then cp ~/where/i/want/this.js |
| 01:20 | ben_vulpes | cp thinger ~/where/i/want/it.js |
| 01:20 | tolstoy | I've little experience with that stuff, but I've just used the non-NPM versions dumped in the resources dir. |
| 01:20 | ben_vulpes | nah i got it tolstoy |
| 01:21 | tolstoy | Yeah. |
| 01:21 | ben_vulpes | i'm attempting to set {:style {:color "red"}} on reagent elements made via a do loop, but just getting react-y STYLE strings interspersed in the dom, anyone run into something like this before? |
| 01:22 | tolstoy | Do loop doesn't return the whole sequence? |
| 01:22 | tolstoy | Use "for"? |
| 01:23 | ben_vulpes | derpdorp attributes first then element value |
| 01:23 | ben_vulpes | betcha i won't bollox that up again |
| 01:39 | pyon | Is there some way to do file I/O without using Java's standard library? (FileReader, etc.) |
| 01:40 | tolstoy | pyon clojure.java.io |
| 01:40 | pyon | Ah, thanks, will look. |
| 01:40 | tolstoy | https://clojure.github.io/clojure/clojure.java.io-api.html |
| 01:40 | tolstoy | There's also Raynes' nice lib: https://github.com/Raynes/fs/ |
| 01:41 | pyon | Checking. |
| 01:59 | pyon | Whoa, tentacles is an awesome library. :-) |
| 02:19 | pyon | How do I tell Leiningen to fetch dependencies from http://clojars.org/ ? |
| 02:20 | tolstoy | I think it does by default. |
| 02:20 | tolstoy | But there's a :repositories key in project.clj. |
| 02:20 | pyon | Ah, thanks. :-) |
| 02:20 | j-pb | tolstoy: it looks in multiple places, leiningen is one of them |
| 02:21 | tolstoy | The bible: https://github.com/technomancy/leiningen/blob/master/sample.project.clj |
| 02:21 | pyon | Checking. |
| 02:22 | tolstoy | pyon That's show you the syntax for adding repos if you're unsure about clojars. |
| 02:22 | tolstoy | Also, "lein sample". |
| 02:45 | beaky | hello |
| 02:45 | beaky | how do i make http requests in clojure |
| 02:46 | TEttinger | I mean, you can sometimes get away with slurp on a URI, though that is not exactly a way to make a proper request |
| 02:46 | TEttinger | (don't think it sets parameters) |
| 02:46 | beaky | oh |
| 02:46 | TEttinger | I don't uh do webdev |
| 02:46 | TEttinger | justin_smith, and/or amalloy, heroes of #clojure, assemble? |
| 02:47 | tolstoy | beaky: You can use one of the clojure libs for that. |
| 02:47 | tolstoy | For instance, https://github.com/dakrone/clj-http or http://www.http-kit.org/client.html |
| 02:48 | beaky | wow thanks |
| 02:48 | beaky | will try those |
| 02:48 | tolstoy | Oh, and: http://aleph.io/aleph/http.html |
| 02:49 | tolstoy | The great thing about aleph is you can implement a server-side web-socket client. |
| 02:49 | tolstoy | But http-kit has no dependencies, which is nice. |
| 02:51 | beaky | i love clj-http |
| 02:53 | tolstoy | Is clj-http async? |
| 02:54 | beaky | i think not |
| 02:55 | beaky | httpkit is async out of the box i think |
| 02:55 | tolstoy | Also aleph. |
| 03:01 | TEttinger | aw, we had lazybot briefly |
| 03:08 | slester | for some reason, this code is really really slow... anyone want to take a look? :( |
| 03:09 | TEttinger | to the refheap! |
| 03:10 | slester | https://www.refheap.com/112706 |
| 03:10 | TEttinger | slester: what's some general background info on the type of application, what it does, what "really slow" means... |
| 03:10 | slester | spoilers on advent of code if that matters |
| 03:11 | TEttinger | heh, it has spoilers? |
| 03:11 | slester | well, it's taking 5+ minutes to run that when I was assuming others are in 30 seconds or so |
| 03:11 | slester | well if you don't want to see a slow working solution :( |
| 03:11 | slester | it gets the right answer, just in 5 minutes |
| 03:11 | TEttinger | huh |
| 03:13 | slester | similar to a thing I was doing with strings -- right answer, but because of how I built it, took forever |
| 03:13 | TEttinger | I forgot the site for advent of code |
| 03:13 | slester | adventofcode.com? |
| 03:13 | slester | this is day 15 |
| 03:14 | TEttinger | I did day 3 in a one-liner, sorta didn't keep up not doing that whole time traveler jesus birthday spending season thing |
| 03:15 | TEttinger | (history puts jesus as being born in the spring even when you account for the months getting shifted around... but that overlaps with easter and not the stolen pagan holidays at the solstice) |
| 03:17 | TEttinger | ah, day 15 is an optimization problem |
| 03:18 | slester | this is really about santa, not jesus |
| 03:18 | TEttinger | taking the christ out of christmas eh? bold move |
| 03:18 | TEttinger | WAR ON CHRISTMAS EVERYBODY NEEDS MORE GUNS |
| 03:19 | slester | yep sounds about right! |
| 03:20 | TEttinger | (yes hanukkah is over, technically. but in a world of make-believe, can't the oil have lasted for 16 nights?) |
| 03:21 | slester | back in those days, 2 of their days was 1 of our days |
| 03:21 | slester | so yeah! |
| 03:22 | TEttinger | need moar scifi |
| 03:22 | slester | yes something like that |
| 03:22 | slester | more parsecs |
| 03:22 | TEttinger | lol |
| 03:23 | TEttinger | I'm pondering this problem as best I can... but since I'm not creating an account, making their tracking telemetry just that much more onerous... |
| 03:25 | slester | just block trackers/ads |
| 03:25 | slester | haha |
| 03:26 | TEttinger | the dude seems like he isn't doing it for the tracker sales revenue, he contributed to OSCON... but I'm still a grinch |
| 03:26 | slester | not really sure what the bottleneck is |
| 03:26 | TEttinger | quick stuff: |
| 03:26 | TEttinger | (pmap #(bake-cookies %) ...) can be changed to (map bake-cookies) |
| 03:26 | TEttinger | err |
| 03:27 | TEttinger | (pmap #(bake-cookies %) ...) can be changed to (map bake-cookies ...) |
| 03:27 | TEttinger | for the same ... |
| 03:27 | TEttinger | that avoids creating a zillion anon fns in parallel |
| 03:27 | slester | oops, yeah, refactored codes |
| 03:27 | TEttinger | and it may only give it one core, so pmap ends up being much slower |
| 03:28 | pyon | How do I read a password from stdin, without display it on the screen? (Assuming I'm running my program from a shell.) |
| 03:28 | slester | gotcha. |
| 03:28 | TEttinger | is it running on your machine or a sandboxed one, slester? |
| 03:28 | slester | my machine |
| 03:28 | TEttinger | pyon: hm, check the docs for uh whatever type System/out is |
| 03:28 | TEttinger | ,(class System/out) |
| 03:29 | clojurebot | java.io.PrintStream |
| 03:29 | TEttinger | or System/in too |
| 03:29 | TEttinger | ,(class System/in) |
| 03:29 | clojurebot | java.io.BufferedInputStream |
| 03:29 | beaky | ,(doc System/out) |
| 03:29 | clojurebot | No entiendo |
| 03:29 | beaky | :( |
| 03:29 | TEttinger | it's java it doesn't have clojure docs |
| 03:29 | slester | beaky, why does clojurebot hate you? |
| 03:29 | slester | oh |
| 03:29 | slester | right, haha |
| 03:31 | TEttinger | slester: so pmap can still have a lot of overhead if the problem isn't both massively parallel and sufficiently time-consuming for each item |
| 03:31 | slester | this is apparently super time consuming :| not sure if it's for the (apply max) part or bake-cookies |
| 03:32 | pyon | TEttinger: Thanks! Checking. |
| 03:32 | TEttinger | more overhead from creating Threads for the more items, which can be offset to be a gain if and only if each item takes a while to process and can be completed without needing other threads |
| 03:32 | TEttinger | (doc time) |
| 03:32 | clojurebot | "([expr]); Evaluates expr and prints the time it took. Returns the value of expr." |
| 03:33 | slester | yeah... ok, well the map takes like 3 seconds |
| 03:33 | slester | so it's the apply max part that's taking an eternity |
| 03:33 | TEttinger | wow |
| 03:33 | TEttinger | so half and half |
| 03:34 | TEttinger | wait I thought.... oh 30 seconds |
| 03:34 | slester | so apply max is taking 4 minutes |
| 03:34 | TEttinger | oh more |
| 03:34 | TEttinger | ha |
| 03:34 | TEttinger | oh! |
| 03:34 | TEttinger | that's because pmap is lazy |
| 03:34 | slester | which is ... confu... oh |
| 03:34 | slester | right |
| 03:34 | slester | haha |
| 03:35 | TEttinger | it isn't running until it gets applied... so the timing is gonna be tricky |
| 03:35 | slester | map took 0.0600 msecs haha |
| 03:35 | TEttinger | oh man everything in there is lazy |
| 03:35 | TEttinger | map is just creating a recipe for how to calculate the whole sequence |
| 03:36 | slester | yesh. |
| 03:36 | TEttinger | (could be an infinite sequence!) |
| 03:36 | slester | it does finish. |
| 03:36 | TEttinger | ,(map inc (range)) |
| 03:36 | clojurebot | (1 2 3 4 5 ...) |
| 03:36 | slester | eventually. |
| 03:38 | TEttinger | (doc keys) ;; is this lazy... |
| 03:38 | clojurebot | "([map]); Returns a sequence of the map's keys, in the same order as (seq map)." |
| 03:38 | TEttinger | don't think it could be |
| 03:38 | slester | yeah, don't think it is |
| 03:39 | TEttinger | I feel like there's gotta be a simpler piece of code for this |
| 03:41 | slester | maybe! |
| 03:41 | slester | I am but a newb. |
| 03:44 | slester | if it's any consolation I get the right answer for both parts |
| 03:45 | TEttinger | sweet |
| 03:46 | slester | it just takes no joke 7 minutes per |
| 03:46 | slester | and my computer is pretty good |
| 03:52 | jessicak | hi |
| 03:54 | jessicak | question: not really sure what these things are called but i'm looking for a list of all the .. hmm.. non-lisp.. syntax constructs? that exist in clojure. like #() is one because for the shorthand anonymous function the pound sign isn't in the list |
| 03:54 | jessicak | basically a list of all the exceptions to the whole "everything is a list and the first element is a function/macro and the rest are arguments" |
| 03:55 | yenda | #() is still a macro |
| 03:56 | yenda | jessicak: maybe this is what you are looking for http://clojure.org/cheatsheet |
| 03:56 | slester | jessicak, all I found is this youtube video: https://www.youtube.com/watch?v=cPNkH-7PRTk |
| 03:56 | jessicak | i've seen the cheat sheet |
| 03:56 | jessicak | im just lookign for a comprehensive list of all these "exceptions" |
| 03:56 | jessicak | wait why's everyone linking this intro stuff |
| 03:58 | jessicak | maybe i'm not being clear.. not really sure how to word this question .. hmm .. like, #() is an exception because the pound sign isn't in a list. it's extra syntax to the language. i want all of those |
| 03:58 | hyPiRion | jessicak: This is a good list I think: https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ |
| 03:59 | hyPiRion | contrary to the 6 month disclaimer, I don't think any of it is outdated |
| 03:59 | j-pb | jessicak: it's called a reader macro |
| 03:59 | jessicak | yeah i know |
| 04:00 | jessicak | like #() turns it in to an actual function with variable names under the hood, etc. |
| 04:00 | j-pb | http://clojure.org/reader#The%20Reader--Macro%20characters |
| 04:01 | j-pb | should be a comprehensive list of all the reader macros in clojure |
| 04:01 | jessicak | ! perfect |
| 04:06 | slester | other people's python solutions run in <2 seconds |
| 04:06 | slester | mann. |
| 04:06 | MJB47 | on same hardware? |
| 04:06 | j-pb | slester: not part of the system? |
| 04:06 | slester | yes |
| 04:07 | slester | my clojure solution takes 5 minutes :( |
| 04:08 | MJB47 | so now you get to do the most fun part of algorithms |
| 04:08 | MJB47 | optimizing! |
| 04:08 | MJB47 | i will point out that the problem here is 99.9% likely to be the implementation details |
| 04:08 | MJB47 | rather than the choice of language |
| 04:08 | j-pb | slester: what are you running? |
| 04:09 | j-pb | matrix stuff with numpy as the reference? |
| 04:09 | j-pb | because that is like comparing with C on a GPU directly ;P |
| 04:10 | slester | mine: https://www.refheap.com/112707 vs. https://www.reddit.com/r/adventofcode/comments/3wwj84/day_15_solutions/cxzhpua |
| 04:12 | slester | the things I can think of: my possible-amounts is definitely overcounting and then filtering |
| 04:13 | j-pb | slester: generally speaking |
| 04:13 | j-pb | many threaded sequences are slow |
| 04:14 | MJB47 | how many cpu cores do you have? |
| 04:14 | j-pb | use the new transducer stuff instead of that |
| 04:15 | yenda | slester: first i'd rewrite your solutions with let bindings rather than def |
| 04:15 | slester | j-pb, whatsit |
| 04:16 | slester | yenda, are there benefits other than code organization? Why do you suggest that? |
| 04:16 | j-pb | (into [] (map inc) []) for example |
| 04:16 | beaky | in clojure how do i |
| 04:16 | beaky | how do i emulate maybe |
| 04:17 | j-pb | http://clojure.org/transducers |
| 04:17 | beaky | like a do maybe |
| 04:17 | ridcully | beaky: some-> ? |
| 04:17 | beaky | ah |
| 04:18 | beaky | ,(some-> (#(3)) (#(nil))) |
| 04:18 | clojurebot | #error {\n :cause "Can't call nil"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.IllegalArgumentException\n :message "Can't call nil"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6876]}]\n :t... |
| 04:18 | beaky | ,(some-> (#(3)) nil)) |
| 04:18 | clojurebot | #error {\n :cause "Can't call nil"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.IllegalArgumentException\n :message "Can't call nil"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6876]}]\n :t... |
| 04:18 | j-pb | slester: you can also write the thing in a large for in clojure |
| 04:18 | beaky | some-> is perfect |
| 04:18 | j-pb | (for [i (range 100), j (range 100), k (range 100)] stuff) |
| 04:19 | slester | j-pb, right, just wondering if there is something 'wrong' with what I did that would cause a slowdown, or of it's simply the algorithm itself |
| 04:19 | j-pb | the code is very hard to read tbh |
| 04:19 | beaky | oh |
| 04:19 | yenda | slester: also the python version makes at tops 1 000 000 iterations |
| 04:19 | beaky | is there osmething like haskell mplus or <|> |
| 04:19 | beaky | in clojure |
| 04:19 | beaky | try x, if nil try y |
| 04:20 | beaky | x <|> hy |
| 04:20 | MJB47 | (or x y) ? |
| 04:20 | beaky | oh |
| 04:20 | beaky | silly me :D |
| 04:20 | MJB47 | it took me forever to realise it too lol |
| 04:21 | amalloy | of course c.c/or only works with nil/false, rather than being general like <|> |
| 04:21 | beaky | ttps://www.refheap.com/112708 well i relly want to refactor this kind of thing |
| 04:21 | beaky | so when the if-let of the thing inside if-let fails i can just return 'world' |
| 04:21 | beaky | s/of/or/ |
| 04:22 | amalloy | (or (when-let [...] (move...)) world) |
| 04:22 | beaky | wow |
| 04:23 | beaky | that works even better |
| 04:23 | beaky | i just need to hoist the or out |
| 04:24 | yenda | slester: are you trying all the possible combinations of ingredients then filtering them to 100 ? |
| 04:25 | beaky | is there an or-let |
| 04:26 | MJB47 | no |
| 04:26 | MJB47 | but you can do |
| 04:26 | amalloy | something you would row a little boatlet with? |
| 04:26 | MJB47 | (if-let [z (or x y)] ...) |
| 04:27 | beaky | amal haha |
| 04:27 | slester | yenda, yeah :( |
| 04:28 | slester | yenda, if there's a better way please let me know, that part is the bottleneck |
| 04:28 | slester | just wanted to avoid doing a for loop I guess |
| 04:28 | MJB47 | you could do it the same way the python guy did it |
| 04:29 | MJB47 | with just O(n**3) for |
| 04:29 | amalloy | why would you want to avoid using for? it's lovely |
| 04:29 | slester | yeah, this is what I did before I looked at other solutions haha |
| 04:30 | slester | I guess I felt like it might be shoehorning other languages' approaches into clojure, but maybe there's no better way |
| 04:31 | MJB47 | nah our for is better than their for |
| 04:31 | MJB47 | nest for loops are a 1 liner |
| 04:31 | MJB47 | and its still lazy |
| 04:31 | MJB47 | and you get awesome stuff like :when |
| 04:31 | MJB47 | and its a function |
| 04:33 | beaky | https://www.refheap.com/112709 ok i refactored to this :D |
| 04:40 | ridcully | a rough transscript of that python version (without the manual unrolling) runs with 2s here (vs .5s of the python version) |
| 04:49 | l1x | hi guys |
| 04:50 | l1x | wondering if this holds onto the head |
| 04:50 | l1x | https://www.refheap.com/112710 |
| 05:00 | pyon | ,(#(%) 1) |
| 05:00 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval26$fn__27 invoke "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval26$fn__27 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval26 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval26 invoke "NO_SOURCE_FILE" -1... |
| 05:00 | pyon | ^ Why? |
| 05:01 | pyon | Shouldn't #(%) be the identity function? |
| 05:01 | MJB47 | no |
| 05:01 | MJB47 | because that tries to do (1) |
| 05:01 | MJB47 | which doesnt owrk |
| 05:01 | MJB47 | if you wanted to do that you would need to do |
| 05:01 | MJB47 | ((fn [x] x) 1) |
| 05:02 | MJB47 | though ofcourse you could just use identity |
| 05:02 | pyon | Oh. |
| 05:02 | pyon | Oh, I didn't know identity existed. |
| 05:02 | pyon | I'm using that. :-p |
| 05:06 | aurelian | hi there... is there a way to invoke a lein task from lein repl? |
| 05:20 | hyPiRion | aurelian: What would you need that for? |
| 05:21 | aurelian | well, I want to start the figwheel and at the same time a garden watcher |
| 05:21 | hyPiRion | aurelian: I think you can do that with lein-pdo, but lein repl itself attempts to make lein invisible to the project |
| 05:22 | aurelian | I see |
| 05:30 | powered | why doesn't lein always trampoline |
| 05:32 | j-pb | powered: perfomance I'd guess |
| 05:33 | hyPiRion | powered: not all tasks needs to run in a trampoline, and it turns messy with the `do` task |
| 05:34 | powered | performance in startup time? |
| 05:34 | hyPiRion | er, needs to run a subprocess |
| 05:34 | powered | I need to wait 3+ seconds anyway to even run lein, so I don't care about the performance |
| 05:34 | powered | I do care about 10% extra of my ram |
| 05:34 | wink | damn, ran into #2000 today myself |
| 05:35 | aurelian | I think I may need something like this: https://github.com/bhauman/lein-figwheel#scripting-with-component to have figwheel watcher and garden watcher at the same time :) |
| 05:37 | yenda | aurelian: or use boot :) |
| 06:08 | aurelian | I think I can plug this into figwheel as an exercise |
| 06:30 | noncom | i heard there was a thread on integrating a sane repl into clojure, how is it going? |
| 06:30 | noncom | i mean, in the clojure core jar |
| 06:31 | ridcully | do you mean the socket repl? |
| 06:31 | ghost_ | Hey, how can I "unpack" a data structure? [[1 2] [2 3]] -> [1 2 2 3] |
| 06:32 | ridcully | ,(mapcat identity [[1 2] [2 3]]) |
| 06:32 | clojurebot | (1 2 2 3) |
| 06:33 | ridcully | ,(apply into [[1 2] [2 3]]) |
| 06:33 | clojurebot | [1 2 2 3] |
| 06:33 | ghost_ | thank you, ridcully |
| 06:33 | ridcully | ~flatten |
| 06:33 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 06:33 | ridcully | also check the log of this channel - iirc there where some similar discussion yesterday or so |
| 06:35 | ridcully | that apply into one falls apart quite fast |
| 06:35 | ghost_ | flatten is the best option in my situation (I think) |
| 06:37 | ghost_ | *actually checks if it works* |
| 06:37 | ghost_ | nah, mapcat is better |
| 06:37 | noncom | ridcully: yeah, the socket one |
| 06:39 | ridcully | noncom: it's part of the changelog for 1.8 and it's in the current pre-releases |
| 06:40 | noncom | oh really |
| 06:40 | noncom | cool! |
| 06:40 | noncom | is 1.8 okay to use already? |
| 06:41 | MJB47 | its in rc3 |
| 06:41 | MJB47 | so go ahead and use it, but maybe wait before using it in production for a little bit |
| 06:41 | ridcully | can't tell. saw a post from David Nolen about usage with cljs some time ago and fooled around with it |
| 06:42 | noncom | heh, what's really interesting is that clojure is advancing rather fast on its versions, like 1.5, 1.6, 1.7, 1.8 ... soon it will make to 2! |
| 06:42 | noncom | unless, ofc, they do 1.10... |
| 06:42 | MJB47 | they likely will |
| 06:42 | MJB47 | 2.0 would usually mean API changes |
| 06:42 | noncom | yeah, so i was just imaginging what kind of a revolution that could be |
| 06:43 | noncom | maybe some radical changes for the bes |
| 06:43 | noncom | *best |
| 06:43 | powered | if get changed to if-else |
| 06:43 | noncom | powered: yeah :D |
| 06:43 | powered | semantically correct names ftw! |
| 06:43 | noncom | or maybe they could finally fix the ns system |
| 06:44 | noncom | so it wont be in the previous age comparing to the rest of the language |
| 06:44 | MJB47 | clojure 2.0: fix typo in name, now known as "closure" |
| 06:44 | yenda | if was already like that in common lisp |
| 06:47 | noncom | is anyone using clojure for system scripting? like "#!/usr/bin/env clojure"... stuff? |
| 06:55 | domgetter | I think most people use python/bash/ruby/perl. I don't think I've ever seen "#!/usr/bin/env java" but I'm sure you could find it if you looked |
| 06:57 | hyPiRion | noncom: I do it for long running programs, but not very small scripts |
| 07:01 | noncom | yeah, i have found python to be far better than bash, but still not clojure enough |
| 07:01 | noncom | hyPiRion: you mean startup time is long? |
| 07:06 | ridcully | so hylang then? |
| 07:08 | hyPiRion | noncom: yeah, startup time is too slow for small tasks |
| 07:09 | Trioxin | I've heard Clojure contrasted to languages that stress mutable data and it stated that for instance a common OOP language vs Closure isn't as correct a way to describe "The World," however; assuming that our reality is virtual/computed (Which I believe it is), why would immutable data constructs be a better way to represent that? Information In this reality is always seeming to change rather than a variation of it being created unle |
| 07:14 | visof | hi guys, what is the best GUI lib for clojure to use for interactive GRAPHICS? |
| 07:15 | ghost_ | how can I prevent a map from mixing its values? if I declare it like this {:a 1 :b 2} I want it to stay in this order |
| 07:15 | ghost_ | not {:b 2 :a 1} |
| 07:16 | dnolen | ghost_: maps aren't ordered, use sorted maps if you need order |
| 07:16 | domgetter | ghost_: a map is an unordered list of key-value pairs where the keys are unique |
| 07:17 | ghost_ | dnolen: How do I create one? sorted-map? |
| 07:17 | Trioxin | visof, clplay? You could also use webkit (My fav) such as with nwjs |
| 07:17 | dnolen | ghost_: yep |
| 07:17 | domgetter | ghost_: https://clojuredocs.org/clojure.core/sorted-map there's a few examples |
| 07:17 | MJB47 | keep in mind that sorted-map will sort yourmap for you |
| 07:17 | MJB47 | instead of keeping it in the order you give them |
| 07:18 | Trioxin | Is it efficient to transfer data between processes u |
| 07:19 | ghost_ | MJB47: it stays the way I've implemented it |
| 07:19 | Trioxin | Piping stdout? ** |
| 07:20 | MJB47 | ,(sorted-map :c 1 :b 2) |
| 07:21 | clojurebot | {:b 2, :c 1} |
| 07:21 | MJB47 | ,(sorted-map :a 1 :b 2) |
| 07:21 | clojurebot | {:a 1, :b 2} |
| 07:22 | ghost_ | MJB47: so it puts keys in alphabetical order? |
| 07:22 | MJB47 | if they are strings/keywords yes |
| 07:22 | ghost_ | neat |
| 07:22 | domgetter | If you only need sorting from a map for one thing, but you don't care about order generally, you can sort it on the fly |
| 07:23 | domgetter | ,(sort {:a 3 :b 5 :z 6 :c 8}) |
| 07:23 | clojurebot | ([:a 3] [:b 5] [:c 8] [:z 6]) |
| 07:23 | domgetter | but it will produce of list of vector tuples |
| 07:23 | ghost_ | dogmetter: I needed a sorted map for extracting values from it with drop/take later |
| 07:23 | ghost_ | dogmetter: cause it's more convenient than with keywords and ranges and stuff |
| 07:24 | domgetter | ah okay sounds god |
| 07:24 | domgetter | good* |
| 07:40 | noncom | visof: try quil |
| 07:41 | noncom | visof: it's based on https://processing.org/ |
| 07:43 | noncom | Trioxin: as to your question on immutable structures: it is really just a POV. however, often the immutability POV is cleaner because it eliminates time from the variables. then you can perceive all the data existing at once |
| 07:45 | noncom | Trioxin: no change is ever done to data. data is always constant. your pointers change - that's what, but not the data they point to, it's matter is always still, like zero on kelvin |
| 07:46 | tdammers | 'immutable data structures' means you cannot modify them in-place, you can only create new ones derived from existing ones |
| 07:46 | tdammers | e.g., when you call (assoc) on a map, it doesn't modify the map, it creates a new one that is based on the old one, but with an extra key |
| 07:47 | noncom | tdammers: yeah, that's what we get in practice, the way it is implemented. but Trioxin question was about the conceptual value as i understood it |
| 07:47 | tdammers | the old one still exists though, and anything that uses it will not be impacted |
| 07:47 | Trioxin | What about my notion of destroying data that has become redundant such as if I create a new data structure that's more than less different than the original? |
| 07:47 | tdammers | well, the conceptual value is that when you "modify" something, you aren't impacting anything else |
| 07:47 | noncom | tdammers: agreed |
| 07:48 | tdammers | the "destroying data" part is basically what garbage collection boils down to |
| 07:48 | noncom | Trioxin: you don't destroy data, you just let it go |
| 07:48 | tdammers | you produce a modified version of a data structure, and just don't keep any references to the old one around, so the GC picks it up and destroys it |
| 07:48 | tdammers | or not, as the case may be, but the observable effect is the same |
| 07:49 | Trioxin | hmm. So code doesn't have to handle that. |
| 07:50 | noncom | Trioxin: the STM + GC are clever enough to manage all the implementation details of your journey in the datascapes. the data that is no more visible to you makes for free memory |
| 07:50 | noncom | yes, code does not have to handle anything like that |
| 07:50 | noncom | just be sure that the data you care about fits into your heap, that's all |
| 07:51 | Trioxin | What about my question of using stdout to communicate between processes? |
| 07:52 | Trioxin | I know there shmem but that doesn't sound like fun. |
| 07:52 | noncom | Trioxin: of course you can use stdout, but what's the exact question? |
| 07:53 | noncom | Trioxin: btw: a good insight into cell lists memory: http://www.cs.usfca.edu/~galles/cs345/LispImpHandout.pdf |
| 07:53 | noncom | *memory model |
| 07:53 | Trioxin | noncom, for instance process 1 needs to steam video to process 2 |
| 07:53 | Trioxin | stream* |
| 07:54 | noncom | Trioxin: umm.. well, yes, you could do that... did you face any problems? |
| 07:55 | noncom | Trioxin: although, i think i'd prefer a network interface rather than rely on system piping |
| 07:56 | Trioxin | I haven't gotten to it yet but I will. The problem is that in my use case process 2 is nwjs |
| 07:56 | Trioxin | So I guess I can run the jar from node in the dom |
| 07:57 | noncom | Trioxin: quite possibly |
| 07:59 | ghost_ | How to check if collection contains only the same values? [1 1 1 1] -> true; [1 2] -> false |
| 07:59 | Trioxin | Sockets are more familiar to work with of course but then I'm involving the network stack |
| 08:01 | MJB47 | ,(apply = [1 1 1]) |
| 08:01 | clojurebot | true |
| 08:01 | MJB47 | ,(apply = [1 2 3]) |
| 08:01 | clojurebot | false |
| 08:01 | ghost_ | damn, it's clever |
| 08:01 | noncom | Trioxin: but you know, the network stack is far more reliable and versatile. also, there're enough libs for supporting various data transfer formats and stuff |
| 08:02 | noncom | what if later you will want to stream over network? |
| 08:02 | noncom | but of course, that's just a decision to make, maybe you see that piping is what you really need... |
| 08:02 | Trioxin | noncom, true. |
| 08:05 | Trioxin | I don't even know how I would use the stdout and get the stream to work in the video player. I know it can be done but haven't worked it out yet in the dom. Socket streaming is straightforward. |
| 08:18 | ghost_ | I need to apply 8 functions on one map. How can I do that in a pretty way? They all return vectors |
| 08:18 | noncom | you want to get all the 8 results back? |
| 08:18 | ghost_ | I want to have 8 vectors at once |
| 08:19 | noncom | (map #(% data) fs) ? |
| 08:19 | luma | ((apply juxt fns) data) |
| 08:19 | ghost_ | (func1 func2 ... func8 map) -> ([vec1] [vec2] ... [vec8]) |
| 08:20 | luma | or ((juxt f1 f2 ... f8) data) |
| 08:20 | noncom | hey, they should not be applied in sequence, right? rather in parallel |
| 08:20 | ghost_ | yeah, in parallel |
| 08:20 | ghost_ | independent calls |
| 08:21 | noncom | juxt is a good solution |
| 08:21 | noncom | probably cleaner than mapping over |
| 08:21 | ghost_ | yeah, juxt is perfect |
| 08:21 | ghost_ | thanks you |
| 08:21 | ghost_ | thank* |
| 08:22 | ghost_ | brain farts are with me today |
| 08:23 | noncom | it is okay. there are times when winds blow, you know |
| 08:24 | ghost_ | I'm also having some kind of food poisoning right now, so it's not only about brain farts |
| 08:25 | noncom | oh, yeah, that happens too... i hope your body gets to norm soon :) |
| 08:25 | ghost_ | thank you for kind words :D |
| 08:26 | noncom | :) |
| 08:26 | ghost_ | also, is it bad when I make my functions only work with one input? like with only one map I'm working with |
| 08:26 | ghost_ | or is it idiomatic to use "reusable" functions all the time |
| 08:28 | noncom | ghost_: you mean the function is taylored to parse the specific map? |
| 08:28 | ghost_ | noncom: yeah |
| 08:29 | oracle` | how to let lein to download jar from http://mvnrepository.com/? |
| 08:29 | Trioxin | Has anyone here ever used LispWorks? It looks to be very portable without platform specific code. It's always been a curiosity to me. |
| 08:30 | noncom | ghost_ i suppose this is ok, since otherwise how do you get your map processed. sure enough that separating some common functionality is better, but don't try to force it at the beginning of your construction, if it does not come easily by itself. it will come naturally later and you will be able to decompose and separate, maybe create a lib |
| 08:30 | noncom | oracle`: just specify the dep |
| 08:31 | ghost_ | noncom: I'm doing a tictactoe and this function extracts diagonal rows |
| 08:31 | ghost_ | noncom: didn't know how to make it "generic" |
| 08:31 | noncom | oracle`: on page of any jar there you can see the "Leiningen" tab - there from you can just take the dep vector and put it into your project.clj dependencies |
| 08:31 | oracle` | but there is no jar found in the default repository. |
| 08:31 | noncom | oracle`: could you be more specific? what is the jar? |
| 08:32 | noncom | ghost_: so you have a square of rows and it extracts diagonals? |
| 08:32 | oracle` | I tried to use core.async with clojure 1.7 |
| 08:32 | oracle` | but it failed to download org.ow2.asm:asm-all:jar:4.2 |
| 08:32 | oracle` | looks like core.async depends on org.ow2.asm:asm-all:jar:4.2 |
| 08:32 | oracle` | but on the default repository, it can't find org.ow2.asm:asm-all:jar:4.2 |
| 08:33 | ghost_ | noncom: entire board is like {:1A "-" :2B "-" ...} ("-" means empty) |
| 08:33 | noncom | oracle`: ummm.. everything should just work if you specify the core.async dep |
| 08:34 | ghost_ | noncom: my func is like (select-keys board [:1A :2B :3C]) |
| 08:35 | noncom | uh, then i don't think it is possible to extract any meaningful generic out of this... probably you could create a function that generates the keys [] for diagonal N |
| 08:35 | noncom | oracle`: i think core async is hosted on https://clojars.org/ and it should be fully functional if you just request it in your deps |
| 08:35 | ghost_ | but I won't be doing anything beyond 3x3 board, I think |
| 08:36 | noncom | ghost_: well, actually i see no reason to use a {} here instead of a [] |
| 08:36 | ghost_ | noncom: it's a sorted map in my program |
| 08:36 | noncom | and if you turn it into a [] then extracting specific elements by indices can be generalized |
| 08:36 | ghost_ | noncom: you mean k-v vector would be better? |
| 08:37 | oracle` | maybe I need to fix a warning first before fix the core.async depends issue. |
| 08:37 | noncom | no, like [ [x o x] [- - -] [x - o] ] |
| 08:37 | oracle` | when run lein repl, it has the following warning |
| 08:37 | oracle` | WARNING: reader-conditional already refers to: #'clojure.core/reader-conditional in namespace |
| 08:37 | oracle` | I am using clojure 1.7, anybody know the meaning of the warning? |
| 08:38 | noncom | oracle`: does not look like a critical thing to me :/ |
| 08:38 | ghost_ | noncom: I'm extracting rows and such with things like (take 3 board), map was the best way for updating a board for me |
| 08:38 | ghost_ | noncom: maybe I'll try that when I finish the entire thing |
| 08:38 | noncom | oracle`: how do you find that core async is not available in your program? the require statement fails? |
| 08:39 | noncom | ghost_: yeah, you know, it's hard to say.. things depend on specifics and algorithms much |
| 08:40 | noncom | ghost_: updating a nested vector is no less easy |
| 08:40 | noncom | ,(assoc-in [[1 2 3][5 6 7][8 9 0]] [1 0] 4) |
| 08:40 | clojurebot | [[1 2 3] [4 6 7] [8 9 0]] |
| 08:40 | noncom | ,(assoc-in [[1 2 3][5 6 7][8 9 0]] [2 1] "heeeey maaaaan") |
| 08:40 | clojurebot | [[1 2 3] [5 6 7] [8 "heeeey maaaaan" 0]] |
| 08:41 | ghost_ | noncom: maps are neat for those kinds of things, I just validate input, turn it into a keyword and assoc |
| 08:42 | noncom | ghost_: not the same thing for ^^ ? |
| 08:42 | noncom | [2 1] looks like a good 2d coordinate representation |
| 08:44 | ghost_ | didn't see your code above, lol |
| 08:44 | noncom | also: |
| 08:44 | noncom | ,((fn [[x y]] (keyword (str x (get {\A 0 \B 1 \C 2} y)))) "2B") |
| 08:44 | clojurebot | :21 |
| 08:45 | noncom | if you want user to input like "2A", then this turns "A" into an integer coordinate |
| 08:45 | noncom | yeah, well, i'm just making the point that the task can be seen from many various POVs |
| 08:46 | noncom | and some may be more friendly for generic representation thatn other |
| 08:46 | ghost_ | yeah, for me it's not that clean |
| 08:46 | ghost_ | it may be better for you or someone |
| 08:46 | ghost_ | it all depends |
| 08:46 | noncom | right |
| 08:47 | ghost_ | also, is there a place where I can put my code and smart people will review it? |
| 08:47 | noncom | ghost_: well, there's code review stack exchange website... |
| 08:48 | ghost_ | noncom: we don't have our own thing? oh, well |
| 08:48 | noncom | also, you can try posting your code to something like refheap and ask here, in this IRC, but it is not guaranteed that it will get much response, especially if it is very big |
| 08:49 | noncom | things less than a page can usually get some response |
| 08:49 | noncom | heh, well, not many languages have their personal code review places? :) |
| 08:50 | ghost_ | it's 116 lines now, with comments |
| 08:50 | ghost_ | but clojurians always have all the good stuff! |
| 08:51 | beaky | hello |
| 08:51 | beaky | whats a good mail client for clojure |
| 08:51 | beaky | so i can pull mail from gmail |
| 08:54 | noncom | beaky: https://github.com/owainlewis/clojure-mail ? |
| 08:54 | noncom | ghost_: hehe yeah, and more good stuff is comin! :) |
| 08:54 | ghost_ | noncom: you mean? |
| 08:54 | noncom | well, 116 lines looks like you could post it here for getting some advice |
| 08:55 | ghost_ | I need to write a function for checking if someone has won, so it'll be ~130 lines |
| 08:55 | noncom | ghost_: well idk, clojure is in active development :) who knows what may come if people keep being that adventurous |
| 08:55 | pyon | ,(-> 1 #(* 2 %) #(+ 3 %)) |
| 08:55 | clojurebot | #error {\n :cause "clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.ClassCastException\n ... |
| 08:56 | pyon | ^ Why does that fail? |
| 08:57 | ghost_ | noncom: I hope it we won't become code cowboys like CL guys |
| 08:57 | noncom | pyon: because it does not work the way you thing it works |
| 08:58 | pyon | How does it work, then? :-O |
| 08:58 | noncom | pyon: the 1 gets inserted in the second place of the list |
| 08:58 | noncom | so you get (-> 1 (fn [a] (* 2 a)) ...) on the first iteration, when reader expands the #() form |
| 08:58 | noncom | then: |
| 08:58 | noncom | (fn 1 [a] (* 2 a)) |
| 08:58 | noncom | and it crashes |
| 08:59 | pyon | Oops. |
| 09:02 | noncom | if you read docs on ->, you'll see it says that the thing gets put into the 2nd place in the next form |
| 09:02 | powered | ,(macroexpand '(-> 1 #(* 2 %) #(+ 3 %))) |
| 09:02 | clojurebot | (fn* (fn* 1 [p1__51#] (* 2 p1__51#)) [p1__52#] (+ 3 p1__52#)) |
| 09:02 | pyon | The example I saw on Stack Overflow was (-> 5 zero? not) |
| 09:02 | noncom | pyon: that's different, it'll work, right |
| 09:02 | pyon | So I assumed it was sugar for function composition. |
| 09:02 | noncom | nah :) |
| 09:02 | pyon | Ah! |
| 09:02 | noncom | comp is the sugar i guess |
| 09:02 | noncom | ((comp f2 f1) x) |
| 09:02 | noncom | ghost_: yeah, i hope very much too. really wish clojure spread more and more |
| 09:02 | pyon | I wouldn't call `comp` sugar. It's the normal function composition HOF AFAICT. :-p |
| 09:02 | noncom | yeah :) i was overly figurative :) |
| 09:02 | pyon | What's the difference between -> and ->> ? |
| 09:02 | noncom | pyon: ->> puts the thing on the last place |
| 09:03 | pyon | Ah! |
| 09:03 | domgetter | pyon: (-> 5 even?) becomes (even? 5), so (-> 5 (fn [n] nil)) becomes (fn 5 [n] nil) which makes no sense |
| 09:03 | ghost_ | noncom: it's the first language I can normally write with, without headaches, being angry or bored |
| 09:03 | noncom | -> and ->> are just suitable for different cases of threading. for example, (map) and (reduce) kind of things would more likely to thread with ->> |
| 09:03 | domgetter | -> doesn't "call the functions in order" it rewrites the whole list |
| 09:04 | pyon | Ah... |
| 09:04 | ghost_ | noncom: or write in*, I dunno |
| 09:04 | pyon | Given those descriptions, I can see myself wanting to use ->> more often than ->. |
| 09:04 | noncom | ghost_: hahah :) well, yes, i see clojure having this magic power :) |
| 09:05 | pyon | ,(macroexpand '(->> #(read-once prompt) repeatedly (drop-while pred) first)) |
| 09:05 | clojurebot | (first (drop-while pred (repeatedly (fn* [] (read-once prompt))))) |
| 09:05 | noncom | pyon: right, but never forget about this: https://github.com/rplevy/swiss-arrows |
| 09:05 | pyon | noncom: Checking. |
| 09:06 | noncom | that's the holy shit of threading apex |
| 09:06 | pyon | :-O |
| 09:06 | noncom | or i mean, holy graal.. |
| 09:06 | noncom | :D |
| 09:06 | pyon | Whoa, -<> looks really cool. |
| 09:07 | ghost_ | noncom: do we have all this weird (and beautiful) stuff with function composition haskell has? |
| 09:07 | noncom | feel like a data wizard with these magic wands, eh ? :D |
| 09:07 | yenda | I'm so happy writing when I'm writing clojure too :) |
| 09:07 | ghost_ | yeah, with clojure you can smile |
| 09:08 | yenda | I even found a mission where I do mostly clojure all day |
| 09:08 | ghost_ | with go, the only thing you can do is google and cry |
| 09:08 | yenda | so I've been smiling a lot lately |
| 09:08 | noncom | ghost_: well, it depends :) much of haskell stuff is there for the strict type system, which of clojure is deprived. so you have to account for that. other than that, i guess, it's all here |
| 09:08 | ghost_ | noncom: do we have a dollar? func1 $ func2 ? |
| 09:09 | noncom | umm, i am no pro in haskell but is not it same as comp? |
| 09:10 | pyon | Eh, as a Haskeller (sometimes), the dollar is one of my least favorite operators. |
| 09:10 | ghost_ | oh, yeah, it's basically comp |
| 09:10 | ghost_ | pyon: why? |
| 09:11 | pyon | `a $ b c d e f g` means `a (b c d e f g)` |
| 09:11 | ghost_ | I know, but why don't you like it |
| 09:11 | pyon | ghost_: Because they hide nesting. |
| 09:11 | pyon | s/they hide/it hides/ |
| 09:12 | pyon | If an expression contains lots of $s, it's actually more nested than the parentheses show. |
| 09:12 | ghost_ | pyon: isn't haskell all about hiding stuff behind hundreds of abstractions? |
| 09:13 | pyon | Dunno... I like Haskell (sometimes) because it's pedantically precise (sometimes), not because it hides anything. :-| |
| 09:14 | pyon | But, anyway, back to Clojure. I like it because it remains elegant even when interacting with a messy world. :-) |
| 09:15 | noncom | eheh, clojure can get strange from time to time too :) |
| 09:16 | pyon | Does this look like idiomatic Clojure? (defn read-many [prompt invalid?] (->> #(read-once prompt) repeatedly (drop-while invalid?) first)) |
| 09:16 | ghost_ | by the way, do you guys know if there is a working library for doing indie games in clojure? |
| 09:16 | pyon | read-once itself is (defn read-once [prompt] (print prompt) (read-line)) |
| 09:17 | dnolen | ghost_: play-clj |
| 09:17 | dnolen | ghost_: http://www.indiedb.com/games/ticks-tales-a-knight-to-remember |
| 09:17 | MJB47 | there is also arcadia for unity |
| 09:18 | dnolen | ghost_: also various activity around ClojureScript as well |
| 09:18 | ghost_ | dnolen: play-clj couldn't recognize keyboard input last time I've used it |
| 09:19 | noncom | yeah, all that and also i am quite successful in using JMonkeyEngine 3 with clojure for my main works |
| 09:19 | ghost_ | oh man, I'm so excited now |
| 09:19 | noncom | did not settle with libgdx (play-clj) because it has its 3d support in the early infancy... |
| 09:19 | noncom | ghost_: also, for easy starters you could try the quil library (which also works for clojurescript) |
| 09:20 | noncom | quil is based on https://processing.org/ |
| 09:20 | ghost_ | noncom: I was typing straight from the tutorial while doing play-clj, it still didn't work, I don't know why |
| 09:21 | pyon | If I add a dependency to my project.clj, do I need to restar the REPL in CIDER? |
| 09:21 | pyon | restart* |
| 09:21 | ghost_ | noncom: and isn't quil about animating stuff? |
| 09:22 | noncom | don't know... i did not get much pro in libgdx, but in its niche it is very mature. idk about the play-clj wrapper though, but it looked ok and functional when i last time saw it |
| 09:22 | noncom | ghost_: well, quil is just a wrapper for processing. and processign can surely be used to make games |
| 09:22 | ghost_ | okay, so I'll try that tomorrow or something, thanks |
| 09:23 | ghost_ | noncom: wrapper for a language? |
| 09:24 | noncom | ghost_: processing is simply a java library :) all that hassle about processing language is just about a dedicated IDE for it. the IDE aimed at artists and other people who are not professional programmers but want to do something codey] |
| 09:24 | noncom | ghost_: but no use for the ide, just take the core library and you're good to go |
| 09:24 | noncom | pyon: afaik yes |
| 09:25 | ghost_ | noncom: damn, Hickey is my god now |
| 09:27 | noncom | ghost_: if you ever get to the thing, this may serve as a source of inspiration: http://www.openprocessing.org/ |
| 09:28 | noncom | but for serious opengl i'd go for libgdx/play-clj, jmonkeyengine or bare lwjgl / jogl if i really mean it |
| 09:30 | noncom | serious i mean like AA or even AAA |
| 09:32 | ghost_ | I'd be doing 2d games, even if it would be "serious developing" |
| 09:37 | l1x | hi guys |
| 09:38 | l1x | has anybody seen this with data.json? |
| 09:38 | l1x | https://usercontent.irccloud-cdn.com/file/zmZZVZoo/Screen%20Shot%202015-12-15%20at%2015.37.33.png |
| 09:39 | m1dnight_ | I recall from my thesis that clojure has a thraedpool somewhere taht defaulted to 30-40ish threads. but i ncant find it in the source. |
| 09:40 | m1dnight_ | Some threadpool for some concurrency mechanism. The source in Agents.java defines N threads in the threadpool. But this used to be different or am I thinking of something else? |
| 09:45 | l1x | https://github.com/StreamBright/riak-loader/blob/master/src/riak_loader/core.clj#L193 |
| 09:50 | beaky | ah thanks nomcom |
| 09:50 | beaky | pyon because you need to surround the #() with () :D |
| 09:51 | beaky | ,(-> 1 (#(+ 1 %)) (#(* 2 %))) |
| 09:51 | clojurebot | 4 |
| 09:51 | noncom | l1x: and why would anyone use clojure json instead of cheshire json ? |
| 09:52 | l1x | noncom: dont know |
| 09:52 | noncom | beaky: pyon: hah, a good point. forgot about this |
| 09:54 | powered | because they're too lazy to add the dependency |
| 09:55 | noncom | l1x: looks like a case worthy of an issue |
| 09:55 | alive876 | hi, i tried on the clojure beginner channel but no luck, I was wondering about this code from http://www.braveclojure.com/read-and-eval/ (def addition-list (list + 1 2)) (eval addition-list) ; => 3 ? |
| 09:57 | ghost_ | ,(eval '(+ 1 2)) |
| 09:57 | clojurebot | 3 |
| 09:57 | beaky | hello alive |
| 09:58 | beaky | ,(eval `(+ 1 2)) |
| 09:58 | clojurebot | 3 |
| 09:58 | beaky | ,(eval '(+ 1 2)) |
| 09:58 | clojurebot | 3 |
| 09:58 | beaky | ,(eval (list + 1 2)) |
| 09:58 | clojurebot | #error {\n :cause "EvalReader not allowed when *read-eval* is false."\n :via\n [{:type java.lang.ExceptionInInitializerError\n :message nil\n :at [sun.reflect.NativeConstructorAccessorImpl newInstance0 "NativeConstructorAccessorImpl.java" -2]}\n {:type java.lang.RuntimeException\n :message "EvalReader not allowed when *read-eval* is false."\n :at [clojure.lang.Util runtimeException "Util.... |
| 09:58 | beaky | ,(list + 1 2) |
| 09:58 | clojurebot | (#object[clojure.core$_PLUS_ 0x2e17e73d "clojure.core$_PLUS_@2e17e73d"] 1 2) |
| 09:59 | ghost_ | ,(eval (list (+ 1 2))) |
| 09:59 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval185 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval185 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval185 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69... |
| 09:59 | ghost_ | oh, darn |
| 09:59 | beaky | ,(eval (list '+ 1 2)) |
| 09:59 | clojurebot | 3 |
| 09:59 | beaky | :D |
| 10:00 | powered | , (eval '(eval (list + 1 2))) |
| 10:00 | clojurebot | #error {\n :cause "EvalReader not allowed when *read-eval* is false."\n :via\n [{:type java.lang.ExceptionInInitializerError\n :message nil\n :at [sun.reflect.NativeConstructorAccessorImpl newInstance0 "NativeConstructorAccessorImpl.java" -2]}\n {:type java.lang.RuntimeException\n :message "EvalReader not allowed when *read-eval* is false."\n :at [clojure.lang.Util runtimeException "Util.... |
| 10:00 | ghost_ | why didn't (eval (list + 1 2)) work? |
| 10:01 | powered | because |
| 10:01 | powered | ,(list + 1 2) |
| 10:02 | clojurebot | (#object[clojure.core$_PLUS_ 0x5acd290d "clojure.core$_PLUS_@5acd290d"] 1 2) |
| 10:02 | powered | ,(list '+ 1 2) |
| 10:02 | clojurebot | (+ 1 2) |
| 10:02 | powered | I don't get the "*read-eval*" error at my own repl though |
| 10:05 | mpenet | m1dnight_: you're probably thinking about core.async threadpool https://github.com/clojure/core.async/blob/a833f6262cdaf92c6b16dd201d1876e0de424e14/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L16-L22 |
| 10:06 | mpenet | well, one of them, there s also at least one other globally defined (unbound) threadpool in there |
| 10:06 | mpenet | which is kind of sad |
| 10:09 | mpenet | In clojure itself the situation isn't better either, you have a globally defined threadpool used for agents/futures, you can redef it, but it's always a global pool that will be shared by all these constructs instread of an argument, agents have a way to use a separate pool (using send-via) but that's it. |
| 10:10 | l1x | noncom: not sure if this is coming from data.json |
| 10:10 | l1x | but looks like |
| 10:10 | mpenet | if you need control over threadpool ressources, use libraries that do this right instead of the built-ins |
| 10:11 | noncom | l1x: what's the exception message? this stack trace does not give it.. is it a OOM ? |
| 10:11 | l1x | there is no exception, my code runs out of heap |
| 10:12 | l1x | for no good reason |
| 10:13 | l1x | started to dig in and it turns out that the most memory goes to json/read-str json/wrt-str |
| 10:14 | noncom | l1x: so it is a OOM (Out of Memory) |
| 10:14 | l1x | yes |
| 10:14 | noncom | l1x: yeah, i think you should rise this in the issues |
| 10:14 | l1x | i am replacing data.json with chesire to confirm that it is 100% that lib |
| 10:14 | noncom | l1x: as a proposal you might try to replace the builtin json library they use with cheshire and see what difference it makes |
| 10:14 | l1x | and not something unrelated |
| 10:14 | noncom | yeah :) |
| 10:15 | l1x | yes :) |
| 10:37 | domgetter | If I (apply max seq) does it lazily realize the seq? |
| 10:37 | beaky | does clojrue have toolkits for language processing |
| 10:37 | domgetter | beaky: just google "clojure nlp" |
| 10:38 | beaky | https://github.com/dakrone/clojure-opennlp there we go |
| 10:38 | beaky | i want to parse language samples to a grammaer |
| 10:38 | beaky | or regex |
| 10:39 | beaky | e.g. ["123" "456" "123"] -> #"\d{3}" |
| 10:39 | beaky | ,(re-find #"\d{3}" "123") |
| 10:39 | clojurebot | "123" |
| 10:39 | l1x | noncom: test running |
| 10:39 | beaky | ,(re-find #"\d{3}" "abc123abc") |
| 10:39 | clojurebot | "123" |
| 10:40 | noncom | l1x: good! let's see what it brings.. |
| 10:40 | beaky | https://github.com/Engelberg/instaparse wow |
| 10:40 | MJB47 | domgetter: no, max will realise the entire seq |
| 10:41 | noncom | beaky: also look for parsers here: http://www.clojure-toolbox.com/ |
| 10:41 | ghost_ | How to apply or to vector of booleans? |
| 10:41 | noncom | *parsing |
| 10:41 | beaky | ah thanks nom |
| 10:41 | noncom | ghost_: yeah, a known quirk. reduce can do |
| 10:42 | noncom | there was another way, but i don't recall. not much more graceful though iirc |
| 10:42 | domgetter | MJB47: would I have to write my own max-finder so that I use constant aux space? |
| 10:42 | MJB47 | i dont see how you can have "max" be not-lazy |
| 10:42 | MJB47 | unless you only find the max value of any elements already realised? |
| 10:42 | ghost_ | noncom: (reduce or [false true])? |
| 10:43 | ghost_ | noncom: also, why do we need reduce here? |
| 10:43 | noncom | ghost_: http://stackoverflow.com/questions/2891707/reduce-or-apply-using-logical-functions-in-clojure |
| 10:43 | noncom | ghost_: look very bottom: https://clojuredocs.org/clojure.core/and |
| 10:43 | noncom | ghost_: coz or and and are macros |
| 10:44 | domgetter | MJB47: I'm not concerned with time complexity. I know I'll have to traverse the list. I'm wondering if (apply max seq) loads the whole seq into ram, or if it just looks at one member of the seq at a time |
| 10:44 | ghost_ | noncom: uh, they told me macros were awesome |
| 10:44 | ghost_ | noncom: thanks |
| 10:44 | MJB47 | oh |
| 10:44 | noncom | ahahaha :))) |
| 10:45 | ridcully | ,(some true? [false false true]) |
| 10:45 | clojurebot | true |
| 10:45 | noncom | >:) maaaacros |
| 10:45 | MJB47 | thats not what lazy means i think |
| 10:45 | MJB47 | but idk the specifics of max so i cant help you :( |
| 10:46 | domgetter | Is there a way to ask how much memory a form took to process? |
| 10:46 | ghost_ | ridcully: oh, thanks you, it's so much better than (some identity []) |
| 10:46 | troydm | how do I convert a function that returns boolean into a goal function in core.logic? |
| 10:47 | ghost_ | ridcully: thank*! my god I'm weird |
| 10:47 | domgetter | ,(some identity [false false 2]) |
| 10:47 | clojurebot | 2 |
| 10:47 | domgetter | ,(some true? [false false 2]) |
| 10:47 | clojurebot | nil |
| 10:47 | noncom | ghost_: yeah, true? will only work for booleans while identity will work for any non-nils and non-false |
| 10:47 | troydm | well besides (== (f ...) true) |
| 10:48 | ghost_ | noncom: I've always found functions using identity confusing |
| 10:49 | noncom | why? |
| 10:49 | clojurebot | why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone |
| 10:49 | noncom | it's just (fn [x] x) |
| 10:50 | powered | didn't know clojurebot does anything else than execute clojure |
| 10:50 | domgetter | ,(source identity) |
| 10:50 | clojurebot | Source not found\n |
| 10:51 | domgetter | (defn identity "Returns its argument." {:added "1.0" :static true} [x] x) |
| 11:02 | beaky | hello |
| 11:02 | beaky | how do i evolve a regex |
| 11:02 | beaky | using https://github.com/vollmerm/fungp |
| 11:05 | l1x | noncom: similar issue |
| 11:05 | noncom | l1x: :((( |
| 11:05 | l1x | even though cheshire is faster and smaller |
| 11:05 | l1x | but it still leaks |
| 11:06 | l1x | https://github.com/StreamBright/riak-loader/blob/master/src/riak_loader/core.clj#L225 |
| 11:06 | l1x | here |
| 11:06 | l1x | (same with Cheshire) |
| 11:07 | pseudonymous | Is there any alternative to maven for easy management of private packages ? |
| 11:07 | noncom | beaky: well, in general, like, define the fitness function, the genes for regex.. and run it |
| 11:07 | noncom | pseudonymous: not really, but waht do you mean by "easy management of private packages" |
| 11:07 | noncom | ? |
| 11:08 | noncom | l1x: at which stage of json processing does it choke? |
| 11:08 | pseudonymous | nomcom: with python (pip) I can add a custom git repo. With racket, I can even distribute zip files if I so desire. I just want to share some code between two services which shouldn't be released publicly |
| 11:08 | l1x | noncom: I show you, give me a sec |
| 11:08 | noncom | l1x: if it reaches the limit due to storing huge strings in memory, then one has to think about a better storage paradigm |
| 11:09 | noncom | pseudonymous: 1) local maven - best, 2) jar, 3) in-project source copy-paste, 4) project-project dep (see lein checkouts thing) |
| 11:10 | pyon | beaky: Sorry, I was away. But thanks. |
| 11:10 | noncom | pseudonymous: using maven does not mean release to public at ll |
| 11:10 | noncom | *at all |
| 11:10 | pyon | beaky: After they explained to me how -> and ->> work, it was clear. |
| 11:11 | beaky | ello pyon |
| 11:11 | l1x | https://usercontent.irccloud-cdn.com/file/gakeeMne/Screen%20Shot%202015-12-15%20at%2017.09.49.png https://usercontent.irccloud-cdn.com/file/t4bVNznU/Screen%20Shot%202015-12-15%20at%2017.10.01.png https://usercontent.irccloud-cdn.com/file/pygnBy31/Screen%20Shot%202015-12-15%20at%2017.10.32.png |
| 11:11 | beaky | i love -> and ->> they are like arrows |
| 11:11 | sdegutis | Hey y'all, I'm workin' on a new Clojure-to-CSS lib that's meant to be very lenient on where you place things. https://gist.github.com/sdegutis/459f552dcbc1d3acf950 |
| 11:11 | beaky | silve arrows to automatically make code elegant |
| 11:11 | beaky | silver bullets |
| 11:11 | pseudonymous | noncom: I know.. But I'm just *one* guy and I'm already managing way too much. It seems overkill to try and wrap my head around maven also. |
| 11:12 | l1x | noncom: i think this function is the trouble: http://basho.github.io/riak-java-client/2.0.1/com/basho/riak/client/core/util/BinaryValue.html |
| 11:12 | sdegutis | It's not quite done yet, there's one bug left that I haven't quite figured out. But it feels like I'm using Sass or Less which is nice. |
| 11:12 | l1x | it seems create does something like this: Create a BinaryValue containing a copy of the supplied string encoded using the supplied Charset. |
| 11:13 | noncom | pseudonymous: a very very known feeling, but actually it's just a couple of minutes away. you just have to create a pom.xml, specifying the groupid, artefactid and version for your library, that's all |
| 11:13 | l1x | i might switch to byte[] and see how does that impact the heap allocations |
| 11:13 | noncom | noncom: then maven install and you're through |
| 11:13 | noncom | ah, misclicked the nic :) |
| 11:13 | noncom | l1x: hmmm... |
| 11:14 | noncom | pseudonymous: but if you still don't want - try the other options i've mentioned |
| 11:14 | pseudonymous | noncom: and I can somehow keep this stuff in git still? Did you do any of this and if so, do you have a resource on hand which you yourself found helpful ? |
| 11:15 | ToxicFrog | noncom: doesn't lein have a git-dependencies plugin? |
| 11:16 | noncom | pseudonymous: sure, you just commit the repo to git. the fact that it contains some pom.xml does not change anything. maven is the most solid solution, but the other issue is that you'll have to call "maven install" on each change to your library. that's why you could try using the lein checkouts feature! |
| 11:16 | noncom | ToxicFrog: pseudonymous: oh maybe, i did not hear about it. could be a good option too |
| 11:16 | ToxicFrog | noncom, pseudonymous: will this do the job? https://github.com/tobyhede/lein-git-deps |
| 11:17 | noncom | ToxicFrog: pseudonymous: wow that looks really interesting |
| 11:17 | noncom | pseudonymous: that does not free you from learning some maven anyway :P |
| 11:17 | pseudonymous | ToxicFrog: will definitely read/look into this. You may have saved my day |
| 11:18 | noncom | pseudonymous: this guide: https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html |
| 11:18 | pseudonymous | noncom: I never should've looked at clojure. I just knew the Java EE monster would come out from under my bed to eat me :'( |
| 11:18 | noncom | pseudonymous: after reading this, you're all set for your requirements |
| 11:18 | ToxicFrog | I used it for a project of mine, depending on a github repo, and it seemed to work fine |
| 11:18 | ToxicFrog | You should be able to point it at an internal git repo just as easily, if the repo contains a valid clj project |
| 11:18 | noncom | yeah, i'll look into git deps plugin too, but not because i shy asway from maven :) |
| 11:18 | ToxicFrog | (caveat: I am assuming you're already using lein) |
| 11:19 | noncom | pseudonymous: don't be afraid, try reading the maven in 5 minutes doc several times over several days, and then try to make a dummy pom.xml according to it :) |
| 11:20 | noncom | pseudonymous: one thing of maven is: there's no way back. the world is immenently moving toward it and similar systems |
| 11:20 | ToxicFrog | noncom: personally, one of the things I like about clojure is that using lein means never having to care about ant or maven |
| 11:20 | ToxicFrog | Because they are awful |
| 11:21 | noncom | ahahaha, true enough :) |
| 11:21 | noncom | but these are tools which do the job which has to be done |
| 11:21 | noncom | and if you're doing anything more or less customized or advanced, the lein maven facade won't work that easily... |
| 11:21 | ToxicFrog | So is machine code, that doesn't mean I want to touch it with my bare hands :P |
| 11:21 | noncom | yeah, depends on the need |
| 11:22 | acron^ | try existing in a world without dependency management before knocking maven :p |
| 11:22 | pseudonymous | ToxicFrog: as someone who got bitten *bad* by Java a few years back. That was Lein's selling point to me, too.. :P |
| 11:22 | noncom | acron^: yeah :) i remember that.. |
| 11:22 | ToxicFrog | acron^: oh, don't get me wrong, dependency management is hugely important |
| 11:22 | ToxicFrog | But using maven is anti-fun |
| 11:22 | pseudonymous | Not all dependency management systems are made equal, though. |
| 11:23 | ToxicFrog | Like, maven does an important job, and does it well, but actually interacting with it directly is painful. Ditto ant. |
| 11:23 | MJB47 | after using the shit show that is npm, maven is workable |
| 11:23 | ghost_ | Do we have something like truthy? function? |
| 11:23 | MJB47 | atleast its consistent |
| 11:23 | noncom | ghost_: what sould it do? the truthy? |
| 11:23 | beaky | btw how do i learn maven |
| 11:23 | ToxicFrog | Mentally, I have filed them as "backend tools": things that fill an important ecological niche, but if I ever have to interact with them directly rather than using other, better tools that hand off to them, something is broken. |
| 11:24 | pseudonymous | noncom: oh, and thanks for the link btw :) I'll look at it and ponder it all. |
| 11:24 | noncom | beaky: the official docs are rather good. also sonatype docs. |
| 11:24 | ghost_ | noncom: (truthy? true) -> true ; (truthy? 2) -> true ; (truthy? false) -> false |
| 11:24 | acron^ | No, you're totally correct, I am trolling a bit. Lein is a breath of fresh air compared to "the others". |
| 11:24 | noncom | ghost_: try (boolean) |
| 11:24 | ghost_ | noncom: I can just map boolean, but I dun- oh, okay |
| 11:24 | noncom | :)) |
| 11:26 | ToxicFrog | acron^: yeah, I haven't touched pip or npm, really, but lein is so much more pleasant to use than luarocks or maven it's unreal. |
| 11:27 | beaky | i love npm |
| 11:27 | beaky | its so awesome |
| 11:27 | MJB47 | i have found npm to be incredibly inconsistant and useless |
| 11:27 | MJB47 | :( |
| 11:27 | acron^ | ^ this |
| 11:28 | MJB47 | you can run npm install 3 different times |
| 11:28 | MJB47 | and get 3 different outcomes |
| 11:28 | MJB47 | its amazing |
| 11:28 | beaky | yes esp on windows |
| 11:28 | beaky | with long path |
| 11:29 | MJB47 | lol |
| 11:29 | beaky | and different node versions |
| 11:29 | MJB47 | one of our servers we cant run locally on windows |
| 11:29 | MJB47 | because the dependency path is too long |
| 11:29 | MJB47 | XD |
| 11:29 | MJB47 | there are workarounds but still |
| 11:29 | pseudonymous | waaaaiit a second. So can I stuff the code I want to share into a lein library project and somehow gain the necessary pom files and whatnot ? |
| 11:39 | gfredericks | apparently if you stub something in specl and the stub function throws an arity exception *at all*, specl will report it as the wrong number of args passed to the stub function |
| 11:39 | ToxicFrog | pseudonymous: AIUI, if you are using lein-git-deps, it doesn't even need the pom file; it derives everything from the project.clj |
| 11:39 | ToxicFrog | At least, the one I was depending on didn't have a pom |
| 11:39 | ToxicFrog | That said, I'm pretty sure lein has a "generate a pom for this library" command. |
| 11:42 | pseudonymous | ToxicFrog: from what I gathered, the project you pull in will be resolved, but not its dependencies - in that sense, you're still managing a lot yourself. |
| 11:43 | sdegutis | Is there a function that can tell if a thing is a list or vector or lazy sequence, but not a map? |
| 11:43 | pseudonymous | I think I'm shelving it, for now. Think I'll give clojure a long hard think, too. Has been a bit of a bumpy ride. |
| 11:43 | gfredericks | sdegutis: sequential? |
| 11:44 | domgetter | sdegutis: just out of curiosity, what are you doing that makes you want to check? |
| 11:44 | sdegutis | Ahhhh nice. |
| 11:45 | sdegutis | I'm writing a little Clojure-to-CSS thing that uses data as its API, so whether an element is a string, map, or list/vector makes the difference as to how it's used. |
| 11:45 | sdegutis | Because with CSS positioning shouldn't matter, if you have some maps and then some vectors of children and some more maps, those maps should be considered your own attributes. |
| 11:46 | ghost_ | Again need help with bools. How to write it correctly? (take-while (not false?) coll) |
| 11:46 | sdegutis | ghost_: take-while already does that |
| 11:47 | ghost_ | sdegutis: But my call doesn't work, it throws an error |
| 11:47 | ghost_ | ,(take-while (not false?) [true false]) |
| 11:47 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn> |
| 11:47 | roninhacker | ,(take-while even? [2 2 2 22 2 2 3 2]) |
| 11:47 | clojurebot | (2 2 2 22 2 ...) |
| 11:47 | ghost_ | I know, darn |
| 11:47 | roninhacker | [2 2 2 22 2 2 3 2]) |
| 11:47 | sdegutis | ghost_: you probably want to create an anonymous function |
| 11:47 | pseudonymous | sdegutis: I may be mistaken but. Most likely it's not hard to cobble together a function from the existing ones (vector? list?). That said, if you mean to act differently depending on its type, you should look into protocols |
| 11:47 | roninhacker | ,(take-while even? [2 3 2 22 2 2 3 2]) |
| 11:48 | clojurebot | (2) |
| 11:48 | sdegutis | ghost_: you're passing (not false?) as a function, when it's actually a function call of its own that probably throws an error |
| 11:48 | sdegutis | ,(not false?) |
| 11:48 | clojurebot | false |
| 11:48 | roninhacker | ,(fn? (not false)) |
| 11:48 | clojurebot | false |
| 11:48 | sdegutis | ghost_: okay so (not false?) just returns false, and you're passing false in where a (predicate) function is expected |
| 11:48 | ghost_ | sdegutils: can you show me that function? I have no idea how to write it |
| 11:50 | roninhacker | anonymous functions in clojure are easy and pleasant: start off w/a #, and refer to arguments as %,%2, %3 |
| 11:50 | ridcully | ,(fn? (complement false?)) |
| 11:50 | clojurebot | true |
| 11:50 | roninhacker | (let [our-addition #(+ % %2)] (our-addition 3 5)) |
| 11:50 | roninhacker | ,(let [our-addition #(+ % %2)] (our-addition 3 5)) |
| 11:50 | clojurebot | 8 |
| 11:51 | ridcully | it's polite to use %1 in that case |
| 11:51 | roninhacker | oh, really? i apologize for my barbaric manners then, ha |
| 11:51 | ghost_ | damn, you're telling me stuff I already know |
| 11:51 | domgetter | ,(let [+ *] (+ 3 3)) |
| 11:51 | clojurebot | 9 |
| 11:52 | roninhacker | well, to put it together w/ take-while |
| 11:52 | roninhacker | the function you’re prolly looking for |
| 11:52 | roninhacker | is not an anon one, but `identity` |
| 11:53 | roninhacker | ,(take-while identity ‘(true (even? 2) (odd? 3) (odd? 4))) |
| 11:53 | clojurebot | #error {\n :cause "Unable to resolve symbol: ‘ in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: ‘ in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: ‘ in this context"\n ... |
| 11:53 | roninhacker | ,(take-while identity [true (even? 2) (odd? 3) (odd? 4)]) |
| 11:53 | clojurebot | (true true true) |
| 11:53 | ghost_ | I have a vector of strings and falses |
| 11:54 | ghost_ | I want to get first string out |
| 11:54 | roninhacker | ah |
| 11:54 | roninhacker | ,(doc drop-while) |
| 11:54 | clojurebot | "([pred] [pred coll]); Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns logical false. Returns a stateful transducer when no collection is provided." |
| 11:54 | roninhacker | ,(first (drop-while [false false “hi”])) |
| 11:54 | clojurebot | #error {\n :cause "Unable to resolve symbol: “hi” in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: “hi” in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: “hi” in this co... |
| 11:55 | roninhacker | ha, whoops |
| 11:55 | roninhacker | ,(first (drop-while identity [false false “hi”])) |
| 11:55 | clojurebot | #error {\n :cause "Unable to resolve symbol: “hi” in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: “hi” in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: “hi” in this co... |
| 11:55 | ghost_ | (first (drop-while #(= false %) coll)) |
| 11:55 | ghost_ | that's what I meant |
| 11:55 | ridcully | (some identity [false false "lerl"]) |
| 11:55 | ghost_ | thanks |
| 11:55 | roninhacker | great! |
| 11:55 | MJB47 | roninhacker: you arent using " somehow |
| 11:56 | roninhacker | MJ:thanks, but weird |
| 11:56 | roninhacker | Yeah, you’re right |
| 11:56 | domgetter | ,(first (filter string? [false false "asdf"])) |
| 11:56 | clojurebot | "asdf" |
| 11:57 | ridcully | ,(some string? [false false "lerl"]) |
| 11:57 | clojurebot | true |
| 11:57 | MJB47 | in general if you are doing (first (filter ... you can just use (some |
| 11:57 | ridcully | ,(some identity [false false "lerl"]) |
| 11:57 | clojurebot | "lerl" |
| 11:57 | roninhacker | right…I always forget some |
| 12:00 | l1x | noncom: i am going nuts |
| 12:00 | noncom | l1x: whats up? |
| 12:00 | l1x | i have no idea why i am holding onto the that piece of data |
| 12:02 | l1x | i am changing approach and pass strings around and convert it to clojure data strucutre in the last moment |
| 12:07 | sdegutis | ghost_: you probably want #(not= false %) or (fn [x] (not= false x)) which are the same. |
| 12:08 | sdegutis | ghost_: or maybe you want #(false? x) which is the same as #(= false %) and (fn [x] (= x false)) |
| 12:08 | ghost_ | sdegutils: they didn't work, I used (first (drop-while #(= false %) coll)) |
| 12:09 | Bronsa | or more simply `false? ` |
| 12:16 | noncom | l1x: yeah, maybe a change in the approach would solve something |
| 12:16 | momerath | is there a way to set a dynamic var at the repl, outside a binding form? |
| 12:16 | sdegutils | ghost_: are you trying to match false items? What does your input data (i.e. coll) look like? |
| 12:16 | noncom | momerath: you can certainly get the var |
| 12:16 | noncom | momerath: the var itself, but what value do you expect it to have outside a binding? |
| 12:16 | ghost_ | sdegutils: like [false "-" false false "-"] |
| 12:16 | sdegutils | ghost_: okay and what data do you want to end up with? |
| 12:16 | ghost_ | sdegutils: and I've found good solution, don't worry |
| 12:16 | ghost_ | sdegutils: "-" |
| 12:16 | sdegutils | ghost_: okay then |
| 12:16 | sdegutils | (->> coll (drop-while false?) (first)) |
| 12:17 | momerath | ? maybe the specifics will help: I want to disable ansi-color printing when I'm debugging at the repl, since cider currently doesn't handle the escape codes well |
| 12:17 | sdegutils | ,(->> [false "-" false false "-"] (drop-while false?) (first)) |
| 12:17 | clojurebot | "-" |
| 12:17 | momerath | and I don't want to type (binding [*ansi-capable* false] stuff) every time |
| 12:17 | noncom | momerath: hmm, maybe alter-var-root will do ? |
| 12:18 | ghost_ | sdegutils: yeah, I used that |
| 12:18 | momerath | same result as var-set: boolean cannon be cast to var |
| 12:18 | noncom | ,(def ^:dynamic *z* 1) |
| 12:18 | clojurebot | #'sandbox/*z* |
| 12:19 | noncom | ,*z* |
| 12:19 | clojurebot | 1 |
| 12:19 | noncom | ,(alter-var-root *z* (constantly 42)) |
| 12:19 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.Var"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.Var"\n :at [clojure.core$alter_var_root invokeStatic "core.clj" 5273]}]\n :trace\n [[clojure.core$alter_var_root invokeStatic "core.clj" 5273]\n [clojure.core$alter_var_root doInvoke "core.clj" -1]\n [clojure.lang.RestFn... |
| 12:19 | noncom | ,(alter-var-root #'*z* (constantly 42)) |
| 12:19 | clojurebot | 42 |
| 12:19 | momerath | "already refers to..." |
| 12:19 | noncom | *z* |
| 12:19 | noncom | ,*z* |
| 12:19 | clojurebot | 42 |
| 12:19 | noncom | see |
| 12:19 | ystael | If you accidentally change the binding of user/*1 in the repl, is there a way to get it back? |
| 12:20 | noncom | ystael: unlikely |
| 12:20 | Bronsa | ystael: there's *2 and *3 |
| 12:20 | ystael | well, yes, but you have to skip one to use those :) |
| 12:21 | noncom | momerath: what do you mean "already refers to.."? the example above worked - i think it'll work 4 u |
| 12:22 | ystael | the binding of *1 in other namespaces is still right (I can (in-ns 'another.namespace) and then *1 works again) |
| 12:22 | momerath | hmm- ok, it did once I added the constantly |
| 12:22 | momerath | thanks noncom! |
| 12:22 | ystael | but I can't (def *1 another.namespace/*1) |
| 12:23 | noncom | momerath: (constantly x) is just (fn [& whateva-i-don-care] x) |
| 12:23 | noncom | momerath: i think it was #' missing |
| 12:24 | momerath | yeah- I'm reading that now. I tried the #' without constantly in either place |
| 12:24 | noncom | btw #'x is (var x) |
| 12:25 | momerath | i get boolean cannot be cast to IFn |
| 12:27 | noncom | momerath: you do now? |
| 12:27 | noncom | ,(def ^:dynamic *ansi-color?* true) |
| 12:27 | domgetter | Say I have two lists of the same size. What's the idiomatic way to consume one element from each list at the same time? |
| 12:27 | clojurebot | #'sandbox/*ansi-color?* |
| 12:27 | noncom | ,*ansi-color* |
| 12:27 | clojurebot | #error {\n :cause "Unable to resolve symbol: *ansi-color* in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: *ansi-color* in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol:... |
| 12:28 | noncom | ,*ansi-color?* |
| 12:28 | clojurebot | true |
| 12:28 | noncom | ,(alter-var-root #'*ansi-color?* (constantly false)) |
| 12:28 | clojurebot | false |
| 12:28 | MJB47 | domgetter interleave? |
| 12:28 | noncom | ,*ansi-color?* |
| 12:28 | clojurebot | false |
| 12:28 | domgetter | In this case, I want to sum to corresponding elements: (3 4 5) ( 7 8 9) --> ((+ 3 7) (+ 4 8) (+ 5 9)) |
| 12:28 | MJB47 | or |
| 12:28 | noncom | momerath: ^^^ ? |
| 12:28 | MJB47 | oh* |
| 12:28 | momerath | without the constantly, i def it in my module, can get the val at the repl, but if i alter-var-root, i get cannot cast bool to ifn |
| 12:29 | noncom | domgetter: btw if you awnt to map on it, just (map f coll-1 coll-2 coll-3 ...) |
| 12:29 | momerath | if i add constantly just at the repl, that works too - my problem is solved, but I don't grok the need for constantly when doing the alter-var-root |
| 12:29 | noncom | ah |
| 12:29 | MJB47 | ,(map + [1 2 3] [4 5 6]) |
| 12:29 | clojurebot | (5 7 9) |
| 12:30 | noncom | momerath: you see, alter-var-root expects a function which will accept your current value and return a new one, *not* just the new value |
| 12:30 | momerath | ahh |
| 12:30 | domgetter | ,(map + (3 4 5) (7 8 9)) |
| 12:30 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval161 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval161 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval161 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69... |
| 12:30 | noncom | ,(map + '(3 4 5) '(7 8 9)) |
| 12:30 | clojurebot | (10 12 14) |
| 12:30 | domgetter | oh drr |
| 12:31 | domgetter | thank you |
| 12:31 | domgetter | haha |
| 12:31 | noncom | try to stick to []s for data instead of ()s |
| 12:31 | domgetter | noncom: I have a thing that is returning a seq |
| 12:31 | noncom | then it's ok :) |
| 12:31 | domgetter | :P |
| 12:31 | justin_smith | ,(seq? '(1 2 3)) |
| 12:31 | clojurebot | true |
| 12:32 | slester | silly seqs |
| 12:32 | noncom | seqsy sills |
| 12:33 | noncom | yeah, the clojuric subliminal dualism between [] and () sometimes gets me |
| 12:34 | domgetter | It's similar to Ruby's dualism between arrays and enumerators |
| 12:36 | Jody | Anyone use dubtrack.fm? |
| 12:37 | Jody | I only ask here because this is a room full of coders and I've started a coding music room |
| 12:39 | jweiss | if i am creating a lazy-seq representing a queue at a remote endpoint (where i am repeatedly dequeuing and adding to my lazy-seq), is there a way to timeout reading the next item from the seq (in case the remote queue stands empty for a long time)? or is this something for core.async (or similar) to handle |
| 12:40 | noncom | jweiss: looks like a task for core async |
| 12:40 | jweiss | noncom: ok that's what i figured thanks |
| 12:41 | noncom | Jody: not really. you mean , ther's good music to listen to while coding? |
| 12:42 | Jody | Lol, I find that video game music tends to be a good choice |
| 12:42 | Jody | Designed to provide pleasant noise, but not be the focus of attention |
| 12:43 | noncom | yeah.. to me, while coding, music is to sink the unnecessary noise around and inside my head :) |
| 12:44 | noncom | things like this one do very good also: http://mynoise.net/NoiseMachines/catPurrNoiseGenerator.php |
| 12:44 | noncom | or some movie soundtracks, true |
| 12:44 | noncom | movie/game |
| 12:49 | ToxicFrog | pseudonymous: it definitely resolves dependencies, or did when I used it; Clearley requires math.numeric-tower and criterium, among other things, and neither were required by other parts of my project. |
| 12:51 | ystael | Right now the ndarray implementation of core.matrix treats indices as offsets into a flat array instead of doing bounds checking: (m/mget (m/array [[0 1] [1 0]]) 0 2) yields 1 instead of an IndexOutOfBoundsException. |
| 12:51 | ystael | If this is as designed, is there a way to get bounds checking instead? |
| 12:51 | ystael | (that is, without implementing it myself) |
| 12:59 | beaky | hello |
| 12:59 | beaky | how do i nillify an exception |
| 12:59 | beaky | e.g. if i attempt to create a regex with invalid pattern, i wanna get nil instead of exception |
| 12:59 | noncom | just (try your-code (catch Exception e nil)) |
| 13:00 | beaky | ah |
| 13:01 | noncom | beaky: you can also (try your-code (catch Exception e (println "OOPS!" (.getMessage e)) nil)) |
| 13:01 | noncom | so that at least some info you get |
| 13:01 | noncom | if you need it ofc |
| 13:02 | noncom | also, nil would be redundant here |
| 13:02 | beaky | ,(try (re-pattern "\@ lol inavald regex") (catch Exception e nil)) |
| 13:02 | clojurebot | beaky: I don't understand. |
| 13:02 | beaky | wha |
| 13:02 | noncom | haha |
| 13:02 | noncom | its his reaction on exceptions i think |
| 13:02 | beaky | ,(try (re-pattern "\@ lol inavald regex") (catch Exception e nil)) |
| 13:02 | clojurebot | beaky: It's greek to me. |
| 13:02 | beaky | oh |
| 13:02 | noncom | ,(throw (Exception. "AARGH")) |
| 13:02 | clojurebot | #error {\n :cause "AARGH"\n :via\n [{:type java.lang.Exception\n :message "AARGH"\n :at [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]}]\n :trace\n [[sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6943]\n [clojure.lang.Compiler eval "Compiler.java" 6906]\n [clojure.core$eval invokeStatic "core.... |
| 13:03 | noncom | hmmmm |
| 13:03 | noncom | ,(try (throw (Exception. "AARGH")) (catch Exception e (println "CLOJUREBOOOT"))) |
| 13:03 | clojurebot | noncom: Pardon? |
| 13:03 | noncom | see |
| 13:03 | beaky | oh |
| 13:03 | schmir | ,(defn maybe-re [s] (try (re-pattern s) (catch Throwable err nil))) |
| 13:03 | clojurebot | schmir: Titim gan éirí ort. |
| 13:04 | TimMc | ,(/ 0) |
| 13:04 | clojurebot | #error {\n :cause "Divide by zero"\n :via\n [{:type java.lang.ArithmeticException\n :message "Divide by zero"\n :at [clojure.lang.Numbers divide "Numbers.java" 158]}]\n :trace\n [[clojure.lang.Numbers divide "Numbers.java" 158]\n [clojure.lang.Numbers divide "Numbers.java" 3784]\n [clojure.core$_SLASH_ invokeStatic "core.clj" 994]\n [clojure.core$_SLASH_ invoke "core.clj" -1]\n [sandbox$ev... |
| 13:04 | schmir | ,(maybe-re "[") |
| 13:04 | clojurebot | #error {\n :cause "Unable to resolve symbol: maybe-re in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: maybe-re in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: maybe-r... |
| 13:04 | noncom | schmir: it did not define the function heh |
| 13:04 | Glenjamin | anyone know if there's a way to get Prismatic's schema to not throw exceptions? |
| 13:04 | luma | you can't use try-catch on clojurebot |
| 13:04 | schmir | year, looks like the bot hates me |
| 13:06 | justin_smith | beaky: do you mean catch one? |
| 13:06 | ystael | Glenjamin: if you want the error object back instead of an exception thrown, you can use s/check instead of s/validate |
| 13:06 | justin_smith | n/m I got lagged |
| 13:06 | ystael | if you are doing coercions, s/coerce! throws, s/coerce doesn't |
| 13:07 | schmir | ,(let [maybe-re (fn [s] (try (re-pattern s) (catch Throwable err nil)))] (maybe-re ".")) |
| 13:07 | clojurebot | schmir: Pardon? |
| 13:07 | justin_smith | schmir: try/catch does not work with clojurebot |
| 13:08 | schmir | ah.ok. |
| 13:20 | Glenjamin | ystael: perfect, thanks |
| 13:21 | ghost_ | Hey guys, I've made a tic tac toe game, it's my first program. Tell me what do you think (140 lines) |
| 13:21 | ghost_ | https://github.com/youarebeautiful/tictactoe |
| 13:24 | slester | ghost_, "it's meant to crash" haha |
| 13:25 | ghost_ | slester: it crashes if you give it wrong input, it's your fault! |
| 13:26 | slester | I'm a pentester at heart. |
| 13:26 | justin_smith | ghost_: instead of performing an illegal function call, you could raise an exception. Same consequences, slightly more clear about the intention. |
| 13:26 | ghost_ | justin_smith: hadn't had it in my course yet |
| 13:27 | ghost_ | justin_smith: I'll fix that |
| 13:27 | ghost_ | (also, courses are boring) |
| 13:27 | justin_smith | (throw (Exception. "You done messed up.")) |
| 13:27 | justin_smith | ,(throw (Exception. "You done messed up.")) |
| 13:27 | clojurebot | #error {\n :cause "You done messed up."\n :via\n [{:type java.lang.Exception\n :message "You done messed up."\n :at [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]}]\n :trace\n [[sandbox$eval25 invokeStatic "NO_SOURCE_FILE" -1]\n [sandbox$eval25 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6943]\n [clojure.lang.Compiler eval "Compiler.java" 6906]\n [clojure.c... |
| 13:28 | justin_smith | ghost_: another explicit option is (System/exit 0) |
| 13:28 | justin_smith | or you can return a value other than 0 if you like |
| 13:29 | justin_smith | I forget what the unix command line convention is for a return code that means "somebody cheated" |
| 13:29 | ghost_ | justin_smith: Updated |
| 13:30 | justin_smith | heh, didn't expect you to use my exact message, but I guess it works |
| 13:31 | ghost_ | I think someone who helps me deserves a place in my program |
| 13:32 | ghost_ | also, how to get it to work on windows? my friend said me that it doesn't fire up terminal |
| 13:32 | ghost_ | it just loads up and does nothing |
| 13:33 | justin_smith | right, you would have to make sure they launch from a terminal, or use some other UI |
| 13:33 | justin_smith | ghost_: maybe there's a windows flag you can set on the jar "run in terminal" ? I have no idea though, maybe TEttinger2 has some clue |
| 13:34 | ghost_ | justin_smith: o-kay, thanks. any comments about the code? |
| 13:39 | justin_smith | ghost_: what's with all the vec calls? |
| 13:39 | tolstoy | Makes it easier to print the board, I bet. |
| 13:40 | justin_smith | ,(let [[board first-row second-row third-row] (iterate (partial drop 3) [1 2 3 4 5 6 7 8 9])] third-row) ; ghost_ |
| 13:40 | clojurebot | () |
| 13:40 | justin_smith | ,(let [[first-row second-row third-row] (iterate (partial drop 3) [1 2 3 4 5 6 7 8 9])] third-row) ; ghost_ |
| 13:40 | clojurebot | (7 8 9) |
| 13:41 | justin_smith | heh, fixed |
| 13:41 | ghost_ | it didn't work without that, 'cause the output was like ("-" "-") |
| 13:41 | justin_smith | ,(let [[first-row second-row third-row] (partition 3 [1 2 3 4 5 6 7 8 9])] third-row) |
| 13:41 | clojurebot | (7 8 9) |
| 13:42 | ghost_ | see? :D |
| 13:42 | justin_smith | ghost_: then why not change your print function? |
| 13:42 | tolstoy | You could move the "vec" stuff to the presentation layer, but, eh. The code is clean, imho. |
| 13:43 | ghost_ | sec, I'll take a look |
| 13:43 | ghost_ | my juxt'd function wouldn't work, iirc |
| 13:44 | ghost_ | but I might be wrong, I'm a bit tired |
| 13:44 | justin_smith | ghost_: it would just return seqs instead of vecs |
| 13:45 | ghost_ | uhm.. what about vec-vals function? |
| 13:45 | justin_smith | vec-vals ? |
| 13:45 | ghost_ | it'd be a helper for these rows and such |
| 13:46 | ghost_ | (defn vec-vals [row] (vec (vals row))) |
| 13:46 | ghost_ | ugh, it's nonsense |
| 13:46 | justin_smith | ghost_: my suggestion was that they don't need to be a vec except where you are printing, but sure, that would also simplify things a bit |
| 13:46 | ghost_ | but looks prettier! |
| 13:47 | ghost_ | justin_smith: I'll try to do something about this tomorrow |
| 13:47 | justin_smith | ghost_: also I would prefer (get board (keyword move)) over ((keyword move) board) |
| 13:47 | ghost_ | justin_smith: for now, I'll just make vec-vals |
| 13:47 | ghost_ | justin_smith: why? |
| 13:47 | justin_smith | ,(def vec-vals (comp vec vals)) |
| 13:47 | clojurebot | #'sandbox/vec-vals |
| 13:47 | ghost_ | ohh, that's neat |
| 13:48 | justin_smith | ,(vec-vals {:a 0 :b 1 :c 2}) |
| 13:48 | clojurebot | [0 1 2] |
| 13:48 | tolstoy | Not (-> (drop 6 board) vals vec)? ;) |
| 13:48 | justin_smith | ghost_: regarding get vs. putting (keyword ...) in the calling position, I just find that is more readable |
| 13:48 | justin_smith | (-> 6 (drop board) vals vec) |
| 13:48 | justin_smith | haha |
| 13:49 | ghost_ | justin_smith: I'll change that too |
| 13:50 | ghost_ | seems idiomatic :D |
| 13:50 | ghost_ | can I use that? |
| 13:50 | tolstoy | Or (->> board (drop 6) vals vec) ;; to keep the focus on the board. ;) |
| 13:50 | justin_smith | tolstoy: yes, I was thinking (-> 6 (drop board) ...) was silly |
| 13:50 | tolstoy | Yeah. ;) |
| 13:51 | tolstoy | 6 takes a little journey. |
| 13:51 | ghost_ | so, not a good idea? sniff. |
| 14:00 | slester | tolstoy, laughed at '6 takes a little journey' :) thanks for that. |
| 14:03 | andonilsson | CIDER question: how do I turn off instrumentation of a fn after a debug session? |
| 14:07 | andonilsson | cider-load-buffer was the answer |
| 14:08 | justin_smith | andonilsson: just reloading that one function should do it too |
| 14:10 | andonilsson | justin_smith: you're right, that'll be the easiest. Thx |
| 14:13 | tolstoy | Speaking of Cider, pretty nice that #_ now de-font-locks the commented out expression. |
| 14:18 | sdegutis | I like how with CIDER you can just C-u M-. on anything and it'll take you to the source, even when the source part of clojure itself and written in Java. Like, do it on str/join or StringBuilder and it'll just work. |
| 14:19 | kungi | tolstoy: This is sweet :-) |
| 14:19 | sdegutis | Oh my bad, StringBuilder is part of Java itself. But it still takes you right to the source. Nice. |
| 14:19 | sdegutis | CIDER is a pretty great IDE. |
| 14:20 | kungi | sdegutis: StringBuilder does not work for me |
| 14:20 | sdegutis | Hmm. It takes me right to StringBuilder.java |
| 14:20 | tolstoy | If I fire up something like Intellij, I start turning off stuff (docked side windows, popups, etc, etc) and end up with a bare window, a basic text editor. I like Emacs/Cider's opt-in strategy. |
| 14:20 | sdegutis | kungi: perhaps you don't have Java JDK installed? |
| 14:21 | sdegutis | tolstoy: yeah that's pretty great |
| 14:21 | sdegutis | Although I have mixed feelings about the Emacs part. Sometimes it feels a bit too bare-bones, and when I install packages to fix that, it feels a bit ad-hoc and weird still. |
| 14:22 | sdegutis | Almost like every feature is an afterthought turned into a prototype written in a rush and published as soon as it resembles something like what the person had in mind in the first place. |
| 14:22 | tolstoy | sdegutis Have you tried that "literate emacs init files" thing? |
| 14:23 | sdegutis | Hmm never heard of it. |
| 14:23 | sdegutis | But I just put comments around stuff that's not obvious. |
| 14:23 | kungi | sdegutis: I work with emacs for a couple of years every day. |
| 14:23 | kungi | sdegutis: Sometimes packages break but most of the time it's great |
| 14:23 | pseudonymous | sdegutis: and eventually you'll see the brilliance of it all. If given enough time, you'll be able to customise emacs in every which way you want, to suit you. |
| 14:23 | sdegutis | And I ignore the majority of my emacs dotfiles, considering most of them ought to have been default settings and not stuff I had to manually set. |
| 14:23 | tolstoy | sdegutis: Mine https://github.com/zentrope/.emacs.d/blob/master/config.org, but this one is more complete: https://github.com/danielmai/.emacs.d/blob/master/config.org |
| 14:24 | sdegutis | kungi, pseudonymous: yeah I've been using emacs full time (40+ hours per week) for the last 3 or 4 years, it's definitely useful |
| 14:24 | tolstoy | Emacs is kind of like Siracusa's "Naked Robotic Core". Stripped down to the primitives. You build your editor on top. Kinda like Clojure, come to think of it. |
| 14:24 | tolstoy | Which doesn't really counter what you're saying. ;) |
| 14:25 | sdegutis | I'd like a version of for that's compatible with ->> |
| 14:25 | sdegutis | I know technically map works, but it feels not nearly as readable as for. |
| 14:25 | sdegutis | tolstoy: I guess my main gripe with Emacs is that it can't do per-pixel scrolling like literally every other modern text editor (except maybe vim). |
| 14:26 | sdegutis | It has to scroll per-line(s) and that isn't as easy to visually follow as I'm scrolling. |
| 14:26 | tolstoy | sdegutis: I'm with you there. |
| 14:26 | sdegutis | But hey I'm still using it so I guess it's not a deal breaker :D |
| 14:28 | sdegutis | I was rooting for some Electron-based editor to take over for a while. But by golly web pages are such an inefficient UI, I just can't get past that. |
| 14:28 | tolstoy | And the javascript. |
| 14:28 | sdegutis | And from what I hear, Atom is slow enough to bother even most Atom advocates. So that seems to confirm the idea that you just can't use web apps to render text editors and still sleep well at night. |
| 14:28 | tolstoy | I sure wish LightTable had just stuck with being super good for Clojure. |
| 14:29 | sdegutis | tolstoy: it's not anymore? |
| 14:29 | tolstoy | It supports multiple languages. |
| 14:29 | sdegutis | tolstoy: I mean I know they tried to make language agnostic, but did that somehow hurt its niceness toward Clojure? |
| 14:29 | tolstoy | It's written in ClojureScript, but I wonder what it would be like if it was just _for_ CLJS and CLJ. |
| 14:30 | tolstoy | Well, at first, it was going to be a cool new re-thinking of what an IDE meant. De-emphasis on files, for instance. But then it turned into a regular editor. |
| 14:31 | sdegutis | My main concern about LT was that it tried to abstract away the concept of files, and let you move and place context-less snippets of code around your screen. That's not a feature I would ever want or use. My code lives in files and I'm fine with that, trying to abstract that away seems like going the completely wrong direction. |
| 14:31 | tolstoy | So, you're not a fan of the Smalltalk environments? |
| 14:32 | sdegutis | Nope. |
| 14:32 | sdegutis | Files/folders are a simple and familiar paradigm, they happen to work great with computers. |
| 14:32 | tolstoy | I think there are environment for people who need to use programming to get their own work done (like scientists), and for those who need to write static software. Smalltalk and Lisp Machines are the former. |
| 14:33 | justin_smith | reminds me of something I saw recently that brought up the difference between building a doghouse vs. a highrise |
| 14:33 | justin_smith | certain things that totally work when building a doghouse stop working once you are building a highrise - you just need to cross more ts and dot more is |
| 14:34 | justin_smith | (on the other hand, building a doghouse as if it were a highrise would be silly too) |
| 14:34 | tolstoy | justin_smith: I've heard that recently, too. Something on Cognicast? |
| 14:35 | justin_smith | hmm... I think stuartsierra or maybe cemerick tweeted about the article? |
| 14:36 | beaky | i love clojure |
| 14:37 | mavbozo | i think it is that story about a guy applying software engineering project discipline when building a dog house |
| 14:37 | pseudonymous | justin_smith: I heard a story like that retold from a Python presentation. The way I remember it, the speaker said that *he* heard it from a language designer who gave a talk many years ago (smalltalk?) |
| 14:37 | justin_smith | ahaha - the plot thickens |
| 14:38 | beaky | tig |
| 14:38 | beaky | oops wrong window |
| 14:41 | tolstoy | Doghouse / skyscraper: http://www.uml.org.cn/UMLApplication/pdf/booch.pdf |
| 14:42 | tolstoy | Also mentioned: http://c2.com/cgi/wiki?SoftwareArchitecture |
| 14:42 | tolstoy | Alas, tainted by the UML chimera. |
| 14:45 | justin_smith | tolstoy: cool, thanks! |
| 14:48 | tolstoy | I guess my point, though, was that there's a place for a fancy environment that uses code, but doesn't produce applications. Today, most people do that with Excel. |
| 14:48 | tolstoy | I think the Smalltalk and Lisp Machine environments were in that mode, and are mis-characterized when thought of as over-the-top IDEs. |
| 14:50 | tolstoy | So, now you have Chris Granger and his Eve project, maybe some of what Brett Victor is after. |
| 14:50 | justin_smith | so basically something more powerful than your scientific calculator but not real software architecture either |
| 14:50 | justin_smith | I think wolfram aims for that niche too |
| 14:50 | mavbozo | tolstoy, i think Mathematica is one such fancy environment although never met someone who uses it seriously in scientific or engineering |
| 14:51 | tolstoy | Yeah. |
| 14:51 | justin_smith | mavbozo: jynx |
| 14:51 | mavbozo | aaarghhhh |
| 14:51 | tolstoy | The idea of those "image based" thing was that you install one, and then customize and customize as you work toward solving problems. |
| 14:52 | tolstoy | Not unlike what we do with dot files and emacs config files. Except for non software dev purposes. |
| 14:52 | tolstoy | I wonder, who uses Mathematica? |
| 14:55 | TimMc | Stephen Wolfram, I guess. |
| 14:55 | justin_smith | plus the people whose intellectual labor he "appropriates" |
| 14:55 | futuro | Does anyone know how to make M-./cider-find-var open the buffer in the current window in emacs? |
| 14:56 | futuro | I've tried passing changing the prefix, calling it with M-;, etc, and it opens the buffer in a different window every time |
| 14:57 | scottj | futuro: you can use shackle.el for that |
| 14:58 | scottj | futuro: s/can/may be able to/ |
| 14:58 | futuro | scottj: I'll look into that, thank you |
| 15:02 | sdegutis | I'm really deep into an algorithm that should be simple, and I'm getting my types so confused that I'm coming up with a string like "a,c,c,o,u,n,t" somehow. |
| 15:06 | scottj | futuro: maybe you have popwin or something else loaded that's causing a window to be created when emacs wouldn't by default |
| 15:07 | futuro | scottj: no, no popwin here |
| 15:07 | futuro | and I don't remember ever setting something up to do that, since i've pretty much always hated this mechanic |
| 15:07 | futuro | but it's something worth thinking about, for sure |
| 15:22 | sdegutis | ,(for [i (range 10) j (range 5)] [i j]) |
| 15:22 | clojurebot | ([0 0] [0 1] [0 2] [0 3] [0 4] ...) |
| 15:23 | sdegutis | ,(for [i (range 4) j []] [i j]) |
| 15:23 | clojurebot | () |
| 15:23 | sdegutis | Dang. That's my bug. |
| 15:23 | sdegutis | Tried to get clever with for, for out-clevered me. |
| 15:56 | sdegutis | This stupid algorithm. Ugh! |
| 15:57 | beaky | i love algorithms |
| 15:57 | sdegutis | (f [] ["a" "b]) => ["a" "b"], (f ["x"] ["a" "b]) => ["x a" "x b"], (f ["x" "y"] ["a" "b]) => ["x a" "x b" "y a" "y b"], what the heck is f? |
| 15:59 | justin_smith | sdegutis: something in clojure.core.combinatorics? |
| 15:59 | sdegutis | I sure hope not. |
| 15:59 | justin_smith | or at least something using it... |
| 15:59 | justin_smith | haha |
| 16:01 | sdegutis | https://gist.github.com/sdegutis/f549b7ece0badf6fd26d |
| 16:02 | sdegutis | This *almost* works: (for [x xs y ys] (str x " " y)) |
| 16:04 | matthavener | just do (if (empty? xs) [""] xs) :D |
| 16:04 | matthavener | er, hrm, that would add a leading space |
| 16:05 | sdegutis | Oh hmm, turn into coll, then remove nil?, then str/join " " |
| 16:06 | sdegutis | Nope, doesn't work. |
| 16:07 | beaky | ye looks combinatorialy |
| 16:07 | sdegutis | Okay this works. (fn [xs ys] (for [x (or (not-empty xs) [nil]), y ys] (if x (str x " " y) y))) |
| 16:07 | beaky | speaking of combinators and combinatorials, how do i permute a string |
| 16:07 | sdegutis | I'm not proud, but it works. |
| 16:08 | beaky | to generate all possible combinations of elements a set |
| 16:08 | sdegutis | All tests pass. Woo! |
| 16:08 | sdegutis | beaky: but (for) is great for that. |
| 16:08 | sdegutis | I just needed a hack for when one of the sets was empty. |
| 16:08 | sdegutis | This works great. |
| 16:09 | sdegutis | Now I can do this! https://gist.github.com/sdegutis/d7a03b9aa5b797b74a8e |
| 16:09 | beaky | yes for is the ultimate |
| 16:09 | beaky | it is like set builder notation |
| 16:10 | sdegutis | :) |
| 16:11 | jessicak | hi i'm trying to get https://github.com/clojure/tools.analyzer working but getting errors. here's what i did. 1) made a new lein app, 2) added [org.clojure/tools.analyzer.jvm "0.6.9"] as a dependency in project.clj, 3) executed this code http://pastebin.com/Fi2B757G 4) i get an error java.lang.RuntimeException: Unable to resolve symbol: create-var in this context on the defn analyze line. any ideas? |
| 16:12 | jessicak | (the pastebin is the code verbatim from the tools.analyzer link) |
| 16:16 | tolstoy | Speaking of "6 takes a journey", clj-time allows for (-> 3 days ago) and (-> 6 days from-now). |
| 16:18 | Bronsa | jessicak: hi, that's not supposed to be code you should use, the README says "Here's a simplified version of how clojure.tools.analyzer.jvm/analyze is defined" |
| 16:19 | Bronsa | jessicak: just use `clojure.tools.analyzer.jvm/analyze` |
| 16:21 | jessicak | Bronsa: thanks that worked! |
| 16:25 | Bronsa | jessicak: feel free to ping me at any time if you have questions/issues about t.a |
| 16:26 | jessicak | Bronsa: perfect i actually have a ton of questions but didn't want to be a bother! lol |
| 16:26 | tolstoy | reloaded.repl is not working for me anymore. It can't find namespaces. WTF! |
| 16:27 | jessicak | Bronsa: is there any way to get the output shorter? i passed in a multiline function (around 5 lines) and the output was 300,000 characters. i'm mostly interested in just a tree of commands and their children |
| 16:33 | Bronsa | jessicak: http://sprunge.us/iFHj?clj something like this maybe? |
| 16:34 | Bronsa | it just shows the shape of the AST and the node types |
| 16:34 | Bronsa | keep in mind that the output of t.a will be an AST for the fully macroexpanded form, so that's going to include a lot more code than you might expect |
| 16:36 | jessicak | yeah.. hmm |
| 16:36 | jessicak | maybe i'll just do it manually.. i think tools analyzer might be a bit too advanced for what i'm trying to do |
| 16:37 | jessicak | i'm just trying to convert any clojure expression in to a json tree with text and children keys for each node |
| 16:37 | amalloy | jessicak: one way to get a general idea of how to achieve what you want is to do it once manually. what's a very simple input you could give, and the output you would want? |
| 16:39 | justin_smith | jessicak: also, it sounds like some of what you want might overlap with technomancy's serializable-fn project? https://github.com/technomancy/serializable-fn |
| 16:39 | justin_smith | or maybe not |
| 16:39 | jessicak | amalloy: sure. something like this: (+ 1 2) ---> { "text": "+", "children": [ { "name": "1" }, { "name": "2" } ] } |
| 16:39 | jessicak | not sure if i typed that right but that's the basic idea |
| 16:39 | jessicak | err /s/name/text |
| 16:40 | jessicak | it could even be a lisp edn tree instead because there's always clj->js |
| 16:41 | amalloy | and what do you want to happen to maps in the input? |
| 16:42 | amalloy | like (assoc {:x 1} :y 2) |
| 16:42 | jessicak | amalloy: yeah that's a bit of a problem with all the reader macro stuff .. i wasn't exactly sure about how to handle all those special cases yet and was going to first work with standard lisp syntax stufff |
| 16:42 | devn | Anyone know where typed clojure is at with gradual typing? |
| 16:42 | amalloy | okay |
| 16:43 | amalloy | well, then you just want to do a postwalk like somebody suggested, but with a different function |
| 16:43 | amalloy | ,(use 'clojure.walk) |
| 16:43 | clojurebot | nil |
| 16:43 | amalloy | ,(doc postwalk) |
| 16:43 | clojurebot | "([f form]); Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall." |
| 16:45 | amalloy | bleh, i can never figure out how to use postwalk. i'd jsut write it recursively by hand :P |
| 16:45 | turbofail | heh |
| 16:46 | amalloy | ,((fn tree [form] (if (coll? form) {:text (first form), :children (map tree (rest form))}, {:text form})) '(+ 1 2)) |
| 16:46 | clojurebot | {:text +, :children ({:text 1} {:text 2})} |
| 16:46 | tolstoy | Ah hah! invokeStatic in clojure 1.8 breaks weavejester's reloaded.repl reset function. |
| 16:47 | Bronsa | :( |
| 16:47 | Bronsa | tolstoy: how so? |
| 16:47 | jessicak | ! that looks good! |
| 16:47 | amalloy | and of couse your format presumes that your tree always has a plain old symbol in the first position: it can't handle something like ((juxt inc dec) 1) |
| 16:47 | tolstoy | Bronsa: It can't find dependent namespaces, I think. |
| 16:47 | jessicak | oh yeah my format was just an example |
| 16:49 | justin_smith | jessicak: so what's going to be done with this data structure once it's on the cljs side? |
| 16:49 | jessicak | justin_smith: tree visualization! |
| 16:49 | justin_smith | oh, cool |
| 16:50 | tolstoy | Bronsa: https://github.com/weavejester/reloaded.repl/issues/3 |
| 16:50 | amalloy | anyway jessicak, the general idea is to write a function that recursively maps itself over all the children. my example was a simple version conforming to your example, but if you have more detailed stuff you can write just about anything following the same general structure |
| 16:51 | Bronsa | tolstoy: that doesn't look like a DL issue to me |
| 16:51 | jessicak | amalloy: ok thanks so much! i'll probably be back soon with more questions :p |
| 16:51 | tolstoy | DL? |
| 16:51 | Bronsa | direct linking |
| 16:51 | Bronsa | the invokeStatic thing :) |
| 16:52 | tolstoy | Oh. I don't know what the issue is. I just see "invokeStatic" and fuzzy match on half-read mailing list posts. |
| 16:53 | amalloy | yeah that doesn't look related to invokeStatic at all |
| 16:54 | tolstoy | Maybe an issue with tools.namespace? |
| 16:55 | Bronsa | are you sure it's tied to the clojure version you're using and not an actual issue in your project? |
| 16:55 | tolstoy | Bronsa: Well, the project compiles and runs. I can "reload" when using Clojure 1.7.0. So, I don't know. Reasonably confident? |
| 16:56 | sdegutis | Anyone know of a clever way to convert a byte array to a hex string? |
| 16:56 | justin_smith | sdegutis: map a format across it and reduce to combine the strings? |
| 16:56 | tolstoy | Something like (apply str (map #(format "%x" %) bytes))? |
| 16:56 | amalloy | sdegutis: i would start by typing into google: java convert byte array hex string |
| 16:57 | Bronsa` | google is something sdegutis is apparently not too familiar with |
| 16:57 | Bronsa` | tolstoy: can you track down the earliest clojure version that makes this fail? |
| 16:57 | sdegutis | Bronsa`, amalloy: I done that. The solutions look fine, but I thought maybe you guys know a better way. |
| 16:57 | justin_smith | ,(apply str (map #(format "%x" %) (.getBytes "hello"))) |
| 16:57 | clojurebot | "68656c6c6f" |
| 16:58 | Bronsa` | tolstoy: TBH i'm skeptical that this is a clojure issue, but if it is I'd like to understand it :) |
| 16:58 | sdegutis | justin_smith: looks neat! |
| 16:58 | sdegutis | justin_smith: I never saw that solution in my google search :D |
| 16:58 | tolstoy | Bronsa` Yeah. First I'll try upgrading tools.namespace, then go back to that. |
| 16:58 | Bronsa` | cool |
| 16:58 | sdegutis | amalloy, Bronsa`: you might fit in better in #swift, they're a lot like you over there |
| 16:59 | sdegutis | The only two things ever said in that channel is questions or answers containing lmgtfy.com. |
| 16:59 | TimMc | sdegutis: This is one of those things that one might expect to find in a stdlib... but it's not. |
| 16:59 | justin_smith | sdegutis: for cleanliness, it's good to add "UTF-8" as the last arg to .getBytes |
| 16:59 | sdegutis | TimMc: Well it looks like it mostly works with (format "%x"), but that kind of cheats since it uses java.util.Formatter |
| 16:59 | justin_smith | sdegutis: and if that's the wrong encoding, you are doing it worng |
| 17:00 | sdegutis | TimMc: plus I heard it goes negative if the first byte is 1 |
| 17:00 | rhg135 | I have lmgtfy as a command in my client |
| 17:00 | TimMc | justin_smith: There's a nice simple flowchart waiting to happen there. |
| 17:00 | justin_smith | TimMc: :) |
| 17:00 | sdegutis | :D |
| 17:01 | tolstoy | Bronsa` Hm. Upgrading to [org.clojure/tools.namespace "0.3.0-alpha2"] seems to fix it. |
| 17:02 | sdegutis | ,(defn md5 [s] (->> (-> (MessageDigest/getInstance "md5") (.digest (.getBytes s "UTF-8"))) (map #(format "%x" %)) (apply str))) |
| 17:02 | clojurebot | #error {\n :cause "No such namespace: MessageDigest"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: No such namespace: MessageDigest, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "No such namespace: MessageDigest"\n :at [clojure.lang.Util runtimeE... |
| 17:02 | Bronsa` | tolstoy: ¯\_(ツ)_/¯ |
| 17:02 | sdegutis | Oh right. |
| 17:02 | sdegutis | Anyway, no need to pull in the digest lib for md5, this is simple! |
| 17:02 | justin_smith | sdegutis: I think you need to do the import for MessageDigest |
| 17:02 | TimMc | ,(apply str (map #(format "%02x" %) (.getBytes "☃" "UTF-8"))) |
| 17:02 | clojurebot | "e29883" |
| 17:03 | TimMc | sdegutis: %02x |
| 17:03 | justin_smith | TimMc: oh yeah, 02x is definitely better |
| 17:03 | justin_smith | thanks for that one |
| 17:03 | sdegutis | ,(do (import '[java.security MessageDigest]) (defn md5 [s] (->> (-> (MessageDigest/getInstance "md5") (.digest (.getBytes s "UTF-8"))) (map #(format "%02x" %)) (apply str)))) |
| 17:03 | clojurebot | #'sandbox/md5 |
| 17:04 | sdegutis | (md5 "foo") |
| 17:04 | sdegutis | ,(md5 "foo") |
| 17:04 | clojurebot | "acbd18db4cc2f85cedef654fccc4a4d8" |
| 17:04 | sdegutis | :) |
| 17:04 | justin_smith | $ md5 -s foo => MD5 ("foo") = acbd18db4cc2f85cedef654fccc4a4d8 |
| 17:04 | justin_smith | nice! |
| 17:05 | sdegutis | :D |
| 17:05 | justin_smith | nice work, team |
| 17:06 | sdegutis | Thanks so much justin_smith and TimMc for making this dream come true! |
| 17:08 | TimMc | you'll be receiving our bill in 2-3 business days |
| 17:09 | l1x | amalloy: any ide why inside a go-loop i have following memleak? i am calling this method http://basho.github.io/riak-java-client/2.0.1/com/basho/riak/client/core/util/BinaryValue.html#create(byte[]) |
| 17:10 | sdegutis | (->> (for [_ (range 1000)] (let [s (str (java.util.UUID/randomUUID))] (= (md5 s) (digest/md5 s)))) (remove true?) (count) (zero?)) => true ;; yay! |
| 17:10 | l1x | https://usercontent.irccloud-cdn.com/file/pygnBy31/Screen%20Shot%202015-12-15%20at%2017.10.32.png |
| 17:10 | amalloy | me? why are you asking me? |
| 17:10 | l1x | cant examplain |
| 17:10 | amalloy | ask the channel |
| 17:10 | l1x | sorry :) |
| 17:10 | l1x | channel: anybody has any idea why this is happening? |
| 17:11 | Bronsa` | possibly http://dev.clojure.org/jira/browse/ASYNC-138 |
| 17:11 | l1x | Bronsa`: wow |
| 17:11 | l1x | damn this is not good |
| 17:12 | l1x | alright I rewrite it without go-loop |
| 17:12 | l1x | Bronsa`: thank you very much |
| 17:13 | sdegutis | I'm finding that I can remove a good portion of third party libs I'm using by replacing it with 50 lines of code or less. |
| 17:15 | justin_smith | l1x: it's a good thing to minimize code inside go to coordination and dispatch code, and do the real work in thread or future anyway (in general) - though that bug is scary |
| 17:15 | justin_smith | makes me wonder if I need to move some things out of go blocks in my app... |
| 17:16 | Bronsa` | or test the patch and bump the ticket? :P |
| 17:17 | justin_smith | Bronsa`: haha, there's that too |
| 17:18 | l1x | justin_smith: thx |
| 17:21 | sdegutis | Hmm. |
| 17:21 | sdegutis | Hmmmmmm. |
| 17:22 | sdegutis | Phew, only using <! and >! inside (go) |
| 17:45 | l1x | justin_smith: what is the best way of getting rid of go and go-loop? i see one option with https://gist.github.com/l1x/3dacf952f70370d9c158 |
| 17:45 | tolstoy | sdegutis What was the issue with a go block?? |
| 17:46 | sdegutis | tolstoy: See Bronsa`'s link |
| 17:46 | sdegutis | Bronsa`: lol what's with the backtick in ur nick |
| 17:47 | Bronsa` | sdegutis: don't ping me for those useless questions thanks |
| 17:47 | tolstoy | He's logged in from two different places. |
| 17:47 | sdegutis | whoa okay then |
| 18:04 | devn | Anyone here handy with datascript? |
| 18:05 | devn | I want to pull datoms for a namespace |
| 18:06 | devn | like '{:find [?x] :in [$ ?ns] :where [[:?x (namespace ?ns) _]]} |
| 18:23 | devn | Note, not in datomic. |
| 18:46 | slester | greetings, clojurians. just wondering if people made the switch from vim to cursive and what their thoughts were? I'm pondering it because IDEs are "the future" or whatever. |
| 19:14 | justin_smith | slester: I'm sure someone has done this. |
| 19:15 | slester | and now, I wait :D |
| 19:15 | cfleming | slester: Yeah, there are quite a few ex-vimmers using Cursive |
| 19:15 | slester | ex-vimmer makes me sad :( |
| 19:15 | cfleming | Well, perhaps current vimmers using Cursive for their Clojure needs :) |
| 19:16 | slester | hehe |
| 19:16 | cfleming | IdeaVim is the emulation plugin - I'm not a vim person myself, but reports say it's about evil-mode level |
| 19:16 | slester | I am feeling a few of the rough edges of vim with regards to REPLing and doc lookups and such |
| 19:19 | cfleming | slester: Ok, give it a whirl. There are some issues, as with all emulations I guess, but it mostly seems ok. Let me know if you have issues, I'm in and out over the next day or two. I'm off for a bit now but I'll be back later on. |
| 19:20 | slester | cfleming: thankee |
| 19:21 | cfleming | I'm planning to put some more serious effort into vim/emacs emulation in the new year. |
| 19:21 | slester | I just miss my vimrc. |
| 19:22 | slester | notably things like jk mapping to esc |
| 19:23 | cfleming | Yeah, I don't really know what that means :) |
| 19:23 | cfleming | Like I say, I'm planning to investigate it and get more familiar with it next year. |
| 19:23 | slester | instead of going over to hit escape, I can type jk really quickly and it'll exit insert mode |
| 19:23 | slester | yes I'm that lazy :( |
| 19:23 | slester | but escape is so very far away |
| 19:24 | cfleming | Yeah, esc is problematic. What about Ctrl-[, with caps lock as control? |
| 19:24 | slester | hmm, well, my brain is already trained to jk :( |
| 19:24 | cfleming | I know IdeaVim is customisable, but I don't know how that works or if it's doable to that extent. |
| 19:24 | slester | I'll look more into IdeaVim |
| 19:25 | justin_smith | slester: jk totally works in evil mode with emacs |
| 19:26 | justin_smith | (if you have the right emacs stuff set up of course - "evil leader mode") |
| 19:26 | slester | justin_smith: back, ye heathen! never, emacs, never! |
| 19:26 | slester | :D |
| 19:27 | justin_smith | slester: If I get tired of evil I'll try out cursive, but it's my thing for now. |
| 19:30 | slester | justin_smith: all jokes. |
| 20:27 | sdegutis | Does the "stack" in a stack-based virtual machine mean, like, an array of values that variables are talking about in that scope? So like if I have "a=1" in some pseudolanguage, it'll probably compile "a" into some index on this array, and reference that index of the "stack" array every time "a" is used? |
| 21:25 | WickedShell | I was working through some boxed math warnings today when I came across 3 warnings that all point at the same async/go but the 3 math functions its compaining about aren't anywhere in my code (indeed the functions aren't used within 200 lines of where the warning is) http://pastebin.com/E1Xh52Ja has the (async/go that it's upset about, lin 431 is the line that the async/go is on) |
| 21:25 | WickedShell | Is there any reason why I apparently have a lt nth and inc there? |
| 21:27 | amalloy | sounds like go's transformation of doseq involves some math |
| 21:28 | WickedShell | Is there a way I can look at whats its translating it to without having to drop to java byte code? |
| 21:34 | pyon | I added [me.raynes/fs "1.4.6"] to my project.clj, ran `lein deps`, and got the following error: http://ix.io/mPb. |
| 21:35 | pyon | I'm at home, and most certainly not behind a proxy. So I don't know what the error could be. |
| 21:35 | spieden | anyone know how to load a repl with a certain dep on the classpath with boot? |
| 21:36 | spieden | intuition said this but it didn't work: boot -d hashids:0.1.0 repl |
| 21:39 | spieden | hmm, actually not working when i add it to lein project either |
| 21:41 | spieden | derp, wrong artifact -- works |
| 22:03 | liuchong | hi |
| 22:04 | liuchong | are you using boot or lein? what's the difference? |
| 22:12 | tolstoy | lein is declarative, boot is scripty |
| 22:51 | princeso | it seems hard to work with a (:gen-class) Class from java, since you cant access the whole namespaces like you do when working in the REPL --- [java.lang.ClassNotFoundException: schema.core, compiling:] |
| 22:52 | princeso | yuo are forced to (:require) in the (ns). |
| 22:58 | princeso | How to translate those REPL capabilities to the VM |
| 23:00 | princeso | classpaths are the same |
| 23:02 | justin_smith | princeso: you can use clojure.lang.RT |
| 23:03 | justin_smith | with that you can require namespaces, get vars from the namespaces, etc. |
| 23:14 | owlbird | how to convert (sql, {:name "alice" :age 20 ...}) to [sql where name=? and age=? .... "alice" 20], should use "recur" ? |