Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

School Help

0 views
Skip to first unread message

Doug Edwards

unread,
Jul 9, 1996, 3:00:00 AM7/9/96
to

I'm working on a school project that includes LISP code examples. I've
found many examples in library books, but still need something.

Could someone send me a source code listing of a simple lisp database
program that I could adapt. The record structures would be similar to
an address book. I must have Name, address, age (integer) and ten
float numbers (for grades). I must enable the user to save to file,
retrieve and update the records. I must also sort them.

Any help would be appreciated.

Thank you,

Doug Edwards


Bruce Voss

unread,
Jul 10, 1996, 3:00:00 AM7/10/96
to

I am trying to convert a complex list (list of lists) into a string. The list looks something like this:

((2 3) (3 4) (4 5))

I want it to look like this:

"((2 3) (3 4) (4 5))"

Does anyone know how this can be done with relative ease?

Any help would be appreciated.

Regards,

bv...@engsoc.carleton.ca

bruc...@nortel.ca

..all opinions are my own, etc. etc.

Benjamin Shults

unread,
Jul 10, 1996, 3:00:00 AM7/10/96
to bruc...@nortel.ca

Bruce Voss wrote:
>
> I am trying to convert a complex list (list of lists) into a string. The list looks something like this:
>
> ((2 3) (3 4) (4 5))
>
> I want it to look like this:
>
> "((2 3) (3 4) (4 5))"
>
> Does anyone know how this can be done with relative ease?
>

(format nil "~a" '((2 3) (3 4) (4 5)))
=>

"((2 3) (3 4) (4 5))"

(stringp (format nil "~a" '((2 3) (3 4) (4 5))))
=>
T

(format nil "~s" '((2 3) (3 4) (4 5)))
=>

"((2 3) (3 4) (4 5))"

(stringp (format nil "~s" '((2 3) (3 4) (4 5))))
=>
T


--
Benjamin Shults Email: bsh...@math.utexas.edu
Department of Mathematics Phone: (512) 471-7711 ext. 208
University of Texas at Austin WWW: http://www.ma.utexas.edu/users/bshults
Austin, TX 78712 USA FAX: (512) 471-9038 (attn: Benjamin Shults)

Erik Naggum

unread,
Jul 11, 1996, 3:00:00 AM7/11/96
to

[Bruce Voss]

| I am trying to convert a complex list (list of lists) into a string.
| The list looks something like this:
|
| ((2 3) (3 4) (4 5))
|
| I want it to look like this:
|
| "((2 3) (3 4) (4 5))"
|
| Does anyone know how this can be done with relative ease?

see the section of the Lisp printer in your Lisp reference.

#\Erik

Ken Tilton

unread,
Jul 16, 1996, 3:00:00 AM7/16/96
to

Bruce Voss wrote:
>
> I am trying to convert a complex list (list of lists) into a string. The list looks something like this:
>
> ((2 3) (3 4) (4 5))
>
> I want it to look like this:
>
> "((2 3) (3 4) (4 5))"
>
> Does anyone know how this can be done with relative ease?
>
> Any help would be appreciated.
>
> Regards,
>
> bv...@engsoc.carleton.ca
>
> bruc...@nortel.ca
>
> ..all opinions are my own, etc. etc.

Hmmm. How about (format t "~s" (format nil "~s" '((2 3) (4 5))))?

Not sure what happens when you get away from simple atoms like 2 and 3.

Cheers,

Ken

Brian M. Moore

unread,
Jul 18, 1996, 3:00:00 AM7/18/96
to

> Bruce Voss wrote:
> >
> > I am trying to convert a complex list (list of lists) into a string.
The list looks something like this:
> >
> > ((2 3) (3 4) (4 5))
> >
> > I want it to look like this:
> >
> > "((2 3) (3 4) (4 5))"
> >
> > Does anyone know how this can be done with relative ease?
> >
> > Any help would be appreciated.
> >
> > Regards,
> >
> > bv...@engsoc.carleton.ca

(setq my-string (format nil "~A" '((2 3) (3 4) (4 5))))

0 new messages