another sug*estion? /soft seeking ...
[1/2] from: petr::krenzelok::trz::cz at: 28-Nov-2000 11:11
Hi, I am not sure If I am alone missing the so called soft-seeking capability in REBOL? What's the point? Let's assume the following series: blk: [1 2 3 6 7 8 9] find blk 4 returns currently none, but there are cases, when you want to return the nearest value ... e.g. I have block of files built from dates: 20001101 2001102 2001105 ... the problem is - we don't download data on weekends. Then my user selects he wants report starting at 1.1.2000, ending at 30.11.2000. But what if 1.1.2000 is a weekend day? The search in block will not be succesfull ... If some kind of find/soft would exists, it could return the nearest value found ... (the same behavior for /reverse seeking) The problem is our series can contain mixture of various datatypes .... So, is it even achievable? Hope someone understands what I want to express :-) Cheers, -pekr-
[2/2] from: al:bri:xtra at: 29-Nov-2000 10:44
Petr Krenzelok wrote:
> I am not sure If I am alone missing the so called soft-seeking capability in REBOL? What's the point? > Let's assume the following series:
<<quoted lines omitted: 6>>> The problem is our series can contain mixture of various datatypes .... > So, is it even achievable?
> Hope someone understands what I want to express :-)
I've had a similar problem in generating reports on student attendance, and needing to "miss out" weekends and public holidays. Here's how I do it. Terms: [ ; 4 terms in New Zealand school year. 1/Feb/2000 7/Apr/2000 26/Apr/2000 30/Jun/2000 17/Jul/2000 22/Sep/2000 9/Oct/2000 7/Dec/2000 ] Holidays: [ ; Only these holidays are the ones that matter. 20/Oct/2000 23/Oct/2000 ] Term: make block! length? Terms foreach [Start End] Terms [ append/only Term map exclude iota Start End Holidays func [Date [date!]] [ if any [ Saturday? Date Sunday? Date ][ exit ; return unset! - so weekends aren't included. ] Date ] ] 'Term then ends up with only the dates that matter for student attendance. Similarly for your reporting interval. What matters is that the dates from 1.1.2000 to 30.11.2000 are the ones reported. So: Dates: iota 1/Jan/2000 30/Nov/2000 generates a block containing every date of interest. Then: union Dates Report_Dates gives the dates of interest. I hope that helps! BTW, 'iota should be on my site. Andrew Martin Around here somewhere...
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted