1. call_func error message

Hi all...

Why is Euphoria choking on the following code?

..\code\test_split.exw:32
Syntax error - expected to see possibly 'end', not a function
              call_func(rtn, {some_list[i], d})
                      ^

function foreach_split(sequence some_list, atom rtn, integer d)
          for i=1 to length(some_list) do
              call_func(rtn, {some_list[i], d})
          end for
end function

There's a few more lines of code, but it never gets parsed by the interpreter
because of the choke-point above. Any ideas?

BTW, what a PITA not having a foreach routine!! TIA....
--
duke

new topic     » topic index » view message » categorize

2. Re: call_func error message

duke normandin wrote:
> 
> Hi all...
> 
> Why is Euphoria choking on the following code?
> 
> ..\code\test_split.exw:32
> Syntax error - expected to see possibly 'end', not a function
>               call_func(rtn, {some_list[i], d})
>                       ^
> 
> function foreach_split(sequence some_list, atom rtn, integer d)
>           for i=1 to length(some_list) do
>               call_func(rtn, {some_list[i], d})
>           end for
> end function
> 
> There's a few more lines of code, but it never gets parsed by the interpreter
> because of the choke-point above. Any ideas?
> 
> BTW, what a PITA not having a foreach routine!! TIA....
> --
> duke

A function needs a return statement. A procedure does not.

Yes, foreach has been discussed on the forum. I don't think it has been brought
up since the open sourcing of Euphoria.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

3. Re: call_func error message

duke normandin wrote:
> 
> Hi all...
> 
> Why is Euphoria choking on the following code?
> 
> ..\code\test_split.exw:32
> Syntax error - expected to see possibly 'end', not a function
>               call_func(rtn, {some_list[i], d})
>                       ^
> 
> function foreach_split(sequence some_list, atom rtn, integer d)
>           for i=1 to length(some_list) do
>               call_func(rtn, {some_list[i], d})
>           end for
> end function
> 
> There's a few more lines of code, but it never gets parsed by the interpreter
> because of the choke-point above. Any ideas?
> 

You're calling a function but not doing anything with the return.  While
you can do this in C, you can't in Euphoria.

Matt

new topic     » goto parent     » topic index » view message » categorize

4. Re: call_func error message

Jason Gade wrote:
> 
> duke normandin wrote:
> > 
> > Hi all...
> > 
> > Why is Euphoria choking on the following code?
> > 
> > ..\code\test_split.exw:32
> > Syntax error - expected to see possibly 'end', not a function
> >               call_func(rtn, {some_list[i], d})
> >                       ^
> > 
> > function foreach_split(sequence some_list, atom rtn, integer d)
> >           for i=1 to length(some_list) do
> >               call_func(rtn, {some_list[i], d})
> >           end for
> > end function
> > 
> > There's a few more lines of code, but it never gets parsed by the
> > interpreter
> > because of the choke-point above. Any ideas?
> > 
> > BTW, what a PITA not having a foreach routine!! TIA....
> > --
> > duke
> 
> A function needs a return statement. A procedure does not.

Yey! My bad! I left out a line when I copying my code ;) However, the
choke-point occurs before where the return statement ought to be. Must
be something else irritating the interpreter! Thanks...
--
duke

new topic     » goto parent     » topic index » view message » categorize

5. Re: call_func error message

duke normandin wrote:
> 
> Jason Gade wrote:
> > 
> > duke normandin wrote:
> > > 
> > > Hi all...
> > > 
> > > Why is Euphoria choking on the following code?
> > > 
> > > ..\code\test_split.exw:32
> > > Syntax error - expected to see possibly 'end', not a function
> > >               call_func(rtn, {some_list[i], d})
> > >                       ^
> > > 
> > > function foreach_split(sequence some_list, atom rtn, integer d)
> > >           for i=1 to length(some_list) do
> > >               call_func(rtn, {some_list[i], d})
> > >           end for
> > > end function
> > > 
> > > snip
> > 
> > A function needs a return statement. A procedure does not.
> 
> Yey! My bad! I left out a line when I copying my code ;) However, the
> choke-point occurs before where the return statement ought to be. Must
> be something else irritating the interpreter! Thanks...
> --
> duke

Hi Duke, welcome to EU.

In case you haven't guessed yet, Jason was pointing out that your call_func() is
a function (as well as the foreach_split() routine) so needs somewhere to stash
whatever it is returning i.e. Var = call_func(...

Regards PeteS

new topic     » goto parent     » topic index » view message » categorize

6. Re: call_func error message

Pete Stoner wrote:
> 
> duke normandin wrote:
> > 
> > Jason Gade wrote:
> > > 
> > > duke normandin wrote:
> > > > 
> > > > Hi all...
> > > > 
> > > > Why is Euphoria choking on the following code?
> > > > 
> > > > ..\code\test_split.exw:32
> > > > Syntax error - expected to see possibly 'end', not a function
> > > >               call_func(rtn, {some_list[i], d})
> > > >                       ^
> > > > 
> > > > function foreach_split(sequence some_list, atom rtn, integer d)
> > > >           for i=1 to length(some_list) do
> > > >               call_func(rtn, {some_list[i], d})
> > > >           end for
> > > > end function
> > > > 
> > > > snip
> > > 
> > > A function needs a return statement. A procedure does not.
> > 
> > Yey! My bad! I left out a line when I copying my code ;) However, the
> > choke-point occurs before where the return statement ought to be. Must
> > be something else irritating the interpreter! Thanks...
> > --
> > duke
> 
> Hi Duke, welcome to EU.
> 
> In case you haven't guessed yet, Jason was pointing out that your call_func()
> is a function (as well as the foreach_split() routine) so needs somewhere to
> stash whatever it is returning i.e. Var = call_func(... 
> 
> Regards PeteS

Honestly? No I hadn't! Too many things on the go at the moment with EU ;)
I'm enjoying it though! I have to admit that all this indirection going on
with call_func(), call_proc() is new to me. I'm going to have to get it straight
in my mind what's calling what, when, AND what's returning what, when. It
seems a bit convoluted to me at the moment, but hey I'm brand new to EU.
I'm not done yet!! Thanks...
--
duke

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu