Examples of RTRecordValue


Examples of org.openquark.cal.internal.runtime.lecc.RTRecordValue

        //must iterate in a deterministic order over the field names (as specified by FieldName.CalSourceFormComparator)
        //so that the function is well-defined in the presence of side effects.
        //If f is a field, then recordDictionary.f is the dictionary for use when calling the class method Debug.show on
        //the value x.f.

        RTRecordValue recordDict = (RTRecordValue)recordDictionary;
        RTRecordValue xRecord = (RTRecordValue)x;

        int nFields = recordDict.getNFields();
        StringBuilder showResult;

        //tuple records (with 2 or more fields) are displayed using the parentheses notation where field-names are omitted.
        if (recordDict.isTuple2OrMoreRecord()) {

            showResult = new StringBuilder("(");
            for (int i = 0; i < nFields; ++i) {

                if (i > 0) {
                    showResult.append(", ");
                }

                RTValue fieldDict = recordDict.getNthValue(i);
                RTValue xField = xRecord.getNthValue(i);

                //compute "Debug.show fieldDict xField"
                //this is just (after inlining Debug.show d = d)
                //fieldDict xField

                showResult.append(fieldDict.apply(xField).evaluate($ec).getStringValue());
            }

            showResult.append(")");

        } else {

            showResult = new StringBuilder("{");
            for (int i = 0; i < nFields; ++i) {

                if (i > 0) {
                    showResult.append(", ");
                }

                RTValue fieldDict = recordDict.getNthValue(i);
                RTValue xField = xRecord.getNthValue(i);

                //compute "Debug.show fieldDict xField"
                //this is just (after inlining Debug.show d = d)
                //fieldDict xField

                showResult.append(xRecord.getNthFieldName(i)).append(" = ");
                showResult.append(fieldDict.apply(xField).evaluate($ec).getStringValue());
            }

            showResult.append("}");
        }
View Full Code Here

Examples of org.openquark.cal.internal.runtime.lecc.RTRecordValue

        //the compiler ensures that the 3 record arguments all have the same fields.
        //we iterate in FieldName order over the field names so that the function is well-defined in the presence of side effects.
        //If f is a field, then recordDictionary.f is the dictionary for use when calling the class method Prelude.compare on
        //the values x.f and y.f.

        RTRecordValue recordDict = (RTRecordValue)recordDictionary;
        RTRecordValue xRecord = (RTRecordValue)x;
        RTRecordValue yRecord = (RTRecordValue)y;

        for (int i = 0, nFields = recordDict.getNFields(); i < nFields; ++i) {

            RTValue fieldDict = recordDict.getNthValue(i);
            RTValue xField = xRecord.getNthValue(i);
            RTValue yField = yRecord.getNthValue(i);

            //compute "Prelude.compare fieldDict xField yField"
            //this is just (after inlining Prelude.compare d = d indexOfCompareClassMethod)
            //(where indexOfCompareClassMethod is the dictionary index of the compare method. See
            //ClassInstance.getDictionaryIndex for details).
View Full Code Here

Examples of org.openquark.cal.internal.runtime.lecc.RTRecordValue

        //the compiler ensures that the 3 record arguments all have the same fields.
        //we iterate in FieldName order over the field names so that the function is well-defined in the presence of side effects.
        //If f is a field, then recordDictionary.f is the dictionary for use when calling the class method Prelude.compare on
        //the values x.f and y.f.

        RTRecordValue recordDict = (RTRecordValue)recordDictionary;
        RTRecordValue xRecord = (RTRecordValue)x;
        RTRecordValue yRecord = (RTRecordValue)y;

        for (int i = 0, nFields = recordDict.getNFields(); i < nFields; ++i) {

            RTValue fieldDict = recordDict.getNthValue(i);
            RTValue xField = xRecord.getNthValue(i);
            RTValue yField = yRecord.getNthValue(i);

            //compute "Prelude.compare fieldDict xField yField"
            //this is just (after inlining Prelude.compare d = d indexOfCompareClassMethod)
            //(where indexOfCompareClassMethod is the dictionary index of the compare method. See
            //ClassInstance.getDictionaryIndex for details).
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.