Questions tagged [pointfree]

The pointfree (also called pointless) style of defining a function is to express it directly in terms of existing functions, without mentioning the arguments of the function being defined. Function composition and partial application are often used.

The pointfree (also called pointless) style of defining a function is to express it directly in terms of existing functions (regarded as combinators), without mentioning the arguments of the function being defined. Function composition and partial application are often used.

See also .

292 questions
0
votes
1 answer

Haskell: Point-free style

Why does the first one fails while the latter one succeeds in compilation? I expect foo and foo' are equivalent, that is, foo' is just a point-free function of foo: foo :: [a] -> [a] -> [(a,a)] foo = map id . zip foo' :: [a] -> [a] -> [(a,a)] foo'…
Chul-Woong Yang
  • 1,223
  • 10
  • 17
0
votes
0 answers

Trouble with a Point Free Representation in Haskell

Trying understand an error message I got from a line of Haskell I wrote. I changed f x = map digitToInt $ show x to f = \x -> map digitToInt (show x) = (map digitToInt).(\x -> show x) = (map digitToInt).show and got the following error message…
Tshimanga
  • 845
  • 6
  • 16
0
votes
2 answers

Haskell utility to make function point free

I'd like to quickly and correctly reduce functions to point free form in Haskell. I'd prefer to produce fairly readable outcomes. How should I go about this?
sof
  • 9,113
  • 16
  • 57
  • 83
0
votes
2 answers

Point free style in haskell

I'm trying to change function (x:xs) = unwords (map reverse (words (x:xs))) into point free style, and I can't do this. isn't it simply function = unwords . map . reverse . words Please help me to change this to point free style. I tried to use…
0
votes
2 answers

How to implement the list filter function in F# using primitives

I was reading Why functional programming matters where the author implements a couple of applications using foldr and function composition. I did the some of them in F# e.g. the map function: let cons a lst = a::lst let map f lst = List.foldBack…
Christian
  • 7,433
  • 4
  • 36
  • 61
-2
votes
2 answers

Recursively calling a curried function in Javascript

As a toy example lets say we have this function and its usage: const map = (f = n => n + 1) => (lst = [1,2,3]) => { if(lst.length === 0) return []; else return [f(...lst.splice(0,1)), ...map(f)(lst)]; } const inc = n => n +…
SultanLegend
  • 535
  • 3
  • 11
-12
votes
4 answers

How to write this function in point-free style?

How to rewrite the following function in point-free style, removing the parameter x from the definition completely (the other two may stay): between min max x = (min < x) && (x < max) This is not an assignment, just a question. I don't know how to…
1 2 3
19
20