Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
_really bad_ Common Lisp
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 51 - 63 of 63 - Collapse all  -  Translate all to Translated (View all originals) < Older 
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kalle Olavi Niemitalo  
View profile  
 More options Nov 16 2002, 5:11 am
Newsgroups: comp.lang.lisp
From: Kalle Olavi Niemitalo <k...@iki.fi>
Date: 16 Nov 2002 11:59:19 +0200
Local: Sat, Nov 16 2002 4:59 am
Subject: _really bad_ Common Lisp

Deon Garrett <garr...@cs.colostate.edu> writes:
>        * Use this code to iterate over a list.
>          (dotimes (i (length lst))
>            (do-something-to (elt lst i)))

Nice use of lst. ;-)  One could slow that down a little more by
measuring the length on each iteration.

  (do ((i 0 (1+ i)))
      ((= i (length lst)))
    (do-something-to (elt lst i)))

  (loop for i from 0
        while (< i (length lst))
        do (do-something-to (elt lst i)))

Is there a simpler way?  These ones look too complex to be used
by mistake.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "is Lisp used in text parsing and processing tasks?" by Gareth McCaughan
Gareth McCaughan  
View profile  
 More options Nov 16 2002, 2:45 pm
Newsgroups: comp.lang.lisp
From: Gareth McCaughan <Gareth.McCaug...@pobox.com>
Date: Sat, 16 Nov 2002 18:28:30 +0000
Local: Sat, Nov 16 2002 1:28 pm
Subject: Re: is Lisp used in text parsing and processing tasks?

Larry Hunter wrote:
>  The best idea I have seen for escaping this hell could only be done in
>  lisp. Chris Riesbeck has written a lisp homework parser that checks
>  for hundreds of stylistic and semantic errors that he never wants to
>  see. Some of it only works for particular problems (generally taken
>  from Graham's CL book exercises), but others are generic. Students
>  have to get the programs to pass his autochecker before submitting it
>  for his review. Source code is available...

>    http://www.cs.nwu.edu/academics/courses/c25/exercises/critic.html

Very neat. That page doesn't say where to get the tool from;
it's at

    http://www.cs.northwestern.edu/academics/courses/c25/programs/cs325.zip

I'm not sure that "could only be done in lisp" is right, though.
(It's certainly easier in Lisp than in any other language I can
think of.) There are similar tools for other languages, not written
in Lisp. Even <shudder> C++.

--
Gareth McCaughan  Gareth.McCaug...@pobox.com
.sig under construc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Schmolck  
View profile  
 More options Nov 16 2002, 5:27 pm
Newsgroups: comp.lang.lisp
From: Alexander Schmolck <a.schmo...@gmx.net>
Date: 16 Nov 2002 22:17:58 +0000
Local: Sat, Nov 16 2002 5:17 pm
Subject: Re: is Lisp used in text parsing and processing tasks?

Larry Hunter <Larry.Hun...@uchsc.edu> writes:
>   I could probably add more. All these examples are from code I've
>   seen since Monday. Yes, I am slowly going insane. Someone please
>   help me...or just kill me.

> The best idea I have seen for escaping this hell could only be done in
> lisp. Chris Riesbeck has written a lisp homework parser that checks
> for hundreds of stylistic and semantic errors that he never wants to

Actually, I vaguely remember the claim of one of my former lecturers to have
written something similar in fortran (analyzing fortran programs) for his phd
thesis, back in the days of punch cards. So maybe you really ought to say that
it can only be done in well matured programming languages (like lisp *or*
fortran). :)

alex


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "_really bad_ Common Lisp" by Knut Olav Bøhmer
Knut Olav Bøhmer  
View profile  
 More options Nov 17 2002, 6:43 am
Newsgroups: comp.lang.lisp
From: "Knut Olav Bøhmer" <kn...@linpro.no>
Date: 17 Nov 2002 12:43:10 +0100
Local: Sun, Nov 17 2002 6:43 am
Subject: Re: _really bad_ Common Lisp
* Kalle Olavi Niemitalo
<cut>

>   (loop for i from 0
>         while (< i (length lst))
>         do (do-something-to (elt lst i)))

> Is there a simpler way?  These ones look too complex to be used
> by mistake.

I don't know why I'm answering this, but here I go:

(loop for i in lst
        do (massage i))

--
Knut Olav Böhmer
         _   _
       / /  (_)__  __ ____  __
      / /__/ / _ \/ // /\ \/ /  ... The choice of a
     /____/_/_//_/\.,_/ /_/\.\         GNU generation

An ideal world is left as an exercise to the reader. (Paul Graham)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul F. Dietz  
View profile  
 More options Nov 17 2002, 7:04 am
