Reverse Greek Conversion Golf
Python 3, 112
Saved 4 bytes thanks to vaultah.
Booyah, beating JS!
lambda x,z="ΑΒΓΔΕϜΖΗΘΙΚΛΜΝΞΟΠϘΡΣΤΥΦΧΨΩϠ".find:sum((z(c)%9+1)*10**(z(c)//9)for c in x)
With test cases:
assert(f("ΡΚΓ")==123)
assert(f("Η")==8)
assert(f("ΨΟΖ")==777)
assert(f("Ρ")==100)
assert(f("ΧϜ")==606)
Loops through the string and uses its index in the list of potentials chars to calculate how much it's worth.
JavaScript (ES7), 115 bytes
s=>[...s].map(c=>n+=((i="ΑΒΓΔΕϜΖΗΘΙΚΛΜΝΞΟΠϘΡΣΤΥΦΧΨΩϠ".search(c))%9+1)*10**(i/9|0),n=0)|n
Haskell, 116 113 bytes
f x=sum[v|d<-x,(l,v)<-zip"ΑΒΓΔΕϜΖΗΘΙΚΛΜΝΞΟΠϘΡΣΤΥΦΧΨΩϠ"$(*)<$>[1,10,100]<*>[1..9],d==l]
Usage example: map f ["ΡΚΓ","Η","ΨΟΖ","Ρ","ΧϜ","ΡϘ","ΜΒ","Ν"]
-> [123,8,777,100,606,190,42,50]
.
Lookup the value of the greek letter from a list of pairs (letter, value)
and sum. The list of values is build by (*)<$>[1,10,100]<*>[1..9]
, where (*)<$>[1,10,100]
builds a list of functions [(*1),(*10),(*100)]
(multiply by 1, 10 and 100) which are applied separately to the elements of [1..9]
and concatenated into a single list.
Edit: 3 bytes with thanks to @xnor.