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


Groups > comp.lang.forth > #43605 > unrolled thread

Re: Simple fractal

Started by"WJ" <w_a_x_man@yahoo.com>
First post2015-11-20 19:51 +0000
Last post2015-11-26 17:13 +0000
Articles 8 — 5 participants

Back to article view | Back to comp.lang.forth

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Simple fractal "WJ" <w_a_x_man@yahoo.com> - 2015-11-20 19:51 +0000
    Re: Simple fractal Mux <Yvo.Zoer@gmail.com> - 2015-11-20 12:44 -0800
      Re: Simple fractal Michael Barry <barrym95838@yahoo.com> - 2015-11-20 22:44 -0800
        Re: Simple fractal Paul Rubin <no.email@nospam.invalid> - 2015-11-20 22:51 -0800
        Re: Simple fractal hughaguilar96@gmail.com - 2016-01-13 19:18 -0800
    Re: Simple fractal "WJ" <w_a_x_man@yahoo.com> - 2015-11-21 15:09 +0000
    Re: Simple fractal "WJ" <w_a_x_man@yahoo.com> - 2015-11-26 16:12 +0000
      Re: Simple fractal "WJ" <w_a_x_man@yahoo.com> - 2015-11-26 17:13 +0000

#43605 — Re: Simple fractal

From"WJ" <w_a_x_man@yahoo.com>
Date2015-11-20 19:51 +0000
SubjectRe: Simple fractal
Message-ID<n2ntkg$70a$1@dont-email.me>
WJ wrote:

> WJ wrote:
> 
> > Ruby:
> > 
> > def neighbors( line, i )
> >   [i-1, i+1].select{|n| n >= 0  and  n < line.size}.
> >     count{|i|  line[i,1] != " "}
> > end
> > 
> > def next_line( old_line, cycles )
> >   return  unless cycles > 0
> >   puts old_line
> >   line = " " * old_line.size
> >   line.size.times{|i| line[i] = " * "[ neighbors( old_line, i ) ] }
> >   next_line( line, cycles - 1 )
> > end
> > 
> > line = " " * 79  ;  line[ line.size/2 ] = "*"
> > next_line( line, 40 )
> > 
> > 
> >                                        *
> >                                       * *
> >                                      *   *
> >                                     * * * *
> >                                    *       *
> >                                   * *     * *
> >                                  *   *   *   *
> >                                 * * * * * * * *
> >                                *               *
> >                               * *             * *
> >                              *   *           *   *
> >                             * * * *         * * * *
> >                            *       *       *       *
> >                           * *     * *     * *     * *
> >                          *   *   *   *   *   *   *   *
> >                         * * * * * * * * * * * * * * * *
> >                        *                               *
> >                       * *                             * *
> >                      *   *                           *   *
> >                     * * * *                         * * * *
> >                    *       *                       *       *
> >                   * *     * *                     * *     * *
> >                  *   *   *   *                   *   *   *   *
> >                 * * * * * * * *                 * * * * * * * *
> >                *               *               *               *
> >               * *             * *             * *             * *
> >              *   *           *   *           *   *           *   *
> >             * * * *         * * * *         * * * *         * * * *
> >            *       *       *       *       *       *       *       *
> >           * *     * *     * *     * *     * *     * *     * *     * *
> >          *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
> >         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> >        *                                                               *
> >       * *                                                             * *
> >      *   *                                                           *   *
> >     * * * *                                                         * * * *
> >    *       *                                                       *       *
> >   * *     * *                                                     * *     * *
> >  *   *   *   *                                                   *   *   *   *
> > * * * * * * * *                                                 * * * * * * * *

def new_cell i, line
  n = [i-1,i+1].grep(0...line.size).map{|j| line[j]}.
    count{|c| c!=" "}
  " * "[n]
end

def new_line line
  new = line.dup
  new.size.times{|i| new[i] = new_cell(i, line)}
  new
end

line = " " * 79  ;  line[ line.size/2 ] = "*"
puts line ;
(puts line = new_line(line)) until " " != line[0]

[toc] | [next] | [standalone]


#43606

FromMux <Yvo.Zoer@gmail.com>
Date2015-11-20 12:44 -0800
Message-ID<df733034-7948-43f9-83c6-eb783a98f9bf@googlegroups.com>
In reply to#43605
On Friday, November 20, 2015 at 11:54:08 AM UTC-8, WJ wrote:
> WJ wrote:
> 
> > WJ wrote:
> > 
> > > Ruby:
> > > 
> > > def neighbors( line, i )
> > >   [i-1, i+1].select{|n| n >= 0  and  n < line.size}.
> > >     count{|i|  line[i,1] != " "}
> > > end
> > > 
> > > def next_line( old_line, cycles )
> > >   return  unless cycles > 0
> > >   puts old_line
> > >   line = " " * old_line.size
> > >   line.size.times{|i| line[i] = " * "[ neighbors( old_line, i ) ] }
> > >   next_line( line, cycles - 1 )
> > > end
> > > 
> > > line = " " * 79  ;  line[ line.size/2 ] = "*"
> > > next_line( line, 40 )
> > > 
> > > 
> > >                                        *
> > >                                       * *
> > >                                      *   *
> > >                                     * * * *
> > >                                    *       *
> > >                                   * *     * *
> > >                                  *   *   *   *
> > >                                 * * * * * * * *
> > >                                *               *
> > >                               * *             * *
> > >                              *   *           *   *
> > >                             * * * *         * * * *
> > >                            *       *       *       *
> > >                           * *     * *     * *     * *
> > >                          *   *   *   *   *   *   *   *
> > >                         * * * * * * * * * * * * * * * *
> > >                        *                               *
> > >                       * *                             * *
> > >                      *   *                           *   *
> > >                     * * * *                         * * * *
> > >                    *       *                       *       *
> > >                   * *     * *                     * *     * *
> > >                  *   *   *   *                   *   *   *   *
> > >                 * * * * * * * *                 * * * * * * * *
> > >                *               *               *               *
> > >               * *             * *             * *             * *
> > >              *   *           *   *           *   *           *   *
> > >             * * * *         * * * *         * * * *         * * * *
> > >            *       *       *       *       *       *       *       *
> > >           * *     * *     * *     * *     * *     * *     * *     * *
> > >          *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
> > >         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > >        *                                                               *
> > >       * *                                                             * *
> > >      *   *                                                           *   *
> > >     * * * *                                                         * * * *
> > >    *       *                                                       *       *
> > >   * *     * *                                                     * *     * *
> > >  *   *   *   *                                                   *   *   *   *
> > > * * * * * * * *                                                 * * * * * * * *
> 
> def new_cell i, line
>   n = [i-1,i+1].grep(0...line.size).map{|j| line[j]}.
>     count{|c| c!=" "}
>   " * "[n]
> end
> 
> def new_line line
>   new = line.dup
>   new.size.times{|i| new[i] = new_cell(i, line)}
>   new
> end
> 
> line = " " * 79  ;  line[ line.size/2 ] = "*"
> puts line ;
> (puts line = new_line(line)) until " " != line[0]

So do you hang out in other language newsgroups too and post ruby code snippets? Just curious...

-Mux

[toc] | [prev] | [next] | [standalone]


#43607

FromMichael Barry <barrym95838@yahoo.com>
Date2015-11-20 22:44 -0800
Message-ID<29d0b94e-bdb3-4356-8984-a08e3f55e930@googlegroups.com>
In reply to#43606
On Friday, November 20, 2015 at 12:44:47 PM UTC-8, Mux wrote:
> ...
> So do you hang out in other language newsgroups too and post
> ruby code snippets? Just curious...
> 
> -Mux

When I search usenet for "WJ" from the Google Groups angle, I get
 39215 results spread over 104 groups.  The results are mostly in
 fetish groups and involve sexually explicit topics.

Mike B.

[toc] | [prev] | [next] | [standalone]


#43608

FromPaul Rubin <no.email@nospam.invalid>
Date2015-11-20 22:51 -0800
Message-ID<87wptbkfq3.fsf@nightsong.com>
In reply to#43607
Michael Barry <barrym95838@yahoo.com> writes:
> When I search usenet for "WJ" from the Google Groups angle, I get
>  39215 results spread over 104 groups.  The results are mostly in
>  fetish groups and involve sexually explicit topics.

In that case I'm surprised he uses Ruby instead of the so-called
bondage-and-discipline languages ;-).

[toc] | [prev] | [next] | [standalone]


#44853

Fromhughaguilar96@gmail.com
Date2016-01-13 19:18 -0800
Message-ID<3400ce3a-5391-4879-8421-7870b08496be@googlegroups.com>
In reply to#43607
On Friday, November 20, 2015 at 11:44:42 PM UTC-7, Michael Barry wrote:
> On Friday, November 20, 2015 at 12:44:47 PM UTC-8, Mux wrote:
> > ...
> > So do you hang out in other language newsgroups too and post
> > ruby code snippets? Just curious...
> > 
> > -Mux
> 
> When I search usenet for "WJ" from the Google Groups angle, I get
>  39215 results spread over 104 groups.  The results are mostly in
>  fetish groups and involve sexually explicit topics.
> 
> Mike B.

Maybe he posts Ruby and Gauche-Scheme code in the fetish forums too! lol

I don't know if that is the same WJ in those groups. I do know however that WJ here on c.l.f. often puts a tagline after his posts that contains a quote describing a rape. For a while he was describing rapes of white women committed by American Indians in the 19th century, but now he seems to always describe rapes committed by Moslems on 11 and 12 year old girls. All this stuff is likely just propaganda --- anyway, it is not appropriate on comp.lang.forth..

