Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: why are hex values not numbers?

by AnomalousMonk (Archbishop)
on Sep 28, 2016 at 00:14 UTC ( [id://1172789]=note: print w/replies, xml ) Need Help??


in reply to why are hex values not numbers?

Once you get this vexed question nailed down, I think you should investigate why the substr built-in is named "substr" and not "substring", "subStr", "subString", "sub_str", "sub_string" or any of a large number of other possibilities. You may answer "Well, they had to call it something," but is just saying "The documentation says it, I believe it, that settles it!" ever really satisfactory? Question authority! (Please see perlfunc for additional raw material. Personally, I've been wondering a lot lately about grep.)


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: why are hex values not numbers?
by choroba (Cardinal) on Sep 28, 2016 at 09:08 UTC
    English Wikipedia on Grep:

    > grep's name comes from the ed command g/re/p (globally search a regular expression and print)

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re^2: why are hex values not numbers?
by eyepopslikeamosquito (Archbishop) on Sep 28, 2016 at 10:21 UTC

    I think you should investigate why the substr built-in is named "substr" and not "substring", "subStr", "subString", "sub_str", "sub_string" or any of a large number of other possibilities.
    Alas, even the shortest of these (substr) is way too long to be competitive at code golf. As a golfer, I wish Perl had used a built-in operator rather than the substr function for string slicing. This is one of the very few areas where Python trounces Perl at code golf, as discussed in detail at Re: Drunk on golf: 99 Bottles of Beer.

    Quite apart from golf, I miss Python's concise and powerful string slicing operator when coding in Perl and feel string slicing is a common enough operation to warrant a very short "Huffman-coded" way to do it -- especially given "things that are commonly used should be shorter/more succinct" is one of Larry's language design principles. I also find it odd that Perl supports built-in array and hash slices, but not built-in string slices.

      I quite agree with your reasoning and conclusion. That said, substr is one of the Perl functions I use the least; uncommonly, on par with things like getpwuid, at least for me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1172789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found