R5RS diagram: follow the link

I am trying to emulate a stack in a circuit. I use DrScheme and I choose the R5RS language. I need to create functions that appear, push and drop in. But it's hard for me to figure out how to follow the link. I read some information about boxes, but they are not supported in R5RS. Is there any other way to follow the link?

+3
source share
2 answers

Instead of passing "by reference" what you can do in an imperative language, Scheme encourages you to think in a functional sense. This means that your operation push, for example, will take two parameters:

  • stack
  • new item

, . pop , peek .

, Scheme , . :

  • push - cons
  • -
  • peek - first
0

: r5rs; . DrRacket "". , :

#lang racket 

(define b (box 234))

(set-box! b 333)

(unbox b)

FWIW: , , , DrRacket (nee DrScheme).

, , " ". - , (, racket, r5rs, java ..) .

+1

Source: https://habr.com/ru/post/1778525/


All Articles