[Ur] debugging

Gergely Buday gbuday at gmail.com
Fri Dec 30 08:09:20 EST 2011


On 30 December 2011 13:30, Ron de Bruijn <rmbruijn at gmail.com> wrote:

> Via [naughtyDebug].

Indeed, here is a sample program for future generations. It outputs

Serving URI /favicon.ico....
Accepted connection.
Handling connection with thread #0.
Serving URI /Naughty/main....
OK 4 is an even number
Hey 3 is an odd number

[gergoe at homeship sandbox]$ cat naughty.ur
fun half ( n : int ) =
    let
        val foo = if ( n % 2 = 1 )
                     then naughtyDebug ("Hey " ^ show n ^ " is an odd number")
                     else naughtyDebug ("OK " ^ show n ^ " is an even number")
     in
        n / 2
    end

fun main () =
    return <xml>{[half 4]}{[half 3]}</xml>
[gergoe at homeship sandbox]$ cat naughty.urp
naughty
[gergoe at homeship sandbox]$ cat naughty.urs
val main : {} -> transaction page

- Gergely



More information about the Ur mailing list