2
votes
1answer
78 views

How to rewrite recursion in a more ruby way

def get_all_friends(uid, client) friends = client.friendships.friends(uid: uid) total = friends.total_number get_friends(total, 0, uid, client) end def get_friends(total, cursor, uid, client) ...
0
votes
0answers
120 views

Ruby Trie Iterative to_a

I've been benchmarking recursive and iterative ruby trie functions. Unsurprisingly the iterative functions seem perform better then my recursive implementations. The only exception to this is my to_a. ...
3
votes
3answers
454 views

Ruby fibonacci(n) recursive computation optimized with reflection. Is this good Ruby?

I'm coming from Java and this is my first attempt with Ruby reflection. The idea is to take the common-known (and awfully bad performing) fibonacci(n) recursive method: # recursively computate ...