X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=docs%2FGoalfile.pod;h=abe9f502e61605a749c1efa26a1bd4e38e30eeaa;hb=5a456c968ee7e7bbe477ae4e756967c4aa2e3fc1;hp=85d19ba8fed6408bb1acc8eab9a4ff639bb064a6;hpb=22e06eac0cf27c97056bb9e2f4fe7e45f7f1a474;p=goals.git diff --git a/docs/Goalfile.pod b/docs/Goalfile.pod index 85d19ba..abe9f50 100644 --- a/docs/Goalfile.pod +++ b/docs/Goalfile.pod @@ -46,6 +46,24 @@ For example: Returns the filename extension. +=head3 filter (pattern, list) + +For example: + + filter ("a+", ["a", "b", "ca"]) ⇒ ["a", "ca"] + +Filter a list returning only the elements that match the extended +regular expression C. + +=head3 filter-out (pattern, list) + +For example: + + filter-out ("a+", ["a", "b", "ca"]) ⇒ ["b"] + +Filter a list returning only the elements that I match the +extended regular expression C. + =head3 head (list) For example: @@ -64,6 +82,22 @@ Concatenate C and C. It's not usually necessary to use this function since goals automatically flattens lists within lists into simple lists in many cases. +=head3 last (list) + +For example: + + last (["a", "b", "c"]) ⇒ "c" + +Returns the last element of a list. + +=head3 nth (n, list) + +For example: + + nth (1, ["a", "b", "c"]) ⇒ "b" + +Returns the n’th element of a list (counting from 0). + =head3 read (filename) For example: @@ -98,6 +132,20 @@ For example: This takes a list of strings and sorts it, removing duplicates. +=head3 split (string) + +For example: + + split ("-g -O2") ⇒ ["-g", "-O2"] + +Split a string using shell rules into a list of strings. This is +commonly used for splitting C provided by autoconf into a list +for use by goals: + + let CFLAGS = split ("@CFLAGS@") + goal compile (name) = + "%name.o" : "%name.c" { %CC %CFLAGS -c %< -o %@ } + =head3 subst (from, to, text) For example: