<< Back to previous view

[CLJ-688] subs function should count back from the end of the string when given negative offset Created: 09/Dec/10  Updated: 01/Mar/13  Resolved: 31/Dec/10

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.2
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Phil Hagelberg Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None

Attachments: Text File 0001-subs-should-count-backwards-when-given-a-negative-ar.patch    
Patch: Code and Test

 Description   

subs function should count back from the end of the string when given negative offset.

Patch attached with test and implementation.



 Comments   
Comment by Stuart Halloway [ 31/Dec/10 3:39 PM ]

A major strength of Clojure is consistency. If (foo X) works, then (foo Y) should work if X and Y are similar in relevant ways.

The negative offset convenience was considered and rejected when the string library was originally moved into Clojure. In order for a feature like this to be on the table, a proposal would need to include an evaluation of all API fns that take indexes, and a plan to either make all of them handle negative indexes, or have a meaningful rule about which ones do and which ones don't. If someone is interested in doing this, please begin with a motivating problem statement in the Design space.

That said, this feels very low priority.

Generated at Mon Sep 01 03:39:38 CDT 2014 using JIRA 4.4#649-r158309.