Permalink
Browse files

Added support for new terse operator syntax. Also fixed a problem wit…

…h the help() operator's case definition.
  • Loading branch information...
sprowell committed May 16, 2012
1 parent 610cb35 commit cff31156ae110b6accc9d7defda96333c2d4ec27
@@ -148,7 +148,7 @@ of each one (if given). Operators whose name begins with an underscore
are suppressed in this list."""
})
-def({ operator #name=help #cases %()->_help_all(), %($r:OPREF)->_help_op($r)
+def({ operator #name=help #cases %($r:OPREF)->_help_op($r), _help_all:OPREF
#description="Get general help or help on an operator."
#detail=
"""With no argument, list all operators. If provided with an operator
@@ -648,6 +648,19 @@ protected class SymbolicOperator protected (sfh: SpecialFormHolder,
}
}
} // Loop over atoms.
+
+ // Handle actual operator application.
+ def handleApply(binds: Bindings): BasicAtom = {
+ // Re-package the arguments with the correct properties.
+ val newargs = AtomSeq(params.props, newseq)
+ // See if we are bypassing the native handler.
+ if (!bypass) {
+ // Run any native handler.
+ if (handler.isDefined) return handler.get(this, newargs, binds)
+ }
+ // No native handler.
+ return OpApply(OperatorRef(this), newargs, binds)
+ }
// There are special cases to handle here. First, if the argument list
// is empty, but there is an identity, return it.
@@ -658,8 +671,9 @@ protected class SymbolicOperator protected (sfh: SpecialFormHolder,
return ident
case None =>
// No identity. We're done.
- return OpApply(OperatorRef(this), AtomSeq(params.props, newseq),
- Bindings())
+ return handleApply(Bindings())
+// return OpApply(OperatorRef(this), AtomSeq(params.props, newseq),
+// Bindings())
}
}
@@ -709,19 +723,6 @@ protected class SymbolicOperator protected (sfh: SpecialFormHolder,
params.atoms
}
- // Handle actual operator application.
- def handleApply(binds: Bindings): BasicAtom = {
- // Re-package the arguments with the correct properties.
- val newargs = AtomSeq(params.props, newseq)
- // See if we are bypassing the native handler.
- if (!bypass) {
- // Run any native handler.
- if (handler.isDefined) return handler.get(this, newargs, binds)
- }
- // No native handler.
- return OpApply(OperatorRef(this), newargs, binds)
- }
-
// We've run out of special cases to handle. Now just try to match the
// arguments against the parameters.
SequenceMatcher.tryMatch(newparams, newseq) match {
Oops, something went wrong.

0 comments on commit cff3115

Please sign in to comment.