Re: global vars and #:declarative? (was [critical bug] The set! doesn't work in indirect reference)

2024-09-19 Thread Taylan Kammer
On 19.09.2024 14:30, Nala Ginrut wrote: > Although I mostly put global var like global parameters in such a module, I > think there's always something that needs a globally setter. > The parameter works when you could get the state first in the runtime, > then you can bind it with pameterize. But f

Bytestructures 2.0.2 released

2024-06-07 Thread Taylan Kammer
This release fixes the test suite for i386. Tarball as produced by 'make dist' can be downloaded here: https://github.com/TaylanUB/scheme-bytestructures/releases/download/v2.0.2/bytestructures-2.0.2.tar.gz - Taylan P.S.: I don't have an i386 system, but I'm 99% sure the issue is fixed. P

Re: intern a top level variable

2023-08-16 Thread Taylan Kammer
On 16.08.2023 21:17, Mortimer Cladwell wrote: > I would like to define a variable within a method but make it available to > the entire module - globally. > Take a string "abc" convert to a variable (symbol??) abc and set to the > string value "def". > The values of name and data are unknown - they

Re: Equality and hashing for new datatypes

2023-06-23 Thread Taylan Kammer
On 23.06.2023 00:45, Philip McGrath wrote: > On Thursday, June 22, 2023 7:33:06 AM EDT Taylan Kammer wrote: >> On 22.06.2023 00:25, Philip McGrath wrote: >>> Hi, >>> >>> What is the recommended way for a library to customize `equal?` and >>> `equal?

Re: Equality and hashing for new datatypes

2023-06-22 Thread Taylan Kammer
On 22.06.2023 00:25, Philip McGrath wrote: > Hi, > > What is the recommended way for a library to customize `equal?` and `equal?` > -based hashing for new datatypes it defines? > > I know from [1] that `equal?` can be customized using GOOPS; however, some > projects do not use GOOPS (e.g. [2]), s

Re: Does declaration order matter in guile?

2023-02-12 Thread Taylan Kammer
On 12.02.2023 19:46, wolf wrote: > So, I have few questions I would like to ask: > > 1. When does order matter? What is going on here? Heya. The order matters in this case because the SRFI-9 implementation in Guile defines syntax (macros) rather than just variables bound to procedures. If you

Re: bytevector seems to be missing in Guile

2023-01-07 Thread Taylan Kammer
On 07.01.2023 22:12, Wolf wrote: > On 2023-01-07 12:07:31 -0800, Matt Wette wrote: >> On 1/7/23 8:34 AM, Sascha Ziemann wrote: >>> Is the procedure "bytevector" missing in Guile? >>> >>> I tried this: >>> guile --r7rs -c '(write (bytevector 1 2 3))' >>> >>> R7RS defines it on page 49. >>> >> >> may

Re: hashmark in symbols

2023-01-01 Thread Taylan Kammer
On 02.01.2023 07:25, Andreas Reuleaux wrote: > Ah, OK, this helps indeed > > --8<---cut here---start->8--- > (read-enable 'r7rs-symbols) > --8<---cut here---end--->8--- > Another option would be to use string->symbol: (st

Re: bytevector-string-ref

2022-12-18 Thread Taylan Kammer
On 18.12.2022 13:12, Sascha Ziemann wrote: > I am wondering if something like bytevector-string-ref is missing in the API. > Or is there any other way to extract a string from a byte vector, without > copying the data twice? > I don't think Guile currently has any way of giving you a string objec

Re: letrec semantics

2022-11-28 Thread Taylan Kammer
On 28.11.2022 09:33, Alexander Asteroth wrote: > >> scheme@(guile-user)> (letrec ((b a)(a 7)) b) >> $1 = 7 > > should be equivalent (of course in a new scope) to: > >> scheme@(guile-user)> (define b #nil) >> scheme@(guile-user)> (define a #nil) >> scheme@(guile-user)> (set! b a) >> scheme@(guile

Re: case source code

2022-09-12 Thread Taylan Kammer
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: (defi

Re: string is read-only

2022-08-03 Thread Taylan Kammer
On 03.08.2022 11:50, Jean Abou Samra wrote: > > >> Le 3 août 2022 à 11:49, Taylan Kammer a écrit : >> >> On 03.08.2022 11:12, Damien Mattei wrote: >>> GNU Guile 3.0.1 >>> Copyright (C) 1995-2020 Free Software Foundation, Inc. >>> >>&g

Re: string is read-only

2022-08-03 Thread Taylan Kammer
On 03.08.2022 11:12, Damien Mattei wrote: > GNU Guile 3.0.1 > Copyright (C) 1995-2020 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 conditions; type `,s

