The do loop part was managed somehow.
(do ((x -5 (+ x 1))) ((>x 5)) (do ((y -5 (+ y 1))) ((>y 5)) (print x "" y "\ n")))
Here, using this loop, I would like to make a list with vector3 as an element containing elements (x, y, 0) in the order that this loop runs.
Description of vector3
I don't know what to do.
If there is a person who understands, please.
Answer # 1
There are several possible ways, but if you assume a loop using
doin that way, it is best to assemble the list from the end and invert it at the end I think this is an easy way.
(let ((r '())) (do ((x -5 (+ x 1))) ((>x 5)) (do ((y -5 (+ y 1))) ((>y 5)) (set! r (cons (vector3 x y 0) r)))) (reverse r))
Answer # 2
If you don't need to use do, it looks like this.
(map (lambda (x) (map (cut vector3 x<>0) (iota 11 -5))) (iota 11 -5))
Answer # 3
There is a way to add more to the end of the linear list. (・ ∀ ・)
(define my-vector3-list (let * ((queue (list #f)) (queue_last queue));queue_last is the last cell in the linear list. (do ((x -5 (+ x 1))) ((>x 5)) (do ((y -5 (+ y 1))) ((>y 5)) (set-cdr! queue_last (list (vector3 x y 0))) (set! queue_last (cdr queue_last)) ) ) (cdr queue);Since the first #f is garbage data, it is discarded ) )
- python - how to create dropdown list using pysimple gui
- create conditional expression using sql subquery
- python - i want to create an image using wordcloud, but i am stuck with a valueerror
- c # - i want to create a hover action using a gradient in wpf
- Tutorial on using Pycharm (Python tool) to create new projects and create Python files
- Scheme of using SVN in Visual Studio Code environment
- python - i want to create a neural network using lstm with keras functional api
- ios Detailed steps for using xcode11 to create a new project
- how to create multi-part mail (html mail and text mail) using php
- i tried to create a survey using googleform, but only the format was edited
- database - i want to do db: create using docker
- html - i want to create a slide show using slick
- html - i want to create a pinterest-like site using masonry and infinite scroll
- python - i want to create a new data frame using the processed file by performing the same process on multiple files
- python 3x - i want to create a keylogger using python and socket
- html5 - i want to create href value using data in vue
- [scheme] i want to apply a recursively defined function to a nested structure
- what is "'" "` "", "in scheme code?
- i don't know what scheme's (define (f a b) (lambda (x) ())) represents
- scheme - i'm having trouble with variable scope (?)
- ruby - i get an error when i try to load schemasql
- php - db schema creation library in yaml
- can't draw triple loop + recursion in scheme
- i get a call of non-procedure: #<unspecified>error in scheme