(define-syntax prnt (syntax-rules () [(prnt elem ...) (display (format \"~a\" elem .开发者_JAVA百科..))]
(define (mult a b);;function mult(a,b) (cond ((IsItZero? b) 0);;if b = 0: return 0 ((let((c (mult a (rest b))));;c = mult(a, floor(b/2))
I\'m guessing that #lang racket is a dialect of scheme with much more out of the box structures and common functions and perhaps would be more pedagogic. What are the perks a #lang racket against #lan
Is it possible to set a def开发者_高级运维ault value to some of arguments in Racket? Like so in Python:
The following code wi开发者_开发问答ll generate #f and #t 1: (define dict (hash 1 \'a 2 \'b )) 2: (hash? (string->symbol \"dict\"))
I have the scenario where a function returns an lambda form, and I want to apply the lambda form but failed. Example:
I have a statement like this: ((lambda (a b c) (+ a b c)) 1 2 3) ; Gives 6 And I would like to be able to also pass it a list as so:
I wrote a quick-sort in scheme (racket) #lang racket (define (quick-sort xs) (let* ([p (list-ref xs 0)] [tail (list-tail xs 1)]
In order to teach myself more advanced macros in racket, I set about creating a macro to increment a field in a mutable struct:
Trying to understand free-identifier=? and bound-identifier=?. Can anyone give me equivalent code examples wher开发者_C百科e using free-identifier=? would return true and using bound-identifier=? woul