From: ·············@gmail.com
Subject: Lisp quiz, anyone?
Date: 
Message-ID: <1176221326.636193.264960@l77g2000hsb.googlegroups.com>
Hello, I am currently trying to learn Common Lisp (I am reading
Practical Common Lisp), but I am also attracted to learn Ruby because
of the Ruby Quiz. Is there something alike in the world of Common
Lisp? I found there is (or was) an attempt of this sort in
http://common-lisp.net/project/quiz/ and have already subscribed to
the mailing list... but there is no activity.

From: Ken Tilton
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <6iPSh.2243$XH5.131@newsfe12.lga>
·············@gmail.com wrote:
> Hello, I am currently trying to learn Common Lisp (I am reading
> Practical Common Lisp), but I am also attracted to learn Ruby because
> of the Ruby Quiz. Is there something alike in the world of Common
> Lisp? I found there is (or was) an attempt of this sort in
> http://common-lisp.net/project/quiz/ and have already subscribed to
> the mailing list... but there is no activity.
> 

I remember the C Puzzle Book as possibly the only technical doc better 
than K&R itself. And I actually did all the puzzles, whereas I have 
never gotten past chapter two in a straight read of a language reference 
-- I get impatient and Just Start Programming. But the C Puzzle book in 
its simplicity ("what does this print?") and devilish difficulty made a 
lot of reference work fun, by giving it a purpose, however 
inconsequential. Funny how that works, reminds me of this Theory Y 
blabber on which my marketing is based:

    http://www.theoryyalgebra.com/TheoryY_1.html

ie, There was no way I was going to memorize the half page of 
precedence, but the puzzle book (a) helped get a lot of it ingrained and 
(b) certainly taught me never to take it for granted, by sucking me in 
with /hard/ work (solving the puzzle) vs tedious work (memorization).

Does the Ruby Quiz have that same devilishly hard quality? I think that 
is where the fun is.

kt

-- 

"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts

http://www.theoryyalgebra.com/
From: Joe Marshall
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176321115.866821.223790@p77g2000hsh.googlegroups.com>
On Apr 10, 9:53 am, Ken Tilton <····@theoryyalgebra.com> wrote:
> ·············@gmail.com wrote:
> > Hello, I am currently trying to learn Common Lisp (I am reading
> > Practical Common Lisp), but I am also attracted to learn Ruby because
> > of the Ruby Quiz. Is there something alike in the world of Common
> > Lisp? I found there is (or was) an attempt of this sort in
> >http://common-lisp.net/project/quiz/and have already subscribed to
> > the mailing list... but there is no activity.
>
> I remember the C Puzzle Book as possibly the only technical doc better
> than K&R itself. And I actually did all the puzzles, whereas I have
> never gotten past chapter two in a straight read of a language reference
> -- I get impatient and Just Start Programming. But the C Puzzle book in
> its simplicity ("what does this print?") and devilish difficulty made a
> lot of reference work fun, by giving it a purpose, however
> inconsequential.

(defun m (i j k)
  (cond ((= k 0) (cond ((= i 1) j)
                       ((= i 2) 0)
                       (t       1)))
        ((= i 0) (+ k 1))
        (t (m (- i 1)
              j
              (m i j (- k 1))))))

