Skip to content
/ ht Public

Nim library that provides an operator to emulate Elixir's `[h | t]` syntax

Notifications You must be signed in to change notification settings

dogue/ht

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Installation

Install with nimble: nimble install https://github.com/dogue/ht

Usage

import ht

let mySequence = @[1, 2, 3, 4, 5]
(head, tail) <- mySequence
echo head, ", ", tail
# 1, @[2, 3, 4, 5]

Notes

The <- only works with right hand types of array, openArray, or sequence. Any other type will throw a compiler error.

Attempting to destructure an empty collection will raise an IndexDefect exception.

Returned values are immutable.

About

Nim library that provides an operator to emulate Elixir's `[h | t]` syntax

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages