6 ms·
Isn't at least one of them undefined? `(1 ,@2) It's always surprising to me how many things Scheme leaves undefined. Other examples are evaluation order (in
by fweimer 26d ago
Isn't at least one of them undefined? `(1 ,@2)
It's always surprising to me how many things Scheme leaves undefined. Other examples are evaluation order (in some rather surprising places) or the value of: (make-bytevector 4)
- soegaard 26d ago> `(1 ,@2) '(1 . 2) This is a pair. The notations is called "dotted pair".
- fweimer 26d agoBut 2 isn't a list, and the argument to unqoute-splicing must be a list: > If an (unquote-splicing <expression> ...) form appears inside a <qq template>, then the <expression>s must evaluate to lists; the opening and closing parentheses of the lists are then “stripped away” and the elements of the lists are inserted in place of the unquote-splicing form.
- soegaard 26d agoSee https://docs.racket-lang.org/reference/quasiquote.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._quasiquote%29%29 https://docs.racket-lang.org/reference/quasiquote.html#%28fo...
- GregBuchholz 26d agoLooks like fweimer is correct for scheme. I admit to being very surprised. Here is the verbiage from various rXrs: r3rs, r4rs & r5rs (section 4.2.6): https://standards.scheme.org/official/r3rs.pdf https://standards.scheme.org/official/r3rs.pdf https://standards.scheme.org/official/r4rs.pdf https://standards.scheme.org/official/r4rs.pdf https://conservatory.scheme.org/schemers/Documents/Standards/R5RS/r5rs.pdf https://conservatory.scheme.org/schemers/Documents/Standards... "If a comma appears followed immediately by an at- sign (@), then the following expression must evaluate to a list;" r6rs (section 11.17): https://standards.scheme.org/official/r6rs.pdf https://standards.scheme.org/official/r6rs.pdf "If an (unquote-splicing 〈expression〉 . . . ) form appears inside a〈qq template〉, then the〈expression〉s must evaluate to lists;" r7rs (4.2.8): https://standards.scheme.org/official/r7rs.pdf https://standards.scheme.org/official/r7rs.pdf "If a comma appears followed without intervening whitespace by a commercial at-sign (@), then it is an error if the following expression does not evaluate to a list;"
- soegaard 26d agoYou need to use the Racket documentation.
- shawn_w 25d agoRacket defines an evaluation order for function arguments (left to right).
- GregBuchholz 25d agoSpecifically section 4.3.1 https://docs.racket-lang.org/guide/application.html#(part._.Evaluation_.Order_and_.Arity) https://docs.racket-lang.org/guide/application.html#(part._....