0:19 python476: turns out after 1 hour, java throws a ThreadDeath exception.
4:04 roelof: Hello, I have to put a initial value here (reduce (fn [counter] (inc counter)) [1,2,3]) but where do I put it ?
4:11 not only do you get the docstring, but quite a few examples answering common questions as well as common gotchas
4:12 roelof: expez: thanks, I have read them and as far as I understand it , it must be this : (reduce (fn [counter] (inc counter)) 0 [1,2,3])
4:13 but then I see this error message : clojure.lang.ArityException: Wrong number of args (2) passed to: core/eval6230/fn--6231
4:13 expez: roelof: you are right, that's the right place ot put the seed value, but that's not related to the error you're getting
4:13 roelof: the function passed to reduced must take two arguments, yours only takes one
4:14 ,(reduce (fn [counter _] (inc counter)) 0 [1,2,3])
4:14 roelof: thanks I will hit the book why counter needs two arguments instead of 1
4:14 clojurebot: 3
4:15 expez: roelof: reduce reduces multiple values two a single value
4:16 roelof: to do that the reducing argument considers two things: the accumulated value so far, and the value of the next element in the input sequence
4:16 the reducing function*
4:17 ,(reduce (fn [accumulator n] (+ accumulator n)) [1 2 3 4])
4:17 clojurebot: 10
4:17 expez: the final value is the value in the accumulator
4:17 once all inputs have been consumed
4:18 roelof: thanks for the explanation
4:19 finnaly that challenge on 4clojure solved. Can this solution be improved : (fn [list] (reduce (fn [counter _] (inc counter)) 0 list))
4:20 expez: I take it the exercise is to re-implement count?
4:20 roelof: expez: yes, I try to solve that exercise
4:22 expez: I think using reduce is a fine choice
4:23 roelof: expez: so the solution cannot be shorter ?
4:24 expez: ,(reduce #(+ %1 %2) (range 10))
4:25 clojurebot: 45
4:26 expez: I thought this might work: (reduce #(inc %1) 0 (range 10)) but it doesn't :p
4:27 so no, I don't think you can make it much shorter
4:30 roelof: expez: thanks, now the next challenge, make Fibonacci Sequence. so again a nice one to think how to solve this. First thought something like map
4:31 luma: i guess you could (reduce + (map (constantly 1) list))
4:34 expez: (while true (future 1)) is fine, right? I'm not leaking any resources?
4:40 amalloy: if you don't mind forkbombing yourself
4:40 this spins up threads as fast as your OS is capable of
4:41 expez: amalloy: obv that doesn't happen in practice, I tested this to find out if I leaked memory when I didn't use future-cancel or ever retrieve the value of the un-interesting futures.
4:42 running the code above at the repl seems to only produce a cpu load, not a memory load
4:43 amalloy: you don't leak anything permanent, but whether your thread demand outpaces supply is a matter of luck and/or system power
4:44 expez: great, thanks
6:05 visof: hi guys
6:06 how can i convert this haskell (fmap (fmap f) z) to clojure? (fmap #(fmap f %) z) ?
6:08 expez: ,(map (partial map inc) [[1 2] [3 4]])
6:08 clojurebot: ((2 3) (4 5))
6:08 expez: visof: ^
6:09 Is there a general version of subvec which works seqs?
6:12 djcoin: visof: in which order are your argument?
9:04 ob-sed: hey this gu in ##hardware is complaining clojure uses up too much ram
9:13 i told him to shut his mouth the hell up
9:13 his name is crocket
9:15 oddcully: ><((((*>
9:19 taylanub: ob-sed: that doesn't sound like a very friendly thing to do
9:19 ob-sed: taylanub: yeah but he's been saying the same thing for an hour, like a broken record, how:
9:19 "<crocket> I just wanted to say that "RAM is cheap" is not an excuse for thinking that it's ok to consume 160MB for a daemon whose only task is to send an HTTP request regularly."
9:21 oddcully: and then you /ignore:d it, right?
9:25 crocket: RAM is not so cheap.
9:25 taylanub: do we have a !mods command? shall I invoke it?
9:26 crocket: If RAM was cheap, it should be ok for every small linux daemon or every kernel driver to consume 160-250MB.
9:26 Then, linux won't fit in 16GB RAM.
9:26 taylanub: ob-sed: crocket: get a room and leave the channel alone
9:27 (I'm new here but I assume this is common sense.)
9:27 crocket: taylanub, you from ##hardware?
9:30 I came here to say it because some people in this channel said as if every program could afford to consume hundreds of MB. This is physically impossible.
9:40 Bronsa: ob-sed: clojure doesn't fit all usecases, I wouldn't use it in memory-constrained embedded devices.
9:40 also please don't bring issues from other channels here
9:40 wasamasa: some people are having a hard time just accepting that java was made for running a single application on a server
9:44 ob-sed: generally, the channel to take such things to is #freenode