You can even skip the lambdas; filter(x->ips, has_value, ".")[0] et c.
/ Johan Sundström (Achtung Liebe!)
Previous text:
2004-09-12 00:11: Subject: Re: gethostip
one that is guaranteed to always give you just one ip,
x->ips[0]
one ip4 ip,
filter(x->ips, lambda(string x) { return has_value(x, "."); })[0]
all ip4 ips.
filter(x->ips, lambda(string x) { return has_value(x, "."); })
one ip6
filter(x->ips, lambda(string x) { return has_value(x, ":"); })[0]
all ip6
filter(x->ips, lambda(string x) { return has_value(x, ":"); })
all ips.
x->ips
Since you normally don't need to differentiate between v4 and v6, it's acceptable that you need to do slightly more work in the cases where you do.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)