Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7064001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:46:51+00:00 2026-05-28T04:46:51+00:00

I found code for generating Sierpinski carpet at http://rosettacode.org/wiki/Sierpinski_carpet#Scheme – but it won’t run

  • 0

I found code for generating Sierpinski carpet at http://rosettacode.org/wiki/Sierpinski_carpet#Scheme – but it won’t run in the DrRacket environment or WeScheme. Could someone provide solutions for either environments?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:46:51+00:00Added an answer on May 28, 2026 at 4:46 am

    I’ve translated the program to run under WeScheme. I’ve made a few changes: rather than use (display) and (newline), I use the image primitives that WeScheme provides to make a slightly nicer picture. You can view the running program and its source code. For convenience, I also include the source here:

    ;; Sierpenski carpet.
    ;; http://rosettacode.org/wiki/Sierpinski_carpet#Scheme
    
    (define SQUARE (square 10 "solid" "red"))
    (define SPACE (square 10 "solid" "white"))
    
    (define (carpet n)
      (local [(define (in-carpet? x y)
               (cond ((or (zero? x) (zero? y))
                      #t)
                     ((and (= 1 (remainder x 3)) (= 1 (remainder y 3)))
                      #f)
                     (else
                      (in-carpet? (quotient x 3) (quotient y 3)))))]
    
      (letrec ([outer (lambda (i)
                        (cond
                          [(< i (expt 3 n))                       
                           (local ([define a-row
                                     (letrec ([inner 
                                               (lambda (j)
                                                 (cond [(< j (expt 3 n))
                                                        (cons (if (in-carpet? i j)
                                                                  SQUARE
                                                                  SPACE)
                                                              (inner (add1 j)))]
                                                       [else
                                                        empty]))])
                                       (inner 0))])
                             (cons (apply beside a-row)
                                   (outer (add1 i))))]
                          [else
                           empty]))])
        (apply above (outer 0)))))
    
    
    (carpet 3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this code from here: http://www.cssportal.com/form-elements/text-box.htm But the problem is you can still
I found some Java code for generating combinations on, but I can't understand what
I found this code for alphanumeric check (Letters, numbers, spaces or underscores) but I
i found some code which is using anchor tags in eval eval(a='http://google.co.in'+window .location.href); The
I found some code for generating CSS3 buttons which I'm using on my site.
So I'm writing some XML generating code, and found that the following attribute value
The following code is generating a page not found error with Kohana 2.3.4 class
i found this code: protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource hwndSource =
I found the code from the net in which i cant understand this line:-
I found this code using Google. private int RandomNumber(int min, int max) { Random

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.