On Fri, Jun 14, 2019 at 10:45 AM Sanjeev Sharma <[email protected]> wrote:
> within this for loop is there any way to access different pieces of the
> description and amt? car-ing and cdr-ing for example?
>
I'm not entirely clear on what you're looking for, but maybe this helps?
(define lst '(a b c))
(for ([(val idx) (in-indexed lst)])
(displayln (cons val idx))
(when (< idx (sub1 (length lst)))
(displayln (format "\tnext val: ~a" (list-ref lst (add1 idx))))))
Output:
(a . 0)
next val: b
(b . 1)
next val: c
(c . 2)
> Or move the identifier definitions into the let*, and pass those to for in
> some way?
>
> (let*((ratio 9/12))
> (for((description(list "this" "that"))
> (amt(list 4467.61 2428.37)))
> (printf"~a ~a: changed values\n"
> description
> (cat(* amt ratio) -2.))))
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/07ad5ce3-0ba8-48a5-a356-5cb1545de4cd%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/07ad5ce3-0ba8-48a5-a356-5cb1545de4cd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/CAE8gKoenWYdDgchNr5-T_UzDbNb3uzgL%3DKxQv8a2U2DmXXSedA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.