From: Nandan
Subject: loading packages using clc/asdf
Date: 
Message-ID: <Pine.GSO.4.40.0504071742250.21858-100000@lambda.cse.ohio-state.edu>
In my first foray into 'real world' lisp programming, I am using CMUCL/Slime on
Debian. I need to read CSV files so I apt-got 'cl-csv'.

Using

(asdf:oos 'asdf:compile-op :csv)
(clc:clc-require :csv)
(read-csv-file "XX.csv")

The asdf:oos causes a lot of compilation, which seems to go fine.
Then I get sent to the debugger. I think perhaps the namespace/package
is incorrect?

I can't figure out the correct one out of these:

1. in /usr/share/common-lisp/source/csv/csv-src.lisp it uses
		(defpackage :fare-csv)
2. in csv.asd (ASDF file for CSV?) I see the forms:
		(defpackage #:csv-system (:use #:asdf #:cl))
		(in-package #:csv-system)
3. Common Lisp Controller's DESIGN.txt files says, though
		- a user wants to use a system-wide library.
		  (asdf:oos 'asdf:compile-op :<library>)
		  will load the system at
		  /usr/share/common-lisp/systems/<library>.asd
		  that will use the source at
		  /usr/share/common-lisp/source/<library>
		  User interface:
		  To load a library "cil" do:
		  (clc:clc-require :cil)
   Which leads me to believe the package I am looking for is 'csv'.

So I am not sure what the relationship between the names
(fare-csv csv csv-system) is.

Should I be trying (require :fare-csv) perhaps?


TIA,  nandan.



-- 
Nandan Bagchee

  Some kinds of waste really are disgusting. SUVs, for example, would arguably
  be gross even if they ran on a fuel which would never run out and generated
  no pollution. SUVs are gross because they're the solution to a gross problem.
  (How to make minivans look more masculine.)

		-- Paul Graham

From: Edi Weitz
Subject: Re: loading packages using clc/asdf
Date: 
Message-ID: <u64yyrznk.fsf@agharta.de>
On Thu, 7 Apr 2005 18:10:55 -0400, Nandan <·······@cse.ohio-state.edu> wrote:

> In my first foray into 'real world' lisp programming, I am using CMUCL/Slime on
> Debian. I need to read CSV files so I apt-got 'cl-csv'.
>
> Using
>
> (asdf:oos 'asdf:compile-op :csv)
> (clc:clc-require :csv)

The first line isn't necessary - CLC-REQUIRE will compile the lib for
you if needed.

Or, as you are using SLIME, you can type ,l while in the REPL buffer
and load the library from there using completion.

> (read-csv-file "XX.csv")

You have to find out the package this symbol is in:

  * (apropos "read-csv-file")

  FARE-CSV::READ-CSV-FILE [function] (p)

Hmm, the double colon means that the symbol isn't exported from its
home package (which is named "FARE-CSV").  Either you're not supposed
to call this function or the author simply forgot to export it... :)

If the latter is the case try

  (fare-csv::read-csv-file "XX.csv")

instead.  That should work.

> So I am not sure what the relationship between the names (fare-csv
> csv csv-system) is.

CSV is the name of the library as far as ASDF (the tool which loads
it) is concerned.  ASDF will look for a file called "csv.asd" in
certain places.  CSV-SYSTEM is the name of a package that's only used
internally and you shouldn't care about it.  FARE-CSV is the package
which contains the symbols (like the name of the function above) you
want to access.

For an introduction to packages see:

  <http://www.gigamonkeys.com/book/programming-in-the-large-packages-and-symbols.html>.

For a simple introduction to what ASDF does see:

  <http://weitz.de/asdf-install/>

HTH,
Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Nandan
Subject: Re: loading packages using clc/asdf
Date: 
Message-ID: <Pine.GSO.4.40.0504071912420.21858-100000@lambda.cse.ohio-state.edu>
>CSV is the name of the library as far as ASDF (the tool which loads it) is
>concerned.  ASDF will look for a file called "csv.asd" in certain places.
>CSV-SYSTEM is the name of a package that's only used internally and you
>shouldn't care about it.  FARE-CSV is the package which contains the symbols
>(like the name of the function above) you want to access.
>

Thanks. Got it to work, I think. Seems something is broken with CSV though, or
my CSV file misformatted.

FARE-CSV> (with-open-file (s "ne")
	    (read-csv-stream s))
; Evaluation aborted
FARE-CSV>  (fare-csv::read-csv-file "ne")

Both forms yield the error:

Error in function (LABELS END-OF-FIELD
                    READ-CSV-LINE):
   end of field expected
   [Condition of type SIMPLE-ERROR]


-
Nandan Bagchee

  Some kinds of waste really are disgusting. SUVs, for example, would arguably
  be gross even if they ran on a fuel which would never run out and generated
  no pollution. SUVs are gross because they're the solution to a gross problem.
  (How to make minivans look more masculine.)

		-- Paul Graham