Re: Removing/Ignoring xmlns when using xml->sxml

2024-07-22 Thread Luis Felipe

Hi Richard,

El 22/07/24 a las 3:11, Richard Sent escribió:

Hi all,

I have some XML created by a tool called latexml that can convert LaTeX
equations to MathML. I am processing the output of this tool as part of
a Guile program and will be using it in a website.

The output looks something like this:

--8<---cut here---start->8---
http://www.w3.org/1998/Math/MathML\"; alttext=\"\\frac{1}{2}\" 
display=\"block\">
   
 1
 2
   

--8<---cut here---end--->8---

I need to convert this output to SXML to integrate it with the rest of
the toolchain.

Annoyingly, when using xml->sxml, the xmlns attribute is prepended to
every non-default element. For example,
'(http://www.w3.org/1998/Math/MathML:math ...) [1].

This behavior is undesirable when splicing the MathML into HTML, since
HTML doesn't support namespaces and web browsers don't seem to handle
elements with colons. The intended conversion is to simply splice the
MathML into HTML, sans namespace [2].

xml->sxml has a #:namespaces argument that allows me to alias the URL
namespace to something else in the SXML, but it doesn't look like I can
alias it to a "nil" namespace that isn't prepended at all.


The following seems to work (where xml-string is the example you provided):

