astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
29.27k stars 956 forks source link

Memoize? #5606

Closed DimitriPapadopoulos closed 1 year ago

DimitriPapadopoulos commented 1 year ago

I cannot find memoize in dictionaries, shouldn't it have been memorize? https://github.com/astral-sh/ruff/blob/0b9af031fb8f51e7f9a72c31366bf5f87b90ca3c/crates/ruff_formatter/src/format_extensions.rs#L72 https://github.com/astral-sh/ruff/blob/0b9af031fb8f51e7f9a72c31366bf5f87b90ca3c/crates/ruff_formatter/src/prelude.rs#L5 https://github.com/astral-sh/ruff/blob/0b9af031fb8f51e7f9a72c31366bf5f87b90ca3c/crates/ruff_python_formatter/src/expression/binary_like.rs#L36

MichaReiser commented 1 year ago

Interesting. I guess the problem why the term isn't in a general purpose dictionary is because it is a term specific to computer science. https://en.wiktionary.org/wiki/memoize

DimitriPapadopoulos commented 1 year ago

I wouldn't be surprised if some words “specific to computer science” were initially actual misspellings. I don't see a substantial difference between the definitions of memorize and memoize, one that would explain the new spelling. Besides, it seems to me the usual word in computer science for “store (the result of a computation so that it can be subsequently retrieved without repeating the computation” is cache.

It is true memoize has been used more “widely” since 1980, but many orders of magnitude less than memorize. I wonder how to find the seminal misspelling around 1970-1980, just to check whether it seems intentional or not. Perhaps it originates in Lisp and is intentional after all. From the Advance Papers of the Fourth International Joint Conference on Artificial Intelligence,Tbilisi, Georgia, USSR, 3-8 Sept. 1975, Volume 2:

so they only have to be computed once ( “memoization” ), and using automatic simplification of the lower levels of access functions.

whether and how to “memoize” data, and so on.

wookie184 commented 1 year ago

The wikipedia page for memoization suggests the spelling was intentional, and describes it as a specific type of caching