Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #25719
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Simple Forth problem |
| Date | 2013-09-17 09:39 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <l19804$g8k$1@dont-email.me> (permalink) |
Make a list of the elements that are found in both lists
at the same index.
OCaml:
open List;;
map fst
(filter (fun (x,y) -> x=y)
(combine [3;5;7;8;12] [2;5;8;10;12]));;
[5; 12]
Using the piping operator (|>):
combine [3;5;7;8;12] [2;5;8;10;12] |>
filter (fun (x,y) -> x=y) |>
map fst ;;
Since every gavino "knows" that Forth amplifies programmer productivity,
let's see several Forth solutions that are more concise than the
OCaml ones.
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar | Unroll thread
Simple Forth problem "WJ" <w_a_x_man@yahoo.com> - 2013-09-17 09:39 +0000
Re: Simple Forth problem VoidVolker <voidvolker@gmail.com> - 2013-09-17 03:28 -0700
Re: Simple Forth problem Coos Haak <chforth@hccnet.nl> - 2013-09-17 17:05 +0200
Re: Simple Forth problem "Alex McDonald" <blog@rivadpm.com> - 2013-09-17 16:53 +0100
Re: Simple Forth problem Howerd <howerdo@yahoo.co.uk> - 2013-09-17 09:18 -0700
Re: Simple Forth problem VoidVolker <voidvolker@gmail.com> - 2013-09-17 11:06 -0700
Re: Simple Forth problem Alex McDonald <blog@rivadpm.com> - 2013-09-17 12:13 -0700
Re: Simple Forth problem VoidVolker <voidvolker@gmail.com> - 2013-09-17 22:42 -0700
Re: Simple Forth problem mhx@iae.nl - 2013-09-18 00:00 -0700
Re: Simple Forth problem Howerd <howerdo@yahoo.co.uk> - 2013-09-17 13:26 -0700
Re: Simple Forth problem Doug Hoffman <glidedog@gmail.com> - 2013-09-18 08:42 -0400
Re: Simple Forth problem "Ed" <invalid@invalid.com> - 2013-09-18 14:22 +1000
csiph-web