lewis1711

Activity Graph

Page 1 of 1

2016-05-19

[07:16:49] lewis1711: has joined #ruby
[07:23:09] lewis1711: is there anything like "#take" for arrays that mutates them in place?
[07:24:22] lewis1711: for some inexplicable reason, #pop removes from the end of an array, but pop(n) removes from the front
[07:24:28] lewis1711: ah, thanks cbliard
[07:26:06] lewis1711: I'm having a slow day. it returns what it removes..
[09:02:47] lewis1711: Ping timeout: 260 seconds

2016-05-18

[00:59:42] lewis1711: has joined #ruby
[04:29:18] lewis1711: Ping timeout: 246 seconds
[04:32:56] lewis1711: has joined #ruby
[04:53:27] lewis1711: Ping timeout: 260 seconds
[04:54:50] lewis1711: has joined #ruby
[05:00:14] lewis1711: Ping timeout: 260 seconds
[05:06:31] lewis1711: has joined #ruby
[05:43:34] lewis1711: Ping timeout: 240 seconds

2016-05-17

[11:46:30] lewis1711: has joined #ruby
[11:47:40] lewis1711: why can't an enumerator be cloned?
[11:48:46] lewis1711: I mean it's just a glorified pointer surely
[12:05:55] lewis1711: Ping timeout: 260 seconds
[21:50:47] lewis1711: has joined #ruby
[21:51:42] lewis1711: if I have an array "xs", how to get an enumerator starting at a particular index in the array?
[21:52:55] lewis1711: oh nm, xs[index..-1].to_enum
[23:30:45] lewis1711: Ping timeout: 246 seconds
[23:32:19] lewis1711: has joined #ruby
[23:38:20] lewis1711: Ping timeout: 260 seconds

2016-05-14

[03:39:08] lewis1711: has joined #ruby
[03:39:22] lewis1711: is there anyway to do something like "has_next?" on an enumerator?
[03:42:47] lewis1711: or, I guess to re-phrase - nothing wrong with exceptions-as-control-flow in ruby, i guess? judging by the way this API has been written
[05:55:48] lewis1711: Ping timeout: 246 seconds
[06:38:00] lewis1711: has joined #ruby
[06:45:04] lewis1711: I never thought about doing that. seems legit
[09:25:44] lewis1711: Quit: Ex-Chat

2016-05-10

[08:51:30] lewis1711: has joined #ruby
[08:51:50] lewis1711: how does ruby "know" how to sort characters?
[08:53:38] lewis1711: hmm it seems to do it by the result of "ord" with strings
[08:54:38] lewis1711: though I am not quite sure what an "integer ordinal" is
[09:38:05] lewis1711: has left #ruby: ("Ex-Chat")

2016-03-12

[01:13:36] lewis1711: has joined #ruby
[01:14:49] lewis1711: http://ruby-doc.org/stdlib-2.2.0/libdoc/matrix/rdoc/Matrix.html#method-c-columns when I type that line into IRB my output does not look like that at all. it just looks like " => Matrix[[25, -1], [93, 66]] ". why?
[01:15:58] lewis1711: damn. I want nice matrix formatting. oh well i can do it myself
[03:13:22] lewis1711: with unicode characters, some characters take up double width when displayed. is there anyway to get this info from a string, or is that related to the font itself?
[03:20:49] lewis1711: that's the proper way to do it, but a bit over kill, I am only dealing with 36 characters, so that's easy to enumerate over
[03:24:50] lewis1711: Ox0dea, no it was my bad counting
[03:24:51] lewis1711: https://en.wikipedia.org/wiki/Bopomofo
[03:27:16] lewis1711: Ox0dea, yeah they are all wide. except for the accent marks
[03:27:37] lewis1711: or tone marks I should say, ˇ ˋ ˊ ˙
[03:27:56] lewis1711: makes sense that the rendering is up to the font though
[06:10:18] lewis1711: Quit: Ex-Chat

