Eval with local environment?

2017-08-19 Thread Christopher Howard
I was just curious: Is there something you can pass to eval procedure
that using the local environment? e.g.,

(let ((foo 12)) (eval 'foo (this-environment)))

to get it to return 12. Of course, you could just

(let ((foo 12)) foo)

But suppose you were working with the identifier 'foo instead for some
reason. All I saw in docs was interaction-environment and null-
environment.

signature.asc
Description: This is a digitally signed message part


Guile Release Signing Key?

2017-09-15 Thread Christopher Howard
Hi, I'm in the habit of checking release signatures before I install
from source. I see in the Download area there are signatures for each
of the Guile releases, but I can't seem to find the right public key. I
imported the project key chain and then (re?)imported the keys listed
for each of the project admins, but no luck.


-- 
Christopher Howard
Computer Assistant
Alaska Satellite Internet
3239 La Ree Way
Fairbanks, Alaska 99709
1-888-396-5623
https://alaskasatelliteinternet.com
personal web site: https://qlfiles.net
https://emailselfdefense.fsf.org/en/




signature.asc
Description: This is a digitally signed message part


Guile Release Signing Key?

2017-09-15 Thread Christopher Howard
Hi, I'm in the habit of checking release signatures before I install
from source. I see in the Download area there are signatures for each
of the Guile releases, but I can't seem to find the right public key. I
imported the project key chain and then (re?)important the keys listed
for each of the project admins, but no luck.


-- 
Christopher Howard
Computer Assistant
Alaska Satellite Internet
3239 La Ree Way
Fairbanks, Alaska 99709
1-888-396-5623
https://alaskasatelliteinternet.com
personal web site: https://qlfiles.net
https://emailselfdefense.fsf.org/en/




signature.asc
Description: This is a digitally signed message part


Listing request: guile-aa-tree module

2017-09-14 Thread Christopher Howard
Hello, I am making a request to have my new module listed on . The project name is Guile AA
Tree, which is of course an AA tree implementation available at

https://savannah.nongnu.org/projects/guile-aa-tree/

Advantages:
- immutable search, insert, and delete operations
- Convenient nested-list operations
- Unambiguous copyleft licensing
- Documentation included
- Unit tests included ("make tests")

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Re: Listing request: guile-aa-tree module

2017-09-16 Thread Christopher Howard
On Sat, 2017-09-16 at 14:25 +0200, Ludovic Courtès wrote:
> Hello,
> 
> Christopher Howard <christopher.how...@qlfiles.net> skribis:
> 
> > Hello, I am making a request to have my new module listed on
> >  > ww.gnu.org/software/guile/libraries/>. The project name is Guile AA
> > Tree, which is of course an AA tree implementation available at
> > 
> > https://savannah.nongnu.org/projects/guile-aa-tree/
> 
> Could you send a patch against
> <https://git.savannah.gnu.org/cgit/guile/guile-web.git>?
> 
> The libraries are listed at
> <https://git.savannah.gnu.org/cgit/guile/guile-web.git/tree/website/a
> pps/base/libraries-page.scm#n64>.
> 
> TIA!
> 
> Ludo’.
> 
> 

Is this what you need (attached)?

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/
diff --git a/website/apps/base/libraries-page.scm b/website/apps/base/libraries-page.scm
index c6108f7..688e216 100644
--- a/website/apps/base/libraries-page.scm
+++ b/website/apps/base/libraries-page.scm
@@ -322,6 +322,17 @@ for GNU Guile programs.  It is a wrapper to the underlying
 ;;; Tools implemented with Guile.
 ;;;
 
+(define aatree
+  (package #:name "Guile AA Tree"
+   #:description "Guile AA tree implementation. AA trees are
+self-balancing binary trees, which ensure O(log n) worst case
+performance for core operations. The module provides non-mutating
+insert, delete, and search operations, with support for convenient
+nested tree operations."
+   #:url "http://savannah.nongnu.org/projects/guile-aa-tree;
+   #:tags '("Guile 2.2")
+   #:license "GPL 3 or later"))
+
 (define aiscm
   (package #:name "AIscm"
#:description "Guile numerical arrays and tensor extension.
@@ -376,7 +387,7 @@ compression. It is written in C and Scheme, with Guile 2.0 bindings."
 (define (%packages-tools)
   "These projects are tools for or implemented with Guile. Mostly, these are
 the types of things that automate documentation or code generation."
-  (list aiscm autogen guix libchop))
+  (list aatree aiscm autogen guix libchop))
 
 
 ;;;


signature.asc
Description: This is a digitally signed message part


Re: SRFIs

2017-09-18 Thread Christopher Howard
Do the SRFIs typically require any C hacking? It seems in Guile there
is usually a C function for each built-in scheme function, but I'm not
sure how that applies to SRFIs.

On Mon, 2017-09-18 at 16:49 +0200, Ludovic Courtès wrote:
> Hello Christopher,
> 
> Christopher Howard <christopher.how...@qlfiles.net> skribis:
> 
> > Hi, I was just wondering if Guile developers are planning to
> > implement
> > all the SRFIs eventually, or if they are just picking and choosing
> > a
> > few here and there? Put another way, is it just a matter of someone
> > volunteering the time to do each SRFI, or are some not being done
> > on
> > purpose?
> 
> I can’t think of any SRFI being purposefully ignored, so I think it’s
> mostly a matter of someone volunteering to do the work.
> 
> Ludo’.
> 
-- 
Christopher Howard
Computer Assistant
Alaska Satellite Internet
3239 La Ree Way
Fairbanks, Alaska 99709
1-888-396-5623
https://alaskasatelliteinternet.com
personal web site: https://qlfiles.net
https://emailselfdefense.fsf.org/en/




signature.asc
Description: This is a digitally signed message part


Re: Comparison operators for strings /and/ numbers?

2017-09-18 Thread Christopher Howard
On Thu, 2017-08-24 at 10:05 +0200, David Kastrup wrote:
> Christopher Howard <christopher.how...@qlfiles.net> writes:
> 
> > Hi, in another lisp I have been working with, it has <, >, and ==
> > (structure equality) operators which can take string arguments,
> > number
> > arguments, or a mixture of both. But it seems in guile that there
> > are
> > separate comparison operators for strings and for numbers. This
> > makes
> > sense but is not very convenient for my present purpose. Is there
> > some
> > other guile operators or extension operators that will handle both?
> > I
> > could make some I'm sure, but I don't want to reinvent the wheel.
> 
> (use-modules (oop goops))
> 
> (define-method (< (a ) . rest)
>   (apply string 
> (< "g" "b") ;; => #f
> 

Forgive me for bring this thread back, but I just finished reading the
goops info manual...

My question, specifically: Suppose:

1) I use fn "<" in my module, as a goops generic, and then
2) somebody else "use"s my module in their module, and then
3) suppose they do a "define-method" to create another "<" for a new
datatype
4) they call a function in my module that uses "<"

Will that function call have access to the new method for that generic?

Background: This would obvious be very important in a module providing
a generic data structure (like a binary tree), where you would want to
compare keys using "<", but you wouldn't want to arbitrarily limit the
possible data types to what was defined in the module.

Or do I need to define an  class and expose that to my module
users? I'm thinking in terms like Data.Ord class from Haskell. (Java
folks would call it an "interface".)

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Re: procedure docstrings / documentation

2017-09-23 Thread Christopher Howard
No thoughts related to this subject?

On Wed, 2017-09-20 at 16:18 -0800, Christopher Howard wrote:
> Is there any convention on content/formatting for a procedure
> docstring? E.g., should I repeat the procedure name and arguments?
> Should I insert newlines to maintain a certain text width?
> 
> I'm not really clear on how document is done in Guile, overall. I see
> Gieser has ways to look up documention for some procedures/modules,
> but
> it doesn't seem to pull that information from the docstring, at least
> not my docstrings.
> 
-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


procedure docstrings / documentation

2017-09-20 Thread Christopher Howard
Is there any convention on content/formatting for a procedure
docstring? E.g., should I repeat the procedure name and arguments?
Should I insert newlines to maintain a certain text width?

I'm not really clear on how document is done in Guile, overall. I see
Gieser has ways to look up documention for some procedures/modules, but
it doesn't seem to pull that information from the docstring, at least
not my docstrings.

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


SRFIs

2017-09-17 Thread Christopher Howard
Hi, I was just wondering if Guile developers are planning to implement
all the SRFIs eventually, or if they are just picking and choosing a
few here and there? Put another way, is it just a matter of someone
volunteering the time to do each SRFI, or are some not being done on
purpose?

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Re: Interactive programming with Event Loop?

2017-10-06 Thread Christopher Howard
Thanks, I implemented what you described a few days ago and it has been
working well for me. Just two notes for posterity:

- I recommend starting the app inside a separate (non-emacs) terminal,
and then connecting to that from inside emacs with geiser. If you let
lots of stdout/stderr get dumped to an emacs buffer, it slows your
computer down to a crawl.
- As you mentioned to me personally, one has to use trampolines for
hooks to make this programming approach work.

On Fri, 2017-10-06 at 09:01 -0400, Thompson, David wrote:
> Hello Christopher,
> 
> On Sat, Sep 30, 2017 at 1:23 AM, Christopher Howard
> <christopher.how...@qlfiles.net> wrote:
> > Hi, I want to code a game using theChickadee framework, but I want
> > to
> > do it in an interactive programming environment, where I can
> > evaluate
> > things in the REPL while the Chickadee kernel is running, rather
> > than
> > needing to restart the kernel after each modification. The
> > Chickadee
> > kernel runs update hooks every so many milliseconds, so I think I
> > just
> > need to figure out a way to communicate code to an update hook,
> > that it
> > could execute. What would be the simplest and/or most sensible way
> > to
> > do this? (Threads? IPC? Communicate to a network port?)
> 
> Mark is right that a cooperative REPL server is the answer here.  We
> both worked on that feature a few years ago for exactly this purpose.
> 
> Here is a simple example program that has a REPL server added in:
> 
> (use-modules (chickadee)
>  (chickadee math vector)
>  (chickadee render sprite)
>  (chickadee render texture)
>  (system repl coop-server))
> 
> (define sprite #f)
> (define repl #f)
> 
> (define (load)
>   (set! sprite (load-image "images/chickadee.png"))
>   (set! repl (spawn-coop-repl-server)))
> 
> (define (draw alpha)
>   (draw-sprite sprite (vec2 256.0 176.0)))
> 
> (define (update dt)
>   (poll-coop-repl-server repl))
> 
> (add-hook! load-hook load)
> (add-hook! update-hook update)
> (add-hook! draw-hook draw)
> (add-hook! quit-hook abort-game)
> 
> (run-game)
> 
> Once the program is running, you can connect to the REPL server over
> a
> tcp socket on port 37146.  If you use Geiser, which I highly
> recommend, just run `M-x connect-to-guile` and use the default
> connection settings.
> 
> Hope this helps,
> 
> - Dave
> 
-- 
Christopher Howard
Enterprise Solutions Manager
Alaska Satellite Internet
3239 La Ree Way
Fairbanks, Alaska 99709
1-888-396-5623
https://alaskasatelliteinternet.com
personal web site: https://qlfiles.net
https://emailselfdefense.fsf.org/en/




signature.asc
Description: This is a digitally signed message part


Enter REPL inside catch...?

2017-10-06 Thread Christopher Howard
Is it possible when catching an exception to enter the REPL, so that
after you continue (",q") the code just keeps running at the point
after the catch?

-- 
https://creation.com/

signature.asc
Description: This is a digitally signed message part


Goops: Setting Immutible Classes?

2017-10-06 Thread Christopher Howard
Hi, is the a way I could use goops such that I the classes are non-
mutating, but have setters that simply return a new instance of the
class (instead of modifying the original)?

I suppose I could simply use define-method to create setter methods
which create a new instance of the object; but that would get rather
complicated, wouldn't it, if the object had superclasses? So I need
some kind of shallow copy mechanism for the whole object, or a chained
copy mechanism...?

-- 
https://www.debian.org/

signature.asc
Description: This is a digitally signed message part


Compiling - won't use from site-dir?

2017-09-12 Thread Christopher Howard
Hi, as reading in guile manual section "Modules and the File System", I
installed my-module.scm to %site-dir and then my-module.go to %site-
dir. But when I run guile interpreter and use-modules my-module, it
ignores that one, and instead acts as though the cache in my home
directory is the only place to get compiled modules. So it will compile
the .go file into my cache even if one is in the %site-dir already.

I tried naming it my-module.scm.go instead, but same results.

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Re: Compiling - won't use from site-dir?

2017-09-13 Thread Christopher Howard
On Wed, 2017-09-13 at 10:41 +0100, Chris Vine wrote:
> On Tue, 12 Sep 2017 20:05:54 -0800
> Christopher Howard <christopher.how...@qlfiles.net> wrote:
> 
> > Hi, as reading in guile manual section "Modules and the File
> > System",
> > I installed my-module.scm to %site-dir and then my-module.go to
> > %site-
> > dir. But when I run guile interpreter and use-modules my-module, it
> > ignores that one, and instead acts as though the cache in my home
> > directory is the only place to get compiled modules. So it will
> > compile the .go file into my cache even if one is in the %site-dir
> > already.
> > 
> > I tried naming it my-module.scm.go instead, but same results.
> 
> This bit of the documentation should help: "As with Scheme files,
> Guile
> searches a path to find compiled .go files, the %load-compiled-path.
> By
> default, this path has two entries: a path for Guile’s files, and a
> path for site packages. You should install your .go files into the
> latter directory, whose value is returned by invoking the
> %site-ccache-dir procedure. As in the previous example, if Guile 2.2
> is
> installed on your system in /usr/, then (%site-ccache-dir) site
> packages will be /usr/lib/guile/2.2/site-ccache"
> 
> Chris
> 

Thank you very much for your help. That is just what I needed, and it
works correctly.

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Re: procedure docstrings / documentation

2017-09-25 Thread Christopher Howard
On Sun, 2017-09-24 at 00:47 +, tantalum wrote:
> * i don't repeat the procedure name and parameter names because that
> can 
> be queried at run-time or automatically extracted
> 

On this particular point: how do you query the parameter names at run-
time? Or do those have to be extracted from the source?

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Interactive programming with Event Loop?

2017-09-29 Thread Christopher Howard
Hi, I want to code a game using theChickadee framework, but I want to
do it in an interactive programming environment, where I can evaluate
things in the REPL while the Chickadee kernel is running, rather than
needing to restart the kernel after each modification. The Chickadee
kernel runs update hooks every so many milliseconds, so I think I just
need to figure out a way to communicate code to an update hook, that it
could execute. What would be the simplest and/or most sensible way to
do this? (Threads? IPC? Communicate to a network port?)

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Self balancing trees

2017-08-21 Thread Christopher Howard
Hello, where do I find a self-balancing tree structure to use with
guile? I'm new to guile, but I can't seem to find what I'm looking for
in the guile info document, or in the gnu guile library collection.

signature.asc
Description: This is a digitally signed message part


Re: Self balancing trees

2017-08-21 Thread Christopher Howard
On Tue, 2017-08-22 at 07:31 +0300, Marko Rauhamaa wrote:
> Christopher Howard <christopher.how...@qlfiles.net>:
> 
> > Hello, where do I find a self-balancing tree structure to use with
> > guile? I'm new to guile, but I can't seem to find what I'm looking
> > for
> > in the guile info document, or in the gnu guile library collection.
> 
> If you can't find anything else, here's mine:
> 
>    http://pacujo.net/~marko/avl-tree.scm
> 
> 
> Marko

Thank you! This looks very helpful! However, there is too much code
here for me to use it without an explicit license. Would you please let
me know under which license you are releasing the code?

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


scsh or similar?

2017-08-26 Thread Christopher Howard
Hi, I was intrigued by the idea of replacing my default shell with some
scheme based shell. I guess there used to be something call scsh but it
hasn't been maintained in years. Has some other project taken the
baton? Or would I have to resurrect scsh myself?

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Comparison operators for strings /and/ numbers?

2017-08-24 Thread Christopher Howard
Hi, in another lisp I have been working with, it has <, >, and ==
(structure equality) operators which can take string arguments, number
arguments, or a mixture of both. But it seems in guile that there are
separate comparison operators for strings and for numbers. This makes
sense but is not very convenient for my present purpose. Is there some
other guile operators or extension operators that will handle both? I
could make some I'm sure, but I don't want to reinvent the wheel.

-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


underscores in debug output?

2017-08-30 Thread Christopher Howard
Hi, what does the underscore character mean in this debug output?

   159:37  5 (delete ((3 . "c") (((2 . "b") (()) 1) (5 . "e") (()) 1)
2) 2)
   163:49  4 (delete ((2 . "b") (()) 1) _)
152:9  3 (delete _ _)
86:11  2 (skew _)
 64:6  1 (horizontal-left-link? _)
46:11  0 (left-tree _)

Knowing the value of those parameters would be super helpful here, but
for some reason they have been replaced by underscores.




Re: underscores in debug output?

2017-08-30 Thread Christopher Howard
Ok, okay. Is there some way to affect that? Perhaps I have to use some
debug printing or stop points to see those values?

On Wed, 2017-08-30 at 22:46 +0800, Alex Vong wrote:
> Christopher Howard <ch.how...@zoho.com> writes:
> 
> > Hi, what does the underscore character mean in this debug output?
> > 
> >    159:37  5 (delete ((3 . "c") (((2 . "b") (()) 1) (5 . "e") (())
> > 1)
> > 2) 2)
> >    163:49  4 (delete ((2 . "b") (()) 1) _)
> > 152:9  3 (delete _ _)
> > 86:11  2 (skew _)
> >  64:6  1 (horizontal-left-link? _)
> > 46:11  0 (left-tree _)
> > 
> > Knowing the value of those parameters would be super helpful here,
> > but
> > for some reason they have been replaced by underscores.
> 
> My guess would be that those values are being garbage-collected.
> Since _
> is the pattern for matching an arbitary value, it is used to denote a
> garbage-collected value.
-- 
https://qlfiles.net
https://emailselfdefense.fsf.org/en/


signature.asc
Description: This is a digitally signed message part


Re: underscores in debug output?

2017-08-30 Thread Christopher Howard
Ok, okay. Is there some way to affect that? Perhaps I have to use some
debug printing or stop points to see those values?

On Wed, 2017-08-30 at 22:46 +0800, Alex Vong wrote:
> Christopher Howard <ch.how...@zoho.com> writes:
> 
> > Hi, what does the underscore character mean in this debug output?
> > 
> >    159:37  5 (delete ((3 . "c") (((2 . "b") (()) 1) (5 . "e") (())
> > 1)
> > 2) 2)
> >    163:49  4 (delete ((2 . "b") (()) 1) _)
> > 152:9  3 (delete _ _)
> > 86:11  2 (skew _)
> >  64:6  1 (horizontal-left-link? _)
> > 46:11  0 (left-tree _)
> > 
> > Knowing the value of those parameters would be super helpful here,
> > but
> > for some reason they have been replaced by underscores.
> 
> My guess would be that those values are being garbage-collected.
> Since _
> is the pattern for matching an arbitary value, it is used to denote a
> garbage-collected value.




Re: underscores in debug output?

2017-08-30 Thread Christopher Howard
Ok, okay. Is there some way to affect that? Perhaps I have to use some
debug printing or stop points to see those values?

On Wed, 2017-08-30 at 22:46 +0800, Alex Vong wrote:
> Christopher Howard <ch.how...@zoho.com> writes:
> 
> > Hi, what does the underscore character mean in this debug output?
> > 
> >    159:37  5 (delete ((3 . "c") (((2 . "b") (()) 1) (5 . "e") (())
> > 1)
> > 2) 2)
> >    163:49  4 (delete ((2 . "b") (()) 1) _)
> > 152:9  3 (delete _ _)
> > 86:11  2 (skew _)
> >  64:6  1 (horizontal-left-link? _)
> > 46:11  0 (left-tree _)
> > 
> > Knowing the value of those parameters would be super helpful here,
> > but
> > for some reason they have been replaced by underscores.
> 
> My guess would be that those values are being garbage-collected.
> Since _
> is the pattern for matching an arbitary value, it is used to denote a
> garbage-collected value.




Re: Repeat syntax

2017-11-25 Thread Christopher Howard
On Sat, 2017-11-25 at 07:06 -0800, Matt Wette wrote:
> > On Nov 25, 2017, at 6:47 AM, Matt Wette 
> > wrote:
> > 
> > you probably want named let
> > 
> > ((_ n exp exp* ...)
> > (let loop ((n n))
> > (unless (<= n 0)
> >    exp exp* ...
> >    (loop (1- n)))
> 
> but not a broken one
> 
> ((_ n exp exp* ...)
>  (let loop ((cnt n))
>    (unless (<= cnt 0)
>   exp exp* ...
>   (loop (1- cnt)
> 

I want both the looping and the expression evaluation to be happening
at run time. The target is to repeat the side effects of the
expressions n times, and the return values are irrelevant.

I think this last submission from Matt does exactly what I want, the
full version being

(define-syntax repeat
  (syntax-rules ()
((_ n exp exp* ...)
 (let loop ((cnt n))
   (unless (<= cnt 0)
 exp exp* ...
 (loop (1- cnt)))

scheme@(guile-user)>  (repeat 10 (display "la\n"))
la
la
la
la
la
la
la
la
la
la

The part that confuses me a little is why

(repeat 10 (display cnt))

doesn't break it. Must be that magical hygiene mentioned in the info page.

-- 
https://worldenglishbible.org/

signature.asc
Description: This is a digitally signed message part


Repeat syntax

2017-11-24 Thread Christopher Howard
Hi list, I want to have a function

  (repeat n exp exp* ...)

That calls the expressions n times for side effect, like for-each, but
without the bother of dealing with a list. It seems like somebody else
must have thought of this before, but I couldn't find the equivalent
procedure. After reading 6.10.2 I came up with this

(define-syntax repeat
  (syntax-rules (repeat)
((_ n exp exp* ...)
 '(unless (<= n 0)
   exp
   exp*
   ...
   (repeat (- n 1) exp exp* ...)

Which doesn't work I think because repeat gets expanded infinitely many
times. I was pondering other ways to do this, but they all seem to end
in either infinite expansion, or an important variable getting
overshadowed. So, could somebody point me in the right direction?

-- 
https://emailselfdefense.fsf.org/en/

signature.asc
Description: This is a digitally signed message part


Re: Signals / Messages / Events / ...?

2018-01-03 Thread Christopher Howard
On Wed, 2018-01-03 at 11:53 +, Neil Jerram wrote:
> 
> Well, one Lispy mechanism in that area is hooks.  For example, from
> some 
> of my old code:
> 
> ;; Changes to modem registration state are indicated by calling this
> ;; hook with args STATE and PROPERTIES.  STATE can be 'none, meaning
> ;; that there is currently no modem; 'unregistered, meaning that
> there
> ;; is a modem but it isn't registered with the network; or
> ;; 'registered, meaning that the modem is registered with the
> network.
> ;; If STATE is 'registered, PROPERTIES is an alist of registration
> ;; properties; otherwise PROPERTIES is #f.
> (define registration-hook (make-hook 2))
> 
> (define (add-registration-hook proc)
>    (add-hook! registration-hook proc))
> 
> (define (notify-registration state properties)
>    (run-hook registration-hook state properties))
> 
> Does that serve your purpose at all?
> 
> Best wishes - Neil
> 
> 

I think that should work. Only part I'm not sure about is if you can
have a "one-off" procedure added to a hook... but you could just have
the procedure call remove-hook! to remove itself...?

-- 
https://www.debian.org/

signature.asc
Description: This is a digitally signed message part


Signals / Messages / Events / ...?

2018-01-02 Thread Christopher Howard
Hi list, forgive me if this is a somewhat vague question... but is
there some kind of framework/system/approach for Guile where you could
have different parts of your code register callback functions to react
to a certain signal or message raised by any other part of the code?
I'm thinking like dbus where I guess you can sort of send off a message
but not really care who receives it. In chickadee you can register
callbacks for the various input events, and i think that basic idea
could be extended so long as (1) you could have any kind of
event/signal you wanted; (2) call backs added could be specified as
either persistent or one-time call-backs.

It seems like it wouldn't be too hard to code something like that with
just lists of callback functions tied to names/data in a tree. But
maybe somebody has already thought of that or would suggest a better
approach.

Just running into this challenge in development where a function like
"new-game" has to do 8 different things to 6 different data structures,
but why not instead just have the code dealing with the 6 different
objects register callbacks to receive the 'new-game signal? I think
message passing is the wrong term because in message passing you
specify the message connections between the different objects, right?
Signal bus maybe?

-- 
http://upgradefromwindows.com

signature.asc
Description: This is a digitally signed message part


Interactive Debugging

2019-10-17 Thread Christopher Howard
Hi, it seems like with the flexibility of Guile, I should be able to do
something like this:
```(define (foo)  (let ((a 1)(b 2)(c 3))(jump-into-
debugging-repl)))```
And have access to a, b, and c and their values. But I'm not quite
figuring out how to this.
I know from 6.26.3.2 that it possible to throw an error and capture the
error stack, but I don't know how you turn that error stack into a
repl, if you get what I'm trying to say.
>From poking around in the source code, I found (system repl repl) and
related modules. (start-repl) does throw me into a repl, but without
debug information. start-repl has a #:debug key, but I can't figure out
what I'm suppose to pass to it.
I can do something like this, with a break:
```(define (foo)  (let ((a 1)(b 2)(c
3))(bp)(display "done!")))
(define (bp)  '())```
But I'm not sure how to get to those locals:
```scheme@(buffer cbuff)> ,break bpTrap 1: Breakpoint at #.scheme@(guile-user)> (foo)Trap 1: Breakpoint at #Entering a new prompt.  Type `,bt' for a backtrace or `,q' to
continue.scheme@(guile-user) [1]> ,btIn current input:700:4  1
(foo)703:0  0 (bp)scheme@(guile-user) [1]> ,locals  No local
variables.scheme@(guile-user) [1]> ,upIn current input:700:4  1
(foo)scheme@(guile-user) [1]> ,locals  No local variables.```

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social feed: https://gnusocial.club/librehacker
xmpp: creation...@member.fsf.org
otr: E9685B53 01F038DD D29281C9 30FDA71E BD0095D4
gnupg: 23FD5CC5 (keys.gnupg.net)
radio: KL1TL
featured: https://u.fsf.org/user-liberation


Interactive Debugging

2019-10-17 Thread Christopher Howard
Hi, it seems like with the flexibility of Guile, I should be able to do
something like this:
```(define (foo)  (let ((a 1)(b 2)(c 3))(jump-into-
debugging-repl)))```
And have access to a, b, and c and their values. But I'm not quite
figuring out how to this.
I know from 6.26.3.2 that it possible to throw an error and capture the
error stack, but I don't know how you turn that error stack into a
repl, if you get what I'm trying to say.
>From poking around in the source code, I found (system repl repl) and
related modules. (start-repl) does throw me into a repl, but without
debug information. start-repl has a #:debug key, but I can't figure out
what I'm suppose to pass to it.
I can do something like this, with a break:
```(define (foo)  (let ((a 1)(b 2)(c
3))(bp)(display "done!")))
(define (bp)  '())```
But I'm not sure how to get to those locals:
```scheme@(buffer cbuff)> ,break bpTrap 1: Breakpoint at #.scheme@(guile-user)> (foo)Trap 1: Breakpoint at #Entering a new prompt.  Type `,bt' for a backtrace or `,q' to
continue.scheme@(guile-user) [1]> ,btIn current input:700:4  1
(foo)703:0  0 (bp)scheme@(guile-user) [1]> ,locals  No local
variables.scheme@(guile-user) [1]> ,upIn current input:700:4  1
(foo)scheme@(guile-user) [1]> ,locals  No local variables.```

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social feed: https://gnusocial.club/librehacker
xmpp: creation...@member.fsf.org
otr: E9685B53 01F038DD D29281C9 30FDA71E BD0095D4
gnupg: 23FD5CC5 (keys.gnupg.net)
radio: KL1TL
featured: https://u.fsf.org/user-liberation


Re: Interactive Debugging

2019-10-18 Thread Christopher Howard
> 
> Define dump-into-debugging-repl as
> 
> (start-repl #:debug (make-debug (stack->vector (make-stack #t)) 0 
> "trap!" #t))
> 
> But as for getting access to locals I don't know if there is a 
> solution.   I have worked on removing slot sharing in the CPS
> processing 
> but it's not working and I probably won't work on it anytime soon.
> 
> Apparently the best option for debugging is to use guile-1.8.
> 
> Matt
> 
> 

For posterity: the required modules are

```
(use-modules (system repl repl)
 (system repl debug))
```

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social feed: https://gnusocial.club/librehacker
xmpp: creation...@member.fsf.org
otr: E9685B53 01F038DD D29281C9 30FDA71E BD0095D4
gnupg: 23FD5CC5 (keys.gnupg.net)
radio: KL1TL
featured: https://answersingenesis.org/



Re: Interactive Debugging

2019-10-19 Thread Christopher Howard


> Below is something I played with years ago.  I'm not sure kill-opt is
> up to date.   Try with
>
>
>   > (load "jtd.scm")
>   > (foo)
>   [1]> ,loc

The code seems to evaluate fine, but does not produce useful results:

```
scheme@(guile-user)> ,use (potluck jtd)
scheme@(guile-user)> (foo)
scheme@(guile-user) [1]> ,loc
While executing meta-command:
Wrong type (expecting string): #f
scheme@(guile-user) [1]> ,locals
  No local variables.
```



srfi-64 apathetic test-error

2019-10-22 Thread Christopher Howard
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?


-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social feed: https://gnusocial.club/librehacker
xmpp: creation...@member.fsf.org
otr: E9685B53 01F038DD D29281C9 30FDA71E BD0095D4
gnupg: 23FD5CC5 (keys.gnupg.net)
radio: KL1TL
featured: https://answersingenesis.org/


Exception on Hang?

2019-10-14 Thread Christopher Howard
Hi, I was planning to use 8sync as a framework for an SDR project,
modeling my program after the Actor Model. I was wondering if there is
some trick to make code raise an exception if it runs for too long. I
was worried about one poorly programmed Actor getting stuck in a non-
yielding loop or non-yielding i/o block, and freezing all the other
actors in that OS process.


-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social feed: https://gnusocial.club/librehacker
xmpp: creation...@member.fsf.org
otr: E9685B53 01F038DD D29281C9 30FDA71E BD0095D4
gnupg: 23FD5CC5 (keys.gnupg.net)
radio: KL1TL
featured: https://www.defectivebydesign.org


Re: resolving anonymous procedures in statprof

2020-03-01 Thread Christopher Howard
What, none of the Great Ones know the answer to this? Surely I can't be
the first to have anonymous functions in statprof'd code.

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social: https://gnusocial.club/librehacker
gpg: ADDEAADE5D607C8D (keys.gnupg.net)

On Fri, 2020-02-28 at 05:24 -0900, Christopher Howard wrote:
> Hi, Guile's statprof utility is very helpful, but a lot of my output
> lines point to anonymous procedures like "anon #x1db7d38". Is there a
> way to figure out which specific lambdas those are referring to? In
> principle it seems like I should be able to figure that out by
> running
> the dissembler (,x) on the code I am profiling with statprof, but the
> addresses given by the dissassembler do not match the ones given by
> statprof.
> 




resolving anonymous procedures in statprof

2020-02-28 Thread Christopher Howard
Hi, Guile's statprof utility is very helpful, but a lot of my output
lines point to anonymous procedures like "anon #x1db7d38". Is there a
way to figure out which specific lambdas those are referring to? In
principle it seems like I should be able to figure that out by running
the dissembler (,x) on the code I am profiling with statprof, but the
addresses given by the dissassembler do not match the ones given by
statprof.

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social: https://gnusocial.club/librehacker
gpg: ADDEAADE5D607C8D (keys.gnupg.net)




Unsafe Conversions and Inlining

2020-02-22 Thread Christopher Howard
Hi, I'm doing a project with SDR involving a lot of number crunching,
as SDR usually does, with Guile 3.0 embedded in a C application. Of
course,  the idea is to have the C functions handle the low-level
number crunching. But it some places it is difficult to get around
performance hits from required scheme conversions, e.g.: scheme
bytevector -> scheme pointer -> C pointer. Of course, working on
reducing those, but wondering...

(1) Do I have any options for unsafe conversions, e.g., some guile
library out there which would convert bytevector to C pointer without
typechecking?

(2) Is there anything I can do as far as inlining those core conversion
functions that might be useful?

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social: https://gnusocial.club/librehacker
gpg: ADDEAADE5D607C8D (keys.gnupg.net)




Incomplete backtrace

2020-03-14 Thread Christopher Howard
I think there are others here better qualified to answer your question,
but maybe one helpful thing: have you read the Guile Implementation
section of the Guile Reference Manual? In subsection "A Virtual Machine
for Guile" there is this paragraph:

'''
Note that once a value in a local variable slot is no longer needed,
Guile is free to re-use that slot.  This applies to the slots that were
initially used for the callee and arguments, too.  For this reason,
backtraces in Guile aren’t always able to show all of the arguments: it
could be that the slot corresponding to that argument was re-used by
some other variable.
'''

I do not know if there is a way to disable slot reuse, for debugging
purposes. Anyone...?

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social: https://gnusocial.club/librehacker
gpg: ADDEAADE5D607C8D (keys.gnupg.net)


> 
> Why do I not see the exact place where the problem is? Why are there
> underscores instead? Why do I not even see that the error originated
> in
> test.scm? I can't find any explanation about this in the manual.
> 
> While this code was extracted from a bigger program and it's obvious
> where
> the problem is, it was super hard to figure it out in the original
> program.
> Because the backtrace actually doesn't even point in the right place,
> it's
> quite useless in my opinion.
> 
> Am I doing anything wrong? I use guile 3.0.1.
> 
> Regards,
> -- 
> Jan Synacek
> Software Engineer, Red Hat
> 
> 




How best to produce a standalone executable with Guile?

2020-04-05 Thread Christopher Howard
Are you a Guix user? One you come up with a Guix package definition, it
is I think a one line command to generate an exportable executable with
a full dependency chain included, or a docker image.

-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social: https://gnusocial.club/librehacker
gpg: ADDEAADE5D607C8D (keys.gnupg.net)

On Sun, 2020-04-05 at 12:00 -0400, guile-user-requ...@gnu.org wrote:
> Send guile-user mailing list submissions to
>   guile-user@gnu.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://lists.gnu.org/mailman/listinfo/guile-user
> or, via email, send a message with subject or body 'help' to
>   guile-user-requ...@gnu.org
> 
> You can reach the person managing the list at
>   guile-user-ow...@gnu.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of guile-user digest..."
> 
> 
> Today's Topics:
> 
>1. How best to produce a standalone executable with Guile?
>   (James Cooper)
>2. Re: How best to produce a standalone executable with Guile?
>   (Matt Wette)
> 
> 
> ---
> ---
> 
> Message: 1
> Date: Sun, 5 Apr 2020 05:28:10 +
> From: James Cooper 
> To: guile-user@gnu.org
> Subject: How best to produce a standalone executable with Guile?
> Message-ID:
>   <
> CAB_RW2E5s7Wd4yRA81OcaGLtGoFsvjOR1hCGhD=w7ec4fhr...@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
> 
> Hi Guile folks,
> 
> I am currently experimenting with a handful of languages that include
> modern implementations of Concurrent ML, to determine which one
> appears
> best able to handle computationally- and message-heavy workloads (at
> least
> for my purposes, Computer Vision).  Guile is one of the languages I
> am
> trying out with the Fibers library.
> 
> My question is, how can I best go about creating Linux executables
> from
> Guile, where said programs benefit from the most ahead-of-time
> compilation
> and optimisation possible?  I don't believe they strictly need to be
> standalone, as the environment I will be running the programs in will
> likely be the same as the development environment. So they can
> undoubtedly
> have dependencies on external libraries.  Furthermore, I am perfectly
> happy
> with the process being a bit convoluted, as I can easily automate it
> with a
> makefile.  I would, however, prefer if at all possible that the
> option to
> target other processor architectures remains available down the line
> (I
> assume using GCC can enable this, but I'm not sure).
> 
> I have looked at all the sections of the Guile manual that appeared
> relevant, but to be honest I'm still a bit confused about what the
> best
> approach would be.  *s* *9.4.5 Bytecode* in the manual seems to
> suggest
> that one can use guild to produce what will be a standalone
> executable that
> looks like an ELF binary to the system and runs on the Guile VM, but
> I'm
> entirely sure if I am reading it correctly.  *s 6.18.5 Compiling
> Scheme
> Code* also discusses compilation but seems to denounce the practice
> explicitly.  *s 9.3.8 Just-In-Time Native Code* talks about JIT
> compilation
> to native code for a given target.  Is it possible to apply this
> process
> ahead-of-time?
> 
> A potential alternative approach I can see is using the capabilities
> of
> running Guile code in a C program (compiled with GCC).  This would
> presumably involve creating a template C program that just calls the
> appropriate Guile functions and passes the relevant command line
> parameters
> in.
> 
> Any thoughts on what would likely produce the most efficient
> executable in
> the end?  The target programs do not need to modify themselves at
> run-time
> (or really do anything dynamic) if that makes a difference.  And does
> anyone know of pre-existing examples they could point me to?  Please
> do let
> me know if there is further information I could provide that would
> help.
> Thanks in advance.
> 
> Regards,
> 
> James
> 
> 
> --
> 
> Message: 2
> Date: Sun, 5 Apr 2020 07:44:18 -0700
> From: Matt Wette 
> To: guile-user@gnu.org
> Subject: Re: How best to produce a standalone executable with Guile?
> Message-ID: 
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> On 4/4/20 10:28 PM, James Cooper wrote:
> > Hi Guile folks,
> > 
> > I am currently experimenting with a handful of languages that
> > include
> > modern implementations of Concurrent ML, to determine which one
> > appears
&