Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #37054

Re: Pascal's Triangle

From Ron Aaron <rambamist@gmail.com>
Newsgroups comp.lang.forth
Subject Re: Pascal's Triangle
Date 2015-03-06 15:15 +0200
Organization A noiseless patient Spider
Message-ID <mdc991$8rr$1@dont-email.me> (permalink)
References <mdbbd1$271$1@dont-email.me>

Show all headers | View raw



On 3/6/15 06:45, WJ wrote:
> Print the first 16 rows of Pascal's Triangle.
> 
> Gauche Scheme:
> 
> (let1 row '(1)
>   (dotimes (16)
>     (print ((#/.(.*)./ (x->string row)) 1))
>     (set! row (map + (cons 0 row) `(,@row 0)))))

In 8th:

[1] ( ( . space ) a:each cr
  dup [0] 0 a:insert swap 0 a:push
  ' n:+ a:op ) 16 times

> Let's see a shorter Forth version.

My version is 82 bytes, yours is 113.  Of course I would normally have
comments etc...

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Pascal's Triangle "WJ" <w_a_x_man@yahoo.com> - 2015-03-06 04:45 +0000
  Re: Pascal's Triangle Melzzzzz <mel@zzzzz.com> - 2015-03-06 07:32 +0100
    Re: Pascal's Triangle Richard Todd <richard.wesley.todd@gmail.com> - 2015-03-05 22:59 -0800
  Re: Pascal's Triangle november.nihal@gmail.com - 2015-03-06 02:24 -0800
    Re: Pascal's Triangle Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-03-06 22:30 +0000
  Re: Pascal's Triangle franck.bensusan@gmail.com - 2015-03-06 04:48 -0800
  Re: Pascal's Triangle Ron Aaron <rambamist@gmail.com> - 2015-03-06 15:15 +0200
  Re: Pascal's Triangle "WJ" <w_a_x_man@yahoo.com> - 2015-03-19 05:14 +0000

csiph-web