Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,9 +0,0 @@
function Palindrome (Text : String) return Boolean is
begin
for Offset in 0..Text'Length / 2 - 1 loop
if Text (Text'First + Offset) /= Text (Text'Last - Offset) then
return False;
end if;
end loop;
return True;
end Palindrome;

View file

@ -1,2 +0,0 @@
function Palindrome (Text : String) return Boolean is
(for all i in Text'Range => Text(i)= Text(Text'Last-i+Text'First));

View file

@ -1,31 +0,0 @@
;== AutoIt Version: 3.3.8.1
Global $aString[7] = [ _
"In girum imus nocte, et consumimur igni", _ ; inexact palindrome
"Madam, I'm Adam.", _ ; inexact palindrome
"salàlas", _ ; exact palindrome
"radar", _ ; exact palindrome
"Lagerregal", _ ; exact palindrome
"Ein Neger mit Gazelle zagt im Regen nie.", _ ; inexact palindrome
"something wrong"] ; no palindrome
Global $sSpace42 = " "
For $i = 0 To 6
If _IsPalindrome($aString[$i]) Then
ConsoleWrite('"' & $aString[$i] & '"' & StringLeft($sSpace42, 42-StringLen($aString[$i])) & 'is an exact palindrome.' & @LF)
Else
If _IsPalindrome( StringRegExpReplace($aString[$i], '\W', '') ) Then
ConsoleWrite('"' & $aString[$i] & '"' & StringLeft($sSpace42, 42-StringLen($aString[$i])) & 'is an inexact palindrome.' & @LF)
Else
ConsoleWrite('"' & $aString[$i] & '"' & StringLeft($sSpace42, 42-StringLen($aString[$i])) & 'is not a palindrome.' & @LF)
EndIf
EndIf
Next
Func _IsPalindrome($_string)
Local $iLen = StringLen($_string)
For $i = 1 To Int($iLen/2)
If StringMid($_string, $i, 1) <> StringMid($_string, $iLen-($i-1), 1) Then Return False
Next
Return True
EndFunc

View file

@ -1,7 +0,0 @@
"In girum imus nocte, et consumimur igni" is an inexact palindrome.
"Madam, I'm Adam." is an inexact palindrome.
"salàlas" is an exact palindrome.
"radar" is an exact palindrome.
"Lagerregal" is an exact palindrome.
"Ein Neger mit Gazelle zagt im Regen nie." is an inexact palindrome.
"something wrong" is not a palindrome.

View file

@ -1,19 +0,0 @@
identification division.
function-id. palindromic-test.
data division.
linkage section.
01 test-text pic x any length.
01 result pic x.
88 palindromic value high-value
when set to false low-value.
procedure division using test-text returning result.
set palindromic to false
if test-text equal function reverse(test-text) then
set palindromic to true
end-if
goback.
end function palindromic-test.

View file

@ -1,2 +0,0 @@
(defun palindrome (s)
(string= s (reverse s)))

View file

@ -1,3 +0,0 @@
(defun test-if-palindrome (text)
(setq text (replace-regexp-in-string "[[:space:][:punct:]]" "" text)) ; remove spaces and punctuation, by replacing them with nothing
(string-equal-ignore-case text (reverse text))) ; ignore case when looking at reversed text

View file

@ -1,8 +0,0 @@
function isPalindrome(sequence s)
for i = 1 to length(s)/2 do
if s[i] != s[$-i+1] then
return 0
end if
end for
return 1
end function

View file

@ -1,14 +0,0 @@
include std/sequence.e -- reverse
include std/console.e -- display
include std/text.e -- upper
include std/utils.e -- iif
IsPalindrome("abcba")
IsPalindrome("abcdef")
IsPalindrome("In girum imus nocte et consumimur igni")
procedure IsPalindrome(object s)
display("Is '[]' a palindrome? ",{s},0)
s = remove_all(' ',upper(s))
display(iif(equal(s,reverse(s)),"true","false"))
end procedure

View file

@ -1,5 +0,0 @@
Function Test-Palindrome( [String] $Text ){
$CharArray = $Text.ToCharArray()
[Array]::Reverse($CharArray)
$Text -eq [string]::join('', $CharArray)
}

View file

@ -1,34 +0,0 @@
function Test-Palindrome
{
<#
.SYNOPSIS
Tests if a string is a palindrome.
.DESCRIPTION
Tests if a string is a true palindrome or, optionally, an inexact palindrome.
.EXAMPLE
Test-Palindrome -Text "racecar"
.EXAMPLE
Test-Palindrome -Text '"Deliver desserts," demanded Nemesis, "emended, named, stressed, reviled."' -Inexact
#>
[CmdletBinding()]
[OutputType([bool])]
Param
(
# The string to test for palindrominity.
[Parameter(Mandatory=$true)]
[string]
$Text,
# When specified, detects an inexact palindrome.
[switch]
$Inexact
)
if ($Inexact)
{
# Strip all punctuation and spaces
$Text = [Regex]::Replace("$Text($7&","[^1-9a-zA-Z]","")
}
$Text -match "^(?'char'[a-z])+[a-z]?(?:\k'char'(?'-char'))+(?(char)(?!))$"
}

View file

@ -1 +0,0 @@
Test-Palindrome -Text 'radar'

View file

@ -1 +0,0 @@
Test-Palindrome -Text "In girum imus nocte et consumimur igni."

View file

@ -1 +0,0 @@
Test-Palindrome -Text "In girum imus nocte et consumimur igni." -Inexact

View file

@ -1,50 +0,0 @@
Function Test-Palindrome {
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline)]
[string[]]$Text
)
process {
:stringLoop foreach ($T in $Text)
{
# Normalize Unicode combining characters,
# so character á compares the same as (a+combining accent)
$T = $T.Normalize([Text.NormalizationForm]::FormC)
# Remove anything from outside the Unicode category
# "Letter from any language"
$T = $T -replace '\P{L}', ''
# Walk from each end of the string inwards,
# comparing a char at a time.
# Avoids string copy / reverse overheads.
$Left, $Right = 0, [math]::Max(0, ($T.Length - 1))
while ($Left -lt $Right)
{
if ($T[$Left] -ne $T[$Right])
{
# return early if string is not a palindrome
[PSCustomObject]@{
Text = $T
IsPalindrome = $False
}
continue stringLoop
}
else
{
$Left++
$Right--
}
}
# made it to here, then string is a palindrome
[PSCustomObject]@{
Text = $T
IsPalindrome = $True
}
}
}
}
'ánu-ná', 'nowt' | Test-Palindrome

