Anonymous user
Doubly-linked list/Definition: Difference between revisions
→{{header|Haskell}}
(re-order) |
|||
Line 716:
For an efficient implementation, see the <code>Data.FDList</code> module provided by [http://hackage.haskell.org/package/liboleg liboleg]. But before using doubly linked lists at all, see [http://stackoverflow.com/questions/1844195/doubly-linked-list-in-a-purely-functional-programming-language this discussion on Stack Overflow].
<lang haskell>import qualified Data.
type NodeID = Maybe Rational
Line 748 ⟶ 747:
mcons :: a -> Node a -> Node a -> DLList a -> DLList a
mcons a n1 n2
M.insert midid mid
where Node n1val farleftid (Just n2id) = n1
Node n2val (Just n1id) farrightid = n2
|