Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #35021
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Program or be Programmed ! |
| Date | 2014-12-19 08:20 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <m70n3m$vmk$1@dont-email.me> (permalink) |
| References | <98f287f7-fc54-4cd6-95c5-3c62100c89fd@googlegroups.com> <ce5mhdFctpU1@mid.individual.net> |
Paul E Bennett wrote:
> I was displaying a sine-wave of
> asterix characters scrolling continuously down the screen. 3 lines of code
> generated the sine-wave (and cosine) numbers and the other 30 or so lines
> did scaling and arrangements for its display. I was showing the source code
> in a separate window.
Gauche Scheme:
(define line-length 79)
(define mid-point (div line-length 2))
(define one-line (string-append
(make-string mid-point #\space) "|" (make-string mid-point #\space)))
(define (pause) (sys-nanosleep 5e7))
(let loop ((x 0.0))
(when (< x 22)
(let ((this-line (string-copy one-line))
(p (round->exact (+ mid-point (* mid-point (sin x))))))
(string-set! this-line p #\*)
(print this-line)
(pause))
(loop (+ 0.1 x))))
Partial output:
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
|*
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
|*
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
|*
| *
| *
| *
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Program or be Programmed ! visualforth@rocketmail.com - 2014-12-01 18:55 -0800
Re: Program or be Programmed ! Paul E Bennett <Paul_E.Bennett@topmail.co.uk> - 2014-12-02 11:36 +0000
Re: Program or be Programmed ! the_gavino_himself <visphatesjava@gmail.com> - 2014-12-13 12:47 -0800
Re: Program or be Programmed ! Paul E Bennett <Paul_E.Bennett@topmail.co.uk> - 2014-12-13 20:54 +0000
Re: Program or be Programmed ! visualforth@rocketmail.com - 2014-12-17 16:51 -0800
Re: Program or be Programmed ! "WJ" <w_a_x_man@yahoo.com> - 2014-12-19 08:20 +0000
Re: Program or be Programmed ! Paul E Bennett <Paul_E.Bennett@topmail.co.uk> - 2014-12-19 09:29 +0000
Re: Program or be Programmed ! "WJ" <w_a_x_man@yahoo.com> - 2015-03-27 07:57 +0000
Re: Program or be Programmed ! "WJ" <w_a_x_man@yahoo.com> - 2014-12-25 21:08 +0000
csiph-web