Article View: fj.comp.lang.lisp
Article #1Re: bug (Funarg problem) in Gauche (Scheme) ?
From: HenHanna
Date: Sun, 19 May 2024 10:37
Date: Sun, 19 May 2024 10:37
35 lines
2388 bytes
2388 bytes
On 5/19/2024 12:41 AM, HenHanna wrote: > From the Gauche (Scheme) manual: > > (cartesian-product ’((a b c) (0 1))) > ⇒ ((a 0) (a 1) (b 0) (b 1) (c 0) (c 1)) > ___________________________________________________ > The Gauche (Scheme) manual describes > string-count and cartesian-product > as built-in functions, but I couldn't use them and ended up defining > them myself. > > (define (cartesian-product x) > (if (null? (cdr x)) > (map list (car x)) > (apply append > (map (lambda (F) > (map (lambda (R) (cons F R)) (cartesian-product (cdr x)))) > (car x))))) > > (print (cartesian-product '((0 1))) ) ==> ((0) (1)) > (print (cartesian-product '((a b)(0 1))) ) ==> ((a 0) (a 1) (b 0) (b 1)) > > ________________________________________ > > The above code works fine, but when i rename the variable (F) as (x), i > get the following error, and this must be a bug in Gauche (Scheme). > > gosh> (load "CpMerge.lsp") > ((0) (1)) > *** ERROR: pair required, but got a > While loading "./CpMerge.lsp" at line 19 No... my bad... That's not a bug. Just my error!
Technical Details
Message-ID:
<v2ckp7$3bajr$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mailReferences:
<v2caem$38tor$1@dont-email.me>Show Full Headers
Complete Article Headers
Message-ID: <v2ckp7$3bajr$1@dont-email.me> Subject: Re: bug (Funarg problem) in Gauche (Scheme) ? Date: Sun, 19 May 2024 03:37:26 -0700 From: HenHanna <HenHanna@devnull.tb> References: <v2caem$38tor$1@dont-email.me> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail Newsgroups: comp.lang.scheme,comp.lang.lisp,fj.comp.lang.lisp Organization: A noiseless patient Spider Lines: 35 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 19 May 2024 12:37:29 +0200 (CEST) User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:CFT3WnOwFeFSV4VTjcj0Hg6GrDs= Content-Language: en-US In-Reply-To: <v2caem$38tor$1@dont-email.me>