|
|
| Author |
Message |
< Erlang ~ "Bootstrapping" function - problem |
| wolfgke |
Posted: Thu Oct 18, 2007 3:49 pm |
|
|
|
User
Joined: 16 Sep 2007
Posts: 16
|
Dear people,
I wrote the following code:
Code:
-module(stream).
-export([const_stream/1]).
const_stream(N) -> {N, fun() -> const_stream(N)}.
What it is supposed to do should be rather obvious (if not, I could, of course explain it ).
When I try to compile it I get the following set of errors:
Quote:
./stream.erl:4: syntax error before: '}'
./stream.erl:2: function const_stream/1 undefined
So please could you tell me how to fix that code  |
|
|
| Back to top |
|
| hao |
Posted: Thu Oct 18, 2007 5:11 pm |
|
|
|
User
Joined: 20 Aug 2007
Posts: 18
Location: Uppsala, Sweden
|
Hi, wolfgke,
There is a syntax error before '}'. It is because you missed the 'end' when defining a fun() variable. The correct version of code should be like this:
Code:
-module(stream).
-export([const_stream/1]).
const_stream(N) ->
{N, fun() -> const_stream(N) end}.
fun() -> a few lines of code end  |
|
|
| Back to top |
|
| wolfgke |
Posted: Thu Oct 18, 2007 6:59 pm |
|
|
|
User
Joined: 16 Sep 2007
Posts: 16
|
Thank you.
Oh dear, I was scatterbrained  |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|