Page 1 of 5 123 ... LastLast
Results 1 to 10 of 47

Thread: Beginners Programming Challenge 15

  1. #1
    Join Date
    Jul 2006
    Location
    somewhere :)
    Beans
    535
    Distro
    Ubuntu 10.04 Lucid Lynx

    Beginners Programming Challenge 15

    Welcome to the Beginner Programming Challenge 15! woot! (i wonder if you spell it like that).

    Well, i was trying to find something useful that you could actually use in a building block for a larger project and then i thought about comparing user input with allowed input.

    as an example, let's say you're programming a navigation software and the user enters

    "navigaet to london"

    instead of

    "navigate to london"

    and you want the program to guess what the user actually meant. one way would be to code a list of strings that the application should accept. another way would be to find a way of defining the distance between two strings.

    One such method is called the levenshtein distance. you can read more about it here: http://en.wikipedia.org/wiki/Levenshtein_distance

    Basically it compares two strings and calculates the smallest number of steps you'd need to change one string into the other. allowed steps are---deletion, insertion and substitution.

    The wikipedia article also has some pseudo-code to get you started

    It would be great if your program could be run from the command line like this:
    Code:
    ./mylevenshtein 'navigaet' 'navigate'
    2
    or alternatively:
    Code:
    ./mylevenshtein file1.txt file2.txt
    #somenumber
    One main criteria for judging will be how easy it is to use your code in a larger project.

    You can use any language you like, but i've only had experience with a few, so it may take me time to understand your code Because i'm only human, i'll probably end up marking you down for this

    Here's some sample input:
    Code:
    dog
    dig
    distance: 1
    
    navigaet
    navigate
    distance: 2
    
    floccinaucinihilipilification
    naucifloccipilinihilification
    distance: 12
    
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nistrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis eute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    Lorem ipsum dolor sit emet, consectetur edipisicing elit, sed do eiusmod tempor incididunt ut lebore et dolore megne elique. Ut enim ed minim veniem, quis nostrud exercitetion ullemco leboris nisi ut eliquip ex ee commodo consequet. Duis eute irure dolor in reprehenderit in voluptete velit esse cillum dolore eu fugiet nulle perietur. Excepteur sint occeecet cupidetet non proident, sunt in culpe qui officie deserunt mollit enim id est leborum.
    distance: 29
    The distance between the attached files (once they've been unzipped) is 154
    Attached Files Attached Files
    there are 10 types of people in the world: those that understand binary and i don't know who the other F are.

  2. #2
    Join Date
    Apr 2007
    Location
    NorCal
    Beans
    1,149
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Beginners Programming Challenge 15

    In Common Lisp. Takes two strings and one keyword argument, :case-insensitive. You can also run it from the command line like so:
    Code:
    schauerlich@inara:~$ sbcl --script schauerlich.lisp "navigaet" "navigate"
    2
    This improves on the pseudo-code on wikipedia because it only requires O(n) space, where n is the length of the second argument. It keeps track of the previous row and the current row, since that's all that's needed to perform the calculations.

    Pretty-looking paste.lisp.org version

    Code:
    (defun levenshtein-distance* (str1 str2 &key (case-insensitive nil))
      (let* ((char-compare (if case-insensitive #'char-equal #'char=))
    	 (y-length (length str1))
    	 (x-length (length str2))
    	 (current-row (make-array (list (1+ x-length)) :initial-element 0))
    	 (prev-row (make-array (list (1+ x-length)))))
        (loop for i from 0 upto x-length do
    	 (setf (aref prev-row i) i))
        (loop for y from 1 upto y-length do
    	 (setf (aref current-row 0) y)
    	 (loop for x from 1 upto x-length do
    	      (let ((cost (if (funcall char-compare 
    				       (char str1 (- y 1))
    				       (char str2 (- x 1)))
    			      0
    			      1)))
    		  (setf (aref current-row x)
    			(min
    			 (1+ (aref prev-row x))
    			 (1+ (aref current-row (- x 1)))
    			 (+ (aref prev-row (- x 1)) cost)))))
    	 (rotatef prev-row current-row))
        (aref prev-row x-length)))
    
    (defun main ()
      (format t "~d~%" 
    	  (levenshtein-distance* (second *posix-argv*) (third *posix-argv*))))
    
    (main)
    Last edited by schauerlich; August 16th, 2010 at 11:15 AM.
    Posting code? Use the [code] or [php] tags.
    I don't care, I'm still free. You can't take the sky from me.

  3. #3
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Beginners Programming Challenge 15

    My first Ada program. I like this, it's quite big but the syntax is very clear.

    Code:
    with Ada.Command_Line;
    with Ada.Text_IO;
    
    procedure Distance is
    	S :     String	:= Ada.Command_Line.Argument(1);
    	T :     String	:= Ada.Command_Line.Argument(2);
    	SL :	Natural	:= S'Length;
    	TL :	Natural := T'Length;
    	Table : array (Natural range 0 .. SL, 
    	               Natural range 0 .. TL)
    		      of Natural;
    
    	package Integer_Text_IO is new Ada.Text_IO.Integer_IO(Integer);
    
    	function Minimum (X :	Natural;
    		          Y :	Natural;
    			  Z :	Natural)
    			 return Natural is
    	begin
    		if X <= Y then
    			if X <= Z then
    				return X;
    			else
    				return Z;
    			end if;
    		elsif Y <= Z then
    			return Y;
    		else
    			return Z;
    		end if;
    	end Minimum;
    
    begin
    
    	for I in Integer range 0 .. SL loop
    		for J in Integer range 0 .. TL loop
    			if I = 0 then
    				Table(0, J) := J;
    			elsif J = 0 then
    				Table(I, 0) := I;
    			elsif S(I) = T(J) then
    				Table(I, J) := Table(I-1, J-1);
    			else
    				Table(I, J) := Minimum(Table(I-1, J),
    				                       Table(I, J-1),
    						       Table(I-1, J-1)) + 1;
    			end if;
    		end loop;
    	end loop;
    
    	Ada.Text_IO.Put("Distance: ");
    	Integer_Text_IO.Put(Table(SL, TL), 0);
    
    end Distance;
    Save as distance.adb, compile with gnat make distance.adb.

    Code:
    firas@itsuki ~ % gnat make distance.adb 
    gcc-4.4 -c distance.adb
    gnatbind -x distance.ali
    gnatlink distance.ali
    firas@itsuki ~ % ./distance dog dig
    Distance: 1
    firas@itsuki ~ % ./distance navigaet navigate
    Distance: 2
    firas@itsuki ~ % ./distance floccinaucinihilipilification naucifloccipilinihilification
    Distance: 12
    firas@itsuki ~ % ./distance "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nistrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis eute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." "Lorem ipsum dolor sit emet, consectetur edipisicing elit, sed do eiusmod tempor incididunt ut lebore et dolore megne elique. Ut enim ed minim veniem, quis nostrud exercitetion ullemco leboris nisi ut eliquip ex ee commodo consequet. Duis eute irure dolor in reprehenderit in voluptete velit esse cillum dolore eu fugiet nulle perietur. Excepteur sint occeecet cupidetet non proident, sunt in culpe qui officie deserunt mollit enim id est leborum."     
    Distance: 29
    Last edited by Bachstelze; August 16th, 2010 at 02:45 AM.
    「明後日の夕方には帰ってるからね。」


  4. #4
    Join Date
    Apr 2007
    Location
    NorCal
    Beans
    1,149
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Beginners Programming Challenge 15

    Terribly inefficient but pure-functional version in Scheme:

    EDIT: borrowed some memoization code, it's now much much faster. Lorem ipsum still takes a while, but it's a vast improvement.

    http://paste.lisp.org/display/113555#1

    Code:
    ; memoization code borrowed from 
    ; http://lists.canonical.org/pipermail/kragen-hacks/1999-March/000166.html
    (define (memoize func)
      (let ((memoresults '()))
        (lambda args
          (let ((memoized-pair (assoc args memoresults)))
    	; for debugging:
    	; (if memoized-pair (begin (print memoized-pair) (cdr memoized-pair))
    	(if memoized-pair (cdr memoized-pair)
    	  (let ((thing-to-save (apply func args)))
    	    (begin
    	      (set! memoresults (cons (cons args thing-to-save) memoresults))
    	      thing-to-save)))))))
    
    
    
    (define (string-cdr str)
      (substring str 1 (string-length str)))
    
    (define (levenshtein-distance str1 str2)
      (let ((str1-length (string-length str1))
            (str2-length (string-length str2)))
        (cond ((= str1-length 0) 
               str2-length)
              ((= str2-length 0)
               str1-length)
              (else
               (min
                (+ (levenshtein-distance (string-cdr str1) (string-cdr str2))
                   (if (char=? (string-ref str1 0) (string-ref str2 0))
                       0
                       1))
                (+ (levenshtein-distance (string-cdr str1) str2)
                   1)
                (+ (levenshtein-distance str1 (string-cdr str2))
                   1))))))
    
    (set! levenshtein-distance (memoize levenshtein-distance))
    Last edited by schauerlich; August 17th, 2010 at 08:10 PM.
    Posting code? Use the [code] or [php] tags.
    I don't care, I'm still free. You can't take the sky from me.

  5. #5
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Beginners Programming Challenge 15

    Haskell. Gives 30 on lorem ipsum, for some reason. :/

    EDIT: Actually this approach is bad, no way around using some kind of state...

    EDIT2: Corrected. Same problem as above: very inefficient.

    Code:
    import System.Environment
    
    min3        :: Int -> Int -> Int -> Int
    distance    :: String -> String -> Int
    
    min3 a b c = if a <= b
                     then if a <= c
                              then a
                              else c
                     else if b <= c
                              then b
                              else c
    
    distance l []       = length l
    distance [] l       = length l
    
    distance [a] [b]
            | a == b    = 0
            | otherwise = 1
    
    distance (x:xs) [y]
            | y == x    = length xs
            | otherwise = length xs + 1
    distance [y] (x:xs) = distance (x:xs) [y]
    
    distance (x1:x2:xs) (y1:y2:ys)
            | x1 == y1  = distance (x2:xs) (y2:ys)
            | otherwise = min3 (distance (x2:xs) (y1:y2:ys))
                               (distance (x1:x2:xs) (y2:ys))
                               (distance (x2:xs) (y2:ys))
                               + 1
    
    main = do
                args <- getArgs
                let s1 = args !! 0
                let s2 = args !! 1
                putStrLn (show (distance s1 s2))
    Last edited by Bachstelze; August 16th, 2010 at 02:52 AM.
    「明後日の夕方には帰ってるからね。」


  6. #6
    Join Date
    Jul 2007
    Location
    Austin, TX
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Beginners Programming Challenge 15

    In Go. It doesn't deal with files, I can't stand working with this language long enough to get io working. Go doesn't even support dynamically allocated multi dimensional arrays (!?).

    Code:
    package main
    
    import "fmt"
    import "flag"
    
    func main() {
    	s := flag.Arg(0)
    	t := flag.Arg(1)
    	n := len(s)
    	m := len(t)
    	cost := 0
    	if m>1000 || n>1000 {
    		fmt.Printf("Sorry, Google can't make a language that's worth a ****.\n"+
    					"Try smaller inputs?\n")
    		return
    	}
    	
    	d := new([1000][1000]int)
    	for i:=0; i<=n; i++ {
    		d[i][0] = i
    	}
    	for j:=0; j<=m; j++ {
    		d[0][j] = j
    	}
    	
    	for i:=1; i<=n; i++ {
    		si := s[i-1]
    		for j:=1; j<=m; j++ {
    			tj := t[j-1]
    			
    			if si == tj {
    				cost = 0
    			} else {
    				cost = 1
    			}
    			d[i][j] = min(d[i-1][j]+1, d[i][j-1]+1, d[i-1][j-1]+cost)
    		}
    	}
    	
    	fmt.Printf("%d\n", d[n][m])
    	//fmt.Printf("Lev. Dist: %d\n", d[n][m])
    }
    
    
    func min( a,b,c int) int {
    	m := a
    	if b < m { m = b }
    	if c < m { m = c }
    	return m
    }

  7. #7
    Join Date
    Jul 2007
    Location
    Austin, TX
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Beginners Programming Challenge 15

    In D2. Still no support for files (ahh laziness..)

    Code:
    // Lev.d
    
    import std.stdio;
    
    void main(string[] args)
    {
    	auto s = args[1];
    	auto t = args[2];
    	auto n = s.length;
    	auto m = t.length;
    	auto d = new int[][](n+1, m+1);
    	auto c = 0;
    	
    	for(int i=0; i<=n; i++)
    		d[i][0] = i;
    	for(int j=0; j<=m; j++)
    		d[0][j] = j;
    	
    	for(int i=1; i<=n; i++)
    	{
    		int si = s[i-1];
    		for(int j=1; j<=m; j++)
    		{
    			int tj = t[j-1];
    			if(si == tj)
    				c = 0;
    			else
    				c = 1;
    			d[i][j] = min( d[i-1][j]+1,
    						   d[i][j-1]+1,
    						   d[i-1][j-1]+c
    						 );
    		 }
    	}
    	writefln("%d", d[n][m]);
    }
    
    int min(int a, int b, int c)
    {
    	int m = a;
    	if(b < m)
    		m = b;
    	if(c < m)
    		m = c;
    	return m;
    }

  8. #8
    Join Date
    Apr 2007
    Location
    NorCal
    Beans
    1,149
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Beginners Programming Challenge 15

    Obligatory C entry. In before inevitable speed contest.

    With 2 or more arguments supplied, it returns the distance between the first two arguments. Otherwise, it goes through all of the examples (including the "sitting" "kitten" one from wikipedia).

    PHP Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    #define LEV_PRINT(str1, str2) printf("%s\n%s\ndistance: %d\n\n", str1, str2, lev_dist(str1, str2))

    int min(int aint bint c) {
      
    int min a;
      if (
    min)
        
    min b;
      if (
    min)
        
    min c;
      
      return 
    min;
    }

    int lev_dist(char *str1char *str2) {
      
    int y_length strlen(str1);
      
    int x_length strlen(str2);
      
    int *prev_row = (int *)malloc((x_length 1) * sizeof(int));
      
    int *current_row = (int *)malloc((x_length 1) * sizeof(int));
      
    int xydistancecost;
      
    int *temp;

      for (
    0<= x_length; ++x) {
        
    current_row[x] = 0;
        
    prev_row[x] = x;
      } 
    // for x
      
      
    for (1<= y_length; ++y) {
        
    current_row[0] = y;
        
        for (
    1<= x_length; ++x) {
          
    cost = (str1[1] == str2[1]) ? 1;
         
          
    current_row[x] = min(prev_row[x] + 1,
                               
    current_row[1] + 1,
                               
    prev_row[1] + cost);
        } 
    // for x
        
        
    temp prev_row;
        
    prev_row current_row;
        
    current_row temp;
      } 
    // for y

      
    distance prev_row[x_length];

      
    free(prev_row);
      
    free(current_row);
      
      return 
    distance;
    // lev_dist

    int main(int argcchar **argv) {
      if (
    argc 3) {
        
    puts("Testing examples...\n");
        
    LEV_PRINT("dog""dig");
        
    LEV_PRINT("sitting""kitten");
        
    LEV_PRINT("navigate""navigaet");
        
    LEV_PRINT("floccinaucinihilipilification""naucifloccipilinihilification");
        
    LEV_PRINT("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nistrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis eute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.""Lorem ipsum dolor sit emet, consectetur edipisicing elit, sed do eiusmod tempor incididunt ut lebore et dolore megne elique. Ut enim ed minim veniem, quis nostrud exercitetion ullemco leboris nisi ut eliquip ex ee commodo consequet. Duis eute irure dolor in reprehenderit in voluptete velit esse cillum dolore eu fugiet nulle perietur. Excepteur sint occeecet cupidetet non proident, sunt in culpe qui officie deserunt mollit enim id est leborum.");
      }
      else {
        
    printf("%d\n"lev_dist(argv[1], argv[2]));
      }

      return 
    EXIT_SUCCESS;

    Code:
    schauerlich@inara:~$ time ./15.out > /dev/null
    
    real	0m0.007s
    user	0m0.004s
    sys	0m0.002s
    Last edited by schauerlich; August 16th, 2010 at 09:59 AM.
    Posting code? Use the [code] or [php] tags.
    I don't care, I'm still free. You can't take the sky from me.

  9. #9
    Join Date
    Jul 2007
    Location
    Austin, TX
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Beginners Programming Challenge 15

    Quote Originally Posted by schauerlich View Post
    Obligatory C entry. In before inevitable speed contest.
    Well in that case..

    Modified D2 entry:

    PHP Code:
    // Lev.d

    import std.stdio;

    void main(string[] args)
    {
        if(
    args.length == 3)
            
    printLevDist(args[1], args[2]);
        else
        {
            
    printLevDist("dog""dig");
            
    printLevDist("sitting""kitten");
            
    printLevDist("navigate""navigaet");
            
    printLevDist("floccinaucinihilipilification""naucifloccipilinihilification");
            
    printLevDist("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nistrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis eute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.""Lorem ipsum dolor sit emet, consectetur edipisicing elit, sed do eiusmod tempor incididunt ut lebore et dolore megne elique. Ut enim ed minim veniem, quis nostrud exercitetion ullemco leboris nisi ut eliquip ex ee commodo consequet. Duis eute irure dolor in reprehenderit in voluptete velit esse cillum dolore eu fugiet nulle perietur. Excepteur sint occeecet cupidetet non proident, sunt in culpe qui officie deserunt mollit enim id est leborum.");
        }
    }

    void printLevDist(string sstring t)
    {
        
    auto n s.length;
        
    auto m t.length;
        
    auto d = new int[][](n+1m+1);
        
    auto c 0;
        
        for(
    int i=0i<=ni++)
            
    d[i][0] = i;
        for(
    int j=0j<=mj++)
            
    d[0][j] = j;
        
        for(
    int i=1i<=ni++)
        {
            
    int si s[i-1];
            for(
    int j=1j<=mj++)
            {
                
    int tj t[j-1];
                if(
    si == tj)
                    
    0;
                else
                    
    1;
                
    d[i][j] = mind[i-1][j]+1,
                               
    d[i][j-1]+1,
                               
    d[i-1][j-1]+c
                             
    );
             }
        }
        
    writeln(d[n][m]);
    }

    int min(int aint bint c)
    {
        
    int m a;
        if(
    m)
            
    b;
        if(
    m)
            
    c;
        return 
    m;

    Code:
    seth@SUbuntu:~/Code/Lev_D$ dmd -O Lev.d
    seth@SUbuntu:~/Code/Lev_D$ time ./Lev > /dev/null
    
    real	0m0.012s
    user	0m0.008s
    sys	0m0.000s

  10. #10
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Beginners Programming Challenge 15

    New Haskell, using the State monad:

    Code:
    import Control.Monad.State
    import System.Environment
    
    min3    :: Int -> Int -> Int -> Int
    min3 a b c = if a < b
                    then if a < c
                            then a
                            else c
                    else if b < c
                            then b
                            else c
    
    type LevenshteinState = State [Int]
    
    distance :: String -> String -> Int -> LevenshteinState Int
    distance s1 s2 n = do t <- get
                          let ls1 = length s1
                          let i = mod n (ls1 + 1)
                          let j = div n (ls1 + 1)
                          let d = if n <= ls1
                                     then n
                                  else if i == 0
                                     then j
                                  else if (s1 !! (i-1)) == (s2 !! (j-1))
                                     then (t !! (ls1+1))
                                  else
                                     min3 (head t) (t !! ls1) (t !! (ls1+1)) + 1
                          let nt = d : (take (ls1 + 1) t)
                          put nt
                          return d
    
    levDistance :: String -> String -> Int -> LevenshteinState [Int]
    levDistance s1 s2 n = if n >= (ls1 + 1)*(ls2 + 1)
                             then return []
                             else liftM2 (:) (distance s1 s2 n) (levDistance s1 s2 (n + 1))
                          where ls1 = length s1
                                ls2 = length s2
    
    levDistanceReal :: String -> String -> Int
    levDistanceReal s1 s2 = last (evalState (levDistance s1 s2 0) [])
    
    printLevDistance :: String -> String -> IO ()
    printLevDistance s1 s2 = do putStrLn s1
                                putStrLn s2
                                putStrLn ("Distance: " ++ show (levDistanceReal s1 s2))
    
    main = do args <- getArgs
              if length args == 0
                 then do putStrLn "Trying the example strings: "
                         putStrLn ""
                         printLevDistance "dig" "dog"
                         putStrLn ""
                         printLevDistance "navigaet" "navigate"
                         putStrLn ""
                         printLevDistance "floccinaucinihilipilification"
                                          "naucifloccipilinihilification"
                         putStrLn ""
                         printLevDistance ("Lorem ipsum dolor sit amet, consectetur adipisicing elit, " ++
                                           "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " ++
                                           "Ut enim ad minim veniam, quis nistrud exercitation ullamco laboris " ++
                                           "nisi ut aliquip ex ea commodo consequat. " ++
                                           "Duis eute irure dolor in reprehenderit in voluptate velit esse " ++
                                           "cillum dolore eu fugiat nulla pariatur. " ++
                                           "Excepteur sint occaecat cupidatat non proident, " ++
                                           "sunt in culpa qui officia deserunt mollit anim id est laborum.")
                                          ("Lorem ipsum dolor sit emet, consectetur edipisicing elit, " ++
                                           "sed do eiusmod tempor incididunt ut lebore et dolore megne elique. " ++
                                           "Ut enim ed minim veniem, quis nostrud exercitetion ullemco leboris " ++
                                           "nisi ut eliquip ex ee commodo consequet. " ++
                                           "Duis eute irure dolor in reprehenderit in voluptete velit esse " ++
                                           "cillum dolore eu fugiet nulle perietur. " ++
                                           "Excepteur sint occeecet cupidetet non proident, " ++
                                           "sunt in culpe qui officie deserunt mollit enim id est leborum.")
                 else if length args == 2
                    then printLevDistance (args !! 0) (args !! 1)
                 else putStrLn "This program takes either 0 or 2 arguments."
    Works, but exhausts my RAM on lorem ipsum. :/
    Last edited by Bachstelze; August 18th, 2010 at 06:31 AM.
    「明後日の夕方には帰ってるからね。」


Page 1 of 5 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •