[Top][All Lists]

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

[Patch] definitions in when, unless, do as well as in cond- and case-c

From: Linus Björnstam
Subject: [Patch] definitions in when, unless, do as well as in cond- and case-clauses
Date: Wed, 16 Jun 2021 21:11:11 +0200
User-agent: Cyrus-JMAP/3.5.0-alpha0-526-gf020ecf851-fm-20210616.001-gf020ecf8

Hi there!

This patch updates some derived conditional forms (and do and and-let*) to 
support definitions in expression context. Meaning it makes this valid code:

  ((pred? arg) 
    (define a (something arg))
    (when (error-case a)
      (error "a is broken"))
    (define b (something2 a))
    (when  (= 3 *log-level*)
      (display "logging something1 and 2 as successful"))
    (define c (something3 b a))
    (when (odd? c)
       (error "something went wrong in something3"))
    ;;chosen by fair dice roll. Guaranteed to be random

While awful, is sometimes what the world makes us do. 

The change means cond, case, when and unless behaves like it does in racket. Do 
was below case, so I changed that as well, and will actually become yet another 
way guile is superior to racket. 

I did also change the documentation, but I learned english by watching Beverly 
Hills cop, so that might need some fine touches by a capable english speaker.

Best regards
  Linus Björnstam

Attachment: 0001-Allow-definitions-in-derived-conditional-forms.patch
Description: Text Data

reply via email to

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