2013-09-17
| 00:06 | clj_newb_2345 | go blocks seems kinda magical to me right now |
| 00:06 | clj_newb_2345 | what in clojure can I do that I can't do inside of a go block? |
| 00:07 | clj_newb_2345 | (or has different meaning inside of a go block) |
| 00:08 | callen | that's not the right question to ask. |
| 00:08 | clj_newb_2345 | socrates, what is the right question to ask? |
| 00:08 | callen | clj_newb_2345: what don't you know about Go blocks? |
| 00:08 | clj_newb_2345 | I don't know anything about go blocks. |
| 00:09 | clj_newb_2345 | I don't even know what I don't know about go blocks |
| 00:09 | callen | clj_newb_2345: then start with "why". |
| 00:09 | clj_newb_2345 | or what there is to know about go blocks. |
| 00:09 | clj_newb_2345 | so I know that Go blocks is to emulate "light weight hreads" |
| 00:09 | clj_newb_2345 | and provide synchronous channels |
| 00:09 | clj_newb_2345 | like Pike's Go language |
| 00:09 | callen | errrr...not quite. |
| 00:09 | clj_newb_2345 | and that this gets rid of clojurescript callback hell |
| 00:09 | callen | channels are already synchronous and provided for outside of Go blocks. |
| 00:09 | callen | so that's not what they're for. |
| 00:09 | callen | so you're already wrong. |
| 00:10 | clj_newb_2345 | well callen, today is your lucky day |
| 00:10 | callen | clj_newb_2345: if channels already work synchronously, no go blocks needed (<!! >!!) then why do you need go blocks? |
| 00:10 | clj_newb_2345 | if you so wish, you can enlighten a random stranger about how go blocks work |
| 00:10 | clj_newb_2345 | it avoids blocking entire java threads |
| 00:10 | callen | clj_newb_2345: I was gently hinting that you should stop talking. |
| 00:10 | callen | clj_newb_2345: and focus on responding to what I was saying |
| 00:10 | clj_newb_2345 | then we want go blocks so we can have green threads without blocking java threads, no? |
| 00:11 | callen | clj_newb_2345: stop dude. you're parroting nouns you saw on a blog post. |
| 00:11 | clj_newb_2345 | okay |
| 00:11 | clj_newb_2345 | I'm stop. |
| 00:11 | clj_newb_2345 | What are the "axioms" of go blocks? |
| 00:11 | callen | clj_newb_2345: I'm trying to help you, but if you don't stop wasting my time, I'm going back to munching on my cucumber. |
| 00:11 | callen | clj_newb_2345: focus on what I said. If you already have synchronous channels that you can put and take from, why do you need Go blocks? |
| 00:12 | clj_newb_2345 | I don't know. |
| 00:12 | callen | clj_newb_2345: so lets say you have some HTTP API you want to call. Without Go blocks, you can just "GET" the HTTP API and put the data into the channels synchronously. |
| 00:13 | callen | the HTTP API is a little slow though. |
| 00:13 | callen | clj_newb_2345: at what point do you suppose this model won't scale? |
| 00:13 | callen | (speaking generally) |
| 00:13 | clj_newb_2345 | When the # of HTTP requests exceeds the # of threads the JVM can provide. |
| 00:13 | clj_newb_2345 | Since each HTTP request is "blocking" an actual thread until it gets the data. |
| 00:13 | clj_newb_2345 | Is this correct? |
| 00:13 | clj_newb_2345 | (or am I still wrong?) |
| 00:14 | callen | clj_newb_2345: good enough. So lets think for a moment |
| 00:14 | callen | clj_newb_2345: don't think, "I Need go blocks" - that's fetishizing nouns. |
| 00:14 | dnolen | callen: that's not true, read/write to channel synchronously is not directly supported, as in not part of the interface of channels, this is provided for by the api through promises |
| 00:15 | callen | dnolen: I don't think that detail matters for the exercise I'm trying to run clj_newb_2345 through. |
| 00:15 | callen | in fact, I've been trying to step away from the details the whole time. |
| 00:16 | callen | clj_newb_2345: so, you know you want to call the (slow) HTTP API and put the results onto a channel, but you don't want the thread waiting for the IO. Have you ever written JavaScript? |
| 00:16 | clj_newb_2345 | Yes |
| 00:16 | callen | specifically anything with callbacks? |
| 00:16 | clj_newb_2345 | I send up crap on .on-receive |
| 00:16 | callen | clj_newb_2345: okay, so hypothetically, you could pass the HTTP GET function a callback and then let that "put" onto the channel, but now you have to write all your code in terms of callbacks right? |
| 00:16 | clj_newb_2345 | Yes. |
| 00:17 | callen | clj_newb_2345: but you didn't really *want* a callback necessarily, just for your code to yield to other threads while doing IO. |
| 00:17 | clj_newb_2345 | Correct, I'm forced to do so because javascript is single threaded and I want to say "continue with this block of code when this event finally happens" |
| 00:18 | callen | one could hypothetically, and no I don't care what core.async does, write a macro that turned you code inside-out into something that automatically yielded "between" the operations inside the go block. |
| 00:18 | callen | turned your* |
| 00:18 | clj_newb_2345 | basically a continuation-passing-style compiler? |
| 00:18 | callen | if you wanted a literal representation, you could almost imagine it being a mechanized "interleaving" of operations. |
| 00:18 | callen | bouncing things around via a thread pool otherwise. |
| 00:18 | Apage43 | the words again |
| 00:19 | callen | clj_newb_2345: well, to be precise, you're just going to have to learn how core.async works, but the basic principle of restructuring your code to be async-friendly can take many forms. |
| 00:19 | clj_newb_2345 | this has been an useful exercise |
| 00:20 | clj_newb_2345 | thinking of go blocks as "inverting code into callbacks" does make it look less magical |
| 00:20 | clj_newb_2345 | in particular, it provides some insight into things like "what happens when I throw an exception" |
| 00:20 | callen | it's not precisely accurate, but it's not the worst half-step you could take |
| 00:20 | callen | clj_newb_2345: http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/ |
| 00:21 | callen | Apage43: do you have an objection? |
| 00:21 | Apage43 | nope :) |
| 00:21 | callen | clj_newb_2345: glad it helped. |
| 00:22 | clj_newb_2345 | thanks for taking the time to expalin it :-) |
| 00:22 | coventry | That blog post is a great dissection. |
| 00:23 | dnolen | clj_newb_2345: note that throwing exceptions "just works", go has try/catch support |
| 00:23 | callen | clj_newb_2345: np. Stuff like this happens more fluidly if you empty your mind a bit. |
| 00:23 | Apage43 | I kind of want a macroexpander that spits out more human friendly gensyms, for that sort of stuff |
| 00:23 | callen | part of what I think dnolen just touched on is that Go macros go to a lot of effort to make certain things "just work" |
| 00:24 | callen | Apage43: doesn't seem that gnarly to me. Eventually you see blonde, brunette, redhead... |
| 00:24 | Apage43 | yeah, you can get it if you stare at it for a sec |
| 00:24 | Apage43 | but if you |
| 00:25 | Apage43 | are running low on gumption |
| 00:37 | callen | Apage43: yeah. That's part of my aversion to using macros unless I have to. I can debug functions half-asleep more readily :) |
| 00:41 | coventry | It would take more than a macro expander. You would need a custom syntax-quote. Hacking tools.reader would probably be the best way. gensyms are generated in pure java, so there's no clojure function to bash. |
| 00:45 | callen | coventry: you're going to end up being our reader/ns/parsing clj expert, aren't you? |
| 00:45 | coventry | No, that will always be Bronsa. :-) |
| 00:49 | coventry | The relevant function in tools.reader is reader/register-gensym. It would be pretty easy to do, although I don't know what a more readable autogenerated form would be. |
| 00:49 | callen | that's the problem - how do you make it more readable than it already is? |
| 00:51 | callen | maybe lop off of the _####? |
| 00:51 | callen | better hope there are no collisions I guess. |
| 00:51 | coventry | You need some kind of unquifier. The __auto__ is ugly I guess. |
| 01:04 | chord | why should I use clojure over haskell? |
| 01:04 | chord | explain |
| 01:06 | brehaut | chord: because (once you have examined them both to your satisfaction) you prefer clojure to haskell (or vice versa) |
| 01:06 | chord | you didn't answer |
| 01:07 | brehaut | im pretty sure i did |
| 01:07 | brehaut | chord: nobody her can answer why you would use clojure over haskell, only why they themselves do |
| 01:07 | brehaut | s/her/here/ |
| 01:08 | chord | you know what my question meant |
| 01:08 | chord | stop dodging it |
| 01:09 | brehaut | i know what your question mean, i just dont think its a valid question |
| 01:10 | chord | but you admit it is a question |
| 01:10 | chord | therefore it is answerable |
| 01:10 | brehaut | neither language is objectively better than the other. they cover similar ground and make different trade offs. |
| 01:10 | chord | and those trade offs are? |
| 01:11 | noidi | chord, well, if your code has to run on the JVM, then Haskell is right out :) |
| 01:12 | callen | guys, he's a troll. |
| 01:12 | callen | he's done this like 4 or 5 times. |
| 01:12 | callen | He just keeps coming back and asking this same question over and over. He sends creepy PMs about having sex with your mother too. |
| 01:13 | chord | callen you know that comment about mother is complete bullshit |
| 01:14 | callen | I've pasted screenshots of you sending me creepy PMs and the last time you were trolling in here, you admitted to sending them when I pasted the link to the screenshot. |
| 01:14 | callen | you realize this channel is logged and I can just bring up the last time you were in here, right? |
| 01:17 | chord | ok so prove the sex with mother comment |
| 01:17 | chord | show the proof |
| 01:17 | H4ns | m| |
| 01:19 | chord | see how callen can't prove it |
| 01:19 | TEttinger | ignore *@*ip.50.47.83.14 |
| 01:19 | chord | hes all bullshit |
| 01:29 | TEttinger | god that was not hard to find http://i.imgur.com/KFR6caY.png |
| 01:29 | gvickers` | wtf? |
| 01:32 | callen | TEttinger: thank you, I was in the middle of a game of DotA :) |
| 01:32 | ambrosebs | (inc TEttinger) |
| 01:32 | lazybot | ⇒ 1 |
| 01:34 | callen | (inc TEttinger |
| 01:34 | callen | er. |
| 01:34 | callen | (inc TEttinger) |
| 01:34 | lazybot | ⇒ 2 |
| 01:34 | callen | there we go. |
| 01:38 | SegFaultAX | Creepy. |
| 01:41 | chord | Tettinger: nothing about sex in that image |
| 01:42 | callen | chord: what do you like about Haskell? |
| 01:43 | chord | static typing, why would I give that up |
| 01:44 | callen | chord: I know right? static typing is awesome. You should just use Haskell. I think they have an IRC channel on FreeNode too. |
| 01:44 | chord | so you guys gonna convert religion then? |
| 01:45 | callen | chord: yeah, after we finish this weird erlang-in-clojure thing. |
| 01:45 | callen | chord: then we'll hop right over and partake in the lotus of the monad with you guys. |
| 01:45 | chord | what does erlang have to do with this |
| 01:45 | callen | EVERYTHING |
| 01:45 | chord | monads aren't that bad |
| 01:45 | brehaut | a stunning defense of the concept |
| 01:45 | brehaut | 'not that bad' |
| 01:46 | chord | they're scary to everyone beacuse they have to learn how to spell monad |
| 01:47 | callen | chord: I don't recall having written the word "monad" anywhere in my Haskell code, but we can go with that. |
| 01:47 | chord | brehaut you hate Haskell? |
| 01:47 | brehaut | im not an idiot, so no |
| 01:48 | brehaut | contrary to popular belief, its possible to like multiple languages at once |
| 01:49 | callen | not if you learn Haskell. Then everything else is inferior and you have only one god |
| 01:49 | chord | Haskell and Erlang, but no lisp |
| 01:49 | callen | and Curry too. |
| 01:49 | callen | I love curry. and currying. and korma. and tikka masala. |
| 01:50 | SegFaultAX | Mmm, tikka masala. |
| 01:50 | amalloy | callen: sounds like what people say about lisp too. lisp weenies never like any other languages |
| 01:50 | callen | amalloy: never ever. ever. Except for javascript weenies. sometimes they like Lisp too. |
| 01:50 | SegFaultAX | amalloy: Because they already know the divine language. |
| 01:50 | callen | DAE PARENTHESES?! |
| 01:51 | SegFaultAX | Bro... do you even parentheses? |
| 01:51 | callen | '(I (simply (cannot (get (enough 'of 'these 'fuckers) {:give :me :more :please :and :thank-you})))) |
| 01:51 | brehaut | sadly thats a better monad joke |
| 01:52 | chord | if I had to use the JVM I will go with Scala rather than subjecting myself to parentheses |
| 01:53 | callen | chord: that sounds great. let us know how it goes. Btw do you have a github where I can see all this awesome Haskell and Scala code you've been writing? |
| 01:53 | callen | I need to stuff myself full of Haskell and Scala code nightly or I wither away. |
| 01:53 | chord | you planning on stealing my code? |
| 01:53 | chord | thats why I don't put it public |
| 01:53 | callen | chord: no, just borrowing. I'll rm -rf it when I'm done. |
| 01:53 | callen | it might be covered in lube when you get it back though. |
| 01:53 | SegFaultAX | callen: That's not a pure function. |
| 01:57 | chord | who here wants to make a starcraft clone using clojure or haskell |
| 01:57 | chord | so you guys quitting means a no? |
| 01:59 | SegFaultAX | chord: You should get a hobby. |
| 01:59 | callen | chord: I think a StarCraft clone in Haskell would make millions of dollars. But if I'm going to join you on this, I need to see your awesome Haskell code first! |
| 01:59 | callen | (if not billions of dollars, because any game made in Haskell is automatically vastly superior) |
| 01:59 | chord | callen: we're doing this in clojure so we can use jvm libraries |
| 02:00 | callen | oh, okay. |
| 02:00 | callen | That makes sense I guess! |
| 02:00 | callen | chord: do you have Clojure code on Github |
| 02:00 | callen | ? |
| 02:00 | chord | we are gonna make it |
| 02:00 | chord | the first open source starcraft clone |
| 02:00 | napping | I've put on "Are we there yet?" after it was mentioned recently, interesting that Rich's points about C++ conflating stuff in pointers are just about what Rust addresses |
| 02:00 | Japella | I've put on "Are we there yet?" after it was mentioned recently, interesting that Rich's points about C conflating stuff in pointers are just about what Rust addresses now has 1 karma |
| 02:01 | SegFaultAX | What just happened? |
| 02:01 | napping | umm, does somebody get karma every time C++ is mentioned? |
| 02:01 | Japella | umm, does somebody get karma every time C is mentioned? now has 1 karma |
| 02:01 | napping | That's not right |
| 02:01 | chord | who is this napping guy |
| 02:01 | SegFaultAX | napping: Are you working on a bot? |
| 02:01 | chord | i know hes not me |
| 02:01 | callen | chord: http://i.imgur.com/LiZCCfS.jpg |
| 02:01 | napping | nope, I think somebody else has a bot |
| 02:01 | callen | Japella++ is a terrible bot. |
| 02:01 | Japella | Japella is a terrible bot. now has 1 karma |
| 02:01 | callen | Japella++ is a terrible bot. |
| 02:01 | Japella | callen: You must wait until 19 minute(s) until you can set karma on that again. |
| 02:01 | callen | oh fuck you. |
| 02:02 | SegFaultAX | callen: Oh man, that's amazing. |
| 02:02 | chord | callen so you gonna help make the starcraft clone in clojure? |
| 02:02 | chord | segfaultax you gonna help too? |
| 02:02 | SegFaultAX | callen: Chelsea is loves it. |
| 02:02 | callen | chord: definitely - if I can see some Clojure code first :) |
| 02:02 | callen | SegFaultAX: it's my favorite response to some things. |
| 02:03 | chord | callen: why do you insist on seeing clojure code |
| 02:04 | callen | chord: I have to know you can contribute to this awesome StarCraft-jure game! |
| 02:04 | dissipate | starcraft clone in clojure? wtf? |
| 02:04 | callen | dissipate: it's going to the best thing ever BECAUSE WE HAVE ATOMS AND REFS AMIRITE? |
| 02:04 | chord | callen: why do you doubt my clojure abilities |
| 02:05 | callen | chord: trust...but verify ;) |
| 02:05 | dissipate | callen, hehehe |
| 02:05 | dissipate | chord, what is the point of doing a starcraft clone in *any* language(s)? |
| 02:06 | chord | starcraft 2 sucks |
| 02:06 | chord | we gotta make it the way it should e |
| 02:06 | chord | it should be |
| 02:06 | callen | clearly 2 Clojure programmers > team of hundreds of professional game developers. |
| 02:06 | callen | We're fucking superhuman thanks to our Lispy powers. |
| 02:07 | chord | They use C++ |
| 02:07 | Japella | They use C now has 1 karma |
| 02:07 | callen | ^^ LOL |
| 02:07 | chord | C++ is horrible for its productivity |
| 02:07 | Japella | C is horrible for its productivity now has 1 karma |
| 02:07 | chord | callen you agree that C++ is a horrible language? |
| 02:07 | Japella | callen you agree that C is a horrible language? now has 1 karma |
| 02:08 | dissipate | chord, newsflash: there's a huge amount of stuff that goes into a game title than just programming |
| 02:08 | chord | dissipate: you're the artist thanks for volunteering |
| 02:08 | callen | the bot repeating what you say minus the ++ reminds me of this: http://dogwork.com/dog-imitates-baby |
| 02:08 | Japella | the bot repeating what you say minus the reminds me of this: http://dogwork.com/dog-imitates-baby now has 1 karma |
| 02:08 | trinary | ha |
| 02:08 | Ember- | actually there's a lot more work on making game *not* related to programming |
| 02:08 | dissipate | chord, negative on that. artist i am not. |
| 02:09 | callen | I don't think people are allowed to say no to chord. |
| 02:10 | chord | Ember- I just acknowledged the art by giving dissipate the job, you want it also? |
| 02:11 | dissipate | chord, protip: haskell is a lot better for apps that need to run natively |
| 02:11 | dissipate | time to rally the troops in #haskell |
| 02:12 | chord | look why are you guys so against a game in clojure, don't you want to prove that clojure can succeed in game development |
| 02:12 | callen | we need to call it CloCraft. or Starjure. |
| 02:12 | Ember- | chord: not really, I've already worked in the gaming industry as a graphic artist |
| 02:12 | Ember- | and no, this was not a joke |
| 02:13 | chord | Ember so then why are you against the starcraft clone game |
| 02:13 | Ember- | since I know the realities |
| 02:13 | Ember- | but keep on trollin' man |
| 02:13 | Ember- | :) |
| 02:13 | chord | which realities... |
| 02:13 | Ember- | I have work to do |
| 02:14 | chord | so you're afraid you will fail at making the game |
| 02:18 | chord | are we all going to give up on starcraft? |
| 02:25 | chord | callen show me your github account |
| 02:25 | chord | lets see what you've coded in clojure |
| 02:30 | chord | anyone here? |
| 02:30 | SHODAN | yes |
| 02:31 | noonian | yup |
| 02:33 | chord | so you guys gonna help with starcarft clone made with clojure? |
| 02:35 | s4muel | Ha, SHODAN. I don't think you want shodan in your AI |
| 02:36 | ddellacosta | removing an entry from a hash map based on the value: is there anything as clean as dissoc? |
| 02:41 | ddellacosta | ,flatten |
| 02:41 | clojurebot | #<core$flatten clojure.core$flatten@64ec49> |
| 02:41 | ddellacosta | argh |
| 02:41 | ddellacosta | ,(doc flatten) |
| 02:41 | clojurebot | "([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence." |
| 02:41 | ddellacosta | &(doc flatten) |
| 02:41 | lazybot | ⇒ ------------------------- clojure.core/flatten ([x]) Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence. nil |
| 02:42 | ddellacosta | hmm, what was that word of warning vs. flatten that one of the bots throws out... |
| 02:42 | ddellacosta | *regarding flatten |
| 02:43 | noonian | hmm, maybe that it flattens arbitrarily nested seqs so if you only want a single level of flattening you need to use a different function |
| 02:44 | ddellacosta | ah! ~flatten |
| 02:45 | ddellacosta | hmm |
| 02:45 | ddellacosta | ~flatten |
| 02:45 | ddellacosta | ? |
| 02:45 | 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. |
| 02:45 | ddellacosta | there we go. |
| 02:49 | TEttinger | ##(into {} (map (fn [pair] [(second pair) (first pair)]) {:foo "foo" :bar "bar"})) |
| 02:49 | lazybot | ⇒ {"foo" :foo, "bar" :bar} |
| 02:50 | TEttinger | ddellacosta: if you do multiple lookups, reversing the key/val arrangement could be good |
| 02:51 | ddellacosta | TEttinger: naw, I'm just doing it to clean stuff out, it happens relatively infrequently--most lookups will be based on key. |
| 02:51 | Japella | TEttinger: naw, I'm just doing it to clean stuff out, it happens relatively infrequentlymost lookups will be based on key. now has -1 karma |
| 02:51 | ddellacosta | wtf |
| 02:51 | TEttinger | Japella-- |
| 02:51 | Japella | Japella now has -2 karma |
| 02:52 | noonian | whats the best way to turn the a maps seq back into a map? |
| 02:52 | noonian | ,(seq {:foo "foo" :bar "bar"}) |
| 02:52 | noonian | ##(seq {:foo "foo" :bar "bar"}) |
| 02:52 | lazybot | ⇒ ([:foo "foo"] [:bar "bar"]) |
| 02:53 | ddellacosta | what the heck is Japella? |
| 02:53 | TEttinger | a bot that responds to -- and ++ |
| 02:53 | Japella | a bot that responds to and now has 1 karma |
| 02:53 | SegFaultAX | napping: Please remove your bot. |
| 02:53 | ddellacosta | ooh, haha. That was meant to be an em-dash, not a decrement, Japella. |
| 02:53 | TEttinger | noonian, into |
| 02:53 | TEttinger | ##(into {} (seq {:foo "foo" :bar "bar"})) |
| 02:53 | lazybot | ⇒ {:foo "foo", :bar "bar"} |
| 02:53 | napping | SegFaultAX: I am not running a bot |
| 02:53 | SegFaultAX | napping: Oh I thought Japella was yours. My mistake. |
| 02:53 | ddellacosta | did the bot just knock my karma down? Not sure what it means anyways. |
| 02:54 | chord | you guys have experience using opengl from clojure? |
| 02:54 | napping | I was just the first one it replied to |
| 02:54 | TEttinger | not your karma |
| 02:54 | TEttinger | (karma ddellacosta) |
| 02:54 | TEttinger | right, the bot is gone |
| 02:54 | ddellacosta | probably low anyways, haha |
| 02:54 | TEttinger | some weird stuff going down |
| 02:54 | ddellacosta | &(karma ddellacosta) |
| 02:54 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: karma in this context |
| 02:54 | ddellacosta | ah, okay |
| 02:55 | ddellacosta | yah, I'm also seeing tons of people getting timed-out all of a sudden here and there |
| 02:55 | noonian | TEttinger: thanks! |
| 02:55 | TEttinger | noonian, np, into is so very useful |
| 02:55 | SegFaultAX | ddellacosta: Probably a netsplit. |
| 02:55 | ddellacosta | SegFaultAX: ah, didn't know about netsplits. Interesting. |
| 02:56 | TEttinger | ddellacosta, it's odd because it normally mentions netsplit in the quit message |
| 02:57 | TEttinger | in my client, it's NICK has quit (*.net *.split) |
| 02:57 | ddellacosta | TEttinger: I did see *.net *.split in some a while back, but after the first few I didn't see it. |
| 02:58 | ddellacosta | it just been "ping timeout" or something since then |
| 02:58 | noonian | I'm getting: <name> has left IRC (Ping timeout: 245 seconds) |
| 02:58 | ddellacosta | yah |
| 02:58 | TEttinger | noonian, yeah that's mostly what I see this time |
| 02:59 | TEttinger | but if it were a normal netsplit it would be the other message, and then everyone would get merged back |
| 02:59 | TEttinger | ,(+ 1 2) |
| 02:59 | clojurebot | 3 |
| 02:59 | TEttinger | ok, clojurebot is back |
| 03:03 | noonian | night all |
| 03:16 | clj_newb_2345 | i keep on hearing people talk baout "repl based development" -- for me, writing in emacs + calling (refresh) in a repl sees powerful enough. What does "replbased dev" really mean? is there a youtube video of someone demoing this? |
| 03:16 | Japella | i keep on hearing people talk baout "repl based development" for me, writing in emacs + calling (refresh) in a repl sees powerful enough. What does "replbased dev" really mean? is there a youtube video of someone demoing this? now has -1 karma |
| 03:30 | s4muel | clj_newb_2345: pretty much what you're talking about. 'repl based development' refers to the quick feedback loop you get with languages that provide one. You don't need to wait, compile, run, do over, etc |
| 03:31 | clj_newb_2345 | hmm |
| 03:31 | clj_newb_2345 | so "repl based" is not -- type code in repl |
| 03:31 | Japella | so "repl based" is not type code in repl now has -1 karma |
| 03:31 | clj_newb_2345 | then when something works, put it into a file ? |
| 03:32 | s4muel | Not to my understanding. That'd be pretty painful. |
| 03:34 | s4muel | It's more of a constant work-checking mechanism |
| 04:10 | SegFaultAX | Yay, I'm finally on the first page of top users on 4clojure. :) |
| 06:06 | supersym | SegFaultAX: grats :P |
| 06:24 | ro_st | cemerick :-) nice work on cljsbuild! |
| 06:26 | cemerick | ro_st: Just some housekeeping :-) |
| 06:26 | ro_st | valuable all the same |
| 08:13 | supersym | I've got this problem that reductions almost solves, anyone got a tip on how to approach this? Say I take (reductions + [1 1 6 6]) it returns (1 2 8 14) but instead, I need those intermediates as well (1 2 7 12 14) would be correct here |
| 08:16 | supersym | (p.s. I know this isn't how reductions work, but this illustrates the concept I need best) Somehow I've lost all my capability to write loops, in Clojure.. I never get that recur stuff going on |
| 08:16 | pyrtsa | supersym: I don't quite get it, so you have a sequence of pairwise sums and then the total in the end of the sequence? |
| 08:17 | supersym | and order matters btw |
| 08:18 | supersym | pyrtsa: ok, sorry. The idea is as follows (this is a very finite set but I'd like to do it idiomatic and not write everything out fully) but one throws 2 dice 1 to 6 that get sorted in ascending order |
| 08:18 | supersym | there are 2 modifiers, trictrac = (1 2) -> (1 1 2 2 5 5 6 6) and doubles e.g. (1 1) -> (1 1 6 6), (5 5) -> (5 5 2 2) |
| 08:18 | supersym | those are movements you can make on this backgammon board |
| 08:19 | supersym | you have to take these in order, but you can accumulate of course |
| 08:20 | pyrtsa | supersym: But what's your rule to get (1 2 7 12 14) from [1 1 6 6]? |
| 08:20 | supersym | so to think in steps ahead, I'd like to be able and get every possible combination I can make (2 2 5 5) could be 2 as a first, or just 4 (for the first two) 7 (2-25-2), etc |
| 08:21 | supersym | 1 is the first step, 1 and 1 are two steps but can be made as if they were a single step |
| 08:21 | supersym | or I take 1 and 7 and 6 |
| 08:21 | supersym | since they can be different stones |
| 08:22 | supersym | I have to match that against a weighed map of most essential strategic positions to take |
| 08:22 | supersym | some have priority over others |
| 08:22 | supersym | thats really why it matters |
| 08:25 | AimHere | supersym, for this (2 2 5 5) case, is the list of possibilities (2 4 7 10)? |
| 08:25 | supersym | and 12 and 14 |
| 08:26 | supersym | since I can just take the 4 steps and treat it as one |
| 08:26 | AimHere | Why not 9? |
| 08:26 | supersym | sorry and 9 |
| 08:26 | supersym | correct, 9 would leave 5 |
| 08:26 | AimHere | So you want a list of every ordered partial sum? |
| 08:27 | supersym | I guess that would be it :) |
| 08:27 | AimHere | So your (1 1 6 6) example missed out 8 and 13, I figure |
| 08:27 | supersym | correct |
| 08:27 | supersym | my bad |
| 08:30 | AimHere | The cute idiomatic functional way of doing this might take some thought. My brain keeps demanding that this contain two for loops... |
| 08:31 | supersym | haha ok... yeah I figured at least I wasn't capable of solving it, my math really blows, never did calculus in higher edu really |
| 08:32 | sheldonh | i managed to get through school without learning to think at all. achievement aside, i didn't do myself any favours |
| 08:34 | clj_newb_2345 | (clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<br>"))) SAXParseException XML document structures must start and end within the same entity. com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:198) |
| 08:34 | supersym | sheldonh: true, school was not my thing, I did take some college degree as librarian so above all I know how to Google well... |
| 08:34 | clj_newb_2345 | what am I doing wrong? |
| 08:34 | clj_newb_2345 | how do I use clojure.xml/parse on a string? |
| 08:35 | supersym | clj_newb_2345: seems to me your xml is missing a root node open/close |
| 08:35 | clj_newb_2345 | supersym what is a minimal xml document acceptable to xml.parse ? |
| 08:35 | supersym | "<br>" isn't valid, "<root><br></root>" might be |
| 08:36 | supersym | "<root></root>" I think |
| 08:36 | supersym | or whatever name you want to give it |
| 08:42 | supersym | AimHere: thanks for the correct definition/jargon anyway, now I can educate myself a bit more with those in my hand |
| 08:42 | AimHere | I'm still trying to knock something up |
| 08:44 | sheldonh | supersym: plus i bet you can wipe the floor with average joe when it comes to the duey decimal system ;) |
| 08:44 | squidz | dnolen: do you know if there is a way use relative paths in the source maps created? |
| 08:45 | squidz | instead of full paths |
| 08:48 | supersym | haha right |
| 08:49 | supersym | AimHere: much appreciated |
| 08:49 | AimHere | http://cljbin.com/paste/52384936e4b02a2f2ebff24c |
| 08:49 | AimHere | Two for loops it is! |
| 08:49 | AimHere | That does seem overly verbose |
| 08:50 | AimHere | My spider sense says there's a neat way of doing it with some built-in function I've forgotten about |
| 08:51 | AimHere | Oh, and it doesn't eradicate duplicates, come to think of it. Bung it in a set afterwards! |
| 09:01 | supersym | AimHere: Last time I got really close was math.combinatorics |
| 09:01 | supersym | anyway thanks for that |
| 09:04 | silasdavis | can anyone improve (defn fpow [[f n]] (reduce comp (repeat n f)))? |
| 09:04 | silasdavis | (possibility by pointing me at library function |
| 09:05 | silasdavis | actually I didn't mean to destrutcure: (defn fpow [f n] (reduce comp (repeat n f)))? |
| 09:06 | xeqi | ,(doc iterate) |
| 09:06 | clojurebot | "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 09:07 | AimHere | Yeah, but iterate gets something roughly the same size |
| 09:07 | tim | xeqi: not really the same, he's using comp to create a function |
| 09:08 | xeqi | tbaldridge: ah, true |
| 09:08 | AimHere | If you're golfing, then you can shave a few characters with iterate |
| 09:09 | AimHere | (defn fp [f n] #(nth (iterate f %) n)) |
| 09:09 | AimHere | I don't think it's materially better in other respects thoughy |
| 09:12 | silasdavis | would the iterate version ever be different than the comp version? |
| 09:54 | supersym | I so want to immigrate |
| 09:55 | supersym | now to figure out what country |
| 09:56 | hashcat | is there a web framework in clojure like Play in scala |
| 09:57 | supersym | hashcat: I don't know Play, you might want to take a look at Pedestal or Luminus |
| 09:58 | supersym | and there are a few static site generators |
| 10:05 | tazjin | hashcat: In general the existing "frameworks" are more a collection of libraries instead of complete "things" |
| 10:06 | tazjin | hashcat: There's a cool book about Web development in Clojure that is still in Beta, you can get it off the Pragmatic bookshelf: http://pragprog.com/book/dswdcloj/web-development-with-clojure |
| 10:08 | hashcat | I think Play is quite complete |
| 10:09 | hashcat | I'm still checking those article |
| 10:12 | crocket | Is clojure used to make native GUI applications? |
| 10:12 | crocket | In POSIX OSes, most GUI apps are written in python, C, and C++. |
| 10:12 | Japella | In POSIX OSes, most GUI apps are written in python, C, and C. now has 1 karma |
| 10:12 | crocket | ??? |
| 10:12 | lazybot | crocket: Yes, 100% for sure. |
| 10:12 | crocket | Now i'm confused. |
| 10:13 | crocket | Am I talking to bots? |
| 10:13 | hashcat | crocket: It seems not hard, just use java library |
| 10:13 | hashcat | I'm confused about this too |
| 10:13 | crocket | hashcat, java GUI libraries suck. |
| 10:13 | babilen | crocket: It looks as if Japella is picking up on anything that ends in foo++. |
| 10:13 | Japella | crocket: It looks as if Japella is picking up on anything that ends in foo. now has 1 karma |
| 10:14 | crocket | hate a bot |
| 10:14 | babilen | No idea if it is an "official" bot (this channel has a few) but it is a bit annoying |
| 10:14 | crocket | JVM is a terrible platform to make GUI applications. |
| 10:14 | crocket | Each app tends to consume at least 64MB for VM's sake. |
| 10:15 | crocket | memory hungry. |
| 10:15 | crocket | They also collect garbages very late. |
| 10:15 | algernon | 64Mb on today's hardware is no big deal. |
| 10:15 | hashcat | swing wrapper https://github.com/daveray/seesaw |
| 10:15 | crocket | algernon, It is a big deal collectively. |
| 10:16 | crocket | There are various apps running in a desktop environment, and if each app runs in a separate VM, I'm going to need 64GB instead of 4GB. |
| 10:17 | crocket | VMs hosting various dynamic languages consume little. |
| 10:18 | crocket | JVM consumes a lot |
| 10:18 | nDuff | crocket: You might look at the stack LightTable is written on. |
| 10:18 | hashcat | maybe you can code in Jvm and use other language for gui |
| 10:19 | nDuff | crocket: ...Chrome + node.js + ClojureScript |
| 10:19 | crocket | nDuff, ??? |
| 10:19 | lazybot | crocket: How could that be wrong? |
| 10:19 | hashcat | shut up, lazybot ~ |
| 10:19 | crocket | nDuff, Is chrome a language? |
| 10:19 | nDuff | crocket: it's a web browser, of course. |
| 10:20 | nDuff | crocket: ...but it can be used as a GUI toolkit by those so inclined. |
| 10:20 | crocket | nDuff, how? |
| 10:20 | nDuff | crocket: as I said, the language there is ClojureScript. |
| 10:20 | hyPiRion | It's a visualization engine connected to the Internet. |
| 10:20 | crocket | nDuff, Do you mean chrome-specific APIs? |
| 10:20 | nDuff | https://github.com/rogerwang/node-webkit |
| 10:21 | nDuff | ...so, no, not really -- apps written with HTML5, CSS3, WebGL, etc., running as desktop apps via hosting in a WebKit frame. |
| 10:21 | gleag | crocket: CEF? |
| 10:22 | crocket | nDuff, Is LightTable written with node-webkit? |
| 10:23 | nDuff | crocket: Yes. |
| 10:24 | crocket | nDuff, What's the benefit of that approach? |
| 10:24 | crocket | What's the tradeoff? |
| 10:26 | gleag | Isn't CEF a better approach anyway? I'd think that the support would be greater, as there are already a few commercial apps relying on that (EverNote, for example). |
| 10:29 | hashcat | is scalable in Pedestal means I can deploy app to cluster? |
| 10:29 | nDuff | gleag: ...C++? |
| 10:29 | Japella | gleag: ...C? now has 1 karma |
| 10:29 | gleag | What C++? |
| 10:29 | Japella | What C? now has 1 karma |
| 10:29 | nDuff | (dec Japella) |
| 10:29 | lazybot | ⇒ -1 |
| 10:29 | leifw | (inc nDuff) |
| 10:29 | lazybot | ⇒ 6 |
| 10:29 | rkneufeld | hashcat: to which page/library are you referring? Pedestal-service? |
| 10:29 | gleag | CEF already has multiple bindings, AFAIK. |
| 10:30 | hashcat | rkneufeld: It's homepage |
| 10:30 | crocket | hmm |
| 10:30 | hashcat | It said "Pedestal gives developers a solid foundation to build highly scalable backend services" |
| 10:30 | hashcat | cluster |
| 10:30 | hashcat | ? |
| 10:31 | nDuff | Yes, of course. |
| 10:31 | hashcat | sounds great |
| 10:31 | rkneufeld | hashcat: well pedestal-app is client side, so that's already quite a bit distributed ;). With pedestal-service you have the ability to stop/resume threads of execution on other threads/machines by virtue of interceptor mechanics. |
| 10:32 | nDuff | hashcat: ...well, the really Big Idea behind pedestal is the dataflow engine, which is centered on the client-side code rather than being server-side at all. |
| 10:32 | nDuff | (not that there aren't multiple innovations, the interceptor approach being another) |
| 10:33 | hashcat | client-side?? |
| 10:33 | lazybot | hashcat: Uh, no. Why would you even ask? |
| 10:33 | hashcat | I'll simply try it later |
| 10:33 | nDuff | hashcat: You might schedule a day (yes, it takes a full day) to go through the tutorial. |
| 10:34 | hashcat | nDuff: yea, I'm planning |
| 10:34 | crocket | hmm |
| 10:34 | crocket | nDuff, I think common lisp and scheme have Gtk+ bindings. |
| 10:34 | crocket | nice |
| 10:35 | crocket | Even Qt bindings |
| 10:36 | nDuff | crocket: Yeah. I don't tend to consider those reasonable options because the languages don't have the kind of functional/immutible semantics that I've been spoiled with in Clojure. |
| 10:37 | rurumate | I'm trying to run the tests in clojurescript, can anyone help? Currently getting only a weird exception, see http://pastebin.com/Mz08rmLw |
| 10:37 | tbaldridge | nDuff: I've slowly come to the conclusion that I don't need a GUI framework anymore, just a browser and an HTTP server. This coming from someone who has always wanted Qt for Clojure. |
| 10:37 | crocket | nDuff, ??? |
| 10:37 | lazybot | crocket: Yes, 100% for sure. |
| 10:37 | nDuff | crocket: what part of that was unclear enough to warrant a "???"? |
| 10:38 | nDuff | rurumate: would you mind using refheap.com, gist.github.com, or otherwise a pastebin without all the animated ads? |
| 10:38 | crocket | nDuff, You've been spolied with functional/immutable semantics in clojure? |
| 10:38 | nDuff | crocket: Yes. GUI toolkits are necessarily stateful, but having that state all mediated through reference types is damned handy. |
| 10:39 | crocket | nDuff, I haven't learned any LISP dialect yet. |
| 10:39 | crocket | reference types? |
| 10:40 | nDuff | crocket: atoms, refs, etc. It'd probably do you good to settle down with a book on Clojure. |
| 10:41 | crocket | nDuff, Do you mean that OOP fits GUI programming better than functional paradigm? |
| 10:41 | seangrove | Are there any advantages to defstruct over just using a hashmap? |
| 10:41 | nDuff | crocket: Nope. |
| 10:42 | nDuff | crocket: you might read through the slides at http://darevay.com/talks/clojurewest2012/ to whet your appetite. |
| 10:43 | rurumate | nDuff: sure, it's just a terminal stracktrace dump though, not code: http://pastie.org/8333105 |
| 10:44 | nDuff | crocket: ...it demonstrates a GUI library that's written to be natively clojure-y -- declarative, callback-based. &c. |
| 10:44 | Japella | crocket: ...it demonstrates a GUI library that's written to be natively clojure-y declarative, callback-based. &c. now has -1 karma |
| 10:48 | nDuff | hiredman: Did you ever get chanops here? |
| 10:51 | squidz | seangrove: do you know if there is a way use relative paths in the source maps created? |
| 10:53 | dnolen | squidz: if this is going to be done there needs to be solution for files in JARs and remote files. It might make sense to copy them into the out folder always, or perhaps you should be able to specify a directory specifically for source map resolution where everything will go into. plan+patch definitely welcome for this. |
| 10:58 | crocket | nDuff, What about Gtk+ or Qt bindings? |
| 10:59 | nDuff | crocket: well, they won't help with Clojure proper, because you're eating the JVM cost no matter what, and that's the part you're objecting to. |
| 11:00 | nDuff | crocket: I don't think anybody has written idiomatic CLJS bindings to either of those yet -- want a project? :) |
| 11:00 | Japella | crocket: I don't think anybody has written idiomatic CLJS bindings to either of those yet want a project? :) now has -1 karma |
| 11:00 | tbaldridge | dnolen: yeah, I tried for about an hour yesterday, was never able to get source maps to work with http-kit. the output folder was resources/public/js. But I could never get the right combination of parameters to get it to all reference /js. So that was a bit of a bummer. |
| 11:01 | nDuff | tbaldridge: any chance of getting more folks anointed chanops? Having the extra bot around here is getting annoying. |
| 11:02 | tbaldridge | nDuff: I have no control over that, not sure who does |
| 11:02 | xeqi | nDuff: I think technomancy got chanops, there was a thread on clojure-dev where chouser proposed adding him |
| 11:02 | seangrove | squidz dnolen: Yeah, I specifically don't have enough experience with it yet to know the right answer, and I'm not sure about the utility of relative urls in source maps ;) |
| 11:04 | crocket | nDuff, We have http://www.cliki.net/GUI |
| 11:05 | nDuff | crocket: The availability of cell-based GUI toolkits looks pretty awesome. |
| 11:05 | nDuff | crocket: ...that said, as before, if you want CL discussion, #clojure isn't the right place. |
| 11:05 | crocket | nDuff, cell-based? |
| 11:05 | crocket | ok |
| 11:06 | nDuff | crocket: "cells" in this context are a dataflow programming abstraction. There've been Clojure libraries implemented on the concept also. |
| 11:08 | `cbp | if I do something like (with-open [s (get-stream)] (def x (do-something s))) at the repl will s get garbage collected? |
| 11:09 | `cbp | Wait that's the wrong question :( nevermind |
| 11:10 | bordatoue | hi could anyone tell me what is wrong with (java.nio.file.Paths/get "somepath") |
| 11:12 | bosie | how did walter white make 80 million? |
| 11:12 | bordatoue | '# |
| 11:13 | bordatoue | who do get clojurebot to execute a cmd |
| 11:13 | bosie | oh shit, wrong channel |
| 11:13 | xeqi | ,(+ 1 2) |
| 11:13 | bordatoue | how do we get clojurebot to execute a cmd |
| 11:13 | clojurebot | 3 |
| 11:13 | bordatoue | thanks , xeqi |
| 11:14 | bordatoue | ,(java.nio.file.Paths/get "something") |
| 11:14 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: java.nio.file.Paths> |
| 11:14 | Apage43 | Paths/get expects a URI |
| 11:14 | Apage43 | (java.nio.file.Paths/get (java.net.URI. "file:///somepath")) |
| 11:14 | bosie | Apage43: the class isn't found though |
| 11:14 | Apage43 | oh |
| 11:14 | bordatoue | well Apage43 it works in java |
| 11:14 | Apage43 | that's cause nio is only in java 7 |
| 11:15 | bosie | Apage43: http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html takes a string nicely |
| 11:15 | Apage43 | .. ah |
| 11:15 | bordatoue | Apage I am having problems with the overloaded get method |
| 11:15 | Apage43 | it's not detecting it should use the overloaded one |
| 11:15 | crocket | nDuff, Is it worse to make GUI programs in SBCL than in clojure? |
| 11:16 | nDuff | crocket: I'm certainly not going to take a position on that. |
| 11:16 | crocket | nDuff, But you implied it earlier. |
| 11:16 | nDuff | crocket: I implied that *I* wouldn't choose SBCL. |
| 11:16 | nDuff | crocket: that's entirely different from saying it's worse. |
| 11:16 | bordatoue | Ok, how do we invoke the overloaded get method in Paths class using clojure |
| 11:17 | nDuff | s/implied/stated/ |
| 11:19 | Apage43 | well |
| 11:19 | Apage43 | thats not *actually* an overload |
| 11:19 | Apage43 | that's a varargs method |
| 11:19 | Apage43 | which like many things on the JVM are sugar |
| 11:19 | Apage43 | it takes a string as its first args, and a string array as its second |
| 11:19 | Apage43 | (java.nio.file.Paths/get "somepath" (into-array String [])) |
| 11:20 | crocket | nDuff, What would you choose between SBCL/CommonQt and clojure/(QtJambi|Seesaw)? |
| 11:21 | nDuff | crocket: That depends on my priorities, of course. |
| 11:21 | bordatoue | this is so confusing ,(java.nio.file.Paths/get "/home/base" "drive" ) |
| 11:21 | nDuff | crocket: Your prioritise include minimizing memory expendature to a far greater extent than mine do. |
| 11:21 | Apage43 | (java.nio.file.Paths/get "/home/base" (into-array String ["drive"])) |
| 11:21 | crocket | nDuff, Let's forget about it for now. |
| 11:21 | nDuff | crocket: ...CommonQt isn't cell-based, is it? It certainly wouldn't be my choice out of the available SBCL GUI toolkits |
| 11:21 | bordatoue | Apage43: then why can't it take a string instead of URI , |
| 11:22 | Apage43 | those are strings |
| 11:22 | crocket | nDuff, I'm not a GUI guy yet. |
| 11:22 | Apage43 | that method doesn't have a single-arg variant that takes a string, only the two-arg variant |
| 11:22 | bordatoue | Apage43: but you have passed an String[] |
| 11:22 | Apage43 | yes |
| 11:22 | Apage43 | it has a (String, String[]) variant, and a (URI) variant |
| 11:23 | bordatoue | Apage43: I am confused with the URI variant , in java it works with string I don't need to pass a URI |
| 11:23 | hyPiRion | 222 |
| 11:23 | bordatoue | Apage43: why is this difference |
| 11:23 | hyPiRion | whoops, sorry about that. |
| 11:23 | Apage43 | bordatoue: in java that becomes the (String, String[]) variant passing an empty array as the second arg |
| 11:24 | Apage43 | this is how varargs are implemeneted in java |
| 11:25 | crocket | nDuff, Imagine that gnome-shell or unity runs on JVM. |
| 11:25 | Apage43 | the String… in the signature is basically a hint to the java compiler, to invoke this function if given any extra args to put them all into an array and invoke that variant |
| 11:25 | crocket | It'd be hogging a lot more RAM than python VM. |
| 11:25 | nDuff | crocket: It would also be much, much faster, as long as you had the RAM. |
| 11:26 | nDuff | crocket: I write Python for my day job at least as much as I do Clojure, and one thing Python is is *slow*. |
| 11:26 | crocket | nDuff, I think SBCL/CommonQt would be a better fit for a complex network of GUI programs. |
| 11:26 | bordatoue | Apage43: for the single arg variant of get why is does it work for String , get(String) works in java not in CLojure |
| 11:26 | nDuff | crocket: I don't know why you're arguing this with me. |
| 11:27 | nDuff | crocket: It's not a discussion I have any interest in. |
| 11:27 | appendonly | nDuff: do you use many libraries? much of my python has been replaced by go |
| 11:27 | Apage43 | because the Java compiler checks the types and (because of that rule) can select that variant |
| 11:27 | nDuff | appendonly: Yes, and a rewrite of some of my paramiko-based code to use go.crypto.ssh is in the works. |
| 11:28 | Apage43 | bordatoue: but that's because Clojure is not doing that Java varargs transform |
| 11:29 | Apage43 | so that's not one of the eligible overloads when it picks a way to invoke that method with a single arg |
| 11:29 | bordatoue | Apage43: thanks, I understand the varargs bit. What I cannot understand is the substituion of String instead of URI in get(String/URI) |
| 11:29 | Apage43 | bordatoue: it can't see the String version |
| 11:30 | Apage43 | since there *is* no single arg String version of that method |
| 11:31 | bordatoue | Apage43: have you tried Paths.get("somefile") would return "somefile", I am passing a string not a URI instance |
| 11:31 | Apage43 | Yes, that works in *java* |
| 11:31 | Apage43 | because java tries the URI version, fails, then tries the varargs transform, which works |
| 11:31 | Apage43 | Clojure doesn't do the varargs transform, so it doesn't |
| 11:32 | bordatoue | Apage43: thanks a lot |
| 11:32 | Apage43 | you can do (java.nio.file.Paths/get "/home/base" (into-array String ["drive"])) directly |
| 11:32 | Apage43 | even though its a bit weird to look at |
| 11:33 | Apage43 | can wrap it up as (defn make-path [base & more] (java.nio.file.Paths/get base (into-array String more))) |
| 11:33 | bordatoue | I think clojure's implemenation of vararg isn't correct then. It is called vararg becasuse that arg can be omitted . so (Paths/get "somethind" nil) |
| 11:33 | clgv | Apage43: so there is a benefit to write a clojure wrapper function here ^^ |
| 11:33 | Apage43 | then use (make-path "/home/base" "drive" "whatever") |
| 11:34 | Apage43 | bordatoue: its more that Java's varargs are a feature of Java, but not of the JVM, so other JVM languages don't "see" it |
| 11:34 | Apage43 | kind of like inner classes |
| 11:35 | bordatoue | Apage43: thats a good point, similar to try-with-resouce and underscores in numerals |
| 11:40 | gleag | Apage43: That doesn't sound like a reason for the other languages to be unable to implement that behavior. |
| 11:41 | nDuff | gleag: Other languages don't know what the original Java code looked like, only what the generated bytecode is. |
| 11:42 | gleag | So it's unrecoverable? Even with heuristics? |
| 11:43 | nDuff | gleag: You could asume that anything that takes an object array as its last argument is a vararg call, sure. |
| 11:43 | nDuff | gleag: public static void main(String[] args) and public static void main(String... args) generate the same bytecode. |
| 11:44 | nDuff | gleag: ...so, it's just a matter of whether you want to allow anything with an array as its last argument to be automatically treated as a vararg call. |
| 11:44 | gleag | So the other languages, if they support varargs and sequences/arrays, could simply offer both calling conventions? |
| 11:45 | nDuff | Could. |
| 11:46 | nDuff | That patch would be pretty straightforward to handle purely at compile-time in the case where no reflection is involved, but would have a runtime performance penalty otherwise. |
| 11:46 | nDuff | ...that runtime performance penalty, IMHO, is a reasonable cause not to go that route. |
| 11:49 | Apage43 | there's also the ambiguity involved if you try to pass an array to something that has an Object… signature |
| 11:50 | Apage43 | is (foo somearray) to be called directly, or should you wrap it up a second time? |
| 12:04 | sm0ke | ,(map {:a 1 :b 2} println) |
| 12:05 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$println> |
| 12:07 | sm0ke | ,(map println {:a 1 :b 2}) |
| 12:07 | clojurebot | ([:a 1]\n[:b 2]\nnil nil) |
| 12:10 | zerokarmaleft | sm0ke: for side-effects, you'll want to prefer doseq |
| 12:11 | zerokarmaleft | ,(doseq [item {:a 1 :b 2}] (println item)) |
| 12:11 | clojurebot | [:a 1]\n[:b 2]\n |
| 12:15 | sm0ke | umm i am trying to map a map to a new map with values doubled |
| 12:15 | sm0ke | cant figure it out |
| 12:16 | hyPiRion | ,(reduce-kv (fn [m k v] (assoc m k (* 2 v))) {} {:a 1 :b 2 :c 3}) |
| 12:16 | clojurebot | {:b 4, :c 6, :a 2} |
| 12:16 | hyPiRion | or ##(into {} (for [[k v] {:a 1 :b 2 :c 3}] [k (* 2 v)])) |
| 12:16 | lazybot | ⇒ {:a 2, :c 6, :b 4} |
| 12:19 | sm0ke | umm doesnt look very nice...in scala i can do ! Map( 1 ->2, 2 -> 3) map { case (k,v) => (k,2*v) }.. what r you guys not using map? |
| 12:20 | sm0ke | does map always give a list back? |
| 12:20 | Bronsa | a seq |
| 12:20 | sm0ke | ,(:doc map) |
| 12:20 | clojurebot | nil |
| 12:20 | sm0ke | aye |
| 12:20 | Apage43 | ,(:doc (meta #'map)) |
| 12:20 | clojurebot | "Returns a lazy sequence consisting of the result of applying f to the\n set of first items of each coll, followed by applying f to the set\n of second items in each coll, until any one of the colls is\n exhausted. Any remaining items in other colls are ignored. Function\n f should accept number-of-colls arguments." |
| 12:21 | Apage43 | or ##(doc map) |
| 12:21 | lazybot | ⇒ ------------------------- clojure.core/map ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each co... https://www.refheap.com/18740 |
| 12:21 | Apage43 | oh that's cool |
| 12:21 | Apage43 | i didn't know it refheaped long answers |
| 12:22 | sm0ke | pretty cool bot |
| 12:22 | rurumate | sm0ke: there's also mapv which is eager and returns a vector |
| 12:23 | supersym | stupid question: in English, when I say numbers 1 up to 24, 24 isn't included is it? Whats the agreement on this? I know this goes wrong with bungee jumping from hotels now and then :P |
| 12:23 | sm0ke | rurumate: what if i wanted map not seq or vectors |
| 12:23 | supersym | what first floor is and what not |
| 12:23 | sm0ke | ,(class []) |
| 12:23 | clojurebot | clojure.lang.PersistentVector |
| 12:23 | sm0ke | ,(class {}) |
| 12:23 | clojurebot | clojure.lang.PersistentArrayMap |
| 12:25 | sm0ke | ,(map #(%) {:a 1 :b 2}) |
| 12:25 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: MapEntry> |
| 12:25 | sm0ke | ? |
| 12:26 | Apage43 | ,(seq {:a 1 :b 2}) |
| 12:26 | clojurebot | ([:a 1] [:b 2]) |
| 12:26 | Apage43 | #(%) is short for (fn [x] (x)), not (fn [x] x) (it was trying to call the pair as a function) |
| 12:27 | sm0ke | umm wow |
| 12:27 | sm0ke | thats subtle |
| 12:27 | zerokarmaleft | ,(map (fn [pair] pair) {:a 1 :b 2}) |
| 12:27 | clojurebot | ([:a 1] [:b 2]) |
| 12:27 | zerokarmaleft | ,(map (fn [[k v]] [k v]) {:a 1 :b 2}) |
| 12:27 | clojurebot | ([:a 1] [:b 2]) |
| 12:27 | zerokarmaleft | less subtle if you use fn |
| 12:27 | sm0ke | whats the shorthand for (fn [pair] pair) then? |
| 12:28 | Apage43 | identity |
| 12:28 | zerokarmaleft | ,(map identity {:a 1 :b 2}) |
| 12:28 | clojurebot | ([:a 1] [:b 2]) |
| 12:28 | sm0ke | ,(into (map (fn [[k v]] [k (* 2 v)]) {:a 1 :b 2})) |
| 12:28 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$into> |
| 12:28 | hyPiRion | ,(map #(`%%%) {:a 1 :b 2}) |
| 12:28 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: arg literal must be %, %& or %integer> |
| 12:28 | sm0ke | ,(into {} (map (fn [[k v]] [k (* 2 v)]) {:a 1 :b 2})) |
| 12:28 | clojurebot | {:a 2, :b 4} |
| 12:28 | hyPiRion | &(map #(`%%%) {:a 1 :b 2}) |
| 12:28 | lazybot | ⇒ ([:a 1] [:b 2]) |
| 12:29 | sm0ke | what is that!! |
| 12:29 | Apage43 | useful has some friendly stuff for that sort of thing https://github.com/flatland/useful/blob/develop/src/flatland/useful/map.clj#L47-L52 |
| 12:29 | hyPiRion | Oh, you're new to Swearjure I see |
| 12:29 | hyPiRion | ~quicksort |
| 12:29 | sm0ke | :) yes i am just learning |
| 12:29 | clojurebot | quicksort is https://www.refheap.com/paste/284a0552a6b69c6037faa2db5 |
| 12:30 | hyPiRion | ^ |
| 12:31 | supersym | hehe hyPiRion showing off :P |
| 12:31 | bja | that quicksort is beautiful |
| 12:31 | sm0ke | no its not |
| 12:31 | zerokarmaleft | hyPiRion: is that in-place? |
| 12:33 | hyPiRion | zerokarmaleft: hah, no. We don't have mutable arrays in Clojure (or Swearjure for that matter). |
| 12:35 | sm0ke | guys is there a web framework for comet in clojure? |
| 12:37 | sm0ke | http kit looks promising |
| 12:38 | supersym | http://http-kit.org/server.html#async |
| 12:38 | supersym | yea |
| 12:42 | TimMc | hyPiRion: More like quacksort. |
| 12:42 | `cbp | :-o that quicksort. Does it choose the median too? :) |
| 12:42 | hyPiRion | yes |
| 12:46 | turbopape | I have the feeling enlive will save my life :à |
| 12:46 | turbopape | :) |
| 12:46 | turbopape | pretty promising |
| 12:48 | technomancy | pew pew pew |
| 12:49 | pjstadig | technomancy: you are ruthless in the exercise of your power |
| 12:49 | hyPiRion | huh |
| 12:49 | technomancy | pjstadig: that bot was causing all kinds of trouble in #emacs too, so I had some background |
| 12:50 | technomancy | you don't connect a bot to a channel without implementing "help" and "source" commands; that's just tacky. |
| 12:50 | TimMc | lazybot: help |
| 12:50 | lazybot | You're going to need to tell me what you want help with. |
| 12:50 | TimMc | clojurebot: help |
| 12:50 | clojurebot | Nobody can help with "X doesn't work". Please provide context: what you did, what you hoped would happen, and what happened instead. A stack trace is especially helpful, if applicable. |
| 12:50 | TimMc | :-D |
| 12:50 | hyPiRion | lazybot: source |
| 12:50 | lazybot | Source not found. |
| 12:50 | hyPiRion | aha, I can just print that for my new bot, wee |
| 12:51 | technomancy | TimMc: unless you're willing to stay in the channel and field those calls yourself, I mean =) |
| 12:51 | hyPiRion | technomancy: by source, you mean author and name of the bot project, right? |
| 12:51 | technomancy | hyPiRion: right; some means of contact at least |
| 12:51 | technomancy | clojurebot: what is your origin story? |
| 12:51 | clojurebot | Excuse me? |
| 12:51 | technomancy | hm; dang. I know it's in there somewhere. |
| 12:52 | TimMc | technomancy: How do you feel about unless I'm willing to stay in the channel and field those calls myself, you mean =)? |
| 12:52 | TimMc | bleep bloop |
| 12:53 | TimMc | For Halloween, I'm going as a badly written Eliza bot. |
| 12:53 | technomancy | http://www.smbc-comics.com/index.php?db=comics&id=3007#comic |
| 12:55 | rurumate | in clojurescript, these expressions evaluate to a the stringify function: [js.JSON.stringify, JSON/stringify, JSON.stringify] while these doesn't: js.JSON/stringify, can somebody comment on that? |
| 12:55 | rurumate | sorry for the broken lingo.. |
| 12:56 | rurumate | I just don't see the rule here, yet |
| 12:57 | dnolen | rurumate: on js/ is valid |
| 12:57 | dnolen | rurumate: only js/ I mean |
| 13:01 | arrdem | technomancy: +1 |
| 13:02 | nDuff | technomancy: I was looking for you earlier -- we have an unwelcome bot. Did you ever get chanops? |
| 13:02 | nDuff | Oh, n/m, I see so. :) |
| 13:03 | TimMc | Was it join/part'ing? I didn't see it. |
| 13:05 | technomancy | it was doing some misguided karma tracking |
| 13:06 | arrdem | someone else started on their clojure cup project early |
| 13:09 | TimMc | Oh, I see it in my logs. |
| 13:09 | TimMc | Yeah, that's pretty irritating. |
| 13:09 | rurumate | dnolen: so "js" is special syntax? |
| 13:10 | darrickw | I'm thinking of using Domina + Crate in my current ClojureScript project. Wondering if those libs are the right way to go or if there are better alternatives. |
| 13:10 | rurumate | darrickw: there is dommyhttps://github.com/Prismatic/dommy |
| 13:10 | rurumate | https://github.com/Prismatic/dommy |
| 13:11 | dnolen | rurumate: yes |
| 13:11 | darrickw | glad I asked! :) |
| 13:11 | dnolen | rurumate: it denotes something which is external to the ClojureScript source - the global namespace |
| 13:12 | rurumate | .. and which is not part of the goog.require syte, |
| 13:12 | rurumate | system |
| 13:12 | rurumate | my fingers suck today |
| 13:13 | dnolen | rurumate: yes those things are handled by the ns form like everything else |
| 13:13 | dnolen | rurumate: so they aren't global |
| 13:59 | benkay | i can talk to QuantLib from the REPL! |
| 14:01 | callen | benkay: the voices are in your head |
| 14:06 | TimMc | hyPiRion: Did we ever figure out the computational complexity of quicksort.swj |
| 14:07 | callen | I feel like I've missed some sort of pattern with auto-generating datalog from arbitrary constraints. |
| 14:08 | hyPiRion | TimMc: At least O(n^3 log n^3) I think |
| 14:08 | hyPiRion | Not sure right now |
| 14:13 | TimMc | 19 ms for (range 10), 2.2 s for (range 50)... |
| 14:14 | TEttinger | what is quicksort.swj ? |
| 14:14 | TEttinger | what is .swj ... |
| 14:14 | rasmusto | TEttinger: hold onto your hat |
| 14:15 | TimMc | ~quicksort |
| 14:15 | callen | quicksort.sqj ? |
| 14:15 | clojurebot | quicksort is not something you need alphanumerics for: https://www.refheap.com/paste/284a0552a6b69c6037faa2db5 |
| 14:15 | callen | er, swj? |
| 14:15 | callen | god dammit hyPiRion |
| 14:16 | TEttinger | rasmusto: http://mobile.businessinsider.com/image/50587a2beab8ea8b2e000002/heisenberg-breaking-bad.png |
| 14:16 | TEttinger | oh, swearjure |
| 14:16 | TEttinger | that crazy stuff |
| 14:18 | TimMc | hyPiRion: Yeah, damn near n^3. |
| 14:19 | `cbp | maybe it shouldnt try picking the median :D |
| 14:21 | TimMc | For ascending inputs, n=[10,50,100] gives millis=[19,2248,19248]. Ratios 116.5 (10->50), 8.6 (50->100), 997.3 (10->100), very close to n^3 ratios of 125, 8, 1000. |
| 14:29 | arrdem | "having coffee" about a potential freelance job tomorrow... anyone done this before & have advice? |
| 14:30 | benkay | callen: u so funny |
| 14:31 | callen | arrdem: I've freelanced off and on for years, I know a few people in here that have done it longer. You might need to get more specific. |
| 14:31 | callen | Do you want advice on...probing the nature of the project...selling the customer? |
| 14:31 | technomancy | I have had coffee before. highly recommend it. |
| 14:31 | arrdem | technomancy: enlightened as always |
| 14:31 | technomancy | well, depends on the coffe |
| 14:31 | technomancy | e |
| 14:32 | callen | technomancy: sometimes I think you sit in IRC with your fingers hovering over the keyboard...nay quivering...just waiting for the right opportunity to be witty. |
| 14:32 | callen | maybe quivering from the thirst of the kill...maybe from the excessive coffee consumption... |
| 14:32 | TimMc | I think he's just fast. |
| 14:32 | technomancy | and then I ruin it with a typo |
| 14:32 | technomancy | TimMc: dvorak, represent |
| 14:34 | arrdem | callen: not sure where to start... the potential customer has shot me a couple of research papers which lay out the desired product pretty well and the contract is really to provide a Clojure imp'l atop Loom. |
| 14:34 | arrdem | callen: I guess the part I'm nervous about is pricing |
| 14:35 | squidz | what's the easiest way do this with a set? #{"a" "b"} -> "a,b" :: without spaces between elements |
| 14:35 | callen | arrdem: charge weekly |
| 14:35 | callen | arrdem: think of a number that is appropriate to charge weekly, quadruple it. |
| 14:36 | `cbp | squidz: clojure.string/join but the order of the items might not be what you want |
| 14:36 | squidz | `cbp: that is fine thank you |
| 14:37 | arrdem | callen: what's the rationale here? or just gut from having done this. |
| 14:37 | callen | arrdem: cock an eyebrow if you want. I'm still right. |
| 14:37 | callen | arrdem: every contractor starts out massively undercharging and discounting the cost of risk and other things |
| 14:37 | callen | they also make the mistake of charging hourly, daily, or by the project. You don't want that. |
| 14:37 | arrdem | callen: I wouldn't be consulting #clojure if I didn't trust the advice, I'm just curious |
| 14:37 | callen | You want weekly so you can focus on the work, not on logging time. You want weekly so your priorities are more closely aligned to that of the client |
| 14:37 | tupi | (type 1.2342342342342) |
| 14:37 | technomancy | I agree that it's very common to under-value your work when starting out |
| 14:38 | callen | ie, no desire to just rush something out. |
| 14:39 | callen | project billing is a bad idea for new people, high risk, high stress. It's generally a bad idea unless you're dealing with a very specific sort of client (large institution) and you're going for a profit hail mary. |
| 14:40 | tupi | sorry, how do i call the clojurebot here ? |
| 14:40 | callen | , |
| 14:40 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 14:40 | `cbp | it broke |
| 14:40 | coventry | tupi: Put a comma in front of your form. ,(type 1.2342342342342) |
| 14:40 | tupi | ,(type 1.2342342342342) |
| 14:40 | clojurebot | java.lang.Double |
| 14:41 | tupi | ,(case (type 1.2342342342342) java.lang.Double (println (format "%.3f" 1.23456789)) (println "blue")) |
| 14:41 | clojurebot | blue\n |
| 14:41 | tupi | what is wrong ? |
| 14:42 | danielszmulewi-1 | technomancy: I want to add my program to /etc/init.d/ on Debian. Should I use the lein-daemon plugin, or is there something built-in with leiningen 2? |
| 14:42 | `cbp | tupi: use cond or condp, case wont evaluate java.lang.Double which means you are comparing a class to a symbol |
| 14:43 | tupi | ok, tx |
| 14:43 | TimMc | ,(class `java.lang.Double) |
| 14:43 | clojurebot | clojure.lang.Symbol |
| 14:43 | callen | danielszmulewi-1: bad form to aim questions unless there's a strong reason for doing so, like continuing a recent conversation. |
| 14:43 | aaelony | quick nrepl+emacs question. I have nrepl+emacs working on another box, but just switched to linux mint and although C-c M-j starts up nrepl and reports that I am "Connected", C-x C-e at the end of a clojure line in emacs gives me "No Lisp subprocess; see variable-lisp-buffer". Any help appreciated... |
| 14:44 | danielszmulewi-1 | technomancy: am I being rude? |
| 14:44 | technomancy | danielszmulewi-1: eh, not really, but I've never used lein-daemon so you might as well ask the whole channel |
| 14:44 | danielszmulewi-1 | technomancy: sure, thanks. |
| 14:44 | callen | aiming questions at people pings them and makes others who could answer your question less likely to do so. |
| 14:45 | callen | I generally don't ping people unless I'm already talking to them or it's hyper-specific to them. |
| 14:45 | technomancy | clojars uses upstart+uberjar which works fine |
| 14:45 | Raynes | technomancy: My leiningen doesn't work. Can you fix it plz. |
| 14:45 | danielszmulewi-1 | callen: Duly noted. |
| 14:45 | technomancy | Raynes: take it back to the shop and ask for a replacement if it's still under warranty |
| 14:46 | Raynes | technomancy: Oh, I forgot to purchase HagelCare. |
| 14:46 | danielszmulewi-1 | technomancy is the authority on leiningen, being the author and such. I guess you get a lot of abuse for that. |
| 14:46 | muhoo | ~hagelcare |
| 14:46 | clojurebot | No entiendo |
| 14:46 | danielszmulewi-1 | :-) |
| 14:47 | callen | danielszmulewi-1: just because he's the author of leiningen doesn't mean it's appropriate to ping him for every Leiningen question |
| 14:47 | technomancy | danielszmulewi-1: I haven't used it outside heroku for a long time, so I'm not as familiar with various production setups. |
| 14:47 | Raynes | I'm the sous authority. |
| 14:47 | danielszmulewi-1 | cool. |
| 14:47 | muhoo | i'd have to venture a guess that leiningen probably has the largest contributor list of any clojure project |
| 14:47 | callen | I'd be comfortable saying so. |
| 14:48 | arrdem | muhoo: given that I'm on it, that's probably true |
| 14:48 | callen | I would reiterate that it's bad form to ping people on IRC in a programming context with questions unless you have a strong cause for doing so. |
| 14:48 | technomancy | huh, github only shows the top 100 contributors on https://github.com/technomancy/leiningen/contributors |
| 14:48 | callen | Counter-example, if you're using one of my libraries like bulwark or blackwater, it's fine to ping me because I'm the only person that likely knows them. |
| 14:48 | callen | Leiningen has tons of users thoguh. |
| 14:48 | danielszmulewi-1 | upstart is an ubuntu thing. Debian has a system V thing |
| 14:48 | muhoo | to which, i say, (partial inc 1) to technomancy's leadership of the project. |
| 14:48 | callen | (inc technomancy) |
| 14:48 | lazybot | ⇒ 75 |
| 14:49 | callen | technomancy: gotta start spending that lazybot karma. |
| 14:49 | muhoo | convert it to bitcoin |
| 14:49 | callen | why is github make 3d viewers and 3d diffs when the UI could still use a lot of work for...actual version control? |
| 14:49 | callen | making* |
| 14:50 | technomancy | ohloh shows 213 contributors, but that includes someone claiming to be "Bagu is my name. Show my code to River Man" so there's that |
| 14:50 | callen | LOL |
| 14:50 | danielszmulewi-1 | I'll take tips from anyone that has experience with daemonizing clojure programs. |
| 14:50 | technomancy | https://www.ohloh.net/p/leiningen/contributors?page=11&sort=latest_commit |
| 14:50 | muhoo | but the point is, there are lots of people who know a lot about leiningen, so the pool of people who can answer questions knowledgeably is large |
| 14:50 | danielszmulewi-1 | Especially on Debian |
| 14:50 | jared314 | 3d views and 3d diffs could be for 3d printing market |
| 14:51 | callen | danielszmulewi-1: `lein run` or uberjars with upstart for daemonization are common. |
| 14:51 | callen | jared314: but...who...cares? |
| 14:51 | callen | I know Yummly does `lein run` :) |
| 14:51 | danielszmulewi-1 | callen: thanks. |
| 14:52 | danielszmulewi-1 | There's a lein-daemon plugin that looks cool |
| 14:52 | technomancy | if you do lein run, be sure to strip out profiles and use trampoline |
| 14:52 | danielszmulewi-1 | technomancy: yessir, I remember that |
| 14:52 | technomancy | `lein with-profiles production trampoline run` to be safe |
| 14:52 | callen | yeah that's what I was thinking. |
| 14:52 | danielszmulewi-1 | technomancy: if there was a way to know the pid then I don't need anything else |
| 14:52 | technomancy | and locking down m2 once for all |
| 14:52 | technomancy | (which is why uberjars are recommended; fewer things to go wrong) |
| 14:53 | callen | which is why I use uberjars :P |
| 14:53 | callen | build once, deploy forever. |
| 14:53 | callen | but I know some people prefer the familiarity of lein. |
| 14:53 | danielszmulewi-1 | yes, but when you push changes to your project, deploying it adds another step with uberjar |
| 14:54 | llasram | Unless your CI infrastructure handles that for you |
| 14:54 | callen | which is sorta how you're supposed to be deploying JVM apps these days. |
| 14:54 | danielszmulewi-1 | llasram: correct |
| 14:55 | callen | I just build locally, push the jar, flip the switch on upstart. |
| 14:55 | danielszmulewi-1 | i do git push and lein run with in production profile. I love the lean aspect of that. |
| 14:56 | callen | yes, having a bunch of production machines do the same provisioning work over and over...very lean...yessss |
| 14:57 | danielszmulewi-1 | I have frequent changes. One production machine. I don't need provisioning. Different use case. |
| 14:58 | callen | many things are possible when n=1 |
| 15:11 | jtoy | what simple way do you guys recommend to split a collection into 2 evenly distributed new collections? |
| 15:14 | jtoy | here is my first attempt: (let [coll (shuffle coll) length (count coll)] (split-at (/ length 2) coll)) |
| 15:14 | gws | jtoy: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/split-at |
| 15:15 | gws | sorry, didn't see that until just after i pasted |
| 15:15 | `cbp | ,(apply map list (partition 2 [1 2 3 4 5 6 7 8])) |
| 15:15 | clojurebot | ((1 3 5 7) (2 4 6 8)) |
| 15:15 | `cbp | :-) |
| 15:16 | arrdem | ,(type (first (partition 2 (range 3)))) |
| 15:16 | clojurebot | clojure.lang.LazySeq |
| 15:17 | borkdude | ,(doall *1) |
| 15:17 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Var$Unbound> |
| 15:17 | borkdude | nm ;) |
| 15:19 | gfredericks | man the bots should totally have *1 etc. |
| 15:19 | arrdem | gfredericks: *1 ? |
| 15:20 | gfredericks | arrdem: clojure.core/*1 |
| 15:20 | gfredericks | like at a repl |
| 15:20 | arrdem | gfredericks: ah. not a sym I've touched before. |
| 15:22 | callen | everybody paste your *1's! |
| 15:23 | callen | {:type :summary, :pass 12, :test 6, :error 0, :fail 0} |
| 15:23 | indigo | nil |
| 15:23 | borkdude | from my private system: {:param2 "value2", ":param2" "value2", ":param1" "value1", :param1 "value1"} |
| 15:23 | gfredericks | nil |
| 15:23 | jtoy | [(12 123 132 13 14324) (24 23432 4)] |
| 15:24 | gfredericks | also {:type :summary, :pass 21, :test 6, :error 0, :fail 0} |
| 15:24 | borkdude | from my work system: I don't know, I closed it because I forgot my adapter :-s |
| 15:24 | callen | lol |
| 15:24 | `cbp | "yeah" |
| 15:25 | callen | `cbp: really? |
| 15:25 | `cbp | :-( |
| 15:25 | Bronsa | you don't want me to paste my *1. |
| 15:25 | gfredericks | callen: were you just trying to give him the opportunity to say "yeah"? |
| 15:25 | callen | `cbp: where in your data was "yeah"? |
| 15:25 | callen | gfredericks: no, I was surprised. |
| 15:26 | `cbp | callen: I changed a function body to "yeah" to see if it was being called :P |
| 15:26 | callen | `cbp: thanks for reminding me we need a better debugging solution :P |
| 15:27 | coventry | You can usually skip that step with something like (trace/trace "x in function y" x) |
| 15:27 | gfredericks | (prn "poop" data) |
| 15:27 | callen | c.t.t is nice. |
| 15:27 | gfredericks | is my debugging library |
| 15:28 | coventry | callen: You get used to it. Compared to pdb, it kind of sucks. |
| 15:29 | callen | coventry: that's just it, I'm used to iPython + ipdb |
| 15:29 | callen | coventry: and before that. Common Lisp |
| 15:29 | callen | I'm getting used to just reading the code but I hate the manual nature of adding print lines. |
| 15:34 | `cbp | is an ORM kind of syntax ok for clojure? Like (create User ..) vs (create-user ..) |
| 15:34 | `cbp | (where the former is a protocol function on a record and the latter is just a fn on a map) |
| 15:34 | callen | `cbp: most Clojure users will avoid ORM patterns. I would use multimethods for this, were I you. |
| 15:35 | callen | `cbp: *if* you really need that kind of abstraction. |
| 15:35 | `cbp | Actually yeah thats a multimethod sorry |
| 15:35 | callen | I usually just write functions and hesitate to abstract until later when I know my needs better. |
| 15:36 | `cbp | I have multimethods create get-record create-table etc. and a protocol that specifies save delete update |
| 15:37 | callen | I'd hesitate to abstract that much until I had more of my problem encompassed. It sounds like you're tripping into a whole SQL abstraction library. |
| 15:37 | callen | it's also a little strange to have something like "create-table" in your app code, IMHO |
| 15:38 | squidz | does core.async work with clojurescipt 1889? |
| 15:39 | callen | I've heard vague rumblings of problems. |
| 15:39 | squidz | does anybody which versions work with each other? |
| 15:41 | `cbp | callen: I've used this "pattern" a couple of times on apps that needed some simple crud and I was making a small application where I can specify a textual design of the database and it would give me the clojure code following that pattern |
| 15:43 | `cbp | Also I was wondering that if I releaased it anyone else would ever use it :P |
| 15:49 | callen | `cbp: if it works it works, but you should look at Korma :P |
| 15:55 | hyPiRion | Argh, the githubs went down |
| 15:56 | callen | time to make Raynes mad |
| 15:56 | callen | hey Raynes |
| 15:56 | callen | Raynes: githubstatus: We are currently experiencing major service outages. |
| 15:56 | hyPiRion | I'd guess it is because of the new feature they launched |
| 15:57 | callen | yes lets have downtime for a silly 3d feature. wonderful. |
| 16:00 | akurilin | So validators like mississippi only take care of keys that are present in the map. You can't use a key ":other" and wire a bunch of validations against that. It does seem to be convenient for cases like "I want the combo of these two keys to be unique", which isn't supported out of the box. I'm thinking of making that a separate check and merging the returned map into the miss. map. Is that how others do it? |
| 16:01 | jtoy | if I wanted to store a string that should be evaled with the last argument in the string passed into it like "(+ 5 X)"; X = 3 => 8; how would I call this from clojure where I can replace X ? |
| 16:03 | hyPiRion | not sure what you mean, but |
| 16:04 | jstew | Curiosity: How do you guys deploy your webapps? Jetty? Tomcat? I'm pretty clueless when it comes to modern Java webdev. Looks like some knowledge of servlet containers would help me. |
| 16:04 | havenn | jtoy: Anonymously like `((fn [x] (+ x 5)) 2)` or named `(defn add-five [x] (+ x 5))`. |
| 16:04 | hyPiRion | ,(->> "(+ 5 X)" read-string (list 'let ['X 3])) |
| 16:04 | clojurebot | (let [X 3] (+ 5 X)) |
| 16:04 | havenn | jtoy: or do you mean something else? |
| 16:04 | callen | jstew: http-kit + uberjar |
| 16:04 | tbaldridge | mdrogalis: pong |
| 16:05 | akurilin | jstew, I create a ring uberjar and have runit keep it up. |
| 16:05 | jstew | Looks like an uberjar is the solution. |
| 16:05 | akurilin | (which I believe is just jetty) |
| 16:05 | jtoy | havenn: more like what hyPiRion did, i want to store a function into a database and call the function with different arguments |
| 16:06 | havenn | jtoy: aha, interesting |
| 16:06 | akurilin | callen, any significant advantages of http-kit over jetty, or more of a flavor thing? |
| 16:07 | jtoy | hyPiRion: is there an easier way to do that if I just have the string "+" and the args can be arbitrary from code? |
| 16:07 | jstew | callen, akurilin: Thanks. |
| 16:07 | callen | akurilin: realistically? not much. I just like async and speed ricing. |
| 16:07 | callen | akurilin: plus it forces me to write my apps async-clean from the start. Which I like in case I need it later, say for websockets. |
| 16:08 | callen | most people are fine with lein ring server |
| 16:08 | indigo | Hm, what's the general state of web development in Clojure anyway |
| 16:08 | callen | indigo: 'tis awsum. |
| 16:08 | indigo | I was thinking about writing a Clojure API-backed AngularJS app in it |
| 16:09 | hyPiRion | jtoy: if you just have function names (e.g. "+", "-" "assoc") then @(resolve (read-string "+")) should find the function |
| 16:09 | hyPiRion | not sure if that's idiomatic though |
| 16:09 | callen | indigo: fantastic idea. check out http://luminusweb.net/ |
| 16:09 | akurilin | callen, great, thanks for explaining the reasoning. |
| 16:10 | indigo | callen: I'll check it out :) |
| 16:10 | akurilin | Thoughts on ClojureQL compared to say Korma? |
| 16:10 | callen | don't use ClojureQL ;_; |
| 16:10 | callen | use Korma. It's named after awesome food. |
| 16:10 | jtoy | how would one eval it though? this doesnt work: |
| 16:11 | jtoy | ,(eval (read-string "+") 2 5 ) |
| 16:11 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 16:11 | jtoy | ,(eval (list (read-string "+") 2 5 )) |
| 16:11 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 16:11 | callen | fucking SANBOX |
| 16:13 | hyPiRion | jtoy: Two ways: ((eval (read-string "+")) 2 5) or ((resolve (read-string "+")) 2 5) |
| 16:14 | AimHere | ,(try (eval (read-string "(+ 2 5)") (catch Exception e (eval (read-string "(+ 2 5)"))) |
| 16:14 | clojurebot | AimHere: Gabh mo leithscéal? |
| 16:15 | jtoy | hyPiRion: ok, thanks, i assume i should use resolve |
| 16:15 | jtoy | ,((resolve (read-string "+")) 2 5) |
| 16:15 | clojurebot | 7 |
| 16:19 | borkdude | I just upgraded some packages among which nrepl, and now it seems smex is causing problems: post-command-hook (global-font-lock-mode-check-buffers): (void-function macroexp--backtrace) - has anyone an idea what to do about it? |
| 16:20 | teemu_f | I'm about to buy pragmatics programming clojure 2nd ed. Is the ebook version good or should I take the dead-tree as well? |
| 16:20 | SegFaultAX | teemu_f: Do yourself a favor and get an e-reader. :) |
| 16:21 | callen | teemu_f: http://clojurebook.com is usually the better choice. |
| 16:21 | teemu_f | SegFaultAX: my wife has a reader, lucky me :) |
| 16:21 | SegFaultAX | teemu_f: Then you never need to worry about toting around heavy dead trees again. |
| 16:22 | teemu_f | SegFaultAX: that's true. |
| 16:23 | nDuff | teemu_f: I'm actually not a fan of that book. |
| 16:23 | jtoy | thx |
| 16:24 | nDuff | teemu_f: ...the O'Reilley one (Clojure Programming) struck me as much less a waste-of-time. |
| 16:24 | callen | that's http://clojurebook.com |
| 16:25 | appendonly | it's a big book but it has lots of commentary (oral history, really) |
| 16:25 | teemu_f | so o'reilly would be better choice? |
| 16:25 | jstew | I really like Clojure Programming, too. It's what sparked my interest of clojure. It was on the shelf at my local library and I picked it up. |
| 16:26 | callen | jstew: helluva library. |
| 16:26 | callen | jstew: where are you that a library has that on the shelves? |
| 16:26 | teemu_f | well, the kindle edition of clojurebook.com isn't that expensive. maybe I'll pick that.. |
| 16:26 | nDuff | teemu_f: The two books that really stand out for me as excellent are Clojure Programming (O'Reilly) and Joy of Clojure. |
| 16:26 | callen | teemu_f: do it. |
| 16:27 | callen | JoC is a good follow-up to Clojure Programming |
| 16:27 | teemu_f | thanks for the tips! |
| 16:27 | nDuff | ...and if you wait for JoC, maybe the second edition will be ready. :) |
| 16:27 | Foxboron | i really regret buying JoC |
| 16:27 | callen | I will say this though, Clojure Programming is very much an O'Reilly book :) |
| 16:27 | jstew | callen: Grand Rapids, MI |
| 16:27 | Foxboron | Mainly because there is a new version comming out ._. |
| 16:27 | rasmusto | JoC MEAP is a good time |
| 16:27 | coventry | How does nrepl decide whether to dump output to the repl buffer or to the minibuffer? Just by size? It would be great if there were a way to make sure it always gets to the repl buffer. |
| 16:27 | jstew | A lot of the other books are dated, and the rest of them are "teach yourself x in 24 hours? |
| 16:32 | borkdude | ah I think I had an older version of emacs: 24.2.1 which probably wasn't supported by those packages… or something |
| 16:33 | borkdude | is there a major outage in the USA? Github down, http://emacsformacosx.com/ down? |
| 16:34 | rasmusto | borkdude: github not down |
| 16:35 | borkdude | rasmusto ah it's back up then |
| 16:35 | teemu_f | oh, it's back up. hooray |
| 16:35 | jstew | Github was down a little while ago. |
| 16:35 | rasmusto | works for me: wontfix |
| 16:35 | borkdude | github itself should be decentralized ;) |
| 16:36 | jstew | I cringe every time I update my melpa packages. Quite often something breaks. |
| 16:36 | borkdude | jstew yeah, I'm just going to upgrade Emacs.app and install emacs-live |
| 16:36 | technomancy | leiningen is mirrored at gitorious |
| 16:36 | technomancy | issues are hard to mirror though =\ |
| 16:37 | callen | gerd derm derterberse. |
| 16:37 | jstew | emacs-live is pretty nice. Only thing I don't like is that it's organized in a way that you're forced to create "packs" to install other elisps (unless I am mistaken) |
| 16:38 | technomancy | yeah, emacs-live way of reinventing their own notion of packages is nuts |
| 16:38 | borkdude | jstew I use it in conjuction with elpa |
| 16:38 | callen | I think emacs-live is why I stopped paying attention to sama. |
| 16:40 | callen | better that people learn to use Emacs. |
| 16:41 | technomancy | I would also not be opposed to people learning to extend emacs in a composable way though |
| 16:43 | technomancy | that said emacs-live would probably be a great fit for other performance artists |
| 16:45 | vijaykiran | I guess most of the people are not interested in writing their own .emacs.d and customize it to hell using composable awesomeness. In those cases, emacs-live is a good starting point |
| 16:46 | rasmusto | vijaykiran: emacs-live seemed like it was doing too much (especially from my emacs-noob pov) |
| 16:46 | technomancy | vijaykiran: the problem is you start out not caring, then you decide you care once you're already invested. |
| 16:47 | vijaykiran | rasmusto: indeed, that's why there are other opinionated startu-packs too |
| 16:47 | vijaykiran | startup* |
| 16:48 | vijaykiran | technomancy: what I meant was for people who are used to IntelliJ e.g. |
| 16:48 | jstew | My emacs config is years old, and I don't want to abandon the cruft |
| 16:49 | technomancy | clojurebot: emacs starter kit? |
| 16:49 | clojurebot | excusez-moi |
| 16:49 | jstew | technomancy: I've used your emacs starter kit in the past, and have enjoyed it. If you are in fact, the person who created that. |
| 16:50 | technomancy | jstew: yeah, that was my doing. I'm in the process of deprecating it. |
| 16:51 | technomancy | clojurebot: emacs starter kit is <reply>Starter kits encourage cargo-culting and usually impede deeper understanding. See https://github.com/technomancy/emacs-starter-kit/blob/v3/README.markdown for rationale as to why the Starter Kit is deprecated. |
| 16:51 | clojurebot | Ok. |
| 16:51 | borkdude | starter-kit-lisp and starter-kit, I used them both in my private Emacs, but it just died while upgrading, so I'm going for emacs-live now, just using my private pack from my other system |
| 16:51 | borkdude | tnx to vijaykiran for suggesting it |
| 16:53 | jstew | I started out with something like starter kit, but now it looks nothing like it. |
| 16:54 | technomancy | the starter kit made sense in 2008 when it was started because there was no package manager |
| 16:54 | borkdude | technomancy there wasn't? wow |
| 16:55 | technomancy | borkdude: people were installing all their elisp from emacswiki.org |
| 16:55 | vijaykiran | I find the package-manager still a bit "undependable" - If I accidentally click U and something magically breaks somehwere - I need to spend a couple of hours to get everything back to where it was |
| 16:56 | borkdude | vijaykiran that's where I got tonight |
| 16:57 | technomancy | vijaykiran: yeah, one of the package manager repos (MELPA) builds packages directly from git master branches, which is a terrible idea for most people |
| 16:57 | borkdude | and now emacsforosx.com is down, I'm lucky |
| 16:58 | technomancy | speaking of package managers ... =P |
| 16:58 | borkdude | fuck this, I'm going for counterclockwise :P |
| 16:58 | vijaykiran | borkdude: try brew with cocoa whatever .. that should essentially be the same |
| 16:59 | vijaykiran | borkdude: now you have "two problems" :) |
| 16:59 | vijaykiran | technomancy: yeah - the git based thing should be marked as "DONT_USE_THIS_STUFF.emacs_for_testing_only.packages-list.com" |
| 17:00 | augustl | is an atom containing a set a good way to implement a "queue" where I just want to put items into the set, and have N threads that just take any item from that set, removes it, and processes it? A queue without ordering, so to speak. |
| 17:00 | jstew | yeah, brew install emacs is the way to go. |
| 17:04 | llasram | augustl: Not really, because then you need a side-channel to both remove the item and yield the new item. Or the atom needs to hold e.g. a vector of the most-recently removed value and the set |
| 17:04 | llasram | augustl: A better choice would be an actual j.u.c.Queue |
| 17:07 | augustl | llasram: I'm only putting new items in for processing. Nothing is ever returned back into the set |
| 17:08 | augustl | other than more new items, that I get from analyzing some input data from another service |
| 17:09 | llasram | augustl: I meant that when you pop something from the queue, you need a way to yield both the popped value while updating the atom to refer to the set of remaining items. |
| 17:09 | llasram | That's not how atoms work in general, so you need to go through some contortions to make it fit |
| 17:09 | augustl | llasram: ah, I see |
| 17:09 | tbaldridge | llasram: you can use compare-and-set! with a loop |
| 17:10 | llasram | tbaldridge: I'd consider that a contortion :-) |
| 17:10 | augustl | not caring about the order is not important either, though :) |
| 17:10 | llasram | Yeah, then definitely -- just use a j.u.c.Queue |
| 17:11 | coventry | Anyone know what the goal of limiting core.async channels to 1024 puts is? |
| 17:11 | augustl | which one of them is good for a task like this? Never used either of them |
| 17:11 | tbaldridge | augustl: that's really what core.async is for |
| 17:11 | tbaldridge | coventry: yes, if you have that many pending puts, you're probably abusing the lib. Try using a buffer instead. |
| 17:12 | tbaldridge | coventry: one of the goals of core.async is to remove unbounded queues, pending puts/takes are unbounded queues |
| 17:12 | llasram | augustl: depends on your exact application, but for something without strict requirements, really any are fine. Probably can't go wrong with LinkedBlockingQueue |
| 17:13 | coventry | tbaldridge: Why is that a goal of core.async? Not arguing, just trying to understand. I was abusing it when I ran into the limitation. :-) |
| 17:14 | tbaldridge | coventry: all queues are bounded (by heap size). So with a buffer you can set a super huge buffer size (1 million items for instance) but you should think about that and make a design decision. |
| 17:15 | tbaldridge | coventry: so having a queue bounded only by heap introduces a odd coupling between the heap size and your queue size. |
| 17:16 | coventry | Yeah, better to fail sooner than that, I guess. Thanks. |
| 17:17 | borkdude | now brew installing the latest emacs cocoa... |
| 17:17 | tbaldridge | coventry: so 1024 was chosen (by Rich) as a number large enough that most people won't hit it, small enough that a badly written program will die fairly quickly |
| 17:18 | coventry | tbaldridge: Well, he protected me from myself. Thoughtful. |
| 17:26 | callen | 1024 puts that aren't taken? |
| 17:26 | coventry | Yeah, a channel blocks when there are 1024 puts in it. |
| 17:28 | coventry | (By default, and if you ask it to make a bigger channel, it tells you not to do that.) |
| 17:31 | callen | LOL |
| 17:31 | callen | okay so don't use core.async as a shim for a real queue. Got it. |
| 17:33 | coventry | Well, this was just an exercise for learning core.async, not a real application. From perspective, it served its purpose well. :-) |
| 17:35 | borkdude | cloning… 25% 390MB.. quite some stuff for the latest emacs cocoa... |
| 17:35 | jstew | borkdude: Yep. Lots and lots of code I would imagine. Seeing as emacs is so old. |
| 17:36 | technomancy | --depth=1 is your friend when cloning emacs =) |
| 17:36 | danielszmulewicz | FYI, the lein daemon plugin did the trick to daemonize a clojure process on a System V init production system |
| 17:37 | jstew | lein does everything. *hugs lein* |
| 17:37 | callen | technomancy: they love your milkshakes. |
| 17:37 | technomancy | the secret is using real vanilla bean |
| 17:37 | technomancy | and love, of course. |
| 17:38 | s4muel | I had never read the actual short story, that was one of the top benefits of lein for me :) |
| 17:38 | Apage43 | I've only seen the MacGyver episode |
| 17:40 | technomancy | oh man |
| 17:40 | technomancy | grenchman should have been called "Trumbo" |
| 17:40 | technomancy | I can't believe I missed that |
| 17:40 | borkdude | technomancy thanks for depth=1… started over =) |
| 17:41 | technomancy | http://macgyver.wikia.com/wiki/Trumbo%27s_World |
| 17:42 | technomancy | I love how the MacGyver wiki has hyperlinks for "rope", "match", and "pipe", etc |
| 17:42 | callen | technomancy: whoa that's brilliant |
| 17:43 | callen | it never occurred to me that there might be a MacGyver episode like "Leiningen and the Ants" :) |
| 17:44 | technomancy | callen: a few other early MacGyver episodes spliced in a bunch of footage from films the studio had rights too |
| 17:44 | technomancy | to |
| 17:44 | technomancy | there's one that consists of 60% scenes from the original Italian Job |
| 17:45 | callen | were they just doing it on a dare or what? |
| 17:45 | technomancy | I feel like it was probably a budget thing |
| 17:46 | technomancy | https://en.wikipedia.org/wiki/Wikipedia%3AArticles_for_deletion%2FList_of_problems_solved_by_MacGyver_(3rd_nomination) <- sad face |
| 17:47 | rasmusto | technomancy: MacGyver: "Well, if the water doesn't stop them, I bet a good fire'd get their attention!" |
| 17:48 | borkdude | I still know the MacGyver tune, used to play it on piano when I was young ;) |
| 17:48 | borkdude | younger ;) |
| 17:49 | borkdude | muhoo drones come close |
| 17:49 | danielszmulewicz | borkdude: you're using brew or you're cloning from repo? |
| 17:50 | borkdude | danielszmulewicz I'm using brew to install from git |
| 17:50 | danielszmulewicz | how did you specify the shallow clone, depth=1? |
| 17:51 | technomancy | wow, brew initiates a full clone just to install emacs? yikes. |
| 17:51 | callen | technomancy: homebrew is the definitive amateur hour OSS. |
| 17:51 | borkdude | danielszmulewicz I did: brew install emacs --HEAD --use-git-head --cocoa --srgb --depth=1 |
| 17:52 | danielszmulewicz | borkdude: cool |
| 17:53 | muhoo | brew reminds me of the days when i used to run slowlaris on a pc. after a few weeks of realizing i was basically building an entire linux distro inside of /usr/local (with no package management, mind you), i said fuck it and installed debian on the box, and never looked back. |
| 17:54 | muhoo | actually, i tried running macos for a brief while some years ago too, and after a few DAYS realized i was building a whole linux distro inside of /usr/local, and made the same decsion: wipe the box, install linux. |
| 17:54 | rasmusto | muhoo: I got comfortable? with gentoo in school, and went to gentoo prefix... You can go too far in the other direction too |
| 17:55 | muhoo | gentoo seemed like madness to me from the get-go. been a debian guy for a decade (though i also use variants like ubuntu or mint as needed to) |
| 17:55 | borkdude | I tried gentoo also. Took me 3 days to get my soundcard working, but it was worth all the compiling. |
| 17:55 | muhoo | s/to/too/ |
| 17:57 | technomancy | muhoo: you're cleverer than I was; my path was "compile some stuff; it doesn't work; wipe /opt; compile some stuff; it doesn't work; wipe /opt; compile some stuff; it doesn't work; switch to debian" |
| 17:57 | danielszmulewicz | borkdude: if you're going to use the new tls that ships with emacs 24 you need --with-gnutls |
| 17:57 | rasmusto | muhoo: ^ s/to/too/g s/too/to/ |
| 17:58 | danielszmulewicz | borkdude: useful for fetching mail from gmail |
| 17:58 | muhoo | technomancy: it's amazing how long it takes for things to really mature. i mean, i bought a brand new laptop the day it shipped in october, and had it running linux and set up more or less perfectly within an hour or two. could never have imagined that happening a decade ago |
| 17:59 | supersym | gentoo is cool except I kept breaking it... Arch is so much more stable + wiki = awesome |
| 17:59 | technomancy | muhoo: well, without broadband it would be difficult to do in an hour =) |
| 18:00 | muhoo | technomancy: i had the usb stick already downloaded, but yeah. |
| 18:00 | callen | I feel like I'm not a real clojurian because I only use juxt to one-line my bindings. |
| 18:00 | borkdude | danielszmulewicz ok thanks |
| 18:01 | gleag | muhoo: I got a C-64 when I was six years old and I was running Commodore BASIC a few seconds after I plugged it in and turned it on. :-) |
| 18:01 | technomancy | callen: part of the joy of juxt is that it's not something you get to use every day |
| 18:01 | technomancy | it's like fine china |
| 18:02 | callen | [uuid action entity] ((juxt :uuid :action :entity) doc) <-- in a let binding. That's all I've got. So weak. :( |
| 18:02 | rasmusto | juxt-ing keywords doesn't count, right? |
| 18:02 | callen | that's my point. that's why I feel it doesn't count. |
| 18:03 | rasmusto | callen: destructuring would almost be better, since you don't have to keep the sexpr order |
| 18:04 | callen | rasmusto: I think you're right. *pokes at it* |
| 18:04 | rasmusto | [{:keys [uuid action entity]} doc], yeah? |
| 18:04 | technomancy | I feel like that moves more things into compile time, but I'm not sure |
| 18:07 | bja | I got to use juxt today. I was happy. I had a bunch of various functions that take the same input and return maps that get merged together. Juxt to the rescue! |
| 18:11 | dobry-den | Does anyone use a git gui that can handle nonstandard .git locations? |
| 18:13 | Apage43 | nonstandard .git locations, eh? |
| 18:14 | dobry-den | Apage43: like `git --git-dir=".dotgit" status` |
| 18:15 | dobry-den | i was inspired to put my home directory under version control. |
| 18:15 | Apage43 | i expect some can work with a bare repo directly |
| 18:15 | Apage43 | but that is a bit odd |
| 18:15 | Apage43 | ahh |
| 18:16 | Apage43 | that sounds problematic |
| 18:23 | rasmusto | dobry-den: ahh, make a ~/dotfiles w/ a standard .git directory and use symlinks |
| 18:26 | TimMc | dobry-den: What's wrong with just using ~/.git ? |
| 18:27 | TimMc | (Haven't tried it myself; I use the symlinks approach.) |
| 18:32 | dobry-den | TimMc: since it's my home directory, every subdirectory looks up and sees .git. |
| 18:33 | _scape | how does this interop work? void getIndices(short[] indices) where indices actually gets set |
| 18:33 | technomancy | yeah, not a fan of that approach. a negated .gitignore means you miss a lot of stuff. |
| 18:34 | dobry-den | what i like about maintaining a home directory .gitignore blacklist is that new dotfiles show up and i have to either add them or ignore them |
| 18:35 | _scape | do I use set! in this situation? |
| 18:37 | callen | rasmusto: yep, solid. Thanks for the reminder that {:keys []} is a thing :) |
| 18:37 | dobry-den | _scape: when you call it normally (.getIndices thing _) is it not staying set or something? |
| 18:37 | rasmusto | dobry-den: doesn't that get noisy? |
| 18:38 | rasmusto | callen: no problem. Vector destructuring + juxt is more powerful if you aren't just pulling out kvps |
| 18:38 | rasmusto | (to my untrained eye) |
| 18:38 | clojurebot | I don't understand. |
| 18:38 | callen | rasmusto: that's why I automatically went to it. |
| 18:38 | callen | more generic and near-at-hand. |
| 18:38 | callen | not "better" though. |
| 18:39 | rasmusto | I guess readability is "better"? |
| 18:39 | _scape | I never have done this sort of interop, where you set a variable within the args of the method call, from clojure |
| 18:39 | callen | I think the destruct version reads better to the trained eye. |
| 18:39 | rasmusto | callen: right, :keys is a little black-magic |
| 18:40 | _scape | (.getMaxIndices (first (.meshes model)) ) is an almost identical call, but actually returns an int |
| 18:40 | _scape | no arg to pass either |
| 18:40 | dobry-den | rasmusto: i've only started playing with it today but i dont think it would be so. it would be noisy if i just dumped everything into ~ though. |
| 18:41 | rasmusto | dobry-den: ah, we must use home directories differently, mine is very flat until I decide to make a ~/repos |
| 18:42 | callen | I use ~/code |
| 18:42 | callen | everything goes in there. |
| 18:42 | callen | or ~/.emacs.d |
| 18:42 | rasmusto | dobry-den: here's an example of it not working: ~/.emacs.d on a system without emacs, how do you delete it without git throwing up? If you used ~/dotfiles/emacs.d and a symlink you can just drop the link |
| 18:43 | dobry-den | rasmusto: i imagined not caring about .emacs.d |
| 18:44 | rasmusto | dobry-den: oh, what types of things are you controlling with git in ~/ then? |
| 18:44 | dobry-den | i don't mind even a dozen extraneous unused dirs/files in ~/ since the real win is that it's consistent and inventorized. |
| 18:45 | dobry-den | rasmusto: .emacs.d, .vimrc, .slate, .config |
| 18:46 | dobry-den | i'll try out symlinks |
| 18:46 | rasmusto | dobry-den: okay, that's what I thought. I guess if you had an emacs.d that only worked with newer versions and emacs wouldn't work at all, it might get confusing |
| 18:47 | _scape | so basically I'm not sure what to type since I'm using an argument that's supposed to get set during the call to the method |
| 18:47 | callen | http://adambard.com/blog/acceptable-error-handling-in-clojure/ |
| 18:49 | dobry-den | _scape: i dont quite understand question. why cant you (.getIndices model new-indices) where model's indices are mutated |
| 18:50 | dobry-den | rasmusto: oh, yeah that's a good point. i don't happen to use any software that differs from what i use on my laptop. |
| 18:50 | dobry-den | rasmusto: in particular, i dont ever see myself using terminal emacs |
| 18:52 | rasmusto | dobry-den: I have a diverse collection of machines ;) |
| 18:52 | _scape | dobry-den: I get an error like: java.lang.ClassCastException: Cannot cast clojure.lang.Var$Unbound to [S |
| 18:53 | _scape | I don't understand how I'd mutate new-indices from the call, I thought you had to use def or set! to change something |
| 18:54 | _scape | unless I make new-indices a function? hmm |
| 18:55 | dobry-den | _scape: why is new-indices unbound in that error? |
| 18:57 | _scape | how would I declare it? i'm terribly confused :-\ |
| 18:58 | _scape | defining a function to the name works in regards to it not being unbound, but still receive a typecast error [S which I don't know what that means |
| 18:58 | dobry-den | is that array of strings? |
| 18:58 | `cbp | [S means String array |
| 18:59 | jkkramer | _scape: paste? |
| 18:59 | _scape | this is the java side: public void getIndices(short[] indices) so i'm guessing a short |
| 18:59 | _scape | (let [model (load-asset AM ["resources/planet.obj"] true)] |
| 18:59 | _scape | (.getIndices (first (.meshes model)) new-indices)) |
| 18:59 | _scape | I am missing something obvious about this I think |
| 18:59 | `cbp | or short array i guess :) |
| 19:00 | _scape | I tried declare and def for new-indices |
| 19:00 | jkkramer | _scape: https://www.refheap.com/ |
| 19:00 | dobry-den | if new-indices is mutated there, then it is still mutated if you refer to it on the next line |
| 19:01 | `cbp | (defn new-indices (short-array len)) |
| 19:01 | `cbp | def* |
| 19:01 | _scape | thanks let me see |
| 19:03 | dobry-den | _scape: (let [new-idx (short-array _)] (.getIndices ... new-idx) new-idx) will return mutated new-idx |
| 19:03 | _scape | yes this is working |
| 19:03 | _scape | thank you :) |
| 19:04 | dobry-den | rasmusto: haha yeah, that's it. in case it's not obvious, im a sysadmin noob with modest needs. im just trying to find the easiest way to sync up my osx laptop with my 2 linodes |
| 19:04 | _scape | I didn't realize setting it up as a short-array first was imperative |
| 19:05 | dobry-den | _scape: well, from the error code it seems like you possibly just had (def new-indices) and then tried (.getIndices ... new-indices). so you were passing in Var$unbound |
| 19:06 | rasmusto | dobry-den: ~/dotfiles repo, put your dotfiles/directories without the leading '.' in the root so they can just be symlinked out flat with a quick rename to make them hidden |
| 19:06 | rasmusto | dobry-den: for example https://github.com/rasmusto/dotfiles |
| 19:07 | dobry-den | cool, then ill just make a Makefile to create the links |
| 19:07 | rasmusto | dobry-den: pay special attention to the shameful empty init.el with (evil-mode 1) in it |
| 19:08 | dobry-den | that's how i roll too |
| 19:12 | mheld | hey y'all |
| 19:12 | callen | mheld: howdy. |
| 19:12 | callen | just wrote a macro because I'm too lazy to catch exceptions. #winning |
| 19:15 | mheld | aww yeah, realtime kmeans clustering |
| 19:15 | mheld | life is good |
| 19:15 | _scape | lol |
| 19:18 | `cbp | hmm is #{true false} the only boolean? kind of check? |
| 19:23 | callen | `cbp: wat |
| 19:24 | `cbp | callen: I just wanted a boolean? predicate which doesn't seem to exist so I'm just using #{true false} |
| 19:25 | callen | ohhhhh |
| 19:25 | amalloy | `cbp: that one doesn't work very well as a predicate :P |
| 19:26 | amalloy | (boolean? false) => false |
| 19:26 | `cbp | amalloy: I just noticed ahha |
| 19:26 | callen | lol. |
| 19:26 | rasmusto | amalloy: haha |
| 19:39 | hyPiRion | ,(map (some-fn true? false?) [true false nil 1 :key]) |
| 19:39 | clojurebot | (true true false false false) |
| 19:39 | callen | the best foibles are the ones others can share in :) |
| 19:40 | dobry-den | reminds me of when i was trying to send 'nil' down core.async channels |
| 20:28 | muhoo | i use identity as a boolean predicate sometimes |
| 20:32 | dbasch | I just adapted some hideous Java code to extract the body of email messages, and could use some feedback. Does it look understandable / idiomatic? https://www.refheap.com/18755 |
| 20:36 | nDuff | dbasch: (let [result (do-something)] result) is a bit more verbose than need be. |
| 20:36 | dbasch | nDuff: yes, I wanted to show the three exit points at a glance |
| 20:36 | nDuff | dbasch: several pieces of get-text feel like they might make sense to extract into smaller functions. |
| 20:37 | dbasch | thanks, I'll refactor it a bit |
| 20:37 | nDuff | identity might be a little more conventional than (complement nil?) for filtering. |
| 20:41 | amalloy | nDuff: welllll, (filter (complement nil?) (map f coll)) is (keep f coll) |
| 20:41 | nDuff | Heh. Just so. |
| 20:42 | noonian | ,(doc keep) |
| 20:42 | clojurebot | "([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects." |
| 20:42 | nDuff | dbasch: see amalloy's point above. |
| 20:42 | noonian | huh, thats cool |
| 20:42 | dbasch | good point |
| 20:43 | hyPiRion | multiple nested ifs like that is usually better conveyed through cond |
| 20:44 | hyPiRion | But seeing that you're dispatching on mime type here, perhaps a multimethod may be a better fit here. |
| 21:06 | l1x | hi |
| 21:07 | l1x | what does #^SomeJavaClass do in clojure? |
| 21:07 | l1x | i could not google it :) |
| 21:08 | dbasch | l1x: type hinting http://clojure.org/java_interop#Java%20Interop-Type%20Hints |
| 21:09 | dbasch | l1x: also http://stackoverflow.com/questions/4245540/clojure-type-hints-syntax |
| 21:10 | l1x | thanks! i did not know that #^ was used |
| 21:10 | l1x | i thought it does something special on the top of ^ |
| 21:53 | cjfrisz | heeeyyyyyyyyyy everybody |
| 21:59 | bbloom | cjfrisz: nobody wants to talk to you b/c you leave @author tags in your code |
| 21:59 | cjfrisz | bbloom: I doubt that |
| 21:59 | bbloom | cjfrisz: real answer: GTAV |
| 21:59 | cjfrisz | Do you mean function/procedure/method-level @author tags? |
| 22:00 | cjfrisz | Because that is dumb |
| 22:00 | bbloom | cjfrisz: file level |
| 22:01 | cjfrisz | Oh pfft, whatever |
| 22:01 | cjfrisz | Why is it a big deal? |
| 22:01 | cjfrisz | Seriously I wrote a macro years ago that just pops information into the top of the file |
| 22:01 | bbloom | the big deal is… why?!?! |
| 22:01 | cjfrisz | Yes I know I wrote all my code files, but the other info is useful at a glance |
| 22:01 | bbloom | what other info? |
| 22:02 | bbloom | gah whatever, i was just bitching on twitter b/c i saw some mega out of date file authors tags. where the author hadn't touched that file in a decade & the file was like 5% his code. so who do i actually email? well, i check git blame :-P anyway. gg cya |
| 22:12 | chord | callen: have you made the initial commit of starcraft clone implemented with clojure? |
| 22:23 | l1x | is there a good pattern to do something like (println "The size of the file is: " size) in clojure? |
| 22:25 | l1x | i guess i can just use (str (size)) |
| 22:26 | TimMc | l1x: If size is a number, (size) will error out. |
| 22:26 | TimMc | l1x: And println will stringify it anyhow. |
| 22:27 | l1x | TimMc: size, size is a number, this is why i just came up with (str (size)) but i am wondering if there is a better pattern |
| 22:28 | TimMc | l1x: I don't thilnk you read my messages. |
| 22:29 | l1x | TimMc: i am not sure what you are referring to |
| 22:30 | chord | starcraft clone in clojure? |
| 22:30 | TEttinger | ,(let [size 4] (str (size))) |
| 22:30 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 22:30 | TEttinger | ,(let [size 4] (str size)) ;; this works |
| 22:30 | clojurebot | "4" |
| 22:31 | l1x | yeah sorry, my bad, of course i was talking about (str size) |
| 22:31 | l1x | i was just wondering if there is a difference between (println "text" number) and (println "text" (str number)) |
| 22:32 | TEttinger | don't think so |
| 22:32 | l1x | thanks |
| 22:34 | TEttinger | l1x, there's also format, which is handy when you need the number turned into a different representation of string: ##(println "text " (format "%X" 255)) |
| 22:34 | lazybot | ⇒ text FF nil |
| 22:35 | TEttinger | %X being capital hex digits |
| 23:11 | l1x | https://gist.github.com/l1x/6603783 throws java.lang.IndexOutOfBoundsException |
| 23:11 | l1x | what i am not taking into consideration? |
| 23:15 | l1x | i am just stupid, the offset is not for the read it is for the array offset in the buffer |
| 23:29 | echo-area | `if-not' is weird |
| 23:30 | technomancy | echo-area: I get the feeling the bar for inclusion in clojure.core is a lot higher than it used to be =) |
| 23:30 | technomancy | I get how if-let is nice in that it lets you avoid a layer of nesting, but if-not is just weird |
| 23:31 | gfredericks | ,(doc not-empty) |
| 23:31 | clojurebot | "([coll]); If coll is empty, returns nil, else coll" |
| 23:31 | arrdem | ,(when [:foo :bar]) |
| 23:31 | clojurebot | nil |
| 23:31 | echo-area | technomancy: Yes, and (if-not pred then else) just makes me think slower |
| 23:32 | technomancy | echo-area: presumably you'd typically use the 2-arg version |
| 23:32 | arrdem | when-not would almost make sense... |
| 23:32 | echo-area | Well for that I'd use when-not |
| 23:32 | arrdem | ,(doc when-not) |
| 23:32 | clojurebot | "([test & body]); Evaluates test. If logical false, evaluates body in an implicit do." |
| 23:33 | arrdem | wow that's a thing |
| 23:33 | technomancy | echo-area: yes, a common mistake =\ |