loganhelms

loganhelms

A while back, I read a great book by Luis Atencio titled, Functional Programming in JavaScript. In section 7.3, he discusses memoization (an optimization technique for caching output values for pure functions for optimization).

If this is already part of Elixir, could someone point me to where I can learn more about it?
If it is not part of Elixir, is there a discussion for its value and tradeoffs?

Showing Posts 1 to 4

Sebb

Sebb

bryanhuntesl

bryanhuntesl

Trade off is memory consumption/local disk cache/staleness/invalidation

cjbottaro

cjbottaro

You don’t even need a process to manage state for memoization. Just need to change your API a little bit.

Stateful Ruby…

class Foo
  def blah
    @blah ||= calc_blah()
  end
end

Stateless Elixir…

module Foo do
  def blah(obj) do
    if obj.blah do
      {obj.blah, obj}
    else
      blah = calc_blah(obj)
      {blah, %{obj | blah: blah}}
    end
  end
end
— All posts loaded —

Where Next? Top

Trending in Chat/Questions Top

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews