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

Re: Some doubts



Quoting Paulo J. Matos:
> But how about optional and key parameters?

In v200, the "etc.ss" library defines `opt-lambda':

 (require (lib "etc.ss"))
 (define f
   (opt-lambda (a [b 10])
     (+ a b)))
 (f 2) ; => 12
 (f 2 3) ; => 5

In v103, I think `opt-lambda' was in "macro.ss" --- but use v200,
instead.

> 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...)

Currently, there's no way to do this with MzScheme's built-in printer.
However, if you use `pretty-print, then you can set
`pretty-print-size-hook' and `pretty-print-print-hook'. You can also
hook pretty-print into MzScheme in various ways (e.g., `current-print',
`port-write-handler').

Search in Help Desk for more information.

Matthew