(note: a bit long being a first post)

I've been writing variations of a (very!) small learning program just
to learn picolisp, and to gather the basics of what I need for a coming
project (also language learning, but with sign). And just wanted to
post a first attempt to check form and convention and company, so here
the latest variant (working):

# Title    :  guess the article, picolisp

(de gtl NIL
   (class +Wrds +Entity)
   (rel wid (+Key +Number))
   (rel wrd (+Key +List +String))
   (pool "words02d.db")
   (setq *Max (maxKey (tree 'wid '+Wrds)))
   (setq *Art '(("r" "der") ("e" "die") ("s" "das") (" " " ") ) )
   (seed (time))
      (prin "number of words (q to quit): ")
      (T (= "q" (setq N (read))) 'end)
      (do N
         (until (db 'wid '+Wrds (rand 1 *Max)))
         (let W (car (get @ 'wrd))
            (prinl '"___ " W)
            (let M
               (mapcan cdr
                  (collect 'wrd '+Wrds
                     (list W "a") (list W "z") 'wrd ) )
                  (and M (<> (setq G (cadr (assoc (key) *Art))) " ") )
                  (ifn (index G M)
                     (prinl "you dummy!")
                     (prinl G " " W ", hurrah!")
                     (when (setq M (delete G M))
                        (prinl "there's more!")) ) ) ) ) ) ) )

And am now about to expand the fields with this as the next step:

   (rel inf (+String))
   (rel shown (+Number))
   (rel wrong (+Number))
   (rel init_dat (+Date))
   (rel init_box (+Number))
   (rel last_dat (+Date))
   (rel last_box (+Number))
   (rel next_dat (+Date))

And have questions about that.

I've noticed the pil db is considerably larger than the original
sqlite, even with only part of the data. If that is normal that is also
OK with me, just wanted to check.

Mostly I am wondering about what to index and what not, also whether an
idx is of any benefit to me.

The wid key (see below) seems necessary because I want to be able to
random sample first of all. The wrd key (word and article) also seem
necessary. But do I really want to add an index for all the additional
data fields (to track scheduled learning)? And what about when I also
add a variety of categories (tags)?

I have tried both iter'ing the whole db as well as collecting in
various versions and notice no real difference in response (with 2600
records). So I am kind of torn, for queries it seems a good and natural
thing to index, but maybe its overkill for my size of db? I think I
want to avoid unnecessary complexity, might be a better way to say that.

I'm not sure how you go about deciding that, since "it depends". For my
case: The final db in any case could be up to 5000 records (and the
same again later for sign language), with data fields updated often,
but where the records themselves are largely static (no additions or
deletions). I am writing it to run on a Nanonote among other things
(picolisp already compiled and running!), so memory and speed could
also be a factor. Queries could be somewhat complex for searching or
maintenance, but "in-play" would be fairly simple. Just to sketch
things out a bit.

Its funny, I was dead set on programming lisp, kind of a principle
thing, but now that I have gotten my feet wet a bit I am starting to
think that picolisp really IS the best choice for what I have in mind.
Because of the db, the gui, its "all just there". A little gem.
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to