[WIP PATCH] (for fibers): wait-until-port-readable-operation / wait-until-port-writable-operation

2021-02-14 Thread Maxime Devos
complete wingo's proposal). Wild guess: maybe schedule-task-when-fd-writable prevents the fiber from being resumed by other causes? Greetings, Maxime. From b8ac732543661b5ee7e2f38482f824b638664bd2 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Sun, 14 Feb 2021 17:04:02 +0100 Subject: [PATCH]

[PATCH] fibers: operations for waiting until port is readable / writable

2021-03-14 Thread Maxime Devos
Hi guilers! This is a patch to guile-fibers that adds a ‘wait-until-port-readable-operation’ and ‘wait-until-port-writable-operation’ that can be used to wait until a port (backed by a fd) becomes readable or writabble respectively. These operations can be used in combination with e.g. get-operat

Moving char-set->arbitrary into quickcheck proper?

2021-03-25 Thread Maxime Devos
Hi, Could the following procure from tests/kinds/octal.scm in disarchive ... (define (char-set->arbitrary cs) (arbitrary (gen (choose-char cs)) (xform (lambda (chr gen) (generator-variant (char->integer chr) gen) ... be moved to guile-quickcheck? (quickcheck arbitrary)

Exception handler installed when handling a continuable exception

2021-08-25 Thread Maxime Devos
Hi, This also happens without #:continuable?. Here's a simpler test case: (with-exception-handler (lambda (exn) (catch #t (lambda () (error "to be caught")) (lambda e (pk 'caught! e (lambda () (error "oops"))) ---> In procedure raise-exceptiont: to be caught I don't know

Scheme-GNUnet 0.1 released

2021-09-17 Thread Maxime Devos
I'm pleased to announe the first release of Scheme-GNUnet. * What is Scheme-GNUnet? Scheme-GNUnet is a work-in-progress (Guile) Scheme port of the GNUnet client libraries. Unlike gnunet-guile, it is not a binding for the C libraries. It can be used in multi-threaded applications, e.g. with guil

Re: #:printer filed in language specification.

2021-09-18 Thread Maxime Devos
Justin Veilleux schreef op vr 17-09-2021 om 18:50 [-0400]: > It works relatively well. However, I also wanted it to print a human > readable version of the procedures created. (It is hard to tell whether > # is a correct church encoding of the number 3) > With a lot of fiddling, I managed to wri

Re: Fwd: new function

2021-09-19 Thread Maxime Devos
Damien Mattei schreef op zo 19-09-2021 om 11:18 [+0200]: > -- Forwarded message - > From: Damien Mattei > Date: Sun, Sep 19, 2021 at 9:54 AM > Subject: new function > To: > > > hello, > i'm developing an extension to Scheme > and i need a procedure or macro that define a variabl

Re: #:printer filed in language specification.

2021-09-19 Thread Maxime Devos
Zelphir Kaltstahl schreef op zo 19-09-2021 om 12:11 [+]: > Hi Maxim! > > Do you know of any simple example anywhere for applicable structs? I might > have > another use for them. From NEWS in the Guile source code: ** Applicable struct support One may now make structs from Scheme that

Re: Fwd: new function

2021-09-19 Thread Maxime Devos
Matt Wette schreef op zo 19-09-2021 om 07:45 [-0700]: > On 9/19/21 3:38 AM, Maxime Devos wrote: > > [...] > > (use-modules (system syntax)) > > (define-syntax define-or-set! > >(lambda (s) > > (syntax-case s () > >((_ var value) > &

Re: foreign objects and the garbage collector

2021-09-19 Thread Maxime Devos
Olivier Dion via General Guile related discussions schreef op zo 19-09-2021 om 14:11 [-0400]: > On Sun, 19 Sep 2021, adriano wrote: > > > If you want to avoid the problem, you should explicitely bind and > > > call the gps-close function and not rely on the garbage collector to > > > do it for yo

Re: foreign objects and the garbage collector

2021-09-21 Thread Maxime Devos
adriano schreef op di 21-09-2021 om 16:26 [+0200]: > > [...] > Well, it'd be wonderful to have an example of what you're describing > here ! 🙂️ > > The new exceptions system is still quite obscure 🤷️ Ignoring with-throw-handler, raise-continuable and pre-unwind handlers, it's the same mechanism

Re: Fwd: new function

2021-09-21 Thread Maxime Devos
Damien Mattei schreef op di 21-09-2021 om 15:04 [+0200]: > i have tested define-once > http://www.gnu.org/software/guile/docs/master/guile.html/Top-Level.html > (the defvar of Lisp)and idea are: > -unfortunately it is considered by scheme as a define,so there is some > context where it is not allow

Re: Fwd: new function

2021-09-22 Thread Maxime Devos
Damien Mattei schreef op wo 22-09-2021 om 09:52 [+0200]: > i do not understand well what you want to mean with those example. > For me define-once does not seems to be a solution, it act as define too > much > ,does not set! variable if already exist and can not use to set it again > because, >

Re: Double-precision floating point arithmetics behaves differently in Guile and in C

2021-10-16 Thread Maxime Devos
Panicz Maciej Godek schreef op ma 27-09-2021 om 16:04 [+0200]: > niedz., 26 wrz 2021 o 21:11 Matt Wette > napisał(a): > > > Your post is a little vague.  Are you comparing singular values > > vectors > > of A vs > > eigenvalues, eigenvectors of A'*A ?  Also, SVD is iterative and > > different alg

Re: Is it possible to expand syntax inside match?

2021-10-24 Thread Maxime Devos
Михаил Бахтерев schreef op zo 24-10-2021 om 11:49 [+0500]: > Greetings! > > I wondering, if is it possible to implement something like > this? > > (define-syntax R (syntax-rules () ((_ r v l) #(red r v l > (define-syntax B (syntax-rules () ((_ r v l) #(black r v l > > (define red-black-s

Re: SRFI 106 "basic socket interface" in Guile

2021-10-24 Thread Maxime Devos
Tim Lee schreef op ma 25-10-2021 om 02:59 [+]: > I noticed that Guile does not implement SRFI 106 (basic socket > interface) > (https://srfi.schemers.org/srfi-106/srfi-106.html). Is there a > fundamental reason for the omission? I'm just wondering whether or > not > Guile has all the socket pri

Re: How to capture pid of (system process?

2021-12-14 Thread Maxime Devos
Jacob Hrbek schreef op ma 13-12-2021 om 21:01 [+]: > I wrote this potato-make > definition (was simplified): > > #:SRC_BEGIN sheme-mode > #!/usr/bin/env sh > exec guile -s "$0" "$@" > !# > > (use-modules (ice-9 futures) >   (potato make)) > (initialize

Re: How to capture pid of (system process?

2021-12-16 Thread Maxime Devos
Jacob Hrbek schreef op vr 17-12-2021 om 01:32 [+]: > Can you elaborate? (I am a noob in guile atm) These procedures are documented in the manual of Guile, you could look in the source code of Shepherd and Guix for examples. Most of these procedures are based on POSIX functions, so you could lo

Re: Can guile be implementation independent?

2021-12-17 Thread Maxime Devos
Jacob Hrbek schreef op vr 17-12-2021 om 01:42 [+]: > I am used to working with common lisp where i can write code that is > "implementation independent" meaning that following a specific coding > style makes it compatible across multiple interpretators/compilers > (sbcl, LispWorks, etc..) > >

Re: Scheme+

2021-12-20 Thread Maxime Devos
Linus Björnstam schreef op ma 20-12-2021 om 09:15 [+0100]: > I played around with it and it seems to rely heavily on mutation, > which makes guile (and chez and racket for that matter) box the > values. That adds a layer of indirection to memory access, meaning > slower code (apart from the more ob

Re: Need help embedding Guile

2021-12-21 Thread Maxime Devos
Dimitris Papavasiliou schreef op di 21-12-2021 om 11:12 [+]: > [1...] > . The manual is not very specific about how and when finalizers are > run.  The >    approach above seems to correctly finalize all objects created as > the Scheme >    code executes, but if references are kept, say via (d

Re: Need help embedding Guile

2021-12-21 Thread Maxime Devos
Hi, Maxime Devos schreef op di 21-12-2021 om 11:37 [+]: > >    approach above seems to correctly finalize all objects created > > as > > the Scheme > >    code executes, but if references are kept, say via (define), > > they > > are not > >    final

Re: Need help embedding Guile

2021-12-21 Thread Maxime Devos
Maxime Devos schreef op di 21-12-2021 om 11:37 [+]: > About finalizers: No. From the BDW-GC faq: [...] I misread your question; this answer doesn't apply exactly to your question. However, there still are no formal guaranteed BDW-GC will collect everything. Greetings, Maxime

Re: Need help embedding Guile

2021-12-22 Thread Maxime Devos
Olivier Dion schreef op wo 22-12-2021 om 09:46 [-0500]: > From `eval-in-sandbox` documentation: > >  If SEVER-MODULE? is true (the default), the module will be unlinked >  from the global module tree after the evaluation returns, to allow MOD >  to be garbage-collected. > > So I _think_ you're gu

Re: Need help embedding Guile

2021-12-22 Thread Maxime Devos
Hi, Dimitris Papavasiliou schreef op wo 22-12-2021 om 11:41 [+]: > Creating the complete graph before evaluation begins in the second > phase is probably not necessary (nodes could be evaluated as they're > created), but it creates the opportunity for certain optimizations > (like dead code el

Re: Guile alternative to GCODE?

2021-12-28 Thread Maxime Devos
Hi, Jacob Hrbek schreef op di 28-12-2021 om 09:21 [+]: > e.g. https://tplang.org in Javascript Guile supports both Scheme and ECMAScript, so it should be possible to write Scheme bindings to tplang. Guile doesn't support all of ECMAScript though. Greetings, Maxime signature.asc Description

Re: Idiomatic Guile for semigroup/monoid/group?

2022-01-02 Thread Maxime Devos
Stuart Hungerford schreef op zo 02-01-2022 om 10:45 [+1100]: > In Haskell/Idris/Purescript/Swift/Rust I'd be looking to > typeclasses/protocols or traits to model a semigroup, monoid or group. > In OOP languages I'd be looking to some kind of abstract base class to > model each structure. > > What

Re: Idiomatic Guile for semigroup/monoid/group?

2022-01-03 Thread Maxime Devos
Stuart Hungerford schreef op ma 03-01-2022 om 10:46 [+1100]: > Just out of interest, are there other multimethod/ad-hoc polymorphism > approaches for Guile? I only know of GOOPS and Theme-D -- Guix also has a ‘define-gexp-compiler’ but it's very ad-hoc. It allows defining something like (define

New release of guile-git?

2022-01-08 Thread Maxime Devos
Hi, I wrote a patch to the git updater in Guix, making it able to update packages like guile-next, emacs-next and minetest-throwing-arrows, that simply point to the latest commit in the git repository at the time the package definition was updated. It uses the procedure 'remote-create-detached',

Re: New release of guile-git?

2022-01-08 Thread Maxime Devos
Nevermind, seems easy to work around with call-with-temporary- directory. A new release of guile-git would still be nice, though. Also, Erik Edrosa seems to have somehow disappeared from CC. signature.asc Description: This is a digitally signed message part

Re: reserved-keyword in macro

2022-02-02 Thread Maxime Devos
Damien Mattei schreef op wo 02-02-2022 om 11:13 [+0100]: > (define-syntax macro >   (syntax-rules () > ((_ arg1 arg2) code1) > ((_ reserved-keyword arg) code2))) The rules are matched in-order, so when the first rule matches, the second rule is ignored. I suggest: (define-syntax macro (syntax-

[ANN] Scheme-GNUnet 0.2 released

2022-02-03 Thread Maxime Devos
Version 0.2 of Scheme-GNUnet has been released. The main change since the 0.1 release, is DHT support. * What is Scheme-GNUnet? Scheme-GNUnet is a WIP (Guile) Scheme port of the GNUnet client libraries. Unlike gnunet-guile, it is not a binding for the C libraries. It can be used in multi-thread

Re: [ANN] Scheme-GNUnet 0.2 released

2022-02-03 Thread Maxime Devos
Hi, Keith Wright schreef op do 03-02-2022 om 15:39 [-0500]: > Maxime Devos writes: > > > The source code can be found at <https://git.gnunet.org/gnunet-scheme.git/>, > > > I can send a copy of the manual (PDF, HTML or TeXmacs) by mail if desired. > >

Re: reserved-keyword in macro

2022-02-04 Thread Maxime Devos
is it included for? Greetings, Maxime. ;;; Copyright © 2022 Maxime Devos ;;; ;;; This library is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU Lesser General Public License as ;;; published by the Free Software Foundation, either version 3 of the ;;; License

Re: Newbie thoughts on Guile Hall + Guix

2022-02-06 Thread Maxime Devos
Ognen Duzlevski schreef op zo 06-02-2022 om 09:53 [-0500]: > > Asking beginners to use Guix is too much of a jump I think. But get > > them > > hooked on Guile with an easy package manager and a rich ecosystem, > > and I > > think they will come to appreciate Guix and other free software > > projec

Re: Newbie thoughts on Guile Hall + Guix

2022-02-06 Thread Maxime Devos
Olivier Dion via General Guile related discussions schreef op zo 06-02- 2022 om 11:35 [-0500]: > I personnally end up writting something similar to hall for a project of > mine using Guix records.  From a description like so: > ---

Re: Newbie thoughts on Guile Hall + Guix

2022-02-06 Thread Maxime Devos
Olivier Dion schreef op zo 06-02-2022 om 17:05 [-0500]: > > Is it restricted to Makefiles, or can it also be used without > > generating Makefiles?  If not, things like progress bars should be > > easy > > to implement and file names containing spaces or ‘special > > characters’ > > can be used wit

Re: Newbie thoughts on Guile Hall + Guix

2022-02-09 Thread Maxime Devos
Aleix Conchillo Flaqué schreef op wo 09-02-2022 om 12:05 [-0800]: > - Assuming you find the library you need... how do you start using it? How > do you install it? Now there's Guix, but not everyone has Guix or wants to > install Guix. I'm on macOS currently so I can't even install Guix > unfortuna

Re: Ideas for making Guile easier to approach

2022-02-09 Thread Maxime Devos
Christine Lemmer-Webber schreef op wo 09-02-2022 om 10:18 [-0500]: > We had: > >   (define-module (my-module) >     #:use-module (guile match) >     #:use-module (guile format) >     #:use-module (srfi list-utils) >     #:use-module (srfi records) >     #:use-module (srfi args-fold) >     #:use-mo

Re: Ideas for making Guile easier to approach

2022-02-09 Thread Maxime Devos
Christine Lemmer-Webber schreef op wo 09-02-2022 om 10:18 [-0500]: > I'd like to actually see Guile integrate Wisp as a core language and > think about what it would be like to support it as a recommended > alternate way of writing programs.  I think with the new block-level > highlighting that Arn

Re: GNU Guile 3.0.8 released

2022-02-11 Thread Maxime Devos
Andy Wingo schreef op vr 11-02-2022 om 08:47 [+0100]: > We are delighted to announce GNU Guile release 3.0.8, the latest in the [...] > The Guile 3.0.8 release mixes maintenance and optimizations [...] Is there any reason the fix was not app

Re: Exception handling - symbol for encoding exception type?

2022-03-08 Thread Maxime Devos
Zelphir Kaltstahl schreef op di 08-03-2022 om 17:11 [+]: >    (make-non-continuable-error) IIRC, 'make-non-continuable-error' indicates that someone tried to continue into a raise-exception that wasn't continuable. It does not make things non-continuable, it just states that someone tried

Re: Exception handling - symbol for encoding exception type?

2022-03-08 Thread Maxime Devos
Zelphir Kaltstahl schreef op di 08-03-2022 om 17:11 [+]: > Is the idea, that one should rely merely on the existing > exception types, which are: > > + assertion-failure > + non-continuable > + implementation-restriction > + lexical > + syntax > + undefined-variable > > and that one should no

Re: Exception handling - symbol for encoding exception type?

2022-03-08 Thread Maxime Devos
Zelphir Kaltstahl schreef op di 08-03-2022 om 17:11 [+]: > and that one should not try to create additional types? Or > is the idea to encode more specifics into the &message? Nothing is stopping you from including both a descriptive error &message and an easily catchable and machine-readable

Re: Guile optimizations slowing down the program?

2022-03-08 Thread Maxime Devos
Jean Abou Samra schreef op wo 09-03-2022 om 00:31 [+0100]: > In summary, the less Guile optimizes, the faster LilyPond runs. Is that > something expected? I don't think so, but I don't have a clue how this happens ... Greetings, Maxime signature.asc Description: This is a digitally signed messa

Re: Question about an error with ports

2022-03-11 Thread Maxime Devos
Olivier Dion via General Guile related discussions schreef op do 10-03- 2022 om 18:46 [-0500]: > I haven't check the implementation details, but I think it's just a > question of buffering.  `get-bytevector-n` will block just like > `get-bytevector-some` when the port is empty.  The former will ret

Re: Question about an error with ports

2022-03-11 Thread Maxime Devos
Chris Vine schreef op vr 11-03-2022 om 18:13 [+]: > code has changed.  I have yet to re-equip my tests to test the write and > display procedures, Those aren't rewritten in Scheme (yet?). Greetings, Maxime. signature.asc Description: This is a digitally signed message part

Re: Question about an error with ports

2022-03-11 Thread Maxime Devos
Chris Vine schreef op vr 11-03-2022 om 18:13 [+]: > Interestingly the read procedure remains unsafe in guile-2.2.6, but > seems to be safe in guile-3.0.8 even though I cannot see what in the This is probably due to the rewrite of the 'read' procedure in Scheme (see module/ice-9/read.scm (canno

Re: Weird cache issue

2022-03-15 Thread Maxime Devos
Zelphir Kaltstahl schreef op di 15-03-2022 om 17:54 [+]: > 013.scm > (library (fileio) Shouldn't this be (library (#{013}#) ...) instead of (library (fileio) ...)? signature.asc Description: This is a digitally signed message part

Re: Weird cache issue

2022-03-15 Thread Maxime Devos
Zelphir Kaltstahl schreef op di 15-03-2022 om 17:54 [+]: > I found out, that this behavior disappears, when I fix the (library ...) > expression in "013.scm" as follows: Nevermind, I now see this part of the mail. Greetings, Maxime signature.asc Description: This is a digitally signed mess

Re: Weird cache issue

2022-03-15 Thread Maxime Devos
Zelphir Kaltstahl schreef op di 15-03-2022 om 17:54 [+]: > 013.scm > (library (fileio) >    (export ) >    (import >     (except (rnrs base) let-values) >     (only (guile) >   lambda* λ >   ;; printing >   display >   simple-format) >     (fileio))) Sho

Re: Module dependencies

2022-03-19 Thread Maxime Devos
Jérémy Korwin-Zmijowski schreef op za 19-03-2022 om 11:10 [+0100]: > Hey Guilers ! > > I would like to visualize all the modules a given module depend on. > > How do you achieve that ? It's not 100% what you're asking for, but you can do $ guix graph --type=module hello to create a graph (in d

Re: Indentation with inline comments in Emacs

2022-04-17 Thread Maxime Devos
Zelphir Kaltstahl schreef op zo 17-04-2022 om 11:06 [+]: > I never understood, why Emacs indented that way, but now I understand. First > argument is seen as special, as the function/procedure that is being called – > aha! I do not know, whether the syntax for vector creation #(...) is the sa

Re: Announcing Guile DNS!

2022-05-24 Thread Maxime Devos
Hugo Hörnquist schreef op di 24-05-2022 om 17:13 [+0200]: > Dear Guilers! > > I'm happy to announce my new library Guile DNS, a pure scheme library > for DNS lookups. > > https://git.lysator.liu.se/hugo/guile-dns To avoid potential later packaging problems, and to avoid licensing problems for li

Re: guile_gi question: gtk+ interface object?

2022-06-14 Thread Maxime Devos
Andy Tai schreef op di 14-06-2022 om 11:52 [-0700]: > question: how to create object representing Gtk+ (version 3) > interfaces? For example. > > (let (model (make ))) > > would fail  because GtkTreeModel is an interface, not class derived > from GObject. By definition, you cannot instatiate int

Re: guile_gi question: gtk+ interface object?

2022-06-15 Thread Maxime Devos
Andy Tai schreef op di 14-06-2022 om 21:05 [-0700]: > (let ((iter (make )) >  (model (make ))) > (define selected (tree-selection:get-selected! selection model iter)) > > get_selected(GtkTreeModel out model, GtkTreeeIter out iter) has two > out parameters, model and iter, Looking at

Re: Curiosity: Microkernel implemented in Guile ?

2022-06-23 Thread Maxime Devos
Matias Jose Seco Baccanelli schreef op do 23-06-2022 om 08:11 [+0200]: > Feels like a nice recipe for User Empowerment ! How does this empower users? Sure, if the user is a programmer they can modify their custom microkernel in Scheme, but then you have a very niche OS that practically no other s

Re: Curiosity: Microkernel implemented in Guile ?

2022-06-23 Thread Maxime Devos
Nala Ginrut schreef op do 23-06-2022 om 18:09 [+0800]: > Such a design, is actually the real GNU operating system described in > imagination. So the question should be: is there any attempt to write GNU > Hurd binding with Guile, and implement the multi server OS to complete GNU? > > I never heard

Re: mmap for guile

2022-06-26 Thread Maxime Devos
Matt Wette schreef op zo 26-06-2022 om 08:37 [-0700]: > scheme@(guile-user)> ,d mmap/search > - Scheme Procedure: mmap/search addr len [prot [flags [fd [offset >   See the unix man page for mmap.  Returns a bytevector.  Note that >   the region allocated will be searched by the garbage

Re: mmap for guile

2022-06-26 Thread Maxime Devos
Some old mmap things that might be useful: * https://lists.nongnu.org/archive/html/guile-devel/2013-04/msg00235.html * https://lists.gnu.org/archive/html/bug-guile/2017-11/msg00033.html * https://lists.gnu.org/archive/html/guile-user/2006-11/msg00013.html +SCM_DEFINE (scm_mmap_search, "mmap/searc

Re: 64-bit Guile on Windows

2022-06-28 Thread Maxime Devos
Jean Abou Samra schreef op di 28-06-2022 om 10:38 [+0200]: > We had exactly the same problem at LilyPond, and this was the fix: > > https://gitlab.com/lilypond/lilypond/-/blob/master/release/binaries/lib/dependencies.py#L721 > For security, shouldn't this check the hash of the downloaded tarball

Re: 64-bit Guile on Windows

2022-06-28 Thread Maxime Devos
Thomas Thiriez via General Guile related discussions schreef op di 28- 06-2022 om 16:41 [+0200]: > Jean Abou Samra writes: > > > Le 27/06/2022 à 15:56, Thomas Thiriez via General Guile related > > discussions a écrit : > [...] > > > (* 999 999 999) -> -76738825 > [...] > > > > We had exactly the

Re: Wiki && Re: [feature request] merge sxml->html from (haunt html) into guile?

2022-06-28 Thread Maxime Devos
Blake Shaw schreef op wo 29-06-2022 om 01:34 [+0700]: > Which brings up another thing I've been considering working on thats > been discussed in the Guix community: the need for click-to-edit > wiki, written in Guile. [...] I don't think ‘written in Guile’ has been discussed? Also, I don't see th

Re: Wiki && Re: [feature request] merge sxml->html from (haunt html) into guile?

2022-06-28 Thread Maxime Devos
Maxime Devos schreef op di 28-06-2022 om 22:13 [+0200]: > Blake Shaw schreef op wo 29-06-2022 om 01:34 [+0700]: > > Which brings up another thing I've been considering working on > thats > > been discussed in the Guix community: the need for click-to-edit > > wiki, w

Re: mmap for guile

2022-07-19 Thread Maxime Devos
Ludovic Courtès schreef op ma 04-07-2022 om 12:09 [+0200]: > I don’t think the optimizer makes any such assumption, except for > literal bytevectors. It _does_ assume that bytevector lengths don't change: ,use (rnrs bytevectors) ,compile (bytevector-u8-ref some-variable 999) ;;; : warning: possi

Re: mmap for guile

2022-07-19 Thread Maxime Devos
Ludovic Courtès schreef op ma 04-07-2022 om 12:09 [+0200]: > But we could provide special semantics: the bytevector would become > zero-length (possible, but weird, as Maxime points out), or it would > be turned into a /dev/zero mapping (weird as well). > > Thoughts? The former is weird and can c

Re: mmap for guile

2022-07-19 Thread Maxime Devos
Ludovic Courtès schreef op ma 04-07-2022 om 12:09 [+0200]: > > Also, what if you mmap a region, use bytevector->pointer and pass > > it to > > some C thing, which saves the pointer somewhere where boehm-gc can > > find > > it and boehm-gc considers it to be live, is there something that > > prevent

Re: Contracts macro example

2022-07-19 Thread Maxime Devos
Zelphir Kaltstahl schreef op do 14-07-2022 om 23:55 [+]: >   (make-assertion-failure) >   (make-exception-with-message "assertion failed") >   (make-exception-with-irritants (quote (op args* ...)] Instead of a generic 'assertion failure', I believe a more specific &

Re: Contracts macro example

2022-07-20 Thread Maxime Devos
On 20-07-2022 10:39, Zelphir Kaltstahl wrote: It would also be nice to define a global 'require' and 'ensure' and '' somewhere (e.g.: (define-syntax require (identifier-syntax (syntax-error "'require' can only be used as part of a contract construct", that way, require / ensure / can be ren

Re: boiler plate class generation, writing fresh variables with macros

2022-07-22 Thread Maxime Devos
On 22-07-2022 11:43, Blake Shaw wrote: But if I try to use `slot-machine` inside a class definition i'm out of luck: (define-class () (slot-machine 'inner 'color "green")) => While compiling expression: Syntax error: socket:7257:0: source expression failed to match any pattern in form (defi

Re: Macro for replacing a placeholder in an expression

2022-07-27 Thread Maxime Devos
These macros all sound more complicated than necessary -- on the first one, I've sent you a message with sneek: ;; By: Maxime Devos ;; This does not recurse into #(...). ;; Also, such a construct does not nest well, you can't put a replace-result-placeholder inside a repl

Re: Macro for replacing a placeholder in an expression

2022-07-27 Thread Maxime Devos
On 28-07-2022 01:57, Zelphir Kaltstahl wrote: scheme@(guile-user)> (define-syntax test   (syntax-rules (lambda)     [(_ (op args body* ...)) ((test op) (test args) (test body* ...))]     [(_ thing1 thing2 things* ...) ((test thing1) (test thing2 things* ...))]     [(_ (thing)) (

Re: Macro for replacing a placeholder in an expression

2022-07-28 Thread Maxime Devos
On 28-07-2022 10:39, Zelphir Kaltstahl wrote: I aimed to do everything with syntax-rules, as the simplest means, but when writing the code I have, I hit the snag, that one could not have multiple ellipses at the same level of nesting in the patterns. IIUC, you mean: (syntax-rules ()   ((foo

Re: Macro for replacing a placeholder in an expression

2022-07-28 Thread Maxime Devos
On 28-07-2022 12:23, Zelphir Kaltstahl wrote: I'll need to look at this and learn about eval-when The eval-when is only required if the macro is 'run' when the module holding the macro is compiled (to avoid some compilation failures); often the eval-when can be dropped. Greetings, Maxime.

Re: Macro for replacing a placeholder in an expression

2022-07-30 Thread Maxime Devos
On 30-07-2022 17:42, Zelphir Kaltstahl wrote: [...] But now comes the problem: Since I want to replace all occurrences of for example and does not need to be defined, I think I must use define-syntax, to avoid Guile trying to evaluate the arguments to a function call. OK, so a macro I wr

Re: Macro for replacing a placeholder in an expression

2022-07-30 Thread Maxime Devos
On 30-07-2022 22:44, Maxime Devos wrote: "All I want to do" is to replace some placeholder (in this case ) in an arbitrary form. No matter how that form looks or how deeply it is nested, if there are inside of it, I want to replace them. Is this impossible? Yes, see e.g. t

Re: Macro for replacing a placeholder in an expression

2022-07-30 Thread Maxime Devos
On 30-07-2022 17:42, Zelphir Kaltstahl wrote: Does this mean, that recursive application of a macro inside a macro is impossible? To expand to subforms being the same macro again and this way transform a whole tree of s-expressions? You can have recursive macros, see e.g. the let^ macro at

Re: string is read-only

2022-08-03 Thread Maxime Devos
On 03-08-2022 11:12, Damien Mattei wrote: scheme@(guile-user)> (define str2 "hello") scheme@(guile-user)> (string-set! str2 4 #\a) ice-9/boot-9.scm:1669:16: In procedure raise-exception: string is read-only: "hello" It's not -- the existence of read-only strings is implied by substring/read-o

Re: Fwd: string is read-only

2022-08-03 Thread Maxime Devos
On 03-08-2022 11:51, Damien Mattei wrote: ok and i suppose it is the standard, i have been confused by other schemes or racket where my code worked: It happens to work in Guile too, when you use the interpreter instead of the compiler: scheme@(guile-user)> (eval `(let ((a ,(string-copy "fo

Re: string is read-only

2022-08-03 Thread Maxime Devos
On 03-08-2022 12:55, Damien Mattei wrote: but no restrictions with lists in Guile: scheme@(guile-user)> (define lst '(1 2 3)) scheme@(guile-user)> (set-car! lst 7) scheme@(guile-user)> lst (7 2 3) Non-empty lists are pairs and the second part of the pair is another list -- in Guile, this is e

Re: Contracts macro example

2022-08-04 Thread Maxime Devos
On 24-07-2022 03:21, Zelphir Kaltstahl wrote: (define-syntax require (identifier-syntax (syntax-error "'require' can only be used as part of a contract construct"))) Can you explain how it works? If you meant: how can identifier-syntax + syntax-error be used? -- I don't have

Re: Using Guile 2.2 modules with Guile 3

2022-08-06 Thread Maxime Devos
On 06-08-2022 17:11, Olivier Dion via General Guile related discussions wrote: Hi, Say I want to use guile-dbi wich use Guile 2.2. Is there any danger for me to use it with Guile 3.0? I see that Guile will recompile the module because the already compiled one does not match, I guess. Other

Re: Using Guile 2.2 modules with Guile 3

2022-08-06 Thread Maxime Devos
On 06-08-2022 17:31, Olivier Dion wrote: old Going by the package definition, guile-dbd-postgresql seems to make a Guile extension (C). There have been incompatible changes (both on the Guile code level, and presumably on the C level). As such, sounds risky to me. Also, for whatever reason, g

Re: Why does compile discard multiple values?

2022-08-10 Thread Maxime Devos
On 10-08-2022 15:01, Jean Abou Samra wrote: Hi, See: $ guile3.0 GNU Guile 3.0.7 Copyright (C) 1995-2021 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain condi

Re: Error in error?

2022-08-19 Thread Maxime Devos
On 19-08-2022 01:44, sidhu1f wrote: According to the guile (version 3.0.7) reference manual, (error "foo ~a" 'bar) should output "foo bar" but instead the output is "foo ~a bar". Am I missing something or is there a bug in error? You might need 'scm-error' instead: (scm-error 'misc-error 'th

Re: avoid character encoding/escaping in sxml->xml or htmlprag's sxml->html

2022-08-20 Thread Maxime Devos
The GuileScript looks nice, for interested readers, see On 20-08-2022 21:59, Aleix Conchillo Flaqué wrote: However, I'm not able to find a way to avoid character encoding/escaping and the generated code inside will always have "<", etc.

Re: avoid character encoding/escaping in sxml->xml or htmlprag's sxml->html

On 21-08-2022 02:05, Aleix Conchillo Flaqué wrote: According to the spec, embedding inline content in the tag should conform to the language defined by the "type" attribute (defaults to javascript). So, I would expect you could put any string that conforms to JS.

Re: expression and definition context in Scheme

On 27-08-2022 18:48, Damien Mattei wrote: My ideas is as it is so easy to cheat the compiler I don't think it's cheating or abusive. from seeing the expressio context why does the compiler restrict this? expression and defintion context, i'm not sure they are in scheme standarts, are they rea

Re: expression and definition context in Scheme

On 27-08-2022 21:02, Damien Mattei wrote: I haven't read the RnRS closely, but I doubt that (some-procedure (define foo 0) (define bar 0)) ? i do not understand well the meaning Me neither, that's what I meant. You are proposing to unify expression context and definition context

Re: expression and definition context in Scheme

On 27-08-2022 21:02, Damien Mattei wrote: in fact just allow 'define that act locally ,see my comment below I do not know what semantics you want. Also, even if (begin ...) and (let () ...) where unified, it would be a shame to lose the ability to only have some definitions tempo

Re: The λ-cube

On 30-08-2022 03:03, Jean Abou Samra wrote: Retrying, it got all mangled up by automatic wrapping … It's mangled over here, perhaps you could sent it as an attachment? Greetings, Maxime OpenPGP_0x49E3EE22191725EE.asc Description: OpenPGP public key OpenPGP_signature Description: OpenP

Re: expression and definition context in Scheme

On 31-08-2022 09:01, Damien Mattei wrote: I always try to keep compatibility with RnRS and in fact except cond none of when, unless, cond, case, while, and do are in standart RnRS schem 'when', 'unless' and 'do' are actually RnRS, see (rnrs control). 'case' is also RnRS, see (rnrs base). How

[ANN] Scheme-GNUnet 0.3 released

Version 0.3 of Scheme-GNUnet has been released. The main change since the 0.2 release, is some CADET support. There are also various small fixes and improvements. If you have any questions, please reply to guile-user@gnu.org. * What is Scheme-GNUnet? Scheme-GNUnet is a WIP (Guile) Scheme port

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

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

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

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_0x4

Re: Error in error?

On 22-09-2022 01:17, sidhu1f wrote: You are both correct. My motivation was to use the assert macro from guile-libs (www.nongnu.org/guile-lib/doc/ref/debugging.assert/). Do you know that Guile already has an 'assert 'macro (see: (guile)rnrs base)? It is less capable though (no ?r-exp), so

python-on-guile fails to compile

I noticed python-on-guile fails to compile in Guix, so I tried updating it, but it still fails (somehow 'type' is #false?): Type is defined on line https://gitlab.com/python-on-guile/python-on-guile/-/blob/master/modules/oop/pf-objects.scm#L1530 as #f but set to something later in https://git

Re: Looking for graph library

On 08-10-2022 12:29, Dmitry Polyakov wrote: Hello! Can you recommend any library for working with graphs (I did not find it in srfi and mailing list). Almost what I need to have in graphviz bindings, but there are no predicate functions and the like. SRFI-234 is for linearizing a direct acy

Re: map-par slower than map

On 12-10-2022 19:19, Damien Mattei wrote: Hello, all is in the title, i test on a approximately 3 element list , i got 9s with map and 3min 30s with par-map on exactly the same piece of code!? > [...] > translated from Scheme+ to Scheme: (define unified-minterms-set-1 (map function-unify-m

Re: map-par slower than map

demonstrate the 'map-par slower than map') and to change it to standard-ish Scheme instead of your Scheme+ variant. On Wed, Oct 12, 2022 at 8:45 PM Maxime Devos <mailto:maximede...@telenet.be>> wrote: [rest of copied previous message, without any comments] This is top

  1   2   >