Skip to content

Why use Arrays for cons? #4

Closed
Closed
@mjgpy3

Description

@mjgpy3

What makes using arrays for the underlying cons representation worth the O(n) tradeoff?

I would kind of expected it too look more like the traditional cons:

var nil = function () {};

var cons = function (car) {
  return function (cdr) {
    return {
      car: car,
      cdr: cdr
    };
  };
};

Where you might instantiate a new list like:

cons(35)(cons(42)(nil))

I'm really liking purescript so far.
Peace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions