-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unnecessary functions from rowl1-tuple.rlc.
- Loading branch information
nineties
committed
Feb 26, 2014
1 parent
766b987
commit ddfbd6d
Showing
3 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
# Copyright (C) 2014 nineties | ||
# $Id: Tuple.ab 2014-02-26 17:07:32 nineties $ | ||
# $Id: Tuple.ab 2014-02-26 18:51:22 nineties $ | ||
|
||
#= Tuple = | ||
# An n-tuple is an (ordered) collection of n objects. Tuples do not have | ||
# functionalities as a sequence like lists or arrays. For example, you | ||
# can't change the size of a tuple. Alternatively, tuples are very light | ||
# and element-access is faster than other containers. | ||
# | ||
# The most commonly used idiom with tuples is *multivariate function*. | ||
# You can return multiple values as a tuple and pick them up using | ||
# pattern matching assignment. | ||
# ---- | ||
# > f(): return (1,2,3) | ||
# > (x, y, z): f() | ||
# > x # => 1 | ||
# > y # => 2 | ||
# > z # => 3 | ||
# ---- | ||
trait Tuple { | ||
.length: alias(() -> Prim.tuple_length(self)) | ||
.size: alias(() -> Prim.tuple_length(self)) | ||
.get(i): Prim.tuple_get(self, i) | ||
.set(i, v): Prim.tuple_set(self, i, v) | ||
# The number of elements. | ||
.size: alias(() -> Prim.arity(self)) | ||
} | ||
|
||
Prim.set_builtin_parent('Tuple, Trait.Tuple) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters