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

Scheme++

Name: Anonymous 2012-06-16 15:57

I'm implementing Scheme dialect with OOP, default argument values and some other features. How readable is it for you?

(define (fib n (memo . #{ (0 . 1) (1 . 1) }))
  (let ((memoized (: memo get n)))
    (if memoized (cdr memoized)
        (let ((result (+ (fib (- n 1)) (fib (- n 2)))))
          (: memo set! (n . result))
          result))))

Name: Anonymous 2012-06-20 0:40

>>27
Damn, I completely forgot about functional part while thinking about OOP implementation. Yes, it is better to evaluate method name for more flexibility and consistency at the same time.
But the quote in this place still annoys me. May it be better to replace quoted symbol with self-evaluating atom?

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