이 페이지의 최신 내용은 아직 번역되지 않았습니다. 최신 내용은 영문으로 볼 수 있습니다.

함수형 프로그래밍

고차 함수 및 기타 함수형 프로그래밍 유틸리티

참고

MuPAD® Notebook은 향후 릴리스에서 제거될 예정입니다. MATLAB® 라이브 스크립트를 대신 사용하십시오.

MuPAD Notebook 파일을 MATLAB 라이브 스크립트 파일로 변환하려면 convertMuPADNotebook을 참조하십시오. MATLAB 라이브 스크립트는 일부 차이는 있지만 대부분의 MuPAD 기능을 지원합니다. 자세한 내용은 Convert MuPAD Notebooks to MATLAB Live Scripts 항목을 참조하십시오.

MuPAD 함수

@Compose functions
@@Iterate a function
copyClosureCopies the lexical closure of a procedure
discontDiscontinuities of a function
funcenvCreate a function environment
mapApply a function to all operands of an object
mapratApply a function to a rationalized expression
operatorDefine a new operator symbol
fp::applyApply function to arguments
fp::bottomFunction that never returns
fp::curryCurry an n-ary function
fp::expr_unapplyCreate a functional expression from an expression
fp::fixargsCreate function by fixing all but one argument
fp::fixedptReturns fixed point of a function
fp::foldCreate function which iterates over sequences
fp::nestRepeated composition of function
fp::nestvalsRepeated composition returning intermediate values
fp::unapplyCreate a procedure from an expression
misc::breakmapStops the mapping currently done by maprec
misc::maprecMap a function to subexpressions of an expression
Pref::typeCheckType checking of formal parameters
Pref::warnDeadProcEnvWarnings about wrong usage of lexical scope
prog::getnameName of an object
prog::getOptionsGet and verify options within a procedure
prog::isGlobalInformation about reserved identifiers

예제 및 방법

Access Arguments of a Procedure

The terms parameters and arguments are often used interchangeably.

Test Arguments

When writing a MuPAD procedure, you can specify the type of arguments accepted by the procedure.

Verify Options

For many standard MuPAD procedures, you can use different options.

Data Collection

Suppose the data that you want to collect is generated element-by-element and you know in advance how many elements will be generated.

Variables Inside Procedures

When you call a procedure, MuPAD allocates memory for the local variables, marks them as uninitialized, and evaluates the body of the procedure.

Utility Functions

You can define utility functions inside a procedure.

Private Methods

Create private methods by using closures.

Calls by Reference and Calls by Value

When calling a procedure with some arguments, you expect the procedure to assign these values for its local variables and perform some computations with those variables.

개념

Functional Programming

Use only in the MuPAD Notebook Interface.

The misc Library

Use only in the MuPAD Notebook Interface.