Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Tyler Compton
Interestingly, Go also kind of has a built-in set data type by using map keys! https://go.dev/play/p/3-ZEKPSPUEh I know that's not really what you mean, but I think it's a cool pattern. On Tue Apr 12, 2022, 07:50 PM GMT, Ian Lance Taylor wrote: On Mon, Apr 11, 2022 at 11:19 PM 'Jack Li' via gol

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Ian Lance Taylor
On Mon, Apr 11, 2022 at 11:19 PM 'Jack Li' via golang-nuts wrote: > > Why Go provides only 2 built-in data structures, slice and map. It has just > more than C, but less than all other programming languages I've heard of, > C++, Python, Swift, Rust. > > I think this simplicity attracts me very m

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Jesper Louis Andersen
Very true! On Tue, Apr 12, 2022 at 8:36 PM Robert Engels wrote: > Nit but you can certainly create maps and slices in a library - you use > methods not language syntax - as long as you have pointers and type > casting. > > On Apr 12, 2022, at 1:30 PM, Jesper Louis Andersen < > jesper.louis.ander

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Robert Engels
Nit but you can certainly create maps and slices in a library - you use methods not language syntax - as long as you have pointers and type casting. > On Apr 12, 2022, at 1:30 PM, Jesper Louis Andersen > wrote: > >  >> On Tue, Apr 12, 2022 at 8:19 AM 'Jack Li' via golang-nuts >> wrote: >>

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Jesper Louis Andersen
On Tue, Apr 12, 2022 at 8:19 AM 'Jack Li' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Hi group, > > Why Go provides only 2 built-in data structures, slice and map. It has > just more than C, but less than all other programming languages I've heard > of, C++, Python, Swift, Rust. > > I

[go-nuts] Why Go has only slice and map

2022-04-11 Thread 'Jack Li' via golang-nuts
Hi group, Why Go provides only 2 built-in data structures, slice and map. It has just more than C, but less than all other programming languages I've heard of, C++, Python, Swift, Rust.  I think this simplicity attracts me very much. Sometimes I can use only one data structures for a task. B