erl_interface and lists

r.raschke@REDACTED r.raschke@REDACTED
Tue May 27 14:45:56 CEST 2003


Hi,

I have written erl_interface code along the lines of this before:

if (ERL_IS_LIST(foo)) {
	for (list = foo; ! ERL_IS_EMPTY_LIST(list); list = ERL_CONS_TAIL(list)) {
		item = ERL_CONS_HEAD(list);
		/* whatever */
	}
}

As far as I know you don't iterate like you would with an array, there
being no index into the list.  Either you loop destructively like the
above or you can write a recursive solution, as you would have to were
you programming in Erlang itself.

Hope this helps,
Robby
-------------- next part --------------
An embedded message was scrubbed...
From: Serge Aleynikov <serge@REDACTED>
Subject: erl_interface and lists
Date: Mon, 26 May 2003 23:28:48 -0400
Size: 3766
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030527/db6e9a20/attachment.eml>


More information about the erlang-questions mailing list