XDS-Agda
List
Initializing search
    pdmosses/xds-agda@pre
    • About
    • Notation
    • Examples
    • Properties
    • Tests
    • Library
    pdmosses/xds-agda@pre
    • About
      • Background
      • Meta-notation
    • Notation
    • Examples
      • LC
        • Abstract-Syntax
        • Domain-Equations
        • Semantic-Functions
      • PCF
        • Abstract-Syntax
        • Domain-Equations
        • Semantic-Functions
      • Scm
        • Abstract-Syntax
        • Auxiliary-Functions
        • Domain-Equations
        • Semantic-Functions
    • Properties
    • Tests
      • LC
      • PCF
      • Scm
    • Library
          • Bool
          • Char
          • Equality
            • Rewrite
          • Int
          • List
          • Maybe
          • Nat
          • Sigma
          • String
          • Unit
        • Primitive
          • Raw
        • Core
          • RawMagma
          • Base
          • Base
        • Empty
          • Polymorphic
          • Base
          • Base
        • Irrelevant
          • Base
            • Base
                • Core
                • Base
          • Base
          • Base
          • Base
          • Base
          • Base
          • Base
          • Base
          • Base
          • Base
            • Base
          • Base
        • Base
        • Bundles
        • Consequences
          • Propositional
          • Setoid
        • Definitions
        • Structures
      • Level
          • Bundles
            • Raw
          • Consequences
              • Reflexive
            • Composition
              • Core
          • Core
          • Definitions
              • Core
            • Setoid
            • Core
            • Properties
            • Syntax
          • Structures
        • Nullary
          • Decidable
            • Core
          • Irrelevant
            • Core
          • Recomputable
            • Core
          • Reflects
        • Unary
          • Properties
    1. Library
    2. Agda
    3. Builtin

    List

    {-# OPTIONS --cubical-compatible --safe --no-sized-types --no-guardedness --level-universe #-}
    
    module Agda.Builtin.List where
    
    infixr 5 _∷_
    data List {a} (A : Set a) : Set a where
      []  : List A
      _∷_ : (x : A) (xs : List A) → List A
    
    {-# BUILTIN LIST List #-}
    
    {-# COMPILE JS  List = function(x,v) {
      if (x.length < 1) { return v["[]"](); } else { return v["_∷_"](x[0], x.slice(1)); }
    } #-}
    {-# COMPILE JS [] = Array() #-}
    {-# COMPILE JS _∷_ = function (x) { return function(y) { return Array(x).concat(y); }; } #-}
    
    Previous
    Int
    Next
    Maybe
    Made with Material for MkDocs