Zulip Chat Archive
Stream: general
Topic: startswith
Patrick Massot (Jan 04 2019 at 14:34):
Do we have something like string.startswith : string -> string -> bool
somewhere?
Mario Carneiro (Jan 04 2019 at 14:36):
There are <:+
and <+:
for comparing lists, you could use that
Gabriel Ebner (Jan 04 2019 at 14:43):
Omg. Did you get these hieroglyphs from Haskell or from Scala?
Patrick Massot (Jan 04 2019 at 14:43):
I currently use
def string.startswith (s s' : string) : Prop := (s'.to_list).is_prefix_of s.to_list instance (s s') : decidable (string.startswith s s') := by unfold string.startswith ; apply_instance
Patrick Massot (Jan 04 2019 at 14:44):
I guess one of your hieroglyphs stands for list.is_prefix_of
Patrick Massot (Jan 04 2019 at 14:44):
But my hope was really that all this should be there already
Mario Carneiro (Jan 04 2019 at 14:45):
the hieroglyphs were a terrible idea that I now regret
Mario Carneiro (Jan 04 2019 at 14:56):
I agree that we should have this function already defined. In particular, you can make a more efficient implementation by working with string iterators instead of lists
Mario Carneiro (Jan 04 2019 at 14:57):
I should load up the docs for strings in haskell or java and copy everything I see
Patrick Massot (Jan 04 2019 at 14:58):
I vote for doing that as soon as all topology and commutative algebra PR will be merged!
Mario Carneiro (Jan 04 2019 at 14:59):
I'm working on #464, making good progress
Mario Carneiro (Jan 04 2019 at 15:00):
what commutative algebra PRs?
Patrick Massot (Jan 04 2019 at 15:01):
I'm joking, keep going on analysis. You'll have many nights in Amsterdam for algebra
Sebastien Gouezel (Jan 04 2019 at 19:38):
I'm working on #464, making good progress
Btw, I updated the PR two days ago, but if you started working on the previous version you can of course disregard the modifications I made.
Mario Carneiro (Jan 04 2019 at 19:43):
yeah, I noticed and have already incorporated your changes
Last updated: Dec 20 2023 at 11:08 UTC