Cuneiform (programming language): Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 312:
Cuneiform's surface syntax was revised twice, as reflected in the major version number.
 
===Version 31===
 
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 untarsdownloads a filereference resultinggenome infrom aan fileFTP listserver.
 
<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
fileLst=`tar tf $tar`
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===
 
===Version 13===
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 downloads a reference genome from an FTP server.
 
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 mv $id.faxf $fatar
fileLst=`tar xftf $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>