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

Pages: 1-

Continued Fractions

Name: Anonymous 2009-05-29 20:56

(define collapse-cf
  (λ(rep)
    (let ((local-rep (reverse rep)))
      (define collapse
        (λ(accum x)
          (if (empty? (cdr x))
              (+ (car x) (/ 1 accum))
              (collapse (+ (car x) (/ 1 accum)) (cdr x)))))
      (collapse (car local-rep) (cdr local-rep))))))

The continued fraction of (1; 1) is the golden mean.

The continued fraction of (1; 2) is the square root of 2.

The continued fraction (88888888; 88888888) is just 88888888.

YOU CALL CARE

Name: Anonymous 2009-05-29 21:13

holy shit

Name: OP 2009-05-29 21:17

The continued fraction (88888888; 88888888) is just 88888888.
This is a lie.

Name: OP 2009-05-29 21:51

>>3
This is a lie.
This is a lie.

Name: OP 2009-05-30 0:55

holy shit
This is a lie.

Name: Anonymous 2009-05-30 3:21

1) awful indentation
2) redundant lambda expressions
3) λ is dumb to use

Name: Anonymous 2009-05-30 3:45

>>6
4) define form where a second let entry would suffice.

Name: Anonymous 2009-05-30 10:00

>>6
redundant
I do not think this word means what you think it means.
>>7
define form where a second let...
Would have to be letrec. I personally think it is clearer when let binds variables and defines bind functions because let-binding of complicated expressions looks like shit, but I guess it would please >>6's PIG DISGUSTING sense of indentation.

Name: Anonymous 2009-05-30 10:55

λ.....

Name: Anonymous 2009-05-30 22:37

>>8
I'm sure my definition is common and I'm sure your code is redundant. Isn't it redundant when you prefer (define id (lambda (x) x)) to (define (id x) x)?

The point of lisp is to make the most use of its expressiveness, else you're crippling your code.

but I guess it would please >>6's PIG DISGUSTING sense of indentation.

Buttfuckinghurt.

Name: Anonymous 2009-05-31 1:40

>>10
you're
You won't troll me today, Anonymous.

Name: Anonymous 2009-05-31 1:48

Scheme's use of DEFINE is pig disgusting and unlispy. Who the hell creates a form that injects a binding into the lexical scope that the binding form exists in? This isn't C.

Name: Anonymous 2009-05-31 1:57

>>12
This isn't C.
You say that like its a good thing.

Name: Anonymous 2009-05-31 3:19

>>13
Indubitably it is.

Name: Anonymous 2009-05-31 12:16

>>10
The point of lisp is to make the most use of its expressiveness, else you're crippling your code.

As I said, I personally think it is clearer when let binds variables and defines bind functions because let-binding of complicated expressions looks like shit.

The lambda syntax is a straightforward translation into English. ``Define collapse-cf to be a function that takes a single argument.'' The alternative use of
(define (collapse-cf a-list) ...) is not so straightforward. Thus, I am making the most of its expressiveness.

Name: Anonymous 2010-11-14 10:43

Name: Anonymous 2010-11-15 1:01

Name: Anonymous 2010-11-25 11:55

Name: Anonymous 2010-11-28 6:52

Name: Anonymous 2010-12-23 4:14

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