public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Scheme+ v8.1
@ 2024-04-09 10:52 Damien Mattei
  0 siblings, 0 replies; only message in thread
From: Damien Mattei @ 2024-04-09 10:52 UTC (permalink / raw)
  To: kawa mailing list

[-- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-09 10:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 10:52 Scheme+ v8.1 Damien Mattei

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