guile-lib 0.2.2 released

2013-01-31 Thread Andy Wingo
I am pleased to announce that Guile-Lib 0.2.2 has been released. It
may be obtained at:

  http://download.savannah.gnu.org/releases/guile-lib/guile-lib-0.2.2.tar.gz

What is Guile-Lib
-

Guile-Lib is intended as an accumulation place for pure-scheme Guile
modules, allowing for people to cooperate integrating their generic
Guile modules into a coherent library. Think "a down-scaled,
limited-scope CPAN for Guile".

What's new
--

 * Install (texinfo nodal-tree) for Guile 2.0.

 * MD5 bugfixes.

 * Better errors in Apicheck.

Thanks to Daniel Hartwig.

Regards,

Andy
-- 
http://wingolog.org/



Public service announcement: avoid libgc 7.3 prereleases for now

2013-01-31 Thread Andy Wingo
Hi,

A quick note to ask people to avoid libgc 7.3 for the moment.  It
introduces a parallel marker by default that currently doesn't work well
with Guile.  We'll fix Guile to deal with it, but in the meantime libgc
7.2d is the best option currently.

Cheers,

Andy
-- 
http://wingolog.org/



Can somebody help to explain why result from atan does not equal a real?

2013-01-31 Thread Hengqing Hu
Dear list,

The following behavior is observed on both guile 1.8 and guile 2.0.
Is it correct?
Can somebody elaborate why it happens?

guile> (atan 0 -1)
3.14159265358979
guile> (= 3.14159265358979 3.14159265358979)
#t
guile> (= (atan 0 -1) 3.14159265358979)
#f

-- 
Best Regards, Hengqing Hu



Re: compile error on FreeBSD 9

2013-01-31 Thread Ludovic Courtès
z_axis  skribis:

> i have installed threaded libgc:
> $pkg_info | grep boehm-gc
> boehm-gc-7.1Garbage collection and memory leak detection for C
> and C++
> boehm-gc-threaded-7.1_1 Garbage collection and memory leak detection
> for C and C++

[...]

> $./configure --prefix=/home/***/guile --with-threads
> LDFLAGS='-L/usr/local/lib'
> $gmake
> ...
> 0x281d4ef4 is not a GC visible pointer location
> GC_is_visible test failed
> Abort trap

As others pointed out, using version 7.2 may work better, and disabling
thread support may also work better on FreeBSD 9.

Ludo’.



Re: Can somebody help to explain why result from atan does not equal a real?

2013-01-31 Thread Noah Lavine
What you have here is a precision problem.

When a floating-point number like pi is printed, I don't think you can
guarantee that the string representation will be read in the same way it
was read out. So when guile reads "3.14159265358979", it gives you some
floating point number that is *close to* what (atan 0 -1) returns, but not
necessarily the same.

That's why line 2 in your example returned #t - because both things were
read as the same number - but #f for line 3 - because (atan 0 -1) returns
something slightly different. You can see this in Guile 2.0:

scheme@(guile-user)> (atan 0 -1)
$7 = 3.14159265358979
scheme@(guile-user)> (= 3.14159265358979 (atan 0 -1))
$8 = #f
scheme@(guile-user)> (= $7 (atan 0 -1))
$9 = #t

It might be possible to have Guile print more digits and make this problem
go away.

Noah Lavine


On Thu, Jan 31, 2013 at 5:50 AM, Hengqing Hu  wrote:

> Dear list,
>
> The following behavior is observed on both guile 1.8 and guile 2.0.
> Is it correct?
> Can somebody elaborate why it happens?
>
> guile> (atan 0 -1)
> 3.14159265358979
> guile> (= 3.14159265358979 3.14159265358979)
> #t
> guile> (= (atan 0 -1) 3.14159265358979)
> #f
>
> --
> Best Regards, Hengqing Hu
>
>


Re: Can somebody help to explain why result from atan does not equal a real?

