harlan icon indicating copy to clipboard operation
harlan copied to clipboard

Better string handling

Open eholk opened this issue 10 years ago • 4 comments

Right now Harlan programs can't do much more with strings than pass them around. Even just adding facilities to convert between C strings and vectors of chars would greatly improve the ability of Harlan programs to manipulate strings.

eholk avatar Sep 03 '13 16:09 eholk

Cool... so how would I access the chars in a string in harlan?

its2mc avatar Apr 29 '15 13:04 its2mc

There's a function, str->vec, which converts a string to a vector of characters. From there you can use vector-ref to access individual characters. For example:

(let ((v (str->vec "hello")))
  (vector-ref v 0))

That should return the character 'h'.

eholk avatar May 05 '15 15:05 eholk

Cool.. will try that out when I get time.. I have twitter word analysis in mind.. but lets see how that can work.. :D

its2mc avatar May 06 '15 13:05 its2mc

Sounds like fun!

I've been working on a PLY file loader lately which is forcing me to improve Harlan's string and IO facilities. Hopefully that will help you out too.

eholk avatar May 06 '15 15:05 eholk