2016-02-28

[01:07:17] lewis1711: has joined #ruby
[01:07:34] lewis1711: how do I map over a hash to get another hash? I want to perform some function on evey value, but leave the keys
[01:09:55] lewis1711: Ox0dea, nope, that looks great, but it never showed up when I searched. I was looking for "to_hash". thanks
[02:55:19] lewis1711: Ping timeout: 268 seconds
[02:55:47] lewis1711: has joined #ruby
[04:14:18] lewis1711: Ping timeout: 276 seconds

2016-02-10

[08:31:02] lewis1711: has joined #ruby
[08:31:51] lewis1711: if I do "m = [].map", m is the type enumerator. how do I call m with a block?
[08:40:41] lewis1711: Ox0dea, but the docs give the example of .map.with_index
[08:42:02] lewis1711: then what the hell is the point of map being essentially "to_enum"
[08:43:38] lewis1711: but if there's no block, it's just 'to_enum'. i don't really understood
[17:24:26] lewis1711: Ping timeout: 240 seconds

2015-10-20

[08:35:36] lewis1711: has joined #ruby
[08:40:34] lewis1711: has left #ruby: ("Ex-Chat")

2015-10-18

[06:37:19] lewis1711: has joined #ruby
[06:39:47] lewis1711: d = Dir("/d"). let's say I know the name of a file inside d. can I get it from the dir object?
[06:41:38] lewis1711: reading the docs. using [], which the docs seemed to suggest
[06:45:01] lewis1711: my eyes glanced over each. it's annoying named
[06:45:28] lewis1711: unless there's some overloaded .each for Array etc now, that returns an enumerator.
[06:45:42] lewis1711: huh, learned something new
[06:46:28] lewis1711: I mean I was aware of "each" that iterates over things and returns nil
[06:48:05] lewis1711: yeah those are all familiar to me. the .each thing return an enumerator was new
[07:12:57] lewis1711: baweaver, .each in a Dir just gives the string names, not files. so it's not possible. I'll just use strings rather than trying to do things with Dir
[08:21:41] lewis1711: has left #ruby: ("Ex-Chat")

2015-10-17

[05:20:46] lewis1711: has joined #ruby
[05:27:22] lewis1711: has left #ruby: ("Ex-Chat")

2015-06-20

[03:30:30] lewis1711: has joined #ruby
[03:31:27] lewis1711: is there a simple ruby testing framework? one that doesn't involve sub-classing or separate files
[03:35:10] lewis1711: phat4life, nothing at the moment. I am just wanting to have system that's like "write a bit of code, write a test just after it, carry on".
[03:35:36] lewis1711: I like having it in the same file
[03:38:30] lewis1711: phat4life, thanks. I'm a simple person, I will only unit test if it's completely thoughtless, I don't like ceremony
[03:48:19] lewis1711: sphex, are you being salty?
[03:54:43] lewis1711: phat4life, I had a look, thanks
[03:56:01] lewis1711: sphex, pretty much the only language I ever used unit tests in was racket, because rackunit was so simple. I search for something similar in other languages, but it's hard to find. I don't really want to write anything longer than a couple of hundred lines in ruby without unit tests, because it's so super dynamic
[04:11:09] lewis1711: Ping timeout: 244 seconds
[05:06:43] lewis1711: has joined #ruby
[05:36:13] lewis1711: this is at least the third time in my life I have spent minutes figuring out why I couldn't construct my class because I wrote "initialise" instead of "initialize".
[05:54:04] lewis1711: Read error: Connection reset by peer

2015-03-26

[01:35:58] lewis1711: is there anyway to have variable that's only computed when you access it? like "page = some_long_operation()". only have it computed once, when it's first accessed?
[01:39:32] lewis1711: jhass, yeap found something that explains how to do what I want. thanks

2013-02-25

[01:16:42] lewis1711: I am registered
[01:17:13] lewis1711: nah i let my registration lapse, too busy with other things