A Generic Linked List Implementation in Fortran 95

Jason R. Blevins
ACM Fortran Forum 28(3), 2–7, 2009.

Availability:

Abstract. This paper develops a standard conforming generic linked list in Fortran 95 which is capable of storing data of an any type. The list is implemented using the transfer intrinsic function, and although the interface is generic, it remains relatively simple and minimizes the potential for error. Although linked lists are the focus of this paper, the generic programming techniques used are very general and broadly-applicable to other data structures and procedures implemented in Fortran 95 that need to be used with data of an unknown type.

Keywords: Fortran 95, generic programming, data structures, scientific computing.

BibTeX Record:

@Article{blevins09generic,
  author       = {Jason R. Blevins},
  title        = {A Generic Linked List Implementation in Fortran 95},
  journal      = {ACM Fortran Forum},
  year         = 2009,
  volume       = 28,
  number       = 3,
  pages        = {2--7}
}

Errata

  1. July 21, 2012: In the list_free subroutine, line 11 should read nullify(current%data) instead of nullify(self%data). Thanks to Michael Quinlan.