These are chat archives for evhub/coconut

22nd
Nov 2018
Joel Dunham
@jrwdunham
Nov 22 2018 06:49
Is there a way to make this work?
def decode(lst) = reduce((acc, (chr2, cnt2)) -> f'{acc}{chr2 * cnt2}', lst, '')
aside from this:
def decode(lst) = reduce((acc, chr_cnt) -> f'{acc}{chr_cnt[0] * chr_cnt[1]}', lst, '')
ie pattern matching in lambdas
Evan Hubinger
@evhub
Nov 22 2018 20:55

@jrwdunham You want

def decode(lst) = reduce(def (acc, (chr2, cnt2)) -> f'{acc}{chr2 * cnt2}', lst, '')

(see statement lambdas)

Joel Dunham
@jrwdunham
Nov 22 2018 20:57
Awesome @evhub ! Thank you