From: Jason
Subject: Happy New Year!
Date: 
Message-ID: <4f6c17c9-3ba9-4305-8139-5f93fa6b6be4@e10g2000prf.googlegroups.com>
(defun geek-out (l)
	   (let ((s nil))
	   (loop for c in l
	      do (setf s (concatenate 'string s (format nil "~a" (code-char
c)))))
	   s))

(geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))

-Jason

From: John Thingstad
Subject: Re: Happy New Year!
Date: 
Message-ID: <op.t38vdh1rut4oq5@pandora.alfanett.no>
P� Tue, 01 Jan 2008 04:18:54 +0100, skrev Jason <·······@gmail.com>:

> (defun geek-out (l)
> 	   (let ((s nil))
> 	   (loop for c in l
> 	      do (setf s (concatenate 'string s (format nil "~a" (code-char
> c)))))
> 	   s))
>
> (geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))
>
> -Jason


(coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78 101  
119 32 89 101 97 114 33)) 'string)

to you too!

--------------
John Thingstad
From: Jason
Subject: Re: Happy New Year!
Date: 
Message-ID: <0a678c93-53c8-4e0f-9252-be44e572a186@u10g2000prn.googlegroups.com>
On Jan 1, 1:30 am, "John Thingstad" <·······@online.no> wrote:
> På Tue, 01 Jan 2008 04:18:54 +0100, skrev Jason <·······@gmail.com>:
>
> > (defun geek-out (l)
> >       (let ((s nil))
> >       (loop for c in l
> >          do (setf s (concatenate 'string s (format nil "~a" (code-char
> > c)))))
> >       s))
>
> > (geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))
>
> > -Jason
>
> (coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78 101  
> 119 32 89 101 97 114 33)) 'string)
>
> to you too!
>
> --------------
> John Thingstad

OMFG. Why did nobody ever tell me about coerce before?

Thank you!

-Jason
From: tim Josling
Subject: Re: Happy New Year!
Date: 
Message-ID: <13nlb5387u9aodc@corp.supernews.com>
On Tue, 01 Jan 2008 12:46:55 -0800, Jason wrote:

> On Jan 1, 1:30 am, "John Thingstad" <·······@online.no> wrote:
>> På Tue, 01 Jan 2008 04:18:54 +0100, skrev Jason <·······@gmail.com>:
>>
>> > (defun geek-out (l)
>> >       (let ((s nil))
>> >       (loop for c in l
>> >          do (setf s (concatenate 'string s (format nil "~a" (code-char
>> > c)))))
>> >       s))
>>
>> > (geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))
>>
>> > -Jason
>>
>> (coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78 101  
>> 119 32 89 101 97 114 33)) 'string)
>>
>> to you too!
>>
>> --------------
>> John Thingstad
> 
> OMFG. Why did nobody ever tell me about coerce before?
> 
> Thank you!
> 
> -Jason

Wider question: how do you find these things?

For example, I saw in CLTL2 that #'int-char had been removed. So I thought
there was no way to convert an int to a character. Little did I realise
there is #'code-char.

Other examples: 

#'coerce (convert)
#'remove-if-not (filter)
Don't get me started on map*.

Is there a function somewhere 
(s2l "Convert sensible name to lisp equivalent" ...)

Tim Josling
From: Jason
Subject: Re: Happy New Year!
Date: 
Message-ID: <8582146b-899e-4cd2-a6c7-934c0efd7231@i12g2000prf.googlegroups.com>
On Jan 1, 1:12 pm, tim Josling <·············@westnet.com.au> wrote:
> On Tue, 01 Jan 2008 12:46:55 -0800, Jason wrote:
> > On Jan 1, 1:30 am, "John Thingstad" <·······@online.no> wrote:
> >> På Tue, 01 Jan 2008 04:18:54 +0100, skrev Jason <·······@gmail.com>:
>
> >> > (defun geek-out (l)
> >> >       (let ((s nil))
> >> >       (loop for c in l
> >> >          do (setf s (concatenate 'string s (format nil "~a" (code-char
> >> > c)))))
> >> >       s))
>
> >> > (geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))
>
> >> > -Jason
>
> >> (coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78 101  
> >> 119 32 89 101 97 114 33)) 'string)
>
> >> to you too!
>
> >> --------------
> >> John Thingstad
>
> > OMFG. Why did nobody ever tell me about coerce before?
>
> > Thank you!
>
> > -Jason
>
> Wider question: how do you find these things?
>

