Elementary cellular automaton/Infinite length: Difference between revisions

m
→‎{{header|Racket}}: Brackets; indentation; fix link.
(Updated D entry)
m (→‎{{header|Racket}}: Brackets; indentation; fix link.)
Line 168:
=={{header|Racket}}==
 
Uses solution to [[Elementary cellular automataautomaton]] saved in file "Elementary_cellular_automata.rkt"
 
<lang racket>#lang racket
Line 190:
(define v-out
(for/fxvector
#:length (fx+ vl-1+ 1) #:fill 0 ; this provides suitable right padding
(([f (in-sequences l-sequence (in-fxvector v-in)))) f)])
f))
(values v-out vl-1+ offset-)]))
 
(module+ main
(define ng/90/infinite (CA-next-generation 90 #:wrap-rule wrap-rule-infinite))
(for/fold (([v (fxvector #b10000000000000000000))]
([o 1)]) ; start by pushing output right by one
(([step (in-range 40))])
(show-automaton v #:step step #:push-right o)
(newline)