Re: Using Inline::C to Implement a binary search with callback (clobbering $a, $b, leaking)

2013-08-14 Thread sisyphus1
-Original Message- From: David Oswald Sent: Thursday, August 15, 2013 7:45 AM To: inline Subject: Using Inline::C to Implement a binary search with callback (clobbering $a, $b, leaking) I'm working on implementing a binary search using Inline::C. Eventually I want to be able to ca

Using Inline::C to Implement a binary search with callback (clobbering $a, $b, leaking)

2013-08-14 Thread David Oswald
I'm working on implementing a binary search using Inline::C. Eventually I want to be able to call it like this: my $found_ix = binary_search { $a <=> $b } @ordered_numbers; or my $found_ix = binary_search { $a cmp $b } @ordered_strings; Currently I've got it to this point: my $found = binary_

Re: Implementing a callback with Inline::C

2013-08-14 Thread David Oswald
Rob, Thanks! My use-case is that I'm rewriting List::BinarySearch in XS via Inline::C and eventually InlineX::C2XS. I haven't had a chance to put your clues to the test, but should be able to get to it this afternoon. My eventual goal (once I get around to figuring out prototypes via Inline::C)

Re: Implementing a callback with Inline::C

2013-08-14 Thread sisyphus1
-Original Message- From: David Oswald Sent: Wednesday, August 14, 2013 7:24 AM To: inline Subject: Implementing a callback with Inline::C See also http://www.perlmonks.org/index.pl?node_id=976632 for some other ideas. The "perfect" approach still eludes me, however. Cheers, Rob