What does (m 4 4 4) evaluate to?
From: Ken Tilton
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <CYbTh.44$na.16@newsfe12.lga>
Joe Marshall wrote:
> On Apr 10, 9:53 am, Ken Tilton <····@theoryyalgebra.com> wrote:
> 
>>·············@gmail.com wrote:
>>
>>>Hello, I am currently trying to learn Common Lisp (I am reading
>>>Practical Common Lisp), but I am also attracted to learn Ruby because
>>>of the Ruby Quiz. Is there something alike in the world of Common
>>>Lisp? I found there is (or was) an attempt of this sort in
>>>http://common-lisp.net/project/quiz/and have already subscribed to
>>>the mailing list... but there is no activity.
>>
>>I remember the C Puzzle Book as possibly the only technical doc better
>>than K&R itself. And I actually did all the puzzles, whereas I have
>>never gotten past chapter two in a straight read of a language reference
>>-- I get impatient and Just Start Programming. But the C Puzzle book in
>>its simplicity ("what does this print?") and devilish difficulty made a
>>lot of reference work fun, by giving it a purpose, however
>>inconsequential.
> 
> 
> (defun m (i j k)
>   (cond ((= k 0) (cond ((= i 1) j)
>                        ((= i 2) 0)
>                        (t       1)))
>         ((= i 0) (+ k 1))
>         (t (m (- i 1)
>               j
>               (m i j (- k 1))))))
> 
> What does (m 4 4 4) evaluate to?
> 

5? I would run it ut my second guess is that it erases my hard drive.

But I am concerned that this seems to have nearly zero educational 
value. Did I miss something? What lisp subtley does it teach?

kzo

-- 
http://www.theoryyalgebra.com/

"Algebra is the metaphysics of arithmetic." - John Ray

"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts

"Stand firm in your refusal to remain conscious during algebra."
    - Fran Lebowitz

"I'm an algebra liar. I figure two good lies make a positive."
    - Tim Allen
From: Joe Marshall
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176336364.781703.317840@y80g2000hsf.googlegroups.com>
On Apr 11, 1:57 pm, Ken Tilton <····@theoryyalgebra.com> wrote:
> Joe Marshall wrote:
> > On Apr 10, 9:53 am, Ken Tilton <····@theoryyalgebra.com> wrote:
>
> >>·············@gmail.com wrote:
>
> >>>Hello, I am currently trying to learn Common Lisp (I am reading
> >>>Practical Common Lisp), but I am also attracted to learn Ruby because
> >>>of the Ruby Quiz. Is there something alike in the world of Common
> >>>Lisp? I found there is (or was) an attempt of this sort in
> >>>http://common-lisp.net/project/quiz/andhave already subscribed to
> >>>the mailing list... but there is no activity.
>
> >>I remember the C Puzzle Book as possibly the only technical doc better
> >>than K&R itself. And I actually did all the puzzles, whereas I have
> >>never gotten past chapter two in a straight read of a language reference
> >>-- I get impatient and Just Start Programming. But the C Puzzle book in
> >>its simplicity ("what does this print?") and devilish difficulty made a
> >>lot of reference work fun, by giving it a purpose, however
> >>inconsequential.
>
> > (defun m (i j k)
> >   (cond ((= k 0) (cond ((= i 1) j)
> >                        ((= i 2) 0)
> >                        (t       1)))
> >         ((= i 0) (+ k 1))
> >         (t (m (- i 1)
> >               j
> >               (m i j (- k 1))))))
>
> > What does (m 4 4 4) evaluate to?
>
> 5? I would run it ut my second guess is that it erases my hard drive.
>
> But I am concerned that this seems to have nearly zero educational
> value. Did I miss something? What lisp subtley does it teach?

Educational value?  I thought you just wanted a simple puzzle that
was `devilish', albeit `inconsequential'.

There is a subtlety, though.  Since actually running the program
might take longer than you are willing to wait, you have to use
your brain to analyze the program without running it.
From: Ken Tilton
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <A8fTh.33584$XH5.17324@newsfe12.lga>
Joe Marshall wrote:
> On Apr 11, 1:57 pm, Ken Tilton <····@theoryyalgebra.com> wrote:
> 
>>Joe Marshall wrote:
>>
>>>On Apr 10, 9:53 am, Ken Tilton <····@theoryyalgebra.com> wrote:
>>
>>>>·············@gmail.com wrote:
>>
>>>>>Hello, I am currently trying to learn Common Lisp (I am reading
>>>>>Practical Common Lisp), but I am also attracted to learn Ruby because
>>>>>of the Ruby Quiz. Is there something alike in the world of Common
>>>>>Lisp? I found there is (or was) an attempt of this sort in
>>>>>http://common-lisp.net/project/quiz/andhave already subscribed to
>>>>>the mailing list... but there is no activity.
>>
>>>>I remember the C Puzzle Book as possibly the only technical doc better
>>>>than K&R itself. And I actually did all the puzzles, whereas I have
>>>>never gotten past chapter two in a straight read of a language reference
>>>>-- I get impatient and Just Start Programming. But the C Puzzle book in
>>>>its simplicity ("what does this print?") and devilish difficulty made a
>>>>lot of reference work fun, by giving it a purpose, however
>>>>inconsequential.
>>
>>>(defun m (i j k)
>>>  (cond ((= k 0) (cond ((= i 1) j)
>>>                       ((= i 2) 0)
>>>                       (t       1)))
>>>        ((= i 0) (+ k 1))
>>>        (t (m (- i 1)
>>>              j
>>>              (m i j (- k 1))))))
>>
>>>What does (m 4 4 4) evaluate to?
>>
>>5? I would run it ut my second guess is that it erases my hard drive.
>>
>>But I am concerned that this seems to have nearly zero educational
>>value. Did I miss something? What lisp subtley does it teach?
> 
> 
> Educational value?  I thought you just wanted a simple puzzle that
> was `devilish', albeit `inconsequential'.

Context is everything. Let's see if we can restore it:

> But the C Puzzle book in
> its simplicity ("what does this print?") and devilish difficulty made a
> lot of reference work fun, by giving it a purpose, however
> inconsequential.

OK, what Lisp reference work would I do to answer this puzzle? The trick 
is not just to create puzzles, but to create puzzles whose act of 
solving edifies in re the subtleties of Lisp.

> 
> There is a subtlety, though.  Since actually running the program
> might take longer than you are willing to wait, you have to use
> your brain to analyze the program without running it.
> 

Then it is a good algorithms puzzle?

kxo

-- 
http://www.theoryyalgebra.com/

"Algebra is the metaphysics of arithmetic." - John Ray

"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts

"Stand firm in your refusal to remain conscious during algebra."
    - Fran Lebowitz

"I'm an algebra liar. I figure two good lies make a positive."
    - Tim Allen
From: Joe Marshall
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176353586.942982.253830@l77g2000hsb.googlegroups.com>
On Apr 11, 5:34 pm, Ken Tilton <····@theoryyalgebra.com> wrote:
>
> Context is everything. Let's see if we can restore it:

Nah, this horse is dead.

> Then it is a good algorithms puzzle?

It was a passing amusement.  Nothing to see here.
Move along.
From: Dan Bensen
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <evkmic$79d$1@wildfire.prairienet.org>
Joe Marshall wrote:
> It was a passing amusement. 
Very amusing indeed.   The answer is 4^(4^(4^(4))).
Somehow "sadistic" seems more accurate :)

It is more of a math problem, though.  There's not much
in it to learn about programming, unless maybe if you
want to grunge around with large-number crunching.

-- 
Dan
www.prairienet.org/~dsb/
From: Ken Tilton
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <WIqTh.3$6C6.2@newsfe12.lga>
Joe Marshall wrote:
> On Apr 11, 5:34 pm, Ken Tilton <····@theoryyalgebra.com> wrote:
> 
>>Context is everything. Let's see if we can restore it:
> 
> 
> Nah, this horse is dead.

Well, getting back to the other horse, I find myself wondering what 
would in fact be fodder for The Lisp Puzzle Book, where the definition 
is "puzzles that make us study things it would be nice to master but 
which are hard to master in a vacuum of necessity". Of course, the 
puzzles are not necessary, which is the neat thing about puzzles. But 
they do pose (a) a specific challenge (b) one can solve in a reasonable 
amount of time (c) but not too easily.

LOOP might be a good candidate. Many times we see people here saying 
they know they should master it but have not bothered yet. LOOP has 
lotsa options to sort through, too many to just stare at. But create 
twenty puzzles touching on all the good stuff and gotchas, and away we 
go. FORMAT, pathnames, CLOS,... other? Packages?

kwt

-- 
http://www.theoryyalgebra.com/

"Algebra is the metaphysics of arithmetic." - John Ray

"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts

"Stand firm in your refusal to remain conscious during algebra."
    - Fran Lebowitz

"I'm an algebra liar. I figure two good lies make a positive."
    - Tim Allen
From: Rob St. Amant
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <evm039$g79$1@blackhelicopter.databasix.com>
Ken Tilton <···@theoryyalgebra.com> writes:

> Joe Marshall wrote:
>> On Apr 11, 5:34 pm, Ken Tilton <····@theoryyalgebra.com> wrote:
>>
>>>Context is everything. Let's see if we can restore it:
>>
>>
>> Nah, this horse is dead.
>
> Well, getting back to the other horse, I find myself wondering what
> would in fact be fodder for The Lisp Puzzle Book, where the definition
> is "puzzles that make us study things it would be nice to master but
> which are hard to master in a vacuum of necessity". Of course, the
> puzzles are not necessary, which is the neat thing about puzzles. But
> they do pose (a) a specific challenge (b) one can solve in a
> reasonable amount of time (c) but not too easily.
>
> LOOP might be a good candidate. Many times we see people here saying
> they know they should master it but have not bothered yet. LOOP has
> lotsa options to sort through, too many to just stare at. But create
> twenty puzzles touching on all the good stuff and gotchas, and away we
> go. FORMAT, pathnames, CLOS,... other? Packages?

A few candidates:

Write a quine.

Write once-only.

(The following are probably too easy except for novices.)

Explain why (read-from-string "foo bar" :start 0) is probably wrong.

Write functions for creation, addition, and deletion for a FIFO queue,
using only lists as data structures.
From: Ken Tilton
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <dTvTh.39$6C6.10@newsfe12.lga>
Rob St. Amant wrote:
> Ken Tilton <···@theoryyalgebra.com> writes:
> 
> 
>>Joe Marshall wrote:
>>
>>>On Apr 11, 5:34 pm, Ken Tilton <····@theoryyalgebra.com> wrote:
>>>
>>>
>>>>Context is everything. Let's see if we can restore it:
>>>
>>>
>>>Nah, this horse is dead.
>>
>>Well, getting back to the other horse, I find myself wondering what
>>would in fact be fodder for The Lisp Puzzle Book, where the definition
>>is "puzzles that make us study things it would be nice to master but
>>which are hard to master in a vacuum of necessity". Of course, the
>>puzzles are not necessary, which is the neat thing about puzzles. But
>>they do pose (a) a specific challenge (b) one can solve in a
>>reasonable amount of time (c) but not too easily.
>>
>>LOOP might be a good candidate. Many times we see people here saying
>>they know they should master it but have not bothered yet. LOOP has
>>lotsa options to sort through, too many to just stare at. But create
>>twenty puzzles touching on all the good stuff and gotchas, and away we
>>go. FORMAT, pathnames, CLOS,... other? Packages?
> 
> 
> A few candidates:
> 
> Write a quine.
> 
> Write once-only.
> 
> (The following are probably too easy except for novices.)
> 
> Explain why (read-from-string "foo bar" :start 0) is probably wrong.
> 
> Write functions for creation, addition, and deletion for a FIFO queue,
> using only lists as data structures.

FIFO is good. Along the same lines, I was going to suggest a destructive 
tree flattener that does not cons. Extra credit for handling a 
self-referential tree. Mind you this is not so much reference digging as 
it is getting used to conses -- maybe we include also "extreme workout" 
for fundamental skills. The CPB did this with pointer dereferencing and 
incrementing.

Macro puzzles are one I missed in the original list.

kzo

-- 
http://www.theoryyalgebra.com/

"Algebra is the metaphysics of arithmetic." - John Ray

"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts

"Stand firm in your refusal to remain conscious during algebra."
    - Fran Lebowitz

"I'm an algebra liar. I figure two good lies make a positive."
    - Tim Allen
From: Rob St. Amant
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <evqhrt$nvd$1@blackhelicopter.databasix.com>
Ken Tilton <···@theoryyalgebra.com> writes:

> Macro puzzles are one I missed in the original list.

I forgot to mention declarations.  Half the time when I add them for
efficiency it seems I don't see any change; I should take the time to
work through some examples to get a better understanding of how to do
it.
From: Ken Tilton
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <ZW6Uh.340$S27.153@newsfe12.lga>
Rob St. Amant wrote:
> Ken Tilton <···@theoryyalgebra.com> writes:
> 
> 
>>Macro puzzles are one I missed in the original list.
> 
> 
> I forgot to mention declarations.  Half the time when I add them for
> efficiency it seems I don't see any change; I should take the time to
> work through some examples to get a better understanding of how to do
> it.

Good one. Black art, as far as I can make out.

kxo

-- 
http://www.theoryyalgebra.com/

"Algebra is the metaphysics of arithmetic." - John Ray

"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts

"Stand firm in your refusal to remain conscious during algebra."
    - Fran Lebowitz

"I'm an algebra liar. I figure two good lies make a positive."
    - Tim Allen
From: byronsalty
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176568773.839809.147700@w1g2000hsg.googlegroups.com>
I think the questions on RubyQuiz are great (well some of them are).
We just need a place to post solutions so that we can compare and
learn how others solve problems. As someone learning Lisp I think this
would be great to see what kind of simplifications others came up
with. I'm often wondering if I'm re-inventing the wheel when I can't
find a function I need and end up writing my own.
From: Ken Tilton
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <GN7Uh.2666$S27.2041@newsfe12.lga>
byronsalty wrote:
> I think the questions on RubyQuiz are great (well some of them are).
> We just need a place to post solutions so that we can compare and
> learn how others solve problems. As someone learning Lisp I think this
> would be great to see what kind of simplifications others came up
> with. I'm often wondering if I'm re-inventing the wheel when I can't
> find a function I need and end up writing my own.
> 

The way to get this going is to post here an especially good RQ question 
and your Lisp solution, see if you can drum up interest. If it takes 
off, you start a Web site or something. If not, the ball game comes on 
at two.

Didn't Xah try whipping up something like this last year?

kt


-- 
http://www.theoryyalgebra.com/

"Algebra is the metaphysics of arithmetic." - John Ray

"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts

"Stand firm in your refusal to remain conscious during algebra."
    - Fran Lebowitz

"I'm an algebra liar. I figure two good lies make a positive."
    - Tim Allen
From: John Thingstad
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <op.tqsbyzacpqzri1@pandora.upc.no>
On Sat, 14 Apr 2007 18:03:02 +0200, Ken Tilton <···@theoryyalgebra.com>  
wrote:

>
>
> Rob St. Amant wrote:
>> Ken Tilton <···@theoryyalgebra.com> writes:
>>
>>> Macro puzzles are one I missed in the original list.
>>   I forgot to mention declarations.  Half the time when I add them for
>> efficiency it seems I don't see any change; I should take the time to
>> work through some examples to get a better understanding of how to do
>> it.
>
> Good one. Black art, as far as I can make out.
>
> kxo
>

You could take a look at "How to make Lisp go as fast as C" by Didier  
Verna.
www.lrde.epita.fr/dload/papers/verna.06.imecs.pdf

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Alan Crowe
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <86ejml7t7e.fsf@cawtech.freeserve.co.uk>
·······@ncsu.edu (Rob St. Amant) writes:
> I forgot to mention declarations.  Half the time when I add them for
> efficiency it seems I don't see any change; I should take the time to
> work through some examples to get a better understanding of how to do
> it.

One of the SBCLers was kind enough to explain this to me
recently. Read

http://www.sbcl.org/manual/Declarations-as-Assertions.html#Declarations-as-Assertions

