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

Pages: 1-

Why Haskell is utterly verbose?

Name: Anonymous 2011-05-15 20:11

Lisp

pSym A [B:A@Rest] -> [[B Rest]]


Haskell

pSym a (b:rest) = if a == b then [(b,rest)] else []
pSym a [] = []


Lisp

Tree =: [[n 5 [n 5 n]] 4 [[n 5 n] 6 n]]


Haskell

data Tree a = Empty | Node (Tree a) a (Tree a)
tree = Node (Node Empty 5 (Node Empty 5 Empty)) 4 (Node (Node Empty 5 Empty) 6 Empty)

Name: Anonymous 2011-05-15 20:20

That's just the way Haskell deals with its typed variables.

Name: Anonymous 2011-05-15 20:29

[[n 5 [n 5 n]] 4 [[n 5 n] 6 n]]
((n 5 #0=(n 5 n)) 4 (#0# 6 n))


Your verbose.

Name: Java Suit 2011-05-15 21:40

JAVA

Name: Anonymous 2011-05-16 5:43

>>1
you're using a DSL that is specifically designed to reduce code size. fuck off.

Name: Anonymous 2011-05-16 6:50

>>1
Why are not using the proper name for the language. You already gave it one.

Name: Anonymous 2011-05-16 6:59

>>3
That is obfuscation!

Name: Anonymous 2011-05-16 7:00

>>5
Better reducing code size, than bloating it, like with Haskell and Java.

Name: Anonymous 2011-05-16 7:03

Lisp

digit X:{\0;\1;\2;\3;\4;\5;\6;\7;\8;\9} -> X,asInt-(\0),asInt
number [@Xs] -> {N [X:!digit @Xs] -> r 10N+X Xs; N [] -> N} 0 Xs
op [X:{\+; \-; \*; \/}]->X,asSym
term [\( A:@expr \)]->[A]; [A:@number]->A
expr [A:@term O:@op B:@expr]->[O A B]; [A:@term]->A
parse X -> strip \Space X,asList | expr



Haskell

import Data.List
import Control.Monad
import Data.Char
import Debug.Trace
 
data Parser a = Parser (String -> [(a, String)])
 
parse :: Parser a -> String -> [(a, String)]
parse (Parser p) = p
 
instance Monad Parser
    where
        return a = Parser (\cs -> [(a, cs)])
        p >>= f  = Parser (\cs -> concat [parse (f a) cs' | (a, cs') <- parse p cs])
 
instance MonadPlus Parser
    where
        mzero       = Parser (\cs -> [])
        mplus p q = Parser (\cs -> parse p cs ++ parse q cs)
 
(+++) :: Parser a -> Parser a -> Parser a
p +++ q = Parser (\cs -> case parse (mplus p q) cs of
    [] -> []
    (x:xs) -> [x])
 
item :: Parser Char
item = Parser (\cs -> case cs of
    ""        -> []
    (c:cs) -> [(c, cs)])
 
sat :: (Char -> Bool) -> Parser Char
sat p = do
    c <- item
    if p c then return c else mzero
 
char :: Char -> Parser Char
char c = sat (==c)
 
notDigits = many $ sat (not . isDigit)
 
 
string :: String -> Parser String
string "" = return ""
string (c:cs) = do
    char c
    string cs
    return (c:cs)
 
many :: Parser a -> Parser [a]
many p = many1 p +++ return []
 
many1 :: Parser a -> Parser [a]
many1 p = do
    a <- p
    as <- many p
    return (a:as)
 
sepby :: Parser a -> Parser b -> Parser [a]
p `sepby` sep = (p `sepby1` sep) +++ return []
 
sepby1 :: Parser a -> Parser b -> Parser [a]
p `sepby1` sep = do
    a  <- p
    as <- many (do {sep; p})
    return (a:as)
 
chainl :: Parser a -> Parser (a -> a -> a) -> a -> Parser a
chainl p op a = (p `chainl1` op) +++ return a
 
chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a
p `chainl1` op = do {a <- p; rest a}
    where
        rest a = (do {f <- op; b <- p; rest (f a b)}) +++ return a
 
space :: Parser String
space = many (sat isSpace)
 
token :: Parser a -> Parser a
token p = do
    a <- p
    space
    return a
 
symb :: String -> Parser String
symb cs = token (string cs)
 
apply :: Parser a -> String -> [(a,String)]
apply p = parse (do {space; p})
 
expr :: Parser Int
addop :: Parser (Int -> Int -> Int)
mulop :: Parser (Int -> Int -> Int)
expr = term `chainl1` addop
term = factor `chainl1` mulop
factor = digit +++ do {symb "("; n <- expr; symb ")"; return n}
digit = do {x <- token (sat isDigit); return (ord x - ord '0')}
addop = do {symb "+"; return (+)} +++ do {symb "-"; return (-)}
mulop = do {symb "*"; return (*)} +++ do {symb "/"; return (div)}
 
apply expr "2 + 4 - 5 * (6/2)" -- [(-9,"")]

Name: Anonymous 2011-05-16 7:16

>>1
u now whats not verbose?

Zip files, that's what.

U used '[' three times, it should of be encoded with two bits or sumthin.

Off with ur verbose shit, real men edit .jar files directly & r non-verbose and manly.

Name: Anonymous 2011-05-16 7:21

>>9
explain how it works or fuck off forever

Name: Anonymous 2011-05-16 7:27

>>11
2deep4u

Name: Anonymous 2011-05-16 7:27

>>10
zips are hard to edit.

Name: Anonymous 2011-05-16 7:45

>>12
okay, fuck off then

Name: Anonymous 2011-05-16 8:05

>>14
Why so butthurt?

Name: Anonymous 2011-05-16 8:09

>>15
Why so fucking faggot?

Name: Anonymous 2011-05-16 8:12

>>16
Just admit already, you're too stupid to download interpeter's source code and see how it works yourself.

Name: Anonymous 2011-05-16 8:55

>>17
I'll download it as soon as I find it, faggot.

Name: Anonymous 2011-05-16 9:02

>>6
Why are not using the proper name for the language. You already gave it one.
Symta is a Lisp dialect. Besides, word "Lisp" angers Haskell and Python apologists, who feel inferiority of their languages.

Name: Anonymous 2011-05-16 9:04

Name: Anonymous 2011-05-16 11:11

>>19
Besides, word "Lisp" angers Haskell and Python apologists, who feel inferiority of their languages.
Fuck you faggot.

Name: Anonymous 2011-05-16 11:41

>>20
Finally. Thanks.

Name: Anonymous 2011-05-16 13:39

>>19
Besides, word "Lisp" angers Haskell and Python apologists, who feel inferiority of their languages.
True.

Name: Anonymous 2011-05-16 13:55

>>23
fuck off and die lithpfag

Name: Anonymous 2011-05-16 14:00

>>24
angerYep.

Name: Anonymous 2011-05-16 14:00

>>25
*
anger
Yep.

Name: Anonymous 2011-05-16 14:02

>>25
you fucking fail, lithpfag

Name: Anonymous 2011-05-16 14:23

>>27
Rage harder.

Name: Anonymous 2011-05-16 14:24

>>28
fuck you harder

Name: Anonymous 2011-05-16 14:39

>>29
Please, more.

Name: Anonymous 2011-05-16 14:41

I don't get it. Most people who like Haskell like Lisp, I don't see why should I be enraged by this.
But honestly, your DSL looks ugly and obfuscated. I like normal CL more and Haskell even more. The only thing that gets on my nerves is you spamming that shit all over the place.
But still better than autism threads, so yeah, whatever.

Name: Anonymous 2011-05-16 15:58

>>31
enjoy your sea of parens and nomads, faggot

Name: Anonymous 2011-05-16 16:00

>>32
sea of parensSomeone doesn't know how to use Paredit.

Name: Anonymous 2011-05-16 16:10

>>33
i only use ed, the one true text editor

Name: Anonymous 2011-05-16 18:45

>>34
What about Text Edit?

Name: Anonymous 2011-05-17 1:20

>>35
working out language design flaws in an IDE goes against my principles

Name: Anonymous 2011-05-17 1:38

>>36
(I (can (match (parens) without) paren) matching.

Can
   you
      indent
            your
                code
            by
      hand
   without
tab?

(I (only have) to
   (press one
     (#\) for)
     (each #\()))

You,
 unless
  your
   code
    is
   indented
  like
 this,
        Will
            be
              a
               nightmare
              to
            indent
        correctly.
   Indentation
              is
                flawed,
              get
   over
it.

Name: Anonymous 2011-05-17 1:48

>>37
Not really, I can just write a script that auto-indents everythin--oh wait, shit

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