View file

@ -1,29 +0,0 @@
REBOL [
Title: "Palindrome Recognizer"
URL: http://rosettacode.org/wiki/Palindrome
]
; In order to compete with all the one-liners, the operation is
; compressed: parens force left hand side to evaluate first, where I
; copy the phrase, then uppercase it and assign it to 'p'. Now the
; right hand side is evaluated: p is copied, then reversed in place;
; the comparison is made and implicitely returned.
palindrome?: func [
phrase [string!] "Potentially palindromatic prose."
/local p
][(p: uppercase copy phrase) = reverse copy p]
; Teeny Tiny Test Suite
assert: func [code][print [either do code [" ok"]["FAIL"] mold code]]
print "Simple palindromes, with an exception for variety:"
repeat phrase ["z" "aha" "sees" "oofoe" "Deified"][
assert compose [palindrome? (phrase)]]
print [crlf "According to the problem statement, these should fail:"]
assert [palindrome? "A man, a plan, a canal, Panama."] ; Punctuation not ignored.
assert [palindrome? "In girum imus nocte et consumimur igni"] ; Spaces not removed.
; I know we're doing palindromes, not alliteration, but who could resist...?

View file

@ -1,18 +0,0 @@
function Squish( s1 )
dim sRes
sRes = vbNullString
dim i, c
for i = 1 to len( s1 )
c = lcase( mid( s1, i, 1 ))
if instr( "abcdefghijklmnopqrstuvwxyz0123456789", c ) then
sRes = sRes & c
end if
next
Squish = sRes
end function
function isPalindrome( s1 )
dim squished
squished = Squish( s1 )
isPalindrome = ( squished = StrReverse( squished ) )
end function

View file

@ -1,4 +0,0 @@
wscript.echo isPalindrome( "My dog has fleas")
wscript.echo isPalindrome( "Madam, I'm Adam.")
wscript.echo isPalindrome( "1 on 1")
wscript.echo isPalindrome( "In girum imus nocte et consumimur igni")