* [Caml-list] Removing an element from a list
@ 2002-06-28 19:39 Vincent Foley
2002-06-28 19:53 ` Paul Steckler
2002-06-28 20:10 ` YAMAGATA yoriyuki
0 siblings, 2 replies; 4+ messages in thread
From: Vincent Foley @ 2002-06-28 19:39 UTC (permalink / raw)
To: OCaml Mailing list
Hi,
I would like to know how to remove an element from a list. For example,
I would like to remove 3 in this list: [1; 2; 3; 4; 5]. How would I do
it?
Vince
--
Vincent Foley-Bourgon
Email: vinfoley@iquebec.com
Homepage: http://darkhost.mine.nu:81
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [Caml-list] Removing an element from a list
2002-06-28 19:39 [Caml-list] Removing an element from a list Vincent Foley
@ 2002-06-28 19:53 ` Paul Steckler
2002-06-28 20:10 ` YAMAGATA yoriyuki
1 sibling, 0 replies; 4+ messages in thread
From: Paul Steckler @ 2002-06-28 19:53 UTC (permalink / raw)
To: 'Vincent Foley', 'OCaml Mailing list'
> I would like to know how to remove an element from a list. For
> example,
> I would like to remove 3 in this list: [1; 2; 3; 4; 5]. How would I
> do
> it?
How you'd do it depends *why* you want to remove it. Because it is a 3,
or because it's the third element in the list, or some other reason?
-- Paul
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Removing an element from a list
2002-06-28 19:39 [Caml-list] Removing an element from a list Vincent Foley
2002-06-28 19:53 ` Paul Steckler
@ 2002-06-28 20:10 ` YAMAGATA yoriyuki
2002-07-13 12:53 ` Tomasz Zielonka
1 sibling, 1 reply; 4+ messages in thread
From: YAMAGATA yoriyuki @ 2002-06-28 20:10 UTC (permalink / raw)
To: caml-list
From: Vincent Foley <vinfoley@iquebec.com>
Subject: [Caml-list] Removing an element from a list
Date: Fri, 28 Jun 2002 15:39:52 -0400
> I would like to know how to remove an element from a list. For example,
> I would like to remove 3 in this list: [1; 2; 3; 4; 5]. How would I do
> it?
List.filter (fun e -> e <> 3) [1; 2; 3; 4; 5]
This creates the new list [1; 2; 4; 5] and does not modify the original
[1; 2; 3; 4; 5]. In caml, operations on lists is never destructive
(unlike lisp).
--
Yamagata Yoriyuki
http://www.mars.sphere.ne.jp/yoriyuki/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-07-13 12:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-28 19:39 [Caml-list] Removing an element from a list Vincent Foley
2002-06-28 19:53 ` Paul Steckler
2002-06-28 20:10 ` YAMAGATA yoriyuki
2002-07-13 12:53 ` Tomasz Zielonka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox