Carp/docs/Libraries.md

77 lines
3.3 KiB
Markdown
Raw Normal View History

2018-03-14 22:32:41 +03:00
## Working with libraries and modules
Below is a list of 'core' modules that comes included with the Carp compiler.
2018-03-14 22:37:00 +03:00
Modules marked with the symbol '⦁' are imported by default, other modules must be imported by loading their file. For example, to get access to the Bench module, do the following:
2018-03-14 22:32:41 +03:00
```clojure
(load "Bench.carp")
```
2018-03-14 22:37:00 +03:00
Using the functions in the Bench module still requires pre-pending them with the module name, i.e. `(Bench.bench fib)`. To avoid that, also do `(use Bench)`.
2018-03-14 22:40:08 +03:00
To see what functions a certain module contains, use the `info` command:
```clojure
(info "Bench")
```
2018-03-14 22:40:58 +03:00
External librares can be loaded by using their relative or absolute location in your file system as the path. To make a library publically available in a more general way you can add it to your Carp project's search path:s (found by running `:p` in the repl). For instance, here's how you would add the NCurses library so that it can be loaded with just `(load "NCurses.carp")`.
2018-03-14 22:32:41 +03:00
```clojure
(Project.config "search-path" "~/Projects/carp-ncurses")
```
2018-03-14 22:41:47 +03:00
This line of configuration can be put into a `~/.carp/profile.carp` file to make it apply in all your projects.
2018-03-14 22:32:41 +03:00
2017-12-15 21:59:26 +03:00
## Core Modules
2017-06-26 12:45:18 +03:00
2018-03-14 22:32:41 +03:00
### Basics
2018-03-27 13:09:39 +03:00
* [Macros ⦁](../core/Macros.carp)
* [Interfaces ⦁](../core/Interfaces.carp)
2018-03-27 13:06:19 +03:00
* [Dynamic ⦁](http://carp-lang.github.io/Carp/core/Dynamic.html) (only available in the repl and at compile time)
2018-03-14 22:32:41 +03:00
2017-06-26 17:24:11 +03:00
### Numerics
2018-03-27 13:06:19 +03:00
* [Int ⦁](http://carp-lang.github.io/Carp/core/Int.html)
* SafeInt
* [Long ⦁](http://carp-lang.github.io/Carp/core/Long.html)
* [Bool ⦁](http://carp-lang.github.io/Carp/core/Bool.html)
* [Float ⦁](http://carp-lang.github.io/Carp/core/Float.html)
* [Double ⦁](http://carp-lang.github.io/Carp/core/Double.html)
* [Vector](http://carp-lang.github.io/Carp/core/Vector.html)
* [Geometry](http://carp-lang.github.io/Carp/core/Geometry.html)
* [Statistics](http://carp-lang.github.io/Carp/core/Statistics.html)
2017-06-26 17:23:01 +03:00
2017-06-26 17:24:11 +03:00
### Text
2018-03-27 13:06:19 +03:00
* [String ⦁](http://carp-lang.github.io/Carp/core/String.html)
* [Char ⦁](http://carp-lang.github.io/Carp/core/Char.html)
* Format ⦁
* [Pattern ⦁](http://carp-lang.github.io/Carp/core/Pattern.html)
2017-06-26 17:23:01 +03:00
2017-06-26 17:24:11 +03:00
### Collections
2018-03-27 13:06:19 +03:00
* [Array ⦁](http://carp-lang.github.io/Carp/core/Array.html)
2018-03-14 22:32:41 +03:00
### System
2018-03-27 13:06:19 +03:00
* [IO ⦁](http://carp-lang.github.io/Carp/core/IO.html)
* [System ⦁](http://carp-lang.github.io/Carp/core/System.html)
2017-06-26 17:23:01 +03:00
2018-03-14 22:32:41 +03:00
### Development
2018-03-27 13:06:19 +03:00
* [Debug ⦁](http://carp-lang.github.io/Carp/core/Debug.html)
* [Test](http://carp-lang.github.io/Carp/core/Test.html)
* [Bench](http://carp-lang.github.io/Carp/core/Bench.html)
2017-12-15 21:58:02 +03:00
2018-03-24 17:34:01 +03:00
### Graphics, sound and interaction
2018-03-14 14:41:44 +03:00
* [SDL](../core/SDL.carp)
2018-03-24 17:34:01 +03:00
* [SDL Image](../core/SDL_image.carp)
* [SDL TTF](../core/SDL_ttf.carp)
* [SDL Mixer](../core/SDL_mixer.carp)
2018-03-14 22:32:41 +03:00
* [GLFW](../core/GLFW.carp)
* [OpenGL](../core/OpenGL.carp)
2018-03-14 14:41:44 +03:00
2017-12-15 21:59:26 +03:00
## External Libraries
2017-12-15 21:58:02 +03:00
* [Stdint](https://github.com/hellerve/stdint) (A wrapper around the types defined in stdint.h)
* [Socket](https://github.com/hellerve/socket) (A wrapper around C sockets)
* [Physics](https://github.com/hellerve/physics) (A port of phys.js)
2018-03-15 11:08:55 +03:00
* [NCurses](https://github.com/eriksvedang/carp-ncurses) ([https://www.gnu.org/software/ncurses/](https://www.gnu.org/software/ncurses/))
* [Anima](https://github.com/hellerve/anima) (A simple drawing and animation framework)
2018-03-24 17:34:01 +03:00
* [Curl](https://github.com/eriksvedang/carp-curl) (Simple bindings to the Curl library)