Gryphon Data Structures: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Built in ==
== Built in ==
Very little by default. Not even arrays. There is something like a byte array.
Very little by default. Not even arrays. There is something like a byte array.
=== Struct ===
The default data structure. Definition is surrounded by angle brackets, or possibly angle brackets plus the type bracket. If the type bracket is [] it would be
  person := <[
    Name string
    Age int
  ]>
I'm not sure yet what the type bracket will be. I like using {} for list so that code blocks stay as curly braces. I end up liking (), but then it would be weird to us that for math. That leaves [], but I'm not sure how I feel about that.
  adam := person[
    Name = "Adam"
    Age = 35
  ]


== Std Lib ==
== Std Lib ==

Revision as of 14:08, 15 October 2019

Built in

Very little by default. Not even arrays. There is something like a byte array.

Struct

The default data structure. Definition is surrounded by angle brackets, or possibly angle brackets plus the type bracket. If the type bracket is [] it would be

 person := <[
   Name string
   Age int
 ]>

I'm not sure yet what the type bracket will be. I like using {} for list so that code blocks stay as curly braces. I end up liking (), but then it would be weird to us that for math. That leaves [], but I'm not sure how I feel about that.

 adam := person[
   Name = "Adam"
   Age = 35
 ]

Std Lib

Slice/Vector

Need these.

Channel

Depending on mutability, I think these will be different from the Go channel. I think you setup a receiver and then create senders. Each sender is a separate but mutable instance.

Hash Map

Yup.

Trees

  • Red/Black
  • B
  • KT

I think it may be possible to create one general purpose tree. It has a B value where B=1 is a binary tree. It can also be KT by passing the depth into the compare function.