Where it is right now:
use Inline::Guile; my $g = Inline::Guile.new; say $g.run_i('(+ 3 7)'); # 10 say $g.run_s('"boo"'); # 'boo'
Where it will go soon:
say $g.run('(+ 3 7)'); say $g.run('"boo"');
After Slang::Guile has been written:
use Slang::Guile; guile-sub car( $x ) { car $x } guile-sub cdr( $x ) { cdr $x } use Test; is car <a b c>, 'a'; is-deeply [ cdr <a b c> ], ['b', 'c'];
I've already figured out how to write the helper code for most of this. Writing the C glue code at compile time using Perl 6 will let me share constants between C, Guile and Perl 6. Two problems I can foresee with this are that strings will need to be surrounded with dynwind-protect so that they don't leak from the Guile interpreter, and I don't think the NativeCall array types support arbitrarily-recursive arrays, I.E. CArrayInt is just a flat array of entries. I can solve this by passing back a typed array of int32s like so:
(3 "a" (7 9) "after") => ( INTEGER, 3, STRING, "a", START-LIST, Nil, INTEGER, 7, INTEGER, 9, EN +D-LIST, Nil, STRING, "after" )
so that everything is returned in a homogeneous data structure, and it's up to the Perl 6 layer to unswizzle this back to:
is-deeply \$g.run(q{'(3 "a" (7 9) "after")}), [ 3, "a", [ 7, 9 ], "after" ];
Hopefully I'll have time around FOSDEM to put this all together.

Replies are listed 'Best First'.
Re: Introducing Scheme In Perl 6
by DrForr (Beadle) on Jan 28, 2016 at 19:14 UTC
    Multiple (single) values are a thing now, so:
    is-deeply [ $g.run( q{(values 3 2 1)} ) ], [ 3, 2, 1 ];
    now DTRT. (Multiple return values in Scheme are kind of like a function returning a list of values rather than an arrayref, and that's exactly how the Perl 6 side is implemented.) After a nap at the hotel (FOSDEM upcoming) I'll get lists working, then it's on to the more fun types. Both Perl 6 and Scheme implement complex types in core, so.... Mandelscheme or Perlbrot, anyone?