or read on and see if I have understood.

(defun f (n)
  (declare (type (integer 2 200) n))
  .
  .
  .

One interpretation of this declaration is that the compiler
realises that n will fit in 8 bits and compiles code
accordingly. On an 8 bit processor, this declaration,
interpreted in this way, speeds things up very nicely.

The under the default compilation settings SBCL interprets
the declaration as documentation. It is a convenient way for
the programmer to tell the maintainer something about n and
the compiler adds to its value by adding code to check both
n > 1 and n <= 200 and signal an error if either assertion
fails. Comments that are actually true, cool!

The price for this very attractive feature is that
declarations are causing the compiler to add runtime overhead
for the sake of easier debugging. The code may run more
slowly. You don't get to see the unobscured impact on speed
until you decide that you have finished debugging and
recompile with a compilation policy that emphasises speed.

Alan Crowe
Edinburgh
Scotland
From: Rob St. Amant
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <evt8pr$906$1@blackhelicopter.databasix.com>
Alan Crowe <····@cawtech.freeserve.co.uk> writes:

> ·······@ncsu.edu (Rob St. Amant) writes:
>> I forgot to mention declarations.  Half the time when I add them for
>> efficiency it seems I don't see any change; I should take the time to
>> work through some examples to get a better understanding of how to do
>> it.
>
> One of the SBCLers was kind enough to explain this to me
> recently. Read
>
> http://www.sbcl.org/manual/Declarations-as-Assertions.html#Declarations-as-Assertions
>
> or read on and see if I have understood.
>
> (defun f (n)
>   (declare (type (integer 2 200) n))
>   .
>   .
>   .
>
> One interpretation of this declaration is that the compiler
> realises that n will fit in 8 bits and compiles code
> accordingly. On an 8 bit processor, this declaration,
> interpreted in this way, speeds things up very nicely.
>
> The under the default compilation settings SBCL interprets
> the declaration as documentation. It is a convenient way for
> the programmer to tell the maintainer something about n and
> the compiler adds to its value by adding code to check both
> n > 1 and n <= 200 and signal an error if either assertion
> fails. Comments that are actually true, cool!
>
> The price for this very attractive feature is that
> declarations are causing the compiler to add runtime overhead
> for the sake of easier debugging. The code may run more
> slowly. You don't get to see the unobscured impact on speed
> until you decide that you have finished debugging and
> recompile with a compilation policy that emphasises speed.

Interesting--this tells me I know even less about declarations and
their impact on efficiency than I'd thought.
From: Chris Russell
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176501645.901018.284100@p77g2000hsh.googlegroups.com>
On Apr 12, 8:08 pm, ·······@ncsu.edu (Rob St. Amant) wrote:
> Ken Tilton <····@theoryyalgebra.com> writes:
> > Joe Marshall wrote:
> >> On Apr 11, 5:34 pm, Ken Tilton <····@theoryyalgebra.com> wrote:
>
> >>>Context is everything. Let's see if we can restore it:
>
> >> Nah, this horse is dead.
>
> > Well, getting back to the other horse, I find myself wondering what
> > would in fact be fodder for The Lisp Puzzle Book, where the definition
> > is "puzzles that make us study things it would be nice to master but
> > which are hard to master in a vacuum of necessity". Of course, the
> > puzzles are not necessary, which is the neat thing about puzzles. But
> > they do pose (a) a specific challenge (b) one can solve in a
> > reasonable amount of time (c) but not too easily.
>
> > LOOP might be a good candidate. Many times we see people here saying
> > they know they should master it but have not bothered yet. LOOP has
> > lotsa options to sort through, too many to just stare at. But create
> > twenty puzzles touching on all the good stuff and gotchas, and away we
> > go. FORMAT, pathnames, CLOS,... other? Packages?
>
> A few candidates:
>
> Write a quine.
>
> Write once-only.
>
> (The following are probably too easy except for novices.)
>
> Explain why (read-from-string "foo bar" :start 0) is probably wrong.
>
> Write functions for creation, addition, and deletion for a FIFO queue,
> using only lists as data structures.

How about, write a tag [1] language parser using FORMAT?

I keep meaning to try and get one running but haven't got round to it
yet...

[1] http://scienceblogs.com/goodmath/2007/02/the_most_pathological_machine_1.php
From: Chris Russell
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176504194.103398.69500@e65g2000hsc.googlegroups.com>
On Apr 13, 11:00 pm, "Chris Russell" <·····················@gmail.com>
wrote:

> How about, write a tag [1] language parser using FORMAT?

OK, I know I'm talking to myself now, but is this even possible?

I thought there was a format command to append another argument onto
the back of the argument list but I can't find it now in the
hyperspec.

Oh well.

C
From: Alan Crowe
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <86odlr16yg.fsf@cawtech.freeserve.co.uk>
"Chris Russell" <·····················@gmail.com> writes:

> On Apr 13, 11:00 pm, "Chris Russell" <·····················@gmail.com>
> wrote:
> 
> > How about, write a tag [1] language parser using FORMAT?
> 
> OK, I know I'm talking to myself now, but is this even possible?
> 
> I thought there was a format command to append another argument onto
> the back of the argument list but I can't find it now in the
> hyperspec.
> 
> Oh well.
> 
> C

I'm having some difficulty working out how to program in tag2.

CL-USER> (defun tag2 (program input)
           (print input)
           (cond ((endp input) (error "No input."))
                 ((eql (first input) 'halt) (rest input))
                 (t (tag2 program
                          (append (cddr input)
                                  (cdr (assoc (first input) program)))))))
TAG2

CL-USER> (tag2 '((a b halt b halt halt)
                     (b c c c c)
                     (c d d d d)
                     (d e e))
                   '(a halt))

(A HALT) 
(B HALT B HALT HALT) 
(B HALT HALT C C C C) 
(HALT C C C C C C C C) 

(C C C C C C C C)

I think the good folk at husi would enjoy the link to

http://scienceblogs.com/goodmath/2007/02/the_most_pathological_machine_1.php

if this thread 

http://www.hulver.com/scoop/story/2007/4/12/81334/7148

is anything to go by

Alan Crowe
Edinburgh
Scotland
From: Nils M Holm
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <evjh8j$1ct$1@online.de>
Joe Marshall <··········@gmail.com> wrote:
> (defun m (i j k)
>   (cond ((= k 0) (cond ((= i 1) j)
>                        ((= i 2) 0)
>                        (t       1)))
>         ((= i 0) (+ k 1))
>         (t (m (- i 1)
>               j
>               (m i j (- k 1))))))
> 
> What does (m 4 4 4) evaluate to?

My guess would be (expt 4 1340780792994259709957402499820584612747936582
059239337772356144372176403007354697680187429816690342769003185818648605
0853753882811946569946433649006084096).

No, I did not actually run it. ;-)

Nice puzzle!

-- 
Nils M Holm <n m h @ t 3 x . o r g> -- http://t3x.org/nmh/
From: Joe Marshall
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176335980.940920.161690@d57g2000hsg.googlegroups.com>
On Apr 11, 1:42 pm, Nils M Holm <·················@online.de> wrote:
> Joe Marshall <··········@gmail.com> wrote:
> > (defun m (i j k)
> >   (cond ((= k 0) (cond ((= i 1) j)
> >                        ((= i 2) 0)
> >                        (t       1)))
> >         ((= i 0) (+ k 1))
> >         (t (m (- i 1)
> >               j
> >               (m i j (- k 1))))))
>
> > What does (m 4 4 4) evaluate to?
>
> My guess would be (expt 4 1340780792994259709957402499820584612747936582
> 059239337772356144372176403007354697680187429816690342769003185818648605
> 0853753882811946569946433649006084096).
>
> No, I did not actually run it. ;-)
>
> Nice puzzle!

Thanks go to Jeremy Wertheimer.

Now for the expert challenge.  Assuming you *did* run it, how many
decimal
digits would be in the output?  What would be the first (leftmost)
several
digits?  What would be the last (rightmost, least significant) few
digits?
From: Nils M Holm
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <evkotj$gql$1@online.de>
Joe Marshall <··········@gmail.com> wrote:
> On Apr 11, 1:42 pm, Nils M Holm <·················@online.de> wrote:
> > Joe Marshall <··········@gmail.com> wrote:
> > > (defun m (i j k)
> > >   (cond ((= k 0) (cond ((= i 1) j)
> > >                        ((= i 2) 0)
> > >                        (t       1)))
> > >         ((= i 0) (+ k 1))
> > >         (t (m (- i 1)
> > >               j
> > >               (m i j (- k 1))))))
> >
> > > What does (m 4 4 4) evaluate to?
> >
> > My guess would be (expt 4 1340780792994259709957402499820584612747936582
> > 059239337772356144372176403007354697680187429816690342769003185818648605
> > 0853753882811946569946433649006084096).
> >
> > No, I did not actually run it. ;-)
> >
> > Nice puzzle!
> 
> Thanks go to Jeremy Wertheimer.
> 
> Now for the expert challenge.  Assuming you *did* run it, how many
> decimal
> digits would be in the output?  What would be the first (leftmost)
> several
> digits?  What would be the last (rightmost, least significant) few
> digits?

The actual computation of (m 4 4 4) would probably involve the
destruction of the known universe, so I looked for some short
cuts. I think I have found two and a half answers to the above
questions, but I am moving on slippery ground here.

Number of digits: 8x10^153.
Last five digits: 84096.

Right now I have no idea how to compute the leading digits.
I thought about the fractional digits of (log10 (expt 4 256)),
but given the fact that this number will still have 153 digits
before the decimal point, I guess that this approach would not
be practicable (at least I have no calculator that can do this).

Does this make me a semi-expert? :-)

