2016-02-24
| 00:28 | Guest73345 | I'm having a problem trying to create an uberjar with boot. I've set up a simple repository with a build.boot file containing a task called "build". After running "boot build" I don't find anything in my target directory. I'm following the instructions on several websites (https://lionfacelemonface.wordpress.com/2015/01/17/boot-getting-started-with-clojure-in-10-minutes/) but it doesn't seem to work. Can anyone point out what I'm do |
| 00:28 | Guest73345 | wrong? Here's a link to the project on github: https://github.com/patterkyle/pietro/blob/master/build.boot |
| 05:29 | WickedShell | oO I just noticed that constant math expressions aren't evaluated at compile time... Is there anyway to get them to evaluate? I have some layout math in the hotloop that I did with some const def's as that was much more readable then hardcoding numbers, but since its actually doing the math per loop that's really painful... |
| 05:32 | TMA | WickedShell: you could try read-time evaluation |
| 05:34 | WickedShell | TMA I'm not quite following can you elaborate? Is there already a way to get this evaluated once instead of per loop? |
| 05:37 | TMA | WickedShell: say you have an expression (+ a (* 3 5)) ; you want to evaluate the (* 3 5) to 15 -- either you can (+ a #.(* 3 5)) or you can (defmacro eval-now [x] (eval x)) (+ a (eval-now (* 3 5))) |
| 05:38 | TMA | WickedShell: the #. is Common Lisp syntax, I would need to check, whether it is the same in clojure or whether it uses another squiggle |
| 05:40 | TMA | WickedShell: the first thing actually performs the evaluation at read time -- the compiler sees (+ a 15), while the second approach performs the evaluation at compile time |
| 05:41 | WickedShell | read time would be better, the first version causes the repl to choke though... |
| 05:41 | TMA | WickedShell: it's spelled #= in clojure |
| 05:43 | TMA | ,'(+ a #=(* 3 5)) |
| 05:43 | clojurebot | #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.> |
| 05:44 | TMA | WickedShell: you might get this error when in restricted environment though :) |
| 05:46 | hyPiRion | ,(binding [*read-eval* true] '(+ a #=(* 3 5))) ; ?? |
| 05:46 | clojurebot | #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.> |
| 05:46 | hyPiRion | mean |
| 05:46 | WickedShell | TMA it works on a simple expression bnut it appears to crash as soon as I put it in a expression that as ^:const member :/ |
| 05:46 | TMA | hyPiRion: it has already been read by the time the binding comes in |
| 05:47 | TMA | WickedShell: oh, that means it's not a constant expression after all |
| 05:48 | WickedShell | and it can't evaluate nested expressions which is kinda weird :P #=(+ 3 (- 2 5)) wont work for example |
| 05:48 | WickedShell | TMA pretty sure it really is constant, its showing up in the bytecode successfuly replaced anyways |
| 05:49 | TMA | WickedShell: try the other approach with the named macro |
| 05:51 | TMA | WickedShell: there might be an issue with the #= that the thing to be evaluated is not yet in existence (I do not know when forms are evaluated when loading a clojure file, it might as well read the whole file before any of the forms therein gets evaluated) |
| 05:52 | WickedShell | TMA that still complies to a runtime eval based on the bytecode |
| 05:52 | WickedShell | RT.uncheckedFloatCast(((IFn)const__60.getRawRoot()).invoke(Numbers.unchecked_minus(Numbers.divide(-200L, 2L), 25L))) |
| 05:53 | TMA | WickedShell: could you share the source snippet? |
| 05:55 | WickedShell | TMA http://pastebin.com/yhBETpCm the actual float is used in an interop call but thats outside the scope |
| 05:55 | clojurebot | Alles klar |
| 05:56 | hyPiRion | TMA: oh yeah, true that |
| 05:57 | TMA | WickedShell: let me experiment a bit |
| 06:00 | TMA | somehow running lein repl from a cygwin terminal and pasting into that from the clipboard is very slow -- one character per second or so |
| 06:01 | TMA | would anyone know why that might be the case? |
| 06:02 | TMA | WickedShell: how did you obtain the RT.uncheckedFloatCast(((IFn)const__60.getRawRoot()).invoke(Numbers.unchecked_minus(Numbers.divide(-200L, 2L), 25L))) translation? |
| 06:04 | WickedShell | TMA jd-gui over the AOT'd result |
| 06:05 | WickedShell | I'm sure no.disassemble could also do it, but I haven't succeeded in making it work locally so jd-gui was the easiest way to go :P |
| 06:07 | TMA | WickedShell: try (defmacro eval-now [x] (eval x)) followed by (eval-now (float (- (/ HUD_WIDTH 2) 25))) |
| 06:09 | WickedShell | pretty sure thats what I tried (well the eval-now was inside the (float) will retry now |
| 06:10 | WickedShell | yeah thats what I did to get the disassembly I sent you |
| 06:11 | TMA | that's weird |
| 06:11 | WickedShell | if I dont put that macro in the invoke() call will go away but the math is still there |
| 06:11 | TMA | or maybe it is not |
| 06:19 | TMA | I don't seem to be able to compile ahead of time. My magic is weak |
| 06:39 | dazlow | How do I time function like "time" does but rather than print to stdout return time to me? |
| 06:40 | TMA | alas, when I figured it out, WickedShell is no more |
| 06:40 | andyf | dazlow: You could make your own slightly-modified version of the time macro that does that. It is pretty short and wouldn't be difficult to write a modified version. |
| 06:42 | MJB47 | TMA: im still interested |
| 06:43 | andyf | dazlow: For example: (defmacro time2 [expr] `(let [start# (. System (nanoTime)) ret# ~expr] (/ (double (- (. System (nanoTime)) start#)) 1000000.0))) |
| 06:43 | dazlow | andyf: yeah, I'm writing macro now, thanks |
| 06:45 | TMA | MJB47: my (eval-now ...) approach does in fact work; if it is wrapped in a body of a function [say (defn do-foo [] (eval-now ...))], the compiled function doesn't do the computation. it has the result precomputed in static {} block and stored in const__1 static final field, which it loads and returns |
| 06:45 | MJB47 | ty |
| 06:48 | TMA | MJB47: probably the difference is when the (eval-now ...) form is a top-level form |
| 06:48 | MJB47 | i wonder if its actually due to inlining |
| 06:50 | TMA | MJB47: it should not be. macros perform transformations on the parse tree, which is then compiled after it is macro-free |
| 06:51 | TMA | MJB47: the eval-now forces the evaluation at compile time, inserting the reduced result into the tree, so the further stages of the compiler do not even see the original code |
| 06:52 | TMA | MJB47: in a sense it is manually inlining the result of the evaluation |
| 09:56 | rcassidy | TimMc: up() { for n ({1..$1}) do cd ..; done } |
| 09:56 | rcassidy | oops, that was waaaay in backscroll, didnt realize iw as reading the past |
| 10:08 | sdegutis | Anyone noticing wrap-file-info being highlighted with a red-ish background color by CIDER? |
| 10:09 | sdegutis | I just saw that this morning and don't know why it's happening, and the CIDER readme doesn't mention it at all. |
| 10:10 | rcassidy | is it because it's marked deprecated? |
| 10:10 | sdegutis | That was my first guess, but -- oh yeah, I see it now in the metadata, :deprecated "1.2 |
| 10:10 | sdegutis | Thanks rcassidy. |
| 10:11 | sdegutis | Cool feature! |
| 10:20 | rcassidy | yeah, that's super neat. |
| 10:22 | sdegutis | Is it possible to replace (if a b c) with a solution that uses (and) and/or (or)? |
| 10:22 | sdegutis | Disclaimer: this is a homework-style problem and not practical or something I would ever consider using |
| 10:25 | rcassidy | ,(defn if-bad [a b c] (or (and a b) c)) |
| 10:25 | clojurebot | #'sandbox/if-bad |
| 10:25 | rcassidy | ,(if-bad true 1 2) |
| 10:25 | clojurebot | 1 |
| 10:25 | rcassidy | ,(if-bad false 1 2) |
| 10:25 | clojurebot | 2 |
| 10:25 | TimMc | ,(if-bad true false 2) |
| 10:26 | clojurebot | 2 |
| 10:26 | rcassidy | fiiiince |
| 10:26 | rcassidy | *fine |
| 10:26 | rcassidy | that's why I called it if-bad |
| 10:26 | xemdetia | if-lucky |
| 10:28 | Glenjamin | until python 2.5, that was the only way to do ternary expressions :D |
| 10:28 | TimMc | ,(({true (constantly 1)} (= 1 1) (constantly 2))) |
| 10:28 | clojurebot | 1 |
| 10:28 | TimMc | ,(({true (constantly 1)} (not= 1 1) (constantly 2))) |
| 10:28 | clojurebot | 2 |
| 10:29 | TimMc | (the fundamentals of how to do it in swearjure) |
| 10:39 | sdegutis | rcassidy: nice! |
| 10:40 | sdegutis | Glenjamin: in Go it still is |
| 10:41 | wutf | what's a better way to do this? (->> ... (apply concat) (apply concat) (apply concat) (apply concat)) |
| 10:41 | sdegutis | Glenjamin: also, your map-based solution uses strict evaluation on the clause that won't be run |
| 10:41 | sdegutis | wutf: flatten |
| 10:56 | TimMc | ~flatten |
| 10:56 | 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. |
| 10:56 | TimMc | wutf: ^ |
| 10:57 | sdegutis | TimMc: either he has lists 4 levels deep and wants exactly only that gone away with, or he just wants the behavior flatten gives. I betted on the latter. It's a gamble I admit, but I took the chance anyway. |
| 10:57 | sdegutis | wutf: please confirm whether TimMc or I am right, so we can settle this dispute once and for good. |
| 10:58 | TimMc | Or you could do (for [a ..., b a, c b, d c] d) I think... |
| 10:59 | TimMc | might need another level |
| 11:01 | sdegutis | TimMc: I don't think that'll produce the lists back, will it? |
| 11:01 | sdegutis | Hmm. I wonder now. |
| 11:01 | wutf | i am working on it |
| 11:01 | spion_ | is there a macro that acts like `use` for namespaces, but only within the passed s-expression? |
| 11:02 | TimMc | ,(for [a [[[[4 5]]]], b a, c b, d c] d) |
| 11:02 | wutf | the lists are super nested ((((( |
| 11:02 | clojurebot | (4 5) |
| 11:02 | TimMc | wutf: Can you avoid the extreme nesting in the first place? |
| 11:03 | spion_ | e.g. (using ['ns1 'ns2 'ns3] (expression)) |
| 11:03 | wutf | it's due to using nested for loops to destructure a nested hash map |
| 11:03 | TimMc | wutf: You know that for can take multiple clauses? |
| 11:04 | wutf | yeah i guess i knew that. i don't technically need to nest them, it will destructure them right? |
| 11:04 | wutf | if i just include the appropriate bindings |
| 11:04 | Glenjamin | wutf: can you show us an example of the hash-map you're destructuring? |
| 11:05 | wutf | it's literally a nested hash map, exported to edn from json in python |
| 11:06 | zerokarmaleft | perhaps get-in would get you most of the way |
| 11:06 | wutf | i tried using that but couldn't get it to work |
| 11:06 | Glenjamin | you can nest destructuring, i'm not clear why you'd need for loops |
| 11:07 | wutf | yeah so basically there is almost never a need for nested for loops right |
| 11:07 | wutf | trying this out |
| 11:07 | Glenjamin | there are some needs, but it's not clear whether or not yours is one of them |
| 11:08 | sdegutis | spion_: you can make a macro that creates a temporary namespace (and destroy it when done) and calls 'use' inside it. |
| 11:08 | zerokarmaleft | ,(let [[_ fruit _] (get-in {:foo {:bar {:baz ["cat" "apple" "car"]}}} [:foo :bar :baz])] fruit) |
| 11:08 | clojurebot | "apple" |
| 11:08 | sdegutis | spion_: I would advise against this however. |
| 11:08 | sdegutis | wutf: can you gist the json file or the hash-map itself? |
| 11:09 | TimMc | spion_: https://github.com/timmc/handy/blob/handy-1.7.0/src/org/timmc/handy.clj#L97 but I'd only use it for testing... |
| 11:09 | TimMc | org.timmc.handy -- with-temp-ns |
| 11:09 | wutf | {"blah" : {"blerg" : {"bloom": {"blum": ... |
| 11:10 | wutf | i do have code that destructures it in one go using a doseq |
| 11:10 | sdegutis | wutf: there's gist.github.com |
| 11:10 | spion_ | sdegutis: would be very convenient for things like om, e.g. (using ['om.dom] (dom goes here)) |
| 11:10 | sdegutis | spion_: Personally I use (:require [some.lib :as lib]) and then just use (lib/foobar). |
| 11:11 | sdegutis | spion_: It's much easier to keep track of the symbols being used and where they come from. |
| 11:11 | sdegutis | spion_: also, you may want to split out some code into a namespace specific to using that library, where *all* the code in that file will be using that library. |
| 11:11 | TimMc | spion_: Yeah, don't use with-temp-ns for your main code. :-) |
| 11:12 | spion_ | sdegutis: I think `using` would provide a compromise between ease of use and ease of tracking, as its very local so its only worth using if you are using many of those functions |
| 11:12 | spion_ | (in that sense its better than :use) |
| 11:12 | Glenjamin | ,(let [{ { { { :keys [blum] } :bloom } :blerg } :blah } {:blah {:blerg {:bloom {:blum 'abc} } } } ] blum) # wutf |
| 11:12 | clojurebot | abc |
| 11:13 | sdegutis | spion_: except then you can't scan the top of the file to see what other namespaces it requires, since you mix in uses anywhere in a file that could be any number of pages long |
| 11:14 | wutf | Glenjamin i'm having a hard time reading that :) |
| 11:14 | spion_ | sdegutis: it would have to be require'd |
| 11:14 | sdegutis | spion_: but if you're firm-set in creating a macro like this, use basically does a combination of clojure.core/require and clojure.core/refer, so you could use those functions yourself in your own macro. |
| 11:14 | sdegutis | spion_: I can write that macro for you for $200 right now and be done in 20 minutes. |
| 11:14 | wutf | you declared the structure of the data first, then provided the actual data, in the binding? |
| 11:14 | Glenjamin | yeah, the left-hand-side is the key bit |
| 11:14 | wutf | then had transparent access to blum. i also need blah, blerg, bloom. |
| 11:14 | spion_ | sdegutis: no need, I was just wondering if it was already there and I'm missing something. Thanks :) |
| 11:14 | sdegutis | Surely. |
| 11:15 | Glenjamin | ,(let [{ { { { :keys [blum] } :bloom :as bloom } :blerg :as blerg } :blah :as blah } {:blah {:blerg {:bloom {:blum 'abc} } } } ] [blum bloom blerg blah]) |
| 11:15 | clojurebot | [abc {:bloom {:blum abc}} {:blerg {:bloom {:blum abc}}} {:blah {:blerg {:bloom {:blum abc}}}}] |
| 11:15 | wutf | ah |
| 11:15 | wutf | neat |
| 11:15 | wutf | i don't really understand the :keys [blum] part |
| 11:16 | wutf | also not clear that this will actually loop over the entire map giving me access to all blah-blerg-bloom-blum combinations |
| 11:16 | Glenjamin | starts to get a bit weird at that point, so a big (let [blarg (get-in data [...]) blah (get-in blarg [...]) might be clearer |
| 11:16 | Glenjamin | oh, you want to convert the entire map into locals? |
| 11:17 | wutf | yeah, i'm looping over the whole shebang and inserting it into datomic |
| 11:17 | wutf | i've done it like five different ways by now |
| 11:17 | wutf | trying to avoid side effects at this point |
| 11:26 | wutf | destructuring is magic :) |
| 11:29 | wutf | i piped the (((()))) mess to flatten flatten which was at least less verbose than (apply concat) (apply concat) |
| 11:52 | justin_smith | TMA: regarding the discussion last night about evaluating things at compile time, anything defined with def is fully evaluated at compile time |
| 11:53 | justin_smith | I mean I guess reader macros could help if you want compile time eval inside a lambda somewhere, but defs are already compile time expressions |
| 11:58 | sdegutis | I'm back. |
| 12:01 | xitrium | Anyone here use transducers much? to programmatically build up a series of steps, do you typically pass around both the combined steps and the collection until you're ready to realize it? |
| 12:02 | justin_smith | xitrium: I've never actually used them that way. I've used them to replace a series of steps with a single combined transformation though. |
| 12:03 | xitrium | yeah, that's my aim too - just my steps are generated at runtime |
| 12:03 | justin_smith | sounds like a great use of transducers, yeah |
| 12:04 | xitrium | sweet |
| 12:10 | sdegutis | Hi. |
| 12:10 | sdegutis | xitrium: what's the use-case btw? I'm intrigured by such a situation. |
| 12:15 | sdegutis | This just in: All of my code sucks. |
| 12:18 | sdegutis | Abstractly, how would you implement a loop which runs (f) every 2 seconds until stopped? |
| 12:18 | sdegutis | I'm specifically asking you justin_smith and Glenjamin. |
| 12:19 | Glenjamin | erm, do you already have core async in the project? |
| 12:19 | justin_smith | sdegutis: how accurate does the timing have to be? |
| 12:19 | sdegutis | Glenjamin: not yet. |
| 12:19 | sdegutis | justin_smith: not super accurate, just so long as it's no less than 2 seconds. |
| 12:19 | justin_smith | sdegutis: I'd use a ScheduledExecutorService (or a wrapper of that, like at-at) |
| 12:20 | Glenjamin | Probably Thread.new or future with a sleep then, and something to check for thread interrupts |
| 12:20 | sdegutis | Also I'm using Clojure 8 and Java 8. |
| 12:20 | Glenjamin | depends how throwaway this is i suppose |
| 12:20 | sdegutis | Not very throwaway. |
| 12:21 | sdegutis | Glenjamin: I'm not opposed to including core.async. |
| 12:21 | Glenjamin | probably go with justin's then |
| 12:21 | sdegutis | justin_smith: thanks I will look into that Java Class. |
| 12:21 | justin_smith | the advantage of ScheduledThreadpoolExecutorService or whatever it's called (I think I had it wrong above) is it gives nice tools for managing tasks and saying "start every X" or "run every X" (different things...) |
| 12:21 | sdegutis | justin_smith: it's called ScheduledExecutorService I think. |
| 12:21 | sdegutis | "An ExecutorService that can schedule commands to run after a given delay, or to execute periodically." |
| 12:21 | justin_smith | sdegutis: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html |
| 12:22 | sdegutis | So yeah it sounds precisely as what i need. |
| 12:22 | justin_smith | that's a class that implements SES |
| 12:22 | justin_smith | so I was right both times, one is the interface, the other is the class |
| 12:23 | justin_smith | sdegutis: anyway, the class is easy to use, but depending on how you feel about adding deps on random thin wrappers, at-at is even easier to use |
| 12:24 | sdegutis | justin_smith: I think I'm somewhat similar to you philosophically in that I'm okay with using the Java class directly and dealing with slight Java ugliness in order to avoid adding an extra dependency. |
| 12:25 | sdegutis | Yes ScheduledThreadPoolExecutor is right. |
| 12:35 | sdegutis | This appears to be perfect. |
| 12:36 | sdegutis | justin_smith: gratitude |
| 12:41 | sdegutis | justin_smith: wow you weren't kidding! https://gist.github.com/sdegutis/d1109109bc56ab7ffb55 |
| 12:50 | max3 | if conversions is a map with functions as values (of the correct types) and vamp-key and value are both strings can someone tell me what this does: ((get conversions vamp-key) value) |
| 13:00 | justin_smith | sdegutis: nice, glad I could help - and yeah in my experience it is that simple |
| 13:01 | TimMc | hyPiRion: Do you remember how to implement boolean in swearjure? |
| 13:01 | justin_smith | max3: that looks up a function in conversions, and calls it with value as an argument |
| 13:01 | justin_smith | ,((get {:frob inc} :frob) 0) ; max3 - it is doing this |
| 13:01 | clojurebot | 1 |
| 13:02 | TimMc | nvm, found it, I did the stupid thing: https://github.com/timmc/swearjure/blob/08895fd01e30b5c93225577ecb4165fd9dd3830e/src/org/timmc/swearjure.clj#L29-L31 |
| 13:09 | max3 | thank you justin_smith |
| 13:17 | sdegutis | Strange error. |
| 13:17 | sdegutis | "No matching method: SECONDS" |
| 13:17 | sdegutis | java.util.concurrent.TimeUnit/SECONDS |
| 13:17 | justin_smith | sdegutis: I think your doto is a bit off... |
| 13:18 | sdegutis | Sounds right. |
| 13:18 | justin_smith | sdegutis: SECONDS should be an arg, not something you call in the doto |
| 13:18 | justin_smith | so you need some parens somewhere |
| 13:18 | sdegutis | Ahh yes. I see. Completely forgot parens. |
| 13:18 | sdegutis | justin_smith: how did you know so quickly? |
| 13:18 | sdegutis | How did you know it was a doto? |
| 13:18 | justin_smith | sdegutis: I was gonna say something but figured it was just a hasty paste with a bad edit |
| 13:18 | justin_smith | sdegutis: you shared a paste earlier, also I am psychic so there is that too |
| 13:19 | sdegutis | Oh. |
| 13:19 | sdegutis | Haha. |
| 13:19 | justin_smith | "There are bugs, so many bugs" |
| 13:19 | justin_smith | "things throwing exceptions" |
| 13:19 | justin_smith | your future is now known |
| 13:20 | sdegutis | LOL |
| 13:21 | justin_smith | "the stack traces - ongodly deep stack traces seemingly without end" |
| 13:22 | sdegutis | Wow it's like you're reading the code right off my screen! |
| 13:25 | sdegutis | Yay now my email queue can be a component! |
| 13:34 | TMA | justin_smith: thanks, I did not knew that |
| 13:38 | justin_smith | sdegutis: on the psychic topic, I had the idea for an html widget to replace radio buttons and list selectors. It would be a magic eight ball (like the toy) and you click it and one of the options comes into view. |
| 13:38 | sdegutis | Haha! That is so impractical but fun. |
| 13:38 | sdegutis | Like 2048! |
| 13:38 | sdegutis | or http://mienfield.com/ |
| 13:40 | sdegutis | That was in response to justin_smith. |
| 13:43 | justin_smith | TMA: common source of bugs in deployment is the expectation that things inside def are not run when aot compiling (they are, because def is always fully evaluated as part of compilation) |
| 13:45 | sdegutis | TMA? |
| 13:45 | sdegutis | The More A-you-know? |
| 13:45 | sdegutis | Time Matters Asynchronously? |
| 13:45 | sdegutis | Hold on don't tell me, I can figure it out. |
| 13:45 | justin_smith | sdegutis: too many apples |
| 13:46 | justin_smith | https://en.wikipedia.org/wiki/TMA |
| 13:46 | TMA | sdegutis: you can figure out something, but I doubt it would be it |
| 13:47 | rhg135 | I agree with the last one, cuz apples |
| 13:47 | sdegutis | Oh! It's a nickname! |
| 13:47 | sdegutis | Haha I should pay more attention. |
| 13:48 | sdegutis | So, I randomly emailed a random programmer whose blog I found via HN the other day. Actually had a pleasant correspondence! 9/10 would recommend. |
| 13:56 | rhg135 | I thought it was normal to not be unpleasant to strangers |
| 13:58 | sdegutis | rhg135: but it's not normal to email strangers and discuss code |
| 13:58 | sdegutis | rhg135: what's your favorite proggin lang? |
| 13:59 | rhg135 | sdegutis: I'm surprised you have to ask |
| 13:59 | sdegutis | rhg135: ah so Lua? |
| 13:59 | TMA | rhg135: if you are right, I probably want to move to your country. which country that might be? |
| 14:00 | rhg135 | Just* |
| 14:00 | sdegutis | rhg135: meh Lua's ok, but I don't see why it's your favorite, that's a bit excessive |
| 14:00 | rhg135 | Somewhere in wonderland |
| 14:02 | rhg135 | It's a midpoint between clojure and c |
| 14:02 | sdegutis | rhg135: true enough |
| 14:03 | justin_smith | I think the "politeness to strangers" thing mainly varies with population density. In less crowded places you have more incentive not to piss anyone off, in more crowded places you have less disincentive to be a jerk (both of thse because of probability of ever seeing the person again) |
| 14:04 | justin_smith | like, in a town with 100 people making one enemy is a big problem, in a city you can make many enemies and usually never see them again |
| 14:04 | sdegutis | Guys help me work on the edges of the hole at http://mienfield.com/948_-957 |
| 14:05 | rhg135 | If I get a random email, I don't reply with 'f*** off' I just won't reply. Maybe that's what you meant |
| 14:06 | sdegutis | rhg135: well a more polite version of that, yeah |
| 14:06 | sdegutis | rhg135: "sorry, I don't know you and this is weird, please don't ever email me again, good bye" |
| 14:06 | sdegutis | rhg135: which I did get once actually a few years ago |
| 14:07 | rhg135 | Lol |
| 14:08 | sdegutis | rhg135: they're actually the more prudent ones of the group, since they know better than to talk to strangers |
| 14:09 | rhg135 | My approach has been to lure them on irc and convince them it's pointless |
| 14:09 | sdegutis | rhg135: in this case I'm not creepy or deranged, but they never know -- I would answer similar to that one person |
| 14:09 | sdegutis | rhg135: what's pointless? you mean "pointless" or point-free style in Haskell? |
| 14:09 | sdegutis | rhg135: why are you talking about Haskell suddenly? where'd that topic change come from? |
| 14:10 | rhg135 | Ah, context. I get inquiries about an ancient device and its software |
| 14:11 | sdegutis | Oh. |
| 14:13 | rhg135 | It's pointless in the sense that even if by some miracle you got anything working, nobody knows wtf a gelato is (not the desert) |
| 14:15 | justin_smith | rhg135: the gelato desert is a harrowing wasteland of pistachios |
| 14:15 | justin_smith | (sorry) |
| 14:17 | rhg135 | Mmm pistachios |
| 14:17 | sdegutis | :) |
| 14:17 | sdegutis | fwiw I don't know what a gilato is even as a dessert |
| 14:18 | justin_smith | sdegutis: gelato is italian style ice cream - more fat and less water than normal ice cream, the good stuff is like frozen butter with sugar and flavors |
| 14:19 | sdegutis | Oh weird. |
| 14:19 | justin_smith | it's so heavy that the scoops are much smaller usually (but just as filling) |
| 14:19 | sdegutis | Yesterday I learned that I really like Mexican food, which I never thought I would like. My wife made these chicken wraps, and they were delicious. It was chicken, mayo, salsa, cayanne pepper, a little cucumbers, and some honey, wrapped in a tortilla. It was great. |
| 14:20 | sdegutis | Also she makes these nachos that are just excellent. Hold on I'll get a photo for you. |
| 14:21 | sdegutis | Never mind I can't find it you'll just have to trust me on it. |
| 14:21 | justin_smith | it's for the best I am on an immutable data structure diet so it would just be a tease |
| 14:23 | rhg135 | Food in general is mutable |
| 14:23 | justin_smith | rhg135: oh man that makes me think of 2g1c as swap! and uck |
| 14:23 | justin_smith | sorry for that image |
| 14:24 | rhg135 | My brain can't form imagery yet, so it's all good |
| 14:25 | justin_smith | lucky |
| 14:26 | rhg135 | I tried writing C once, I've never been three same |
| 14:38 | sdegutis | rhg135: false |
| 14:39 | sdegutis | rhg135: food runs through a digest function which hashes it into poop |
| 14:40 | sdegutis | My code has a really strange and ugly dependency tree. |
| 14:41 | sdegutis | Most of my components do not have any dependence on the app's primary business logic, so the graph strictly flows outward. But two do, and it's weird. |
| 14:41 | sdegutis | How do you solve this? Extract it into a function that you give the component which it can then call? |
| 14:43 | wouter_ | hello, i was wondering if anyone can help me. I have written a macro in Clojure for use in Clojurescript, but I get Uncaught SyntaxError: Unexpected token . . A simplified version of the macro I was writing is: (defmacro test [x] `(defmulti ~x (fn [& _] :default))). can someone help me? |
| 14:44 | sdegutis | wouter_: hi |
| 14:44 | wouter_ | hi sdegutils |
| 14:44 | sdegutis | wouter_: Check if ClojureScript has defmulti. |
| 14:44 | sdegutis | Maybe it does not? |
| 14:45 | wouter_ | i have used defmulti and defmethod in clojurescript before |
| 14:45 | sdegutis | wouter_: Then I'm wrong. |
| 14:46 | sdegutis | wouter_: That was as much assistance as I can be of. Good day. |
| 14:46 | wouter_ | alright thank you |
| 14:46 | sdegutis | wouter_: You're very welcome. Best of luck to you finding out your solution. |
| 14:46 | wouter_ | thanks |
| 14:47 | justin_smith | wouter_: have you tried macroexpanding the macro? |
| 14:47 | justin_smith | where does it insert a . ? |
| 14:47 | wouter_ | yes, that works actually. wait, i will give you the result |
| 14:48 | justin_smith | wouter_: I think your [& _] has to be [& _#] because ` |
| 14:48 | wouter_ | so i try the following in clojurescript: cljs.user> (macroexpand-1 '(nedarch.helper/dm bla)) (clojure.core/defmulti bla (clojure.core/fn [& nedarch.helper/_] :default)) |
| 14:49 | justin_smith | [& nedarch.helper/_] is the problem |
| 14:49 | justin_smith | that is not a valid binding |
| 14:49 | justin_smith | if you change _ to _# that will be fixed |
| 14:49 | wouter_ | alright, thanks a lot! i will try to see if it works! |
| 14:52 | wouter_ | no, it does not work unfortunately. even if i remove the & and _ for the purpose of testing and replace it with (fn [y] ...), it does not work unfortunately |
| 14:52 | justin_smith | wouter_: NO |
| 14:52 | justin_smith | you did not do what I said |
| 14:52 | justin_smith | replace _ with _# |
| 14:52 | justin_smith | or replace your y with y# |
| 14:53 | justin_smith | the problem isn't that _ is _, it is that it does not end with # |
| 14:53 | justin_smith | ,`(fn [x] x) |
| 14:53 | clojurebot | (clojure.core/fn [sandbox/x] sandbox/x) |
| 14:53 | justin_smith | ,`(fn [x#] x#) |
| 14:53 | wouter_ | sorry, it works, i tried that first but somehow it was not compiled. this seems to work! |
| 14:53 | clojurebot | (clojure.core/fn [x__49__auto__] x__49__auto__) |
| 14:53 | justin_smith | see the difference? |
| 14:54 | wouter_ | yes, thank you very much justin, i can now continue with my program :) |
| 14:54 | justin_smith | cool, sorry for the CAPS |
| 14:54 | justin_smith | haha |
| 14:54 | wouter_ | no worries, thanks a lot! :) |
| 14:56 | sdegutis | You know, I've been meaning to write my Clojure-like language for a few years now. But I keep thinking to myself "nobody will use this, in fact I will probably rarely use this," and it's been convincing me to use my time for other things instead. |
| 14:56 | sdegutis | But I think it's time to just ignore that fact and start working on it. |
| 14:57 | sdegutis | Because even if it's not useful to me or anyone I know, it could eventually be useful to someone. Maybe. Or something. |
| 15:23 | sdegutis | ,`(fn [x#] x#) |
| 15:23 | clojurebot | (clojure.core/fn [x__25__auto__] x__25__auto__) |
| 15:23 | sdegutis | Cool. |
| 15:23 | sdegutis | ,`(fn [x#] (str 'x#)) |
| 15:23 | clojurebot | (clojure.core/fn [x__50__auto__] (clojure.core/str (quote x__50__auto__))) |
| 15:23 | sdegutis | ,(`(fn [x#] (str 'x#)) "foo") |
| 15:23 | clojurebot | #error {\n :cause "clojure.lang.Cons cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.Cons cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval76 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval76 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval76 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java"... |
| 15:24 | sdegutis | ,((eval `(fn [x#] (str 'x#))) "foo") |
| 15:24 | clojurebot | "x__100__auto__" |
| 15:24 | sdegutis | Hahaha. Silly Clojure, escaping details. |
| 15:33 | Kamuela | I think I'm looking for some pain tonight. Ok. So is it Emacs with Cider that's the ultimate setup? |
| 15:33 | TimMc | that'll get you some pain, sure |
| 15:33 | TimMc | more the cider part of things |
| 15:34 | amalloy | well, if you're not familiar with emacs there's some pain learning that stuff |
| 15:35 | amalloy | also if you do start learning emacs, my advice is to do something to make the mouse and arrow keys both un-usable and then press ctrl-h, followed by t, to start the tutorial |
| 15:37 | TimMc | Good point. Kamuela, how familiar are you with Emacs to begin with? |
| 15:38 | TimMc | amalloy: I should go through the tutorial again at some point. :-P |
| 15:44 | sdegutis | Kamuela: in my opinion it's the best interactive experience, but it also needs paredit |
| 15:44 | Kamuela | TimMc: pretty much zero |
| 15:44 | sdegutis | Kamuela: ok then you're in for about 2 weeks of nothing but pain |
| 15:44 | amalloy | nah |
| 15:45 | Kamuela | sdegutis: is paredit not part of cider? |
| 15:45 | sdegutis | Kamuela: I'm super productive in Emacs with Paredit and Cider but I have absolutely no idea how to use it anymore, only my fingers remember how. |
| 15:45 | sdegutis | Kamuela: it is not |
| 15:46 | amalloy | sdegutis tries to be helpful sometimes but right now i think he is just trying to scare you |
| 15:47 | sdegutis | Kamuela: yah I was exaggerating just a bit.. expect to have some bumps in the road and frustration while teaching your fingers how to use emacs, but in about 1 or 2 weeks you should be pretty comfortable using it.. and in another 2 weeks you should have a decent ~/.emacs.d/ |
| 15:47 | Kamuela | Is this a decent guide? http://www.braveclojure.com/basic-emacs/ |
| 15:48 | sdegutis | I forgot what guides I used for learning Emacs like 4 years ago. |
| 15:48 | justin_smith | Kamuela: the C-h t thing amalloy mentions (the built in tutorial) has the most important basics |
| 15:49 | Kamuela | I'll follow this guide then and make sure to do the built in tutorial |
| 15:49 | sdegutis | yeah definitely, although it's written terribly and extremely verbose and time-consuming |
| 15:49 | sdegutis | (the builtin guide) |
| 15:50 | sdegutis | It's almost as if it were written by RMS. |
| 15:50 | justin_smith | sdegutis: it needs big blocks of text so you can practice all the motion commands |
| 15:50 | justin_smith | sdegutis: I think it might have been written by RMS |
| 15:50 | sdegutis | justin_smith: that explains it then |
| 15:50 | sdegutis | justin_smith: if #2 is true then #1 is merely coincidence |
| 15:50 | sdegutis | Although I admit #1 is a real benefit. |
| 15:51 | rcassidy | i'm doing pretty OK with vim, paredit, and fireplace, if you're already somewhere in that camp, but i bet emacs/cider is awesome too. sounds like it's more integrated. |
| 15:52 | sdegutis | rcassidy: lately cider shows you the evaluated result in-line in your text file (highlighted as a comment) and it disappears as soon as you do anything, which is convenient |
| 15:52 | justin_smith | I've been using clojure-mode and evil, and might have to try the vim/fireplace thing one of these days. The new lady on my team uses vim/fireplace and it looks decent. |
| 15:52 | rcassidy | sdegutis: in-line in the file? as a comment? woah. |
| 15:52 | sdegutis | rcassidy: in the buffer, yeah |
| 15:52 | rcassidy | woah |
| 15:52 | sdegutis | it's super neat |
| 15:53 | justin_smith | kind of like light-table? |
| 15:53 | rcassidy | i'm not sure if i want that, but it sounds flashy |
| 15:53 | sdegutis | justin_smith: probably, I dunno |
| 15:53 | sdegutis | rcassidy: it's been very convenient, I have to admit |
| 15:53 | sdegutis | It's also got var-aware, namespace-aware auto completion. |
| 15:54 | sdegutis | It's pretty much a sweet IDE at this point. |
| 15:55 | sdegutis | It's also got a nice function to replace the result of your function call in-line, so if you type (vec (range 5)) and then press C-c C-w, it replaces it with [0 1 2 3 4] in your file. |
| 15:56 | sdegutis | That's not super useful but it's neat anyway for the few times you want to put literal data in your file for whatever reason. |
| 15:56 | TimMc | Kamuela: This is an emacs pre-guide that I wrote when I was first learning it: https://www.brainonfire.net/blog/emacs-n00b-start/ The idea is to read that first, then go to some other guide. This one just teaches you the basics like how to cancel, how to quit, and some terminology. |
| 15:57 | ystael | didn't emacs used to have C-x C-c, C-g, and C-h t mentioned on the startup screen? |
| 15:57 | sdegutis | Hmm. I wrote a starter kit slash cheat sheet a few years ago, but there was 0 interest in it so I deleted it. |
| 15:57 | justin_smith | ystael: it still does, but who actually reads that stuff :) |
| 15:58 | sdegutis | justin_smith, ystael: especially when you can just do (setq initial-scratch-message "" inhibit-startup-screen t inhibit-splash-screen t) to avoid seeing it |
| 15:58 | ystael | ooh, I didn't know about `initial-scratch-message` |
| 15:59 | sdegutis | You'd be surprised how many variables Emacs comes with, especially ones that seem a bit redundant. |
| 15:59 | justin_smith | sdegutis: if you know how to do that you probably don't need C-h t, but maybe someone made a bad choice when designing a starter kit you use, who knows |
| 15:59 | sdegutis | :D |
| 16:00 | sdegutis | justin_smith: meh I was more or less trying to make a bad joke |
| 16:00 | sdegutis | speaking of bad jokes |
| 16:00 | sdegutis | hold on im looking for it |
| 16:02 | sdegutis | i made this dad-joke this weekend http://i.imgur.com/oeLDBhB.jpg |
| 16:12 | Kamuela | i notice that i find ctrl on mac really hard to deal with |
| 16:12 | Kamuela | is emacs basically built around ctrl and alt commands? |
| 16:13 | justin_smith | Kamuela: yeah, it helps to swap control and caps-lock |
| 16:14 | postpunkjustin | Kamuela: how often do you use caps lock? |
| 16:14 | postpunkjustin | dammit double justin again |
| 16:14 | Kamuela | hmm |
| 16:14 | postpunkjustin | I'll get you one of these days, justin_smith |
| 16:14 | justin_smith | postpunkjustin: I'll rate limit and give you a chance |
| 16:14 | Kamuela | It's possible that I can just work through my disability for a bit because I do tend to use caps lock without thinking |
| 16:15 | postpunkjustin | Kamuela: that sounds... bad? |
| 16:15 | justin_smith | clearly a professional spammer or troll |
| 16:15 | Kamuela | haha |
| 16:15 | justin_smith | writes sql or basic or fortran? |
| 16:16 | Kamuela | sql and TOO_MANY_CONSTANTS |
| 16:19 | spuz | anyone here use Lighttable? |
| 16:19 | spuz | I am trying to run a test but it does not seem to load the definitions in the source file I am testing |
| 16:19 | spuz | how do i get it to include definitions from another file when running the tests? |
| 16:20 | justin_smith | spuz: you use require to require the namespace you are testing |
| 16:21 | spuz | justin_smith, i've done that |
| 16:22 | spuz | the test file works if I run it with 'lein test' |
| 16:22 | postpunkjustin | spuz: do you have to evaluate the ns declaration maybe? |
| 16:23 | spuz | postpunkjustin, maybe but it seems the state of one evaluation does not carry over to the next |
| 16:23 | spuz | when i evaluate the ns, I see the result is 'nil', but it doesn't seem to help resolve the function call when i evaluate the test definition |
| 16:24 | postpunkjustin | oh, that's really odd |
| 16:24 | postpunkjustin | I'm afraid I don't have much else to offer; I don't actually use LightTable |
| 16:25 | spuz | I will try something else |
| 16:39 | Kamuela | lol it said when you open emacs you may see a lot of activity while it downloads packages. so if I don't see it, here's my first hurlde |
| 16:42 | spuz | Kamuela, are you trying to use emacs for the first time? |
| 16:42 | spuz | I am investigating it right now |
| 16:42 | sdegutis | Kamuela: I have rebound caps lock to be control within Mac's system preferences -> keyboartd |
| 16:43 | spuz | do you have any guides to point to? |
| 16:43 | Kamuela | yeah I'm using this spuz http://www.braveclojure.com |
| 16:43 | Kamuela | but no one necessarily says it's the best or anything |
| 16:43 | sdegutis | haha |
| 16:43 | sdegutis | surely amalloy knows of some guide that he recommends or something |
| 16:45 | spuz | does spacemacs offer any advantage over vanilla emacs other than vim like keybindings? |
| 16:45 | postpunkjustin | spuz: most definitely |
| 16:46 | postpunkjustin | it also has better discoverability, sensible configurations for a lot of languages, basic package management |
| 16:46 | postpunkjustin | and some other stuff |
| 16:46 | spuz | postpunkjustin, would you recommend it to someone who is totally unfamiliar with emacs and only a little familiar with vim? |
| 16:47 | spuz | my primary aim is to have an intelligent clojure editor |
| 16:47 | postpunkjustin | I guess? It's hard for me to say since I was pretty familiar with both when I started using it |
| 16:47 | Kamuela | Does this look like an emacs config to anyone here? https://github.com/flyingmachine/emacs-for-clojure |
| 16:47 | j-pb | spuz: use intellij + cursi e |
| 16:47 | spuz | i.e. with all the shiny things like inline docs, syntax highlighting, repl integration etc |
| 16:47 | j-pb | cursive, it's not open source but gets you started in no time without having to follow down any config rabit hole |
| 16:48 | spuz | j-pb, cursive is great but I want to see what the free options are like before settling on the $120 price tag |
| 16:49 | spuz | I've used it for 30 days an am reasonably happy with it but it is a little clunky in some respects |
| 16:49 | Kamuela | spuz: are you using it commercially? |
| 16:50 | spuz | Kamuela, no |
| 16:50 | Kamuela | if you're honestly just dabbling or open source, apply for a license and you'll get one $0 |
| 16:50 | spuz | hmm |
| 16:50 | spuz | what is the difference between a personal license and a non-commercial license? |
| 16:51 | Kamuela | personal is it's just for you but you sell software |
| 16:51 | Kamuela | non-commercial means open source or practice |
| 16:51 | Kamuela | personal projects |
| 16:51 | Kamuela | <- not a lawyer |
| 16:52 | spuz | great |
| 16:52 | spuz | well I can start coding again then :) |
| 16:54 | Kamuela | Should ~/.emacs.d be a directory full of themes? |
| 16:58 | justin_smith | Kamuela: I'd say .emacs.d is a decent place to put a theme, but it should also have your init.el (your config file) and other elisp code |
| 16:58 | Kamuela | justin_smith: I'm wondering if I set this up wrong by copying a directory into .emacs.d rather than the contents of that directory |
| 16:59 | justin_smith | Kamuela: that could be, maybe it wants themes to be in a subdirectory - that seems cleaner at least |
| 17:00 | justin_smith | you can probably explicitly tell the theme user where to find the themes, regardless |
| 17:00 | Kamuela | justin_smith: well that init.el thing is currently in .emacs.d/subdirectory-of-thing/init.el |
| 17:00 | justin_smith | subdirectory of what thing? |
| 17:01 | justin_smith | Kamuela: emacs looks for init.el in specific places, the lib might have its own init, but you should have an init.el as well, and that should be directly in .emacs.d |
| 17:01 | Kamuela | i will see what explodes by moving it up one |
| 17:02 | sdegutis | Ahh, I remember the first time I configured ~/.emacs.d/ |
| 17:02 | sdegutis | I still have tons of "WTF" code in there that I just don't care about and it gets the job done so whatever. |
| 17:02 | justin_smith | hell I remember having to chance from ~/.emacs to ~/.emacs.d/init.el |
| 17:02 | justin_smith | sdegutis: mines all refactored into separate namespaces and stuff |
| 17:03 | sdegutis | justin_smith: yeah mine too, kinda sorta |
| 17:03 | sdegutis | justin_smith et al: This is my init.el https://gist.github.com/sdegutis/30b881ad500660c5abea |
| 17:03 | sdegutis | Terribly stupid way to load "modules" but meh it gets the job done. |
| 17:04 | justin_smith | right, pretty much how I do it, but I also have some conditionals for emacs versions and whatever |
| 17:04 | sdegutis | Plus things are not really in the right files, like necessities.el and startup.el and os.el are all conflated |
| 17:04 | sdegutis | justin_smith: Ahh I just use the latest and be done with that. |
| 17:05 | sdegutis | Also I have all of ~/.emacs.d/elpa under version control. |
| 17:06 | sdegutis | Honestly I did give that bundler thing a try, but I dunno it just didn't settle well. |
| 17:07 | sdegutis | Forgot what it was called |
| 17:08 | Kamuela | ok moving it to the root did the trick |
| 17:08 | Kamuela | I'm at the very least at this guy's setup |
| 17:09 | sdegutis | I think it was Cask? |
| 17:10 | Kamuela | well I think this setup includes paredit because that bit is happening |
| 17:10 | Kamuela | Not sure if the repl or cider bit is happening |
| 17:11 | sdegutis | Oh yeah! Cask used to be called Carton. That's when I was trying it out. |
| 17:19 | rhg135 | sdegutis: I was perfectly fine without that image |
| 17:19 | sdegutis | rhg135: sorry what image again? |
| 17:20 | rhg135 | "<sdegutis> rhg135: food runs through a digest function which hashes it into poop" |
| 17:20 | sdegutis | rhg135: oh, right |
| 17:20 | sdegutis | rhg135: hey dont blame me i didnt invent digestion |
| 17:21 | paul_muadib666 | can somone help me with a cider issue? I have ring setup to start nrepl when i run 'lein ring server', when I later try to use 'cider-connect' to connect to the nrepl port, it claims cider-nrepl isn't installed |
| 17:21 | paul_muadib666 | though I have cider-nrepl declared in my profiles.clj file |
| 17:23 | TristeFigure | Hi. I'm having a silly problem. I'm trying to (use 'some-name-space) I placed in the test folder, but I get FileNotFoundException Could not locate... The file is test/entomologist/gentests.clj and the ns statement reads like (ns entomologist.gentests ....) What am I doing wrong ? |
| 17:24 | TristeFigure | Besides, there is nothing wrong with underscores in my file names |
| 17:24 | rhg135 | sdegutis: to be pedantic digestion is hardly of type Food->Poop |
| 17:26 | amalloy | Food -> (Calories, Poop) |
| 17:26 | sdegutis | rhg135: Yeah amalloy's correct it's more of a monad |
| 17:26 | rhg135 | and Gas |
| 17:26 | amalloy | that's not really a monad at all |
| 17:26 | amalloy | yeah, (a,b) doesn't admit a monad instance |
| 17:26 | sdegutis | Oh, well fine then. |
| 17:26 | sdegutis | Then DONT implement digestion in Haskell for all I care. |
| 17:27 | rhg135 | and calories would be an input |
| 17:27 | rhg135 | the canonical implementation is in DNA |
| 17:30 | rhg135 | sdegutis: amalloy: technically all this is in the BodyProcess Monad which abstracts away the details of how the body finances it |
| 17:30 | sdegutis | Um, did str/split change behavior in Clojure 1.8? I'm not seeing it in the release notes. |
| 17:31 | sdegutis | It's throwing an exception when I didn't think it should. |
| 17:31 | rhg135 | It shouldn't have |
| 17:32 | sdegutis | Oh no wait I'm just stupid ignore me. |
| 17:32 | rhg135 | typo? |
| 17:32 | sdegutis | Haha! Nope. Someone created invalid data in production. |
| 17:32 | sdegutis | Oh man. I should foolproof this stuff a little more. |
| 17:33 | rhg135 | oh |
| 17:34 | rhg135 | this is why db's have schemas, too bad they don't work well enough |
| 17:35 | sdegutis | The more I look into it the more I think it's not actually an inconsistency in the database, it's just retarded code I wrote that assumed things which I guess are no longer true. |
| 17:35 | sdegutis | Also, Datomic is just plain awesome. |
| 17:38 | rhg135 | it'd be rather cool to have a db enforce invariants at transaction time |
| 17:38 | TristeFigure | Resolved my own problem : I wasn't in my project folder :facepalm: |
| 17:40 | sdegutis | rhg135: what's an invariant btw |
| 17:41 | cortexman | why is it called figwheel? |
| 17:41 | rhg135 | sdegutis: an INvariant |
| 17:41 | sdegutis | rhg135: sorry whats an INvariant |
| 17:41 | sdegutis | wNNNNNbc |
| 17:41 | csd_ | Can someone explain what exactly is happening in clojure.main on the first line REQUIRE.invoke(CLOJURE_MAIN)? When I try to reason out what's happening I end up with invoke() being applied to an an instance of Unbound, which is an exception. I'm sure I'm missing some assignment somewhere but not clear exactly what I'm missing |
| 17:43 | rhg135 | sdegutis: "a function of the |
| 17:43 | rhg135 | │ │ coefficients of one or more forms, which remains unaltered, when these |
| 17:43 | rhg135 | │ │ undergo suitable linear transformations |
| 17:43 | rhg135 | eh |
| 17:43 | sdegutis | rhg135: I'm scared |
| 17:43 | rhg135 | sorry |
| 17:43 | sdegutis | rhg135: water under the bridge |
| 17:44 | hiredman | why do you think REQUIRE is Unbound? |
| 17:44 | rhg135 | I've since learned to get a good dictionary |
| 17:44 | csd_ | hiredman: a newly created var sets root = Unbound |
| 17:45 | hiredman | sure, but using RT causes RT's static initializers to run |
| 17:46 | csd_ | oh maybe now i'm hitting the edge of my java knowledge. what exactly happens w/r/t what you're referring to? |
| 17:47 | hiredman | loading the RT class causes clojure.core to load |
| 17:48 | sdegutis | Fixed. Phew. |
| 17:49 | csd_ | hiredman: oh i see that now. but still how does REQUIRE's root not get set to Unbound? |
| 17:52 | rhg135 | csd_: you have to do something like REQUIRE = RT.var(...) not just instatiate a var |
| 17:52 | csd_ | rhg135: this is me trying to understand the the opening line of main.java's main() |
| 17:53 | rhg135 | ah, then nvm |
| 17:54 | csd_ | it seems that RT.var creates var REQUIRE with root = Unbound but that some static magic in RT changes the value of root, or something |
| 17:57 | sdegutis | bye |
| 18:08 | Trioxin | why hasn't Clojure and Scala overtaken the popularity of Java? It only makes sense. Academia? |
| 18:09 | Trioxin | Java is pretty much #1 and the other two are nowhere on the map |
| 18:10 | csd_ | i think being effective in clojure requires some knowledge of java.. i imagine scala might be similar |
| 18:10 | rhg135 | csd_: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/main.java#L20 |
| 18:11 | csd_ | rhg135: yeah that's the code i'm looking at |
| 18:11 | rhg135 | that's what sets REQUIRE |
| 18:12 | csd_ | rhg135: my question is about line 36. i cant find where REQUIRE is bound to anything prior to invoke() |
| 18:12 | rhg135 | lines 19-23 are executed at class load |
| 18:13 | csd_ | yeah i know |
| 18:13 | Trioxin | hell i would just stick with javascript since we have things like nwjs and cordova if concurrency weren't so damn annoying |
| 18:13 | csd_ | but line 20 AFAICT only creates the var. i dont see where it binds it |
| 18:15 | rhg135 | it doesn't. it looks it up in the environment and as hiredman said RT loads loads core |
| 18:15 | rhg135 | then at line 36 clojure.main is required through it |
| 18:15 | csd_ | ok but where does it do that lookup |
| 18:16 | rhg135 | RT#var gets a var by name |
| 18:16 | csd_ | it interns the var |
| 18:17 | csd_ | doesnt that only mean declaring it |
| 18:17 | csd_ | RT.var = return Var.intern(... |
| 18:18 | rhg135 | but if it is bound then it will be a bound |
| 18:19 | csd_ | but where does that happen |
| 18:19 | rhg135 | and RT loads clojure.core |
| 18:20 | rhg135 | thus #'clojure.core/require already exists and RT#var return the var already bound. |
| 18:20 | csd_ | oh i see what you're saying |
| 18:21 | rhg135 | and vars are mutable hence those vars like on line 21 are unbound until REQUIRE loads clojure.main |
| 18:22 | csd_ | and so when load('clojure/core') is run, which files exactly are being loaded? i dont see any reference to the compiler so i dont think it can be the clj files yet |
| 18:24 | rhg135 | I'm not sure, the clojure java code is a special kind of beautiful |
| 18:25 | csd_ | haha |
| 18:25 | rhg135 | the clojure clojure code though... |
| 18:26 | csd_ | tell me about it... i was looking at the code for (destructure) earlier |
| 18:26 | rhg135 | it's a mixed bag |
| 18:26 | csd_ | if someone accustomed to haskell wrote clojure |
| 18:26 | csd_ | but without the helpfulness of type signatures |
| 18:27 | rhg135 | some of it is so minimal it's beautiful |
| 18:33 | csd_ | thanks for your help |
| 18:35 | rhg135 | np |
| 18:57 | Guest50097 | hi, having this (defmacro mac [a] (list a 2 3 4)) I call it with (mac 1) and it returns (nil 2 3 4). Why? |
| 18:58 | hiredman | it doesn't do that, you are mistaken |
| 18:59 | Guest50097 | hiredman: you mean it returns (1 2 3 4) |
| 18:59 | Guest50097 | ? |
| 18:59 | hiredman | ,(defmacro mac [a] (list a 2 3 4)) |
| 18:59 | clojurebot | #'sandbox/mac |
| 18:59 | hiredman | ,(mac 1) |
| 18: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$eval52 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval52 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval52 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 6927]... |
| 19:02 | AimHere | ,(mac +) |
| 19:02 | clojurebot | 9 |
| 19:02 | AimHere | ,(mac list) |
| 19:02 | clojurebot | (2 3 4) |
| 19:05 | Guest50097 | :] |
| 19:43 | Quezion | Is there a way to work-around namespace collisions from protocols in another namespace? |
| 19:43 | Quezion | E.g. Namespace A and B both protocol X. I want to use both versions of the protocol in the current namespace |
| 19:45 | Quezion | If I require namespace A :as A, I still can't access the protocol. A/ProtoX/method naturally throws an error. |
| 19:57 | Quezion | Is there a way to import/use two protocols with the same name into the current namespace? |
| 20:07 | justin_smith | Quezion: it's not A/ProtoX/method it's just A/method |
| 20:07 | justin_smith | or (.method thing) |
| 20:07 | justin_smith | Quezion: just like in Java you wouldn't type the name of the interface into a call on an interface method |
| 20:11 | Quezion | @justin_smith: That fixed it, thanks! I'm guessing you can't have a protocol method and a function of the same name in the same namespace, then? |
| 22:16 | srruby | How do I accomplish (.indexOf "dog" ["cat" "dog"]) ? answer should be 1 |
| 22:17 | srruby | Java interop here |
| 22:17 | TEttinger | well you're calling that on the String "dog" |
| 22:17 | TEttinger | (.indexOf ["cat" "dog"] "dog" ) |
| 22:17 | TEttinger | ,(.indexOf ["cat" "dog"] "dog" ) |
| 22:17 | clojurebot | 1 |
| 22:18 | TEttinger | (.indexOf "dog" \g) |
| 22:18 | TEttinger | ,(.indexOf "dog" \g) |
| 22:18 | clojurebot | #error {\n :cause "No matching method found: indexOf for class java.lang.String"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No matching method found: indexOf for class java.lang.String"\n :at [clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 80]}]\n :trace\n [[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 80]\n [clojure.lang.Reflector invokeInst... |
| 22:18 | TEttinger | hm |
| 22:18 | TEttinger | well the main takeaway is .method takes the object with that method as its first parameter |
| 22:19 | srruby | ok parameter order was wrong. (.indexOf [:a :b :c :d] :c) works |
| 22:20 | srruby | TEttinger: Thanks |
| 22:21 | TEttinger | glad to help |
| 22:34 | paul_muadib666 | two questions. what does :- mean? how can i search that pattern in google? |
| 22:36 | srruby | How come this works (update-in ["1" 2] [0] #(Integer/parseInt %)) |
| 22:37 | srruby | but this doesn't (update-in ["1" 2] [0] Integer/parseInt) |
| 22:38 | TimMc | paul_muadib666: You probably found that in... let's see, something that uses schema? |
| 22:39 | paul_muadib666 | TimMc: I believe so I'm playing around with compojure, yet me check the deps tree and see if anything uses that |
| 22:39 | TimMc | http://symbolhound.com/ sometimes helps but not in this case |
| 22:39 | TEttinger | srruby: because oddly, java interop method calls don't act like normal clojure fns. there is memfn to turn something like that into a fn |
| 22:40 | paul_muadib666 | yes compojure-api has a dependency on prismatic/schema |
| 22:40 | TEttinger | ,(doc memfn) |
| 22:40 | clojurebot | "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn. name may be type-hinted with the method receiver's type in order to avoid reflective calls." |
| 22:40 | TEttinger | hm, not static |
| 22:41 | TEttinger | ,(update-in ["1" 2] [0] read-string) |
| 22:41 | clojurebot | [1 2] |
| 22:41 | srruby | TEttinger: Thank you. |
| 22:42 | TimMc | srruby, TEttinger: read-string is a bit over-powered here... |
| 22:42 | TEttinger | it looks like you're getting into the trickier parts of learning clojure, srruby |
| 22:42 | TEttinger | yes |
| 22:42 | TimMc | I would use Integer/parseInt for sure. |
| 22:42 | TEttinger | I just needed a clojure fn for that that could be passed as an example |
| 22:42 | TimMc | ah, ok |
| 22:42 | srruby | No, I just want to turn a string into an int. |
| 22:42 | TimMc | read-string has security implications, for one :-) |
| 22:43 | srruby | Right |
| 22:43 | TEttinger | since Integer/parseInt isn't quite the same as a fn... what is the recommended way for static members like that? |
| 22:44 | paul_muadib666 | TimMc: I'm not having any luck finding that symbol on symbolhound :( |
| 22:44 | TimMc | TEttinger: #(Integer/parseInt %) :-P |
| 22:44 | TimMc | or Long/parseLong, really |
| 22:44 | TEttinger | paul_muadib666: it is a keyword, and it might be used in a map |
| 22:44 | TEttinger | yeah |
| 22:45 | TEttinger | ,(:- {:- 1 :D 2}) |
| 22:45 | clojurebot | 1 |
| 22:45 | TimMc | paul_muadib666: What's the context? |
| 22:45 | paul_muadib666 | TEttinger: oh. that makes sense. I assumed a reader macro or something |
| 22:45 | TEttinger | no, that would be # something |
| 22:46 | TEttinger | the only cases where reader macros don't start with # are probably things you use all the time |
| 22:47 | paul_muadib666 | TimMc: going through this tutorial http://nblumoe.github.io/mundane-clojure-for-mortals/org/api-for-mortals.html#sec-7-1 , the symbol is in the last code block |
| 22:47 | TEttinger | https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ |
| 22:48 | paul_muadib666 | nice, yall are full of choice links today :) |
| 22:48 | TimMc | paul_muadib666: http://clojure.org/reference/reader is a good thing to look through now and then -- that's effectively the page on syntax |
| 22:48 | TEttinger | ah! https://github.com/metosin/compojure-api |
| 22:49 | TEttinger | that uses :- and is require'd in that link |
| 22:49 | TimMc | paul_muadib666: Oh, looks like it's a keyword that has special meaning for that GET* macro. |
| 22:52 | paul_muadib666 | TEttinger: what do you mean it's require'd ? |
| 22:53 | TEttinger | oh, either :require or :use , didn't checj |
| 22:54 | TEttinger | I just noticed that that API was being used from the code |
| 22:54 | paul_muadib666 | ok, so if i check ns-publics in that namespace it should be there |
| 22:55 | paul_muadib666 | welp library's closing, thanks for hte help TimMc and TEttinger! |
| 22:55 | TEttinger | probably. it looks like they might have not written out namespace GET* is in, which is the one that has the funny meaning for :- |
| 22:55 | TEttinger | later! |
| 23:21 | kenrestivo | what's the most clojure-ish way to deal with configuration management in a large clustered app? |
| 23:22 | rhg135 | Environ I think |
| 23:23 | kenrestivo | for large clusters? i've used environ. i found it limiting, now i use large edn conf files (with schema). but i'm not sure how this would scale |
| 23:23 | tolstoy | Are you talking about multiple services that consult a central service for configuration? |
| 23:23 | kenrestivo | something like that might be necessary. or is it? |
| 23:24 | tolstoy | IMHO, as soon as you start asking that question, you're into "domain specific" solutions that depend on so many things outside the language of the app. But maybe I'm misunderstanding? |
| 23:24 | rhg135 | Oh for clusters, hmm |
| 23:27 | tolstoy | Hm. Something like puppet/chef plops an EDN file in a known-location on every filesystem, and you slurp it in? ;) |
| 23:30 | tolstoy | A long time ago, someone made a Zookeeper thing that had atom semantics. I bet that's fallen by the way side. |
| 23:30 | kenrestivo | i mean, there's etcd in coreos, for example. there's also chef/puppet/ansible. there's also just putting conf files in git and scp'ing them up, which is what i've been doing. |
| 23:30 | kenrestivo | my main curiosity is in clojure specifically |
| 23:30 | kenrestivo | how do people do it? what's the best practices? |
| 23:30 | kenrestivo | in other languages, there's a whole gaggle of different things all competing with each other. in clojure-land, what's the answer? i'll bet it's somethign simple and elegant |
| 23:30 | kenrestivo | then again, maybe the fact that this hasn't been a problem for me means that it just isn't a problem in clojure-land. |
| 23:32 | tolstoy | What's an example in another language? |
| 23:32 | kenrestivo | etcd, chef, puppet, ansible |
| 23:33 | kenrestivo | some people also use redis for that stuff |
| 23:33 | tolstoy | Ah, so you're wanting a version of one of those, but written in Clojure? |
| 23:33 | kenrestivo | no, and i'm having a tough time making the question clear |
| 23:33 | kenrestivo | it's a devops question. |
| 23:35 | rhg135 | I'd think synchronizing some data would be rather common actually |
| 23:35 | tolstoy | Yeah. Sorry. I assume configuration management is independent of the language a thing that needs to be configured is written in, hence my confusion. |
| 23:36 | kenrestivo | if you're rolling out a system with a bunch of microservices, dependent on databases, ip addresses, load balancers, etc, how do i get all that configuration to the clojure artifacts running the services? right now i just do "java -jar someuber.jar config.edn" and i have the config pushed out via scp. |
| 23:36 | kenrestivo | it's been fine for my small apps. i wonder how the Big Guys do it with large, hairy clojure apps. |
| 23:36 | tolstoy | Yeah, that's what I do (now that I'm small time). |
| 23:37 | tolstoy | In the past, I've had an RPM what had the central config with a key for individual apps to pick out, then just make apps depend on that. |
| 23:37 | tolstoy | But, datomic would be an intereting choice. Maybe. |
| 23:38 | kenrestivo | thanks. maybe the only people who'd really know are buried deep inside cognitecht or somewhere, and they're not going to share their secrets. |
| 23:39 | kenrestivo | who builds massive clojure apps with dozens or hundreds of instances? |
| 23:43 | tolstoy | Here's this thing, but you can see it's bitrotted: https://liebke.github.io/avout/ |
| 23:47 | kenrestivo | thanks. i think *shrug* is a perfectly valid-- and in this case, probably the most accurate-- answer. |
| 23:57 | solatis | kenrestivo: it's fairly simple, actually |
| 23:57 | solatis | i'm not sure if we qualify as "big guy", but we have around 100 servers / services |
| 23:57 | solatis | we use AWS CloudFormation |
| 23:58 | solatis | a *huge* template |
| 23:58 | solatis | and it automatically writes a config.edn |
| 23:58 | solatis | that is indeed imported in the way you describe |
| 23:58 | solatis | and then we use luminus/config to read out the config files |
| 23:59 | solatis | if you want to get inspiration how the Really Fucking Big Guys do it, look at Erlang / Elixir and how they do configuration management |
| 23:59 | solatis | but it's hairy, and full of "service lookup services", etc |
| 23:59 | solatis | i like the simplicity of working with CloudFormation |