Skip to content

Black magic to get slice or array dimensioned with specified dimensions.

Notifications You must be signed in to change notification settings

mattn/go-redimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

go-redimer

Black magic to get slice or array dimensioned with specified dimensions.

Usage

package main

import (
    "fmt"

    "github.com/mattn/go-redimer"
)

func main() {
    arr := []int{1, 2, 3, 4, 5, 6, 7, 8, 9}

    for _, v := range redimer.Redim(&arr, 3, 3).([][3]int) {
        fmt.Println(v)
    }
    // [1 2 3]
    // [4 5 6]
    // [7 8 9]
}

Installation

$ go get github.com/mattn/go-redimer

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

About

Black magic to get slice or array dimensioned with specified dimensions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages