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


Groups > comp.lang.forth > #43835

Re: Simple fractal

From "WJ" <w_a_x_man@yahoo.com>
Newsgroups comp.lang.forth
Subject Re: Simple fractal
Date 2015-11-26 17:13 +0000
Organization A noiseless patient Spider
Message-ID <n37ej3$d0$1@dont-email.me> (permalink)
References <ksr2bn$ur8$1@dont-email.me> <mbha3c$894$1@dont-email.me> <n2ntkg$70a$1@dont-email.me> <n37b1r$h9a$1@dont-email.me>

Show all headers | View raw


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
    ['*';' '] | [' ';'*'] -> '*' |
    _ -> ' ' ;;

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


Thread

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

csiph-web