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
--------------------------------------|-----------------------------------------
(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 ...
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:
Anonymous2011-10-08 8:10
LISP is a dynamic language like PHP. That's why no one takes it seriously.
Name:
Anonymous2011-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:
Anonymous2011-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:
Anonymous2011-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:
Anonymous2011-10-08 8:31
haskell is fucking worthless
the only good thing is monads and that's not even specific to haskell
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.
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:
Anonymous2011-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.
>>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:
Anonymous2011-10-08 13:36
>>21
There is no materia in the whole universe to fill 64-bit address space.
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.
>>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.
>>18
It is when you want to find the solutions to 1/x + 1/y = 1/n! when N is reasonably large (>1000).
Name:
Anonymous2011-10-09 8:42
>>30
But at that point, GMP and most BigInt implementations fuck up anyway...
Name:
Anonymous2011-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:
Anonymous2011-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.
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))
i think lisp should get it right, it's not cool if you jump from one field to another (mathematicaly speaking)
Name:
Anonymous2011-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'
>>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:
Anonymous2011-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:
Anonymous2011-12-28 2:05
>>50 crap :: (crap -> crap) -> crap
looks like crap.
is that because it aint Lisp?
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*(*)(...)