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

Scala

Name: Anonymous 2011-04-18 9:55

Listen brahs. I have a dirty anus that needs cleaning: Java. I learned Java as my first language in school and now that I learned Scheme and am learning Haskell, I figured I may as well not let that go to waste and learn Scala. Is it simple to go from Java to Scala? Or is the syntax strange in some places. Because I looked over some code snippets and it seemed decent.

Name: Anonymous 2011-04-18 12:35

>>57-
Please ignore troll posts!!!

Name: Anonymous 2011-04-18 12:36

>>55
What profit in this "pure functional language" buzzword?

Name: Anonymous 2011-04-18 12:36

>>56
Recursive anonymous functions? I wish I'd thought of that. Oh wait. I did. Expand that concept to include whole modules? Recursive modules? Oh that's right.

Name: Anonymous 2011-04-18 12:37

>>58
10/10. Master trolling.

Name: Anonymous 2011-04-18 12:37

>>58
Pure functional language -- a family of toy languages, useless for solving real world problems. Examples: unlambda, brainfuck.

Name: Anonymous 2011-04-18 12:38

>>61
brainfuck
IHBT.

Name: Anonymous 2011-04-18 12:38

>>61
Those are esoteric, not pure functional. 0/10. Go back to troll school

Name: Anonymous 2011-04-18 12:39

>>63
Ignore him.

Name: Anonymous 2011-04-18 12:39

>>63
Haskell is esoteric and not pure functional (unsafe perform io and the likes).

Name: Anonymous 2011-04-18 12:40

>>65
Monad- IHBT

Name: Anonymous 2011-04-18 12:41

Nobody can explain in simple words why Haskell is better than LISP. This proves that haskell is another no-better useless "blub" language.

Name: Anonymous 2011-04-18 12:41

>>65
You are a monad:
instance Monad Troll where
  (>>=) = yhbt
  return = ihbt

Name: Anonymous 2011-04-18 12:42

>>66
"monad" is buzzword for continuation-passing-style.

Name: Anonymous 2011-04-18 12:42

>>67
Nobody says that. And it's Lisp, not LISP. IHBT.

Name: Anonymous 2011-04-18 12:43

>>67
They're at the same level, brah. Nice try though.
>>69
Lol monads return side effects but okay. IHBT

Name: Anonymous 2011-04-18 12:44

>>70
It's Ihbt, not IHBT. And i'm not IHBT-fag.

Name: Anonymous 2011-04-18 12:45

>>72
-fag
Back to the imageboards, please.

Name: Anonymous 2011-04-18 12:47

>>73
whats wrong with imageboards?

Name: Anonymous 2011-04-18 12:47

>>72
So many cool stories. This thread is a pit of trolls. Ignore and move on. Too many anuses murdering up in this goyim.

Name: VIPPER 2011-04-18 12:47

>>72
Aim for the anus.

Name: Anonymous 2011-04-18 13:00

>>48
You mean
foldl1 (+) xs

is more primitive than

int acc;
for(int i = 0; i < n; i++) {
  acc += xs[i];
}


?

replicateM_ 10 (putStrLn "you mena haskal?")

is more primitive than

for(int i = 0; i < 10; i++){
  printf("you mena haskal?");

}

?

mapM_ (print . (*2)) xs

is more primitive than

for(int i = 0; i < n; i++){
  printf(xs[i] * 2);
}


?

Name: Anonymous 2011-04-18 13:05

>>77
OMFG! Ignore the trolls and ignore the thread!

Name: Anonymous 2011-04-18 13:09

>>77
haskell

foldl1 (+) xs


lisp

fold + xs

Name: Anonymous 2011-04-18 13:11


Haskell

mapM_ (print . (*2)) xs


Lisp (DSL)

map (say 2?) xs

Name: Anonymous 2011-04-18 13:11

>>79
Cool story cause its the same thing?
Just let this thread die.

Name: Anonymous 2011-04-18 13:12

>>79
you mena (mydslmacro fold + xs) or maybe
(mydslmacro "fold + xs")

otherwise not lisp

Name: Anonymous 2011-04-18 13:15

>>82
It's a Lisp dialect, because it has macros.

e:m:if @body -> $@body.{#($@t then $@a else $@b) -> #(_if $t $a $b)
                       ;#($@t then $@a         ) -> #(_if $t $a no)
                       ;#($t       $a       $b ) -> #(_if $t $a $b)
                       ;#($t       $a          ) -> #(_if $t $a no)
                       ;default                  -> error "if: syntax error"}

Name: Anonymous 2011-04-18 13:16

>>83
So is Nemerle, so is Perl 6.

Name: Anonymous 2011-04-18 13:16