John Passaniti openly discussed masturbation and gay group sex on comp.lang.forth --- Elizabeth Rather and Bernd Paysan praised him continually as a great ANS-Forth programmer, despite the fact that he posted as much ANS-Forth code as WJ does (none) --- if WJ began praising ANS-Forth rather than calling it a toy language suitable only for automatic toilet-flushers, Elizabeth and Bernd would begin praising him too.

[toc] | [prev] | [next] | [standalone]


#43614

From"WJ" <w_a_x_man@yahoo.com>
Date2015-11-21 15:09 +0000
Message-ID<n2q1f7$o18$1@dont-email.me>
In reply to#43605
WJ wrote:

> WJ wrote:
> 
> > WJ wrote:
> > 
> > > Ruby:
> > > 
> > > def neighbors( line, i )
> > >   [i-1, i+1].select{|n| n >= 0  and  n < line.size}.
> > >     count{|i|  line[i,1] != " "}
> > > end
> > > 
> > > def next_line( old_line, cycles )
> > >   return  unless cycles > 0
> > >   puts old_line
> > >   line = " " * old_line.size
> > >   line.size.times{|i| line[i] = " * "[ neighbors( old_line, i ) ] }
> > >   next_line( line, cycles - 1 )
> > > end
> > > 
> > > line = " " * 79  ;  line[ line.size/2 ] = "*"
> > > next_line( line, 40 )
> > > 
> > > 
> > >                                        *
> > >                                       * *
> > >                                      *   *
> > >                                     * * * *
> > >                                    *       *
> > >                                   * *     * *
> > >                                  *   *   *   *
> > >                                 * * * * * * * *
> > >                                *               *
> > >                               * *             * *
> > >                              *   *           *   *
> > >                             * * * *         * * * *
> > >                            *       *       *       *
> > >                           * *     * *     * *     * *
> > >                          *   *   *   *   *   *   *   *
> > >                         * * * * * * * * * * * * * * * *
> > >                        *                               *
> > >                       * *                             * *
> > >                      *   *                           *   *
> > >                     * * * *                         * * * *
> > >                    *       *                       *       *
> > >                   * *     * *                     * *     * *
> > >                  *   *   *   *                   *   *   *   *
> > >                 * * * * * * * *                 * * * * * * * *
> > >                *               *               *               *
> > >               * *             * *             * *             * *
> > >              *   *           *   *           *   *           *   *
> > >             * * * *         * * * *         * * * *         * * * *
> > >            *       *       *       *       *       *       *       *
> > >           * *     * *     * *     * *     * *     * *     * *     * *
> > >          *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
> > >         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > >        *                                                               *
> > >       * *                                                             * *
> > >      *   *                                                           *   *
> > >     * * * *                                                         * * * *
> > >    *       *                                                       *       *
> > >   * *     * *                                                     * *     * *
> > >  *   *   *   *                                                   *   *   *   *
> > > * * * * * * * *                                                 * * * * * * * *
> 
> def new_cell i, line
>   n = [i-1,i+1].grep(0...line.size).map{|j| line[j]}.
>     count{|c| c!=" "}
>   " * "[n]
> end
> 
> def new_line line
>   new = line.dup
>   new.size.times{|i| new[i] = new_cell(i, line)}
>   new
> end
> 
> line = " " * 79  ;  line[ line.size/2 ] = "*"
> puts line ;
> (puts line = new_line(line)) until " " != line[0]

Modified to work under versions of Ruby before 1.9:

def new_cell i, line
  n = [i-1,i+1].grep(0...line.size){|j| line[j,1]}.
    count{|c| c!=" "}
  " * "[n,1]
end

def new_line line
  new = line.dup
  new.size.times{|i| new[i] = new_cell(i, line)}
  new
end

line = " " * 79  ;  line[ line.size/2 ] = "*"
puts line ;
(puts line = new_line(line)) until " " != line[0,1]

[toc] | [prev] | [next] | [standalone]


#43831

From"WJ" <w_a_x_man@yahoo.com>
Date2015-11-26 16:12 +0000
Message-ID<n37b1r$h9a$1@dont-email.me>
In reply to#43605
WJ wrote:

