[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some doubts

Paulo J. Matos wrote:

> 1 - In Common Lisp when I need to search for a function
> specification or a function that does something I go to
> the Hyperspec, what should I do when I have the same problem with
> Scheme?

You should consult Help | Help Desk, which offers a search engine at
the bottom of the window.

> 2 - How can I remove (without consing, i.e. destructively) an
> element from a list?

The default REMOVE/REMV/... procedures built into PLT Scheme seem to
be non-destructive, so I guess you're going to have to write this
yourself.  Use SET-CDR! (the equivalent of RPLACD).

> 2.1 - Following the question above I should probably pass a
>   function to the remove function above (called delete in CL)
>   telling it how to compare the objects (maybe eq? by default in
>   Scheme). How can I pass that optional parameter...
> I do know that rest parameters are:
> (define foo (arg1 arg2 . restargs)
>         null)
> But how about optional and key parameters?

Search for OPT-LAMBDA.

> 3 - How can I print a hash-table for example in a different way
> than its default way defined by implementation? (without defining
> a function to do it explicitly... I would like to overload
> something as a print-object method or something...)

Unlike CL, PLT Scheme doesn't provide this kind of facility as a
primitive.  You can hook into the pretty-printer ... for instance, you 
can set a new PRETTY-PRINT-HANDLER that chains to the old one for all
values other than the new one you want to handle explicitly.