I looked around in the reference section of my copy of ANSI Common
Lisp. According to the author it "describes every operator in ANSI
Common Lisp". So far it seems to do the trick.

As Kenny mentioned, apropos is also useful, although it can be a bit
frustrating at times.

-Jason
From: Ken Tilton
Subject: Re: Happy New Year!
Date: 
Message-ID: <477a8a6c$0$9165$607ed4bc@cv.net>
Jason wrote:
> On Jan 1, 1:12 pm, tim Josling <·············@westnet.com.au> wrote:
> 
>>On Tue, 01 Jan 2008 12:46:55 -0800, Jason wrote:
>>
>>>On Jan 1, 1:30 am, "John Thingstad" <·······@online.no> wrote:
>>>
>>>>P� Tue, 01 Jan 2008 04:18:54 +0100, skrev Jason <·······@gmail.com>:
>>
>>>>>(defun geek-out (l)
>>>>>      (let ((s nil))
>>>>>      (loop for c in l
>>>>>         do (setf s (concatenate 'string s (format nil "~a" (code-char
>>>>>c)))))
>>>>>      s))
>>
>>>>>(geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))
>>
>>>>>-Jason
>>
>>>>(coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78 101  
>>>>119 32 89 101 97 114 33)) 'string)
>>
>>>>to you too!
>>
>>>>--------------
>>>>John Thingstad
>>
>>>OMFG. Why did nobody ever tell me about coerce before?
>>
>>>Thank you!
>>
>>>-Jason
>>
>>Wider question: how do you find these things?
>>
> 
> 
> I looked around in the reference section of my copy of ANSI Common
> Lisp. According to the author it "describes every operator in ANSI
> Common Lisp". So far it seems to do the trick.
> 
> As Kenny mentioned, apropos is also useful, although it can be a bit
> frustrating at times.

I have the advantage of using AllegroCL, which has a GUI dialog for 
apropos which lets me restrict the matches several ways. I see the CLHS 
documents the package constraint as standard, ACL lets me also restrict 
to (a) exported (b) functions. That along with constraining search to 
symbols in the CL package knocks Apropos on "CHAR" down to 39 items, 
pretty easily scanned for something that will return the char of a 
number. It would be a minute's work to use Lisp's introspective 
capabilities to portablu do the same to the output of apropos-list. 
Combine this with the Lisp GUI environment of your choice and 
replicating ACL's dialog would be a snap.

kt

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

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Edi Weitz
Subject: Re: Happy New Year!
Date: 
Message-ID: <ur6h1gjoj.fsf@agharta.de>
On Tue, 01 Jan 2008 18:46:37 -0500, Ken Tilton <···········@optonline.net> wrote:

> I have the advantage of using AllegroCL, which has a GUI dialog for
> apropos which lets me restrict the matches several ways. I see the
> CLHS documents the package constraint as standard, ACL lets me also
> restrict to (a) exported (b) functions. That along with constraining
> search to symbols in the CL package knocks Apropos on "CHAR" down to
> 39 items, pretty easily scanned for something that will return the
> char of a number. It would be a minute's work to use Lisp's
> introspective capabilities to portablu do the same to the output of
> apropos-list. Combine this with the Lisp GUI environment of your
> choice and replicating ACL's dialog would be a snap.

Has been done at least twice:

  http://www.lispworks.com/documentation/lw50/CLWUG-W/html/clwuser-w-318.htm
  http://weitz.de/lw-add-ons/#apropos

Both tools listed above will also accept regular expressions as search
strings (as does slime-apropos in SLIME IIRC).

Edi.

-- 

