read or learn more
λ λ λ
Fogus' Thoughts on life, programming, and thinking
❤ c clj erl pl frink fth cl org pure icl qi ❤
Follow me on Twitter... or RSS...
Run this blog in mobile
2024 2023 2022 2021 2020 2019 2018 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002
Yesterday I demonstrated how to transform a mundane recursive function into a tail recursive function. However, I received some flak for that post because there are better ways to implement run-length encoding with Clojure. While certainly true, I think some of my critics1 missed the point of the exercise. ;-) Having said that; their points […]
this example is in Clojure, but the general principle stands regardless of language Transforming an accumulating mundane recursive function to a tail-recursive function using a helper function. (defn mundane-pack “Mundane recursive way to pack a sequence” [[f & r :as S]] (if (seq S) (let [[packed tail] (split-with {f true} S)] (if (seq tail) (cons […]
Continue