For these problems, you must use pure functional scheme. That is: You may not use a functions like set! whose name ends with '!'. You may not use do. All repetition must be via explicit recursion or the recursion implicit in map or similar functions. You may, however, use define – in fact you must use it. You may define additional helper functions. Be sure to test your definitions using some implementation of the “R5RS” scheme standard, preferably the one in Racket – see Pages > scheme_links.html for a discussion of how to get it. (It is what I have been using in lecture.) If you use the Racket implementation of scheme, be sure that the language is set to R5RS – the name “R5RS” should appear at the bottom left corner of the window, and not something like “advanced student” or “Determine language from source”. Define the function (doubleBubbleLst lst). This function should resolve to a list of sublists, where each sublist holds a single element from lst and all sublists from lst are also bubbled, so that every list and sublist has no atoms. This is the deep recursion version of bubbleLst. For example: (doubleBubbleLst '(1 2 (3 4)) ) resolves to '((1) (2) (( (3) (4) ))).
Computer Science
For these problems, you must use pure functional scheme. That is:
-
You may not use a functions like set! whose name ends with '!'.
-
You may not use do. All repetition must be via explicit recursion or the recursion implicit in map or similar functions.
-
You may, however, use define – in fact you must use it.
-
You may define additional helper functions.
Be sure to test your definitions using some implementation of the “R5RS” scheme standard, preferably the one in Racket – see Pages > scheme_links.html for a discussion of how to get it. (It is what I have been using in lecture.) If you use the Racket implementation of scheme, be sure that the language is set to R5RS – the name “R5RS” should appear at the bottom left corner of the window, and not something like “advanced student” or “Determine language from source”.
Define the function (doubleBubbleLst lst). This function should resolve to a list of sublists, where each sublist holds a single element from lst and all sublists from lst are also bubbled, so that every list and sublist has no atoms. This is the deep recursion version of bubbleLst.
For example: (doubleBubbleLst '(1 2 (3 4)) ) resolves to '((1) (2) (( (3) (4) ))).
Step by step
Solved in 4 steps with 2 images