Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1,6 +1,6 @@
A [[wp:Palindrome|palindrome]] is a phrase which reads the same backward and forward.
{{task heading}}
{{task heading|Task}}
Write a function or program that checks whether a given sequence of characters (or, if you prefer, bytes)
is a palindrome.

View file

@ -0,0 +1,19 @@
# by Artyom Bologov
H
,p
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
g/^(.)(.*)\1$/s//\2/
v/^(.)(.+)\1$|^.?$/s/.*/Not a palindrome!/
g/^.?$/s//Palindrome!/
,p
Q

View file

@ -1,6 +1,5 @@
isPalin1=: 0:`($:@(}.@}:))@.({.={:)`1:@.(1>:#)
isPalin2=: monad define
if. 1>:#y do. 1 return. end.
if. ({.={:)y do. isPalin2 }.}:y else. 0 end.
)
inexact=: [: (-:|.)@tolower [ ([-.-.) a. {~ 65 97 +"0 _ i.@26
inexact 'A man, a plan, a canal: Panama!'
1
inexact 'Not palindrome...'
0

View file

@ -1,12 +1,6 @@
foo=: foo,|.foo=:2000$a.
ts=:6!:2,7!:2 NB. time and space required to execute sentence
ts 'isPalin0 foo'
2.73778e_5 5184
ts 'isPalin1 foo'
0.0306667 6.0368e6
ts 'isPalin2 foo'
0.104391 1.37965e7
'isPalin1 foo' %&ts 'isPalin0 foo'
1599.09 1164.23
'isPalin2 foo' %&ts 'isPalin0 foo'
3967.53 2627.04
isPalin1=: 0:`($:@}.@}:)@.({.={:)`1:@.(1>:#)
isPalin2=: monad define
if. 1>:#y do. 1 return. end.
if. ({.={:)y do. isPalin2 }.}:y else. 0 end.
)

View file

@ -0,0 +1,12 @@
foo=: foo,|.foo=:2000$a.
ts=:6!:2,7!:2 NB. time and space required to execute sentence
ts 'isPalin0 foo'
2.73778e_5 5184
ts 'isPalin1 foo'
0.0306667 6.0368e6
ts 'isPalin2 foo'
0.104391 1.37965e7
'isPalin1 foo' %&ts 'isPalin0 foo'
1599.09 1164.23
'isPalin2 foo' %&ts 'isPalin0 foo'
3967.53 2627.04

View file

@ -0,0 +1,6 @@
palindrome templates
[$...] -> # !
when <|=$(..:-1)> do '$...;' !
end palindrome
[['rotor', 'racecar', 'level', 'rosetta']... -> palindrome ] !

View file

@ -0,0 +1,5 @@
!yamlscript/v0
defn main(n=31337):
not =: when((n:S != n:S:reverse) ' not')
say: "$n is$not a palindrome."