public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: kawa mailing list <kawa@sourceware.org>
Subject: Scheme+ v8.1
Date: Tue, 9 Apr 2024 12:52:34 +0200	[thread overview]
Message-ID: <CADEOadc-zDsphjVM5Pm9s9U3ZJHA9GW1RwUJ5TS29wuJwQ+xHQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1939 bytes --]

hello,

i released a minor update of Scheme+:

https://github.com/damien-mattei/Scheme-PLUS-for-Kawa

mainly add a nex 'if then else' syntax compatible with scheme

examples:

;; > (if #f else 3)
;; 3
;; > (if #t else 3)
;; > (if #t 2 else 3)
;; 2
;; > (if #t then 2 else 3)
;; 2
;; > (if #f then 2 else 3)
;; 3
;; > (if #f then 1 2 else 3 4)
;; 4
;; > (if #t then 1 2 else 3 4)
;; 2
;; > (if #t 1 2 3)
;; 3
;; > (if #t then 1 2 else 3 4 then 5)
;; . . SRFI-105.rkt:181:17: if: then after else near : '(then 5)
;; > (if #t then 1 2 else 3 4 else 5)
;; . . SRFI-105.rkt:181:17: if: 2 else inside near: '(else 5)
;; > (if #t else 1 2 then 3 4)
;; . . SRFI-105.rkt:181:17: if: then after else near : '(then 3 4)
;; > (if #t then 1 2 then 3 4)
;; . . SRFI-105.rkt:181:17: if: 2 then inside near: '(then 3 4)

(define (funct-unify-minterms-set-of-sets-rec-tail sos acc) ;; with
accumulator

  (if (singleton-set? sos) then

      ;; singleton
      (reverse acc)

   else

         ;; at least 2 elements in set of sets
         {mt-set1 <+ (car sos)} ;; minterm set 1
{mt-set2 <+ (cadr sos)} ;; minterm set 2
{mt-set2-to-mt-setn <+ (cdr sos)} ;; minterm sets 2 to n
{weight-mt-set1 <+ (floor-bin-minterm-weight (car mt-set1))} ;; in a set
all minterms have same weight
{weight-mt-set2 <+ (floor-bin-minterm-weight (car mt-set2))}
{delta-weight <+ {weight-mt-set2 - weight-mt-set1}}

(if {delta-weight = 1} then ;; if minterms set are neighbours

    {unified-mt-set1-and-mt-set2 <+
 (funct-unify-minterms-set-1-unit-future mt-set1 mt-set2)}

    (if (null? unified-mt-set1-and-mt-set2)
(funct-unify-minterms-set-of-sets-rec-tail mt-set2-to-mt-setn acc) ;; the
result will be the continuation with sets from 2 to n
(funct-unify-minterms-set-of-sets-rec-tail mt-set2-to-mt-setn (insert
unified-mt-set1-and-mt-set2 acc))) ;; end &
 else

    (funct-unify-minterms-set-of-sets-rec-tail mt-set2-to-mt-setn acc))))
;; continue with sets from 2 to n

                 reply	other threads:[~2024-04-09 10:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADEOadc-zDsphjVM5Pm9s9U3ZJHA9GW1RwUJ5TS29wuJwQ+xHQ@mail.gmail.com \
    --to=damien.mattei@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).