[plt-scheme] Newbie question: picking the right data structure

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Jul 18 11:03:15 EDT 2009


How would this work:

(define (command-line-data-structure-explorer)
   (define (repl list-of-things-to-track)
      ...
      (repl (cons additional-string list-of-things-to-track)))
      ... )
   ;; --- IN:
   (repl '()))

For cons, you can use whatever you find more suitable. Sorry if this
misinterprets your question -- Matthias



On Jul 18, 2009, at 10:03 AM, Gregg Williams wrote:

> Hi! I'm fairly new at Scheme, though I have written a number of
> programs in the functional style with no problem. However, I'm hitting
> a blind spot and would like somebody's opinion.
>
> I want to use Scheme to create an interactive environment for
> exploring a data set (i.e., from the command line). Each datum is
> represented by a string that I use as a key, so I will be building up
> various named lists of strings and adding to them.
>
> Here's my problem: I can't seem to find a good way to add strings to a
> list identified by a fixed variable name. I can't seem to use "define"
> to overwrite the variable with a new list. I could use a vector, but
> that would waste a lot of space if I made all vectors long enough for
> practical purposes. I looked into using mutable lists, but
> destructively splicing a second list onto the list connected to my
> veritable name has repercussions.
>
> Am I missing something obvious, or do I have to just choose one of
> these options and deal with the consequences? Thanks for your help.
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.