Fixed imports in docs.

This commit is contained in:
Erik Svedäng 2017-09-06 14:43:41 +02:00
parent 9dde12261f
commit 3b4423103c
3 changed files with 14 additions and 14 deletions

View File

@ -32,9 +32,9 @@ The Carp REPL has built in documentation, run ```(help)``` to access it!
## A Small Example
```clojure
(import IO)
(import Int)
(import String)
(use IO)
(use Int)
(use String)
(defn main []
(do (println &"~ The number guessing game ~")

View File

@ -96,23 +96,23 @@ These can only be used at the REPL and during macro evaluation.
Functions and variables can be stored in modules which are named and can be nested. To use a symbol inside a module
you need to qualify it with the module name, like this: ```Float.cos```.
Importing a module makes it possible to access its members without qualifying them:
*Using* a module makes it possible to access its members without qualifying them:
```
(import Float)
(use Float)
(defn f []
(cos 3.2f))
```
If there are several imported modules that contain symbols with the same name, the type inferer will try to figure
If there are several used modules that contain symbols with the same name, the type inferer will try to figure
out which one of the symbols you really mean (based on the types in your code). If it can't, it will display an error.
For example, both the module ```String``` and ```Array``` contain a function named 'count'. In the following code it's
possible to see that it's the array version that is needed, and that one will be called:
```
(import String)
(import Array)
(use String)
(use Array)
(defn f []
(count [1 2 3 4 5]))
@ -120,8 +120,8 @@ possible to see that it's the array version that is needed, and that one will be
In the following example it's not possible to figure out which type is intended:
```
(import String)
(import Array)
(use String)
(use Array)
(defn f [x]
(count x))
@ -129,8 +129,8 @@ In the following example it's not possible to figure out which type is intended:
Specifying the type solves this error:
```
(import String)
(import Array)
(use String)
(use Array)
(defn f [x]
(String.count x))

View File

@ -3,8 +3,8 @@
A simple piece of code:
```clojure
(import String)
(import IO)
(use String)
(use IO)
(defn say-hi [text]
(while true