|
Wow, you guys know nothing. That facelift is yards better than the design before it. And yes, that gluey top bar is executed oddly.
|
# ¿ Aug 26, 2009 14:27 |
|
|
# ¿ May 17, 2024 01:52 |
|
How come in a for loop over a tied array, FETCH gets called twice for each index? Seems kind of... redundant. I would look for the reason why in the source myself but I don't know how to navigate it.
|
# ¿ Sep 11, 2009 22:54 |
|
You know what, nevermind. It was probably something gay in my implementation of the tied class. vv
Triple Tech fucked around with this message at 19:04 on Sep 14, 2009 |
# ¿ Sep 14, 2009 18:50 |
|
Let's say I have an idea for a framework. Should I publish immediately to CPAN so people can start toying with it or should I hold back until it's "complete"? I know what you're thinking. Triple Tech, you always have ideas! I know. But this time I actually made some proof of concept code, so I know this works somewhat. The idea is to have LINQ for Perl. If you don't know LINQ, it's a query language for C#. It's like having SQL for lists/arrays or really any collection (trees, graphs, other data providers). Here's what I would think it would look like in Perl: code:
|
# ¿ Sep 14, 2009 23:06 |
|
Tim Berners-Lee posted:I don't know LINQ, but most of it looks to be redundant in perl. Perl already has map, grep, and sort. All you'd be doing is changing the syntax. That's like saying LINQ is redundant because SQL exists. Which is only partially true. The point of making a language-integrated query ... language. is so that other people can implement data providers. So of course LINQ for local collections looks like it could be done better with map, grep, and sort. But you can use the remote collections version for both remote and local collections. Then, you could mix and match local and remote collections. It's like doing a join at runtime between an array and an XML document, without writing a lick of SQL or XPath.
|
# ¿ Sep 15, 2009 13:32 |
|
It's running it from the current working directory. It has nothing to do with your environment variables.
|
# ¿ Nov 9, 2009 01:25 |
|
I might be talking out of my bum. I'm sorry.
|
# ¿ Nov 9, 2009 02:01 |
|
Maybe the flip flop operator can do what you want.
|
# ¿ Jan 7, 2010 21:44 |
|
Captain Frigate posted:so does [mah codez] do what I think it does? No. You usually flip flop between boundaries (like $i == 2 or /START/). If you run your code, you print everything from 3 up. Why: The code fails until it hits three. At which point it satisfies and flips to the second condition. Code up until that condition is true, it's less than seven. Then, when you hit seven, that second expression is false, so it flops back to the first. But wait, every high number is always greater than 2. So it prints the rest. You want hard boundaries like Vanadium posted.
|
# ¿ Jan 8, 2010 17:09 |
|
At a really high level, there aren't really types with scalars. (internally, there is, but that's not what we're talking about)code:
|
# ¿ Jan 12, 2010 21:46 |
|
Filburt Shellbach posted:To be fair special variables are basically impossible to google for. The further explosion of punctuation is one reason I dislike Perl 6. This is stupid. If you're within reach of Google, you're within reach of perlvar.
|
# ¿ Jan 12, 2010 22:40 |
|
CanSpice posted:I can get perlvar on my iPhone? You sho can, little boy! Just point yer Safaris to here!
|
# ¿ Jan 13, 2010 21:29 |
|
Are there any initiatives to get Perl5 or Perl6 onto .NET? It seems like there used to be for Perl5, but I think it's dead now. I use C# at work and I'm a junkie now, I love it. Perl6 looks good in the way Duke Nukem Forever looks good.
|
# ¿ Jan 19, 2010 19:58 |
|
I've been listening the FLOSS Weekly podcast and I heard about IronPython, Jython, and IronRuby, etc... It made me think, wow, this is almost as bad/crazy as Parrot! And now I feel like making a chart... Here are all the VMs, .NET, JVM, Parrot, and here are all the languages on top of it... And you can have crazy permutations! C# on Parrot IronPerl JPHP Although I don't know any sane person that would want to redo the abortion that is PHP.
|
# ¿ Jan 19, 2010 21:12 |
|
Just because you can jam everything on to one line doesn't mean you have to. What's matrix?
|
# ¿ Jan 21, 2010 21:07 |
|
So... you want to set up a 2D array. Super, that's pretty straight forward. And I'm guessing "matrix" is a key. It should really be quoted to make it more clear. Keys for hashes should be quoted since they are strings/scalars. If you're doing a 2D array, why would you need a hash? If it's a single value hash/dictionary, that doesn't really make sense. Why not start just at the 2D array? A 2D array in Perl is not unlike the way it's done in other languages. It's literally an array of arrays. Except that Perl does not support typed or first class 2D arrays (where it isn't an array OF arrays but a native, 2-dimensional data structure with two indices).
|
# ¿ Jan 21, 2010 21:37 |
|
Well if both values aren't indices starting at zero, it's not really an array, is it? I mean, the storage mechanism could be anything (AoA) but accessing it is a whole different story. Storing the 10th and 20th values of something results in what, a 20 element array or a 2 element array? You want a hash of hashes, each key happening to be a number. code:
Edit: Alternatively, you could have an x_lookup and a y_lookup and a 2D array for storing the values themselves. But that's three data structures instead of one monster one.
|
# ¿ Jan 21, 2010 22:24 |
|
If you value iterating over them cell by cell in order, then a 2D array is the way to go. What I meant by the lookups is that the array indices will have no semantic value to you. Hence the lookup table to provide a mapping between semantic index and array index.code:
|
# ¿ Jan 21, 2010 22:49 |
|
I'm assuming you have you x keys and your y keys already in an ordered list (or some sort of source). If not, then you need to keep sorting them if you iterate over the keys in the lookup hash or keep a regular list of values in their significant order. There are so many ways of tackling this problem and the answer is IT DEPENDS on your use case. Are you building this structure, are you reading it, does it need to be fast, how are you reading it, etc. All of these things matter and I have no idea what you want. PS - If building and arbitrary reading are all important, consider making or finding a matrix class that provides ordered and random access, implementation be damned.
|
# ¿ Jan 21, 2010 23:39 |
|
Mithaldu posted:You need to stop golfing your stuff so hard. Hey everyone, pro tip! This one, right here! Just because you can chain nested indices together doesn't mean you should! code:
|
# ¿ Jan 22, 2010 16:54 |
|
Golfing. To code emphasizing the least amount of keystrokes. Usually results in lovely, unreadable code.Captain Frigate posted:Wow I did that and it worked out great! I assume perl like references better than lots of stacked brackets? I'm not sure what you mean by golfing though. Yes, pretty much. But after the first index, you don't need subsequent arrows for dereferencing. code:
|
# ¿ Jan 22, 2010 17:41 |
|
You know what, I take back what I said about quoting keys. My misunderstanding. I thought the default case was it as an expression. Turns out that hasn't been the case for some time. I got it backwards. I'm confusing it with functions that consume parenthesis.
|
# ¿ Jan 22, 2010 17:58 |
|
The canonical example of what I was referring to is:code:
|
# ¿ Jan 22, 2010 18:14 |
|
Wow, way too much crazy going on up there. You have a fundamental misunderstanding with references and how to access them. Granted, I went through the exact same thing, but once you get it, it's pie (except for maybe some weird edge cases or trying to find the last index of an array ref, both of which could easily be addressed by not nesting indices).Captain Frigate posted:I have no idea what is happening here. What does the preceding "+" do? The "unary plus" operator forces Perl to evaluate the expression in a different manner. In the first example, it consumes the parenthesis before print can, so print evaluates over the whole expression instead of just the parenthesis. In the second example, you're saying that print should be treated as more than just a bareword, and that you want to plusify (aka do nothing to) the return value of a function called print.
|
# ¿ Jan 22, 2010 21:06 |
|
Otto Skorzeny posted:for (('to you', 'dear '.shift)[0,0,1,0]) { print "Happy birthday $_! " } Mind blown. Is it someone's birthday? Edit: code:
Triple Tech fucked around with this message at 21:48 on Feb 16, 2010 |
# ¿ Feb 16, 2010 21:45 |
|
Alter does not return a result set*. If the execute doesn't die, it was successful. Capture in an eval block if you want error detection, as opposed to success detection. * as far as I know on SQL Server. Typically only SELECT statements do, barring some weird DB implementations
|
# ¿ Jun 26, 2010 01:23 |
|
The logo is a bikeshed. Larry should kill himself based off that butterfly alone. Both are terrible but obviously Sri's is yards less terrible.
|
# ¿ Jun 26, 2010 15:54 |
|
satest3 posted:I like you. What are the braces referring to?
|
# ¿ Jul 14, 2010 03:32 |
|
I recently took up a new job in NYC in one of the city's like... five or so active Perl shops. It's like a vicious cycle! Anyway, I should be back on the Perl grind soon. I'm going to miss Visual Studio...
|
# ¿ Jul 31, 2010 15:41 |
|
Fenderbender posted:Probably took my last job. ;X Where did you work and where do you work now?
|
# ¿ Aug 1, 2010 21:03 |
|
I'm not exactly sure what features Perl6 even has, but it's poised in my head as "The Jesus Language". Whatever killer feature other languages have, Perl6 needs to have. Or, if Perl6 already has it, people just need to be educated about it. The only killer things I can think of are... * Low barrier parallelization (threads, cores, etc) * ORM * Client-side collection querying (like LINQ) * Web MVC framework (yawn) Once those spaces have matured (for any language, really), I'm not really sure what's left to do.
|
# ¿ Aug 4, 2010 14:46 |
|
I conflated Perl6 core with its ecosystem. I agree ORM and MVC needn't be core, but client-side querying and parallelization would get a huge boost if they were much closer to the native constructs of the language. Otherwise it'd be another Moose-type project and who needs that. Just make it core.
|
# ¿ Aug 5, 2010 20:53 |
|
You can consume it directly or use more concise notation.code:
|
# ¿ Aug 6, 2010 14:39 |
|
Keep in mind the above/latest/hash technique won't work if the keys are not unique.
|
# ¿ Oct 28, 2010 15:07 |
|
What is state of developers were you work? (assuming you do Perl full time) We lost three people recently and it's been really hard to find developers of that caliber to replace them. How are you guys coping with the current state of the industry?
|
# ¿ Aug 4, 2012 01:15 |
|
|
# ¿ May 17, 2024 01:52 |
|
EVGA Longoria posted:Anyone have any tricks for designing complex data structures? I've been doing it in my head but it ends up taking longer than it should to wrap my head around it. I'd like an easy way to (visually, preferably) layout a hash of arrays of hashes and the like to make sure I'm getting all the key pieces. Maybe you just need to mitigate its complexity? What are you designing? Arrays for collections, hashes for objects. Dunzo.
|
# ¿ Aug 21, 2012 10:48 |