diff options
author | dos-reis <gdr@axiomatics.org> | 2011-12-10 18:54:17 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-12-10 18:54:17 +0000 |
commit | 49fc7b2f58f56ea7c9aa8169be3dfcc22b818be2 (patch) | |
tree | b9475624cbe821fff9753a08ef614396ffe8f2e4 /src/boot/utility.boot | |
parent | 1bee5e2ddcac5cd3a168f5f70a754fd8bee34021 (diff) | |
download | open-axiom-49fc7b2f58f56ea7c9aa8169be3dfcc22b818be2.tar.gz |
* boot/parser.boot (bpArgtypeList): Accept mapping types.
* boot/ast.boot (bfType): New.
* boot/translator.boot (genDeclaration): Use it.
* boot/utility.boot (every?): New. Export.
(any?): Likewise.
(takeWhile): Lilkewise.
Diffstat (limited to 'src/boot/utility.boot')
-rw-r--r-- | src/boot/utility.boot | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/boot/utility.boot b/src/boot/utility.boot index 5b870a6d..6e08acb5 100644 --- a/src/boot/utility.boot +++ b/src/boot/utility.boot @@ -48,7 +48,8 @@ module utility (objectMember?, symbolMember?, stringMember?, lastNode, append, append!, copyList, substitute, substitute!, setDifference, setUnion, setIntersection, symbolAssoc, applySubst, applySubst!, applySubstNQ, objectAssoc, - remove,removeSymbol,atomic?,copyTree,finishLine) where + remove, removeSymbol, atomic?, every?, any?, takeWhile, copyTree, + finishLine) where substitute: (%Thing,%Thing,%Thing) -> %Thing substitute!: (%Thing,%Thing,%Thing) -> %Thing append: (%List %Thing,%List %Thing) -> %List %Thing @@ -63,6 +64,9 @@ module utility (objectMember?, symbolMember?, stringMember?, setUnion: (%List %Thing,%List %Thing) -> %List %Thing setIntersection: (%List %Thing,%List %Thing) -> %List %Thing atomic?: %Thing -> %Boolean + every?: (%Thing -> %Thing, %List %Thing) -> %Thing + any?: (%Thing -> %Thing, %List %Thing) -> %Thing + takeWhile: (%Thing -> %Thing, %List %Thing) -> %List %Thing copyTree: %Thing -> %Thing finishLine: %Thing -> %Void --FIXME: Next signature commented out because of GCL bugs @@ -77,6 +81,19 @@ module utility (objectMember?, symbolMember?, stringMember?, atomic? x == x isnt [.,:.] or x.op is 'QUOTE +++ Return the last image of `f' if all images of elements in `l' +++ are non-nil. Otherwise return nil. +every?(f,l) == + and/[apply(f,x,nil) for x in l] + +++ Return the first non-nil image of `f' of elements in `l'. +any?(f,l) == + or/[apply(f,x,nil) for x in l] + +++ Return the sublist of `l' whose elements have non-nil image by `f'. +takeWhile(f,l) == + [x for x in l while apply(f,x,nil)] + copyTree t == t is [.,:.] => [copyTree first t,:copyTree rest t] t |