DEV Community

Discussion on: Solving Problems By Avoiding Them

Collapse
 
gypsydave5 profile image
David Wickes

Ahhhh - this looks fun! I hope you're enjoying doing this as much as I did reading it.

So, I have a question: what made you decide to support partial application of functions? It looks like you're going down the 'everything is curried' route, like in Haskell. Is this coming from the book?

I've not seen a Lisp with that language feature before, and I'm wondering what the downsides of supporting it are... what are the tradeoffs?

(Reading this post gave me Rust flashbacks - those types! 😮)

Collapse
 
deciduously profile image
Ben Lovy

It IS fun! It's been my favorite Rust project to date. I highly recommend both the book as-is and the exercise of translating it.

You're correct, this is coming from the book. My end goal is an equivalent interpreter to that found in the book, and the Lisp the author describes is indeed idiosyncratic.

As it turns out, variadic functions are the very next thing on the list, but employing a syntax like {x & xs}, using xs to collect any trailing arguments. Then we can define curry: fun {unpack f xs} {eval (join (list f) xs)} and uncurry: fun {pack f & xs} {f xs}.

Collapse
 
gypsydave5 profile image
David Wickes

Just remembered one tradeoff - variadic functions!