Advertisement
stobix

crawling factorial function with no variables

Jan 17th, 2013
366
0
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))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement