Giter Club home page Giter Club logo

ringlists.jl-286e9d63-9694-5540-9e3c-4e6708fa07b2's Introduction

RingLists

Build Status

Coverage Status

codecov.io

A RingList is a list of distinct values that is unchanged by rotation. These can be created by giving a list of values or a one-dimensional array of values:

julia> a = RingList(1,2,3,4);

julia> b = RingList([2,3,4,1]);

julia> a==b
true

Functions

In this list, a stands for a RingList.

  • length(a) gives the number of elements held in the RingList.
  • keys(a) returns an iterator of the elements in a.
  • haskey(a,x) checks if x is an element of the RingList.
  • Vector(a) returns a one-dimensional array of the elements in a.
  • Set(a) returns the elements of a (as an unordered collection).
  • a[x] returns the next element after x in a.
  • previous(a,x) returns the element y with a[y]==x.
  • first(a) returns an element of a; call first(a,true) to attempt try to return the smallest value held in a. Fails if a is empty.
  • insert!(a,x) inserts the element a into the RingList. No guarantee where it will end up.
  • delete!(a,x) removes x from the collection linking together its predecessor and successor.
  • insertafter!(a,x,y) inserts x into a after y. For example:
julia> a = RingList(1,2,3)
RingList{Int64}(1,2,3)

julia> insertafter!(a,99,2)

julia> a
RingList{Int64}(1,2,99,3)
  • reverse(a) returns a new RingList with the elements reversed.
julia> a = RingList(1,2,3,4,5)
RingList{Int64}(1,2,3,4,5)

julia> b = reverse(a)
RingList{Int64}(1,5,4,3,2)

ringlists.jl-286e9d63-9694-5540-9e3c-4e6708fa07b2's People

Contributors

scheinerman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.