Hello, it's me again :S.<br><br>I would like to know how I can access persistent collection pages efficiently.<br><br>What I'm trying to do is making work a web list component with elephant. The list component is supposed to support well known navigation commands, like look at the collection in pages, support for first, last, next, previous buttons, and display of collection size.
<br><br>The collection size problem was treated here: <a href="http://common-lisp.net/pipermail/elephant-devel/2007-October/001162.html">http://common-lisp.net/pipermail/elephant-devel/2007-October/001162.html</a>.<br><br>
But now I have a problem with building the pages. <br><br>My first try was:<br> (let*<br> ((start (* (current-page self) (page-size self)))<br> (end (+ start (page-size self)))<br> )<br> (<:ul<br>
(elephant:map-btree #'(lambda (key elem) (declare (ignore key))<br> (let ((elem-text (make-elem-text self elem)))<br> (<:li<br> (if (slot-value self 'selectable)
<br> (<ucw:a :action (answer elem) (<:as-html elem-text))<br> (<:a (<:as-html elem-text))))))<br> (model self) :start start :end end)<br> )
<br><br>with start and end previously fixed based in the current page number and size.<br><br>But I realized indexes were not sequential when I created new objects, as this shows:<br><br>ASKIT> (with-btree-cursor (cursor (find-class-index 'user))
<br> (iter <br> (for (values exists? k v) = (cursor-next cursor))<br> (while exists?)<br> (format *standard-output* "~A -> ~A ~%" k v)))<br>2 -> #<USER name: dssdf {B043379}> <br>3 -> #<USER name: ttttt {B045C69}>
<br>5 -> #<USER name: ff {B048179}> <br>6 -> #<USER name: other {B04A451}> <br>7 -> #<USER name: guest {AD61271}> <br>100 -> #<USER name: qqq {B053001}> <br>101 -> #<USER name: {B055721}>
<br>102 -> #<USER name: {B057E01}> <br>103 -> #<USER name: {B05A529}> <br>104 -> #<USER name: {B05CCF1}> <br>105 -> #<USER name: {B05F579}> <br>106 -> #<USER name: {B063E91}>
<br>107 -> #<USER name: qqq {B066851}> <br>200 -> #<USER name: {B069519}> <br>201 -> #<USER name: {B06C009}> <br>300 -> #<USER name: {B06EBA1}> <br>301 -> #<USER name: aaa {B0717D1}>
<br>NIL<br><br>I don't think this is a bug, it must have to do with how Elephant manages btrees; but then how am I supposed to access through pages?<br>I would like to have to access all the objects from the beggining just to discard them instantly (imagine a large collection and the user wanting to see the last page).
<br><br>Thank you again :)<br><br>Mariano<br>