Example #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);
            }
        }
Example #2
0
 public AType ExecutePrimitive(ABox rightArgument, ABox leftArgument)
 {
     return AInteger.Create((leftArgument != rightArgument) ? 1 : 0);
 }
Example #3
0
 public override AType ExecutePrimitive(ABox argument, Aplus environment = null)
 {
     return ABox.Create(argument.NestedItem);
 }
 public virtual AType ExecutePrimitive(ABox argument, Aplus environment = null)
 {
     throw new NotImplementedException("Invalid use-case");
 }