From: Roelof Wobben <r.wobben@home.nl>
To: caml-list@inria.fr
Subject: Re: [Caml-list] reverse a list
Date: Sun, 19 Oct 2014 17:37:20 +0200 [thread overview]
Message-ID: <5443DAB0.7050604@home.nl> (raw)
In-Reply-To: <5443D50B.5000306@home.nl>
Roelof Wobben schreef op 19-10-2014 17:13:
> Philippe Wang schreef op 19-10-2014 15:59:
>> On Sun, Oct 19, 2014 at 2:34 PM, Malcolm Matalka <mmatalka@gmail.com>
>> wrote:
>>> Lists are immutable so you'll be constructing a list as you consume
>>> another list.
>> Please don't formulate it this way, as it sounds to me as if the list
>> being "consumed" is disappearing (because that's what generally
>> happens when something is being "consumed"). :-/
>> To the beginners reading this: well, in OCaml, any given list will
>> never disappear before it actually becomes useless, and they may be
>> "consumed" over and over again without any "harm" happening to them.
>>
>
> Thanks all
>
> Now trying to find out how I can add things to the second list. I
> think this can work 2::l2
>
> Roelof
>
I have found a way :
let rec test l1 l2 =
match l1 with
| [] -> l2
| h :: t -> test t (h::l2)
;;
Roelof
next prev parent reply other threads:[~2014-10-19 15:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-19 12:07 Roelof Wobben
2014-10-19 12:30 ` Gabriel Scherer
2014-10-19 12:34 ` Malcolm Matalka
2014-10-19 13:59 ` Philippe Wang
2014-10-19 15:13 ` Roelof Wobben
2014-10-19 15:37 ` Roelof Wobben [this message]
2014-10-19 12:50 ` SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5443DAB0.7050604@home.nl \
--to=r.wobben@home.nl \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox