Michael Forrest

London, United Kingdom

grimaceworks.com

Age: 36

Creative Developer and Founder of Good To Hear.

goodtohear.co.uk

Music software obsessive.

github.com/michaelforrest

10h
awarded Good Question
Jul
4
awarded Yearling
Jul
4
awarded Autobiographer
Jul
3
awarded Curious
Jun
26
accepted Weird NSDateFormatter result
Jun
26
comment Weird NSDateFormatter result
Gah! Nice one. That's exactly it.
Jun
26
asked Weird NSDateFormatter result
Jun
16
awarded Popular Question
Jun
13
accepted Address of static variable changes between static inline function calls
Jun
13
comment Address of static variable changes between static inline function calls
Ha, ok thanks. Shows how much I know about C!
Jun
13
comment Use functional programming to perform a transformation on each item in a hash
This is a Q&A website... What's wrong with 'fishing for answers' exactly?
Jun
13
comment Use functional programming to perform a transformation on each item in a hash
The crux of this question is that I want it to read forward like [1,2,3].map{|n| n + 1} does. These mechanisms mean I have to jump backwards and forwards through the line when reading it which feels overly complicated. each_with_object employs a memo thing and I always end up having to refer to documentation when such things are involved. And it's not much different to initializing an empty hash on the previous line. I just wish there was a Hash.transform_values method or something like that to let me go {'a','b'}.transform_values{|v| v.uppercase} or whatever.
Jun
13
comment Use functional programming to perform a transformation on each item in a hash
I find the hash.each_with_object approach particularly difficult to read! ;)
Jun
13
accepted Use functional programming to perform a transformation on each item in a hash
Jun
13
comment Use functional programming to perform a transformation on each item in a hash
Ok I'm accepting this one for now but crossing my fingers that there's some secret thing built into Hash.map or some other function or library that does this without going via a nested array.
Jun
13
comment Use functional programming to perform a transformation on each item in a hash
Not so interested in the string conversion - more the mapping stuff. (I'm doing v.split('-').first)
Jun
13
comment Use functional programming to perform a transformation on each item in a hash
Better - so you go from an array of arrays back to a hash, but isn't there a more direct way to do this?
Jun
13
comment Use functional programming to perform a transformation on each item in a hash
I've clarified my question to show that I want to avoid a temporary variable or mutating my original hash. I want to just create a new hash with modified values inline.
Jun
13
asked Use functional programming to perform a transformation on each item in a hash
Jun
13
comment Address of static variable changes between static inline function calls
Do you mean 'compilation unit' (as opposed to 'translation unit')? I think I'll accept this answer even though both are good, because it explains the whys a bit more.
1 2 3 4 5