Due: Monday, November 11 th @5:00PM Being a classic example of a functional langage, !"#P is an important langage for this corse$ %his assignment is bro&en p into t'o halves$ %he first half is a 'or&sheet style, designed to gide yo throgh some of the (ir&s of !"#P$ %he second half )the *real* assignment+ consists of a single tas&, for 'hich yo mst create a generali,ed recrsive soltion$ Part The First -omplete and ans'er the follo'ing$ .or (estions 'here " as& yo of the difference bet'een t'o statements, or 'hat happens 'hen yo rn a piece of code, " am N/% simply as&ing 'hat appears on the screen$ Actually explain it$ 0lso, please remember that, 'hen " say that a fnction shold return a vale, it needs to actally return a vale$ #imply printing is not sfficient$ 1$ 1hat is the difference bet'een the lines: (print (+ 1 1)) and (print '(+ 1 1)) 2$ 1hat is the difference bet'een 34.506 and 34.P060M4%467 8$ #ho' me three different 'ays to create the list: )1 2 8+ 9$ 1rite a :random; nmber<generating fnction, rand, that accepts no parameters and 0!10=# retrns the vale 9$ 5$ 1rite a fnction, dozenify, that, 'hen given a nmber )as its sole parameter+, 'ill retrn dozen if it*s 12, or not dozen if it isn*t$ >$ 1rite a fnction, frenchify, that, 'hen given a nmber, retrns un if it*s 1, deux if it*s 2, trois if it*s 8, and je ne sais pas other'ise$ ?$ 1rite a fnction, modulizer, that accepts t'o parameters )it*ll be t'o lists+, and retrns a list containing the remainders from dividing each nmber in the first list by the vale in the corresponding position in the second list$ e$g$ (modulizer '(4 5 6) '(1 !)) result: (" 1 ") @$ #tate the otpt)retrn+ of the follo'ing code: (let ((x '(1 !))) (format t #$a$%# x) (push 4 x) (format t #$a$%# x)) A$ -onsider the t'o follo'ing fnctions: (defun &i''ly&o''ly(x) (push 5 x) (format t #$a$%# x)) (defun timey&imey(x) (let ((y x)) (push 5 y) (format t #$a$%# x))) 0ssming each is intended to act on a list, 'hat is the difference bet'een them7 )Ma&e sre to inclde the 1B=C+ 10$ #ppose yo have a global variable, (x(, that has the list ((1 !) (4 5 6) () * +))$ 1hat is the reslt of (nth 1 (x()7 Part The Secon Premise: 0: DBey -laireC " 'as spposed to start my brea& 1? mintes agoCD -: D=eah, " &no', 0bby, bt loo& at that line yo*ve got at yor registerC =o can*t Est abandon them allCD 0: D" fail to see 'hy not$ "n any event, yo*re the manager, so isn*t it yor Eob to handle things li&e that7D -: D.ineC "*ll open a till on the third register$ Bt 'e*re still going to have to get all those cstomers over here$D 0: D0nd that*s difficlt$$$ 'hy7 Fst tell everyone to move over to yor chec&ot$D -: D=eah, see, that*s the problem$ 0ll of those cstomers are compter scientists, here for or %ech and 0lgorithms sale$D 0: D$$$ seriosly7D -: D0bsoltely$ %hey love the stff$ Gnfortnately, as compter scientists, they have certain$$$ (ir&s$$$D 0: D"*m going to 'ish "*d simply started my brea& early, aren*t "7D -: D/h yeah$ #ee, compter scientists are very pic&y people$ %hey don*t exactly go 'ith the flo'$ "f yo told everyone to Est s'amp over to another chec&ot, they 'oldn*t end p in the same ordering as they started, so some cstomers 'old effectively have others ctting in front of them$D 0: D" thin& " can see 'here this is going$$$ and, having their heads in the clods, they don*t really ever seem to notice yo tal&ing nless yo address them personally, so yo can really only direct one person at a time, right7D -: DPreciselyC 0nd, if yo start telling them to Est *go to the bac& of this line*, they*ll Est 'ander off, so yo have to &eep them 'here yo can see them$D 0: D#o then, 'hat7 =o Est &eep calling the first person from my line, and adding them to the front of yor line7D -: DNoC %hat 'old reverse the lineC 1e*ll have to get Betsy to help s here$D B: D/h, don*t drag M4 into thisC "*m already on M= brea&C Baving me a sammichCD -: D6elax, Betsy$ "*ll be the only one actally doing 'or&$ -ompter scientists are relatively docile$ 1e can &eep shifting them bac& and forth indefinitely and they*ll Est accept it$D 0: D/&ay, so " finally get itC 1e Est move everyone from my line into Betsy*s, reversing the line, and then from hers to yors, restoring orderC %hat doesn*t sond so badCD -: DBaC !i&e " said, P"-H=C Not to mention obstinateC No compter scientist cold stand being forced in line behind someone they 'ere previosly ahead of for even one secondC No$$$ this is going to call for some desperate measres$D B: D0h hec&, are yo tal&ing abot 'hat " thin& yo*re tal&ing abot7D 0: D" thin& she is$ "f only 'e had a langage li&e !"#P, to ma&e that recrsive algorithm easier$$$D -: D"ndeed$ 1e*re certainly going to pretend that !"#P someho' ma&es this problem easier to solveCD !our Tas": %he )slightly 'ordy+ dialog above describes a basic (eeing problem$ =o*ll be 'riting a !"#P program that, 'hen given a list of names, 'ill shift all of those names, one<by<one, from one position to another, 'ith an additional one being available to help 'ith the transition$ =o can thin& of them as starting at 0, ending p at -, and having B for additional storage )thogh it may be easier to code them as 0, 2, and 1, respectively+$ Bo'ever, yo need to adhere to the follo'ing rles: 1henever yo move a name, yo need to annonce 'hich name yo*re moving, 'hich line yo*re moving from, and 'hich line yo*re moving to$ =o may only move one name at a time$ =o may, ho'ever, move the same name an arbitrary nmber of times$ 0ny name yo move for a step mst be at the .6/N%I%/P of its line$ 1henever a name is moved, in the ne' line it mst stay in #ront of all names it 'as in front of in the original line, and $ehin all names it 'as behind in the original line$ -learly, this 'ill severely limit the legal moves available to yo$ 0ny soltion violating a single one of those for rles 'ill instantly be a'arded a ,ero, irrespective of 'hat else is on the mar&ing scheme$ %ints: "f yo loo& at this careflly, it*s actally a pretty old problem$ $$$actally, yo probably don*t even need to loo& all that careflly to spot it$ %hat said, don*t let that tempt yo into plagiari,ing$ "t*ll be caght$ .er real$ -onsider defining more than one fnction$ Personally, " sed three )one to do the actal 'or&, given three lists, a ser<friendly one to accept a single parameter of the original list and invo&e the *real* one, and one to convert list indices into :0bigail;, :Betsy;, and :-laire;+$ " very strongly sggest that yo develop this incrementally$ .irst ma&e sre that yo &no' ho' to shift a single vale from one list to another$ /nly then shold yo start considering things li&e recrsion$ %he sample exection " provide belo' finishes off by sho'ing the final state of the three lines$ %his isn*t at all necessaryJ bt is handy for easily seeing 'hat happened$ #ample 4xection: ,1-. (hannah '(/hil 0ed)) 1o2e /345 from 6748645 to 79:;< 1o2e 09= from 6748645 to >564?9 1o2e /345 from 79:;< to >564?9 (045 045 (/345 09=)) &sing LISP on Sancast'e =o are more than 'elcome to install some flavor of !"#P on yor o'n compter, bt it*s also available on #andcastle$ #ince the mar&er 'ill probably be grading on #andcastle, if yo do install it at home, yo may 'ish to se the same variety that he*ll be sing )-!"#P+$ "t isn*t li&ely to ma&e a difference, bt it*s p to yo to verify that he can execte yor sbmission$ %o execte a !"#P script, simply inclde it as a command<line parameter$ Bo'ever, in order to ma&e se of the 64P! )6ead<4val<Print !oop$ i$e$ the prompt+, yo*ll need to add @repl first$ e$g$ clisp @repl myscriptAlsp %his 'ill execte the contents of the script file, myscriptAlsp, )alerting yo of any errors it catches+, inclding definitions of fnctions, and then give yo the normal !"#P environment$ Im(ortant Ti( 0s mentioned earlier, the first part is 'ritten to help gide yo throgh learning some basic tric&s in !"#P$ Bo'ever, yo*ll still need a proper reference$ %here are tons of great references online )Est google *-ommon !isp*+, bt "*m going to sggest this one: httpBCC&&&ADiDamonEeysAcomC'ooEC "t*s got some pretty good stff in it$ Su$mission Ph)sica': Print yor soltion for the first part$ Print yor sorce code for the second part, as 'ell as a sample exection 'ith at least for names$ #taple all of these together, attach a departmental coverpage, and drop it into the corse dropbox in F<Bloc& by the date and time specified above$ *'ectronic: Pt yor code into a separate folder on sandcastle )yor K: drive+$ ##BIP%%= in, navigate to that folder, and type: su'mitp+" "t shold prompt yo to specify things li&e assignment L, etc$