Вы находитесь на странице: 1из 2

What is natural language processing?

Stub
What is Haskell?
Haskell is a static, pure, lazy, functional language. Gee, that sounds an awful
lot like buzzword lingo!
That may well be, but these properties make Haskell a very effective language, a
nd sometimes a bit
odd. These properties are also opposite to most mainstream languages. For instan
ce, Java is static,
impure, eager, and not functional, Ruby is dynamic, impure, eager, and only func
tional at times. While
it is hard to give an accurate definition of every characteristic, we will try a
nyway.
Functional: Haskell puts an emphasis on functions and treats computation as the
evaluation of
functions. This in contrast to so-called imperative languages, that specify an o
rder of instructions. As
such, Haskell functions very often resemble mathematical functions closely. Bein
g functional also has
practical implications. For instance, iteration is accomplished by means of recu
rsion, and functions
are also values and can be passed to other functions.
Pure: Haskell is a pure language, in that functions do not have side-effects. Th
is means that existing
values cannot be changed, since changing data would be a side-effect of a functi
on. It also guarantees
that the evaluation of a function will always result in the same value given the
same function
arguments.
Lazy: As a lazy language, Haskell only evaluates expressions when needed. Say yo
u just implemented
a function that gives a list of all prime numbers. In a strict language, the fun
ction that makes the list
will never terminate (since there are always more prime numbers). Haskell, on th
e contrary, will only
Introduction
2
evaluate this function when and as much as necessary. As long as you take a fini
te number of primes
from the list, the program will happily terminate.
Static: Haskell programs are compiled before they can run. This means that the H
askell compiler will
catch many errors for you at compile-time, rather than finding them when your pr
ogram is used in
production. Additionally, Haskell does type-inference. This means that the Haske
ll compiler can find
out the types of values most of the times, and you do not need to type-annotate
every value.
If you have prior programming experience in an imperative or eager language, Has
kell can feel a bit
odd in the beginning. Don't worry, you will feel warm and fuzzy eventually!
You may ask why we chose Haskell as the main programming language for this book,
rather than
a more mainstream language. During our own experiences developing natural langua
ge processing
tools, we noticed that very many natural language processing tasks are relativel
y straightforward data
transformations. Haskell is a language that is exceptionally good at data transf
ormations. First of all,
because it has higher order functions (functions that take functions as an argum
ent) that traverse lists,
sets, mappings, etc. Second, Haskell makes it easy to construct more complex tra
nsformations out of
simple transformations.
Although this book does not provide a full introduction to the Haskell programmi
ng language,
we try to cover Haskell concepts extensively when required. If you require more
background on
certain concepts, we recommend you to consult the book Learn Haskell for Great G
ood! [http://
learnyouahaskell.com/]

Вам также может понравиться