A Generic Linked List Implementation in Fortran 95
Jason R. Blevins
ACM Fortran Forum 28(3), 2–7, 2009.
Availability:
- Published version: doi:10.1145/1667140.1667141
- Preprint version: generic-list.pdf
- Source code: generic_list.f90
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
- July 21, 2012: In the
list_free
subroutine, line 11 should readnullify(current%data)
instead ofnullify(self%data)
. Thanks to Michael Quinlan.