Full stack web dev.
Studying FP web development approaches, while helping Mission Bit create paths to programming for underserved public school kids.
Previously @ Gradescope.
I'm impressed by how short many of the solutions are.
Clojure:
(nscheckbook(:require[clojure.string:refer[joinsplit]]));; split line into tokenized "entry"(defntokens[line](mapread-string(re-seq#"(?:\w|\.)+"line)));; append running balance onto entries(defnwith-running-balance[[start&entries]](reduce(fn[accentry](let[prev-bal(last(lastacc))cur-bal(-prev-bal(lastentry))new-entry(conj(vecentry)"Balance"cur-bal)](conjaccnew-entry)))[["Original_Balance"(laststart)]]entries));; output entry as string, with numbers rounded(defnformat-entry[xs](case(countxs)2(applyformat"%s %.2f"xs)5(applyformat"%s %s %.2f %s %.2f"xs)));; append running balance, include total & average, format nums(defnbalance[s](let[lines(splits#"\n")entries(maptokenslines)$$(maplast(restentries))](join"\n"(mapformat-entry(conj(with-running-balanceentries)["Total expense"(apply+$$)]["Average expense"(/(apply+$$)(count$$))])))))
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm impressed by how short many of the solutions are.
Clojure: