How to resolve the algorithm Rosetta Code/Count examples step by step in the TUSCRIPT programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Rosetta Code/Count examples step by step in the TUSCRIPT programming language

Table of Contents

Problem Statement

Essentially, count the number of occurrences of ==header on each task page. Output: For a full output, updated periodically, see Rosetta Code/Count examples/Full list. You'll need to use the Media Wiki API, which you can find out about locally, here, or in Media Wiki's API documentation at, API:Query

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Rosetta Code/Count examples step by step in the TUSCRIPT programming language

Source code in the tuscript programming language

$$ MODE TUSCRIPT
url="http://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Programming_Tasks&cmlimit=500&format=xml"
data=REQUEST (url)

BUILD S_TABLE beg=*
DATA :title=":
BUILD S_TABLE end=*
DATA :":

titles=EXTRACT (data,beg|,end,1,0,"~~")
titles=SPLIT (titles,":~~:")
sz_titles=SIZE (titles)

BUILD R_TABLE header=":==\{\{header|:"
all=*

ERROR/STOP CREATE ("tasks",seq-e,-std-)

COMPILE
LOOP title=titles
ask=*
ask      =SET_VALUE(ask,"title",title)
ask      =SET_VALUE(ask,"action","raw")
ask      =ENCODE (ask,cgi)
http     ="http://www.rosettacode.org/mw/index.php"
url      =CONCAT (http,"?",ask)
data     =REQUEST (url)
header   =FILTER_INDEX (data,header,-)
sz_header=SIZE(header)
line     =CONCAT (title,"=",sz_header," members")
FILE "tasks" = line
all      =APPEND(all,sz_header)
ENDLOOP

ENDCOMPILE
all =JOIN(all),sum=SUM(all),time=time()
line=CONCAT (time,": ", sz_titles, " Programing Tasks: ", sum, " solutions")

FILE "tasks" = line

  

You may also check:How to resolve the algorithm Conditional structures step by step in the ColdFusion programming language
You may also check:How to resolve the algorithm Partial function application step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Solve a Numbrix puzzle step by step in the 11l programming language
You may also check:How to resolve the algorithm Tree traversal step by step in the Eiffel programming language
You may also check:How to resolve the algorithm Hunt the Wumpus step by step in the Racket programming language