-- 
Nils M Holm <n m h @ t 3 x . o r g> -- http://t3x.org/nmh/
From: Lars Rune Nøstdal
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <461bb77d$0$29074$c83e3ef6@nn1-read.tele2.net>
On Tue, 10 Apr 2007 09:08:46 -0700, ivan.salazarv wrote:

> Hello, I am currently trying to learn Common Lisp (I am reading
> Practical Common Lisp), but I am also attracted to learn Ruby because
> of the Ruby Quiz. Is there something alike in the world of Common
> Lisp? I found there is (or was) an attempt of this sort in
> http://common-lisp.net/project/quiz/ and have already subscribed to
> the mailing list... but there is no activity.

maybe http://www.spoj.pl/ they accept submissions in Common Lisp (CLISP)

-- 
Lars Rune Nøstdal
http://nostdal.org/
From: Frank Buss
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <67jbrl4yefyh.183ly5fy5ba9d.dlg@40tude.net>
·············@gmail.com wrote:

> Hello, I am currently trying to learn Common Lisp (I am reading
> Practical Common Lisp), but I am also attracted to learn Ruby because
> of the Ruby Quiz. Is there something alike in the world of Common
> Lisp? I found there is (or was) an attempt of this sort in
> http://common-lisp.net/project/quiz/ and have already subscribed to
> the mailing list... but there is no activity.

If you just searching for some tasks, why not solving the Ruby Quizzes in
Lisp?

Another good idea:

http://www.recmath.com/contest/index.php

I'm in the middle of the highscore, with a solution calculated by a Lisp
program, which I hacked in a few hours and which needed some minutes to
create the solutions.

-- 
Frank Buss, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: ·············@gmail.com
Subject: Re: Lisp quiz, anyone?
Date: 
Message-ID: <1176317890.594110.83980@n76g2000hsh.googlegroups.com>
Thanks everyone, I think this is the best part of learning, having
contact and feedback from others. Thank you very much.