Thanks for the screenshot Travis. Just for fun, here's a version in Racket that eschews assignment, vectors and for loops, in favour of recursion and lists ...
#lang racket (define years 30) (define prop-female 0.5) (define egg-surv 0.6) (define fecundity '(0 0 200 400 800)) (define survival '(0.2 0.4 0.6 0.8 0)) (define capacity '(1e6 1e5 1e4 1e3 1e2 -9999)) (define cap0 (first capacity)) (define (beverton-holt N p c) (/ N (+ (/ 1 p) (/ N c)))) (define (evolve N [f fecundity] [s survival] [cap (rest capacity)] [Nt0 0] [Nt null]) (if (null? f) (cons Nt0 (reverse Nt)) (evolve (rest N) (rest f) (rest s) (rest cap) (+ Nt0 (if (= (first f) 0) 0 (beverton-holt (* (first N) prop-female) (* (first f) egg-surv) (- cap0 Nt0)))) (if (= (first s) 0) Nt (cons (beverton-holt (first N) (first s) (first cap)) Nt))))) (define (iterate N n [i 1]) (displayln (list i N)) (unless (= i n) (iterate (evolve N) n (+ i 1)))) (iterate (make-list (length fecundity) 10) years) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.