unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: Scheme+ for Guile v8.1
Date: Wed, 10 Apr 2024 10:28:41 +0200	[thread overview]
Message-ID: <CADEOadfZHqfrofhd_V2+hFNHxfLq3GDr=WzyJ1Qn3pLWs_gwfg@mail.gmail.com> (raw)

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


                 reply	other threads:[~2024-04-10  8:28 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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to='CADEOadfZHqfrofhd_V2+hFNHxfLq3GDr=WzyJ1Qn3pLWs_gwfg@mail.gmail.com' \
    --to=damien.mattei@gmail.com \
    --cc=guile-user@gnu.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).