Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Is this Satori or Zen?

Name: Anonymous 2009-02-01 9:15

CPS in 3 lines of code

(define (apply# f . args) (shift k (let ((g (gensym "g"))) (reset `(,f ,@args (lambda (,g) ,(k g)))))))
(define-syntax if# (syntax-rules () ((if# <cond> <then> <else>) (shift k `(if ,<cond> ,(reset (k <then>)) ,(reset (k <else>)))))))
(define-syntax define# (syntax-rules () ((define# (name/args ...) body) `(define (name/args ... k-->) ,(reset `(k--> ,body))))))


(define# (fact-iter--> n acc)
;;     (if# (apply# 'zero?--> 'n)
;;          'acc
;;          (apply# 'fact-iter--> (apply# '---> 'n 1) (apply# '*--> 'acc 'n))))
(define (fact-iter--> n acc k-->)
  (zero?--> n (lambda (g875)
   (if g875
       (k--> acc)
       (---> n 1 (lambda (g876)
        (*--> acc n (lambda (g877)
         (fact-iter--> g876 g877 (lambda (g878) (k--> g878)))))))))))

Is this Satori or Zen?

Name: Anonymous 2009-02-01 9:49

)))))))
)))))))
))))))
)))))))))))

This... IS... MADNEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSS!!

Name: Anonymous 2009-02-01 9:56

I'M SRFI 72
SON OF A BITCH GENSYM
GENSYM IS PIG
DO YOU WANT DYNAMIC SCOPE?
DO YOU WANT NO SHADOWING?
GENSYM IS PIG DISGUSTING
X3J13 IS A MURDERER
FUCKING GENSYM

Name: Anonymous 2009-02-01 10:51

what is SRFI 72?

Name: Anonymous 2009-02-01 11:06

Name: Anonymous 2009-02-01 18:48

>>5
thank you

Name: Anonymous 2009-02-01 19:00

>>5
YOU HELPED HIM!

Name: Anonymous 2009-02-01 23:14

what are reset and shift?

Name: Anonymous 2009-02-02 0:09

>>5-7
loled

>>8
continuations witchcraft, don't even try to understand them until you've reached satori.

Name: Anonymous 2009-02-02 1:21

>>8
goto

Name: Anonymous 2009-02-02 11:22

>>10
people who think continuations are like gotos don't understand continuations

Name: Anonymous 2009-02-02 18:05

lol

Name: Anonymous 2009-02-02 18:09

people who think gotos are like continuations don't understand gotos

Name: Anonymous 2009-02-02 18:30

people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand people who think gotos are like gotos don't understand

(Post truncated.)

Name: Anonymous 2009-02-02 18:56

>>14
Was anyone else retarded enough to try and click on the "Post truncated"?

Name: Anonymous 2009-02-02 19:00

>>15
No.

Name: Anonymous 2009-02-02 19:04

>>16
¡¡¡I was!!!

Name: Anonymous 2009-02-02 23:34

>>11
You can use shift/reset to create a mess of such complexity and inscrutability that it will make even best spaghetti experts of goto look dull.

Name: Anonymous 2009-02-03 7:41

>>18
This is why Lisp programmers love continuations and sneer at C.

Name: Anonymous 2009-06-25 14:10

>>19
no you

Name: FrozenVoid 2009-06-25 16:09

>>18 A normal Goto btw is block oriented, its the goto line X and computed gotos that are bad.



______________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
orbis terrarum delenda est

Name: Anonymous 2009-06-25 20:31

>>21
Don't post

Name: Anonymous 2010-11-26 3:48

Don't change these.
Name: Email:
Entire Thread Thread List