Re: [Chicken-users] Some syntax help?

2015-05-02 Thread Daniel Leslie
 The incorrect code that CSC allows other things to work on:

This should have stated CSI.

-Dan

On Sat, May 2, 2015 at 8:01 AM, Dan Leslie d...@ironoxide.ca wrote:


 Hi Chickeners!

 Around two weeks ago I received a bug report that the monad egg wasn't
 working in CSC. This turned out to be the result of a syntax error, and
 though I've greatly simplified the syntax and narrowed the issue
 considerably, I find myself stuck in a corner while surrounded by wet
 paint.

 Working branch is here:
 https://github.com/dleslie/monad-egg/tree/compiler-import-bug

 The issue is thus: the egg does some heavy lifting of syntax transforms,
 and there exists a utility such that a user might bind new symbols while
 within the quoted syntax of a stack of transformers. It looks like this:

 (do state
   (/m! put 99)
   (x - (/m get))
   (return x))

 Which would expand to something similar to:

 (state-bind
   (state-put 99)
   (state-bind
 (state-get)
 (lambda (x)
   (state-unit x

 I think; it's early. ;)

 Anyhow, notice that the /m and /m! transforms occur within the do
 syntax; the do syntax transforms through do-using, %unroll-do-using, and
 finally to using; where they're defined dynamically within a quoted
 syntax block.

 Here's the wierdness: this works magnificently in CSI, but fails in CSC.

 Moreover, if I replace /m! with a broken variant then /m works great in
 both CSI and CSC! I know, it doesn't make much sense to me either. My
 best guess is that /m! failing somehow short-circuits a code path in the
 compiler and so allows /m to function as I expect.

 The correct code that CSC breaks on:

 https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L58-L61
 And test output:
 https://gist.github.com/71cc934fbc9fc7fa2d86

 The incorrect code that CSC allows other things to work on:

 https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L63-L66
 And test output:
 https://gist.github.com/d0c276f7ed243d79166b

 Any thoughts would be appreciated. :D

 Thanks!

 --
 -Dan Leslie

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Some syntax help?

2015-05-02 Thread Dan Leslie

Hi Chickeners!

Around two weeks ago I received a bug report that the monad egg wasn't
working in CSC. This turned out to be the result of a syntax error, and
though I've greatly simplified the syntax and narrowed the issue
considerably, I find myself stuck in a corner while surrounded by wet
paint.

Working branch is here:
https://github.com/dleslie/monad-egg/tree/compiler-import-bug

The issue is thus: the egg does some heavy lifting of syntax transforms,
and there exists a utility such that a user might bind new symbols while
within the quoted syntax of a stack of transformers. It looks like this:

(do state
  (/m! put 99)
  (x - (/m get))
  (return x))

Which would expand to something similar to:

(state-bind
  (state-put 99)
  (state-bind
(state-get)
(lambda (x)
  (state-unit x

I think; it's early. ;)

Anyhow, notice that the /m and /m! transforms occur within the do
syntax; the do syntax transforms through do-using, %unroll-do-using, and
finally to using; where they're defined dynamically within a quoted
syntax block.

Here's the wierdness: this works magnificently in CSI, but fails in CSC.

Moreover, if I replace /m! with a broken variant then /m works great in
both CSI and CSC! I know, it doesn't make much sense to me either. My
best guess is that /m! failing somehow short-circuits a code path in the
compiler and so allows /m to function as I expect.

The correct code that CSC breaks on:
https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L58-L61
And test output:
https://gist.github.com/71cc934fbc9fc7fa2d86

The incorrect code that CSC allows other things to work on:
https://github.com/dleslie/monad-egg/blob/compiler-import-bug/monad.scm#L63-L66
And test output:
https://gist.github.com/d0c276f7ed243d79166b

Any thoughts would be appreciated. :D

Thanks!

-- 
-Dan Leslie

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Termbox using

2015-05-02 Thread frad

Hi,

(Sorry for my English)

Newbie with Scheme, i try to use the termbox egg.
It seems me a very nice and cool library and the documentation helps me 
a lot.

I am learning Scheme and appreciate Chicken implementation.
Here a little piece of code to print a simple text menu.
But this code isn't in the functionnal way (very iterative).


(use termbox)
(init)

(define running (make-parameter #t))
(define choice 1)

(define (menu x y lst)
  (let loop ()
(if ( choice (length lst)) (set! choice 1))
(if ( choice 1) (set! choice (length lst)))
(do ((i 0 (+ i 1)))
((= i (length lst)))
(if (= choice (+ i 1))
(bprintf x (+ y i) (style black) (style white) (list-ref lst 
i))
(bprintf x (+ y i) (style white) (style black) (list-ref lst 
i

(present)
(poll (lambda (mod key ch)
  (cond
((eq? key key-arrow-down) (set! choice (+ choice 1)))
((eq? key key-arrow-up) (set! choice (- choice 1)))
((eq? key key-enter) (running #f
  (lambda (w h) (loop)))
(when (running) (loop

;; an example
(menu 5 8 '(Choice 1 Choice 2 Choice 3 Other))

(shutdown)

(printf Your choice: ~a\n choice)


Maybe, someone could give me some advices or corrections to make it 
better.


Regards,
  frad

http://blog.indexi.net






___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] MSYS2 as Windows build platform?

2015-05-02 Thread Matt Gushee
Hello, chickeneers--

As a by-product of my recent adventure in packaging Chicken for Windows, I
discovered MSYS2.

MSYS2 is an updated version of the venerable MSYS, with 64-bit support and
an optional MinGW environment, ported from mingw-w64. It offers a large
selection of packages, uses the Pacman package manager from Arch Linux, and
has pretty good documentation.

While I can't claim extensive experience with this project, it gave me a
very good impression. It seems well put-together - a bit more of a polished
and complete product than either the old MSYS or mingw-w64. The
documentation, while not very extensive, as far as I can tell is accurate,
up-to-date, and covers all the essential info you need in order to use the
system. And there seems to be a small but dedicated group of developers
working with the project.

So I think that MSYS2 may be a superior platform for developing with
Chicken on Windows, and I would encourage any of you Microsoftians to check
it out. So far I have been able to compile and install Chicken, and run
'csi' with no apparent problems in a standard Windows command shell; there
are some issues with using csc and chicken-install, but they seem to be
mostly related to problems with paths, so I imagine they can be worked out.

Let me know if you decide to try it out. There are a few simple but not
very obvious steps involved in getting to where I've gotten.

Here's the project homepage:

https://msys2.github.io/

And documentation:

http://sourceforge.net/p/msys2/wiki/Home/

--
Matt Gushee
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Some syntax help?

2015-05-02 Thread Dan Leslie

And thanks to your feedback the branch is now passing the available
tests.

Turns out that (syntax) was allowing the two-modules-in-one-file thing
to work. Taking that out caused... Problems. ;)

-- 
-Dan Leslie

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users