Script Library: 1238 scripts


REBOL [ Title: "Automatic local variables" Date: 20-Jul-1999 Version: 1 File: %protect-func.r Author: "Thomas Jensen" Tabs: 4 Purpose: { Function generator that automatically makes local variables } Language: 'English Email: %dm98411--edb--tietgen--dk Charset: 'ANSI library: [ level: 'intermediate platform: none type: 'tool domain: none tested-under: none support: none license: none see-also: none ] ] protected-function: function [spec body] [ locals ][ locals: make block! [] foreach word body [ if set-word? :word [ append locals make word! :word ] ] function spec locals body ] example: [ some-math-function: protected-function [x] [ y: + x 2 z: / x 2 z + y ] x: "this string (x) has not been modified!" y: "this string (y) has not been modified!" z: "this string (z) has not been modified!" print some-math-function 4 print [x newline y newline z] ] do example
halt ;; to terminate script if DO'ne from webpage
  • email address(es) have been munged to protect them from spam harvesters. If you are a Library member, you can log on and view this script without the munging.
  • (dm98411:edb:tietgen:dk)