Re: NCI, undef and structures
Leopold Toetsch wrote: Ron Blaschke [EMAIL PROTECTED] wrote: I see. Does this morphing work as designed? Creating an array out of an undef feels somewhat wrong. Yes and yes ;) A longer answer is: all operators currently need an existing LHS. [snip] Thanks for explaining things. I guess the lesson here is: Don't mess with Undef, it's ... undefined. Or for the test case: check the return result of Cdlfunc. Thought so, too. I'll open a ticket. Ron
Re: Reality check
On Fri, 4 Feb 2005, Juerd wrote: Does this make sense? my @words = gather { for =(open '/usr/share/dict/words' err die) { .=chomp; next if /-[a-z]/; /$re/ and take { word = $_, score = %scores{ .letters }.sum }; } } == sort { .score } is descending, { .word.length }, { .word }; With some effort I managed to understand _which_ sense it should make up to this: } == sort { .score } is descending, { .word.length }, { .word }; I mean: everything of what is gather()ed gets 'piped' into sort() which sorts according to C { .score } . But what are the other args to it supposed to mean? (Sorry for being dense!) Michele -- i need to know what type of math and how much math a surgeon uses. How about asking what type of surgery and how much surgery a mathematician uses? - Robin Chapman in sci.math
Common error with | and ^$ in regexps
Will the relative precedence of grouping versus anchors for beginning and end of line remain the same in Perl6 rules? The error of writing /^(?:free|net|open)bsd|bsdos|interix$/ when you mean /^(?:(?:free|net|open)bsd|bsdos|interix)$/ is rather too easy to make. This is not the first time I've seen this sort of error, and I think I've made it myself at least once. My gut feeling is that the need to write expressions that behave as: /(?:^(?:free|net|open)bsd)|bsdos|(?:interix$)/ is actually very rare. Nicholas Clark - Forwarded message from Michael G Schwern [EMAIL PROTECTED] - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:makemaker@perl.org List-Id: makemaker.perl.org Delivered-To: mailing list makemaker@perl.org Delivered-To: makemaker@perl.org X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00 X-Spam-Check-By: la.mx.develooper.com Date: Mon, 7 Feb 2005 05:35:00 -0500 From: Michael G Schwern [EMAIL PROTECTED] To: Rafael Garcia-Suarez [EMAIL PROTECTED] Cc: makemaker@perl.org Subject: Re: Where were we at? In-Reply-To: [EMAIL PROTECTED] User-Agent: Mutt/1.4i On Fri, Jan 28, 2005 at 09:23:55AM -, Rafael Garcia-Suarez wrote: Please don't forget to integrate this platform-specific patch from bleadperl : Change 23849 by [EMAIL PROTECTED] on 2005/01/21 15:26:10 Subject: [perl #33892] Add Interix support From: Todd Vierling (via RT) [EMAIL PROTECTED] Date: 21 Jan 2005 14:36:31 - Message-ID: [EMAIL PROTECTED] I think the patch is wrong, or adding more wrongness. -$Is_BSD = $^O =~ /^(?:free|net|open)bsd|bsdos$/; +$Is_BSD = $^O =~ /^(?:free|net|open)bsd|bsdos|interix$/; That second pair of bsd|bsdos isn't enclosed in parens. Furthermore, its not freeinterix its just interix. Here's the right line. $Is_BSD = $^O =~ /^(?:free|net|open)bsd$/ or $^O eq 'bsdos' or $^O eq 'interix'; - End forwarded message -
Re: Reality check
Michele Dondi skribis 2005-02-07 11:45 (+0100): With some effort I managed to understand _which_ sense it should make up to this: } == sort { .score } is descending, { .word.length }, { .word }; I mean: everything of what is gather()ed gets 'piped' into sort() which sorts according to C { .score } . But what are the other args to it supposed to mean? (Sorry for being dense!) Since I sent the message, I learned that if you want to sort with multiple criteria, the first argument should be an arrayref of closures. So what I should have written is: == sort [ { .score } is descending, { .word.length }, { .word } ]; And it's easier to write if a simple numeric minus is used: == sort [ { -.score }, { .word.length }, { .word } ]; This makes sort sort by score first, but if two words score equally, word length will become important (score with as few letters as possible, because there's a greater chance of succeeding within the time limit). If the lengths are also equal, it sorts alphabetically, so that words beginning with the same letter are grouped together. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html
Re: Common error with | and ^$ in regexps
Nicholas Clark skribis 2005-02-07 12:10 (+): Will the relative precedence of grouping versus anchors for beginning and end of line remain the same in Perl6 rules? There currently is no such thing as precedence in regexes. Changing this would make understanding regexes a lot harder, I think. And now that (?:) is called [], I think teaching how to just do the right thing is easy enough. /^(?:foo|bar|baz)$/ /^ [ foo | bar | baz ] $/ Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html
Re: [perl #34059] [PATCH][MSWin32] Add NCI test symbols
Ron Blaschke wrote: Why not generate the .def file instead of hoping that people add the correct symbols? Here's a patch that seems to do the trick for me (though not running Windows, I can't really test if the defines are all correct). I haven't checked the details, but I think this will not work, as it seems to generates a list of all symbols beginning with nci_, but 'int_cb_D4' is used, too. nci_test.c is used only for testing. So there is no harm in renaming the symbols as needed. Previously, I have proposed adding 'PARROT_API' to declarations, and grep for them, or expand them to '__declspec(dllexport)' on Windows. This might work for 'parrot.dll', but not for libnci_test.dll, as it isn't a part of the interface on Parrot. #31649: [TODO] Win32 - Automatically Export Symbols http://rt.perl.org/rt3/Ticket/Display.html?id=31649 CU, Bernhard -- ** Dipl.-Physiker Bernhard Schmalhofer Senior Developer Biomax Informatics AG Lochhamer Str. 11 82152 Martinsried, Germany Tel: +49 89 895574-839 Fax: +49 89 895574-825 eMail: [EMAIL PROTECTED] Website: www.biomax.com **
Re: Common error with | and ^$ in regexps
On Mon, Feb 07, 2005 at 01:21:00PM +0100, Juerd wrote: Nicholas Clark skribis 2005-02-07 12:10 (+): Will the relative precedence of grouping versus anchors for beginning and end of line remain the same in Perl6 rules? There currently is no such thing as precedence in regexes. Changing this would make understanding regexes a lot harder, I think. A clarification: P6rules currently has precedence. Alternatives is one of the looser bindings. I suspect the original question is really asking about the relative precedence of [alternatives] versus anchors for beginning and end of [string], since the question arises even in the absence of (?:...) constructs. Here's a brief stab at a p6 rule expression precedence table, at least for what I've been working with in the grammar engine: terms a . \s \b ^ $ ^^ $$ (...) [...] ... :: ::: quantifiers * + ? *? +? ?? **{...} **{...}? backtracking : concatenation conjunctive alternative | Thus Nicholas' question is really asking if we can give ^ and $ a looser binding than alternatives, such that / ^ abc | def | ghi $ / binds as / ^ [ abc | def | ghi ] $/ and not / [^abc] | def | [ghi$] / It's certainly technically possible to do this, but I'd then wonder what to do about ^^ and $$, and if it would then be more confusing that ^ and $ (and possibly ^^ and $$) bind much more loosely than the other assertions. Personally, I'll let you guys hash out those things and then set the grammar engine to match. :-) Pm
Re: Test::Unit, ::Class, or ::Inline?
Belated response... On 26 Jan 2005, at 20:18, Michael G Schwern wrote: On Mon, Jan 24, 2005 at 04:11:56PM -0500, Ian Langworth wrote: I'm taking a software development class this semester which will involve writing extensive object-oriented code. My partner and I are trying to decide whether to use Test::Unit, ::Class, or ::Inline for our test scripts. I can see the advantages of Test::Class in terms of object heirarchy, but I really like the idea of having my tests right along with the methods when using Test::Inline. (The latter would be great when presenting our code to the class.) Thoughts? Test::Unit, as mentioned by Curtis, has been abandoned. Has it? I thought that the folk on [EMAIL PROTECTED] had taken it on ? If it has been abandoned I might adopt it (if only to add a note that active development has ceased and add pointers to Test::Builder based modules). [snip] The important thing to remember is these are all additive. Its not either or. You can safely use Test::Inline and Test::Class together. You can use them all in addition to traditional .t files. Use them all where appropriate. [snip] Definitely. Hell, I wrote T::C and I still start my test scripts with plain Test::More until I actually need things like fixtures. One of the things that makes Perl's testing framework so neat is the way you can integrate different testing models/frameworks via Test::Builder / TAP / Test::Harness. Cheers, Adrian
Re: Junctive puzzles.
[EMAIL PROTECTED] wrote: pugs ? 4 (0 | 6) 2 (#t|#f) Here's my take on it. Compare my $a = (0 | 6); say 4 $a and $a 2; vs say 4 (0 | 6) and (0 | 6) 2; The difference is that in the first case the junction refers to the same object, and the result should probably be expanded only once: (4 0 and 0 2) | (4 6 and 6 2) while in the second case, we have two different junctions, and each gets threaded separately: (4 0 and 0 2) | (4 6 and 6 2) | (4 0 and 6 2) | (4 6 and 0 2) The first expansion gives the correct result, while the other is really a variant on what you have. And I believe this becomes highly dangerous if you start assigning junctions around. :) Miro
Re: Still failing some dynclass/py*.t tests
On Fri, 4 Feb 2005, Andy Dougherty wrote: On Solaris/SPARC, I'm still seeing failure on the tests others have reported problems for. Failed 3/133 test scripts, 97.74% okay. 30/2167 subtests failed, 98.62% okay. Failed TestStat Wstat Total Fail Failed List of Failed --- t/dynclass/pybuiltin.t3 768 63 50.00% 2 4-5 t/dynclass/pyclass.t 3 768 63 50.00% 2 5-6 t/dynclass/pyint.t 24 614425 24 96.00% 1-10 12-25 7 tests and 66 subtests skipped. Here are some more details: [EMAIL PROTECTED] ([EMAIL PROTECTED]) signal SEGV (no mapping at the fault address) in Parrot_switch_to_cs at line 2136 in file packfile.c 2136 if (new_cs-base.pf != interpreter-code) (dbx) where current thread: [EMAIL PROTECTED] =[1] Parrot_switch_to_cs(interpreter = 0x5800d0, new_cs = 0x9de3bf70, really = 1), line 2136 in packfile.c [2] Parrot_Sub_invoke(interpreter = 0x5800d0, pmc = 0x78daa0, next = 0x864dc0), line 240 in sub.c [3] Parrot_Closure_invoke(interpreter = 0x5800d0, pmc = 0x78daa0, next = 0x864dc0), line 84 in closure.c [4] Parrot_PyFunc_invoke(interpreter = 0x5800d0, pmc = 0x78daa0, next = 0x864dc0), line 171 in pyfunc.pmc [5] Parrot_invoke(cur_opcode = 0x864dbc, interpreter = 0x5800d0), line 421 in core.ops [6] runops_slow_core(interpreter = 0x5800d0, pc = 0x864dbc), line 147 in runops_cores.c [7] runops_int(interpreter = 0x5800d0, offset = 0), line 742 in interpreter.c [8] runops(interpreter = 0x5800d0, offs = 0), line 81 in inter_run.c [9] Parrot_runcode(interpreter = 0x5800d0, argc = 1, argv = 0xffbefa90), line 768 in embed.c [10] Parrot_runcode(interpreter = 0x5800d0, argc = 1, argv = 0xffbefa90), line 700 in embed.c [11] main(argc = 1, argv = 0xffbefa90), line 603 in main.c The new_cs structure is coming from Parrot_Sub_invoke in the file sub.c. It's generated with line 232: 232 struct Parrot_sub * sub = PMC_sub(pmc); At this point, the 'sub' structure doesn't appear to have anything useful. (dbx) print *sub *sub = { seg = 0x9de3bf70 address = 0xf227a048 end = 0xf027a044 name = 0xe007a044 packed = 0x9014 bad address 0x9014 use_reg_offs = 1080280737U pad_stack= 0x100 } Attempts to access any of those members yield error messages, like (dbx) print *sub-name dbx: cannot access address 0xe007a044 Tracing back further, I lost track and couldn't figure out who was ultimately responsible for ensuring that 'pmc' was properly initialized, so I got stuck here. -- Andy Dougherty [EMAIL PROTECTED]
Re: [perl #34059] [PATCH][MSWin32] Add NCI test symbols
Bernhard Schmalhofer wrote: Ron Blaschke wrote: I haven't checked the details, but I think this will not work, as it seems to generates a list of all symbols beginning with nci_, but 'int_cb_D4' is used, too. nci_test.c is used only for testing. So there is no harm in renaming the symbols as needed. Previously, I have proposed adding 'PARROT_API' to declarations, and grep for them, or expand them to '__declspec(dllexport)' on Windows. This might work for 'parrot.dll', but not for libnci_test.dll, as it isn't a part of the interface on Parrot. How about this: We separate things into 2 steps. 1) Create a .sym file for each relevant compilation unit. 2) Join the .sym files for all to-be-linked objects and create the .def file. (on Windows) Now things boil down to creating the .sym files. These might be created by grepping the source for Cnci_, CParrot_, etc, or by whatever script created the compilation unit. Disclaimer: I might have shamelessly stolen one idea or the other from the perl source. ;-) Ron
Re: Reality check
On Fri, Feb 04, 2005 at 10:39:30PM +0100, Juerd wrote: : Does this make sense? : : my @words = gather { : for =(open '/usr/share/dict/words' err die) { : .=chomp; : next if /-[a-z]/; : /$re/ and take { word = $_, score = %scores{ .letters }.sum }; : } : } == sort { .score } is descending, { .word.length }, { .word }; The other problem with this that = binds tighter than == does. Once you start with pipes you probably want to stick with pipes: gather {...} == sort {...} == my @words; or my @words == sort {...} == gather {...}; or just go back to the tried and true: my @words = sort {...} gather {...}; Larry
Latest MSWin32 Test Results
Just for your information: Here are the latest test results on Windows. Ron Failed TestStat Wstat Total Fail Failed List of Failed --- t\dynclass\pybuiltin.t5 1280 65 83.33% 1-2 4-6 t\dynclass\pyclass.t 6 1536 66 100.00% 1-6 t\dynclass\pycomplex.t1 256 11 100.00% 1 t\dynclass\pyfunc.t 4 1024 44 100.00% 1-4 t\dynclass\pyint.t 25 640025 25 100.00% 1-25 7 tests and 64 subtests skipped. Failed 5/133 test scripts, 96.24% okay. 41/2167 subtests failed, 98.11% okay. NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0xff' Stop.
Re: [perl #34072] parrot build fails on Linux PPC
On Sun, Feb 06, 2005 at 01:57:09PM -0800, chromatic wrote: On Sun, 2005-02-06 at 10:40 -0800, Jeff Dik wrote: So, I just commented out line 14 of jit/ppc/core.jit [patch attached], recompiled, and ran make fulltest. Only one test failed (test 5 of t/dynclass/pyclass.t). I'm guessing that merely commenting that line out is *not* The Right Way(TM) and that it might break things on other platforms. Hopefully, somebody knows The Right Solution(TM). :-) Bug #32514 has a Righter Solution. I don't claim that it's The Right, but I think it does allow JITting. Ah yes, your patch seems to be about infinitely more Right, even if it's not The Right. I take it that bug #32514 is still awaiting some TLC by a Configure hacker? If somebody could delete this ticket for me, that would be great. I need to learn to search this RT thing before I file a new ticket. Sorry about the noise. Jeff
Re: Test::Unit, ::Class, or ::Inline?
On Mon, Feb 07, 2005 at 03:03:29PM +, Adrian Howard wrote: Test::Unit, as mentioned by Curtis, has been abandoned. Has it? I thought that the folk on [EMAIL PROTECTED] had taken it on ? http://groups.yahoo.com/group/PerlUnit/ shows some activity on the mailing list. Its members-only so I joined to see what's going on. There was a grand total of 24 messages from January to March 2004 until the list effectively died. Everything else after that is spam. I sent out a lifeline post pointing whoever's left here and at qa.perl.org.
Re: Junctive puzzles.
On Mon, Feb 07, 2005 at 05:33:06PM +0100, Miroslav Silovic wrote: my $a = (0 | 6); say 4 $a and $a 2; Yup. My mathematic intuition cannot suffer that: 4 X 2 to be true in any circumstances -- as it violates associativity. If one wants to violate associativity, one should presumably *not* use the chained comparison notation! So Pugs will evaluate that to (#f|#f), by lifting all junctions out of a multiway comparison, and treat the comparison itself as a single variadic operator that is evaluated as a chain individually. This way, both associativity and junctive dimensionality holds, so I think it's the way to go. Please correct me if you see serious flaws with this approach. Thanks, /Autrijus/ pgpbnBpjxcFNh.pgp Description: PGP signature
Re: Junctive puzzles.
On Tue, 8 Feb 2005 11:12:40 +0800, Autrijus Tang [EMAIL PROTECTED] wrote: On Mon, Feb 07, 2005 at 05:33:06PM +0100, Miroslav Silovic wrote: my $a = (0 | 6); say 4 $a and $a 2; Yup. My mathematic intuition cannot suffer that: 4 X 2 to be true in any circumstances -- as it violates associativity. If one wants to violate associativity, one should presumably *not* use the chained comparison notation! Indeed. It smells like relational algebra, so we can confirm this intuition with a rather familiar example: select * from $a cross join $b cross join $c where a b and b c Looks right to me! I look forward to the SQL query construction modules in Perl6. :) Ashley
eq_array testing values prematurely...
I've written some coverage tests for Ima::DBI as part of Phalanx, but I get a warning under -W promptHARNESS_PERL_SWITCHES=-W make test And got these warnings [EMAIL PROTECTED] Ima-DBI-0.33]$ HARNESS_PERL_SWITCHES=-W make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/DBIok 3/0Use of uninitialized value in string eq at /usr/lib/perl5/5.8.0/Test/More.pm line 1013. Use of uninitialized value in string eq at /usr/lib/perl5/5.8.0/Test/More.pm line 1013. t/DBIok All tests successful. Files=1, Tests=54, 0 wallclock secs ( 0.32 cusr + 0.03 csys = 0.35 CPU) Investigating further, that line in Test::More is sub eq_array { my($a1, $a2) = @_; return 1 if $a1 eq $a2; ... Now the more recent versions of eq_array (you can see I'm using 5.8.0) try to protect it a bit from non-array references, but even running the latest version of Test::More::eq_array (and _eq_array) still gives this warning. So I changed it to this sub eq_array { my($a1, $a2) = @_; if (defined $a1 and defined $a2) { return 1 if $a1 eq $a2; } And we get [EMAIL PROTECTED] Ima-DBI-0.33]$ HARNESS_PERL_SWITCHES=-W make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/DBIok All tests successful. Files=1, Tests=54, 1 wallclock secs ( 0.33 cusr + 0.02 csys = 0.35 CPU) I'm guessing this is the right forum to post this too - unless I should go right ahead and file with RT...? -- Leif Eriksen Snr Developer http://www.hpa.com.au/ phone: +61 3 9217 5545 email: [EMAIL PROTECTED]
Re: eq_array testing values prematurely...
It seems to me that that would just hide other problems. This function is for comparing 2 arrays and if neither of them things passed in are actually arrays then it's quite right to issue a warning. Why is this test passing undef into both arguments of eq_array? Fergal On Tue, Feb 08, 2005 at 05:02:50PM +1100, [EMAIL PROTECTED] wrote: I've written some coverage tests for Ima::DBI as part of Phalanx, but I get a warning under -W promptHARNESS_PERL_SWITCHES=-W make test And got these warnings [EMAIL PROTECTED] Ima-DBI-0.33]$ HARNESS_PERL_SWITCHES=-W make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/DBIok 3/0Use of uninitialized value in string eq at /usr/lib/perl5/5.8.0/Test/More.pm line 1013. Use of uninitialized value in string eq at /usr/lib/perl5/5.8.0/Test/More.pm line 1013. t/DBIok All tests successful. Files=1, Tests=54, 0 wallclock secs ( 0.32 cusr + 0.03 csys = 0.35 CPU) Investigating further, that line in Test::More is sub eq_array { my($a1, $a2) = @_; return 1 if $a1 eq $a2; ... Now the more recent versions of eq_array (you can see I'm using 5.8.0) try to protect it a bit from non-array references, but even running the latest version of Test::More::eq_array (and _eq_array) still gives this warning. So I changed it to this sub eq_array { my($a1, $a2) = @_; if (defined $a1 and defined $a2) { return 1 if $a1 eq $a2; } And we get [EMAIL PROTECTED] Ima-DBI-0.33]$ HARNESS_PERL_SWITCHES=-W make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/DBIok All tests successful. Files=1, Tests=54, 1 wallclock secs ( 0.33 cusr + 0.02 csys = 0.35 CPU) I'm guessing this is the right forum to post this too - unless I should go right ahead and file with RT...? -- Leif Eriksen Snr Developer http://www.hpa.com.au/ phone: +61 3 9217 5545 email: [EMAIL PROTECTED]
Re: Junctive puzzles.
On Tue, Feb 08, 2005 at 11:12:40AM +0800, Autrijus Tang wrote: : This way, both associativity and junctive dimensionality holds, so : I think it's the way to go. Please correct me if you see serious : flaws with this approach. Feels right to me. Larry