Catálogo de publicaciones - libros

Compartir en
redes sociales


Practical OCaml

Joshua B. Smith

Resumen/Descripción – provisto por la editorial

No disponible.

Palabras clave – provistas por la editorial

Software Engineering/Programming and Operating Systems

Disponibilidad
Institución detectada Año de publicación Navegá Descargá Solicitá
No detectada 2007 SpringerLink

Información

Tipo de recurso:

libros

ISBN impreso

978-1-59059-620-3

ISBN electrónico

978-1-4302-0244-8

Editor responsable

Springer Nature

País de edición

Reino Unido

Fecha de publicación

Información sobre derechos de publicación

© Apress 2007

Tabla de contenidos

Why Objective Caml (OCaml)?

It’s a fair question. You have picked up this book, so I assume that you are (at a minimum) interested in Objective Caml (OCaml). That interest is enough for some to cover the “why” question. If you write programs to make a living, perhaps the glib, navel-gazing answer is not what you were looking for.

Palabras clave: Hedge Fund; Proof Assistant; Exception Handling; Functional Programming Language; Interface Definition Language.

Pp. 1-9

Interacting with OCaml: The Toplevel

The OCaml toplevel, the interactive OCaml interpreter, is one of the many powerful features of OCaml that can help you be more productive. This interactive interpreter enables you to enter OCaml code and have it evaluated immediately. You can then prototype code on-the-fly (much like Python, which has a similar system) instead of relying on the compile-run-debug cycle found in languages such as Java or C. The toplevel provides an interactive read/eval/print loop and gives you access to all features of the language.

Palabras clave: Binary Package; Source File; Native Code; Integrate Development Environment; File Extension.

Pp. 11-20

Syntax and Semantics

So, now that you know how to install and start the OCaml toplevel, you will learn how to actually do things in the language.

Palabras clave: Type Information; Functional Programming; Record Type; Assignment Operator; Aggregate Type.

Pp. 21-32

Understanding Functions

Functions are the main part of OCaml, which is not surprising because OCaml is a functional programming (FP) language. Functions in OCaml have signatures that are displayed in the OCaml toplevel and are used extensively in the module language.

Palabras clave: Pattern Match; Recursive Call; Functional Programming; Fibonacci Sequence; Return Type.

Pp. 33-50

Practical: Creating a Simple Database

Now that you have a basic overview of the OCaml language under your belt, it’s time to actually write code that does something. In this chapter, you will write a small database of securities trades and accounts. You will be able to add and remove (buy and sell) quantities of a given stock. There is also a simple network-based client to retrieve current price information from the web.

Palabras clave: Hash Table; Price Information; Security Trade; Basic Overview; Stock Price Data.

Pp. 51-60

Primitive and Composite Types

Chapter 3 introduced you to the OCaml concept of type; here you will learn more about types—their importance and things you can do with and about them. This chapter discusses the primitive types in OCaml (they are sometimes referred to as basic types; both terms are used interchangeably here).

Palabras clave: Pattern Match; Regular Expression; Primitive Type; Composite Type; Type Safety.

Pp. 61-71

Practical: Simple Database Reports, Exports, and Imports

Now that you have a solid grounding in the OCaml types and functions, you will revisit the simple database from Chapter 3 and Chapter 5. One of the major things missing from that database was any way to import or export data. Sure, you can add and remove items, but if you really want to use this database, you will want more functionality.

Palabras clave: Function Signature; Regular Expression; Format Output; Format String; Simple Database.

Pp. 73-87

Collections

OCaml has a standard library that provides for several collections to handle everything from lists to sets. Although not all these collections are purely functional, the purity of a given container isn’t all that important to many programmers.

Pp. 89-111

Files and File I/O

Although pure algorithmic programming can certainly be fun, any programming language would not be very practical without the capability to store and retrieve data from a persistent source. OCaml is a practical language that provides sophisticated methods for storing, retrieving, sending, and receiving data from outside itself.

Palabras clave: Output Channel; Temporary File; Binary Mode; File Descriptor; Disk File.

Pp. 113-122

Exception Handling

OCaml has exceptions, which are integrated into the language and are basic types. Exceptions cannot be polymorphic. Unlike some languages (such as Java), there is only one kind of exception, and there is no requirement to handle any exception. However, it’s often a good idea. Also, exception handling in OCaml is quite fast.

Palabras clave: Pattern Match; Line Number; Module Type; Error Message; Exception Handling.

Pp. 123-134