European Common Lisp Meeting, Amsterdam, April 19/20, 2008

  http://weitz.de/eclm2008/

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Ken Tilton
Subject: Re: Happy New Year!
Date: 
Message-ID: <477abf88$0$9101$607ed4bc@cv.net>
Edi Weitz wrote:
> On Tue, 01 Jan 2008 18:46:37 -0500, Ken Tilton <···········@optonline.net> wrote:
> 
> 
>>I have the advantage of using AllegroCL, which has a GUI dialog for
>>apropos which lets me restrict the matches several ways. I see the
>>CLHS documents the package constraint as standard, ACL lets me also
>>restrict to (a) exported (b) functions. That along with constraining
>>search to symbols in the CL package knocks Apropos on "CHAR" down to
>>39 items, pretty easily scanned for something that will return the
>>char of a number. It would be a minute's work to use Lisp's
>>introspective capabilities to portablu do the same to the output of
>>apropos-list. Combine this with the Lisp GUI environment of your
>>choice and replicating ACL's dialog would be a snap.
> 
> 
> Has been done at least twice:
> 
>   http://www.lispworks.com/documentation/lw50/CLWUG-W/html/clwuser-w-318.htm
>   http://weitz.de/lw-add-ons/#apropos
> 
> Both tools listed above will also accept regular expressions as search
> strings (as does slime-apropos in SLIME IIRC).

Cool, tho I was suggesting it as a newby exercise, not something for a 
Lisp demi-god such His Ediness. Can you keychord to the source 
definition of something, or, in the case of a class, pop open a GUI 
class browser on that class? You were just showing off with the regex, 
right?

kzo

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

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Edi Weitz
Subject: Re: Happy New Year!
Date: 
Message-ID: <umyrohocr.fsf@agharta.de>
On Tue, 01 Jan 2008 22:33:47 -0500, Ken Tilton <···········@optonline.net> wrote:

> Can you keychord to the source definition of something, or, in the
> case of a class, pop open a GUI class browser on that class?

You can right-click yourself to the source, the documentation, an
inspector, or a class browser.  If you press #\Return, it'll take you
to the source code (or, failing that, to the documentation).

> You were just showing off with the regex, right?

Nah, I was hoping you would admit that AllegroCL doesn't have
that... :)

Edi.

-- 

European Common Lisp Meeting, Amsterdam, April 19/20, 2008

  http://weitz.de/eclm2008/

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Ken Tilton
Subject: Re: Happy New Year!
Date: 
Message-ID: <477ad649$0$9112$607ed4bc@cv.net>
Edi Weitz wrote:
> On Tue, 01 Jan 2008 22:33:47 -0500, Ken Tilton <···········@optonline.net> wrote:
> 
> 
>>Can you keychord to the source definition of something, or, in the
>>case of a class, pop open a GUI class browser on that class?
> 
> 
> You can right-click yourself to the source, the documentation, an
> inspector, or a class browser.

No key chords? And they have to be the same ones used in the rest of the 
IDE. btw, symbol-completion in the search field?

>  If you press #\Return, it'll take you
> to the source code (or, failing that, to the documentation).
> 
> 
>>You were just showing off with the regex, right?
> 
> 
> Nah, I was hoping you would admit that AllegroCL doesn't have
> that... :)

That may be a feature, not a bug. AllegroCL has a dandy regex package, 
and they have a dandy apropos dialog. Combining the two would take five 
minutes. They have not done so, and they continually refine their IDE in 
response to user requests. Feel the walls closing in?

How about a good use case for (+ regex apropos)?

kt

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

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Edi Weitz
Subject: Re: Happy New Year!
Date: 
Message-ID: <uejd0hjnr.fsf@agharta.de>
On Wed, 02 Jan 2008 00:11:06 -0500, Ken Tilton <···········@optonline.net> wrote:

> symbol-completion in the search field?

Symbol completion in an Apropos dialog?  Hmmm....

> That may be a feature, not a bug.

Yes, I've heard that before, but from another company.  Have you been
promoted to the marketing department for 2008?

> AllegroCL has a dandy regex package

