From: ·······@despammed.com
Subject: Help - crash course for lisp novice
Date: 
Message-ID: <2b2845e7.0302131747.e9e2d08@posting.google.com>
Hello,

I have two weeks (now 1 1/2 weeks) to complete a programming
assignment in LISP.  I've never used LISP before.  The assignment is
to implement huffman encoding on a list of symbols (not strings) that
look like words.  We're not allowed to use iteration, side effects or
procedures with local variables (no setf, setq, let, etc...).

I'm not interested in anything that could be considered plagiarism,
but would appreciate pointers to web sites or postings that might
focus in on the tools I'll need.  I've read the first 5 chapters of a
LISP text and I'm continuing to work through it as well as digging
around the web as much as I can.  I'm finding, however, that there is
lots of information and most of it is not immediately relevent.  Since
we were only given two weeks for the assignment, a more targetted
search would be invaluable.

Any references will be appreciated.

Thanks,
-Steve-

From: Larry Clapp
Subject: Re: Help - crash course for lisp novice
Date: 
Message-ID: <nqoh2b.g1g.ln@theclapp.ddts.net>
In article <···························@posting.google.com>,
·······@despammed.com wrote:
> I have two weeks (now 1 1/2 weeks) to complete a programming
> assignment in LISP.  I've never used LISP before.  The assignment is
> to implement huffman encoding on a list of symbols (not strings)
> that look like words.  We're not allowed to use iteration, side
> effects or procedures with local variables (no setf, setq, let,
> etc...).
> 
> I'm not interested in anything that could be considered plagiarism,
> but would appreciate pointers to web sites or postings that might
> focus in on the tools I'll need.  I've read the first 5 chapters of
> a LISP text and I'm continuing to work through it as well as digging
> around the web as much as I can.  I'm finding, however, that there
> is lots of information and most of it is not immediately relevent.
> Since we were only given two weeks for the assignment, a more
> targetted search would be invaluable.

http://www.cs.sfu.ca/CC/310/pwfong/Lisp/ has some information on
functional programming in Lisp.  Googling on "functional programming
tutorial lisp" may turn up more.

http://www.nist.gov/dads/HTML/huffmanEncoding.html and
http://www.la.unm.edu/~mbrettin/algorithms/huffman.html have some
information on Huffman encoding. 

Also remember you can build LET out of FUNCALL:

    (let ((x 1)
	  (y 2)
	  (z 3))
      (print x)
      (print y)
      (print z))

equals

    (funcall #'(lambda (x y z)
		 (print x)
		 (print y)
		 (print z))
	     1 2 3)

Good luck.

-- 
Larry Clapp / ·····@theclapp.org
Use Lisp from Vim: VILisp: http://vim.sourceforge.net/script.php?script_id=221


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----
From: Jeremy Yallop
Subject: Re: Help - crash course for lisp novice
Date: 
Message-ID: <b2i8sn$1d4aqj$1@ID-114079.news.dfncis.de>
Larry Clapp wrote:
> Also remember you can build LET out of FUNCALL:
> 
>     (let ((x 1)
> 	  (y 2)
> 	  (z 3))
>       (print x)
>       (print y)
>       (print z))
> 
> equals
> 
>     (funcall #'(lambda (x y z)
> 		 (print x)
> 		 (print y)
> 		 (print z))
> 	     1 2 3)

You don't even need the `funcall' in this case:

      ((lambda (x y z)
               (print x)
               (print y)
               (print z))
            1 2 3)

See `lambda forms' in the Hyperspec.

Jeremy
From: Dr. Des Small
Subject: Re: Help - crash course for lisp novice
Date: 
Message-ID: <m6r8abnlmg.fsf@pc156.maths.bris.ac.uk>
·······@despammed.com writes:

> Hello,
> 
> I have two weeks (now 1 1/2 weeks) to complete a programming
> assignment in LISP.  I've never used LISP before.  The assignment is
> to implement huffman encoding on a list of symbols (not strings) that
> look like words.  We're not allowed to use iteration, side effects or
> procedures with local variables (no setf, setq, let, etc...).

This is heresy, of course, but there is a fill-in-the-gaps
Huffman-encoding exercise in SICP, available at:

http://mitpress.mit.edu/sicp/full-text/sicp/book/node41.html

It sounds like they want you to pretend you're writing an even sillier
dialect of Scheme anyway, so I'd start with that - you won't need
"iteration" (you do, of course, but it's written as function calls),
or side effects.  A bit of syntactic salt can take out any use of
"let".

If they're under the impression that Scheme is a Lisp you can stop
there, otherwise it should be a straightforward port to Common Lisp.
In a sane world you'd use Common Lisp in the first place, but in a
sane world you wouldn't pretend you were writing in pure lambda
calculus.

[...]

Good luck!

Des
is happily retired from hoop-jumping.
-- 
Des Small, Scientific Programmer,
School of Mathematics, University of Bristol, UK.