higher-order-functions
difference between foldLeft and reduceLeft in Scala
I have learned the basic difference between foldLeft and reduceLeft foldLeft: initial value has to be passed[详细]
2023-04-13 03:21 分类:问答Using constructor where function expected
Having two simple classes taking Int as an a开发者_JAVA技巧rgument: case class Foo(i: Int) class Bar(j: Int)[详细]
2023-04-12 03:19 分类:问答reversing a list in OCaml using fold_left/right
UPDATE - Solution Thanks to jacobm for his help, I came up with a solution. // Folding Recursion let reverse_list_3 theList =[详细]
2023-04-04 16:51 分类:问答I'm trying to write a general function for adding/multiplying terms in a sequence
I\'m trying to write a function with 4 arguments in python def sequence(operation, sta开发者_StackOverflowrt, n, term):[详细]
2023-04-04 05:43 分类:问答Product of first n terms in a sequence in python
I\'m trying to create a function that takes one argument (a number) and returns the factorial of that number.[详细]
2023-04-03 22:49 分类:问答How to repeat a function n times
I开发者_如何学JAVA\'m trying to write a function in python that is like: def repeated(f, n): ... where f is a function that takes one argument and n is a positive integer.[详细]
2023-04-03 22:17 分类:问答passing in block to method in Ruby
I would like to pass in an generated(higher order function)to a method to a ruby method . Something like this[详细]
2023-04-03 03:51 分类:问答Unsure of how to design a useful library using combinators
I\'ve been reading about combinators and seen how useful they are (for example, in Haskell\'s Parsec).My problem is that I\'m not quite sure how to use them practically.[详细]
2023-03-28 06:51 分类:问答Why does fold have the following type in Scala?
I was lo开发者_StackOverflow社区oking at the way fold is defined for immutable.Set: def fold [A1 >: A] (z: A1)(op: (A1, A1) ⇒ A1): A1[详细]
2023-03-26 20:44 分类:问答In Perl, what is the most reliable way to determine a coderef's package?
I have a number of higher order utility functions that take in a code reference and apply that code to some data.Some of these functions require localizing variables during the execution of the subrou[详细]
2023-03-19 23:21 分类:问答