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

Pages: 1-4041-

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 7:34


http://hackage.haskell.org/packages/archive/base/latest/doc/html/src/GHC-Show.html#ShowS

Haskell

instance  (Show a, Show b) => Show (a,b)  where
  showsPrec _ (a,b) s = show_tuple [shows a, shows b] s

instance (Show a, Show b, Show c) => Show (a, b, c) where
  showsPrec _ (a,b,c) s = show_tuple [shows a, shows b, shows c] s

instance (Show a, Show b, Show c, Show d) => Show (a, b, c, d) where
  showsPrec _ (a,b,c,d) s = show_tuple [shows a, shows b, shows c, shows d] s

instance (Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) where
  showsPrec _ (a,b,c,d,e) s = show_tuple [shows a, shows b, shows c, shows d, shows e] s

instance (Show a, Show b, Show c, Show d, Show e, Show f) => Show (a,b,c,d,e,f) where
  showsPrec _ (a,b,c,d,e,f) s = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g)
        => Show (a,b,c,d,e,f,g) where
  showsPrec _ (a,b,c,d,e,f,g) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h)
         => Show (a,b,c,d,e,f,g,h) where
  showsPrec _ (a,b,c,d,e,f,g,h) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i)
         => Show (a,b,c,d,e,f,g,h,i) where
  showsPrec _ (a,b,c,d,e,f,g,h,i) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                      shows i] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j)
         => Show (a,b,c,d,e,f,g,h,i,j) where
  showsPrec _ (a,b,c,d,e,f,g,h,i,j) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                      shows i, shows j] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k)
         => Show (a,b,c,d,e,f,g,h,i,j,k) where
  showsPrec _ (a,b,c,d,e,f,g,h,i,j,k) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                      shows i, shows j, shows k] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
          Show l)
         => Show (a,b,c,d,e,f,g,h,i,j,k,l) where
  showsPrec _ (a,b,c,d,e,f,g,h,i,j,k,l) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                      shows i, shows j, shows k, shows l] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
          Show l, Show m)
         => Show (a,b,c,d,e,f,g,h,i,j,k,l,m) where
  showsPrec _ (a,b,c,d,e,f,g,h,i,j,k,l,m) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                      shows i, shows j, shows k, shows l, shows m] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
          Show l, Show m, Show n)
         => Show (a,b,c,d,e,f,g,h,i,j,k,l,m,n) where
  showsPrec _ (a,b,c,d,e,f,g,h,i,j,k,l,m,n) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                      shows i, shows j, shows k, shows l, shows m, shows n] s

instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k,
          Show l, Show m, Show n, Show o)
         => Show (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) where
  showsPrec _ (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) s
        = show_tuple [shows a, shows b, shows c, shows d, shows e, shows f, shows g, shows h,
                      shows i, shows j, shows k, shows l, shows m, shows n, shows o] s

Name: Anonymous 2011-10-08 8:10

LISP is a dynamic language like PHP.  That's why no one takes it seriously.

Name: Anonymous 2011-10-08 8:21

Haskell is currently the best language for new projects. Extremely expressive language and a powerful type system will allow you to quickly write elegant and reliable code. Language is not so common. while your competitors are using older technology based on the untyped-calculus lamblia or mandatory approach with elements of dynamic typing, you can at times raise its efficiency by employing System F - the latest achievement of science in the field of static typing.
But that's not all. In the life of any startup comes a point when it becomes a product and support the project attracted more developers. At this stage, the prevalence and availability of language begins to play a crucial role. Due to the active promotion of Haskell and functional programming in commercial programmers, as well as support for this language from the leader in the manufacture Office applications and operating systems - Microsoft, you can be sure that in future you do not have to burn your project to C + +, as This was the infamous design Paul Graham. Haskell will give you a guarantee of success and stability of your endeavors.
Select Haskell and now a few years you will be able to enjoy the results of their labors - a successful project, executed with all the latest technologies and industry standards.
Haskell - Your guide to success in the world of software development.
Choose Haskell.

Name: Anonymous 2011-10-08 8:23

Haskell is great and very powerful. But the main thing - it has already invested enough money to consider it unsinkable.

If you assume the continuous development of your project, then it is best to choose logchinee Haskell. But the happiness of him would be incomplete if it were not for two outstanding free product.

The first - come with a monad Haskell. This is just one of a class type, which adds the advantages applicative model (and solutions like those used in PHP-projects) is not selected by the traditional Haskell-chips.

Of course blogs enthusiasts Haskell and some books can be found as harmful input / output functions, but to understand the cons of this, simply try to write to Fail without them.

The second - type classes. This is some abstract entity, which enable your specific type to use some features. What functions - depends on the specific class types, and how these functions are implemented for a particular type - depends on the embodiment of class types for this type. By creating a separate schema for each subsystem, you can use their (de facto, the pieces developed solutions) in other projects. There are a lot of useful information.