2013-01-31 Thread John Darrington
On Thu, Jan 31, 2013 at 08:32:53AM -0500, Noah Lavine wrote:
 What you have here is a precision problem.
 
 scheme@(guile-user)> (= 3.14159265358979 (atan 0 -1))
 $8 = #f
 scheme@(guile-user)> (= $7 (atan 0 -1))
 $9 = #t
 
 It might be possible to have Guile print more digits and make this problem
 go away.
 
 Noah Lavine

pi is an irrational number.  You would need an infinite number of digits 
wouldn't you?

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.



signature.asc
Description: Digital signature


Re: Can somebody help to explain why result from atan does not equal a real?

2013-01-31 Thread Noah Lavine
On Thu, Jan 31, 2013 at 9:50 AM, John Darrington <
j...@darrington.wattle.id.au> wrote:
>
> pi is an irrational number.  You would need an infinite number of digits
> wouldn't you?
>


Good point :-). All I meant was enough digits that it parsed as the same
floating-point number that (atan 0 -1) returns.

Noah Lavine


Re: [ANN] the Guile 100 Programs Project

2013-01-31 Thread Ludovic Courtès
Hi Mike,

Mike Gran  skribis:

> Hello.  I'm pleased to announce the upcoming Guile 100 Programs
> Project.

Very good initiative, sounds fun!

If you want we can add it to gnu.org/s/guile/news.html and/or Guile’s
RSS feed (which ends up on planet.gnu.org).

Ludo’.




First steps towards a window manager

2013-01-31 Thread Mark Witmer

Hi all,

I thought I'd follow up on my previous post regarding xlib and a guile
window manager.

First of all, I have guile-xlib working with guile-2.0; I'm calling my
branch "guile2-xlib." You can use git and pull it from
http://github.com/mwitmer/guile2-xlib or download an archive at
http://markwitmer.com/dist/guile2-xlib-0.1.tar.gz. I'm still toying with
the idea of writing some xcb bindings, time permitting!