Re: Indentation with inline comments in Emacs

2022-04-16 Thread Taylan Kammer
On 16.04.2022 14:12, Zelphir Kaltstahl wrote: > Hello Guile users! > > The subject might not be only Guile related, but I figure, that many on this > mailing list are using Emacs for writing Guile code. I wonder, if anyone has > some trick for fixing the following indentation issue: > > Sometim

Re: A modest Scheme poem ...

2022-04-16 Thread Taylan Kammer
On 16.04.2022 18:49, Jean Abou Samra wrote: > (let ((be values)) >   (when values >     (yield) >     *unspecified*) >   (if values >   (do () >     (not > (values be quit) > > Could not execute. Variable 'yield' unbound. A missing import? ;-) (it's a haiku) --

bytestructures 2.0.1

2022-02-22 Thread Taylan Kammer
On 21.02.2022 22:09, Taylan Kammer wrote: > > It's already fixed upstream. Not sure if it's worth releasing 2.0.1. > Decided to release it after all. Just the test suite fix. https://github.com/TaylanUB/scheme-bytestructures/releases/tag/v2.0.1 -- Taylan

Re: bytestructures 2.0.0

2022-02-21 Thread Taylan Kammer
On 21.02.2022 00:25, Matt Wette wrote: > > On 2/20/22 11:51 AM, Taylan Kammer wrote: >> I'd like to announce the release of bytestructures 2.0.0 for Scheme and >> Guile in particular. >> >> Don't be fooled by the major version bump, there&#x

bytestructures 2.0.0

2022-02-20 Thread Taylan Kammer
I'd like to announce the release of bytestructures 2.0.0 for Scheme and Guile in particular. Don't be fooled by the major version bump, there's nothing radically new in this release. :-) https://github.com/TaylanUB/scheme-bytestructures What's new? --- This release bumps the major ve

Re: [EXT] Can guile be implementation independent?

2021-12-19 Thread Taylan Kammer
On 19.12.2021 21:03, Keith Wright wrote: > > Do we recoginize a distinction between core language and libraries? > R5RS and earlier don't have libraries. The things I listed as lacking in RnRS (whether 6 or 7) are taking into account all optional libraries listed in the respective standard. E.

Re: [EXT] Can guile be implementation independent?

2021-12-18 Thread Taylan Kammer
On 17.12.2021 18:05, Thompson, David wrote: > Hi Jacob, > > On Thu, Dec 16, 2021 at 8:43 PM Jacob Hrbek wrote: >> >> 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 mu

Re: Fwd: new function

2021-09-22 Thread Taylan Kammer
On 21.09.2021 21:03, Maxime Devos wrote: > > (define (foo2 set?) > (define x) ; define an (undefined or unbound, not sure about terminology) > variable > (if set? > (let () > (set! x 2) ; change the value of x > (display "x=") > (display x) > (newline)) >

Re: cond(itionals) with optional execution of statements

2021-09-12 Thread Taylan Kammer
On 12.09.2021 19:05, Damien Mattei wrote: > Hello Zelphir, > > condx evaluate all code(s) in the 'exec' block until a conditional is true, > it then evaluate the consequent code of course. > So ,yes your true it saves a lot of nesting parenthesis as in this example: > Interesting macro. I think

Re: Difficulty integrating with Swift/Objective-C

2021-09-06 Thread Taylan Kammer
On 06.09.2021 12:21, paul wrote: > Hello again list, Taylan, > > On 2021-09-05 at 18:26 AEST, quoth Taylan Kammer : >> To narrow down the issue, I'd attempt a few things, in order: >> >> 1. Compile only the C code, adding a main() function, just to make sure the

Re: Difficulty integrating with Swift/Objective-C

2021-09-05 Thread Taylan Kammer
On 05.09.2021 08:03, paul wrote: > Good day, > > I have an existing app which is written in Swift and runs on macOS 10.15.  I > would like to provide users a way of customising the app (initially just > simple things like modifying keybindings for example, later hopefully more) > and as a keen

Re: Can system modify an environment variable in the current environment?

2021-09-02 Thread Taylan Kammer
On 02.09.2021 21:49, Mortimer Cladwell wrote: > Hi, > > Consider my file test.scm: > > (define (main args) > (let* ((myvar (string-append "export > GUILE_LOAD_PATH=/some/random/text:$GUILE_LOAD_PATH")) >(statement1 (system (string-append "echo " myvar " >> > $HOME/.bashrc"))) >

Re: return macro

2021-06-27 Thread Taylan Kammer
On 28.06.2021 01:10, Damien Mattei wrote: > hi, > > i wanted to create a macro that is used like a function definition and > allow return using call/cc: > > (define-syntax def > (syntax-rules (return) > ((_ (name args ...) body body* ...) > (define name (lambda (args ...) > (call/cc (lambda (retu

Re: define anywhere

2021-06-04 Thread Taylan Kammer
On 05.06.2021 00:27, Damien Mattei wrote: > hello, > i'm was considering that i want to be able to define a variable anywhere in > code, the way Python do. Few scheme can do that (Bigloo i know) > ( the list here is not exact: > https://www.reddit.com/r/scheme/comments/b73fdz/placement_of_define_in

Re: Procedure arity and documentation

2021-05-27 Thread Taylan Kammer
On 26.05.2021 21:33, Zelphir Kaltstahl wrote: > > Is that a bug, or is it, because I am trying to use it in the REPL and there > my > procedure is not compiled? > > Best regards, > Zelphir > There's a relevant bug report I looked into recently: https://bugs.gnu.org/40294 Quoting myself: It s

Re: srfi-64 tests passing when they should not

2021-05-06 Thread Taylan Kammer
On 05.05.2021 15:47, Luis Felipe wrote: > Hi Taylan, > > On Wednesday, May 5, 2021 6:39 AM, Taylan Kammer > wrote: > >> On 04.05.2021 10:31, Zelphir Kaltstahl wrote: >> >>> The first 2 tests are surprisingly passing. This is also the reason, why I >>

Re: srfi-64 tests passing when they should not

2021-05-04 Thread Taylan Kammer
On 04.05.2021 10:31, Zelphir Kaltstahl wrote: > > The first 2 tests are surprisingly passing. This is also the reason, why I > used > test-assert and manually wrote the (equal? ...) in the last test, to see, > whether it makes any difference. Indeed it does. > The reference implementation of SRF

Re: Syntax-Case macro that selects the N-th element from a list

2021-04-05 Thread Taylan Kammer
On 05.04.2021 13:30, Dr. Arne Babenhauserheide wrote: > Hi, > > In dryads-wake I need selection of the element in a list in a macro from > user-input. Currently I have multiple macros, and the correct one (which > strips the non-selected choices) is selected in a simple cond: > > (define-syntax-r

Re: Somehow I have got this "thunk" thing wrong.

2021-03-06 Thread Taylan Kammer
On 06.03.2021 01:31, Olivier Dion via General Guile related discussions wrote: > You've quoted the whole s-exp. Which means lambda is never applied. > You have to apply lambda in order to create a procedure. Just a bit of pedantry on the terms: 'lambda' is not "applied" anyway, because it's a spe

Re: test-equal: actual returned value is #f when tested expression raises execption

2021-02-21 Thread Taylan Kammer
On 20.02.2021 13:09, Jérémy Korwin-Zmijowski wrote: My concern here is that I did not defined the procedure in the module. It's empty. I can reproduce this on Guile 2.2 (don't have access to 3.0 right now) and in my opinion it's a bug. I've also checked what my own SRFI-64 implementation doe

Re: Guix records

2021-02-09 Thread Taylan Kammer
On 10.02.2021 02:02, Dr. Arne Babenhauserheide wrote: Taylan Kammer writes: The most feature-rich record system supported by Guile is probably the R6RS record system, which is available through the modules: (rnrs records syntactic (6)) (rnrs records procedural (6)) (rnrs records

Re: Guix records

2021-02-09 Thread Taylan Kammer
On 05.02.2021 17:51, Olivier Dion via General Guile related discussions wrote: Hello, In the module (guix records), there's some very nice syntax rule `define-record-type*` that allows very powerfull declarative style of records. For example:

Re: reading symbols containing apostrophe

2021-01-05 Thread Taylan Kammer
On 05.01.2021 00:12, Tom Gillespie wrote: In this instance I think the situation is worse than if the standard said this was an error. In fact the standard doesn't say this is an error at all, which would be better than the current situation. Where nearly all other implementations will read 'a'b'

Re: reading symbols containing apostrophe

2020-12-30 Thread Taylan Kammer
On 30.12.2020 05:51, Tom Gillespie wrote: Hi, I'm in the processes of reviewing reader behavior for a number of different lisp dialects and Guile has a quirk that I have been unable to find any documentation about. Specifically, as far as I can tell apostrophe is not allowed in identifiers ac

Re: Writing a procedure in different style

2020-12-13 Thread Taylan Kammer
On 13.12.2020 08:06, Taylan Kammer wrote:   (define find-in-tree* (λ (peg-tree filter-proc)    (define traverse (λ (subtree rest)    (simple-format (current-output-port)   "working with subtree ~a\n"    

Re: Writing a procedure in different style

2020-12-12 Thread Taylan Kammer
On 12.12.2020 13:22, Zelphir Kaltstahl wrote: (define find-in-tree* (λ (peg-tree filter-proc) (define traverse (λ (subtree cont) (simple-format (current-output-port) "working with subtree ~a\n" subtree) (cond

Re: Question about data structures

2020-11-22 Thread Taylan Kammer
On 22.11.2020 19:48, Zelphir Kaltstahl wrote: Hello Guile Users! I have a question about data structures. [...] How do you approach this problem? Is it a problem at all? First of all, be cautious about premature optimization. In many cases it's best to just write the code the most straight

Re: Difference when calling guile script from C vs interpreter

2020-10-20 Thread Taylan Kammer
On 20.10.2020 14:58, Jean Rene Dawin wrote: Hi, when following guile script: __ gp.guile _ (snip) __ is run from the interpreter, the output shows the following: (snip) Total time: 0.327908556 seconds (0.121140347 seconds in GC) #t When the same scri

Re: Surprising behavior of eq?

2020-09-20 Thread Taylan Kammer
Others already mentioned 'equal?' as the correct predicate for testing structural content equality. It works not only for strings but also arbitrarily nested structures, for instance: (define a (list 'a 9871239876234 "foo" (vector #\a #\b #\c))) (define b '(a 9871239876234 (string #\f #\

Re: Starting a GNU Guile awesome list

2020-07-14 Thread Taylan Kammer
On 13.07.2020 23:19, Zelphir Kaltstahl wrote: > Hello Guile Users, > > I followed up on that idea I mentioned recently on the mailing list and > started creating an awesome list: > > https://notabug.org/ZelphirKaltstahl/awesome-guile Cool! Let me mention my following projects. They're in main

Re: Naming conventions

2020-07-08 Thread Taylan Kammer
On 07.07.2020 13:05, Simen Endsjø wrote: > > - :: ? As a macro parameter > I personally do this with pattern variables in macros, but I don't know if anyone else does. I'd advocate for it to become the norm though! I find it very intuitive because pattern variables are placeholders for something

Re: FFI questions

2020-05-15 Thread Taylan Kammer
On 15.05.2020 15:47, Jan Synacek wrote: Hello, Currently I have something like this: (define libxcb (dynamic-link "libxcb")) ... (define c-change-window-attributes (pointer->procedure void (dynamic-func "xcb_change_window_attributes" libxcb) (list '* uint32 uint32 '*))) (defin

Re: Help: equivalent syntax-case to defmacro

2020-05-06 Thread Taylan Kammer
On 05.05.2020 19:34, Dale Mellor wrote: Been struggling with this for a while, and nothing I try works. In test-suite/tests/getopt-long there is (defmacro deferr (name-frag re) (let ((name (symbol-append 'exception: name-frag))) `(define ,name (cons 'quit ,re

Re: SRFI-64: test exception symbol

2020-05-02 Thread Taylan Kammer
On 01.05.2020 21:20, Vladimir Zhbanov wrote: The first question: supposed that I already have guile installed (together with its own srfi's) and have downloaded your repository, how can I use your modules in my own code then? The second one: how to make your code available for our code in the s

Re: SRFI-64: test exception symbol

2020-05-01 Thread Taylan Kammer
On 30.04.2020 17:55, Vladimir Zhbanov wrote: On Thu, Apr 30, 2020 at 06:06:21PM +0300, Vladimir Zhbanov wrote: Hi, In SRFI-64, is there a way to test what exception raised using test-error() or anything else? I know about looking into test logs (if 'test-error' is used), though that's not what

Re: question about values

2020-03-17 Thread Taylan Kammer
On 18.03.2020 00:50, Massimiliano Gubinelli wrote: (let ((a (values "a" "b" "c"))) a) The result of (values x y z) is not a kind of object that contains three values (like a list or vector). It's three separate values that would need to be put into three separate variables. But you're only

Re: How to contribute ?

2020-02-20 Thread Taylan Kammer
Thank you for bringing up SRFI 64. May I propose to replace it with my SRFI 64 implementation instead? Last time this idea was opposed on the grounds that it might not be well tested whereas the reference implementation used in Guile is ubiquitous, but I think that doesn't really hold much weight

Re: Pure (side-effect-free) calls into c/c++?

2020-01-11 Thread Taylan Kammer
On 12.01.2020 03:12, Linas Vepstas wrote: > To answer my own question, it appears doable with a very simply macro, then: > > (define (bar x) >(format #t "Called bar with ~A\n" x) >(+ x 1)) > > (define (memoize FUNC) > " > memoize a function FUNC which takes a single int as argument > "

Re: Pure (side-effect-free) calls into c/c++?

2020-01-11 Thread Taylan Kammer
On 11.01.2020 19:52, Linas Vepstas wrote: > Or, thinking aloud a bit: boxes and symbols > > So, for example, if I was able to tell apart calls (f 42) from calls (f x) > where x is a "symbol" (or "variable", *see below*) referencing an integer, > then, for the former case, I could create a new

Re: srfi-64 apathetic test-error

2019-10-24 Thread Taylan Kammer
written in a terrible style that makes it very difficult to comprehend and improve. - Taylan On 24.10.2019 18:18, Taylan Kammer wrote: > On 23.10.2019 06:37, Christopher Howard wrote: >> Hi, I was just wondering: `test-error' from (srfi srfi-64) gives a pass >> if it catches

Re: Use core or SRFIs?

2019-10-24 Thread Taylan Kammer
On 24.10.2019 17:55, Zelphir Kaltstahl wrote: > Hello Guile Users! > > I have a question regarding usage of SRFIs in Guile code. > > Sometimes there are core functions, which are also available from an > SRFI implementation. One example I am currently dealing with are bitwise > operations for int

Re: srfi-64 apathetic test-error

2019-10-24 Thread Taylan Kammer
On 23.10.2019 06:37, Christopher Howard wrote: > Hi, I was just wondering: `test-error' from (srfi srfi-64) gives a pass > if it catches an exception, but it doesn't seem to care whether or not > the exception caught matches what you told it to expect. Is this a bug? The (test-error ...) form take

Re: Macros as 1st class objects

2019-03-12 Thread Taylan Kammer
Tk writes: > How likely is that something likes this, > (define macro2 (module-ref (current-module) 'macro1)) > > breaks in the future versions of Guile? The docs say this is > low-level, so I have my suspicions. > > I have an application that defines abstract interface modules and > specialises

Re: issues unit testing with srfi-64

2018-12-30 Thread Taylan Kammer
FWIW, I have a SRFI-64 implementation whose code-base and default test runner is somewhat cleaner than the upstream one: https://github.com/TaylanUB/scheme-srfis/tree/master/srfi/64 (All actual code is in the *.body.scm files. Others are R7RS library wrappers.) It sounds like using a custom