Equivalent of #map in ruby in golang
Posted
by
Oct
on Programmers
See other posts from Programmers
or by Oct
Published on 2012-04-08T14:10:56Z
Indexed on
2012/04/08
17:45 UTC
Read the original article
Hit count: 382
I'm playing with Go and run into something I'm unable to find in Google, although there is certainly something that exists:
I'm using the following struct:
type Syntax struct {
name string
extensions *regexp.Regexp
}
type Scanner struct {
classifier * bayesian.Classifier
save_file string
name_to_syntax map[string] *Syntax
extensions_to_syntax map[*regexp.Regexp] *Syntax
}
I'd like to perform the following using Go and I'm quoting ruby because it's how I'd do that using ruby:
test_regexpes = my_scanner.extensions_to_syntax.keys
My goal is to get an array of *regexp.Regexp .
Any idea on how to do that in a simple way ?
Thank you !
© Programmers or respective owner