Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Quark Lists have convenience methods #229

Open
bozzzzo opened this issue Jul 27, 2016 · 0 comments
Open

Quark Lists have convenience methods #229

bozzzzo opened this issue Jul 27, 2016 · 0 comments

Comments

@bozzzzo
Copy link
Contributor

bozzzzo commented Jul 27, 2016

All of these can be written in Quark (e.g., in the ListUtil<T> class), but that might not be the most efficient way to do so.

List<T>
  // Queries
  int indexOf(T value) -> lowest index of value in self, or -1 if not found
  bool contains(T value) -> indexOf(value) != -1
  int count(T value) -> 0..n number of times value is found in self

  // Ways to make new lists
  List<T> __add__(List<T> other) - concatenate
  List<T> __mul__(int count) - repeat
  List<T> copy() -> self * 1 - returns a new list that is a shallow copy of self

  // Ways to mutate self
  void extend(List<T> additional) - mutates self to be self + additional
  void reverse() - reverse
@bozzzzo bozzzzo added this to the runtime milestone Jul 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant