Skip to main content
syntax highlighting
Source Link
user12205
  • 9k
  • 3
  • 33
  • 65

Haskell (390 Char)

import System.Environment import Data.List main = do [p] <- getArgs interact $ q (read p) q :: (Int, Int) -> String -> String q p j=case d p j of (f, s) -> b (f++i) (')':s) d (l,c) j=case splitAt (l-1) (lines j) of (f, (t:s)) -> case splitAt c t of (r,y) -> ((unlines f)++r, y++"\n"++(unlines s)) b=(\a b->a++(show a)++" "++(show b)++b) i="((\\a b->a++(show a)++\" \"++(show b)++b) " 
import System.Environment import Data.List main = do [p] <- getArgs interact $ q (read p) q :: (Int, Int) -> String -> String q p j=case d p j of (f, s) -> b (f++i) (')':s) d (l,c) j=case splitAt (l-1) (lines j) of (f, (t:s)) -> case splitAt c t of (r,y) -> ((unlines f)++r, y++"\n"++(unlines s)) b=(\a b->a++(show a)++" "++(show b)++b) i="((\\a b->a++(show a)++\" \"++(show b)++b) " 

Not very golfed. Just an example. This takes the position as a command line argument and source code as a standard input and puts the new source code as standard output.

Haskell (390 Char)

import System.Environment import Data.List main = do [p] <- getArgs interact $ q (read p) q :: (Int, Int) -> String -> String q p j=case d p j of (f, s) -> b (f++i) (')':s) d (l,c) j=case splitAt (l-1) (lines j) of (f, (t:s)) -> case splitAt c t of (r,y) -> ((unlines f)++r, y++"\n"++(unlines s)) b=(\a b->a++(show a)++" "++(show b)++b) i="((\\a b->a++(show a)++\" \"++(show b)++b) " 

Not very golfed. Just an example. This takes the position as a command line argument and source code as a standard input and puts the new source code as standard output.

Haskell (390 Char)

import System.Environment import Data.List main = do [p] <- getArgs interact $ q (read p) q :: (Int, Int) -> String -> String q p j=case d p j of (f, s) -> b (f++i) (')':s) d (l,c) j=case splitAt (l-1) (lines j) of (f, (t:s)) -> case splitAt c t of (r,y) -> ((unlines f)++r, y++"\n"++(unlines s)) b=(\a b->a++(show a)++" "++(show b)++b) i="((\\a b->a++(show a)++\" \"++(show b)++b) " 

Not very golfed. Just an example. This takes the position as a command line argument and source code as a standard input and puts the new source code as standard output.

Source Link
Christopher King
  • 7.4k
  • 6
  • 37
  • 66

Haskell (390 Char)

import System.Environment import Data.List main = do [p] <- getArgs interact $ q (read p) q :: (Int, Int) -> String -> String q p j=case d p j of (f, s) -> b (f++i) (')':s) d (l,c) j=case splitAt (l-1) (lines j) of (f, (t:s)) -> case splitAt c t of (r,y) -> ((unlines f)++r, y++"\n"++(unlines s)) b=(\a b->a++(show a)++" "++(show b)++b) i="((\\a b->a++(show a)++\" \"++(show b)++b) " 

Not very golfed. Just an example. This takes the position as a command line argument and source code as a standard input and puts the new source code as standard output.