[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Scheme+ for Guile v8.1
From: |
Damien Mattei |
Subject: |
Scheme+ for Guile v8.1 |
Date: |
Wed, 10 Apr 2024 10:28:41 +0200 |
Hello,
i released a new minor version of Scheme+ for Guile v8.1:
https://github.com/damien-mattei/Scheme-PLUS-for-Guile/releases/tag/v8.1
some new features are:
new 'if then else' compatible with scheme 'if':
;; > (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)
example:
;; a tail recursive version(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)} ; unify
neighbours minterms sets
(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
;; this procedure returns a set of unified minterms of the
current level and
;; and when there is no more minterms set to unify this
procedure returns '() and perheaps
;; sort of '(()) or '(() () ...)
available on Github:
https://github.com/damien-mattei/Scheme-PLUS-for-Guile
Damien
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Scheme+ for Guile v8.1,
Damien Mattei <=