As far as the window manager goes, you need very little code to get
started with something extremely basic. Here are a few lines that let
you open some X applications, though it lacks resizing/positioning
(guile-xlib doesn't support that... yet).

--8<---cut here---start->8---
(define-module (guile-wm wm)
  #:use-module (xlib xlib))

(define-once wm-display #f)
(define-once wm-display-string (or (getenv "DISPLAY") ":0"))
(define-once wm-event-hook (make-hook 1))

(define rc-file-location 
  (string-append (passwd:dir (getpw (getuid))) "/.guilewmrc"))

(define-public (wm-init!)
  "Connect to a running X server and begin listening for events"
  (set! wm-display (x-open-display! wm-display-string))
  (let ((wm-root (x-root-window wm-display)))
(x-select-input! wm-root (logior ButtonPressMask ExposureMask KeyPressMask))
(wm-event-hook-refresh)
(if (file-exists? rc-file-location) (load rc-file-location))
(dynamic-wind
  (lambda () (x-flush! wm-display))
  (lambda () (x-event-loop! wm-display wm-event-hook))
  (lambda () (x-close-display! wm-display)

(define-public (wm-event-hook-refresh)
  "Refresh the event hook with the hooks listed in wm-event-hooks"
  (reset-hook! wm-event-hook)
  (for-each (lambda (hook) (add-hook! wm-event-hook hook)) wm-event-hooks))

(define-public (wm-shell-command command)
  "Execute COMMAND in a shell"
  (if (= (primitive-fork) 0)
  (let ((env (cons 
  (format #f "DISPLAY=~a.~a" wm-display-string 
  (x-screen-number-of-screen (x-screen-of-display 
wm-display))) 
  (environ
(execle "/bin/sh" env "/bin/sh" "-c" command

;; guile-xlib doesn't have support for keysyms yet, so I just use raw
;; keycodes here
(define default-key-map
  `((24 . ,(lambda (event) (x-event-loop-quit! (x-event:button event
(26 ,wm-shell-command "emacs")
(28 ,wm-shell-command "xterm")))

(define (mapped-key-handler map)
  "Return a key handler that maps keycodes to commands"
  (lambda (event)
(if (= (x-event:type event) KeyPress) 
(let ((command (assq-ref map (x-event:keycode event
  (if command
(if (list? command) 
(apply (car command) (cdr command))
(command event)))

(define-public wm-event-hooks (list (mapped-key-handler default-key-map)))
--8<---cut here---end--->8---

You also need a startup script like this:

--8<---cut here---start->8---
(use-modules (guile-wm wm))
(wm-init!)
--8<---cut here---end--->8---

The fun part is that you can put a line like

guile --listen=37147 -L /path/to/module/.../ \
  /path/to/startup/script/wm.scm   

in your .xinitrc or xsession file, and then you can connect to that
listening process from Geiser or something like that and hack the wm
while it's running.

A lot of this is inspired by Stumpwm, a pretty nifty tiling wm written
in common lisp that's similarly configurable.

I'll put the wm code on github as well as I get more features
added. Feedback and suggestions are welcome!

Mark Witmer



Re: First steps towards a window manager

2013-01-31 Thread z_axis
That's a good start !  hope this guile WM will be more stable, fast and  
small compared with STUMPWM.
I ever reported a tiny stumpwm problem(  
http://stackoverflow.com/questions/13174207/cannot-use-keyboards-numpad-to-input-digit  
), but i havenot gotten answer now!


在 Fri, 01 Feb 2013 04:35:44 +0800,Mark Witmer   
写道:




Hi all,

I thought I'd follow up on my previous post regarding xlib and a guile
window manager.

First of all, I have guile-xlib working with guile-2.0; I'm calling my
branch "guile2-xlib." You can use git and pull it from
http://github.com/mwitmer/guile2-xlib or download an archive at
http://markwitmer.com/dist/guile2-xlib-0.1.tar.gz. I'm still toying with
the idea of writing some xcb bindings, time permitting!

As far as the window manager goes, you need very little code to get
started with something extremely basic. Here are a few lines that let
you open some X applications, though it lacks resizing/positioning
(guile-xlib doesn't support that... yet).

--8<---cut here---start->8---
(define-module (guile-wm wm)
  #:use-module (xlib xlib))

(define-once wm-display #f)
(define-once wm-display-string (or (getenv "DISPLAY") ":0"))
(define-once wm-event-hook (make-hook 1))

(define rc-file-location
  (string-append (passwd:dir (getpw (getuid))) "/.guilewmrc"))

(define-public (wm-init!)
  "Connect to a running X server and begin listening for events"
  (set! wm-display (x-open-display! wm-display-string))
  (let ((wm-root (x-root-window wm-display)))
(x-select-input! wm-root (logior ButtonPressMask ExposureMask  
KeyPressMask))

(wm-event-hook-refresh)
(if (file-exists? rc-file-location) (load rc-file-location))
(dynamic-wind
  (lambda () (x-flush! wm-display))
  (lambda () (x-event-loop! wm-display wm-event-hook))
  (lambda () (x-close-display! wm-display)

(define-public (wm-event-hook-refresh)
  "Refresh the event hook with the hooks listed in wm-event-hooks"
  (reset-hook! wm-event-hook)
  (for-each (lambda (hook) (add-hook! wm-event-hook hook))  
wm-event-hooks))


(define-public (wm-shell-command command)
  "Execute COMMAND in a shell"
  (if (= (primitive-fork) 0)
  (let ((env (cons
  (format #f "DISPLAY=~a.~a" wm-display-string
  (x-screen-number-of-screen (x-screen-of-display 
wm-display)))
  (environ
(execle "/bin/sh" env "/bin/sh" "-c" command

;; guile-xlib doesn't have support for keysyms yet, so I just use raw
;; keycodes here
(define default-key-map
  `((24 . ,(lambda (event) (x-event-loop-quit! (x-event:button event
(26 ,wm-shell-command "emacs")
(28 ,wm-shell-command "xterm")))

(define (mapped-key-handler map)
  "Return a key handler that maps keycodes to commands"
  (lambda (event)
(if (= (x-event:type event) KeyPress)
(let ((command (assq-ref map (x-event:keycode event
  (if command
(if (list? command)
(apply (car command) (cdr command))
(command event)))

(define-public wm-event-hooks (list (mapped-key-handler  
default-key-map)))

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

You also need a startup script like this:

--8<---cut here---start->8---
(use-modules (guile-wm wm))
(wm-init!)
--8<---cut here---end--->8---

The fun part is that you can put a line like

guile --listen=37147 -L /path/to/module/.../ \
  /path/to/startup/script/wm.scm

in your .xinitrc or xsession file, and then you can connect to that
listening process from Geiser or something like that and hack the wm
while it's running.

A lot of this is inspired by Stumpwm, a pretty nifty tiling wm written
in common lisp that's similarly configurable.

I'll put the wm code on github as well as I get more features
added. Feedback and suggestions are welcome!

Mark Witmer




--
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/




Re: First steps towards a window manager

2013-01-31 Thread David Thompson

On 01/31/2013 03:35 PM, Mark Witmer wrote:

Hi all,

I thought I'd follow up on my previous post regarding xlib and a guile
window manager.

First of all, I have guile-xlib working with guile-2.0; I'm calling my
branch "guile2-xlib." You can use git and pull it from
http://github.com/mwitmer/guile2-xlib or download an archive at
http://markwitmer.com/dist/guile2-xlib-0.1.tar.gz. I'm still toying with
the idea of writing some xcb bindings, time permitting!

As far as the window manager goes, you need very little code to get
started with something extremely basic. Here are a few lines that let
you open some X applications, though it lacks resizing/positioning
(guile-xlib doesn't support that... yet).

--8<---cut here---start->8---
(define-module (guile-wm wm)
   #:use-module (xlib xlib))

(define-once wm-display #f)
(define-once wm-display-string (or (getenv "DISPLAY") ":0"))
(define-once wm-event-hook (make-hook 1))

(define rc-file-location
   (string-append (passwd:dir (getpw (getuid))) "/.guilewmrc"))

(define-public (wm-init!)
   "Connect to a running X server and begin listening for events"
   (set! wm-display (x-open-display! wm-display-string))
   (let ((wm-root (x-root-window wm-display)))
 (x-select-input! wm-root (logior ButtonPressMask ExposureMask 
KeyPressMask))
 (wm-event-hook-refresh)
 (if (file-exists? rc-file-location) (load rc-file-location))
 (dynamic-wind
   (lambda () (x-flush! wm-display))
   (lambda () (x-event-loop! wm-display wm-event-hook))
   (lambda () (x-close-display! wm-display)

(define-public (wm-event-hook-refresh)
   "Refresh the event hook with the hooks listed in wm-event-hooks"
   (reset-hook! wm-event-hook)
   (for-each (lambda (hook) (add-hook! wm-event-hook hook)) wm-event-hooks))

(define-public (wm-shell-command command)
   "Execute COMMAND in a shell"
   (if (= (primitive-fork) 0)
   (let ((env (cons
  (format #f "DISPLAY=~a.~a" wm-display-string
  (x-screen-number-of-screen (x-screen-of-display 
wm-display)))
  (environ
(execle "/bin/sh" env "/bin/sh" "-c" command

;; guile-xlib doesn't have support for keysyms yet, so I just use raw
;; keycodes here
(define default-key-map
   `((24 . ,(lambda (event) (x-event-loop-quit! (x-event:button event
 (26 ,wm-shell-command "emacs")
 (28 ,wm-shell-command "xterm")))

(define (mapped-key-handler map)
   "Return a key handler that maps keycodes to commands"
   (lambda (event)
 (if (= (x-event:type event) KeyPress)
(let ((command (assq-ref map (x-event:keycode event
   (if command
(if (list? command)
(apply (car command) (cdr command))
(command event)))

(define-public wm-event-hooks (list (mapped-key-handler default-key-map)))
--8<---cut here---end--->8---

You also need a startup script like this:

--8<---cut here---start->8---
(use-modules (guile-wm wm))
(wm-init!)
--8<---cut here---end--->8---

The fun part is that you can put a line like

guile --listen=37147 -L /path/to/module/.../ \
   /path/to/startup/script/wm.scm

in your .xinitrc or xsession file, and then you can connect to that
listening process from Geiser or something like that and hack the wm
while it's running.

A lot of this is inspired by Stumpwm, a pretty nifty tiling wm written
in common lisp that's similarly configurable.

I'll put the wm code on github as well as I get more features
added. Feedback and suggestions are welcome!

Mark Witmer

Very cool. Writing a window manager in Guile has been something I've 
wanted to do. Good luck to you!




SLIB and guile 2

2013-01-31 Thread Andrew Bernard

Greetings,

Does SLIB work with guile 2?

With guile 2.0.7 and slib 3b3 on Linux there appear to be 
incompatibilities. Are there releases that work together?


Andrew





Re: Can somebody help to explain why result from atan does not equal a real?

2013-01-31 Thread Mark H Weaver
Hengqing Hu  writes:
> The following behavior is observed on both guile 1.8 and guile 2.0.
> Is it correct?
> Can somebody elaborate why it happens?
>
> guile> (atan 0 -1)
> 3.14159265358979
> guile> (= 3.14159265358979 3.14159265358979)
> #t
> guile> (= (atan 0 -1) 3.14159265358979)
> #f

Sorry, this is due to an inadequate 'number->string' implementation in
Guile.  A proper implementation should guarantee that when the string is
read back in, you'll get precisely the same number back, and recent
Scheme standards mandate this.  At present, Guile does not always print
enough digits to guarantee this.

I plan to soon rewrite Guile's 'number->string' based on "Printing
Floating-Point Numbers Quickly and Accurately" by Dybvig and Burger.
I recently started that work but became distracted by more pressing
matters.  I hope to get back to it soon.

Regards,
  Mark



Re: SLIB and guile 2

2013-01-31 Thread Mark H Weaver
Hi Andrew,

Andrew Bernard  writes:
> Does SLIB work with guile 2?
>
> With guile 2.0.7 and slib 3b3 on Linux there appear to be
> incompatibilities. Are there releases that work together?

Andy Wingo recently posted a patch to get slib working with Guile 2.0.
Hopefully a variant of it will be accepted upstream soon.

http://lists.gnu.org/archive/html/guile-user/2013-01/msg00014.html

 Mark



Re: Can somebody help to explain why result from atan does not equal a real?

2013-01-31 Thread Mark H Weaver
I wrote:
> Sorry, this is due to an inadequate 'number->string' implementation in
> Guile.

Having looked more closely, I see now that our 'string->number' is also
less precise than it should be.  I'll fix these issues soon.

Mark



Re: Public service announcement: avoid libgc 7.3 prereleases for now

2013-01-31 Thread Nala Ginrut
On Thu, 2013-01-31 at 11:48 +0100, Andy Wingo wrote:
> Hi,
> 
> A quick note to ask people to avoid libgc 7.3 for the moment.  It
> introduces a parallel marker by default that currently doesn't work well
> with Guile.  We'll fix Guile to deal with it, but in the meantime libgc
> 7.2d is the best option currently.
> 

And I even enabled parallel-marker with a happy feeling, which made me
the first victim. :-(

> Cheers,
> 
> Andy





Re: SLIB and guile 2

2013-01-31 Thread Jay Sulzberger




On Fri, 1 Feb 2013, Andrew Bernard  wrote:


Greetings,

Does SLIB work with guile 2?

With guile 2.0.7 and slib 3b3 on Linux there appear to be incompatibilities. 
Are there releases that work together?


Andrew


If you want, let us know how the patches offered by Andy Wingo work.

I hope to run more tests next week.  I have a working Guile-2
with SLIB, but some puzzles remain for me.

oo--JS.