Skip to main content
deleted 2 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Insert-everywhere function

This is HtDP Excercise 12.4.2.:

Here is the tests iI conducted:

So itIt works. But, but I think this is not the way it was supposed to be solved. In their hint, they ask to use only recursion anand append., but I didn't really get it. Could someone suggest a better answer.?

Insert-everywhere

This is HtDP Excercise 12.4.2.

Here is the tests i conducted:

So it works. But I think this is not the way it was supposed to be solved. In their hint, they ask to use only recursion an append. I didn't really get it. Could someone suggest a better answer.

Insert-everywhere function

This is HtDP Excercise 12.4.2:

Here is the tests I conducted:

It works, but I think this is not the way it was supposed to be solved. In their hint, they ask to use only recursion and append, but I didn't really get it. Could someone suggest a better answer?

added 76 characters in body
Source Link
Alexis King
  • 3.2k
  • 2
  • 21
  • 35

This is HTDP Excercise 12.4.2 :- Page 161HtDP Excercise 12.4.2.

(insert-everywhere 'a '()) returns '((a))--- (insert-everywhere 'a '(b)) returns '((a b) (b a)) --- (insert-everywhere 'a '(b c d)) returns '((a b c d) (b a c d) (b c a d) (b c d a))

(insert-everywhere 'a '()) ; returns '((a))
(insert-everywhere 'a '(b)) ; returns '((a b) (b a))
(insert-everywhere 'a '(b c d)) ; returns '((a b c d) (b a c d) (b c a d) (b c d a))

This is HTDP Excercise 12.4.2 :- Page 161

(insert-everywhere 'a '()) returns '((a))--- (insert-everywhere 'a '(b)) returns '((a b) (b a)) --- (insert-everywhere 'a '(b c d)) returns '((a b c d) (b a c d) (b c a d) (b c d a))

This is HtDP Excercise 12.4.2.

(insert-everywhere 'a '()) ; returns '((a))
(insert-everywhere 'a '(b)) ; returns '((a b) (b a))
(insert-everywhere 'a '(b c d)) ; returns '((a b c d) (b a c d) (b c a d) (b c d a))
Tweeted twitter.com/#!/StackCodeReview/status/203036001415872512
Source Link
Rajesh Bhat
  • 261
  • 1
  • 3
  • 5
Loading