[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tuples?
- Subject: Re: Tuples?
- From: Ori Bernstein <ori@xxxxxxxxxxxxxx>
- Date: Wed, 20 May 2015 11:32:29 -0700
- To: Ryan Gonzalez <rymg19@xxxxxxxxx>
- Cc: "myrddin-dev@xxxxxxxxxxxxxx" <myrddin-dev@xxxxxxxxxxxxxx>
On Wed, 20 May 2015 12:28:53 -0500
Ryan Gonzalez <rymg19@xxxxxxxxx> wrote:
> I just noticed the language manual mentions tuple literals; however, their type is never specified. Are they even fully implemented:
Yep, and in use all over the place. For example, iterating over the utf8
codepoints in a string:
while str.len != 0
(chr, str) = std.striter(str)
use(chr)
;;
or command line opt parsing:
for arg in parsed.args
match arg
| ('O', arg): use(arg)
| _: etc
;;
;;
Types are specified as '(t0, t1, ..., tN)', for example:
var x : (int, char, byte[:])
x = (0xf00, 'c', "str")
>
> Also:
> - The home page still says user-defined traits aren't implemented
> - In example 5.2 of the manual, a function named "intmax" is defined. Later on, it is referred to as "max".
> - In 6.2, the last "const" is misspelled.
I should get that part of the website into (public) git so that I can accept pull
requests...
I've been pretty bad about keeping docs up to date: Writing code is so much
more fun than writing docs.
--
Ori Bernstein <ori@xxxxxxxxxxxxxx>
Follow-Ups:
Re: Tuples? | Ryan Gonzalez <rymg19@xxxxxxxxx> |
References:
Tuples? | Ryan Gonzalez <rymg19@xxxxxxxxx> |