{"id":1058,"date":"2022-08-30T15:11:41","date_gmt":"2022-08-30T15:11:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/problem-about-racket-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:11:41","modified_gmt":"2022-08-30T15:11:41","slug":"problem-about-racket-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-racket-collection-of-common-programming-errors\/","title":{"rendered":"problem about racket-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/af28ea5cfbc865d617d6e37a265c6105?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWill Ness<br \/>\nscheme racket<br \/>\nI&#8217;m trying to write some code, but there is a problem with my reply procedure. Ignore the procedures for the first two random-of-threes, but the problem is in the else when calling the pick-random procedure. Here&#8217;s the code:(define earlier-responses &#8216;()) (define (doctor-driver-loop name earlier-<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/17c0190cc521c554c0d4555edbe76f4c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nKeen<br \/>\nfunctional-programming scheme racket mutable<br \/>\ni have this definition &#8220;sort left list&#8221; which is a list of pairs sorted according to the left element of each pair the left element must be a non-negative integer and the right component may be a value of any typei have to<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/61L4u.jpg?s=32&amp;g=1\" \/><br \/>\nTimbo925<br \/>\ntable user-interface listbox scheme racket<br \/>\nI&#8217;m currently trying to create a a grid of information in Racket using the Racket Graphical Interface Tooling. The only real table that is available is the list-box% (link to reference)To fill the table I need to use:(send a-list-box set choices &#8230;) \u2192 void?choices : (listof label-string?)choices being list being a list of each column. The problem is that I have a variable amount of collumns. My current data is formated like (list (list 1 2 3) (list 4 5 6))<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/afb3a36064179f0226a1691c9433be13?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nYasir Arsanukaev<br \/>\nlist scheme racket<br \/>\nBelow is my code which takes a car element of a list(carVal) and an list(initialized to<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b499a054ad06b6d3461155f0c3945a85?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\n\u00d3scar L\u00f3pez<br \/>\nscope scheme racket define<br \/>\nI need some function which among other stuff would define a new global symbol. So that I could use it like this:(define (func-prototype symbol value comment)(define symbol value) ; th<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/729442eea8d8548842a6e0947e333c7b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nChris Jester-Young<br \/>\nracket cartesian-product<br \/>\nI was hoping someone could guide me in the right direction: I am looking two produce all possible combinations of items in two lists: Example: Given the lists &#8216;(symbo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7a20097de286fccc680f2fb8a436fd03?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmac01021<br \/>\nlisp scheme racket<br \/>\nUsing DrRacket, on both linux and Mac OS, the following code gives this error *: expects type as 1st argument, given #but if I uncomment the (newline) at the beginning of the procedu<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/75a63a4644da3c2b09bcdb26788ecffe?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMichael McGuinness<br \/>\nscheme racket<br \/>\nI have been trying to launch a racket program from the commandline (via &#8216;racket&#8217;) but have not been having success. According to the documentation (here http:\/\/docs.racket-lang.org\/reference\/running-sa.html#%2<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/835b9fab8784c5dca07b2165ac8b3df4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nakavel<br \/>\nscheme racket old historical<br \/>\nI&#8217;m trying to resurrect an old (1999 or earlier) project written in Scheme (PLT-Scheme, using the mzscheme interpreter (?) commandline tool). To make the matters worse, I don&#8217;t know Scheme, or Lisp (in fact, I want to learn, but that&#8217;s another story).I have the source code of the project at: github.com\/akavel\/shermanNow, when running the code, it bails out with an error message like below:Sherman runtime version 0.5 Hosted on MzScheme version 52, Copyright (c) 1995-98 PLT (Matthew Flatt) reference to undefined identifier: list-&gt;block<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/afb3a36064179f0226a1691c9433be13?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nYasir Arsanukaev<br \/>\nrecursion racket<br \/>\nI&#8217;m still plugging away at the exercises in How to Design Programs on my own, but have managed to get stuck again. This time it&#8217;s question 11.4.7:Develop the functionis-not-divisible-by=1], i, and a naturalnumber m, with i &lt; m. If m is notdivisible by any number between 1(exclusive) and i (inclusive), thefunction produces true; otherw<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/74530a34228bb8fa1f87ae92c78909b7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEli Barzilay<br \/>\nscheme eval racket<br \/>\nThe following racket function produces the error:reference to undefined identifier: valThis i<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4635487b7617045ed5feb5def6fc8407?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\necounysis<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8d1d283e26ff75fa977e82752479afe4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2085086<br \/>\nscheme racket scoping drracket<br \/>\nSo I know that in Scheme define is for dynamic scoping and let for static scoping, yet the following thing confuses me:If I have(let ((x 0))(define f (lambda () x))(display (f))(let ((x 1))(displa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/83ddd182088d107264f567d1669103b4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSam Tobin-Hochstadt<br \/>\nracket<br \/>\nWhen building up some functions, I can make some mistakes. When<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/74530a34228bb8fa1f87ae92c78909b7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEli Barzilay<br \/>\nscheme racket<br \/>\nHey i&#8217;m just trying to write some code in DrScheme: ((function (<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/83ddd182088d107264f567d1669103b4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSam Tobin-Hochstadt<br \/>\nlisp scheme racket<br \/>\nI&#8217;m trying to run the program described in SICP 4.1 (http:\/\/mitpress.mit.edu\/sicp\/full-text\/book\/book-Z-H-26.html) but have run into some difficulty in redefining the function apply as the book suggests that you do. The code is the following:#lang planet neil\/sicp;; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; ;; 4.1.1 The Core of the Evaluator ;; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;;; Eval (define apply-in-underlying-scheme apply) (define (eval exp env)(display &#8216;eval)(newline)(display exp)(newline)(cond ((self-evaluating? exp) exp)((variable? exp) (let ((res (lookup-variable-value exp env)))(display (list &#8216;lookup exp))(newline)(display res)(newline)res))((quoted? exp) (text-of-quotation exp))((assignment? exp) (eval-assignment exp env))((definition? exp) (eval-definition exp env))((if? exp) (eval-if exp env))((lambda? exp)(make-procedure (lambda-parameters exp)(lambda-body exp)env))((begin? exp)(eval-sequence (begin-actions exp) env))((cond? exp) (eval (cond-&gt;if exp) env))((application? exp)(apply (eval (operator exp) env)(list-of-values (operands exp) env)))(else(error &#8220;Unknown expression&#8221; exp))));; Apply(define (apply procedure arguments)(display &#8216;apply)(newline)(display procedure)(newline)(cond ((primitive-procedure? procedure)(apply-primitive-procedure procedure arguments))((compound-procedure? procedure)(eval-sequence(procedure-body procedure)(extend-environment(procedure-parameters procedure)arguments(procedure-environment procedure))))(else(error&#8221;Unknown procedure type &#8212; &#8221; procedure))));; Application(define (application? exp) (pair? exp)) (define (operator exp) (car exp)) (define (operands exp) (cdr exp));; Procedure arguments(define (list-of-values exps env)(if (no-operands? exps)'()(cons (eval (first-operand exps) env)(list-of-values (rest-operands exps) env))))(define (no-operands? ops) (null? ops)) (define (first-operand ops) (car ops)) (define (rest-operands ops) (cdr ops));; Conditionals(define (eval-if exp env)(if (true? (eval (if-predicate exp) env))(eval (if-consequent exp) env)(eval (if-alternative exp) env)));; Sequences(define (eval-sequence exps env)(cond ((last-exp? exps) (eval (first-exp exps) env))(else (eval (first-exp exps) env)(eval-sequence (rest-exps exps) env))));; Assignments and definitions(define (eval-assignment exp env)(set-variable-value! (assignment-variable e<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a717291747c76567bb0f086e15ae6e43?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGilles<br \/>\nvariables scheme racket<br \/>\nI think I read somewhere that you could bind multiple definitions to a single name in scheme. I know I might be usin<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/729442eea8d8548842a6e0947e333c7b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nChris Jester-Young<br \/>\nscheme racket continuations<br \/>\nConsider the following code:(call-with-values(lambda ()(call\/cc (lambda (k)(k k k))))(lambda (x y)(procedure-arity y)))It&#8217;s pretty obvious here that the continuation at the point of the call\/cc call is the lambda on the right-hand side, so its ari<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6974538cf02a4fcb8766e73a25bdc3c6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNathan Campos<br \/>\nregex url racket<br \/>\nI&#8217;m trying to use the URL regular expression to match URLs in Racket like this:(regexp-match #rx&#8221;((mailto\\:|(news|(ht|<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:20:22. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Will Ness scheme racket I&#8217;m trying to write some code, but there is a problem with my reply procedure. Ignore the procedures for the first two random-of-threes, but the problem is in the else when calling the pick-random procedure. Here&#8217;s the code:(define earlier-responses &#8216;()) (define (doctor-driver-loop name earlier- Keen functional-programming scheme racket mutable i have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1058","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1058"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1058\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}