#Doing things again and again and again
#Another exercise page 4 et 5

#Path {
#    Move 100 400
#    Line 100.1 400.097
#    Line 100.2 400.193
#    blah blah blah
#    Line 500 400
#  }

Set $2Pi 6.28318530717959

#Set $Factor Over 400 $2Pi
# ( $Factor :=  400 / $2Pi )
#  Path {
#    Width 1
#    Move 100 400
#    For $x0 0 200 {
#      Set $x Times $x0 Over $2Pi 200
#      Set $y Sin $x
#      Set $t Plus 100 Times $x $Factor
#      Set $u Plus 400 Times $y $Factor
#     Line $t $u
#    }
#
#    Line 500 400
#  }

  ( $Factor :=  400 / $2Pi  )

  Path {
    Width 1
    Move 100 400
    For $x0 0 200 {
      ( (
        $x :=  $x0 * ( $2Pi / 200 )
        $y := sin ( $x )
        $t := 100 + $Factor * $x
        $u := 400 + $Factor * $y
      ) )
      Line $t $u
    }

    #Line 500 400
  }

#Another exercise
Path {
    Width 0	# this means: as thin as possible
    Move 100 400
    Line 500 400
    # Move 100 Minus 400 $Factor
    Move 100  ( 400  - $Factor )
    Line 100  ( 400  + $Factor )
    # every pi/4 units:
    For $n 0 9 {
      #Set $x Times $n Over $2Pi 8
      #Set $t Plus 100 Times $x $Factor
      ( (
        $x := $n * ( $2Pi / 8 )
        $t := 100 + ( $x * $Factor )
      ) )


      Move $t 390
      Line $t 410
    }
  }