>>81
It isnt. Haskell needs mapM_, zip, zipWith, zip3, etc, where LISP needs only map.

Name: Anonymous 2011-04-18 13:17

Now, excuse me, I have a thread to bury.

Name: Anonymous 2011-04-18 13:17

It's a Lisp dialect, because it has macros.
You mena Lisepples?

Name: Anonymous 2011-04-18 13:17

Name: Anonymous 2011-04-18 13:17

>>84
They've different kind of macros. Lisp on the, other hand, rewrites directly SEXPs.

Name: Anonymous 2011-04-18 13:17

Name: Anonymous 2011-04-18 13:17

Name: Anonymous 2011-04-18 13:17

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

>>87
sepples doesn't have lists.

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:18

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:19

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:20

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:21

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:22

Name: Anonymous 2011-04-18 13:26

A very practical language.

module Sort where
 
 -- natural numbers
 data Zero
 data Succ a
 
 -- booleans
 data True
 data False
 
 -- lists
 data Nil
 data Cons a b
 
 -- shortcuts
 type One   = Succ Zero
 type Two   = Succ One
 type Three = Succ Two
 type Four  = Succ Three
 
 -- example list
 list1 :: Cons Three (Cons Two (Cons Four (Cons One Nil)))
 list1 = undefined
 
 -- utilities
 numPred :: Succ a -> a
 numPred = const undefined
 
 class Number a where
   numValue :: a -> Int
 
 instance Number Zero where
   numValue = const 0
 instance Number x => Number (Succ x) where
   numValue x = numValue (numPred x) + 1
 
 numlHead :: Cons a b -> a
 numlHead = const undefined
 
 numlTail :: Cons a b -> b
 numlTail = const undefined
 
 class NumList l where
   listValue :: l -> [Int]
 
 instance NumList Nil where
   listValue = const []
 instance (Number x, NumList xs) => NumList (Cons x xs) where
   listValue l = numValue (numlHead l) : listValue (numlTail l)
 
 -- comparisons
 data Less
 data Equal
 data Greater
 
 class Cmp x y c | x y -> c
 
 instance Cmp Zero Zero     Equal
 instance Cmp Zero (Succ x) Less
 instance Cmp (Succ x) Zero Greater
 instance Cmp x y c => Cmp (Succ x) (Succ y) c
 
 -- put a value into one of three lists according to a pivot element
 class Pick c x ls eqs gs ls' eqs' gs' | c x ls eqs gs -> ls' eqs' gs'
 instance Pick Less    x ls eqs gs (Cons x ls) eqs gs
 instance Pick Equal   x ls eqs gs ls (Cons x eqs) gs
 instance Pick Greater x ls eqs gs ls eqs (Cons x gs)
 
 -- split a list into three parts according to a pivot element
 class Split n xs ls eqs gs | n xs -> ls eqs gs
 instance Split n Nil Nil Nil Nil
 instance (Split n xs ls' eqs' gs',
           Cmp x n c,
       Pick c x ls' eqs' gs' ls eqs gs) =>
          Split n (Cons x xs) ls eqs gs
 
 listSplit :: Split n xs ls eqs gs => (n, xs) -> (ls, eqs, gs)
 listSplit = const (undefined, undefined, undefined)
 
 -- zs = xs ++ ys
 class App xs ys zs | xs ys -> zs
 instance App Nil ys ys
 instance App xs ys zs => App (Cons x xs) ys (Cons x zs)
 
 -- zs = xs ++ [n] ++ ys
 -- this is needed because
 --
 -- class CCons x xs xss | x xs -> xss
 -- instance CCons x xs (Cons x xs)
 --
 -- doesn't work
 
 class App' xs n ys zs | xs n ys -> zs
 instance App' Nil n ys (Cons n ys)
 instance (App' xs n ys zs) => App' (Cons x xs) n ys (Cons x zs)
 
 -- quicksort
 class QSort xs ys | xs -> ys
 instance QSort Nil Nil
 instance (Split x xs ls eqs gs,
           QSort ls ls',
       QSort gs gs',
       App eqs gs' geqs,
       App' ls' x geqs ys) =>
          QSort (Cons x xs) ys
 
 listQSort :: QSort xs ys => xs -> ys
 listQSort = const undefined

Name: Anonymous 2011-04-18 13:28

Name: Anonymous 2011-04-18 13:28

Name: Anonymous 2011-04-18 13:28

Name: Anonymous 2011-04-18 13:28

Name: Anonymous 2011-04-18 13:28

Name: Anonymous 2011-04-18 13:28

Name: Anonymous 2011-04-18 13:28

Name: Anonymous 2011-04-18 13:28


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