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

Pages: 1-

http://disc.420chan.org/nj/

Name: Anonymous 2010-02-04 16:24

ITT: /prog/ writes me the code needed for those snazzy drop down menus at the top

Name: Anonymous 2010-02-04 16:43

<?php
    snazzyDrop_down_atTheTop("http://dicks.com/", "Dicks", "http://cocks.com", "Cocks");
?>

Name: Anonymous 2010-02-04 16:45

This thread sucks, I will use it to recite some poetry

#lang scheme
(define generator%
  (class object%
    (init first)
    (define next-proc first)
    (super-new)
    (define (next-helper)
      (call-with-exception-handler (lambda (error)
                                     (when (string=? error "StopIteration")
                                       (set! next-helper (lambda () (raise "StopIteration"))))
                                     (raise error))
                                   (lambda ()
                                     (let* ((v (next-proc))
                                            (next (vector-ref v 1))
                                            (return-values (vector-ref v 0)))
                                       (set! next-proc next)
                                       (apply values return-values)))))
    (define/public (next) (next-helper))))

(define-syntax (generator stx)
  (syntax-case stx ()
    ((generator expr rest ...)
     (with-syntax ((yield (datum->syntax #'generator 'yield)))
       #'(new generator% (first
                          (lambda ()
                            (call/cc (lambda (escape)
                                       (let ((yield (lambda args
                                                      (call/cc (lambda (next)
                                                                 (escape (vector args next)))))))
                                         expr
                                         rest ...
                                         (raise "StopIteration")))))))))))

(define (make-fibonacci-generator)
  (generator
   (let loop ((x 0) (y 1))
     (yield x)
     (loop y (+ x y)))))

;; Examples
;> (define fibs (make-fibonacci-generator))
;> (send fibs next)
;0
;> (send fibs next)
;1
;> (send fibs next)
;1
;> (send fibs next)
;2
;> (send fibs next)
;3
;> (send fibs next)
;5
;> (send fibs next)
;8
;> (send fibs next)
;13
;> (send fibs next)
;21
;> (send fibs next)
;34
;> (send fibs next)
;55
;> (send fibs next)
;89
;> (send fibs next)
;144
;> (send fibs next)
;233
;> (send fibs next)
;377
;> (send fibs next)
;610

Name: Anonymous 2010-02-04 16:47

>>3
Now listen here jerkface! My thread doesnt suck! You have the time to write in your toy language but cant write me some actually useful HTML/CSS ?

Name: >>3 2010-02-04 18:13

If anyone is interested, you can add "send" to this by changing 3 lines of code, and adding 1. Which ones are left as an exercise.

>>4
Your thread does suck, and you don't get to complain since you don't seem to be able to code yourself.

Name: Anonymous 2010-02-04 18:15

>>5

<? php
@echo
#5 is an anus!

?>

I am an PHP programmer!

Name: Anonymous 2010-02-04 18:18

>>6
PHP is to programming, as drowning is to swimming.

Name: Anonymous 2010-02-04 18:38

>>7
Including comma splices in your sentence is to English as taking the head off is to a cow.

Name: Anonymous 2010-02-04 19:18

I'm sorry fellas, you seem to have stumbled into /prog/. Did you mean to click on /lounge/? Don't worry, it's not a problem. Just leave /prog/ and sage your thread on the way out; the door's on the left.

Name: Anonymous 2010-02-04 19:51

#lang scheme

(require scheme/control srfi/41)

(define-syntax-rule (generator body ...) ((stream-lambda () (reset body ... stream-null))))
(define (yield x) (shift k (stream-cons x (k))))

Name: Anonymous 2010-02-05 4:11

>>10
but that would have been too easy.

Name: Anonymous 2010-02-05 4:33

>>11
also, my intention was to mimic pythons generators.

Name: Anonymous 2010-02-05 4:42

Help me Froven Void!

Name: Anonymous 2010-02-05 4:46

>>13
Frozen Void is dead. His gaming forum is overrun by some bots and he stopped updating his blog.

Name: Anonymous 2010-02-05 4:52

>>14
oh noes!

Name: Anonymous 2010-02-05 8:35

lolol is ur FV ded

Name: Anonymous 2010-02-05 9:03

>>14
No surprise, his fursona clearly indicated suicidal tendencies.

Name: Anonymous 2010-02-05 19:24

>>17
You do realize that he stole the fursona from somewhere?

Name: Anonymous 2010-02-06 5:01

>>14-15
Laugh all you want each time FV dies he comes back more powerful than before.

Name: Anonymous 2010-02-07 11:57

>>19

It cannot be helped.

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