Content deleted Content added
Realbadwolf (talk | contribs) No edit summary |
Realbadwolf (talk | contribs) No edit summary |
||
Line 312:
Cuneiform's surface syntax was revised twice, as reflected in the major version number.
===Version
In its first draft published in May 2014, Cuneiform was closely related to [[Make (software)|Make]] in that it constructed a static data dependency graph which the interpreter traversed during execution. The major difference to later versions was the lack of conditionals, recursion, or static type checking. Files were distinguished from strings by juxtaposing single-quoted string values with a tilde <code>~</code>. The script's query expression was introduced with the <code>target</code> keyword. Bash was the default foreign language. Function application had to be performed using an <code>apply</code> form that took <code>task</code> as its first keyword argument. One year later, this surface syntax was replaced by a streamlined but similar version.▼
The current version of Cuneiform's surface syntax, in comparison to earlier drafts, is an attempt to close the gap to mainstream functional programming languages. It features a simple, statically checked typesystem and introduces records in addition to lists as a second type of compound data structure. Booleans are a separate base data type.▼
The following example script
<pre>
declare download-ref-genome;▼
def untar( tar : File ) -> <fileLst : [File]>▼
in Bash *{▼
deftask download-fa( fa : ~path ~id ) *{▼
tar xf $tar▼
wget $path/$id.fa.gz▼
gunzip $id.fa.gz▼
mv $id.fa $fa
}*
ref-genome-path = ~'ftp://hgdownload.cse.ucsc.edu/goldenPath/hg19/chromosomes';▼
let hg38Tar : File =▼
ref-genome-id = ~'chr22';▼
'hg38/hg38.tar';▼
ref-genome = apply(▼
let <fileLst = faLst : [File]> =▼
task : download-fa▼
untar( tar = hg38Tar );▼
path : ref-genome-path▼
id : ref-genome-id▼
);▼
target ref-genome;▼
faLst;▼
</pre>
Line 358 ⟶ 363:
</pre>
===Version 1===▼
▲In its first draft published in May 2014, Cuneiform was closely related to [[Make (software)|Make]] in that it constructed a static data dependency graph which the interpreter traversed during execution. The major difference to later versions was the lack of conditionals, recursion, or static type checking. Files were distinguished from strings by juxtaposing single-quoted string values with a tilde <code>~</code>. The script's query expression was introduced with the <code>target</code> keyword. Bash was the default foreign language. Function application had to be performed using an <code>apply</code> form that took <code>task</code> as its first keyword argument. One year later, this surface syntax was replaced by a streamlined but similar version.
▲The current version of Cuneiform's surface syntax, in comparison to earlier drafts, is an attempt to close the gap to mainstream functional programming languages. It features a simple, statically checked typesystem and introduces records in addition to lists as a second type of compound data structure. Booleans are a separate base data type.
The following script untars a file resulting in a file list.
<pre>▼
▲declare download-ref-genome;
▲<pre>
▲deftask download-fa( fa : ~path ~id ) *{
▲def untar( tar : File ) -> <fileLst : [File]>
▲ wget $path/$id.fa.gz
▲in Bash *{
▲ gunzip $id.fa.gz
tar
}*
▲let hg38Tar : File =
▲ref-genome-path = ~'ftp://hgdownload.cse.ucsc.edu/goldenPath/hg19/chromosomes';
▲ 'hg38/hg38.tar';
▲ref-genome-id = ~'chr22';
▲let <fileLst = faLst : [File]> =
▲ref-genome = apply(
▲ untar( tar = hg38Tar );
▲ task : download-fa
▲ path : ref-genome-path
▲ id : ref-genome-id
▲);
▲faLst;
▲target ref-genome;
</pre>
|