#Is my linked list "ADT"?

1 messages · Page 1 of 1 (latest)

sly zodiacBOT
#

<@&987246399047479336> please have a look, thanks.

reef frigate
#

What does ADT mean to you?

spice belfry
#

and i assume since i can use any datatype to plug into my linked list that it would be "ADT" but im just confused

storm sage
#

ADT has another meaning

#

Algebraic Data Type

#

it is that

#

specifically your list is a sum type

#
data List a = Empty | NotEmpty a (List a)
#

and the NotEmpty type is a product type

#

while the Empty type is a unit type

spice belfry
#

hmmm

#

so does that mean it is "ADT"?

storm sage
#

it is an algebraic data type

#

it is also "abstract" in some ways

#

both over the kinds of elements it can contain and the contract it gives to users

spice belfry
#

is the javas linkedlist library thing considered adt too?

storm sage
#

java's linkedlist is not an algebraic data type

spice belfry
#

this shit is so confusing man

#

so my linked list is "kinda ADT"?

storm sage
#

your linked list is an algebraic data type

#

which has a specific actual meaning

spice belfry
storm sage
#

because you modeled it as either empty or not empty

#

"abstract data type" is a term with a lot looser of a definition

spice belfry
#

isnt that just another way of saying is polymorphic?

storm sage
#

yes

spice belfry
#

hmm

#

also, would it be wise to use "map" to go through my whole linked list to encrypt it?

storm sage
#

sure

#

since encryption is done on an element by element basis

spice belfry
#

hmm

#

@storm sage, I've created a method to encrypt and decrypt. Separated in a new class. I added functionality to add to the display but I am still confused on how I can also add this to my linked list. so when th encrypt button is pressed it will do the mapping function to encrypt

storm sage
#

You "add" the functionality when you need it

#

So list.map(new EncryptFunction())! Or similar

#

So not in the list definition itself