Subject: [clisp-list] newbie problem: invalid byte #xB3 in CHARSET:ASCII conversion

From: Szymon <[email-masked]>
Date: Wed Nov 26 10:00:04 2003

Hi.

I'm newbie and `dirs' function (below) is my first piece of lisp code (i try
clisp only for now).

please help.

~$ clisp --version

==> GNU CLISP 2.31 (released 2003-09-01) (built on midas.slackware.lan [127.0.0.1])
==> Features: 
==> (CLOS LOOP COMPILER CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI GETTEXT UNICODE BASE-CHAR=CHARACTER PC386 UNIX)
==> Installation directory: /usr/lib/clisp/
==> User language: ENGLISH

question: can I send (to this mailinglist) stupid problems like this?

--------begin.
[65]> (defun dirs (x &key depth)
  (let ((c '()))
    (flet ((wildir (d) (directory (concatenate 'string  (directory-namestring d) "*/"))))
      (if (null depth)
	  (labels ((f (d) (mapcar #'f (wildir d)) (push d c))) (cdr (f x)))
	(labels ((f (d i)
		    (cond ((<= i depth)
			   (mapcar #'(lambda (o) (f o (1+ i))) (wildir d))
			   (push d c)))))
	  (cdr (f x 0)))))))
DIRS

[66]> (length (dirs #P"/7/etc/" :depth 1))
40

[67]> (length (dirs #P"/7/" :depth 1))
*** - invalid byte #xB3 in CHARSET:ASCII conversion   <=== !problem <======

1. Break [68]> :q

[69]> (dir "/7/*/")
/7/A/
/7/A3/
/7/ART/
/7/ARTGEN/
/7/ARTYKUL.2/
/7/ARTYKUL.3/
/7/CLIKI/
/7/anime/
/7/bckup.5/
/7/bg/
/7/documentation/
/7/emacs-21.3/
/7/etc/
/7/flena/
/7/gg-history/
/7/libIDL-0.8.2/
/7/mail/
/7/mod/
/7/mozilla-bookmarks/
/7/musick/
/7/ninja/
/7/osiolek/
/7/rfan/
/7/sources/
/7/techno/
/7/temp/
/7/torrents/
/7/xforms-1.0/

[70]> #'dirs
#<CLOSURE DIRS (X &KEY DEPTH) (DECLARE (SYSTEM::IN-DEFUN DIRS))
  (BLOCK DIRS
   (LET ((C 'NIL))
    (FLET ((WILDIR (D) (DIRECTORY (CONCATENATE 'STRING (DIRECTORY-NAMESTRING D) "*/"))))
     (IF (NULL DEPTH) (LABELS ((F (D) (MAPCAR #'F (WILDIR D)) (PUSH D C))) (CDR (F X)))
      (LABELS ((F (D I) (COND ((<= I DEPTH) (MAPCAR #'(LAMBDA (O) (F O (1+ I))) (WILDIR D)) (PUSH D C))))) (CDR (F X 0)))))))>

--------end.

---

From: Sam Steingold <[email-masked]>
Date: Mon Dec 1 11:58:11 2003

> * Szymon <[email-masked]> [2003-11-26 18:58:28 +0100]:
>

yes.  <http://clisp.cons.org/faq.html#help>

> *** - invalid byte #xB3 in CHARSET:ASCII conversion

<http://clisp.cons.org/faq.html#enc-err>
Try "clisp -E utf-8".

see also <http://clisp.cons.org/impnotes/environment.html#debugger>
(try "where").

note that (directory "foo/**/") is the same as your (dirs "foo/").

note that (dirs "foo/" :depth number) is the same as

(let ((*merge-pathnames-ansi* t))
  (loop :with d = "foo/" :repeat number
     :nconc (directory (setq d (merge-pathnames "*/" d)))))

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
186,000 Miles per Second.  It's not just a good idea.  IT'S THE LAW.

---

From: Szymon <[email-masked]>
Date: Mon Dec 1 20:17:41 2003

Hi.

> yes.  <http://clisp.cons.org/faq.html#help>

Nice. Now I have reason to learn how write in english :) (I can only
read it).

> <http://clisp.cons.org/faq.html#enc-err>

Thanks, `-E' works.

> [.....]

I wrote `dirs' because I read few lisp tutorials and want try it
(trying to reinvent wheel is ok. for me if I do something to
educate myself).

>      :nconc (directory (setq d (merge-pathnames "*/" d)))))

Very nice, thanks. No "super"loop in my tutorials :(

regards, szymon.