Jump to content

Talk:Fold (higher-order function)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 189.61.19.115 (talk) at 04:39, 27 August 2010. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputing Start‑class
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.
WikiProject iconComputer science Start‑class
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.
Things you can help WikiProject Computer science with:

Haskell?????

Why are you using Haskell for the examples? You and the other 5 people who use it should think about real world application of this information.

Rewrite

As partially noted below, the article was rather terrible, containing numerous severe errors. (buggy scheme code, foldl and foldr being confused with respect to lazy evaluation, associativity and commutativity being confused, etc.) I've rewritten it and extended it somewhat. It is mildly Haskell-centric as far as the examples go, but Haskell can very well be treated as functional pseudocode, and very little of the content is really particular to Haskell, but applies to most any language supporting higher-order functions.

-- Cgibbard 02:22, 21 October 2006 (UTC)[reply]

foldl and foldr

I see, the paragraph about foldl and foldr has nicely the facts correct and conclusions all wrong, but I don't want to think about the correct examples right now.

Concatenation is not commutative, right, but it still doesn't matter whether foldl or foldr is used, because concatenation is still associative.

Foldr "starts" from the right, right, but that's still the correct fold for infinite lists because the lazy processing starts to produce co-data from the "end" (outer scope). You can try with

foldr (:) [] [1..]
foldr (&&) True ([True,False] ++ repeat True) 

--TuukkaH 01:40, 27 August 2006 (UTC)[reply]

other high-order functions ?

Could someone add more HOFs into Wikipedia ? For example, filter is missing - http://en.wikipedia.org/wiki/Talk:Filter_%28software%29 For example, map is missed (mentioned, but not described anyhow) —The preceding unsigned comment was added by 212.176.32.19 (talk) 09:12, 15 May 2007 (UTC).[reply]

See Map (higher-order function). — Tobias Bergemann 08:46, 21 May 2007 (UTC)[reply]

Python

Should the article mention that Guido wants to remove reduce[1] from Python with the next great revision or would this be off topic? — Tobias Bergemann 11:46, 30 May 2007 (UTC)[reply]

This, of course, isn't the case. As indicated by the Python (3) example, reduce was moved to functools, not removed — Masklinn (talk) 13:15, 9 October 2009 (UTC)[reply]

Fold equivalent in Lisp/Scheme?

Is there a built-in function a la fold in Lisp or Scheme? If so, it should be named, of not, that should also be noted. —Preceding unsigned comment added by 172.179.150.144 (talk) 10:09, 30 October 2007 (UTC)[reply]

Data structures other than linkd lists

Shouldn't there be some discussion of how folds apply to other data structures than linked lists (trees, etc)? I don't really know enough to make the edits, but I'm sure I've seen something about folding trees somewhere. 79.72.112.167 (talk) 22:06, 3 February 2008 (UTC)[reply]

Well, that does fall under Catamorphism already... 99.247.248.73 (talk) 20:09, 9 August 2008 (UTC)[reply]

introduction

can someone rewrite it in the 'plain' language, which would be understandable to non technical people.

moving an example from the beginning 'Folds on lists' to the introduction would be nice.

216.80.119.92 (talk) 01:37, 23 August 2008 (UTC)[reply]