[Top][All Lists]

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

Re: problems with the docs

From: Andy Wingo
Subject: Re: problems with the docs
Date: Mon, 11 Oct 2010 23:21:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)


On Mon 11 Oct 2010 00:40, address@hidden writes:

> i'm trying to learn about scheme/guile-2.0 and the language module. but
> the given compilers use some constructs i don't understand and can't
> find explanation to. for example, i can't find explanation to pmatch or
> emit. these procedures are also not listed in the procedure index.

The manual aims to explain the interfaces that Guile offers to the
programmer. It would be much longer if it explained everything about
the implementation itself :) So many things you will find, you will have
to puzzle out yourself, or otherwise ask.

In this case, pmatch is a pattern matcher. Instead of writing:

(lambda (x)
  (if (and (pair? x) (eq? (car x) 'foo))
      (let ((bar (cdr x)))
        (* 2 bar))))

you can write

(lambda (x)
  (pmatch x
    ((foo . ,bar)
     (* 2 bar))))

`Emit' is a local variable in the compiler.

Have fun with Guile,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]