问题标签 [fill-pointer]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
string - How to initialize a string with a fill pointer in Common Lisp?
I want to use formatted output in a loop to generate a string. Manual says it can be easily done by giving format
function a string with a fill pointer as a destination. Unfortunately, it is not transparent from the manual how to initialize this string in the first place.
I tried (string "")
and (format nil "")
with no luck.
(make-array 0 :element-type 'character :fill-pointer 0)
did work for me, but it just doesn't feel right.
What is the proper way to initialize a string with a fill pointer?
vector - 在结果向量中使用填充指针合并两个向量
我有两个带有填充指针的向量。我需要merge
这些向量,因此有一个仍然具有填充指针的新向量。
我似乎找不到要指定合并的类型,以便结果将具有填充指针。我想明显的解决方法是:
- 自己编写一个
merge
函数,声明一个新向量并以正确的顺序执行插入。 - 使用填充指针将结果复制到另一个向量中。
当然,如果有一种方法可以使用merge
标准来做到这一点,那么这两种解决方法都非常不令人满意。