SHARE
TWEET

crawling factorial function with no variables

stobix Jan 17th, 2013 141 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (define (f)
  2.   (begin
  3.     (while (> (length f) 2) (pop f -1))
  4.     (push
  5.       '(if (> 0 1)
  6.          (begin        
  7.            (setf ((last f) -1) (* $it ((last f) 1 1))) ;; Increase return value
  8.            (dec ((last f) 1 1)) ;; Change exit condition
  9.            (if (> (length f) 4) ;; Shorten the function if it's too long
  10.              (pop f 2))                                        
  11.            (push (last f) f -1))
  12.          1)                                                              
  13.       f -1)                                                          
  14.     (setq ((last f) 1 1) (args 0))))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top