Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #60717
| From | "Robert L." <No_spamming@noWhere_7073.org> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Rosetta: Van der Corput sequence |
| Date | 2017-06-14 10:57 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <ohr4rc$88f$1@gioia.aioe.org> (permalink) |
(use streams) (use streams-math) (define base 2) (define powers (stream-iterate (cut * base <>) base)) (define (digits n) (stream-unfold (cut modulo <> base) positive? (cut quotient <> base) n)) (define (vdc n) (stream-sum (stream-map / (digits n) powers))) (define vdc-stream (stream-map vdc (stream-from 0))) (stream->list 12 vdc-stream) ===> (0 0.5 0.25 0.75 0.125 0.625 0.375 0.875 0.0625 0.5625 0.3125 0.8125) In Forth? -- I wrote until my fingers were blue, over and over: "Political Correctness is a religion." I proved it and showed you why it is so important that Political Correctness is a religion. --- Bob Whitaker
Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread
Rosetta: Van der Corput sequence "Robert L." <No_spamming@noWhere_7073.org> - 2017-06-14 10:57 +0000
csiph-web