Newsgroups: comp.lang.lisp
From: "Paul F. Dietz" <di...@dls.net>
Date: Sun, 17 Nov 2002 06:05:27 -0600
Local: Sun, Nov 17 2002 7:05 am
Subject: Re: _really bad_ Common Lisp

Knut Olav Bøhmer wrote:
>>  (loop for i from 0
>>        while (< i (length lst))
>>        do (do-something-to (elt lst i)))

>>Is there a simpler way?  These ones look too complex to be used
>>by mistake.

> I don't know why I'm answering this, but here I go:

> (loop for i in lst
>         do (massage i))

He knew that.  He was looking for a simpler way to make
bad code, not the simpler way to do it right.

Oh, and this is simpler. :)

   (mapc #'massage lst)

        Paul


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "is Lisp used in text parsing and processing tasks?" by Rob Warnock
Rob Warnock  
View profile  
 More options Nov 17 2002, 7:15 am
Newsgroups: comp.lang.lisp
From: r...@rpw3.org (Rob Warnock)
Date: Sun, 17 Nov 2002 06:15:09 -0600
Local: Sun, Nov 17 2002 7:15 am
Subject: Re: is Lisp used in text parsing and processing tasks?
I recently wrote about some circa 1970 PDP-10 code, saying:
+---------------
|       mul    t0,t1    ; .B*3
+---------------

Should have been "imul", of course. (*blush*)

-Rob

Reference: <URL:http://pdp10.nocrew.org/docs/opcodes.html>

-----
Rob Warnock, PP-ASEL-IA         <r...@rpw3.org>
627 26th Avenue                 <URL:http://www.rpw3.org/>
San Mateo, CA 94403             (650)572-2607


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paolo Amoroso  
View profile  
 More options Nov 17 2002, 10:48 am
Newsgroups: comp.lang.lisp
From: Paolo Amoroso <amor...@mclink.it>
Date: Sun, 17 Nov 2002 16:32:30 +0100
Local: Sun, Nov 17 2002 10:32 am
Subject: Re: is Lisp used in text parsing and processing tasks?
On Thu, 14 Nov 2002 03:33:38 -0700, Deon Garrett <garr...@cs.colostate.edu>
wrote:

What's amazing is not much that students make mistakes like the ones
mentioned in this thread. I am more suprised by the fact that they do such
mistakes after being exposed to a usually large number of--hopefully--good
and idiomatic code samples.

How much attention do they pay to _reading_ those examples? Shouldn't the
"cut and paste" mindset be of some help here? Bad habits spread like
wildfire, but there's a sort of psychological barrier to copying good ones.

Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paolo Amoroso  
View profile  
 More options Nov 17 2002, 10:48 am
Newsgroups: comp.lang.lisp
From: Paolo Amoroso <amor...@mclink.it>
Date: Sun, 17 Nov 2002 16:32:32 +0100
Local: Sun, Nov 17 2002 10:32 am
Subject: Re: is Lisp used in text parsing and processing tasks?

On Wed, 13 Nov 2002 18:08:49 GMT, Kenny Tilton <ktil...@nyc.rr.com> wrote:
> Exactly. In fact, sick idea: I'd love to track down the worst programmer
> who likes Lisp. Maybe hold an anti-contest. I bet they would not be very

This is an interesting reading:

  "FoOBaR - A Prehistoric Survivor"
  António Menezes Leitão
  Proceedings of ELUGM '99

  Abstract: We describe an old and large AI system that crossed several
  Lisp periods and dialects. The system is currently implemented in Common
  Lisp but still represents an unique source of information regarding
  implementation problems and solutions in older Lisp dialects and
  implementations. Most of these solutions are techniques to sourmount
  language limitations, to use language features in unforseen ways, or just
  incorrect coding practices. This paper describes some of these problema
  snd solutions, and their impact on readability, efficiency, and
  maintenance.

Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Deon Garrett  
View profile  
 More options Nov 17 2002, 5:30 pm
Newsgroups: comp.lang.lisp
From: Deon Garrett <garr...@cs.colostate.edu>
Date: Sun, 17 Nov 2002 15:29:24 -0700
Local: Sun, Nov 17 2002 5:29 pm
Subject: Re: is Lisp used in text parsing and processing tasks?

Paolo Amoroso <amor...@mclink.it> writes:

> What's amazing is not much that students make mistakes like the ones
> mentioned in this thread. I am more suprised by the fact that they do such
> mistakes after being exposed to a usually large number of--hopefully--good
> and idiomatic code samples.

Aye, therein lies the rub.  Ordinarily, students start off with the
standard Lisp beginner fare; reverse a list recursively and all that
stuff.  In this course, the professor decided to try a little
experiment.  He explained Lisp in some detail in the lectures, but
then left the students to study on their own.  They were supposed to
read the Graham book (Ansi Common Lisp) and see me with questions.
All the assignments have been fairly substantial pieces of code, at
least considering their lack of experience.  Of course, most didn't
read anything and have just been trying to muddle their way through
the semester.  I actually thought this was a good idea.  I've always
found the best way to learn a language was to write something real in
it.  In hindsight, I think students probably need a little more
guidance in the process of learning Lisp.

Yes, they _should_ have been exposed to plenty of good examples, but
the reality is that many of them probably think mapcar is some sort of
joint venture between Honda and Rand McNally.

I'm being a little too critical here.  About 25% of the class is
actually writing very good code.  A couple of students have actually
learned the Lisp efficiency model.  I guess that's probably the norm
in undergraduate education these days.  You probably can't expect much
more than that to do truly good work.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Nov 17 2002, 8:13 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 18 Nov 2002 01:13:14 +0000
Local: Sun, Nov 17 2002 8:13 pm
Subject: Re: is Lisp used in text parsing and processing tasks?
* Paolo Amoroso
| What's amazing is not much that students make mistakes like the ones
| mentioned in this thread. I am more suprised by the fact that they do such
| mistakes after being exposed to a usually large number of--hopefully--good
| and idiomatic code samples.
|
| How much attention do they pay to _reading_ those examples?  Shouldn't
| the "cut and paste" mindset be of some help here?  Bad habits spread like
| wildfire, but there's a sort of psychological barrier to copying good
| ones.

  The problem is that some people can learn something only once.  They are
  only malleable while they are truly unexposed.  Show them something, and
  the impression it makes causes anything that could occupy the same space
  later to be rejected.  If they later learn that their first impression was
  wrong, the result is only that they reject everything, which makes them
  insecure and suspicious.  To make matters worse, I believe this to be the
  default programming mode of the brain and that it requires directed effort
  -- also known as /thinking/ -- to override the default behavior.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal Costanza  
View profile  
 More options Nov 17 2002, 9:05 pm
Newsgroups: comp.lang.lisp
From: Pascal Costanza <costa...@web.de>
Date: Mon, 18 Nov 2002 03:05:21 +0100
Local: Sun, Nov 17 2002 9:05 pm
Subject: Re: is Lisp used in text parsing and processing tasks?

Erik Naggum wrote:
>   The problem is that some people can learn something only once.  They are
>   only malleable while they are truly unexposed.  Show them something, and
>   the impression it makes causes anything that could occupy the same space
>   later to be rejected.  If they later learn that their first impression was
>   wrong, the result is only that they reject everything, which makes them
>   insecure and suspicious.  To make matters worse, I believe this to be the
>   default programming mode of the brain and that it requires directed effort
>   -- also known as /thinking/ -- to override the default behavior.

I think you are talking about cognitive dissonance. See
http://tip.psychology.org/festinge.html

Pascal

--
Given any rule, however ‘fundamental’ or ‘necessary’ for science, there
are always circumstances when it is advisable not only to ignore the
rule, but to adopt its opposite. - Paul Feyerabend


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Nov 17 2002, 9:16 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 18 Nov 2002 02:16:46 +0000
Local: Sun, Nov 17 2002 9:16 pm
Subject: Re: is Lisp used in text parsing and processing tasks?
* Pascal Costanza
| I think you are talking about cognitive dissonance.

  Well, cognitive dissonance is the effect of the cause I was talking about.
  When cognitive dissonance occurs, the default coping strategy is to reject
  rather than to think and analyze and embrace new input, but the key to the
  ability to learn is the ability to update a slot that had been filled by
  the first impression, or to internalize and integrate new and conflicting
  information.  Failure to do this will only produce repeated incidents of
  cognitive dissonance.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Daly, Jr.  
View profile  
 More options Nov 19 2002, 4:48 pm
Newsgroups: comp.lang.lisp
From: t...@tenkan.org (Tim Daly, Jr.)
Date: Tue, 19 Nov 2002 15:48:22 -0600
Local: Tues, Nov 19 2002 4:48 pm
Subject: Re: is Lisp used in text parsing and processing tasks?

tuo...@yahoo.com (Tuomas P) writes:
> Hi!

> Is Lisp being used in programs that do text processing of various
> kind, such as parsing and manipulating an HTML file, parsing C code
> (and reindenting it), etc.? Would Lisp be a good to choice if one is
> to write such software?

For parsing, I would highly recommend bigloo:

  http://www-sop.inria.fr/mimosa/personnel/Manuel.Serrano/bigloo/

It's not Common Lisp, but it's still great.  It includes functionality
for lexing - (regular-grammar), and lalr parser generation
(lalr-grammar).  Check it out, I'm really impressed.

-Tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages < Older 
« Back to Discussions « Newer topic     Older topic »