タグ

2016年12月30日のブックマーク (1件)

  • リリカル☆Lisp開発日記 » Blog Archive » displaced array

    Common Lispにはdisplaced arrayと呼ばれるものがあります。 これは他の配列へのポインタのようなもので、CLHSでは以下のように定義されています。 displaced array n. an array which has no storage of its own, but which is instead indirected to the storage of another array, called its target, at a specified offset, in such a way that any attempt to access the displaced array implicitly references the target array. (CLHS: Glossary-Section D) 試しに使ってみるとこんな感じです。 C

    masatoi
    masatoi 2016/12/30
    非破壊的なところではsubseqを使うより部分配列への参照として持っていた方が省メモリになるという