00:00
some14u has joined #ruby
00:02
markong has quit [Ping timeout: 256 seconds]
00:04
seydar has quit [Ping timeout: 272 seconds]
00:09
seydar has joined #ruby
00:13
Sheilong has joined #ruby
00:14
seydar has quit [Ping timeout: 272 seconds]
00:16
TCZ has joined #ruby
00:18
dviola has quit [Ping timeout: 246 seconds]
00:20
seydar has joined #ruby
00:21
dviola has joined #ruby
00:24
seydar has quit [Ping timeout: 246 seconds]
00:25
o|||||o has quit [Ping timeout: 248 seconds]
00:30
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
00:34
dviola has quit [Ping timeout: 268 seconds]
00:35
dviola has joined #ruby
00:40
dviola has quit [Ping timeout: 246 seconds]
00:41
dviola has joined #ruby
00:43
dviola has quit [Max SendQ exceeded]
00:47
dviola has joined #ruby
01:18
dviola has quit [Ping timeout: 246 seconds]
01:21
dviola has joined #ruby
01:26
dviola has quit [Ping timeout: 248 seconds]
01:27
dviola has joined #ruby
01:33
dviola has quit [Remote host closed the connection]
01:34
dviola has joined #ruby
01:39
dviola has quit [Ping timeout: 256 seconds]
01:42
dviola has joined #ruby
01:46
favadi has joined #ruby
01:48
favadi has quit [Client Quit]
01:51
yossarian has quit [Ping timeout: 272 seconds]
01:52
yossarian has joined #ruby
01:52
yossarian has quit [Changing host]
01:52
yossarian has joined #ruby
01:57
dviola has quit [Ping timeout: 248 seconds]
01:59
TCZ has quit [Quit: Leaving]
02:02
dviola has joined #ruby
02:07
dviola has quit [Remote host closed the connection]
02:08
dviola has joined #ruby
02:13
dviola has quit [Ping timeout: 268 seconds]
02:21
seydar has joined #ruby
02:22
duds- has joined #ruby
02:22
dviola has joined #ruby
02:26
seydar has quit [Ping timeout: 246 seconds]
02:28
dviola has quit [Ping timeout: 246 seconds]
02:31
seydar has joined #ruby
02:34
Thanzex has quit [Read error: Connection reset by peer]
02:34
Thanzex has joined #ruby
02:36
dviola has joined #ruby
02:36
seydar has quit [Ping timeout: 268 seconds]
02:36
dviola has quit [Max SendQ exceeded]
02:37
dviola has joined #ruby
02:40
donofrio has joined #ruby
02:42
seydar has joined #ruby
02:46
seydar has quit [Ping timeout: 248 seconds]
02:52
seydar has joined #ruby
02:56
seydar has quit [Ping timeout: 248 seconds]
03:02
justOkay is now known as justChili
03:02
seydar has joined #ruby
03:06
seydar has quit [Ping timeout: 246 seconds]
03:12
seydar has joined #ruby
03:17
seydar has quit [Ping timeout: 246 seconds]
03:21
dviola has quit [Ping timeout: 248 seconds]
03:23
seydar has joined #ruby
03:23
seydar has quit [Read error: Connection reset by peer]
03:24
dviola has joined #ruby
03:37
dviola has quit [Ping timeout: 246 seconds]
03:40
dviola has joined #ruby
03:43
dviola has quit [Max SendQ exceeded]
03:54
dviola has joined #ruby
04:17
dviola has quit [Ping timeout: 256 seconds]
04:18
dviola has joined #ruby
04:24
dviola has quit [Ping timeout: 248 seconds]
04:24
donofrio has quit [Ping timeout: 268 seconds]
04:25
dviola has joined #ruby
04:58
goepsilongo has quit [Quit: Konversation terminated!]
05:08
dviola has quit [Ping timeout: 246 seconds]
05:10
dviola has joined #ruby
05:11
Hess has quit [Quit: Ping timeout (120 seconds)]
05:11
Hess has joined #ruby
05:15
dviola has quit [Ping timeout: 246 seconds]
05:17
dviola has joined #ruby
05:22
Sheilong has quit []
05:23
seydar has joined #ruby
05:26
seydar has quit [Read error: Connection reset by peer]
05:28
dviola has quit [Ping timeout: 246 seconds]
05:30
favadi has joined #ruby
05:32
agrosant has joined #ruby
05:34
dviola has joined #ruby
05:36
seydar has joined #ruby
05:41
seydar has quit [Ping timeout: 248 seconds]
05:41
dviola has quit [Ping timeout: 248 seconds]
05:44
dviola has joined #ruby
05:45
dviola has quit [Max SendQ exceeded]
05:51
dviola has joined #ruby
05:57
seydar has joined #ruby
05:58
dviola has quit [Ping timeout: 248 seconds]
05:59
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
06:01
dionysus69 has joined #ruby
06:01
seydar has quit [Ping timeout: 256 seconds]
06:07
seydar has joined #ruby
06:07
favadi has joined #ruby
06:07
dviola has joined #ruby
06:08
oxfuxxx has joined #ruby
06:12
seydar has quit [Ping timeout: 248 seconds]
06:12
_ht has joined #ruby
06:13
dviola has quit [Max SendQ exceeded]
06:17
seydar has joined #ruby
06:19
dviola has joined #ruby
06:21
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
06:22
seydar has quit [Ping timeout: 248 seconds]
06:24
dviola has quit [Max SendQ exceeded]
06:27
seydar has joined #ruby
06:32
seydar has quit [Ping timeout: 248 seconds]
06:36
favadi has joined #ruby
06:37
oxfuxxx has quit [Ping timeout: 248 seconds]
06:38
seydar has joined #ruby
06:38
favadi has quit [Client Quit]
06:40
dviola has joined #ruby
06:42
dviola has quit [Changing host]
06:42
dviola has joined #ruby
06:42
dviola has quit [Client Quit]
06:43
seydar has quit [Ping timeout: 248 seconds]
06:43
dviola has joined #ruby
06:44
dviola has quit [Max SendQ exceeded]
06:46
dviola has joined #ruby
06:47
dviola has quit [Max SendQ exceeded]
06:55
u0_a151 has joined #ruby
06:55
Thanzex has quit [Read error: Connection reset by peer]
06:55
Thanzex has joined #ruby
06:56
o|||||o has joined #ruby
06:56
u0_a151 has quit [Client Quit]
07:10
Tempesta has quit [Ping timeout: 265 seconds]
07:15
seydar has joined #ruby
07:17
Tempesta has joined #ruby
07:20
seydar has quit [Ping timeout: 246 seconds]
07:21
ur5us_ has joined #ruby
07:26
seydar has joined #ruby
07:31
seydar has quit [Ping timeout: 256 seconds]
07:36
seydar has joined #ruby
07:39
oxfuxxx has joined #ruby
07:40
dionysus69 has quit [Ping timeout: 256 seconds]
07:42
seydar has quit [Ping timeout: 268 seconds]
07:47
seydar has joined #ruby
07:51
o|||||o has quit [Ping timeout: 248 seconds]
07:52
seydar has quit [Ping timeout: 256 seconds]
07:56
ur5us_ has quit [Quit: Leaving]
07:57
seydar has joined #ruby
08:02
seydar has quit [Ping timeout: 246 seconds]
08:02
ur5us has joined #ruby
08:02
favadi has joined #ruby
08:02
favadi has quit [Client Quit]
08:07
seydar has joined #ruby
08:12
seydar has quit [Ping timeout: 246 seconds]
08:27
seydar has joined #ruby
08:31
seydar has quit [Ping timeout: 256 seconds]
08:47
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
09:00
justChili has quit [Remote host closed the connection]
09:01
justChili has joined #ruby
09:12
georgemp_ is now known as georgemp
09:26
ur5us has quit [Ping timeout: 268 seconds]
09:26
jhass has quit [Ping timeout: 250 seconds]
09:26
oxfuxxx has joined #ruby
09:29
jhass has joined #ruby
09:46
some14u has joined #ruby
09:51
teclator has joined #ruby
10:05
ssh073 has joined #ruby
10:07
ssh073 has quit [Client Quit]
10:08
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
10:16
ssh073 has joined #ruby
10:25
fercell has quit [Ping timeout: 246 seconds]
10:28
seydar has joined #ruby
10:30
roadie has joined #ruby
10:30
markong has joined #ruby
10:35
donofrio has joined #ruby
10:36
donofrio has quit [Remote host closed the connection]
10:37
seydar has quit [Ping timeout: 272 seconds]
10:52
donofrio has joined #ruby
10:52
seydar has joined #ruby
10:57
seydar has quit [Ping timeout: 268 seconds]
10:58
___nick___ has joined #ruby
10:59
___nick___ has quit [Client Quit]
11:00
seydar has joined #ruby
11:01
___nick___ has joined #ruby
11:02
___nick___ has quit [Client Quit]
11:04
___nick___ has joined #ruby
11:08
dionysus69 has joined #ruby
11:14
seydar has quit [Ping timeout: 246 seconds]
11:20
seydar has joined #ruby
11:25
seydar has quit [Ping timeout: 268 seconds]
11:40
some14u has joined #ruby
11:45
donofrio has quit [Ping timeout: 268 seconds]
11:48
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
11:55
dionysus69 has quit [Ping timeout: 256 seconds]
11:57
seydar has joined #ruby
11:58
o|||||o has joined #ruby
11:58
donofrio has joined #ruby
12:02
seydar has quit [Ping timeout: 246 seconds]
12:15
goepsilongo has joined #ruby
12:24
donofrio has quit [Ping timeout: 268 seconds]
12:25
Thanzex has quit [Read error: Connection reset by peer]
12:26
Thanzex has joined #ruby
12:36
Sheilong has joined #ruby
12:36
seydar has joined #ruby
12:36
some14u has joined #ruby
12:43
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
12:44
seydar has quit [Ping timeout: 246 seconds]
12:49
seydar has joined #ruby
12:54
seydar has quit [Ping timeout: 272 seconds]
12:59
some14u has joined #ruby
13:06
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
13:08
some14u has joined #ruby
13:09
seydar has joined #ruby
13:10
TCZ has joined #ruby
13:11
donofrio has joined #ruby
13:14
seydar has quit [Ping timeout: 246 seconds]
13:20
seydar has joined #ruby
13:20
factor has joined #ruby
13:25
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
13:41
favadi has joined #ruby
13:50
dionysus69 has joined #ruby
13:51
some14u has joined #ruby
13:51
roadie has quit [Ping timeout: 248 seconds]
13:54
some14u has quit [Client Quit]
13:55
o|||||o has quit [Ping timeout: 246 seconds]
13:57
hololeap has quit [Remote host closed the connection]
14:10
some14u has joined #ruby
14:17
roadie has joined #ruby
14:21
seydar has quit [Ping timeout: 246 seconds]
14:29
Coop has joined #ruby
14:30
roadie has quit [Ping timeout: 248 seconds]
14:34
TCZ has quit [Quit: Leaving]
14:37
seydar has joined #ruby
14:42
seydar has quit [Ping timeout: 272 seconds]
14:47
seydar has joined #ruby
14:52
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
14:52
seydar has quit [Ping timeout: 248 seconds]
14:56
roadie has joined #ruby
14:57
seydar has joined #ruby
15:01
roadie has quit [Ping timeout: 260 seconds]
15:02
seydar has quit [Ping timeout: 248 seconds]
15:07
<
ox1eef >
:: def foo(...); bar(...); end; def bar(a,b,&c); Kernel.p [á,b,c]; end; bar(1,2) {}
15:07
<
ruby-eval >
ERROR: undefined local variable or method `á' for main:Object
15:07
<
ruby-eval >
(eval):1:in `bar'
15:07
<
ox1eef >
:: def foo(...); bar(...); end; def bar(a,b,&c); Kernel.p [a,b,c]; end; bar(1,2) {}
15:07
<
ruby-eval >
[1, 2, #<Proc:0x044795d8 (eval):1>]
15:07
<
ruby-eval >
=> [1, 2, #<Proc:0x044795d8 (eval):1>]
15:07
<
ox1eef >
thats nice
15:11
roadie has joined #ruby
15:17
seydar has joined #ruby
15:20
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:21
fef has joined #ruby
15:23
seydar has quit [Ping timeout: 268 seconds]
15:28
seydar has joined #ruby
15:29
graywolf has joined #ruby
15:31
Guest26nakilon has joined #ruby
15:31
<
Guest26nakilon >
where is Hash#dup documented?
15:31
<
Guest26nakilon >
I feel like it's doing something weird, not what I expected
15:33
seydar has quit [Ping timeout: 268 seconds]
15:35
<
Guest26nakilon >
hm, it feels like when I use a Struct (that I modify in process) as a key they go as different keys
15:35
<
Guest26nakilon >
but when I dup, it probably calls some rehash and the hash gets "corrupted", i.e. becomes smaller, all the keys merge
15:37
dionysus70 has joined #ruby
15:38
<
Guest26nakilon >
yeah it's funny
15:38
dionysus69 has quit [Ping timeout: 256 seconds]
15:38
dionysus70 is now known as dionysus69
15:43
seydar has joined #ruby
15:47
dionysus69 has quit [Ping timeout: 256 seconds]
15:48
seydar has quit [Ping timeout: 268 seconds]
15:55
donofrio has quit [Ping timeout: 268 seconds]
15:57
sylario has joined #ruby
15:58
Guest65 has joined #ruby
16:00
<
Guest65 >
not sure if it's my bad or something wrong with the documentation
16:04
<
leftylink >
I also see such a character
16:06
<
adam12 >
Guest65: It's a shortcut link.
16:06
<
adam12 >
Guest65: If you click it, it updates the hash in the URL.
16:14
<
Guest65 >
Nice to know. Useful feature. But isn't beautiful. Another way to do this would be great.
16:15
<
Guest65 >
Thanks for the response
16:17
<
adam12 >
Guest65: Those aren't the official docs, so...
16:19
<
Guest65 >
I will switch to the official one. The examples copied from there
16:26
donofrio has joined #ruby
16:36
Guest65 has quit [Quit: Client closed]
16:40
_aeris_ has joined #ruby
16:43
aeris has quit [Remote host closed the connection]
16:43
_aeris_ is now known as aeris
16:47
Thanzex has quit [Read error: Connection reset by peer]
16:48
Thanzex has joined #ruby
16:59
donofrio has quit [Ping timeout: 248 seconds]
17:01
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
17:10
<
Guest26nakilon >
and how do I skip the values? like [1,2,3] => x,_
17:10
<
Guest26nakilon >
it throws a syntax error
17:13
<
ox1eef >
where are the official docs? i dont know of any except third party efforts
17:14
donofrio has joined #ruby
17:14
<
Guest26nakilon >
oh I see, I need brackets
17:16
markong has quit [Ping timeout: 248 seconds]
17:17
<
Guest26nakilon >
though it had formatting issues on some pages too
17:17
<
Guest26nakilon >
leftylink thanks
17:22
<
ox1eef >
oh nice. i wasn't aware the docs were hosted on ruby-lang these days.
17:36
some14u has joined #ruby
17:38
<
Guest26nakilon >
I always felt like those are some Windows documentation format and so they might be very old
17:38
some14u has quit [Client Quit]
17:39
some14u has joined #ruby
17:39
<
Guest26nakilon >
they are exactly the same as the .chm file coming with Ruby Installer
17:41
graywolf has quit [Quit: WeeChat 3.3]
17:43
some14u has quit [Client Quit]
17:44
seydar has joined #ruby
17:45
fercell has joined #ruby
17:46
some14u has joined #ruby
17:48
<
ox1eef >
i like yard, not perfect either but pretty powerful.
17:49
seydar has quit [Ping timeout: 246 seconds]
17:51
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
17:51
<
Guest26nakilon >
I remember Windows API, C and C++ docs were on CDs in this format -- they were perfect to use when you have no internet yet
17:54
<
Guest26nakilon >
I also wonder why no one makes fxri
17:54
<
Guest26nakilon >
it stopped working with ruby 2.0 IIRC
17:54
<
ox1eef >
in todays world we have the file:/// protocol and a browser, as long as the HTML follows some simple rules i think it should work just as well
17:54
<
Guest26nakilon >
if you have a browser you might have an internet though
17:55
<
Guest26nakilon >
it's just today's days that we have browser launched all the time
17:56
seydar has joined #ruby
18:00
seydar has quit [Ping timeout: 246 seconds]
18:02
seydar has joined #ruby
18:14
g0zart has joined #ruby
18:30
g0zart has quit [Quit: Leaving]
18:32
dionysus69 has joined #ruby
18:32
Guest26nakilon has quit [Quit: Client closed]
18:44
dionysus69 has quit [Ping timeout: 268 seconds]
18:53
guest_nakilon has joined #ruby
18:54
<
guest_nakilon >
imagine I have an array that I want to iterate through exactly once; the thing is that my algorithm's iterations are not equivalent to array's elements, so I have to kinda move a pointer
18:56
<
guest_nakilon >
I used to call the array.first and array.shift when I need to step further, but now I want to eliminate the mutation; how do I do that? if I make enum = array.to_enum, and utilize peek and next, then it does not stop gracefully
18:56
<
guest_nakilon >
I mean when I do the last peek it throws StopIteration, I don't want to handle exceptions
18:58
guest_nakilon has quit [Remote host closed the connection]
18:58
guest_nakilon has joined #ruby
18:58
<
guest_nakilon >
doing enum = [*array, nil].to_enum would be a kludge
19:00
guest_nakilon has quit [Remote host closed the connection]
19:01
guest_nakilon has joined #ruby
19:02
guest_nakilon has quit [Remote host closed the connection]
19:03
guest_nakilon has joined #ruby
19:04
<
guest_nakilon >
I mean in my current implementation I just check for array.first.nil?
19:05
Thanzex has quit [Read error: Connection reset by peer]
19:05
taupiqueur has joined #ruby
19:05
Thanzex has joined #ruby
19:08
guest_nakilon has quit [Remote host closed the connection]
19:09
guest_nakilon has joined #ruby
19:10
roadie has quit [Ping timeout: 260 seconds]
19:14
ssh073 has joined #ruby
19:16
guest_nakilon has quit [Remote host closed the connection]
19:17
fef has quit [Remote host closed the connection]
19:17
guest_nakilon has joined #ruby
19:18
guest_nakilon has quit [Remote host closed the connection]
19:19
guest_nakilon has joined #ruby
19:20
guest_nakilon has quit [Remote host closed the connection]
19:21
guest_nakilon has joined #ruby
19:22
guest_nakilon has quit [Remote host closed the connection]
19:23
guest_nakilon has joined #ruby
19:24
guest_nakilon has quit [Remote host closed the connection]
19:24
dionysus69 has joined #ruby
19:24
brw has joined #ruby
19:25
guest_nakilon has joined #ruby
19:26
some14u has joined #ruby
19:27
dionysus69 has quit [Read error: Connection reset by peer]
19:28
guest_nakilon has quit [Remote host closed the connection]
19:33
guest_nakilon has joined #ruby
19:34
<
guest_nakilon >
nevermind, I just replace "break unless array.first" with "enum.peek rescue break" and it seems to be working
19:36
roadie has joined #ruby
19:36
seydar has quit [Ping timeout: 246 seconds]
19:42
seydar has joined #ruby
19:42
roadie has quit [Remote host closed the connection]
19:42
roadie has joined #ruby
19:43
noname has joined #ruby
19:44
noname has quit [Remote host closed the connection]
19:44
teclator has joined #ruby
19:46
seydar has quit [Ping timeout: 256 seconds]
19:58
_ht has quit [Remote host closed the connection]
20:02
seydar has joined #ruby
20:04
___nick___ has quit [Ping timeout: 268 seconds]
20:06
seydar has quit [Ping timeout: 268 seconds]
20:10
ssh073 has joined #ruby
20:12
seydar has joined #ruby
20:14
taupiqueur has quit [Quit: taupiqueur]
20:14
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
20:16
seydar has quit [Ping timeout: 248 seconds]
20:22
wand has quit [Ping timeout: 240 seconds]
20:23
nirvdrum has joined #ruby
20:26
seydar has joined #ruby
20:26
dionysus69 has joined #ruby
20:27
libsys has quit [Ping timeout: 256 seconds]
20:28
libsys has joined #ruby
20:30
seydar has quit [Ping timeout: 248 seconds]
20:36
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
20:40
markong has joined #ruby
20:45
gfawcett has quit [Quit: Ping timeout (120 seconds)]
20:45
dionysus69 has quit [Quit: dionysus69]
20:45
gfawcett has joined #ruby
20:46
seydar has joined #ruby
20:49
roadie has quit [Ping timeout: 260 seconds]
20:51
seydar has quit [Ping timeout: 248 seconds]
20:59
some14u has joined #ruby
21:03
gfawcett has quit [Quit: Ping timeout (120 seconds)]
21:04
gfawcett has joined #ruby
21:06
nirvdrum has joined #ruby
21:07
gfawcett has quit [Client Quit]
21:07
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:07
some14u has joined #ruby
21:15
victori has quit [Read error: Connection reset by peer]
21:15
roadie has joined #ruby
21:18
ur5us has joined #ruby
21:20
FetidToot1 has joined #ruby
21:21
roadie has quit [Ping timeout: 260 seconds]
21:22
FetidToot has quit [Ping timeout: 260 seconds]
21:22
FetidToot1 is now known as FetidToot
21:24
victori has joined #ruby
21:43
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:46
roadie has joined #ruby
21:47
roadie has quit [Read error: Connection reset by peer]
22:08
seydar has joined #ruby
22:17
some14u has quit [Ping timeout: 272 seconds]
22:34
FetidToot8 has joined #ruby
22:36
FetidToot has quit [Ping timeout: 256 seconds]
22:37
FetidToot has joined #ruby
22:40
FetidToot8 has quit [Ping timeout: 260 seconds]
22:45
comet23 has joined #ruby
22:46
<
comet23 >
hello everyone i am stuck on a homework problem :(
22:48
<
comet23 >
how can i use inject to find the biggest or smallest number?
22:49
sylario has quit [Quit: Connection closed for inactivity]
22:56
<
adam12 >
comet23: assign to acc if num is greater than acc
22:56
<
adam12 >
(or less than acc)
22:57
<
adam12 >
comet23: ie. change acc when it's smaller than the number currently being compared.
22:57
<
adam12 >
comet23: You're almost there, probably just using inject wrong.
22:57
<
comet23 >
so like { |acc, num| acc if num > acc }
22:58
<
weaksauce >
acc must be something every time
22:59
<
adam12 >
comet23: Don't forget to return acc always
22:59
<
adam12 >
acc = num if num > acc; acc
22:59
<
weaksauce >
also you don't pass in a starting value so you have to check for the acc being nill
22:59
<
comet23 >
i didn't know i can use semi colons in ruby
22:59
<
weaksauce >
nil even
22:59
<
adam12 >
And like weaksauce said, inject(0)
22:59
<
weaksauce >
well or something smaller than any reasonable input
23:00
<
weaksauce >
personally i'd do a acc = num unless acc and check normally
23:00
<
comet23 >
thank you so much for your help
23:00
<
comet23 >
my code is working now but i think i can shorten it to a one liner with the hint provided by adam12
23:00
<
adam12 >
That's true. I'd probably inject(nums.first) or something.
23:01
<
weaksauce >
yeah that works too
23:01
<
weaksauce >
still doesn't check for the nil
23:02
<
comet23 >
nums.inject { |acc, num| acc = num if num > acc; acc }
23:02
<
adam12 >
:: def max_inject(*nums)= nums.inject(nums.first) { |acc, num| acc = num if num > acc; acc }; max_inject(30, 28, 18)
23:02
<
comet23 >
why do i need to check for nil?
23:02
<
weaksauce >
:: def max_inject(*nums)= nums.inject { |acc, num| acc = num if num > acc; acc }; max_inject(30, 28, 18)
23:02
<
adam12 >
:: def max_inject(*nums)= nums.inject(nums.first) { |acc, num| next (num > acc ? num : acc) }; max_inject(30, 28, 18)
23:03
<
weaksauce >
weird i got a nil problem when i ran it
23:03
justChili is now known as justErkel
23:05
<
weaksauce >
oh nevermind it was the original code
23:05
Thanzex has quit [Read error: Connection reset by peer]
23:06
<
weaksauce >
that didn't always return acc
23:06
<
weaksauce >
it uses the first value as the default memo
23:06
Thanzex has joined #ruby
23:23
seydar has quit [Ping timeout: 260 seconds]
23:34
comet23 has quit [Ping timeout: 250 seconds]
23:34
seydar has joined #ruby
23:35
Sheilong has quit [Quit: Connection closed for inactivity]
23:40
seydar has quit [Ping timeout: 268 seconds]
23:50
ur5us has quit [Ping timeout: 268 seconds]
23:54
seydar has joined #ruby