I am trying to implement LCM in one line in Scala.
This is how I've implemented it with 2 functions:
def gcd(a: BigInt, b: BigInt):BigInt=if (b==0) a.abs else gcd(b, a%b)
def lcm(list: Seq[BigInt]):BigInt=list.foldLeft(BigInt(1))((a, b) => (a/gcd(a,b))*b)
How would you convert gcd into a lambda inside lcm?