Difference between revisions of "Talk:String Handling Routines"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
 
(125 intermediate revisions by 79 users not shown)
Line 1: Line 1:
[http://afreelancespork.ifrance.com/text/km-renault/ km0 renault clio benzina auto km 0] [http://poriddle.ifrance.com/articles/britannia/ britannia 25] [http://chelsxd.ifrance.com/directory/esibizionismo-roma.htm esibizionismo roma] [http://wagreenw.ifrance.com/text/alice-in.htm alice in chains music bank the videos] [http://stormclouds13.ifrance.com/description/hoda.htm hoda] [http://lucornew.ifrance.com/articles/televisori-da/ televisori da 37] [http://pulema.ifrance.com/small/milano-bergamo.htm milano bergamo bruxelles biglietti aerei] [http://afreelancespork.ifrance.com/text/carta-de/ carta de verano] [http://drgreghousemd.ifrance.com/library/televisori-lcd/ televisori lcd sanyo] [http://scalek.ifrance.com/styles/decapitazioni-ostaggi/ decapitazioni ostaggi in irak] [http://romonjon.ifrance.com/directory/mobile-per/ mobile per lcd] [http://stormclouds13.ifrance.com/description/www-nic.htm www nic berg it] [http://paheidi.ifrance.com/blog/test-ammissione/ test ammissione psicologia libri] [http://qizzlary.ifrance.com/resources/barcellona-quenn.htm barcellona quenn] [http://mctungat.ifrance.com/text/la-ragazza/ la ragazza di dublino] [http://kialford.ifrance.com/directory/hotel-maria/ hotel maria] [http://qizzlary.ifrance.com/resources/foto-desktop.htm foto desktop gratis] [http://drgreghousemd.ifrance.com/library/casio/ casio] [http://xbr00t4lx.ifrance.com/directory/equus.htm equus] [http://nakramer.ifrance.com/small/tesine-di.htm tesine di economia] [http://kemenke.ifrance.com/directory/idioti.htm idioti] [http://anskaggs.ifrance.com/resources/testi-san.htm testi san salvador moonlight] [http://romonjon.ifrance.com/directory/miltiorrhiza/ miltiorrhiza] [http://stasenka.ifrance.com/lib/magari-renato/ magari renato zero] [http://wagreenw.ifrance.com/text/medicina-ospedali.htm medicina ospedali] [http://kemenke.ifrance.com/directory/ati-amd.htm ati amd portatili] [http://kialford.ifrance.com/directory/films-gratis/ films gratis] [http://paheidi.ifrance.com/blog/amstrad-hdd/ amstrad hdd] [http://drgreghousemd.ifrance.com/library/auguri-di/ auguri di natale in power point] [http://hapierce.ifrance.com/text/ricoh-fax/ ricoh fax] [http://xbr00t4lx.ifrance.com/directory/busty-redhead.htm busty redhead] [http://kemenke.ifrance.com/directory/io-mammeta.htm io mammeta e tu] [http://qizzlary.ifrance.com/resources/halo-.htm halo 2 pc] [http://nereinig.ifrance.com/styles/voglia-di.htm voglia di vincere] [http://stasenka.ifrance.com/lib/vecchie-coppie/ vecchie coppie porche] [http://pulema.ifrance.com/small/sale-cinema.htm sale cinema medusa] [http://wagreenw.ifrance.com/text/supporto-mp.htm supporto mp3] [http://chelsxd.ifrance.com/directory/digitale-terrestre.htm digitale terrestre offerta] [http://qizzlary.ifrance.com/resources/spedizionieri-verona.htm spedizionieri verona] [http://stormclouds13.ifrance.com/description/rociera.htm rociera] [http://poriddle.ifrance.com/articles/recinzione-giardino/ recinzione giardino] [http://sonicmaind.ifrance.com/styles/tecno-new.htm tecno new age] [http://paheidi.ifrance.com/blog/asrock-dualgl/ asrock 775dual915gl] [http://lucornew.ifrance.com/articles/vaio-sxp/ vaio s4xp] [http://poriddle.ifrance.com/articles/friends-stagione/ friends stagione 7] [http://pulema.ifrance.com/small/nic.htm nic] [http://afreelancespork.ifrance.com/text/www-esselunga/ www esselunga it privacy] [http://afreelancespork.ifrance.com/text/creatina-e/ creatina e carnitina] [http://hapierce.ifrance.com/text/tutte-le/ tutte le manie di bob] [http://xbr00t4lx.ifrance.com/directory/gioielli-antichi.htm gioielli antichi] [http://afreelancespork.ifrance.com/text/fiat-coupe/ fiat coupe 2 0 16v] [http://stormclouds13.ifrance.com/description/d-mu.htm d12 mu band] [http://hapierce.ifrance.com/text/pullman-macerata/ pullman macerata roma] [http://nakramer.ifrance.com/small/tom-tom.htm tom tom palm] [http://stormclouds13.ifrance.com/description/roswell.htm roswell] [http://romonjon.ifrance.com/directory/tolleranza/ tolleranza] [http://drgreghousemd.ifrance.com/library/the-might/ the might of] [http://paheidi.ifrance.com/blog/ep-toner/ ep27 toner nero] [http://chelsxd.ifrance.com/directory/oregon-scientific46.htm oregon scientific rm329p] [http://qizzlary.ifrance.com/resources/tanga-rubati.htm tanga rubati] [http://kialford.ifrance.com/directory/frigo-ariston/ frigo ariston classe a] [http://scalek.ifrance.com/styles/foto-eddie/ foto eddie guerrero] [http://stasenka.ifrance.com/lib/gessate/ gessate] [http://paheidi.ifrance.com/blog/giochi-di144/ giochi di babbo natale] [http://drgreghousemd.ifrance.com/library/hp-ipaq72/ hp ipaq rz] [http://sonicmaind.ifrance.com/styles/nicholas-burg.htm nicholas burg video] [http://nakramer.ifrance.com/small/lettore-mpeg.htm lettore mpeg] [http://poriddle.ifrance.com/articles/batteria-nokia/ batteria nokia bl5c] [http://lamalone.ifrance.com/web/motorhead/ motorhead] [http://kialford.ifrance.com/directory/athlon-fx/ athlon64 fx] [http://sonicmaind.ifrance.com/styles/indirizzi-delle.htm indirizzi delle scuole di estetica] [http://sckieffe.ifrance.com/content/un-riepilogo/ un riepilogo in immagini] [http://paheidi.ifrance.com/blog/video-violenze/ video violenze sessuali in casa] [http://sckieffe.ifrance.com/content/enio/ enio] [http://nereinig.ifrance.com/styles/mercedes-sl.htm mercedes sl 2001] [http://anskaggs.ifrance.com/resources/hotel-trapani.htm hotel trapani] [http://lamalone.ifrance.com/web/howardstern-com/ howardstern com] [http://flella.ifrance.com/styles/piscina-frosinone.htm piscina frosinone] [http://poriddle.ifrance.com/articles/clone-dvd/ clone dvd serial] [http://flella.ifrance.com/styles/cinema-multisala.htm cinema multisala maestoso roma] [http://photosexibitionist.hunchoxi.info/ Photos exibitionist fuck] [http://troienapoli.flowake.info/ Troie napoli] [http://videokellyclarkson.hyndres.info/ Video kelly clarkson because of you] [http://calendarioserie.goxasi.info/ Calendario serie a] [http://sessocavallo.ipnerka.info/ Sesso cavallo porno] [http://queenylove.ipnerka.info/ Queeny love] [http://maturabbwasian.gittose.info/ Matura bbw asian] [http://albergobarcellona.grekles.info/ Albergo barcellona spagna] [http://ludovico.gittose.info/ Ludovico ariosto orlando furioso] [http://pornonegre.hunchoxi.info/ Porno negre] [http://affittomacchina.hyndres.info/ Affitto macchina] [http://impsmilano.hpirale.info/ Imps milano] [http://svevofreud.hequila.info/ Svevo freud] [http://vaginesfondate.hequila.info/ Vagine sfondate] [http://autousatatoyota.grekles.info/ Auto usata toyota yaris] [http://leonessa.gittose.info/ Leonessa] [http://xxx-password.hyndres.info/ Xxx-password] [http://studiarchitettura.hequila.info/ Studi architettura a roma] [http://puttanetorino.ipnerka.info/ Puttane torino] [http://fotonudoartistico.hpirale.info/ Foto nudo artistico gratis] [http://ragazzimaschi.ipnerka.info/ Ragazzi maschi nudi] [http://acquistoorologio.hyndres.info/ Acquisto orologio] [http://gruppoassicurazione.hpirale.info/ Gruppo assicurazione automobile] [http://infermiera.hpirale.info/ Infermiera troia] [http://piscinavimercate.hunchoxi.info/ Piscina vimercate] [http://wwrossoaliceit.hyndres.info/ Wwrossoaliceit] [http://littlelolita.gittose.info/ Little lolita sex] [http://bisiacaria.goxasi.info/ Bisiacaria] [http://vestibratz.hyndres.info/ Vesti bratz] [http://pornostudentesse.hunchoxi.info/ Porno studentesse] [http://cazzoniinbocca.goxasi.info/ Cazzoni in bocca] [http://scarpabasket.ipnerka.info/ Scarpa basket] [http://chatwebcam.goxasi.info/ Chat webcam sesso] [http://ernia.gerbinu.info/ Ernia] [http://temie65.hequila.info/ Temi e65] [http://storiaeglobalizzazione.hequila.info/ Storia e globalizzazione] [http://gruppocarige.hpirale.info/ Gruppocarige it] [http://velieri.flowake.info/ Velieri] [http://cartonianimati.goxasi.info/ Cartoni animati xxx] [http://moglicuckold.gittose.info/ Mogli cuckold] [http://videomelita.flowake.info/ Video melita toniolo] [http://partenone.hunchoxi.info/ Partenone inglese] [http://albergobiarritz.hyndres.info/ Albergo biarritz] [http://inculatavaltellina.hpirale.info/ Inculata valtellina] [http://scaricareemule.ipnerka.info/ Scaricare emule] [http://shoppinghouse.ipnerka.info/ Shopping house napoli] [http://regcleanerdownload.ipnerka.info/ Regcleaner download] [http://pennellotrucco.hunchoxi.info/ Pennello trucco] [http://piquadro.hunchoxi.info/ Piquadro] [http://traduttoreistantaneo.hequila.info/ Traduttore istantaneo] [http://acidofolico.hyndres.info/ Acido folico] [http://minuteriametallica.gittose.info/ Minuteria metallica bologna] [http://corradovideo.goxasi.info/ Corradovideo] [http://hotdoctor.hpirale.info/ Hot doctor gets pussy screwed by patient] [http://vespapx.hyndres.info/ Vespa px] [http://vickyvetta.flowake.info/ Vicky vetta] [http://disegniglitterati.hyndres.info/ disegni glitterati] [http://iconaper.hpirale.info/ Icona per il desktop gratis] [http://gratisputtana.hpirale.info/ Gratis puttana] [http://animamanga.grekles.info/ Anima manga] [http://sanvitolocapo.ipnerka.info/ Sanvitolocapo] [http://custodianera.gerbinu.info/ Custodia nera dvd] [http://suoreporche.hequila.info/ Suore porche] [http://scarpadimensione.ipnerka.info/ Scarpa dimensione danza offerta] [http://santarelli.ipnerka.info/ Santarelli photos] [http://grassevecchie.hpirale.info/ Grasse vecchie troie] [http://vedeteporno.flowake.info/ Vedete porno italiane] [http://quindicenni.ipnerka.info/ Quindicenni nude] [http://donneanziane.gerbinu.info/ Donne anziane sex] [http://tatuaggilettering.hequila.info/ Tatuaggi lettering] [http://sitigratuiti.ipnerka.info/ Siti gratuiti] [http://cartinasardegna.goxasi.info/ Cartina sardegna nord] [http://antinfortunistica.grekles.info/ Antinfortunistica] [http://castoro.goxasi.info/ Castoro] [http://palletrack.hunchoxi.info/ Pallet rack] [http://ilvangelo.hpirale.info/ Il vangelo di luca] [http://lorenacozza.gittose.info/ Lorena cozza] [http://robertamissoni.ipnerka.info/ Roberta missoni video porno] [http://wwwsexyviptv.hyndres.info/ Www sexyvip tv] [http://albergosalisburgo.hyndres.info/ Albergo salisburgo] So wtf does group_string actually do?  The linked "descriptive" post has an utterly unhelpful example.  Has anyone ever used it for anything?
+
So wtf does group_string actually do?  The linked "descriptive" post has an utterly unhelpful example.  Has anyone ever used it for anything?
  
 
Groups a string into a map using a regular expression. To understand the function you must know.
 
Groups a string into a map using a regular expression. To understand the function you must know.
Line 50: Line 50:
  
 
I personally haven't used it. Would be used in parsing a page by hand.
 
I personally haven't used it. Would be used in parsing a page by hand.
 +
 +
 +
== Regular expressions ==
 +
 +
Finally! As of this moment, every single function has a page on this wiki except for the regular expression functions. ''(Much cheering!)'' Part of the problem with making pages for them is that a whole ream of background information is necessary to use them. I can see several approaches that we can take to this. I hope that we can discuss which tact to take:
 +
#Create a new category and page for regular expressions where we discuss how to use them in detail.
 +
#At the top of the Regular expressions section on this page, we post a link to another site that discusses how to use them. Obviously this is easiest. Then we assume that information is understood by the reader.
 +
#* http://www.regular-expressions.info/
 +
#* http://java.sun.com/docs/books/tutorial/essential/regex/index.html
 +
#Assume information about the nature of regular expressions and how to use regular expression functions is both known and just discuss the specifics of each function.
 +
Personally, I favor creating a page for regular expressions which starts with a link to a site that explains how to create regular expressions. Then the page explains how they can be used in ash.
 +
--[[User:Bale|Bale]] 10:01, 6 May 2010 (UTC)
 +
 +
I'm leaning toward not adding in another category on the main page; it's getting cluttered as-is. However, I'm 100% the idea of linking to a dedicated page with more info & links. For the user comfortable with regex, they can go to the strings page and just follow links. For others, they can go to the regex page first. However, I'm not a programmer, so I don't know if most would consider regex to be a sub-set of string handling, or its own category. I'd go by whatever is considered "standard" for that.
 +
 +
If we go with complete separation, I'd probably want to have a link to said page on the string handling page, and perhaps not even include it on the Main Page. I dunno. Honestly, I'm fine leaving this to whoever feels comfortable enough with regex to add said function pages.
 +
 +
Whichever approach is taken, I agree that we shouldn't include all of the background info on each page. Matche(r)s, groups, etc. should be briefly defined on their specific pages, but otherwise left to a general description page or assumed to be known with references provided (on the category / sub-category page). Explaining each concept on every page is a bit absurd. (It would be like giving a definition of string on every function page that accepts a parameter of or returns a string; we have other "general info" pages for this reason.)
 +
 +
Also, congrats & thanks on reaching this major milestone! --[[User:StDoodle|StDoodle (#1059825)]] 15:48, 6 May 2010 (UTC)
 +
 +
* Good points. Regexp are a subset of string handling so we can keep them on that page, but link to a page of regexp information at the top of the regexp page. If we decide to have regexp information on this site. That would be a pretty good solution. How much detail should we go into on the regexp page? Just basic information and a few links for the user to learn more? Or just assume that they are understood as well as string? --[[User:Bale|Bale]] 21:11, 6 May 2010 (UTC)
 +
 +
 +
The way you're currently going with is is a.o.k. by me. I wouldn't add too much to the dedicated page; I'd prefer additional tutorials & reference material to "original" content, for the most part. Mostly 'cause I see people fitting into the following groups re: regex;
 +
* Those who will never get it; it doesn't matter what we do for this group
 +
* Those who already get it; again, doesn't matter what we do
 +
* Those who are capable of getting it, given adequate info
 +
** Adequate is, for the most of people in this category, going to be far more than we really want to get in to (I know some people who are very comfortable with regex who STILL keep a cheat-cheat or bookmark for some stuff)
 +
** I don't want to spend 1k wiki-hours (that's an official metric now, dontchaknow?) on stuff that's been done well elsewhere when there's a lot of mafia (non-ash) stuff left to document; priorities, bang-for-your-buck, etc.
 +
 +
So yeah, keep up what you're doing basically. Flesh out quick coverage of the basics on the Regex page, add more links if you find ones that may also be helpful, but beyond that, don't worry too much about it. --[[User:StDoodle|StDoodle (#1059825)]] 04:09, 7 May 2010 (UTC)
 +
 +
Edit to add:
 +
 +
There is one minor additional note. As you note on the Regex page & I've seen elsewhere, ash regex is just a wrapper for java regex. As such, there's absolutely no reason to cover the same ground (I'm fairly sure java has better documentation resources than mafia :P ) EXCEPT it might be nice to give some "advanced info" that points out exactly how the ash equivalents map to their java counterparts. This isn't high-priority, but is the only thing beyond links and very basic coverage that I can see being worthwhile. --[[User:StDoodle|StDoodle (#1059825)]] 04:12, 7 May 2010 (UTC)
 +
 +
Do you think I'm adding too much detail? Should I trim back and rely on off-site tutorials? I think you can see right now about how much of a skim through regexes I'm planning to do. Should I skip it? --[[User:Bale|Bale]] 04:37, 7 May 2010 (UTC)
 +
 +
Well, first and foremost, don't worry a whole lot about having too much info, as long as it's accurate. I'm just saying that at the point that it stops flowing naturally and you have to stop and think hard about it, skim over the rest and point to tutorials. If the biggest flaw in this wiki ends up being that it duplicates information that can be learned elsewhere, I'll be able to live with that. --[[User:StDoodle|StDoodle (#1059825)]] 06:17, 7 May 2010 (UTC)
 +
* LOL! Very philosophical of you. ^_^ --[[User:Bale|Bale]] 06:40, 7 May 2010 (UTC)

Latest revision as of 06:40, 7 May 2010

So wtf does group_string actually do? The linked "descriptive" post has an utterly unhelpful example. Has anyone ever used it for anything?

Groups a string into a map using a regular expression. To understand the function you must know. 1. What maps are and how they are used. 2. Understand what regular expressions are and how to create them.

Using the original post:

FUNCTION DEFINTION: string [int,int] group_string( string source, string regex ) EXAMPLE: string [int,int] test = group_string( "This is a test", "([a-z] ) " );

Example Breakdown: string [int,int] Define a map. Two dimensional. The indices are integers. The data is stored as a string. test Define the map with name test. group_string Call the function. "This is a Test" Feeding the function a sample string. "([a-z] ) " Your regular expression.

Regular expressions deal with pattern matching. You want the function to find a particular pattern. The function then returns that pattern, or the stuff before it, or the stuff after it, or splits them appart, or squeezes them together. So what does this regular expression look for? The Parenthesis (): Tell the function this is a group of characters. [a-z]: Tell us they will be lower case letters.  : Tell us to look for one or more characters. That space between the ) and " Tells us the pattern ends in a space.

Thus reading down the string. T = Does not match [a-z] is a capital letter. h = Matches [a-z]. Starting Group i = Matches [a-z] s = Matches [a-z]

 = Matches space. First group found and is "his "

i = Matches [a-z]. Starting Group s = Matches [a-z]

 = Matches space. Second group found, and is "is "

a = Matches [a-z]. Starting Group

 = Matches space. Third group found, and is "a "

t = Matches [a-z]. Starting Group e = Matches [a-z] s = Matches [a-z] t = Matches [a-z] End of line. No more matches. Stop.

Thus, trusting the post, the map would be:

test[0][0] => "his " test[0][1] => "his" test[1][0] => "is " test[1][1] => "is" test[2][0] => "a " test[2][1] => "a"

I personally haven't used it. Would be used in parsing a page by hand.


Regular expressions

Finally! As of this moment, every single function has a page on this wiki except for the regular expression functions. (Much cheering!) Part of the problem with making pages for them is that a whole ream of background information is necessary to use them. I can see several approaches that we can take to this. I hope that we can discuss which tact to take:

  1. Create a new category and page for regular expressions where we discuss how to use them in detail.
  2. At the top of the Regular expressions section on this page, we post a link to another site that discusses how to use them. Obviously this is easiest. Then we assume that information is understood by the reader.
  3. Assume information about the nature of regular expressions and how to use regular expression functions is both known and just discuss the specifics of each function.

Personally, I favor creating a page for regular expressions which starts with a link to a site that explains how to create regular expressions. Then the page explains how they can be used in ash. --Bale 10:01, 6 May 2010 (UTC)

I'm leaning toward not adding in another category on the main page; it's getting cluttered as-is. However, I'm 100% the idea of linking to a dedicated page with more info & links. For the user comfortable with regex, they can go to the strings page and just follow links. For others, they can go to the regex page first. However, I'm not a programmer, so I don't know if most would consider regex to be a sub-set of string handling, or its own category. I'd go by whatever is considered "standard" for that.

If we go with complete separation, I'd probably want to have a link to said page on the string handling page, and perhaps not even include it on the Main Page. I dunno. Honestly, I'm fine leaving this to whoever feels comfortable enough with regex to add said function pages.

Whichever approach is taken, I agree that we shouldn't include all of the background info on each page. Matche(r)s, groups, etc. should be briefly defined on their specific pages, but otherwise left to a general description page or assumed to be known with references provided (on the category / sub-category page). Explaining each concept on every page is a bit absurd. (It would be like giving a definition of string on every function page that accepts a parameter of or returns a string; we have other "general info" pages for this reason.)

Also, congrats & thanks on reaching this major milestone! --StDoodle (#1059825) 15:48, 6 May 2010 (UTC)

  • Good points. Regexp are a subset of string handling so we can keep them on that page, but link to a page of regexp information at the top of the regexp page. If we decide to have regexp information on this site. That would be a pretty good solution. How much detail should we go into on the regexp page? Just basic information and a few links for the user to learn more? Or just assume that they are understood as well as string? --Bale 21:11, 6 May 2010 (UTC)


The way you're currently going with is is a.o.k. by me. I wouldn't add too much to the dedicated page; I'd prefer additional tutorials & reference material to "original" content, for the most part. Mostly 'cause I see people fitting into the following groups re: regex;

  • Those who will never get it; it doesn't matter what we do for this group
  • Those who already get it; again, doesn't matter what we do
  • Those who are capable of getting it, given adequate info
    • Adequate is, for the most of people in this category, going to be far more than we really want to get in to (I know some people who are very comfortable with regex who STILL keep a cheat-cheat or bookmark for some stuff)
    • I don't want to spend 1k wiki-hours (that's an official metric now, dontchaknow?) on stuff that's been done well elsewhere when there's a lot of mafia (non-ash) stuff left to document; priorities, bang-for-your-buck, etc.

So yeah, keep up what you're doing basically. Flesh out quick coverage of the basics on the Regex page, add more links if you find ones that may also be helpful, but beyond that, don't worry too much about it. --StDoodle (#1059825) 04:09, 7 May 2010 (UTC)

Edit to add:

There is one minor additional note. As you note on the Regex page & I've seen elsewhere, ash regex is just a wrapper for java regex. As such, there's absolutely no reason to cover the same ground (I'm fairly sure java has better documentation resources than mafia :P ) EXCEPT it might be nice to give some "advanced info" that points out exactly how the ash equivalents map to their java counterparts. This isn't high-priority, but is the only thing beyond links and very basic coverage that I can see being worthwhile. --StDoodle (#1059825) 04:12, 7 May 2010 (UTC)

Do you think I'm adding too much detail? Should I trim back and rely on off-site tutorials? I think you can see right now about how much of a skim through regexes I'm planning to do. Should I skip it? --Bale 04:37, 7 May 2010 (UTC)

Well, first and foremost, don't worry a whole lot about having too much info, as long as it's accurate. I'm just saying that at the point that it stops flowing naturally and you have to stop and think hard about it, skim over the rest and point to tutorials. If the biggest flaw in this wiki ends up being that it duplicates information that can be learned elsewhere, I'll be able to live with that. --StDoodle (#1059825) 06:17, 7 May 2010 (UTC)

  • LOL! Very philosophical of you. ^_^ --Bale 06:40, 7 May 2010 (UTC)