> WJ wrote:
> 
> > WJ wrote:
> > 
> > > Ruby:
> > > 
> > > def neighbors( line, i )
> > >   [i-1, i+1].select{|n| n >= 0  and  n < line.size}.
> > >     count{|i|  line[i,1] != " "}
> > > end
> > > 
> > > def next_line( old_line, cycles )
> > >   return  unless cycles > 0
> > >   puts old_line
> > >   line = " " * old_line.size
> > >   line.size.times{|i| line[i] = " * "[ neighbors( old_line, i ) ] }
> > >   next_line( line, cycles - 1 )
> > > end
> > > 
> > > line = " " * 79  ;  line[ line.size/2 ] = "*"
> > > next_line( line, 40 )
> > > 
> > > 
> > >                                        *
> > >                                       * *
> > >                                      *   *
> > >                                     * * * *
> > >                                    *       *
> > >                                   * *     * *
> > >                                  *   *   *   *
> > >                                 * * * * * * * *
> > >                                *               *
> > >                               * *             * *
> > >                              *   *           *   *
> > >                             * * * *         * * * *
> > >                            *       *       *       *
> > >                           * *     * *     * *     * *
> > >                          *   *   *   *   *   *   *   *
> > >                         * * * * * * * * * * * * * * * *
> > >                        *                               *
> > >                       * *                             * *
> > >                      *   *                           *   *
> > >                     * * * *                         * * * *
> > >                    *       *                       *       *
> > >                   * *     * *                     * *     * *
> > >                  *   *   *   *                   *   *   *   *
> > >                 * * * * * * * *                 * * * * * * * *
> > >                *               *               *               *
> > >               * *             * *             * *             * *
> > >              *   *           *   *           *   *           *   *
> > >             * * * *         * * * *         * * * *         * * * *
> > >            *       *       *       *       *       *       *       *
> > >           * *     * *     * *     * *     * *     * *     * *     * *
> > >          *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
> > >         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > >        *                                                               *
> > >       * *                                                             * *
> > >      *   *                                                           *   *
> > >     * * * *                                                         * * * *
> > >    *       *                                                       *       *
> > >   * *     * *                                                     * *     * *
> > >  *   *   *   *                                                   *   *   *   *
> > > * * * * * * * *                                                 * * * * * * * *
> 
> def new_cell i, line
>   n = [i-1,i+1].grep(0...line.size).map{|j| line[j]}.
>     count{|c| c!=" "}
>   " * "[n]
> end
> 
> def new_line line
>   new = line.dup
>   new.size.times{|i| new[i] = new_cell(i, line)}
>   new
> end
> 
> line = " " * 79  ;  line[ line.size/2 ] = "*"
> puts line ;
> (puts line = new_line(line)) until " " != line[0]

Ocaml:

let new_cell i line =
  [i-1;i+1] |> List.filter (fun n -> n>=0 && n<String.length line)
  |> List.map (String.get line) |> List.filter ((=) '*') |>
  List.length |> String.get " * " ;;

let new_line line = String.mapi (fun i c -> new_cell i line) line;;

let tmp = String.make 39 ' ' ;;

let rec  loop line =
  print_endline line ;
  if ' ' = line.[0] then loop (new_line line)
in loop (tmp ^ "*" ^ tmp) ;;

                                       *
                                      * *
                                     *   *
                                    * * * *
                                   *       *
                                  * *     * *
                                 *   *   *   *
                                * * * * * * * *
                               *               *
                              * *             * *
                             *   *           *   *
                            * * * *         * * * *
                           *       *       *       *
                          * *     * *     * *     * *
                         *   *   *   *   *   *   *   *
                        * * * * * * * * * * * * * * * *
                       *                               *
                      * *                             * *
                     *   *                           *   *
                    * * * *                         * * * *
                   *       *                       *       *
                  * *     * *                     * *     * *
                 *   *   *   *                   *   *   *   *
                * * * * * * * *                 * * * * * * * *
               *               *               *               *
              * *             * *             * *             * *
             *   *           *   *           *   *           *   *
            * * * *         * * * *         * * * *         * * * *
           *       *       *       *       *       *       *       *
          * *     * *     * *     * *     * *     * *     * *     * *
         *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
       *                                                               *
      * *                                                             * *
     *   *                                                           *   *
    * * * *                                                         * * * *
   *       *                                                       *       *
  * *     * *                                                     * *     * *
 *   *   *   *                                                   *   *   *   *
* * * * * * * *                                                 * * * * * * * *

[toc] | [prev] | [next] | [standalone]


#43835

From"WJ" <w_a_x_man@yahoo.com>
Date2015-11-26 17:13 +0000
Message-ID<n37ej3$d0$1@dont-email.me>
In reply to#43831
WJ wrote:

> Ocaml:
> 
> let new_cell i line =
>   [i-1;i+1] |> List.filter (fun n -> n>=0 && n<String.length line)
>   |> List.map (String.get line) |> List.filter ((=) '*') |>
>   List.length |> String.get " * " ;;

Shorter:

let new_cell i line =
  [i-1;i+1] |>
  List.map (fun j -> try line.[j] with _-> ' ') |>
  function
    ['*';' '] | [' ';'*'] -> '*' |
    _ -> ' ' ;;

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web