Yeah, I've read about it.  It came a bit late, though... :)

> They have not done so, and they continually refine their IDE in
> response to user requests. Feel the walls closing in?

Nope.  I know some of their users.

> How about a good use case for (+ regex apropos)?

- "^with" instead of "with"
- "focus.*p$"
- "default.*type"
- "(delete|remove)"
- "^(make|create|new)-"

And so on...

-- 

European Common Lisp Meeting, Amsterdam, April 19/20, 2008

  http://weitz.de/eclm2008/

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Ken Tilton
Subject: Re: Happy New Year!
Date: 
Message-ID: <477b8d71$0$13889$607ed4bc@cv.net>
Edi Weitz wrote:
> On Wed, 02 Jan 2008 00:11:06 -0500, Ken Tilton <···········@optonline.net> wrote:
> 
> 
>>symbol-completion in the search field?
> 
> 
> Symbol completion in an Apropos dialog?  Hmmm....

Useful when I am there trying to see if I have a package issue on a 
symbol name I am sure of.

> 
> 
>>That may be a feature, not a bug.
> 
> 
> Yes, I've heard that before, but from another company.  Have you been
> promoted to the marketing department for 2008?

Wow, I thought I straightened you out on that. Bad form, old boy, and 
the second time you have turned to a character attack when I was simply 
trying to suggest a nice beginner project for noobs and help them with 
apropos. You are so 2006!

I can see things will be ugly in Amsterdam. Can't wait.

> 
> 
>>AllegroCL has a dandy regex package
> 
> 
> Yeah, I've read about it.  It came a bit late, though... :)

I guess it was not all that hard to toss off.

> 
> 
>>They have not done so, and they continually refine their IDE in
>>response to user requests. Feel the walls closing in?
> 
> 
> Nope.  I know some of their users.

The users you know probably are not all that good.

> 
> 
>>How about a good use case for (+ regex apropos)?
> 
> 
> - "^with" instead of "with"
> - "focus.*p$"
> - "default.*type"
> - "(delete|remove)"
> - "^(make|create|new)-"
> 
> And so on...
> 

Ah, yes, I have wanted "starts with" to winnow the results, tho the 
alpha sort makes it easy enough to fake. Doubt I would like the OR 
thing, just makes for too many results, I'd rather do two searches.

Can you get to your apropos dialog from your GUI inspector?

   http://www.tilton-technology.com/cloucell.jpg

Or maybe you do not have a GUI inspector? I would suggest your friends 
show you the ACL inspector, but they probably do not know it has one.

kt

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

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Edi Weitz
Subject: Re: Happy New Year!
Date: 
Message-ID: <u63ycgsyo.fsf@agharta.de>
On Wed, 02 Jan 2008 08:13:15 -0500, Ken Tilton <···········@optonline.net> wrote:

> You are so 2006!

Yeah, my daughter also says that sometimes.  Have to think about it.

> I can see things will be ugly in Amsterdam. Can't wait.

Looking forward to that too.  And it's on neutral territory, kind of.

> I'd rather do two searches.

Hmm...

> Can you get to your apropos dialog from your GUI inspector?

Sure.  Although I'm wondering why I should.

> Or maybe you do not have a GUI inspector?

Ah, come one, this is getting a bit childish now... :)

Edi.

-- 

European Common Lisp Meeting, Amsterdam, April 19/20, 2008

  http://weitz.de/eclm2008/

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Tobias C. Rittweiler
Subject: Re: Happy New Year!
Date: 
Message-ID: <87hchw1lx2.fsf@freebits.de>
Edi Weitz <········@agharta.de> writes:

> Both tools listed above will also accept regular expressions as search
> strings (as does slime-apropos in SLIME IIRC).

Slime doesn't anymore. The rationale is that you can use the usual
`isearch-forward', `occur', &c. in the resulting buffer.

  -T.