(define namespaces '((#false . "http://www.w3.org/1998/Math/MathML";)))

(xml->sxml xml-string #:namespaces namespaces)
$7 = (*TOP* (math (@ (display "block") (alttext "\\frac{1}{2}")) "\n  " 
(mfrac "\n    " (mn "1") "\n    " (mn "2") "\n  ") "\n"))





OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Srfi-159/166 - monadic formatting for guile

2024-07-07 Thread Luis Felipe

Hi,

El 7/07/24 a las 13:23, Linus Björnstam escribió:

I had an implementation of 158 that was available in guix. However, bitbucket 
discontinued hg support and now the code is gone.

It was trivial to port of the SRFI iirc.


At that time, https://www.softwareheritage.org/ was archiving public 
projects from Bitbucket; they were aware of the situation. Maybe they 
have a copy of your project.


Cheers,


OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Some issues with guile

2024-04-27 Thread Luis Felipe

El 27/04/24 a las 7:28, Nikolaos Chatzikonstantinou escribió:

On Fri, Apr 26, 2024 at 11:21 AM Luis Felipe  wrote:

Hi Nikolaos,

Hello Luis!


El 26/04/24 a las 7:05, Nikolaos Chatzikonstantinou escribió:

2. Documentation extraction sucks.

[...]

- documentá in its page does not include an example of how it works!
  Not a line of code to explain to the user which documentation is
  extracted. I could not understand how to use it.

Yeah, I didn't want to include how to document code in Documentá.
Instead, I wanted to propose adding that documentation to Guile's
documentation and link to it from Documentá. But I haven't made the time
to write the proposed section.

Just add /something/ with a visible TODO that your wish is to have
guile document it instead. It should be prominent too, not buried 10
layers deep. You could just say "read the source code of documentá for
examples." When I looked at your documentation, I spent about 10
minutes trying to figure this out, and I was frustrated when I
couldn't find any examples. The user is left thinking they're an idiot
(they very well may be!) for not RTFM well enough and frustrated,
unlikely to look back at documentá...


I'll see what I can do to make it easier :)


Currently, Documentá can extract module documentation and procedure
documentation. It also documents variables, record types, and macros
exported by modules, but it simply lists them (record type fields are
listed too), it doesn't extract any particular documentation added by
human code writers. I haven't found, and in some cases investigated, a
way to properly document variables, macros, record types and GOOPS
clases using human-written documentation strings. But I want to have
that too.

What is the issue with this?

 ;;; my favorite constant
 (define magic 42)


That I don't know any existing mechanism to tell that the comment is the 
documentation of the variable. I'd prefer something like Elisp 
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Variables.html):


  defvar symbol [value [doc-string]]

  (defvar bar 23
    "The normal weight of a bar.")




OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Some issues with guile

2024-04-27 Thread Luis Felipe

Hi Linas,

El 27/04/24 a las 17:35, Linas Vepstas escribió:

On Sat, Apr 27, 2024 at 2:47 AM Nikolaos Chatzikonstantinou <
nchatz...@gmail.com> wrote:


On Fri, Apr 26, 2024 at 4:39 PM Tomas Volf <~@wolfsden.cz> wrote:

What you want is:

 (set-object-property! foo 'documentation "Contains a @code{'bar}.")

Okay, so this can document objects. I propose that a good-enough
solution is to document symbols.


  (define foo 42)
(set-object-property! foo 'documentation "my foo thing")
,a foo
(guile-user): foo
,d foo
my foo thing
(define (bar) (list 'a))
(set-object-property! bar 'documentation "this bar does stuff")
,a bar
(guile-user): bar #
(guile): module-obarray-ref #
...
,d bar
this bar does stuff

where ,a is short for ,apropos and ,d is short for ,describe


If I understand correctly, though, the "set-object-property!" procedure 
is part of a legacy interface. The manual recommends using object 
properties as shown in the Object Properties section instead 
(https://www.gnu.org/software/guile/manual/html_node/Object-Properties.html).





OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Some issues with guile

2024-04-26 Thread Luis Felipe

Hi Nikolaos,

El 26/04/24 a las 7:05, Nikolaos Chatzikonstantinou escribió:

2. Documentation extraction sucks.

[...]

   - documentá in its page does not include an example of how it works!
 Not a line of code to explain to the user which documentation is
 extracted. I could not understand how to use it.


Yeah, I didn't want to include how to document code in Documentá. 
Instead, I wanted to propose adding that documentation to Guile's 
documentation and link to it from Documentá. But I haven't made the time 
to write the proposed section.


Currently, Documentá can extract module documentation and procedure 
documentation. It also documents variables, record types, and macros 
exported by modules, but it simply lists them (record type fields are 
listed too), it doesn't extract any particular documentation added by 
human code writers. I haven't found, and in some cases investigated, a 
way to properly document variables, macros, record types and GOOPS 
clases using human-written documentation strings. But I want to have 
that too.


You can see examples of module and procedure documentation in 
Documentá's source 
(https://codeberg.org/luis-felipe/guile-documenta/src/branch/trunk/documenta). 
Note that for module documentation Documentá supports the conventional 
format


  ;;; Commentary:

  ;;; Your module documentation here ↓

  ;;; Code:

  ;;; Your code here ↓

Guile Scheme comments in the "Commentary" section are considered module 
documentation. You can use block comments too, the ones surrounded in #| 
... |#, instead of multiple line comments (see Documentá source code for 
examples).


Finally, better structuring, indexing and linking of generated API 
documentation are planned. I also want to explore exporting to Org format.


Hope that helps,


OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [ANN] Guile Hoot 0.4.0 released!

2024-04-09 Thread Luis Felipe

Hi David,

El 9/04/24 a las 14:12, Thompson, David escribió:

Hey Guilers!

On behalf of the Spritely Institute, I'm happy to announce that Guile
Hoot v0.4.0 has been released! Hoot is a Scheme to WebAssembly
compiler backend for Guile, which means you can now run Scheme in the
browser for real, tail calls and all.

The highlights of this release are:

* Hoot now supports user-defined modules.  Users no longer have to
   stuff their entire program into one file!

* The standard library is now available as a collection of importable
   modules.  Hoot provides the R7RS (scheme ...) namespace, as well as
   its own (hoot ...) namespace.

* An example project was added to the source tree in Git to serve as
   an easy starting point for new Hoot projects.  This example project
   also ships with our official release tarballs.  See the template's
   README [0] for more information.

* More of R7RS-small has been implemented and Hoot can now run 54 out
   of 57 Scheme benchmarks! [1] (Note that this data is currently just
   from my machine.  The official benchmark server will need to be
   capable of running NodeJS 22+, or another V8 distro, before Hoot
   results could be published there.)

Read the full release notes here:

https://spritely.institute/news/guile-hoot-v040-released.html

If you use Guix then it's easy to try out Hoot:

 guix pull
 guix shell guile-next guile-hoot

Happy hooting!


This is awesome! I can't wait to start hooting.

Thank you all for the hard work :)




OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Help with modules and unit tests

2023-12-08 Thread Luis Felipe


El 8/12/23 a las 14:26, Luis Felipe escribió:

Hi Nikolaos,

El 8/12/23 a las 6:59, Nikolaos Chatzikonstantinou escribió:

Hello guile-user list,

I am trying to figure out modules and unit tests on Guile.

I would like to have a main.scm that prints a variable defined in
lib.scm and has unit tests in test.scm.

What I thought I had to do was to use

 (add-to-load-path (dirname (current-filename)))

This seemed to be the suggestion in 6.16.8 Load Paths of the Guile
manual. My entire main.scm looks like this:

 (define-module (applejack main))
 (add-to-load-path (dirname (current-filename)))
 (use-modules (applejack lib))
 (define-public (main)
   (format #t "Hello from ~a!~%" name))

My lib.scm is:

 (define-module (applejack))
 (define-public name "Applejack")

but I get an error, which I believe originates from current-filename
returning #f. Separately, the test suite in test.scm is just the
example in SRFI-64, but I don't know how to run it. I am using Emacs
and geiser-mode. If I run geiser-eval-buffer, I get test output, and
it promises that there is some more in vec-test.log, but the logfile
stands empty.

I would appreciate it if some pointers for the workflow of a small
Guile project along the lines above were given.


Personally, I'm using these

For running tests: https://luis-felipe.gitlab.io/guile-proba/


For documentation extraction: https://luis-felipe.gitlab.io/guile-documenta/

(I sent the message incomplete by accident)



OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Help with modules and unit tests

2023-12-08 Thread Luis Felipe

Hi Nikolaos,

El 8/12/23 a las 6:59, Nikolaos Chatzikonstantinou escribió:

Hello guile-user list,

I am trying to figure out modules and unit tests on Guile.

I would like to have a main.scm that prints a variable defined in
lib.scm and has unit tests in test.scm.

What I thought I had to do was to use

 (add-to-load-path (dirname (current-filename)))

This seemed to be the suggestion in 6.16.8 Load Paths of the Guile
manual. My entire main.scm looks like this:

 (define-module (applejack main))
 (add-to-load-path (dirname (current-filename)))
 (use-modules (applejack lib))
 (define-public (main)
   (format #t "Hello from ~a!~%" name))

My lib.scm is:

 (define-module (applejack))
 (define-public name "Applejack")

but I get an error, which I believe originates from current-filename
returning #f. Separately, the test suite in test.scm is just the
example in SRFI-64, but I don't know how to run it. I am using Emacs
and geiser-mode. If I run geiser-eval-buffer, I get test output, and
it promises that there is some more in vec-test.log, but the logfile
stands empty.

I would appreciate it if some pointers for the workflow of a small
Guile project along the lines above were given.


Personally, I'm using these

For running tests: https://luis-felipe.gitlab.io/guile-proba/




OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Guile outside of Emacs + Geiser

2023-09-27 Thread Luis Felipe

Hi,

El 27/09/23 a las 19:07, Christine Lemmer-Webber escribió:

There's a long thread on guix-devel which is related and touches on many
things, but I thought I'd narrow in on this one thing.

Has anyone had a "good" experience programming with Guile without using
Emacs?  If so, what was your development experience like?


I have tried several editors and IDEs, and you're pretty much left on 
your own, typing characters. The only assistance I've found is syntax 
highlighting and closing parenthesis automatically. Besides those, the 
minimum features I'd expect to feel comfortable editing scheme are 
structural editing (like Emacs paredit) and something like rainbow 
delimiters. These tools alone make any worries about parenthesis go away 
(at least in my case).


But I've always wanted the same level of assistance I find for Python.



Furthermore, what's the right direction to making non-Emacs users have
as nice of an experience as Emacs users do?  Racket, for instance, has
lovely support in vscode with "Magic Racket".  What's the right path to
recommend for the present, and what's the best path to improve the
future?  LSP?  There are a few incomplete implementations I think but I
haven't tried them.
Personally, I'm hoping projects like 
https://codeberg.org/rgherdt/scheme-lsp-server will make it easier to 
improve the experience outside Emacs (and maybe inside too).


OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: guile-email 0.3.0 released

2023-01-07 Thread Luis Felipe
On Friday, January 6th, 2023 at 20:15, Arun Isaac  
wrote:


> Hello all,
> 

> I am pleased to announce the release of guile-email 0.3.0. Significant
> changes since the 0.2.2 release are described in the NEWS
> file. https://git.systemreboot.net/guile-email/tree/NEWS

Great, thanks for working on this :)

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: GNU G-Golf 0.8.0-a.1 available for testing!

2022-12-14 Thread Luis Felipe
Great! Thanks for working on this, David.


On Tuesday, December 13th, 2022 at 20:37, David Pirotte  wrote:

> Ultimately, one of the best way to test, and participate, is to select
> G-Golf to develop the next application of your dream!

I'll definitively try it out in one of my projects.

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Artanis: Referring to pub from SXML templates

2022-11-11 Thread Luis Felipe
--- Original Message ---
On Wednesday, November 9th, 2022 at 19:45, Luis Felipe 
 wrote:

> Hi,
> 

> Artanis documentation shows examples of HTML templates that use commands like 
> <@css filename.css %>, but how do I get the path to the "pub" directory from 
> my SXML templates?

Nevermind. For some reason simply using paths like "/img/icon.png" was not 
loading anything from the pub directory before, but now it works. I didn't have 
to do anything else.

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Artanis: Referring to pub from SXML templates

2022-11-09 Thread Luis Felipe
Hi,

Artanis documentation shows examples of HTML templates that use commands like 
<@css filename.css %>, but how do I get the path to the "pub" directory from my 
SXML templates?


---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


New "GNU Guile Made" and "Guile Hall Managed" badges

2022-07-16 Thread Luis Felipe
Hi,

I made some badges you can use to let people know that your software is made 
with Guile and managed with Hall.

See the picture for an example rendering on GitLab with a dark theme (they 
should work on a light theme too).

https://luis-felipe.gitlab.io/media/2022/07/gnu-guix-guile-hall-badges-2022-07-16.png

Grab the source SVG from my website:

https://luis-felipe.gitlab.io/media/badges/gnu-guile-made.svg

https://luis-felipe.gitlab.io/media/badges/guile-hall-managed.svg

The Guix badge is available too:

https://luis-felipe.gitlab.io/media/badges/gnu-guix-packaged.svg


Enjoy 🙂



---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: The Spritely Institute publishes A Scheme Primer (the long-requested "Guile tutorial"?)

2022-07-07 Thread Luis Felipe
On Thursday, July 7th, 2022 at 06:04, Dr. Arne Babenhauserheide 
 wrote:

> A also think, since this is an org-file, it would be a natural fit to
> turn this into a printed tutorial. Just make it a PDF, add a title page,
> and you can get it printed as POD (i.e. https://www.epubli.de/ ) —
> including access via the usual webshops for books.

+1

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: The Spritely Institute publishes A Scheme Primer (the long-requested "Guile tutorial"?)

2022-07-07 Thread Luis Felipe
On Wednesday, July 6th, 2022 at 18:55, Christine Lemmer-Webber 
 wrote:


> Hello all!
> 

> I'm thrilled to announce that The Spritely Institute has published A
> Scheme Primer:
> 

> https://spritely.institute/news/the-spritely-institute-publishes-a-scheme-primer.html
> https://spritely.institute/static/papers/scheme-primer.html
> 

> Source:
> https://gitlab.com/spritely/scheme-primer
> 

> and yes since the source is a .org file, there's a .info export:
> https://spritely.institute/static/papers/scheme-primer.info

It would be great to have this listed in 
https://www.gnu.org/software/guile/learn/. The first one on its level :)

And I hope Jeko's and Blake's higher level materials arrive soon too :)


> I've considered making a Guix package of the .info version. What do
> people think? Would that be useful?

Yes.

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Geiser+Guile For Remote Connections: "geiser-repl--wait-for-prompt: No prompt found!"

2022-07-04 Thread Luis Felipe
Hello Munyoki Kilyungi,

> Any
> one know how to fix the "No prompt found!" Or
> better yet, how would you specify, with Geiser,
> what Guile version to use on a per-project basis?

I filed a bug report about that to Guix a couple of years ago, and it seems the 
problem comes from the "~/.guile" file. Removing it, for example, fixed the 
problem for me (See https://issues.guix.gnu.org/35727).


publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


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

2022-06-28 Thread Luis Felipe
Hi Blake,

On Monday, June 27th, 2022 at 06:57, Blake Shaw  wrote:

> Finally I caved and decided to look at the Bootstrappable source code, and
> voila! (haunt html) provides sxml->html... the piece of the puzzle I was
> missing. Massive, near comical, relief.

Just to mention that there is also htmlprag, from guile-lib 
(https://www.nongnu.org/guile-lib/doc/ref/htmlprag/).

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: LSP Server for Scheme (and more ...)

2022-06-11 Thread Luis Felipe
Hi,


On Saturday, June 11th, 2022 at 02:07, Aleix Conchillo Flaqué 
 wrote:

> Yes!!! This is amazing and things like this can expose Guile to many more
> people. Even though I've been using Emacs for many years, I believe it's
> not great for newcomers to hear "if you want a good Guile environment you
> can only use Emacs".

I agree. This is great, Ricardo :)

Personally, I'd like to see Guile support in GNOME Builder some day 
(https://builder.readthedocs.io/en/latest/plugins/langserv.html).

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Indentation with inline comments in Emacs

2022-04-18 Thread Luis Felipe
On Monday, April 18th, 2022 at 1:33 PM, Ricardo G. Herdt  
wrote:

> actually the doc-strings are available during runtime using '(ice-9
> documentation)', so theoretically it is not restricted to Emacs. In fact
> I have been working on my spare time on a LSP server for scheme
> (together with a emacs-lsp and a VS Code extension), and documentation
> of guile functions was quite straight-forward to implement. It's not yet
> ready for prime time though.

That sounds great.

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Indentation with inline comments in Emacs

2022-04-18 Thread Luis Felipe
On Monday, April 18th, 2022 at 10:48 AM, Zelphir Kaltstahl 
 wrote:

> I like the documentation style in the doc string you are proposing. Not sure I
> will always go to that length myself, but it would probably be a good 
> practice.
> Just like you said, for generating auto-generating things like API docs. Btw.:
> What is the standard tool in the Guile ecosystem to do that from doc strings
> like yours?

None that I know of :)

But I see there are pieces around that could make it possible to generate 
documentation [semi]automatically:

+ procedure-documentation
  (https://www.gnu.org/software/guile/manual/guile.html#Procedure-Properties)

+ (scheme documentation) module from guile-lib
  (https://www.nongnu.org/guile-lib/doc/ref/scheme.documentation/)

+ (ice-9 documentation) module
  
(https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/documentation.scm)

+ guild doc-snarf command
  (although this one doesn't generate any output when passing a module with 
docstrings)


> Also thanks for the C-c C-d C-d hint. I did not know the shortcut.

You're welcome :)

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Indentation with inline comments in Emacs

2022-04-17 Thread Luis Felipe
Hi Zelphir,

On Sunday, April 17th, 2022 at 10:49 AM, Zelphir Kaltstahl 
 wrote:

> I have the same indentation issue though, when I use #||# comments for
> arguments, which are not keyword arguments, but I want to hint what they are
> used for. One could argue, that I should rewrite the called function to use
> keyword arguments, or, if it is a library function, I should wrap it. Hmmm.
> Maybe that's a valid point.

Or document the function and its parameter using a documentation string 
(docstring) instead of comments? This way, you or the users of your code can 
read that documentation with Emacs Geiser.

For instance:

(define (get-field record field)
  "Get the value of FIELD from RECORD.

  RECORD (Guile Record or SRFI 9 Record)
A record of any type.

  FIELD (Symbol)
The name of the field.

  RETURN VALUE (Anything)
The value of the field.

  If the FIELD does not exist, a no-such-field exception is raised."
  (let* [(descriptor (record-type-descriptor record))
 (access-field (record-accessor descriptor field))]

(access-field record)))

Then, in Emacs, when calling this procedure, you would place the caret in 
get-field, press C-c C-d C-d, and Emacs would show its documentation in a 
buffer.

That's my documentation style, though, which is not conventional, but just an 
example.

Using documentation string is also useful if you later want to [auto]generate 
API documentation.

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


[WISH] Picture language: Improve editability of generated SVG

2022-04-07 Thread Luis Felipe
Hi,

After reading the home page of the project, I understand this may be out of the 
scope, but I'm enjoying this tool and would enjoy it even more if the objects 
in the generated SVGs were easier to edit (in Inkscape, for example).

So, the following may be already known, but I'll explain just in case.

Take this program for example:

~~~
(use-modules (pict))

(define hat (triangle 20 20))
(define hat-pile
  (vc-append (hc-append hat hat)
 (hc-append hat hat)))

(pict->file hat-pile "hat-pile.svg")
~~~

In the resulting SVG, the hat objects are deeply nested one into each other, 
which makes it hard to select them individually. For example, to select the 
bottom-right hat, one has to double-click hats minus one times to get to it. 
Also, once you select an object, you can't move it around nor rotate it.

In (Dr)Racket, for example, the resulting hats would be all into one group; 
ungrouping lets them all readily available for edition. For example:

~~~
(require 2htdp/image)

(define hat (triangle 20 "solid" "orange"))
(define hat-pile
  (above (beside hat hat)
 (beside hat hat)))

(save-svg-image hat-pile "racket-hat-pile.svg")
~~~

Best,

---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: guile-gi: Using Gtk.show_uri and application:get-active-window

2022-03-24 Thread Luis Felipe
On Friday, March 11th, 2022 at 11:59 PM, Luis Felipe 
 wrote:

> Hi, I want to display the help of an application on Yelp when users click on 
> "MenuButton → Help" or when they press F1. I already have the relevant 
> actions connected to a procedure that looks like this:
> 

> (define (on-help action app)
> #| Show application manual in Yelp. |#
> (let [(window (get-active-window app))]
> 

> (show-uri window "help:geteka" CURRENT_TIME)))

I "moved" this question to Guile-GI (see 
https://github.com/spk121/guile-gi/issues/122).


publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: guile-gi: Using Gtk.show_uri and application:get-active-window

2022-03-12 Thread Luis Felipe
On Friday, March 11th, 2022 at 11:59 PM, Luis Felipe 
 wrote:

> Hi, I want to display the help of an application on Yelp when users click on 
> "MenuButton → Help" or when they press F1. I already have the relevant 
> actions connected to a procedure that looks like this:
> 

> (define (on-help action app)
> 

> #| Show application manual in Yelp. |#
> 

> (let [(window (get-active-window app))]
> 

> (show-uri window "help:geteka" CURRENT_TIME)))
> 

> [...]
> 

> Also, I don't know whether I'm using the CURRENT_TIME constant correctly. It 
> is part of GDK 4 (GDK_CURRENT_TIME),² which I also required in my module.

Not only CURRENT_TIME, but also "show_uri", which is a GTK function. How do I 
use these symbols? Just like that, without any prefix?

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


guile-gi: Using Gtk.show_uri and application:get-active-window

2022-03-11 Thread Luis Felipe
Hi, I want to display the help of an application on Yelp when users click on 
"MenuButton → Help" or when they press F1. I already have the relevant actions 
connected to a procedure that looks like this:

(define (on-help action app)
  #| Show application manual in Yelp. |#
  (let [(window (get-active-window app))]

(show-uri window "help:geteka" CURRENT_TIME)))

This fails, however, because there is "No applicable method for generic 
get-active-window", even though I have required GTK 4 and loaded GtkApplication 
by name.¹ Like so:

(require "Gtk" "4.0")
(load-by-name "Gtk" "Application")

This is the backtrace:

#+begin_example
Backtrace:
In ice-9/boot-9.scm:
  1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
   9 (apply-smob/0 #)
In ice-9/boot-9.scm:
724:2  8 (call-with-prompt _ _ #)
In ice-9/eval.scm:
619:8  7 (_ #(#(#)))
In ice-9/boot-9.scm:
   2835:4  6 (save-module-excursion _)
  4380:12  5 (_)
In geteka.scm:
 21:8  4 (_)
In unknown file:
   3 (application:run #< 7f881910d780> ("ge…"))
In geteka/views.scm:
79:16  2 (on-help _ _)
In oop/goops.scm:
  1567:11  1 (cache-miss #f)
   1585:2  0 (_ _ _)

oop/goops.scm:1585:2: No applicable method for #< get-active-window 
(1)> in call (get-active-window #f)
#+end_example 


Also, I don't know whether I'm using the CURRENT_TIME constant correctly. It is 
part of GDK 4 (GDK_CURRENT_TIME),² which I also required in my module.

For what it's worth, here's the complete code: 
https://gitlab.com/luis-felipe/geteka


1. https://docs.gtk.org/gtk4/method.Application.get_active_window.html
2. https://docs.gtk.org/gdk4/const.CURRENT_TIME.html

---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: understanding guile-gi

2022-01-16 Thread Luis Felipe
On Sunday, January 16th, 2022 at 1:37 PM, Zelphir Kaltstahl 
 wrote:

> Which things are part of GTK and which things are part of Gnome? Currently my
> picture is: GTK contains all the GUI things and Gnome the data things. For
> example: GTK might contain some date picker dialog or popup or whatever, but 
> the
> datatype for date itself would be part of Gnome. "GDate". As such Gnome 
> provides
> a sort of common datatypes basis, which could be used by other frameworks as
> well (and maybe is?).

Maybe this can serve as an overview of where is everything:

For generic GTK apps (not necessarily targeted at GNOME): 
https://www.gtk.org/docs/apis/

For GTK apps that integrate well with GNOME: 
https://developer.gnome.org/documentation/introduction/components.html

Also, for new projects, if you would like your app to adapt well to different 
screens, like modern web apps do, maybe take a look at libhandy 
(https://gnome.pages.gitlab.gnome.org/libhandy/) and libadwaita 
(https://gnome.pages.gitlab.gnome.org/libadwaita/doc/). The latter, if I 
understand correctly will replace the former.

Also, note that Glade (https://glade.gnome.org/) only supports GTK 3, and there 
doesn't seem to be any plans to support GTK 4, so people seem to be writing 
GUIs by hand in GTK 4 projects.

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: understanding guile-gi

2022-01-16 Thread Luis Felipe
Hi

On Sunday, January 16th, 2022 at 1:37 PM, Zelphir Kaltstahl 
 wrote:

> guile-gi – I think this stands for "Guile Gnome(?) Introspection"?

It's GObject Introspection: https://gi.readthedocs.io/en/latest/

Many libraries become available through GI, not only GTK.

> And finally: Is my expectation correct, that I will be able to make GTK 
> applications using Guile, if I learn to use guile-gi?

Yes.

For what it's worth I did an attempt to get a minimal GTK app in Python and 
Guile running (https://gitlab.com/luis-felipe/geteka).

>From that exercise, though, I had to choose Python for my current desktop app 
>project, because I found it easier to make progress. But I'd like to try again 
>with Guile knowing what I've learned with Python.

publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: backing out of debugger

2021-09-14 Thread Luis Felipe
On Tuesday, September 14th, 2021 at 1:27 PM, Mortimer Cladwell 
 wrote:

> Thanks Luis. What about in emacs/geiser where Ctrl-D won't work?

The equivalent in Geiser would be C-c C-q, I think. But I don't know if that's 
any better than typing ,q plus Enter :)



Re: backing out of debugger

2021-09-14 Thread Luis Felipe
Hi, Mortimer,

On Tuesday, September 14th, 2021 at 12:50 PM, Mortimer Cladwell 
 wrote:

> Hi,
>
> Let's say I made a lot of mistakes. I look at my repl and see:
>
> scheme@(guile-user) [10]>
>
> Any way to back out to scheme@(guile-user)> without typing ,q ten times?

I don't know if there is a command for that, but maybe pressing Ctrl+D several 
times is easier than typing ,q several times?



Re: Simple list of key-value pairs?

2021-07-08 Thread Luis Felipe
Hi,

On Thursday, July 8th, 2021 at 2:37 PM, Hartmut Goebel 
 wrote:

> Anyhow, I'm wondering whether the
>
> quite and quasiquote can be replaced by something simpler.

> (api-uri "https://ci.guix.gnu.org"; "/api/jobs")
>
> (api-uri "https://ci.guix.gnu.org"; "/api/jobs"
>
>      `("nr" ,limit)      `("evaluation" ,evaluation)
>
>      `("system" ,#f))

Would it be simpler to create the pairs like this?

(cons "nr" limit)
(cons "evaluation" evaluation)
(cons "system" #false)



Re: srfi-64 tests passing when they should not

2021-05-06 Thread Luis Felipe
On Thursday, May 6, 2021 11:16 AM, Taylan Kammer  
wrote:

> On 05.05.2021 15:47, Luis Felipe wrote:
>
> > Hi Taylan,
> > On Wednesday, May 5, 2021 6:39 AM, Taylan Kammer taylan.kam...@gmail.com 
> > wrote:
> >
> > > 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 SRFI-64 (which is what Guile ships)
> > > doesn't seem to be written very well.
> > > I have an alternative implementation here, if you're interested:
> > > https://github.com/TaylanUB/scheme-srfis
> > > I'm not sure if the newest Guile is able to run it out of the box
> > > though. You might have to create some .scm symlinks to the .sld files.
> >
> > For what it's worth, I know about your implementation for a long time, but 
> > I've never tried to use it because I don't know where to start. Is it not 
> > possible to package these libraries so that users can simply install them 
> > as any other guile library? Say:
> > $ guix install r7rs-srfi-64
> > I see that Guile can be run with the "--r7rs" option "to better support 
> > R7RS"...
>
> Hmm, I had hoped that with the newest Guile, simply adding the repo's
> root directory to the load path would work, at least when invoked with
> the --r7rs switch, but it seems that Guile still chokes on library name
> parts that are integers. That's an incompatibility with r7rs that's not
> mentioned in the manual.

Ah, good to know.


> I guess the only way to make the modules work is to rename all the files
> and change the library names to not use integer parts.
>
> Maybe I'll make a guile-compatible standalone package for the SRFI-64
> implementation, since that's the most fancy thing in that repo.
>
> I might do it in the following days since I'm on a vacation, but... the
> vacation is supposed to be a vacation. :-) Work has been really burning
> me out in the last year.

Yeah, you should not work on vacation.


> If someone else feels like trying: all you have to do is rename .sld
> files to .scm, change the integer parts of the module names to symbols
> (e.g. s64 instead of 64), and rename the directory '64' accordingly.

That helps. I might even try it myself, thanks.

(But, really, at least for me, it would be ideal to have these libraries 
packaged.)



Re: srfi-64 tests passing when they should not

2021-05-05 Thread Luis Felipe
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 
> > 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 SRFI-64 (which is what Guile ships)
> doesn't seem to be written very well.
>
> I have an alternative implementation here, if you're interested:
>
> https://github.com/TaylanUB/scheme-srfis
>
> I'm not sure if the newest Guile is able to run it out of the box
> though. You might have to create some .scm symlinks to the .sld files.

For what it's worth, I know about your implementation for a long time, but I've 
never tried to use it because I don't know where to start. Is it not possible 
to package these libraries so that users can simply install them as any other 
guile library? Say:

$ guix install r7rs-srfi-64

I see that Guile can be run with the "--r7rs" option "to better support R7RS"...



Re: Guile-GI: : Setting parameter type to None or NULL

2021-04-25 Thread Luis Felipe
On Monday, April 26, 2021 12:16 AM, Mike Gran  wrote:

> Well, um, the truth is that the conversion of values of type GVariant
> to SCM was never implemented. I went ahead and made that fix and
> pushed it into guile-gi master branch. With the fix (and after
> importing TextBuffer and TextView) clicking on "Say hello!" does set
> the main window to "hello" which I believe is what is intended.
>
> Unforunately it may take time to write the unit test and then get a
> new guile-gi release over to Guix.
>
> Apologies,

No problem, Mike, thanks for working on it.




Re: Guile-GI: : Setting parameter type to None or NULL

2021-04-25 Thread Luis Felipe
On Sunday, April 25, 2021 8:44 PM, Mike Gran  wrote:

> In this form, you'd do the following. Leaving out the #:parameter-type
> from the constructor sets it to to its default of what Python would
> call None.
>
> (make  #:name "about")

Thanks for checking, Mike. I'm actually doing this (omitting #:parameter-type), 
but then, when I run the application and interact with something in the GUI 
that should trigger an action, I get the following error, and the appropriate 
callbacks are never run:

Backtrace:
In ice-9/boot-9.scm:
  1736:10  7 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
   6 (apply-smob/0 #)
In ice-9/boot-9.scm:
718:2  5 (call-with-prompt _ _ #)
In ice-9/eval.scm:
619:8  4 (_ #(#(#)))
In ice-9/boot-9.scm:
   2806:4  3 (save-module-excursion _)
  4351:12  2 (_)
In geteka.scm:
153:8  1 (_)
In unknown file:
   0 (application:run #< 7f367819b5e0> ("ge…"))

ERROR: In procedure application:run:
In procedure gig_value_to_scm: unknown type "GVariant"


I thought that maybe this could be related to not specifying 
#:paramenter-type... So I don't understand what I'm doing wrong. This is the 
application I'm trying to write:

https://gitlab.com/luis-felipe/geteka/-/blob/master/geteka.scm

The actions and connections are defined in the "app:activate" and "app:startup" 
procedures.



Guile-GI: : Setting parameter type to None or NULL

2021-04-25 Thread Luis Felipe
Hello again,

I want to add actions to an application but I can't seem to find the correct 
value to indicate that no parameter should be passed to a handler.

In Python, for example, I do this:

  action = Gio.SimpleAction.new("about", None)

In Guile, I'm doing it like this for now:

  (let [(action (make «GSimpleAction» #:name "about"))
...]

...)

But what I need to indicate is:

  (make «GSimpleAction» #:name "about" #:parameter-type None)

So what's the equivalent to None in Guile?


Any help is very welcome,


---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/



Re: Guile-GI: builder:new-from-file: Segmentation fault

2021-04-25 Thread Luis Felipe
On Saturday, April 24, 2021 10:47 PM, Mike Gran  wrote:

> On Sat, Apr 24, 2021 at 08:46:08PM +0000, Luis Felipe wrote:
>
> > Hi,
> > I'm trying to learn some Guile-GI, but I just hit a segfault. I was
> > trying to create a GTK Builder from a file:
>
> Hello.
> GTK needs to be initialized before builder can be used
>
> (use-modules (gi) (gi repository))
> (require "Gio" "2.0")
> (require "Gtk" "3.0")
> (load-by-name "Gtk" "Builder")
> (load-by-name "Gtk" "init")
> (init!)
> (builder:new-from-file "app.ui")
>
> Another way to initialize is to use the trio of
> application:new, connect, and run.
>
> Hope this helps,

It does! Thank you Mike.



Guile-GI: builder:new-from-file: Segmentation fault

2021-04-24 Thread Luis Felipe
Hi,

I'm trying to learn some Guile-GI, but I just hit a segfault. I was trying to 
create a GTK Builder from a file:


$ guile
GNU Guile 3.0.5
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 conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules (gi) (gi repository))
scheme@(guile-user)> (require "Gio" "2.0")
scheme@(guile-user)> (require "Gtk" "3.0")
scheme@(guile-user)> (load-by-name "Gtk" "Builder")
$1 = (translation-domain builder:translation-domain value-from-string-type! 
builder:value-from-string-type! value-from-string! builder:value-from-string! 
set-translation-domain builder:set-translation-domain set-application 
builder:set-application get-type-from-name builder:get-type-from-name 
get-translation-domain builder:get-translation-domain get-objects 
builder:get-objects get-object builder:get-object get-application 
builder:get-application extend-with-template builder:extend-with-template 
expose-object builder:expose-object connect-signals-full 
builder:connect-signals-full connect-signals builder:connect-signals 
add-objects-from-string builder:add-objects-from-string 
add-objects-from-resource builder:add-objects-from-resource 
add-objects-from-file builder:add-objects-from-file add-from-string 
builder:add-from-string add-from-resource builder:add-from-resource 
add-from-file builder:add-from-file add-callback-symbol 
builder:add-callback-symbol builder:new-from-string builder:new-from-resource 
builder:new-from-file builder:new )
scheme@(guile-user)> (builder:new-from-file "app.ui")

(process:13659): Gtk-CRITICAL **: 15:12:12.366: 
_gtk_style_provider_private_get_settings: assertion 
'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:13659): Gtk-CRITICAL **: 15:12:12.366: 
_gtk_style_provider_private_get_settings: assertion 
'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:13659): Gtk-CRITICAL **: 15:12:12.366: 
_gtk_style_provider_private_get_settings: assertion 
'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
Violación de segmento


I don't have a GitHub account (https://github.com/spk121/guile-gi), so I'm 
reporting here instead.

This is the UI file I used: https://luis-felipe.gitlab.io/downloads/temp/app.ui.

I'm on Guix System, using guile-gi 0.3.1.


---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/



Re: Very Small Atom Feed Reader

2016-03-06 Thread Luis Felipe López Acevedo

On 2016-03-06 09:12, Amirouche Boubekki wrote:

Héllo,



Hi, Amirouche :)



I share with you this small *atom* feed reader which works from
command line. Create a ~/.prime.txt file with the address of atom
files you want to follow and then run the script.



I tried it and it works with my atom feed. But my posts in Spanish and 
other languages that use non-ASCII characters don't display correctly. 
For example, I get titles like "Danza de Salomé", but it should be 
"Danza de Salomé". This is my atom feed in Spanish: 
http://sirgazil.bitbucket.org/es/blog/activity.atom.




The problem I have is that it fails on wingolog and others but I'm
accepting patches ;)


FWIW, atom feeds generated by Tekuti 
(https://wingolog.org/projects/tekuti/) used to fail for me too, not 
long ago, using different readers (Liferea, for example). It seems to be 
something that comes and goes. I initially had intermittent errors 
reported by Liferea when reading Wingo's and Nala's feeds, but they are 
working normally now (I'm using Liferea).



--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/



Re: Using libnotify from Guile

2016-01-04 Thread Luis Felipe López Acevedo

On 2016-01-04 13:26, Neil Jerram wrote:

Hi Luis,

I noticed you asked about libnotify on IRC; unfortunately I wasn't 
quick

enough before you left the channel, but I had a quick play and found
that it was quite easy to generate a notification using the FFI:


Oh, great Neil! Thank you very much. It works for me :)

--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/



Re: [ANN] Guile-SDL2 0.1.0 released

2015-12-22 Thread Luis Felipe López Acevedo

On 2015-12-22 15:11, Thompson, David wrote:

Hello Guilers,

I am pleased to announce the first release of Guile-SDL2, pure Guile
Scheme bindings to the SDL2 game programming library.  Guile-SDL2 not
only provides low-level bindings to the SDL2 C API, it also provides a
high-level, more Schemey interface for happier hacking.  In addition
to bindings for the core SDL2 API, bindings for the SDL2_image,
SDL2_mixer, and SDL2_ttf extension libraries are also available.


Awesome! Thanks, David!


--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/



Re: [ANN] gzochi project development release 0.8

2015-04-19 Thread Luis Felipe López Acevedo

On 2015-04-19 16:44, Julian Graham wrote:

Hi everyone,

I'm pleased to announce the eighth development release of the gzochi
game development framework.


Great! I didn't even know about gzochi. You should add it to the list 
projects:


https://www.gnu.org/software/guile/gnu-guile-projects.html

And maybe package it for GuixSD, GNU's Advanced System Distribution:

http://www.gnu.org/software/guix/

I'm bookmarking gzochi now :)


--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/



Re: How do I run a whole test suite with Guile's default test runner

2015-03-18 Thread Luis Felipe López Acevedo

On 2015-03-18 17:17, taylanbayi...@gmail.com wrote:

Luis Felipe López Acevedo  writes:


Hi,

I'm learning to program in Guile Scheme and currently reading and
practicing unit testing with SRFI-64.

How do I make the default test runner in Guile run my whole test
suite? I put all tests in a tests directory (see
<https://bitbucket.org/sirgazil/guilelab/src>).

Thanks,


The way you wrote that file, the test suite will be run when you load
the module.  Instead, you could wrap all those top-level forms (sans 
the

module declaration) in some kind of 'main' procedure.



Yeah, loading the module is what I currently use to run the tests in one 
file, but that won't be convenient when I add more modules and tests. I 
thought that maybe there was something like Python's test discovery, 
where you run `$ python -m unittest` and it will find all the tests 
instead of loading files individually by hand.


Maybe I'll try using a main procedure as you suggest.



And for what it's worth, I have an arguably cleaner implementation of
SRFI-64 here, but it's an R7RS library so it won't work out-of-the-box
on Guile yet: https://gitorious.org/taylan-scheme/srfi/

Taylan


Thanks, Taylan :)

--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/



How do I run a whole test suite with Guile's default test runner

2015-03-18 Thread Luis Felipe López Acevedo

Hi,

I'm learning to program in Guile Scheme and currently reading and 
practicing unit testing with SRFI-64.


How do I make the default test runner in Guile run my whole test suite? 
I put all tests in a tests directory (see 
<https://bitbucket.org/sirgazil/guilelab/src>).


Thanks,

--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/