Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Guess the language!!!

Name: Anonymous 2012-10-27 12:38

package main
 
import (
        "big"
        "fmt"
        "os"
        "strings"
)
 
func main() {
        if len(os.Args) != 2 {
                fmt.Fprintf(os.Stderr, "Usage: %s <number>\n", os.Args[0])
                os.Exit(1)
        }
 
        number_str := strings.Replace(os.Args[1], " ", "", -1)
 
        number, ok := new(big.Int).SetString(number_str, 0)
        if !ok {
                fmt.Fprintf(os.Stderr, "Failed to convert %q to big integer.\n", number_str)
                os.Exit(1)
        }
 
        os.Stdout.Write(number.Bytes())
}

Name: Anonymous 2012-10-27 12:55

fun factorial n = let
  fun fac (0, acc) = acc
    | fac (n, acc) = fac (n - 1, n*acc)
  in
    if (n < 0) then raise Fail "negative argument"
    else fac (n, 1)
  end

fun reverse xs = let
  fun rev [] acc = acc
    | rev (hd::tl) acc = rev tl (hd::acc)
in
  rev xs []
end

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List