You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/dowlandaiello/immutable-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/dowlandaiello/immutable-go

v0.0.0-20191022013519-a584b8af7ea2
Source
Go
Version published
Created
Source

immutable-go

Straightforward, functional immutable data collections for Go.

Installation

go get -u github.com/dowlandaiello/immutable-go

Lists

Initialization

import "github.com/dowlandaiello/immutable-go"

list := immutable.NewList(1, 2, 3, 4) // Initializes a new list of integers

Getting Values

import "github.com/dowlandaiello/immutable-go"

list := immutable.NewList(1, 2, 3, 4) // Initializes a new list of integers

firstElement := list(0) // Get the element at index 0
secondElement := list(1) // Get the element at index 1
...

Setting Values

import "github.com/dowlandaiello/immutable-go"

list := immutable.NewList(1, 2, 3, 4) // Initialize a new list of integers
newList := list.Set(0, 37) // Set the element at index 0 to 37

Or, push a value:

import "github.com/dowlandaiello/immutable-go"

list := immutable.NewList(1, 2, 3, 4) // Initialize a new list of integers
newList := list.Push(102) // Push an integer with the value 102 to the list

Finally, pop a value:

import "github.com/dowlandaiello/immutable-go"

list := immutable.NewList(1, 2, 3, 4) // Initialize a new list of integers
newList := list.Pop() // Remove an integer from the list

Getting a List's Used Size

import "github.com/dowlandaiello/immutable-go"

list := immutable.NewList(1, 2, 3, 4) // Initialize a new list of integers
length := list.Size() // Get the size of the list

FAQs

Package last updated on 22 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.