On Thu, Dec 15, 2011 at 12:09:14PM +0100, Ralf Hemmecke wrote:
>> ------- t.input -----------------------------
>> x := 1
>> while x<  4 repeat {output x;  x := x + 1}
>>
>> g(): Void ==  x := 1
>>                while x<  4 repeat {output x;  x := x + 1}
>> ---------------------------------------------
>
> [..]
> in
>
>   g(): Void ==  x := 1
>                 while x<  4 repeat {output x;  x := x + 1}
>
> the first line is the definition of g.
> The second line does not belong to g anymore, but is just some indented  
> something.
>
> Correctly you would have to do
>
> g(): Void ==
>     x := 1
>     while x < 4 repeat {output x;  x := x + 1}
>
> The function body is the block of lines that are indented with the same  
> amount of spaces. In your version "x := 1" is not indented at all. So  
> does *not* belong to a block together with the "while" line.
>

I see now. Thank you.

And is this a natural indentation rule?
For example, Haskell allows

  g :: Integer
  g = f 1 a  where f = (+)
                   a = 2           
                       
-- with a certain evident indentation rule, without need of dropping 
`where' to the next line.
(I do not know, which rule is better).
Also
  g = f 1 a  
      where f = (+)
            a = 2           
,
  g = f 1 a  
      where 
      f = (+)
      a = 2           
and
  g = f 1 a  where {f = (+); a = 2}           

have the same meaning.

Regards,

------
Sergei
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to