Skip to main content

All Questions

2 votes
4 answers
198 views

Let's say I have a function foo: def foo(A, B, C) A + B + C end And I call it like this, with only the last parameter changing: foo("foo", "bar", "123") foo("foo&...
Jabrove's user avatar
  • 863
-1 votes
1 answer
158 views

I have a text file, that need to be split in the following way: first line is an identifier and must be at the top of every file created, following lines are a pair of digits separated by a comma: ...
skgifen's user avatar
  • 13
1 vote
2 answers
125 views

I am processing 2-dimensional shapes in ruby. I have a Point class with x and y attribute, and a Line class which has two end points. Later in the process chain, I often want to identify and process ...
david's user avatar
  • 46
1 vote
1 answer
70 views

I redefined function fold using reduce method in Ruby. def fold(f, init, lst) lst.reduce(init){|w, a| f.call(w, a)} end I have reverse and twist functions below and examples on how they should ...
Jenny's user avatar
  • 5
1 vote
3 answers
451 views

I have an array I want to turn into a hash map keyed by the item and with an array of indices as the value. For example arr = ["a", "b", "c", "a"] would ...
stk1234's user avatar
  • 1,176
1 vote
4 answers
81 views

I have 3 array of hashes: a = [{name: 'Identifier', value: 500}, {name: 'Identifier2', value: 50 }] b = [{name: 'Identifier', value: 500}, {name: 'Identifier2', value: 50 }] c = [{name: 'Identifier', ...
MrBear's user avatar
  • 175
0 votes
1 answer
36 views

Apparently, my ability to think functional withered over time. I have problems to select a sub-dataset from a dataset. I can solve the problem the hacky imperative style, but I believe, there is a ...
Twonky's user avatar
  • 814
-1 votes
2 answers
49 views

I have a string that looks like this: "[hello][my][friend]" I'm interested in returning an array like ["hello", "my", "friend"] How can I do this in Ruby?
Dylan Richards's user avatar

15 30 50 per page
1
2 3 4 5
9