FlogScript

From Esolang
Jump to: navigation, search

FlogScript is a programming language by User:Zzo38, similar to GolfScript but it is different. No documentation yet, read the examples and source code to try to figure it out.

[edit] Examples

Factorial example:

{
 ,{)}%A*
}fac:

5 fac~ P.

Check if a sentence is a palindrome:

{Evade me Dave!}
Su{/[^A-Z]/}{;{}}S~.Ar=P.

Convert roman numbers to decimal:

0.:Il1/Ar{[1{.5*.2*}3*~]\{IVXLCDM}1/?=._-Ms){_1*}?.Ma:-}/P.

Underload:

Ia:
{
 [
  {\}
  {.}
  {;}
  {+}
  {_{)()}S0\:}
  {{(}\+{)}+}
  {_+:}
  {P.}
  {}
 ]
 _(\:
 {~:!*(a^S}1/?=~
 _,0=!F[
}~

"Strange Numbers" from perl golf challenge:

Il~.2/^M2P,

Beer program:

99{
 .P. { bottles of beer on the wall}P,
 .P. { bottles of beer}P,
 {Take one down and pass it around}P,
 ( .!F]
 .P. { bottles of beer on the wall}P,P_
 F<
}~{No more bottles of beer on the wall}P,

ROT13:

#{A:Za:z}Sx{N:ZA:M}Sx.Sl+St

Display printable characters ASCII table:

32"{[?>!+]}Sb;16/A_100/P.

Reverse order of lines in input:

)Ar

Reverse order of characters on each line in input:

"Ar

BrainFuck interpreter (use ! at end of program) (the one on anarchy golf is completely wrong even if it says FIXED):

[]{!}I0{+<>,.[]-}S5Sb

Count how many of each letters:

IaSua SxS5${/(.)\1*/}S?{0=){  <}P.P.{> }P.,)P.{ TIM}P,}/

Set-theoretic definition of natural numbers:

~f{.`{, }\++}y(*~`

[edit] Examples from anarchy golf

Occasionaly the FlogScript code is longer than GolfScript codes (but some might just pass the examples given in anarchy golf without being correct), but the FlogScript code is often shorter.

100 (GolfScript 269, FlogScript 195)

{zero}P,{one.two.three.four.five.six.seven.eight.nine}d/.A_P,{ten}P,{eleven}P,{twelve}P,.(;{twen}\0
A={thir}\1 A={fif}\3 A={eigh}\6 A=.(;{{teen}+P,}/{for}\2 A=\e\+\At{Ar{ty }A,P,}/{one hundred}P,

257 (GolfScript 30, FlogScript 19)

35,{2+257\10@MbSuP,

capital and small letters (GolfScript ?, FlogScript 25)

[IlSl.Su1/\1/]AzAt{A.P,}/

Card Sharp (GolfScript 105, FlogScript 93)

)a S5:[[{Ace}9,i%i%~{Jack}{Queen}{King}]{Spades.Hearts.Diamonds.Clubs}d/At{{ of }A,._ Sc!Z^}%

cut string (GolfScript ?, FlogScript 7)

)Ar~~/(

delete duplicate lines (GolfScript 6, FlogScript 3)

).|

delete last line (GolfScript 6, FlogScript 5)

)););

double back lines (GolfScript 14, FlogScript 7)

".Ar(;+

Drop first line (GolfScript 4, FlogScript 3)

)(;

duplicate lines (GolfScript 8, FlogScript 4)

".P,

GCD of 1 to n (GolfScript 5, FlogScript 2)

"1

happy number (GolfScript 28, FlogScript 24) (very slow)

2000,{{`1/sq%A+}F91=}^Pa

invert case (GolfScript 6, FlogScript 13)

#a.SlAr+.ArSt

judge Janken (GolfScript 32, FlogScript 28)

"s/{"0=17%10%)2/}/-2*)3%60+"

N Queens (GolfScript ?, FlogScript 39)

~~,}o%At{A?F|.}:{._#y,X+_#y,"X+_#;A#}%$

Numeral system (GolfScript 31, FlogScript 7)

"s/~\Md

Palindromic Quine (GolfScript 19, FlogScript 13)

{)P.}FyF}.P){

Phone Key Pad (GolfScript ?, FlogScript 44)

#Su{+A:Z-}Sx{122233344455566070778889990*}St

reverse lines (GolfScript 7, FlogScript 2)

)"

rotate lines (GolfScript 7, FlogScript 5)

));(+

rotate lines reversely (GolfScript 9, FlogScript 6)

));)P,

Summation (GolfScript 12, FlogScript 11)

"0+.!F]),A+

sum of square numbers (GolfScript 14, FlogScript 13)

"~..)*\2*)*6/

Underload interpreter (GolfScript 20(cheat), FlogScript 64(genuine))

Ia:{{\ . ; + _{)()}S0\: j\+i+ _+: ]}s/_(\:{~:!*(a^S}1/?=~_,0=!F[

zero lines (GolfScript 10, FlogScript 7)

",0`\*]

[edit] External resources

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox