示例#1
0
        /// <summary>
        /// AArray generated by type and shape with Reshape dyadic nonscalar function.
        /// If shape list is null, we give back the filler elemenet.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="shape"></param>
        internal static AType FillElement(ATypes type, AType shape = null)
        {
            AType filler = null;

            switch (type)
            {
            case ATypes.ABox:
            case ATypes.AFunc:
                filler = ABox.Create(ANull());
                break;

            case ATypes.AChar:
                filler = AChar.Create(' ');
                break;

            case ATypes.AFloat:
                filler = AFloat.Create(0);
                break;

            case ATypes.AInteger:
                filler = AInteger.Create(0);
                break;

            case ATypes.ASymbol:
                filler = ASymbol.Create("");
                break;

            default:
                throw new NotImplementedException("Invalid use-case");
            }

            if (shape != null)
            {
                return(AplusCore.Runtime.Function.Dyadic.DyadicFunctionInstance.Reshape.Execute(filler, shape));
            }
            else
            {
                return(filler);
            }
        }
示例#2
0
 public AType ExecutePrimitive(ABox rightArgument, ABox leftArgument)
 {
     return AInteger.Create((leftArgument != rightArgument) ? 1 : 0);
 }
示例#3
0
 public override AType ExecutePrimitive(ABox argument, Aplus environment = null)
 {
     return ABox.Create(argument.NestedItem);
 }
示例#4
0
 public virtual AType ExecutePrimitive(ABox argument, Aplus environment = null)
 {
     throw new NotImplementedException("Invalid use-case");
 }