Menu

#97 e) and e( (array max and min) implementation (code snippet)

0.6.5
open
nobody
None
2016-01-24
2016-01-24
UsernameAK
No

Please add this code, this implements some of your planned features.

        add(new Op1("e)") {
            @Override
            protected Object calc(final CJam x, final Object a) {
                if (!isList(a)) {
                    throw fail(a);
                }
                final List<?> l = toList(a);
                return Collections.max(l);
            }
        });
        add(new Op1("e(") {
            @Override
            protected Object calc(final CJam x, final Object a) {
                if (!isList(a)) {
                    throw fail(a);
                }
                final List<?> l = toList(a);
                return Collections.min(l);
            }
        });

Related

Tickets: #98

Discussion


Log in to post a comment.