From: Ken Tilton
Subject: Re: Happy New Year!
Date: 
Message-ID: <477a68dd$0$9118$607ed4bc@cv.net>
tim Josling wrote:
> On Tue, 01 Jan 2008 12:46:55 -0800, Jason wrote:
> 
> 
>>On Jan 1, 1:30 am, "John Thingstad" <·······@online.no> wrote:
>>
>>>På Tue, 01 Jan 2008 04:18:54 +0100, skrev Jason <·······@gmail.com>:
>>>
>>>
>>>>(defun geek-out (l)
>>>>      (let ((s nil))
>>>>      (loop for c in l
>>>>         do (setf s (concatenate 'string s (format nil "~a" (code-char
>>>>c)))))
>>>>      s))
>>>
>>>>(geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))
>>>
>>>>-Jason
>>>
>>>(coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78 101  
>>>119 32 89 101 97 114 33)) 'string)
>>>
>>>to you too!
>>>
>>>--------------
>>>John Thingstad
>>
>>OMFG. Why did nobody ever tell me about coerce before?
>>
>>Thank you!
>>
>>-Jason
> 
> 
> Wider question: how do you find these things?
> 
> For example, I saw in CLTL2 that #'int-char had been removed. So I thought
> there was no way to convert an int to a character. Little did I realise
> there is #'code-char.
> 
> Other examples: 
> 
> #'coerce (convert)
> #'remove-if-not (filter)
> Don't get me started on map*.
> 
> Is there a function somewhere 
> (s2l "Convert sensible name to lisp equivalent" ...)

apropos.

kt

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

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: ····················@googlemail.com
Subject: Re: Happy New Year!
Date: 
Message-ID: <084f5942-4d8d-4a23-86da-27677a718d8e@s12g2000prg.googlegroups.com>
On 1 Jan., 22:12, tim Josling <·············@westnet.com.au> wrote:
> On Tue, 01 Jan 2008 12:46:55 -0800, Jason wrote:
> > On Jan 1, 1:30 am, "John Thingstad" <·······@online.no> wrote:
> >> På Tue, 01 Jan 2008 04:18:54 +0100, skrev Jason <·······@gmail.com>:
>
> >> > (defun geek-out (l)
> >> >       (let ((s nil))
> >> >       (loop for c in l
> >> >          do (setf s (concatenate 'string s (format nil "~a" (code-char
> >> > c)))))
> >> >       s))
>
> >> > (geek-out '(72 97 112 112 121 32 78 101 119 32 89 101 97 114 33))
>
> >> > -Jason
>
> >> (coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78 101  
> >> 119 32 89 101 97 114 33)) 'string)
>
> >> to you too!
>
> >> --------------
> >> John Thingstad
>
> > OMFG. Why did nobody ever tell me about coerce before?
>
> > Thank you!
>
> > -Jason
>
> Wider question: how do you find these things?
>
> For example, I saw in CLTL2 that #'int-char had been removed. So I thought
> there was no way to convert an int to a character. Little did I realise
> there is #'code-char.
>
> Other examples:
>
> #'coerce (convert)
> #'remove-if-not (filter)
> Don't get me started on map*.
>
> Is there a function somewhere
> (s2l "Convert sensible name to lisp equivalent" ...)

