
CLHS: Function REDUCE - Lisp
reduce uses a binary operation, function, to combine the elements of sequence bounded by start and end. The function must accept as arguments two elements of sequence or the results from combining those elements .
reduce | Common Lisp (New) Language Reference
reduce uses a binary operation, function, to combine the elements of sequence bounded by start and end. The function must accept as arguments two elements of sequence or the results from combining those elements. The function must also be able to accept no arguments. If key is supplied, it is used is used to extract the values to reduce.
第四章:特殊数据结构 — ANSI Common Lisp 中文版
函数 reduce 用来把序列压缩成一个值。它至少接受两个参数,一个函数与序列。函数必须是接受两个实参的函数。
map-reduce in common lisp - Alex木头 - 博客园
2012年6月6日 · ;;(reduce function list) ;; reduce让一个指定的函数(function)作用于列表的第一个元素和第二个元素,然后在作用于上步得到的结果和第三个元素,直到处理完列表中所有元素。
Simplified Common Lisp reference - reduce - jtra.cz
REDUCE applies function fn to its previous result and next element. The result is what fn returned in last call. For the first call fn is called with either initial-value and first element or first two elements.
在Common Lisp中,“Reduce”和“Fold”的区别 - 偏执的码农
在Common Lisp编程中,reduce和fold是两种非常有用的函数,它们可以帮助我们更轻松地计算序列中的元素。 虽然它们在实现方式上有所不同,但它们都可以用于相同的目的。
Reducing in Common Lisp on Exercism
Reducing is the repeated application of a function to each element of a sequence and accumulating, in some way, the results. The function applied takes two parameters: the current accumulated value and the item to process. It must evaluate to the new accumulated value. This is called accumulate or fold in some programming languages.
list - Common lisp: How to implement reduce - Stack Overflow
2017年1月24日 · Left fold can be implemented with a simple iteration: (loop for fold = initial then (funcall reducer fold element) for element in list. finally (return fold))) For example: ((((0 . 1) . 2) . 3) . 4) You can generalize and fold over vectors too if you use map: (map nil. (lambda (e) (setf fold (funcall reducer fold e))) sequence) fold)
Lists | Common Lisp
The reduce function can be used to turn a list into a scalar, by applying a function on successive subsets of the list. For instance: You can also use a custom function: The above is equivalent to (* 10 (* 20 (* 30))). To get a better understanding of how reduce works, we can use format: The sort function allows you to sort a sequence:
lisp - Practical use of fold/reduce in functional languages
2011年3月18日 · fold/reduce is the general version of the "cdr-ing down a list" pattern. Each algorithm that's about processing every element of a sequence in order and computing some return value from that can be expressed with it.