Re: and-let* is not composable?

2013-10-05 Thread Ian Price
Panicz Maciej Godek  writes:


> presentation of Racket macro
> system, http://www.infoq.com/presentations/racket,
> where he points to a quite good introduction to "define-syntax" macros
> by Greg Hendershott: http://www.greghendershott.com/fear-of-macros/

I was also made aware of it recently, it seems like a fine introduction,
and I had even considered mentioning it to you in this thread :) but...

> And now that my head is clearer on this regard, I think it is
> confusing
> to call them "syntax-case" macros, because "syntax-case" is rather
> auxiliary than essential for defining that sort of macro.
(This is mostly true, but it's been a conventional name for some 20 years :/)

> So I believe that at least placing a link to than explanation in the
> manual
> could be a great help for beginners.
... the problem is it makes a lot of references to Racket, and Racket
specific ways of doing things. Much of it can be fixed for Guile and
other Schemes, but you'd still need to gut around half of it.

There haven't been any patches yet, but that doesn't mean I haven't been
spending time thinking about all this :)

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"



Delimeted continuations for gule-log guile-prolog and kanren

2013-10-05 Thread Stefan Israelsson Tampe
Hi all,

Delimited continuations are a really nice feature in guile. I have now
implemented that
for guile-log and hence also for kanren and prolog. With it we can now do

(use-modules (logic guile-log))
(use-modules (logic guile-log umatch))

( (f)
  ( (i x) ( 'tag ( (i x) ( i x
  (
   ( (<=> x i)  (<=> x ,(+ i i)))
   ( (<=> x ,(- i)) (<=> x ,(- (+ i i))


( (test x y)
  ( 'tag #f f
( (tag next kk)
( ((k (kk)))
   ( (x (k 1  x))
  (y (k 10 y)))

( 10 (x y) (test x y))

--> $1 = ((1 10) (-1 -10) (2 20) (-2 -20))

--
This shows delimited continuations works in combination with interleaving
and zip constructs
(zip evaluates all it's argumets in parallell). And I claim that the
continuation is first class and can be used soundly everywhere above the
 construct. I documented it in the guile-log manual for anyone
interested in using this. To note is that this constructs is first class
and should work quite well with all features of guile-log e.g. It will work
well with zip like constructs, interleaving construct, postpone, storing
and restarting and all accumulator constructs. Also it is really efficient
in many ways and contains optimization for handling breath first search
with storing a huge number of continuation points in e.g. the postpone
construct.

There is published paper from this year about non first class continuations
in prolog ontop WAM.

Probably guile-log should be documented and published as a scientific
paper, anybody interested in mentoring such an effort?

I will continue with implementing iso-prolog next and then do a release.

Happy Hacking