mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-30 01:50:25 +02:00
Merged down
This commit is contained in:
@@ -758,15 +758,18 @@ timer.clear( );
|
|||||||
// or iterate over indicies
|
// or iterate over indicies
|
||||||
[ idx in myBigArray.domain ] myBigArray[idx] = -myBigArray[idx];
|
[ idx in myBigArray.domain ] myBigArray[idx] = -myBigArray[idx];
|
||||||
```
|
```
|
||||||
|
|
||||||
Who is this tutorial for?
|
Who is this tutorial for?
|
||||||
-------------------------
|
-------------------------
|
||||||
This tutorial is for people who want to learn the ropes of Chapel without having to hear about what fiber mixture the ropes are, or how they were braided, or how the braid configurations differ between one another.
|
|
||||||
|
This tutorial is for people who want to learn the ropes of chapel without having to hear about what fiber mixture the ropes are, or how they were braided, or how the braid configurations differ between one another.
|
||||||
It won't teach you how to develop amazingly performant code, and it's not exhaustive.
|
It won't teach you how to develop amazingly performant code, and it's not exhaustive.
|
||||||
Refer to the [language specification](http://chapel.cray.com/language.html) and the [library documentation](http://chapel.cray.com/docs/latest/) for more details.
|
Refer to the [language specification](http://chapel.cray.com/language.html) and the [library documentation](http://chapel.cray.com/docs/latest/) for more details.
|
||||||
|
|
||||||
Occasionally check back here and on the [Chapel site](http://chapel.cray.com) to see if more topics have been added or more tutorials created.
|
Occasionally check back here and on the [Chapel site](http://chapel.cray.com) to see if more topics have been added or more tutorials created.
|
||||||
|
|
||||||
### What this tutorial is lacking:
|
### What this tutorial is lacking:
|
||||||
|
|
||||||
* Modules and standard modules
|
* Modules and standard modules
|
||||||
* Synchronize and atomic variables
|
* Synchronize and atomic variables
|
||||||
* Multiple Locales (distributed memory system)
|
* Multiple Locales (distributed memory system)
|
||||||
@@ -779,6 +782,7 @@ Occasionally check back here and on the [Chapel site](http://chapel.cray.com) to
|
|||||||
|
|
||||||
Your input, questions, and discoveries are important to the developers!
|
Your input, questions, and discoveries are important to the developers!
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
The Chapel language is still in-development (version 1.11.0), so there are occasional hiccups with performance and language features.
|
The Chapel language is still in-development (version 1.11.0), so there are occasional hiccups with performance and language features.
|
||||||
The more information you give the Chapel development team about issues you encounter or features you would like to see, the better the language becomes.
|
The more information you give the Chapel development team about issues you encounter or features you would like to see, the better the language becomes.
|
||||||
Feel free to email the team and other developers through the [sourceforge email lists](https://sourceforge.net/p/chapel/mailman).
|
Feel free to email the team and other developers through the [sourceforge email lists](https://sourceforge.net/p/chapel/mailman).
|
||||||
@@ -789,24 +793,30 @@ It is under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0)
|
|||||||
|
|
||||||
Installing the Compiler
|
Installing the Compiler
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Chapel can be built and installed on your average 'nix machine (and cygwin).
|
Chapel can be built and installed on your average 'nix machine (and cygwin).
|
||||||
[Download the latest release version](https://github.com/chapel-lang/chapel/releases/)
|
[Download the latest release version](https://github.com/chapel-lang/chapel/releases/)
|
||||||
and its as easy as
|
and its as easy as
|
||||||
1. `tar -xvf chapel-1.11.0.tar.gz`
|
|
||||||
2. `cd chapel-1.11.0`
|
1. ```tar -xvf chapel-1.11.0.tar.gz```
|
||||||
3. `make`
|
2. ```cd chapel-1.11.0```
|
||||||
4. `source util/setchplenv.bash # or .sh or .csh or .fish`
|
3. ```make```
|
||||||
|
4. ```source util/setchplenv.bash # or .sh or .csh or .fish```
|
||||||
|
|
||||||
You will need to `source util/setchplenv.EXT` from within the Chapel directory (`$CHPL_HOME`) every time your terminal starts so its suggested that you drop that command in a script that will get executed on startup (like .bashrc).
|
You will need to `source util/setchplenv.EXT` from within the Chapel directory (`$CHPL_HOME`) every time your terminal starts so its suggested that you drop that command in a script that will get executed on startup (like .bashrc).
|
||||||
|
|
||||||
Chapel is easily installed with Brew for OS X
|
Chapel is easily installed with Brew for OS X
|
||||||
1. `brew update`
|
|
||||||
2. `brew install chapel`
|
1. ```brew update```
|
||||||
|
2. ```brew install chapel```
|
||||||
|
|
||||||
Compiling Code
|
Compiling Code
|
||||||
--------------
|
--------------
|
||||||
Builds like other compilers
|
|
||||||
|
|
||||||
`chpl myFile.chpl -o myExe`
|
Builds like other compilers:
|
||||||
|
|
||||||
A notable argument, `--fast` enables a number of optimizations and disables array bounds checks. Should only enable when application is stable.
|
```chpl myFile.chpl -o myExe```
|
||||||
|
|
||||||
|
A notable argument:
|
||||||
|
|
||||||
|
* ``--fast``: enables a number of optimizations and disables array bounds checks. Should only enable when application is stable.
|
||||||
|
@@ -327,8 +327,8 @@ prints:
|
|||||||
mouse is a mammal
|
mouse is a mammal
|
||||||
"""
|
"""
|
||||||
for animal in ["dog", "cat", "mouse"]:
|
for animal in ["dog", "cat", "mouse"]:
|
||||||
# You can use % to interpolate formatted strings
|
# You can use {0} to interpolate formatted strings. (See above.)
|
||||||
print "%s is a mammal" % animal
|
print "{0} is a mammal".format(animal)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
"range(number)" returns a list of numbers
|
"range(number)" returns a list of numbers
|
||||||
@@ -387,7 +387,7 @@ else: # Optional clause to the try/except block. Must follow all except blocks
|
|||||||
|
|
||||||
# Use "def" to create new functions
|
# Use "def" to create new functions
|
||||||
def add(x, y):
|
def add(x, y):
|
||||||
print "x is %s and y is %s" % (x, y)
|
print "x is {0} and y is {1}".format(x, y)
|
||||||
return x + y # Return values with a return statement
|
return x + y # Return values with a return statement
|
||||||
|
|
||||||
# Calling functions with parameters
|
# Calling functions with parameters
|
||||||
@@ -497,7 +497,7 @@ class Human(object):
|
|||||||
|
|
||||||
# An instance method. All methods take "self" as the first argument
|
# An instance method. All methods take "self" as the first argument
|
||||||
def say(self, msg):
|
def say(self, msg):
|
||||||
return "%s: %s" % (self.name, msg)
|
return "{0}: {1}".format(self.name, msg)
|
||||||
|
|
||||||
# A class method is shared among all instances
|
# A class method is shared among all instances
|
||||||
# They are called with the calling class as the first argument
|
# They are called with the calling class as the first argument
|
||||||
|
Reference in New Issue
Block a user