Indeed, at present, the development of systems-level ERP, when a new treaty to introduce you actually begin to develop a separate branch versions on your system.

It is possible that at the next company will need to take some of your system and to develop together with experts of the customer. In such circumstances, both of the aforementioned product, it becomes necessary for the development of your project.

Please note that Leksah, Glasgow Haskell Compiler, interpreter GHCi, fremvork Prelude, Monad type classes - are free products that can be legally used in commercial projects.

Name: Anonymous 2011-10-08 8:27

Haskell - a simple and understandable language for normal people like physicists and mathematicians free from bytefuckery and makes specially breed gay programmers redundant. Yes you heard right. Once this language to normal people will spread, seasoned assfuckery byte-sparta of von Neumann architecture and fucked into mouth applicative order combat pidarasov programmers will lose all meaning. What will do after this pathetic sub-human, who five years of brain washing their all human? We can only interrupt his miserable existence.

Name: Anonymous 2011-10-08 8:31

haskell is fucking worthless

the only good thing is monads and that's not even specific to haskell

Name: Anonymous 2011-10-08 8:31

for me at least the best of haskell is the separation of concerns

I write the algorithm in one module

on a second one I call it with Control.Parallel.Strategies to make it parallel

on another I call it utilizing a lazy feature of the algo.

on another I just make IO and Gui.

then i cum into her hot sister three times in a row

Name: Anonymous 2011-10-08 8:54

a `par` (b `pseq` (c a b))

Write something with same effect in lisp, faggot.

Name: Anonymous 2011-10-08 9:14

>>9

(par a (pseq b (c a b)))

Name: Anonymous 2011-10-08 10:50

Prelude> floor (1/0)
179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

Anyone knows what's going on here?

Name: Anonymous 2011-10-08 11:05

Name: Anonymous 2011-10-08 11:05

>>11
Stack monadic pointer overflow.
Nice dubz, btw.

Name: Anonymous 2011-10-08 11:19

I like both. And most of your examples are stupid, but that's because you're trolling.

Name: Anonymous 2011-10-08 11:26

11:25 < jorrik> floor (1/0)
11:25 < jorrik> what gives?
11:25 < Saizan> > floor (1/0)
11:25 < lambdabot>  
179769313486231590772930519078902473361797697894230657273430081157732675805...

Name: Anonymous 2011-10-08 11:53

After 2 minutes in the REPL, I figured what >>1's issue is: Haskell threated 0 as 0.0 or as 2^-1024 (smallest non-zero floating point it could represent), thus it actually did 1.0/*2^-1024) = 2^1024 = *that big number*.

