{"size": 755, "ext": "scrbl", "max_stars_repo_path": "scribblings/Y-combinator.scrbl", "max_stars_repo_name": "Hectarea1996/Y-combinator", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scribblings/Y-combinator.scrbl", "max_issues_repo_name": "Hectarea1996/Y-combinator", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scribblings/Y-combinator.scrbl", "max_forks_repo_name": "Hectarea1996/Y-combinator", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.8787878788, "max_line_length": 96, "alphanum_fraction": 0.5695364238}
#lang scribble/manual

@(require (for-label racket/base
                     Y-combinator))


@title{Y-combinator}

@author[(author+email "Héctor Galbis Sanchis" "hectometrocuadrado@gmail.com")]

@defmodule[Y-combinator]

Ejemplo de implementación en Racket del combinador de punto fijo Y.

@defproc[(Y [proc procedure?])
         procedure?]{
    
   Tiene el mismo comportamiento que el combinador de punto fijo descubierto por Haskell Curry.

   @#reader scribble/comment-reader
   (racketblock
      (define (fact-step supply-k)
         (lambda (n)
            (if (zero? n)
               1
               (* n ((supply-k) (sub1 n))))))
            
      (define fact (Y fact-step))

      (fact 5) ;; -> 120
   )

}