From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: return macro Date: Mon, 28 Jun 2021 01:10:29 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11951"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Jun 28 01:10:57 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxdvU-000317-W4 for guile-user@m.gmane-mx.org; Mon, 28 Jun 2021 01:10:56 +0200 Original-Received: from localhost ([::1]:51198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxdvT-0005ys-Uj for guile-user@m.gmane-mx.org; Sun, 27 Jun 2021 19:10:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxdvI-0005yW-R3 for guile-user@gnu.org; Sun, 27 Jun 2021 19:10:44 -0400 Original-Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:42761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxdvG-0004fc-Qs for guile-user@gnu.org; Sun, 27 Jun 2021 19:10:44 -0400 Original-Received: by mail-il1-x136.google.com with SMTP id h3so15667777ilc.9 for ; Sun, 27 Jun 2021 16:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=RVekYPna8By117ayO3BXuyI3Mw9wJ1/oQ8plxCYZ/xk=; b=cHU009hNY9ojFM8ZLk1pBf5P3+4gH5/zbn59RcCRPUP6V4DruOarvckIRQBbj/oA7/ oVtI3FzPHDWV1YnRpAxSAQvPOoMFEqhs9rPNYTJzOAK/cI8UXi9HQw2nq0/OWuXGuKZB LZxxmvQ96DVtZLZPES6BjogUS6Z8q4XKy0YEzKz0fpZTGfiwFT9xKc75OaKI5qwhxZhK u91vXw0aOJD29CLaV1YHWYxJeqwKZFCd6qxMLFcE6lvV0f9INj5oZy8BJ/vsmvu7YNwo BLdFvxiNnUdFaiayLyzheDGR86NpcWE3JSKx/UDQrdZ7wTcfrwe+aj3oNagaZkOwkpb8 8+cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=RVekYPna8By117ayO3BXuyI3Mw9wJ1/oQ8plxCYZ/xk=; b=qL/yYvCCJRDfKZCDPjxlRJQif/3ACKGxUN0j91egkRe1YPesBXuDGvr9+Lc3iO+ToC QxvanEtIq6fq8rE1NXzd5KiJp2fGfbdQFpBIxvGys9I6H+yunaTwyNlHikJutzSRhEDv V6lmAqODY33eDRaC9uo+y+YjKXL1Z3QzNw8B+OhuY7+EI4hFVBqcnqKK6Zy5h66NtcKW Lya7QmpKK/kiFjF8KGDQmcFuVSADPiS/fBB4hGhm3dEXA5nDs8FoDUHXjGHsysI7if5i I8JVQ9jLwRyjoppyOBJYpSpZL4c8chEgtaRjOPvGYV7GB4goYZhXScHanqs0IDcZIX5k HxmA== X-Gm-Message-State: AOAM531sFP72UduuMnksK6euHsKG7k6pKCxMxe+rc/BaoYYIwXHfTzdw 1pnCTr2Dbt8cOle3m3OFeO8HlgJm+Ff3tLSpYl47B7WUWrX36g== X-Google-Smtp-Source: ABdhPJwHcNUcY+xJVQlwI6mB+Ke+JBLPOB4rcT3DfGH7GUYS6sq919ZMfzS3gtkcKV4Wo1wqx73rSTGukr879AoMXOM= X-Received: by 2002:a92:d483:: with SMTP id p3mr4177039ilg.113.1624835440583; Sun, 27 Jun 2021 16:10:40 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::136; envelope-from=damien.mattei@gmail.com; helo=mail-il1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17620 Archived-At: hi, i wanted to create a macro that is used like a function definition and allow return using call/cc: (define-syntax def (syntax-rules (return) ((_ (name args ...) body body* ...) (define name (lambda (args ...) (call/cc (lambda (return) body body* ...))))) ((_ name expr) (define name expr)))) unfortunaly i got error: scheme@(guile-user)> (def (test x) (cond ((= x 3) 7) ((= x 2) (return 5)) (else 3))) ;;; :2:42: warning: possibly unbound variable `return' scheme@(guile-user)> (test 2) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Unbound variable: return any idea? Damien