3 ms·
Some syntactic sugar can help with this a bit; here's the same code rewritten using the pipe operator in Elixir: def make_tiramisu(eggs, sugar1, wine, chee
by lilactown 9y ago
Some syntactic sugar can help with this a bit; here's the same code rewritten using the pipe operator in Elixir:
def make_tiramisu(eggs, sugar1, wine, cheese, cream, fingers, espresso, sugar2, cocoa)
beat(eggs)
|> beat(sugar1, wine)
|> whisk
|> beat(beat(cheese))
|> fold(whip(cream))
|> assemble(
soak2seconds(fingers, disolve(sugar2, espresso)))
|> sift(cocoa)
end
It reads a lot closer to the recipe, though the nested multiple operations are still a bit hard to read. Separating them into their own named functions would probably be better.
- eyelidlessness 9y agoIn Clojure: (defn make-tiramisu [eggs sugar1 wine cheese cream fingers espresso sugar2 cocoa] (-> eggs (beat) (beat sugar1 wine) (whisk) (beat (beat cheese)) (fold (whip cream)) (assemble (soak2seconds fingers (dissolve sugar2 espresso))) (sift cocoa) (refrigerate)))