Re: [Chicken-users] UNLIST a list of lists!?

2015-01-05 Thread Patrick Li
Hi Bahman. "apply" is the standard way of doing what you're looking for. Cheers. -Patrick On Mon, Jan 5, 2015 at 10:25 AM, Bahman Movaqar wrote: > Happy 2015 CHICKEN'ers! > > I have a procedure which accepts a variable number of lists as the > arguments: > > (define (foobar . lists) ...) >

Re: [Chicken-users] Named let*

2013-05-29 Thread Patrick Li
On Wed, May 29, 2013 at 12:25 PM, Michele La Monaca < mikele.chic...@lamonaca.net> wrote: > On Wed, May 29, 2013 at 3:53 PM, Patrick Li > wrote: > > If I understand the OP correctly, he wants let* to imitate this macro. > > > > (define-syntax named-let* > >

Re: [Chicken-users] Named let*

2013-05-29 Thread Patrick Li
If I understand the OP correctly, he wants let* to imitate this macro. (define-syntax named-let* (syntax-rules () ((named-let* name ((var val) ...) body ...) (let* ((var val) ...) (let name ((var var) ...) body ...) -Patrick On Wed, May 29, 2013 at 5:47

Re: [Chicken-users] Environments as Modules

2011-03-24 Thread Patrick Li
Hi George! I can attest that writing your own scheme interpreter is fun and educational. I've had success trying out language design ideas with interpreters. I implemented a very simple heap-based interpreter, and tried out a similar idea to yours with no problem (but I was using environments as

Re: [Chicken-users] Help with writing a macro

2011-03-20 Thread Patrick Li
c some-more-args) (do-that a b c some-more-args) (do-other a b c some-more-args)) The dot trick doesn't work in this circumstance. -Patrick On Sun, Mar 20, 2011 at 10:36 PM, Thomas Chust wrote: > 2011/3/21 Patrick Li : > > [...] > > I'm trying to write a

[Chicken-users] Help with writing a macro

2011-03-20 Thread Patrick Li
Hello everyone, I'm trying to write the following macro using the syntax-rules system, and got stuck trying to figure out the ellipsis. Would someone mind giving me a hand with this? I really appreciate it. I'm trying to write a macro that will tranform: (temp (a b c) do-this do-that do-other) i

[Chicken-users] display with cyclic structures or just limit on characters?

2011-02-15 Thread Patrick Li
Hello everyone, I'm just debugging some software with display statements, except that I am using some cyclic data structures. If I use (display my-data-structure) on a cyclic structure, it just floods the screen and crashes the program. Is there an existing cycle-detecting pretty-printer for Chic

Re: [Chicken-users] Help solving this phasing problem.

2011-02-12 Thread Patrick Li
Thanks Peter. That's perfectly good enough. As long as I'm not repeating myself and it's transparent to the user, I can live with it. You've been very helpful. -Patrick On Sat, Feb 12, 2011 at 4:51 PM, Peter Bex wrote: > On Sat, Feb 12, 2011 at 04:35:23PM -0500, Patr

[Chicken-users] Help solving this phasing problem.

2011-02-12 Thread Patrick Li
Hello everyone, I'm creating a module that exports two things, a macro and a function. The definition of the macro happens to require the use of the function. I am having problems creating this module. The defined macro cannot access the function. --Example

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-12 Thread Patrick Li
d-all bound-symbols (expand expression) expression)) ;;Macroexpand-All (define (macroexpand-all expression) (-macroexpand-all '() expression)) On Sat, Feb 12, 2011 at 2:08 PM, Patrick Li wrote: > Thanks for the help! I upgraded to 4.6.0 and everything's fine now. > -Patrick &

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-12 Thread Patrick Li
Thanks for the help! I upgraded to 4.6.0 and everything's fine now. -Patrick On Sat, Feb 12, 2011 at 12:55 PM, Peter Bex wrote: > On Sat, Feb 12, 2011 at 12:18:30PM -0500, Patrick Li wrote: > > Ah I'm using Chicken 4.4.0. > > I'm a beginner to Chicken and just typ

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-12 Thread Patrick Li
Ah I'm using Chicken 4.4.0. I'm a beginner to Chicken and just typed "port install chicken" into my MacOSX terminal. I'll figure out how to upgrade Chicken. -Patrick On Sat, Feb 12, 2011 at 12:04 PM, Peter Bex wrote: > On Sat, Feb 12, 2011 at 11:52:40AM -0500, Pa

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-12 Thread Patrick Li
> > After full expansion, you should get ##core#lambda, which is the "core" > lambda. > I didn't understand what you mean by this part. How do I perform a "full expansion"? eg. (define-syntax mymacro (syntax-rules () ((mymacro) (lambda () 3 (expand '(mymacro)) => (lambda1020 () 3) (expand (

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-12 Thread Patrick Li
Thanks for the help Felix! There's one more question I stumbled upon actually. Do you know of some way I can tell if a symbol *actually* refers to lambda or let? eg. after some macro expansions, a form might look like (lambda89 (x y) body ...) where lambda89 is equivalent to lambda. Given a symb

Re: [Chicken-users] Using a macro definition within a explicit renaming macro.

2011-02-12 Thread Patrick Li
Thanks for the help. The module workaround will work fine for what I'm doing! -Patrick On Sat, Feb 12, 2011 at 5:36 AM, Felix < fe...@call-with-current-continuation.org> wrote: > > > > There may be a shorter way involving begin-for-syntax or something. > > > > (begin-for-syntax (define-syntax .

[Chicken-users] Using a macro definition within a explicit renaming macro.

2011-02-11 Thread Patrick Li
Hello, I'm working with explicit renaming macros, and I'm having a lot of trouble using macros within them. (define-syntax say-hi (syntax-rules () ((say-hi) (display "Hello!" (define-syntax my-renaming-macro (lambda (expression rename comparison) (say-hi) <-- Attempt to call pred

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-11 Thread Patrick Li
Great. Thanks for that tip! I think I will try and figure it out. As long as I can figure out what the core binding-introducing forms are, I think I can do it. -Patrick On Fri, Feb 11, 2011 at 2:56 PM, Peter Bex wrote: > On Fri, Feb 11, 2011 at 02:46:58PM -0500, Patrick Li wrote: > >

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-11 Thread Patrick Li
anyone know which forms introduce new bindings? How can I check this up? Thank you very much. -Patrick On Fri, Feb 11, 2011 at 12:15 PM, Patrick Li wrote: > No I didn't. > Thank you. I will check that out! > > > On Fri, Feb 11, 2011 at 11:42 AM, Christian Kellermann < > c

[Chicken-users] Implementing a macroexpand-all

2011-02-11 Thread Patrick Li
Hello everyone, I'm trying to write a simple macroexpand-all function (a function to recursively macroexpand all subforms in a form until there are absolutely no macros left in the form), and realized that my naive implementation has a serious bug in it, namely that it doesn't keep track of local

Re: [Chicken-users] Implementing a macroexpand-all

2011-02-11 Thread Patrick Li
No I didn't. Thank you. I will check that out! On Fri, Feb 11, 2011 at 11:42 AM, Christian Kellermann wrote: > * Patrick Li [110211 17:20]: > > Hello everyone, > > > > I'm trying to write a simple macroexpand-all function (a function to > > recursively mac

[Chicken-users] Where is macroexpand?

2011-02-10 Thread Patrick Li
Hello, I am new to Chicken scheme and have just installed it using MacPorts. I opened csi, and am having trouble finding macroexpand, or macroexpand-1. I found some older posts that show that other members aren't having any trouble. Is there something that I am forgetting? Thank you very much