scheme

how to make HTML from a list in scheme, racket

北城以北 提交于 2021-02-10 06:48:33
问题 This is a very long question ... I am new and joined, so please don't attack me. Apologies for my bad communications in English. I have some defintions: An HTML(H) is one of Str Tag A Tag is (cons Sym (listof H)) I want to use mutual recursion,make the HTML into real HTML code. For example, (list 'html (list 'head (list 'title "Hi")) (list 'body (list 'h1 "Welcome") "Text")) Turns into: "<html><head><title>Hi</title></head><body><h1>Welcome</h1>Text</body></html>" This should work for any

miniKanren: How to define #s and #u?

我的未来我决定 提交于 2021-02-10 00:23:53
问题 In miniKanren, succeed can be defined as (define succeed (== #t #t)) , and fail can be defined as (define fail (=== #t #f)) . But what about #s and #u as short forms of succeed and fail , as they appear in The Reasoned Schemer ? (define #s succeed) produces an error in Racket: Welcome to Racket v7.2. > (require Racket-miniKanren/miniKanren/mk) > (define #s succeed) ; readline-input:2:8: read-syntax: expected `(`, `[`, or `{` after `#s` [,bt ; for context] #<procedure:...iniKanren/mk.rkt:337:4

miniKanren: How to define #s and #u?

≯℡__Kan透↙ 提交于 2021-02-10 00:20:46
问题 In miniKanren, succeed can be defined as (define succeed (== #t #t)) , and fail can be defined as (define fail (=== #t #f)) . But what about #s and #u as short forms of succeed and fail , as they appear in The Reasoned Schemer ? (define #s succeed) produces an error in Racket: Welcome to Racket v7.2. > (require Racket-miniKanren/miniKanren/mk) > (define #s succeed) ; readline-input:2:8: read-syntax: expected `(`, `[`, or `{` after `#s` [,bt ; for context] #<procedure:...iniKanren/mk.rkt:337:4

miniKanren: How to define #s and #u?

橙三吉。 提交于 2021-02-10 00:20:36
问题 In miniKanren, succeed can be defined as (define succeed (== #t #t)) , and fail can be defined as (define fail (=== #t #f)) . But what about #s and #u as short forms of succeed and fail , as they appear in The Reasoned Schemer ? (define #s succeed) produces an error in Racket: Welcome to Racket v7.2. > (require Racket-miniKanren/miniKanren/mk) > (define #s succeed) ; readline-input:2:8: read-syntax: expected `(`, `[`, or `{` after `#s` [,bt ; for context] #<procedure:...iniKanren/mk.rkt:337:4

miniKanren: How to define #s and #u?

谁说胖子不能爱 提交于 2021-02-10 00:20:32
问题 In miniKanren, succeed can be defined as (define succeed (== #t #t)) , and fail can be defined as (define fail (=== #t #f)) . But what about #s and #u as short forms of succeed and fail , as they appear in The Reasoned Schemer ? (define #s succeed) produces an error in Racket: Welcome to Racket v7.2. > (require Racket-miniKanren/miniKanren/mk) > (define #s succeed) ; readline-input:2:8: read-syntax: expected `(`, `[`, or `{` after `#s` [,bt ; for context] #<procedure:...iniKanren/mk.rkt:337:4

miniKanren: How to define #s and #u?

試著忘記壹切 提交于 2021-02-10 00:19:56
问题 In miniKanren, succeed can be defined as (define succeed (== #t #t)) , and fail can be defined as (define fail (=== #t #f)) . But what about #s and #u as short forms of succeed and fail , as they appear in The Reasoned Schemer ? (define #s succeed) produces an error in Racket: Welcome to Racket v7.2. > (require Racket-miniKanren/miniKanren/mk) > (define #s succeed) ; readline-input:2:8: read-syntax: expected `(`, `[`, or `{` after `#s` [,bt ; for context] #<procedure:...iniKanren/mk.rkt:337:4

miniKanren: How to define #s and #u?

雨燕双飞 提交于 2021-02-10 00:19:22
问题 In miniKanren, succeed can be defined as (define succeed (== #t #t)) , and fail can be defined as (define fail (=== #t #f)) . But what about #s and #u as short forms of succeed and fail , as they appear in The Reasoned Schemer ? (define #s succeed) produces an error in Racket: Welcome to Racket v7.2. > (require Racket-miniKanren/miniKanren/mk) > (define #s succeed) ; readline-input:2:8: read-syntax: expected `(`, `[`, or `{` after `#s` [,bt ; for context] #<procedure:...iniKanren/mk.rkt:337:4

How are these nested vectors connected?

ぃ、小莉子 提交于 2021-02-09 17:49:04
问题 I've written a piece of code, which creates a vector 'scoreboard' that contains 3 seperate vectors of size 3, all containing the symbol ? at all indices 0-2. When i now execute a 'vector-set!' on the first vector of scoreboard, to change its first element to a 'X, vectors 2 and 3 will change too. How does this occur? (define scoreboard (make-vector 3 (make-vector 3 '?))) (define (display-scoreboard) (display (vector-ref scoreboard 0)) (newline) (display (vector-ref scoreboard 1)) (newline)

How are these nested vectors connected?

自作多情 提交于 2021-02-09 17:47:17
问题 I've written a piece of code, which creates a vector 'scoreboard' that contains 3 seperate vectors of size 3, all containing the symbol ? at all indices 0-2. When i now execute a 'vector-set!' on the first vector of scoreboard, to change its first element to a 'X, vectors 2 and 3 will change too. How does this occur? (define scoreboard (make-vector 3 (make-vector 3 '?))) (define (display-scoreboard) (display (vector-ref scoreboard 0)) (newline) (display (vector-ref scoreboard 1)) (newline)

How are these nested vectors connected?

你离开我真会死。 提交于 2021-02-09 17:47:09
问题 I've written a piece of code, which creates a vector 'scoreboard' that contains 3 seperate vectors of size 3, all containing the symbol ? at all indices 0-2. When i now execute a 'vector-set!' on the first vector of scoreboard, to change its first element to a 'X, vectors 2 and 3 will change too. How does this occur? (define scoreboard (make-vector 3 (make-vector 3 '?))) (define (display-scoreboard) (display (vector-ref scoreboard 0)) (newline) (display (vector-ref scoreboard 1)) (newline)