From 0f7085dedd2f60f2ccc0b1f49558f5be89de97b2 Mon Sep 17 00:00:00 2001
From: Tucker Evans <tucker@tuckerevans.com>
Date: Wed, 10 Jun 2020 23:23:52 -0400
Subject: Fix change order of functions in double ended queue.

Groups functions that return items together.
---
 collections/double_ended_queue.adoc | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

(limited to 'collections/double_ended_queue.adoc')

diff --git a/collections/double_ended_queue.adoc b/collections/double_ended_queue.adoc
index 00c6dad..f583df3 100644
--- a/collections/double_ended_queue.adoc
+++ b/collections/double_ended_queue.adoc
@@ -176,9 +176,9 @@ deq_push_back(queue, NULL);
 assert(deq_size(queue) == 1);
 ----
 
-+void* deq_pop_front(deq *self)+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Pops an item off of the front of the queue +self+.
++void deq_set(deq *self, int index, void *item)+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Sets the element at position +index+ in +self+ to +item+.
 
 Examples
 ^^^^^^^^
@@ -194,13 +194,15 @@ deq *queue = deq_new();
 deq_push_back(queue, str_dup(str1));
 deq_push_back(queue, str_dup(str2));
 
-assert(str_cmp(deq_pop_front(queue), str1) == 0);
-assert(str_cmp(deq_pop_front(queue), str2) == 0);
+deq_set(queue, 0, str2);
+
+assert(str_cmp(deq_pop_back(queue), str2) == 0);
+assert(str_cmp(deq_pop_back(queue), str2) == 0);
 ----
 
-+void* deq_pop_back(deq *self)+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Pops an item off of the back of the queue +self+.
++void* deq_pop_front(deq *self)+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Pops an item off of the front of the queue +self+.
 
 Examples
 ^^^^^^^^
@@ -216,13 +218,13 @@ deq *queue = deq_new();
 deq_push_back(queue, str_dup(str1));
 deq_push_back(queue, str_dup(str2));
 
-assert(str_cmp(deq_pop_back(queue), str2) == 0);
-assert(str_cmp(deq_pop_back(queue), str1) == 0);
+assert(str_cmp(deq_pop_front(queue), str1) == 0);
+assert(str_cmp(deq_pop_front(queue), str2) == 0);
 ----
 
-+void deq_set(deq *self, int index, void *item)+
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Sets the element at position +index+ in +self+ to +item+.
++void* deq_pop_back(deq *self)+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Pops an item off of the back of the queue +self+.
 
 Examples
 ^^^^^^^^
@@ -238,10 +240,8 @@ deq *queue = deq_new();
 deq_push_back(queue, str_dup(str1));
 deq_push_back(queue, str_dup(str2));
 
-deq_set(queue, 0, str2);
-
-assert(str_cmp(deq_pop_back(queue), str2) == 0);
 assert(str_cmp(deq_pop_back(queue), str2) == 0);
+assert(str_cmp(deq_pop_back(queue), str1) == 0);
 ----
 
 +void* deq_index(deq *self, int index)+
-- 
cgit v1.1

