Well, actually that will be nested vectors, I just used list as example.
I thought about storing arrays as one-dimentional vectors, but it makes hard to
work with literal arrays. If I use nested vectors, then I can write something
like:
(matrix-* A #[#[1 2 3] #[4 5 6]])
--
You received this m
Daniel, thank you for your response!
It really helped. I've focuded too much on recursion and tried to put nested
array generation into it, without realizing that I can use external loop.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsu
My current approach is to try to make recursion that will expand into somethig
like this (for generator functions that accepts 1, 2 and 3 arguments
respectively):
(define (bv func)
(build-vector 3 func))
((lambda (f) (bv (lambda (x)
(f x generator)
((lambda (f) (bv (la
On Thursday, July 13, 2017 at 9:30:44 PM UTC+2, Daniel Prager wrote:
> It's straightforward to design a recursive macro with similar intent, but
> different surface syntax:
>
> (generate-array (i) 10)
> (generate-array (i) i)
> (generate-array (i j) (+ (* 10 i) j))
>
>
> Dan
Thanks for the an
I need to write function generete-array:
(define (generate-array num-dimensions generator)
...)
such that it generate num-dimensions array (each dimension is of size 3) and
uses generator function to produce elements of array (generator accepts
num-dimensions arguments and returns number; ea
I want to change how Racket prints some values both in REPL and when using
(print), (println), e.t.c.
Suppose that I want change like this (gives as simple example):
(define (print~ datum [out (current-output-port)] [quote-depth 0])
(if (number? datum)
(print `',datum out 1)
(print
Also thanks to Jens and Sam -- your examples is valuable, I learned from them
(for example, how I can use (let) to bind variable that was defined before --
so it keeps previous binding in the definitions part of (let) but uses new
binding in the body part of (let)).
--
You received this messag
Hi, gustavo!
Thanks for your answer, it was very helpful.
So i rewrote my (substitute-term) macro like this:
(define-syntax (substitute-term stx)
(syntax-case stx ()
[(_ term-from term-to (body0 body ...))
#`#,(append (if (equal? (syntax-e #'body0) (syntax-e #'term-from))
Hi!
I'm learning Racket and I stumpbled into a couple of problems with macros.
I tried to make macros that implements recursive lambda, but not the classic
one (that uses letre), but the one that uses Y combinator.
So it should work like this:
(recursion fact (n)
(if (zero? n)
9 matches
Mail list logo