Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualAlpha_ProgDes

Posted 30 April 2013 - 03:16 AM

And the scheme/racket version of your code:

 

(define (insert-everywhere c string)
  (local [(define (recursive-insert string-before string-after)
            (local [(define new-word (append string-before (cons c string-after)))]
              (cond
                [(empty? string-after) (list new-word)]
                [else (cons new-word 
                            (recursive-insert 
                              (append string-before (list (first string-after))) 
                              (rest string-after)))])))]
  (recursive-insert empty string)))

(insert-everywhere "w" (list "e" "a" "r"))

#2Alpha_ProgDes

Posted 30 April 2013 - 03:06 AM

And the scheme/racket version of your code:

 

(define (insert-everywhere c string)
  (local [(define (recursive-insert string-before string-after)
            (local [(define new-word (append string-before (cons c string-after)))]
            (cond
              [(empty? string-after) (list new-word)]
              [else (cons new-word 
                          (recursive-insert 
                            (append string-before (list (first string-after))) 
                            (rest string-after)))])))]
  (recursive-insert empty string)))

(insert-everywhere "w" (list "e" "a" "r"))

#1Alpha_ProgDes

Posted 30 April 2013 - 02:48 AM

And the scheme/racket version of your code:

 

(define (insert-everywhere c string)
  (local [(define (recursive-insert string-before string-after)
            (local [(define new-word (append string-before (cons c string-after)))]
            (cond
              [(empty? string-after) (list new-word)]
              [else (cons new-word 
                          (recursive-insert 
                           (append string-before (list (first string-after))) 
                           (rest string-after)))])))]
  (recursive-insert empty string)))

(insert-everywhere "w" (list "e" "a" "r"))

PARTNERS