Re: case source code

2022-09-13 Thread Damien Mattei
thanks, if just replaced the 'begin by 'let () to allow internal
definitions but i haven't test it yet (finally no need in my code of define
internal at this point)
regards,
Damien

On Mon, Sep 12, 2022 at 10:47 AM Taylan Kammer 
wrote:

> On 12.09.2022 09:42, Damien Mattei wrote:
> >
> > Hello,
> > i can not find in the scheme community a definition of 'case in term of
> macro as for when, unless,while,do... does anyone have it?
> > thanks,
> > Damien
>
> The RnRS often contain such definitions.  The following is taken from
> R7RS-small:
>
> (define-syntax case
>   (syntax-rules (else =>)
> ((case (key ...) clauses ...)
>  (let ((atom-key (key ...)))
>(case atom-key clauses ...)))
> ((case key (else => result))
>  (result key))
> ((case key
>(else result1 result2 ...))
>  (begin result1 result2 ...))
> ((case key
>((atoms ...) result1 result2 ...))
>  (if (memv key ’(atoms ...))
>  (begin result1 result2 ...)))
> ((case key
>((atoms ...) => result))
>  (if (memv key ’(atoms ...))
>  (result key)))
> ((case key
>((atoms ...) => result)
>clause clauses ...)
>  (if (memv key ’(atoms ...))
>  (result key)
>  (case key clause clauses ...)))
> ((case key
>((atoms ...) result1 result2 ...)
>clause clauses ...)
>  (if (memv key ’(atoms ...))
>  (begin result1 result2 ...)
>  (case key clause clauses ...
>
> --
> Taylan
>
>


Re: macro definition for continue and break

2022-09-13 Thread Damien Mattei
interesting , i was just intending to have syntax and features a bit like C
in fact.Your syntax goes beyond, Racket for too, i do not know Chibli
scheme.
Regards,
Damien

On Mon, Sep 12, 2022 at 9:20 PM Linus Björnstam 
wrote:

> If you want a bit more advanced looping you could have a look at my
> goof-loop: https://git.sr.ht/~bjoli/goof-loop
>
> It currently does not support a break or continue clause, but adding one
> should not really be a problem.
>
> A good thing is that it does not rely on mutation for anything except
> higher order sequences, meaning it does not lead to the implicit boxing
> overhead of set!, which is a good idea in loops since that quickly adds up.
>
> Best regards
>   Linus Björnstam
>
> On Sun, 4 Sep 2022, at 13:13, Jean Abou Samra wrote:
> > Hi,
> >
> > Adding back the list in CC.
> >
> >
> > Le 04/09/2022 à 12:49, Damien Mattei a écrit :
> >> hello jean,
> >> yes (thank you for your help) i'm a sorcerer's apprentice that always
> >> push to later the understanding of literals in syntax-rules, but by
> >> instinct i finally succeed in making works the weird thing :-) , here
> >> is my macro definition now for a for with break and continue:
> >>
> >> (define-syntax for
> >>
> >>   (lambda (stx)
> >> (syntax-case stx ()
> >>   ((kwd (init test incrmt) body ...)
> >>
> >>(with-syntax
> >> ((BREAK (datum->syntax #'kwd 'break))
> >>  (CONTINUE (datum->syntax #'kwd 'continue)))
> >>
> >>#`(call/cc
> >> (lambda (escape)
> >> (let-syntax
> >>  ((BREAK (identifier-syntax (escape
> >>   init
> >>  (let loop ()
> >> (when test
> >>
> >>#,#'(call/cc
> >> (lambda (next)
> >>(let-syntax
> >> ((CONTINUE
> >> (identifier-syntax (next
> >>body ...)))
> >>
> >> incrmt
> >> (loop)))
> >>
> >> note the mysterious #,#' that save the day ;-)
> >
> >
> > For me, it works without it… ?
> >
> >
> >> and a few examples (in Scheme+)
> >>
> >> ;; scheme@(guile-user)> (for ({i <+ 0} {i < 5} {i <- {i + 1}}) {x <+
> >> 7} (display x) (newline) (break))
> >> ;; 7
> >> ;; scheme@(guile-user)> (for ({i <+ 0} {i < 5} {i <- {i + 1}}) {x <+
> >> 7} (continue) (display x) (newline) (break))
> >> ;; scheme@(guile-user)>
> >>
> >> ;; (for ({k <+ 0} {k < 3} {k <- {k + 1}})
> >> ;;  (display k)
> >> ;;  (newline)
> >> ;;  (for ({i <+ 0} {i < 5} {i <- {i + 1}}) {x <+ 7}
> >> ;;(display x)
> >> ;;(newline)
> >> ;;(break))
> >> ;;  (newline))
> >>
> >> ;; 0
> >> ;; 7
> >>
> >> ;; 1
> >> ;; 7
> >>
> >> ;; 2
> >> ;; 7
> >>
> >> ;; (for ({k <+ 0} {k < 3} {k <- {k + 1}})
> >> ;;  (display k)
> >> ;;  (newline)
> >> ;;  (continue)
> >> ;;  (for ({i <+ 0} {i < 5} {i <- {i + 1}}) {x <+ 7}
> >> ;; (display x)
> >> ;; (newline)
> >> ;; (break))
> >> ;; (newline))
> >>
> >> ;; 0
> >> ;; 1
> >> ;; 2
> >>
> >>
> https://github.com/damien-mattei/library-FunctProg/blob/master/for-next-step.scm
> >>
> >> it also works with imbricated loops in a natural way (but other
> >> interpretation and implementation could be  done , C act like this ,i
> >> think)
> >> but if it could be coded better i will use a better version
> >
> >
> > Yes, it can be done better; see my reply on the other thread.
> >
> >
> > Best,
> > Jean
>


Re: Loop macros (was: Re: macro definition for continue and break)

2022-09-13 Thread Damien Mattei
do you have any examples of use? that illustrate the features ,just with
the code it is not easy.
Regards,
Damien

On Mon, Sep 12, 2022 at 10:57 PM Maxime Devos 
wrote:

>
>
> On 12-09-2022 21:19, Linus Björnstam wrote:
> > If you want a bit more advanced looping you could have a look at my
> goof-loop: https://git.sr.ht/~bjoli/goof-loop
> >
> > It currently does not support a break or continue clause, but adding one
> should not really be a problem.
> >
> > A good thing is that it does not rely on mutation for anything except
> higher order sequences, meaning it does not lead to the implicit boxing
> overhead of set!, which is a good idea in loops since that quickly adds up.
> >
> > Best regards
> >Linus Björnstam
>
> I also have a mutation-free loop macro, named 'hat-let' or 'let^':
>
> https://git.gnunet.org/gnunet-scheme.git/tree/gnu/gnunet/utils/hat-let.scm
>
> Its origin is rather different though, goof-loop appears to be the
> result of combining various loop-related constructs, plus some extras,
> whereas let^ is the result of combining various binding constructs
> (including the 'let loop'), plus some extras.
>
> It combines the following: let*, lambda / define, receive, 'let loop',
> 'if', 'begin'.
>
> Doesn't do any accumulation though.
>
> Greetings,
> Maxime.
>


Re: Loop macros (was: Re: macro definition for continue and break)

2022-09-13 Thread Maxime Devos



On 13-09-2022 16:25, Damien Mattei wrote:
do you have any examples of use? that illustrate the features ,just with 
the code it is not easy.


"git grep -F let^" inside the repo.  More specifically, parse-expandable 
from (gnu gnunet config parser), though there are other uses too.


OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


[ANN] Guile-SSH 0.16.0 released

2022-09-13 Thread Artyom V. Poptsov
Hello Guilers!

I'm pleased to announce Guile-SSH 0.16.0:
  https://github.com/artyom-poptsov/guile-ssh/releases/tag/v0.16.0

As usual, this release tag is signed with my GPG key[1].

This release contains a new SFTP directory traversal API and some small
bugfixes.  See the full list of user visible changes below.

Guile-SSH 0.16.0 API should be backward-compatible with Guile-SSH
0.15.1, but not vice-versa.

Also now you can read the Guile-SSH documentation online here:
  

Or here (through the Yggdrasil[2] network):
  


Please note that:

  1. The Yggdrasil access is experimental and there's no guarantees; the
 actual Yggdrasil IPv6 address can be found on the main page of the
 site: 

  2. The site itself is self-hosted so sometimes it is a bit flacky.


* What is Guile-SSH?

Guile-SSH is a library that provides access to the SSH protocol[3] for
programs written in GNU Guile interpreter.  It is built upon the
libssh[4] library.

Currently Guile-SSH provides the following features:
  - The API that is sufficient for building of standalone SSH clients and
servers, or for embedding client/server functionality in your lispy Scheme
applications.
  - Several authentication methods are supported, including password
authentication, public key and SSH agent authentication methods.
  - Key management procedures: you can make key pairs, read keys from files,
get key hashes, get public keys from private keys etc.  DSS, RSA, RSA1 and
ECDSA (by means of OpenSSL) are supported.
  - Port forwarding procedures and high-level API for creating of SSH tunnels.
  - Distributed forms ('dist-map', 'distribute', ...) that allow to spread the
evaluation of Scheme code between remote hosts.  Or you can just connect
to a remote REPL from Scheme using 'with-ssh' procedure and evaluate some
expressions.  No special server needed on the remote side, just an SSH
daemon and GNU Guile installed!
  - SFTP client API allows you to read and write remote files, or do directory
traversal over the SSH protocol right from the Scheme code.
  - Remote popen API that allows you to make either input, output or
bidirectional pipes to remote processes.
  - Detailed documentation in Texinfo format with examples included, even more
examples in 'examples' directory.
  - Procedures for interaction with SSH agents.


* The list of user-visible changes

Here's the list of user-visible changes (an excerpt from NEWS file):

--8<---cut here---start->8---
* Changes in version 0.16.0 (2022-09-13)
** Fix Guile snarfer environment
Fix a bug introduced in Guile-SSH 0.15.0 that breaks the cross-compilation.

Reported by Ludovic Courtes  here:

** New API: SFTP Directory
Guile-SSH now allows directory traversal by means of the new procedures in the
(ssh sftp) module.
** Update the documentation.
--8<---cut here---end--->8---


Many thanks to all the people who helped me with bug reports, pull
requests and other hints.  I added all contributors to "AUTHORS" and
"THANKS" files -- please let me know if I forgot to thank someone or
if there any typos.

- Artyom


References:
1. https://pgp.mit.edu/pks/lookup?search=0x0898A02F&op=index
2. https://yggdrasil-network.github.io/
3. https://en.wikipedia.org/wiki/Secure_Shell
4. https://www.libssh.org/

-- 
Artyom "avp" Poptsov 
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F


signature.asc
Description: PGP signature