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

I'm learning Haskell.

Name: Anonymous 2011-10-08 7:33


Lisp              | Haskell
------------------|------------------
map f l           | map f l
map list l1 l2    | zip l1 l2
map list l1 l2 l3 | zip3 l1 l2 l3
map f l1 l2       | zipWith f l1 l2
map f l1 l2 l3    | zipWith3 f l1 l2 l3



Lisp                        | Haskell
----------------------------|---------------------------------------------------
* (floor (/ 1 0))           | Prelude> floor (1/0)
DIVISION-BY-ZERO signalled  | 1797693134862315907729305190789024733617976978942306572
                            | 7343008115773267580550096313270847732240753602112011387
                            | 9871393357658789768814416622492847430639474124377767893
                            | 4248654852763022196012460941194530829520850057688381506
                            | 8234246288147391311054082723716335051068458629823994724
                            | 5938479716304835356329624224137216



Lisp                             | Haskell
---------------------------------|---------------------------------------------------
* (expt -1 (+ 2 1.0e-15 -1e-15)) | Prelude> (-1)**(2 + 1e-15 - 1e-15) :: Double
1.0                              | NaN



Lisp                     | Haskell
-------------------------|-------------------------
* (expt -1 (exp 1))      | Prelude> (-1) ** exp 1
#C(-0.6332554 0.7739428) | NaN



Haskell                          | Lisp
---------------------------------|---------------------------------
zip      l1 l2                   | map list l1 l2
zip3     l1 l2 l3                | map list l1 l2 l3
zip4     l1 l2 l3 l4             | map list l1 l2 l3 l4
zip5     l1 l2 l3 l4 l5          | map list l1 l2 l3 l4 l5
zip6     l1 l2 l3 l4 l5 l6       | map list l1 l2 l3 l4 l5 l6
zip7     l1 l2 l3 l4 l5 l6 l7    | map list l1 l2 l3 l4 l5 l6 l7
N/A                              | map list . ls
map      f  l                    | map f l
zipWith  f  l1 l2                | map f l1 l2
zipWith3 f  l1 l2 l3             | map f l1 l2 l3
zipWith4 f  l1 l2 l3 l4          | map f l1 l2 l3 l4
zipWith5 f  l1 l2 l3 l4 l5       | map f l1 l2 l3 l4 l5
zipWith6 f  l1 l2 l3 l4 l5 l6    | map f l1 l2 l3 l4 l5 l6
zipWith7 f  l1 l2 l3 l4 l5 l6 l7 | map f l1 l2 l3 l4 l5 l7
N/A                              | map f . ls



Lisp                        | Haskell
----------------------------|---------------------------------------------------
$ sbcl                      | $ ghci
* +3                        | Prelude> +3
3                           | <interactive>:1:0: parse error on input `+'
*                           | Prelude>



Lisp                        | Haskell
----------------------------|---------------------------------------------------
reduce                      | fold, foldl, foldr, foldl',
                            | foldr1, foldl1, foldl1
                            |
elt                         | fst snd thd fth ffth...




Lisp                                  | Haskell
--------------------------------------|-----------------------------------------
(EVAL (SETQ X '`(EVAL (SETQ X ',X)))) | <interactive>:1:0: Not in scope: `eval'



Lisp                    | Haskell
------------------------|-------------------------------------------------------
* (type-of 123)         | <interactive>:1:0: Not in scope: `typeof'
(INTEGER 0 536870911)   |



Lisp                      | Haskell
--------------------------|-----------------------------------------------------
(map #'map (read) (read)) | Couldn't match expected type `[t1] -> t'
                          |        against inferred type `[[a] -> [b]]'



Lisp                       | Haskell
---------------------------|----------------------------------------------------
Prefix notation.           | Prelude> let fac 1 = 1; fac n = n * fac n-1
                           | Prelude> fac 4
                           | *** Exception: stack overflow
                           |
                           | Prelude> let f 1 = 1; f n = ((*)(n)((f) ((-) n 1)))
                           | Prelude> ((f) 4)
                           | 24




Lisp                     | Haskell
-------------------------|------------------------------------------------------
* (setf Tree             | data Tree a = Empty | Node (Tree a) a (Tree a)
        '((n 5 (n 5 n))  | tree = Node
          4              |       (Node Empty 5 (Node Empty 5 Empty))
         ((n 5 n) 6 n))) |        4
                         |       (Node (Node Empty 5 Empty) 6 Empty)



Lisp                       | Haskell
---------------------------|---------------------------------------------------
Speed comparable to C/C++  | The fastest BWT implementation written in Haskell,
                           | after weeks of optimization by several experts,
                           | remained over 200x slower than C++.





Lisp                      | Haskell
--------------------------|-----------------------------------------------------
* (defun yoba (a b)       | Prelude> :{
    (if (< a b)           | Prelude| let yoba a b = if a < b
        '(123 "abc")      | Prelude|                then [123, "abc"]
        '("abc" 123)))    | Prelude|                else ["abc", 123]
* (* 2 (car (yoba 1 2)))  | Prelude> :}
245                       | <interactive>:1:30:
*                         |     No instance for (Num [Char])
                          |       arising from ...

Name: Anonymous 2011-10-08 13:58

>>22
Abstract models care not for any particular physical reality, also I think you're also wrong about that number:
http://en.wikipedia.org/wiki/Orders_of_magnitude_(data)

2305 - The information capacity of the observable universe, according to Seth Lloyd.Not only that, the observable universe is likely not the whole universe as well.

An abstract model could have a finite, limited version that could be implemented physically. Maybe a better way for you to practically imagine my idea would be this: imagine you're designing a specification, a protocol, and this protocol cannot ever be changed (for example IPv4 isn't likely to change in the future) and it needs to support an efficient encoding of integers (bignums) regardless of the hardware/software changes that may follow in the near and far future, nor should it be designed to target only the current top-of-the-line processors, instead it should be fine to implement a limited version of it, but at the same time, fine to reason abstractly about it and present mathematical proofs about soundness of certain properties of it.

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