Passing parameters in the circuit

Can someone help me understand the different modes of passing parameters in a schema? I know that Scheme implements passing parameters by value. But what about other modes?

Is there any good documentation for passing parameters in a schema?

+3
source share
2 answers

There are only default function calls in the schema. There are other alternatives that can be implemented within the language, but if you are a beginner, it is best not to try them at this point. If you are looking for a way to pass values ​​"by reference" - then one option that can do this is to use macros, but you really shouldn't go there. Instead, some Schema implementations, such as the PLT Scheme, provide a "field value": it is a kind of container that is used as follows:

  • You create a box <something>with(box <something>)
  • You get the value that is stored in the field with (unbox <some-box>)
  • You change the value that is stored in the field with (set-box! <some-box> <new-value>)

, " ", . C, (, ) , , . , : - , .

( , , , .)

+7

...

- , , . , " " , ; , , . , , ( unbox), .

, , call-by-reference , , , , . set! " " .

+1

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


All Articles