News for hackers. Stuff that matters.
Re:Concatenation is composition by tromp on Monday July 18, 2022 @03:03AM (#32135527)
The given Haskell example doesn't support their claim that

> This is shorter than the equivalent in an applicative language, because we have to name the input argument, that is only used once.

It's also wrong in that the predicate (4 >) is equivalent to (\x -> 4 > x) and thus tests for numbers being less than 4.

It's strange to argue that concatenation is structurally simpler than application, when you then need to add a quoting operator to add back the needed structure, while introducing a subtle distinction between evaluated and unevaluated code.

Re:Concatenation is composition by voxl on Monday July 18, 2022 @10:59AM (#32139158)
But there is a strong benefit to adding quotation: higher-order programming becomes explicit, and you can restrict it to prevent the need for garbage collectors.

"Linear-style" programming becomes obvious to implement in a point-free style, but obtuse when you have variables, adding arbitrary usage restrictions.

Re:Concatenation is composition by yakubin on Monday July 18, 2022 @04:59AM (#32136076)
> The given Haskell example doesn't support their claim that

>> This is shorter than the equivalent in an applicative language, because we have to name the input argument, that is only used once.*

Are you saying that in your eyes the Common Lisp and Haskell snippets are equally terse? To me the Haskell snippet looks a lot shorter and easier to read. Counting tokens also supports that judgement.

Re:Concatenation is composition by simiones on Monday July 18, 2022 @05:49AM (#32136344)
The article seemed to be claiming that the Factor example was shorter than both the CL and Haskell ones. While the CL one is clearly the longest, the Haskell example seems at least as terse as the Factor example (`( 4 > )` in Haskell, vs `[ 4 > ]` in Factor - not sure if the parens in Haskell and the square brackets in Factor have the same amount of semantic weight though).
Re:Concatenation is composition by yakubin on Monday July 18, 2022 @05:54AM (#32136378)
Oh, got it. I got confused, because the Haskell snippet is written in a point-free, not applicative style.
Re:Concatenation is composition by marcosdumay on Monday July 18, 2022 @12:05PM (#32139880)
Personally, I attribute more "semantic weight" to the brackets in Factor. They have a much heavier definition of creating a lambda than Haskell's parenthesis, that only group operations.

(But I'm not sure if I prefer terseness to that level. Explicitness has value too.)

Re:Concatenation is composition by dreamcompiler on Monday July 18, 2022 @11:16AM (#32139336)
The Common Lisp example is a tiny bit disingenuous. Common Lisp programmers rarely write

  (function evenp)
but instead write the shorthand version

  #'evenp
Re:Concatenation is composition by Jtsummers on Monday July 18, 2022 @01:05PM (#32140597)
Also, Common Lisp has a complement function which produces a new Boolean function with the negation of the result:

  (complement #'evenp)
vs the example:

  (lambda (n) (not (evenp n)))
Not much shorter by character count, but it is shorter by token count.

http://clhs.lisp.se/Body/f_comple.htm