Arc Forumnew | comments | leaders | submitlogin
1 point by Pauan 4785 days ago | link | parent

"less buggy"? You're using k when it should be key. :P It is shorter, though, so thanks for that.

---

"There aren't that many axiomatic things strings do in Arc"

Yeah, I know. Tables seem to be the big pain point. Possibly conses too, if somebody wanted to extend those... tables seem like they'd be the most common thing to extend, though, and also the trickiest.

---

"[...] being coerced to a lazy list, sent through a function, and coerced back [...]"

Oh! Oh! I know! Let's use message passing! :P We can give strings an 'iter message! Just like Python! Whooo! I'm reminded of the Jamie Zawinski quote, "Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems."

Actually, I think it'd just be easier to define a `coerce` rule for 'iter, no need for message passing in that situation. Now, as for the actual creation of iterators, that could be done with message passing. :P

Then again... you're right that if pos-string uses the same type 'string as built-in strings, then `coerce` won't be able to know that it should use pos-string... unless you added in a message to the iterator, of course. But then that won't play as well with coerce...

I guess that is one example where the current way of coerce + extend + new-type-every-time is actually better.



1 point by rocketnia 4785 days ago | link

"You're using k when it should be key. :P"

Fixed! Now it oughta be less buggy. ^^

---

"Tables seem to be the big pain point. Possibly conses too[...]"

I could be wrong, but I think it's enough for a table to extend 'keys, function call behavior, and 'sref. <Insert usual disclaimer that there'd need to be predicates like 'supports-keys in the absence of failcall.>

For Penknife's purposes, the only reason I care about cons cells is that they're eager implementations of nonempty lazy lists. They should support function call behavior, 'sref, and the one and only lazy list operation:

  (iffirst first rest seq
    <...thing to do with first and rest if the seq isn't empty...>
    <...thing to do if the seq is empty...>)
If cons cells are mutable and allowed to be improper, then they need 'scdr too, and it might be more elegant to add 'scar, 'car, and 'cdr.

-----

1 point by Pauan 4784 days ago | link

"I could be wrong, but I think it's enough for a table to extend 'keys, function call behavior, and 'sref."

And the built-in `table?` as well, so other code recognizes it as a table.

-----