plist-sig.sml

来自「这是我们参加06年全国开源软件的竞赛作品」· SML 代码 · 共 45 行

SML
45
字号
(* plist-sig.sml * * COPYRIGHT (c) 1999 Bell Labs, Lucent Technologies. * * Property lists using Stephen Weeks's implementation. *)signature PROP_LIST =   sig     type holder     val newHolder : unit -> holder     val clearHolder : holder -> unit    val sameHolder : (holder * holder) -> bool	(* returns true, if two holders are the same *)  (* newProp (selHolder, init)   * creates a new property for objects of type 'a and returns   * functions to get the property, set it, and clear it.  The function   * selHolder is used to select the holder field from an object   * and init is used to create the initial property value.   * Typically, properties are reference cells, so that they can   * be modified.  The difference between peekFn and getFn is that   * peekFn returns NONE when the property has not yet been created,   * whereas getFn will allocate and initialize the property.  The   * setFn function can either be used to initialize an undefined property   * or to override a property's current value.   *)    val newProp : (('a -> holder) * ('a -> 'b)) -> {	    peekFn : 'a -> 'b option,	    getFn  : 'a -> 'b,	    setFn  : ('a * 'b) -> unit,	    clrFn  : 'a -> unit	  }    val newFlag : ('a -> holder) -> {	    getFn : 'a -> bool,	    setFn : ('a * bool) -> unit	  }  end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?