Well, you can always use brute force:
(defun find-function (result &rest args)
  (labels ((permutations (bag)
             (if (null bag)
                 '(())
                 (mapcan #'(lambda (e)
                             (mapcar #'(lambda (p) (cons e p))
                                     (permutations (remove e
bag :count 1 :test #'eq))))
                         bag))))
    (let ((arg-combinations (remove-duplicates (permutations
args) :test #'equal)))
      (loop for symbol being the external-symbols in :cl
         do (when (and (fboundp symbol)
                       (not (macro-function symbol))
                       (not (special-operator-p symbol))
                       (not (find symbol '(abort break compile delete-
file describe documentation error eval inspect
                                           invoke-debugger invoke-
restart pprint prin1 princ print proclaim random
                                           read read-byte read-char
read-char-no-hang read-delimited-list read-line
                                           read-preserving-whitespace
return set-pprint-dispatch signal sleep warn
                                           write y-or-n-p yes-or-no-
p))))
              (dolist (arg-combination (copy-tree arg-
combinations))
                (multiple-value-bind (value error) (ignore-errors
(apply (symbol-function symbol) arg-combination))
                  (when (and (not error) (equal value result))
                    (format t "(~a~{ ~a~}) ==> ~a~%" symbol arg-
combination result)))))))))


Gives you:
CL-USER> (find-function #\d 100)
(CODE-CHAR 100) ==> d

It also works with multiple parameters:
CL-USER> (find-function '(2 4 9) '(1 2 3) '(2 2 3) #'*)
(MAPCAR #<FUNCTION *> (1 2 3) (2 2 3)) ==> (2 4 9)
(MAPCAR #<FUNCTION *> (2 2 3) (1 2 3)) ==> (2 4 9)

disclaimer: This is very dangerous and may destroy your data and eat
your children and so on.

-vl
From: John Thingstad
Subject: Re: Happy New Year!
Date: 
Message-ID: <op.t4cq83onut4oq5@pandora.alfanett.no>
P� Thu, 03 Jan 2008 10:31:45 +0100, skrev  
<····················@googlemail.com>:

> Well, you can always use brute force:
> (defun find-function (result &rest args)
>   (labels ((permutations (bag)
>              (if (null bag)
>                  '(())
>                  (mapcan #'(lambda (e)
>                              (mapcar #'(lambda (p) (cons e p))
>                                      (permutations (remove e
> bag :count 1 :test #'eq))))
>                          bag))))
>     (let ((arg-combinations (remove-duplicates (permutations
> args) :test #'equal)))
>       (loop for symbol being the external-symbols in :cl
>          do (when (and (fboundp symbol)
>                        (not (macro-function symbol))
>                        (not (special-operator-p symbol))
>                        (not (find symbol '(abort break compile delete-
> file describe documentation error eval inspect
>                                            invoke-debugger invoke-
> restart pprint prin1 princ print proclaim random
>                                            read read-byte read-char
> read-char-no-hang read-delimited-list read-line
>                                            read-preserving-whitespace
> return set-pprint-dispatch signal sleep warn
>                                            write y-or-n-p yes-or-no-
> p))))
>               (dolist (arg-combination (copy-tree arg-
> combinations))
>                 (multiple-value-bind (value error) (ignore-errors
> (apply (symbol-function symbol) arg-combination))
>                   (when (and (not error) (equal value result))
>                     (format t "(~a~{ ~a~}) ==> ~a~%" symbol arg-
> combination result)))))))))
>
>
> Gives you:
> CL-USER> (find-function #\d 100)
> (CODE-CHAR 100) ==> d
>
> It also works with multiple parameters:
> CL-USER> (find-function '(2 4 9) '(1 2 3) '(2 2 3) #'*)
> (MAPCAR #<FUNCTION *> (1 2 3) (2 2 3)) ==> (2 4 9)
> (MAPCAR #<FUNCTION *> (2 2 3) (1 2 3)) ==> (2 4 9)
>
> disclaimer: This is very dangerous and may destroy your data and eat
> your children and so on.
>
> -vl

That is just about the craziest thing I ever saw ;;->

You might want to add these to your avoid list
     delete-advice
     delete-package
     delete-directory
     delete-system
     dribble
     room
     setf
     ...

Also observe that copy-tree will not copy non cons elements so destructive  
operations (like nreverse) will destroy the test data.

(find-function "ROOM" "room")
returns "MOOR" :)

You need to make a function clone-tree that copies EVERYTHING.
Also is safer (saner) to make a list of functions to test and only test  
those...

--------------
John Thingstad
From: ····················@googlemail.com
Subject: Re: Happy New Year!
Date: 
Message-ID: <2a7e7271-ee44-4549-94f8-7815682aa78d@s8g2000prg.googlegroups.com>
On 3 Jan., 12:52, "John Thingstad" <·······@online.no> wrote:
> På Thu, 03 Jan 2008 10:31:45 +0100, skrev  
> <····················@googlemail.com>:
>
>
>
> > Well, you can always use brute force:
> > (defun find-function (result &rest args)
> >   (labels ((permutations (bag)
> >              (if (null bag)
> >                  '(())
> >                  (mapcan #'(lambda (e)
> >                              (mapcar #'(lambda (p) (cons e p))
> >                                      (permutations (remove e
> > bag :count 1 :test #'eq))))
> >                          bag))))
> >     (let ((arg-combinations (remove-duplicates (permutations
> > args) :test #'equal)))
> >       (loop for symbol being the external-symbols in :cl
> >          do (when (and (fboundp symbol)
> >                        (not (macro-function symbol))
> >                        (not (special-operator-p symbol))
> >                        (not (find symbol '(abort break compile delete-
> > file describe documentation error eval inspect
> >                                            invoke-debugger invoke-
> > restart pprint prin1 princ print proclaim random
> >                                            read read-byte read-char
> > read-char-no-hang read-delimited-list read-line
> >                                            read-preserving-whitespace
> > return set-pprint-dispatch signal sleep warn
> >                                            write y-or-n-p yes-or-no-
> > p))))
> >               (dolist (arg-combination (copy-tree arg-
> > combinations))
> >                 (multiple-value-bind (value error) (ignore-errors
> > (apply (symbol-function symbol) arg-combination))
> >                   (when (and (not error) (equal value result))
> >                     (format t "(~a~{ ~a~}) ==> ~a~%" symbol arg-
> > combination result)))))))))
>
> > Gives you:
> > CL-USER> (find-function #\d 100)
> > (CODE-CHAR 100) ==> d
>
> > It also works with multiple parameters:
> > CL-USER> (find-function '(2 4 9) '(1 2 3) '(2 2 3) #'*)
> > (MAPCAR #<FUNCTION *> (1 2 3) (2 2 3)) ==> (2 4 9)
> > (MAPCAR #<FUNCTION *> (2 2 3) (1 2 3)) ==> (2 4 9)
>
> > disclaimer: This is very dangerous and may destroy your data and eat
> > your children and so on.
>
> > -vl
>
> That is just about the craziest thing I ever saw ;;->
>
> You might want to add these to your avoid list
>      delete-advice
>      delete-package
>      delete-directory
>      delete-system
>      dribble
>      room
>      setf
>      ...
>
> Also observe that copy-tree will not copy non cons elements so destructive  
> operations (like nreverse) will destroy the test data.
>
> (find-function "ROOM" "room")
> returns "MOOR" :)
>
> You need to make a function clone-tree that copies EVERYTHING.
> Also is safer (saner) to make a list of functions to test and only test  
> those...
>
> --------------
> John Thingstad

I'm totally aware that this is completely crazy, but you know life is
short and life is dangerous. That's why I came up with this
"solution". A list with harmless functions probably would be the right
thing to do.

-vl
From: Harald Hanche-Olsen
Subject: Re: Happy New Year!
Date: 
Message-ID: <pcowsqtkxkv.fsf@shuttle.math.ntnu.no>
+ "John Thingstad" <·······@online.no>:

> (coerce (mapcar (lambda (c) (code-char c)) '(72 97 112 112 121 32 78
> 101  119 32 89 101 97 114 33)) 'string)

(map 'string #'code-char '(65 110 100 32 116 111 32 121 111 117 33)) ;->

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell
From: viper-2
Subject: Re: Happy New Year!
Date: 
Message-ID: <de47caf2-2bc6-48eb-b58b-0ee667678d14@l6g2000prm.googlegroups.com>
>
(defun pick-greeting (elems)
  #'(lambda ()
      (let ((randy (random (length elems))))
	  (nth randy elems))))
PICK-GREETING

>
(defun pair-greeting (l1 l2)
  #'(lambda ()
      (append (funcall (pick-greeting l1))
	    (funcall (pick-greeting l2)))))
PAIR-GREETING

>
(defun print-pairs (l1 l2)
  (format t "~%")
  (dotimes (count 50)
    (let ((randy (* 6 (random 10)))
	  (rand (nth (random 4) '(the cylons are fraktured!))))
      (format t "~%~va"
	     randy rand)
      (format t "~12T")
      (mapcar #'(lambda (x)
		  (format t "~a " x))
	      (funcall (pair-greeting l1 l2))))))
PRINT-PAIRS

>
(setf l1 '((happy) (celebrate) (best wishes for the)
	   (have a great) (rocking))
      l2 '((new year!) (2008!)))
((NEW YEAR!) (2008!))

>
(print-pairs l1 l2)

CYLONS                                          ROCKING 2008!
CYLONS                                    ROCKING 2008!
FRAKTURED!  HAPPY 2008!
ARE                           CELEBRATE NEW YEAR!
THE                     HAVE A GREAT 2008!
CYLONS                        BEST WISHES FOR THE NEW YEAR!
CYLONS      HAPPY NEW YEAR!
FRAKTURED!        BEST WISHES FOR THE 2008!
THE               CELEBRATE 2008!
FRAKTURED!                          BEST WISHES FOR THE NEW YEAR!
ARE                           BEST WISHES FOR THE 2008!
CYLONS            BEST WISHES FOR THE NEW YEAR!
ARE                           HAVE A GREAT 2008!
ARE                                                   CELEBRATE NEW
YEAR!
CYLONS                              HAPPY 2008!
THE                           CELEBRATE 2008!
FRAKTURED!  HAPPY NEW YEAR!
THE                                       HAVE A GREAT NEW YEAR!
THE                                 HAVE A GREAT 2008!
THE                     BEST WISHES FOR THE NEW YEAR!
THE                                       ROCKING NEW YEAR!
FRAKTURED!                    CELEBRATE NEW YEAR!
CYLONS                                                BEST WISHES FOR
THE NEW YEAR!
CYLONS      ROCKING NEW YEAR!
CYLONS                  HAVE A GREAT NEW YEAR!
FRAKTURED!              BEST WISHES FOR THE NEW YEAR!
FRAKTURED!                          HAPPY NEW YEAR!
CYLONS      HAVE A GREAT 2008!
THE               BEST WISHES FOR THE 2008!
CYLONS                  ROCKING 2008!
ARE                                             BEST WISHES FOR THE
2008!
THE                                 CELEBRATE 2008!
CYLONS      BEST WISHES FOR THE NEW YEAR!
CYLONS            CELEBRATE 2008!
CYLONS                                          BEST WISHES FOR THE
NEW YEAR!
THE                                 CELEBRATE 2008!
FRAKTURED!        CELEBRATE 2008!
ARE         HAPPY NEW YEAR!
CYLONS                                    CELEBRATE NEW YEAR!
FRAKTURED!                    HAPPY NEW YEAR!
THE         BEST WISHES FOR THE NEW YEAR!
THE                                       CELEBRATE NEW YEAR!
CYLONS                  HAVE A GREAT 2008!
THE                     ROCKING NEW YEAR!
CYLONS      BEST WISHES FOR THE NEW YEAR!
CYLONS      HAPPY 2008!
THE         HAVE A GREAT 2008!
THE                                 CELEBRATE NEW YEAR!
CYLONS      CELEBRATE 2008!
FRAKTURED!  ROCKING 2008!
NIL



A hodge-podge inspired by some old exercises from Profesor Keith
Downing of Norwegian University of Science and Technology (NTNU)

http://www.idi.ntnu.no/~keithd/iweb/Site/Homepage.html

agt
From: viper-2
Subject: Re: Happy New Year!
Date: 
Message-ID: <72dafbc2-3c98-4345-9c2c-4c523234e832@s19g2000prg.googlegroups.com>
On Jan 1, 10:58 pm, viper-2 <········@mail.infochan.com> wrote:

...

> A hodge-podge inspired by some old exercises from Profesor Keith
> Downing of Norwegian University of Science and Technology (NTNU)
>
> http://www.idi.ntnu.no/~keithd/iweb/Site/Homepage.html

I omitted to mention that my hodge-podge was also inspired by Carl's
New Year greeting:

http://groups.google.com/group/comp.lang.lisp/msg/c1fef00e6aead52d

Happy New Year - again!!

agt