Closures (in Haskell)

后端 未结 2 1583
余生分开走
余生分开走 2021-02-01 07:43

To me a Closure is a (nested?) function with co-located data.

When you write software in Haskell and look it through afterwards, you frequently find closures that you h

2条回答
  •  生来不讨喜
    2021-02-01 08:36

    Typically, if I need to precompute tables or something for a function, or there's a function that requires a lot of data, yeah, that'll be done as a closure. For example, on my AI homework the other day, I wrote a thing that learned from a lot of samples and then popped out a (Point -> Bool) function, but that function had to depend on a lot of data that I'd accumulated from the learning process.

提交回复
热议问题