CL-USER> (/ 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 (expt 2 #x400))

Not exactly ideal behaviour, but partially understandable. The 0 in a 1/0 when doing a limit is actually an infinitely small number approaching 0, thus you get "infinity" (divergence) as the result, but since the smallest number approaching 0 for a the concrete/finite implementation used in Haskell is 2^-1024, you get that result.

Name: >>16 2011-10-08 12:05

Also, I'm guessing >>1 is Symta/``in Lisp''-guy or someone who read his examples.
I've been thinking lately about the implementation of an abstract machine over Peano Arithmetic which is similar to lambda calculus/universal turing machine in that it has infinite memory (actually, that's wrong, it has unbounded memory, but it's representable as always a finite integer, no matter how large) and it got me thinking about a good way of encoding integers(bignums) as I need to be able to encapsulate/store them within more regular memory (also integers). My current naive encoding is this:
encoding of n = 1...repeated log2_n times...1,0,n(taking 2^(log2_n) bits).
It seems a bit inefficient and I wonder if I should instead use recursive applications of log2_n instead to encode the length.
The other option would be to use a terminator symbol that specifies when a number is complete.
To my minor, but expected annoyance I found out that SBCL and SML's bignum's are actually using a fixed size field for representing the size (which depends on what architecture you run it - it's just derived from the CPU's register/max memory size, which makes perfect sense when you're dealing with a finite physical RAM/register machine, but might not make as much sense if you could serialize your results on disk or if you were working on an abstract machine model divorced from this particular physical reality).

Name: Anonymous 2011-10-08 13:03

>>17
>To my minor, but expected annoyance I found out that SBCL and SML's bignum's are actually using a fixed size field for representing the size
There is no reason using numbers bigger than address space.

Name: Anonymous 2011-10-08 13:07

>>18
Oh, but there can be. Just not for most casual programs.

Name: Anonymous 2011-10-08 13:18

>>19
Use 64-bit MMU.

Name: Anonymous 2011-10-08 13:24

>>20
I suppose that would be enough for a lot of practical applications.
Not nearly enough for my abstract model though, hence I'll keep on thinking about what would be a decent, not too wasteful (but not too painful to work with either) encoding for an unbounded integer.

Name: Anonymous 2011-10-08 13:36

>>21
There is no materia in the whole universe to fill 64-bit address space.

Name: David Hilbert 2011-10-08 13:47

>>22
What if one wants to represent twice the materia in the whole universe?

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.

Name: Anonymous 2011-10-09 1:30

>>23
He is probably Terry Davis.

>>24
Anyway, 64-bit should be enough for everyone. You can map every device on earth to 64-bit address space.

Name: Anonymous 2011-10-09 1:54

>>25
Anyway, 64-bit should be enough for everyone. You can map every device on earth to 64-bit address space.This is an abstract model. For example, this abstract model should be able to operate on all kinds of finite, but unbounded data. For example, it could be used to model a system of physics as big as the observable universe (this is just an example, not the goal of the model).
For most practical applications that we can do here on Earth, I agree, 64bit will likely be enough, but think of this as an abstract model (like a Turing Machine or Lambda Calculus) which needs to be able to perform any computable operation, regardless of wether it can be implemented in this particular universe or not.

Name: Anonymous 2011-10-09 4:43

Skilled troll.

Name: Anonymous 2011-10-09 5:23

(-1) ** (2 + (1e-15 - 1e-15))
1.0

Newbies.

Name: Anonymous 2011-10-09 5:50

>>28
So, in Haskell addition isnt associative?

Name: Anonymous 2011-10-09 8:41

>>18
It is when you want to find the solutions to 1/x + 1/y = 1/n! when N is reasonably large (>1000).

Name: Anonymous 2011-10-09 8:42

>>30
But at that point, GMP and most BigInt implementations fuck up anyway...

Name: Anonymous 2011-10-10 2:19

Tomorrow look for a book on the Internet Categories for the Working Mathematician. Fuck if anything you do not understand. Then go to haskell.org and learn the standard library from cover to cover. Then grind, namely, female, notch definition language and standard libraries - The Haskell 2010 Report, that bounced away from the teeth. When you write your first katamorfizm on the way to study the theory of types at the level TaPL-but, download and learn any haskellevskuyu library with world-class functors and morphisms recommend category-extras or recursion-schemes. How do I convert a standard prelude to at least all recursive schemes have been expressed in terms of comonad, you can go further - you'll get a fascinating world of category theory. Katamorfizmy, paramorfizmy, zigomorfizmy, histomorfizmy, prepromorfizmy, anamorphism, apomorfizmy, futumorfizmy, postpromorfizmy, hilomorfizmy, kronomorfizmy, sinkronomorfizmy, ekzomorfizmy, metamorphism, algebra and coalgebra dinamorfizmy Calvin Elgota last. Success Hickey vyblyadkov / bydlokoderov simply type reyfaga or sisyarp / java-developers who are working in Luxoft will not excite you, and within half a year you will receive these grants, that any professor would flow at the mention of a list of your publications.

Name: Anonymous 2011-10-10 3:45

I'm still grovelling through reams of stuff, trying to find out how to
open *and* read a file in a grown up way, and I find various programs
on haskell.org. There's an implementation of cat(1)! That's the thing!
A file concatenator must be able to open *and* read it's file. Eagerly
I download it. Curiously there doesn't seem to be any error handling.
I compile it and point it at a non-existent file. The program crashes.
Horribly. So much for Cat.hs. I feel glad I hadn't been able to cope
with the video of Simon Peyton-Jones OSCON talk, because the camera
operator kept filming his face while he's gesturing at the specific
line of code he's talking about with a pointer! After seeing Cat.hs do
essence of FAIL just opening a file, claims that Haskell could serve
as a scripting language suitable for the crew of the Black Pearl in
yonder corner to use would pain me.

Name: Anonymous 2011-12-27 12:25

You asked Haskell to floor Infinity:


1 / 0

Infinity

floor (1 / 0)

179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

That is a strange request, at least not a mathematically valid one.

How does lisp handle this?

In Haskell:

let b = 1 / 0
let c = 1 / 0
b
Infinity
b == c
True
b + c == b
True
b - b
NaN
let 2 + 2 = 5 in 2 + 2

Name: Anonymous 2011-12-27 14:54

Oh, it's this thread again.

Name: Anonymous 2011-12-27 15:40

Everyone floors infinity on their first trip.

Name: Anonymous 2011-12-27 20:34

>>11
Anyone knows what's going on here?
Haskell can divide by zero. Haskell is Chuck Norris! OH SHI-

Name: Anonymous 2011-12-27 20:48

>>12
how did you make /prog/ look like that?

Name: Anonymous 2011-12-27 20:58

>>38
Yotsuba, nigger!

Name: Anonymous 2011-12-27 22:12

>>12

same reaction here. Such is life. map list ery day.

Name: Anonymous 2011-12-27 22:20

This is SBCL 1.0.54, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>;.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (expt -1 (+ 2 1.0e-15 -1e-15))

1.0
* (+ 2 1.0e-15)

2.0
*


yeah... no

Name: Anonymous 2011-12-27 22:29

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

i think here in fact haskell does the right thing.

in lisp you jump to the complex number vagon, where you instead wanted a Floating number. if i wanted a complex number in haskell i would had

import Data.Complex

Prelude Data.Complex> ((-1) :+ 0)** (exp 1)
(-0.6332556513148192) :+ 0.773942685266709

i think lisp should get it right, it's not cool if you jump from one field to another (mathematicaly speaking)

Name: Anonymous 2011-12-27 22:37

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++.


Source?

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

uhh was "import Data.Typeable" too much for you?

Prelude Data.Typeable> typeOf 2.6963
Double
Prelude Data.Typeable> typeOf "mom i love you"
[Char]

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


this one is stupid, you defined fac 2 diferent times.
Prelude Data.Typeable> let {fac 1 = 1; fac n = n * fac (n-1)}
Prelude Data.Typeable> fac 4
24

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

haskell doesn't need eval.

why am i posting on a troll thread?

Name: Anonymous 2011-12-27 22:47

>>43

you are providing hope for those of us that don't yet know haskel.

Name: Anonymous 2011-12-27 22:48

>>41
>your number by default is rounded upon presentation
>be surprised when it appears round
hurr haskellfags

Name: Anonymous 2011-12-27 23:06

>yoba
Yet another russian faggot.

Name: Anonymous 2011-12-27 23:28

>>45
why should that be? not a haskellfag but it seem rather strange.

(+ 2 1.0e-15) != 2

why round the result to appear as a Int when it obviously was a floating point operation?

or is for some cause i don't know?

Name: Anonymous 2011-12-28 1:41


Lisp               | Haskell
-------------------|------------------------
(lambda (x) (x x)) | Prelude> \x -> x x
                   |     Occurs check: cannot construct the infinite type

Name: sageru 2011-12-28 1:42

>>47
I was just trolling, but I assume it's because you're actually looking at the number at a human interface. If you passed the value of the operation to a function and then outputted the value to a file or read it using a custom reply command, I'm guessing it would show the actual value. My reasoning would be if you tried to see the actual value anyways, it would either like like a ridiculously long value, or it would give the mantissa and multiplicand or whatever the names are.

Name: Anonymous 2011-12-28 1:47

>>48
    Lisp               | Haskell
    -------------------|------------------------
    (lambda (x) (x x)) | Prelude> \x -> x x
                       |     Occurs check: cannot construct the infinite type

uhh

fix :: (a -> a) -> a
fix f = let x = f x in x

i am not even a real haskeller

Name: Anonymous 2011-12-28 2:05

>>50
crap :: (crap -> crap) -> crap
looks like crap.
is that because it aint Lisp?

Name: Anonymous 2011-12-28 2:19

>>51
it can be what ever you want, it will typecheck anyways

Name: Anonymous 2011-12-28 3:30

yoba
вот ты и спалился, петушок

Name: Anonymous 2011-12-28 3:51

>>51
Lisp is shit, but Haskell is THE worst faggot shit.

Name: Anonymous 2011-12-28 5:42

>>50

yeah, the type expression for a function that returns itself is infinitely long. You run into the same problem in C if you want to declare a function that returns a pointer to itself. You ahve to cast it as void* and then recast the return value to void*(*)(...)

Name: Anonymous 2011-12-28 6:37

>void*(*)(...)
C is easy and simple..they said.

Name: Anonymous 2012-04-15 1:49

bump

Name: Anonymous 2012-04-15 2:05

>>57
SO FUCKING FUCK YOU FAGGOT FOR NECROBUMPING

YES I AM MAD

Name: >>55 2012-04-15 2:30

>>56
example:

scheme:


((lambda (x) (x x)) (lambda (x) (x x))


although let's write using named functions to make the translation easier:


(define (u f) (f f)) ;; take a function and call it with itself as the argument.
(u u) ;; infinite loop


c


#include <stdio.h>

void* u(void* f) {
  printf("called u\n"); // It'll print this a lot before it segfaults from a stack explosion.
  return ((void*(*)(void*))f)(f);
}

void main() {
  u(u);
}


You could also write it like this:

#include <stdio.h>

void* u(void*(*f)(void*)) {
  printf("called u\n");
  return f(f);
}

void main() {
  u((void*(*)(void*))u);
}

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