[HN Gopher] Fancy Defines
       ___________________________________________________________________
        
       Fancy Defines
        
       Author : todsacerdoti
       Score  : 15 points
       Date   : 2021-03-18 10:31 UTC (1 days ago)
        
 (HTM) web link (idiomdrottning.org)
 (TXT) w3m dump (idiomdrottning.org)
        
       | nerdponx wrote:
       | Interesting, I didn't know about this at all. Is it _that_ common
       | in Scheme to write functions that immediately return other
       | functions? Seems like an oddly  "blessed" usage of syntax that
       | IMO could be better used for something like pattern matching.
       | 
       | Looking at this example from the linked SRFI [0]:
       | (define ((greet-with-prefix prefix) suffix)           (string-
       | append prefix " " suffix))              (define greet (greet-
       | with-prefix "Hello"))              (greet "there!") => "Hello
       | there!"
       | 
       | I'm not convinced that this is anything but an obfuscation,
       | compared to the standard R5RS version:                   (define
       | (greet-with-prefix suffix)           (lambda (prefix)
       | (string-append prefix " " suffix)))              (define greet
       | (greet-with-prefix "Hello"))              (greet "there!") =>
       | "Hello there!"
       | 
       | What do the experienced Schemers think?
       | 
       | [0]: https://srfi.schemers.org/srfi-219/srfi-219.html
        
       ___________________________________________________________________
       (page generated 2021-03-19 23:02 UTC)