Re: Sequences - parameter checking responsibility

new topic     » goto parent     » topic index » view thread      » older message » newer message

> > In my real-life example the sequence passed as the parameter
> > must contain at least one, but may contain multiple sequences.
                    ^^^^^^^^^- I almost missed that...
> > Also the sequences within sequences must be composed of atoms,
> > not other sequences.
    ^^^^^^^^^^^^^^^^^^^
    You missed this part, Ralf...

>         Here is what it should look like:
>         In your program type:

    If it looks like that, { {"345, "567"}, "567"} will pass...

> ----------- Code begins here: ---------------------------------------
>
>         type 2D_Sequence (sequence s)
          atom len len=length(s)
                  if len<1 then return(0) end if
>                 for j = 1 to length(s)
                      if atom(s[j]) then return(0) end if
                      for i= 1 to length(s[j]) do
                          if sequence(s[j][i]) then return(0) end if
                      end for
>                 end for
>                 return 1                  -- Value ok
>         end type
>
>         global function xyz ( 2D_Sequence s )
>         -- code
>         end function
> ------------------------------ Code ends here --------------------

I've been to lazy to write this for myself, but now I have it...

>> Edmunds
> Ralf
Anders
--------------------------------------------------------------
Anders Eurenius <c96aes at cs.umu.se> ICQ UIN:1453793
Computer Science/Engineering student at the university of Umea
--------------------------------------------------------------

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu