Giter Site home page Giter Site logo

huihua's Introduction

huihua

https://img.shields.io/hackage/v/huihua.svg https://github.com/tonyday567/huihua/workflows/haskell-ci/badge.svg

huihua is a Haskell port of uiua

https://www.uiua.org/docs/

Development

:r
:set -Wno-type-defaults
:set -Wno-name-shadowing
:set -XOverloadedStrings
:set -XRebindableSyntax
:set -XQuasiQuotes
import Prelude qualified
import NumHask.Prelude hiding ((.))
import NumHask.Prelude qualified as P
import NumHask.Array.Dynamic qualified as D
import NumHask.Array.Shape qualified as Shape
import Huihua.ArrayU as U
import Huihua.Array qualified as A
import Huihua.Stack
import Huihua.Examples
import Huihua.Glyphs as G
import Huihua.Stack qualified as S
import Huihua.Parse
import Huihua.Parse.FlatParse
import Data.ByteString.Char8 qualified as C
import Data.String.Interpolate
import Data.ByteString (ByteString)
import Data.Text.Encoding
import MarkupParse
import Data.List qualified as List
import Prettyprinter hiding (equals)

run [i|⊡ [1_2 0_1 0_0] [1_2_3 4_5_6 ]|]
D.length $ A.first $ D.iota [2]
D.rank $ (D.asArray [8,3,9,2,0] :: Array Int)
A.pick (D.array [2,1] [2,1]) (D.asArray [8,3,9,2,0] :: Array Int)
run [i|⊡ 2_1 [8 3 9 2 0]|]

range

A.range (D.toScalar 3)
A.range (D.asArray [3])
A.range (D.asArray [-2,3])
A.range (D.toScalar (-3))

A.range (D.toScalar 4)
A.range (D.asArray [4])
D.range (D.asArray [4])
-- a = D.asArray [4]
a = D.toScalar [4]
D.join $ D.tabulateA (fmap abs a) (\s -> D.zipWithE (\ab si -> bool ab (negate one - ab) (si<0)) s (fmap signum a))

member

i = D.toScalar 2 :: Array Int
a = D.array [2,2,3] [1,2,3,4,5,6,2,1,1,2,2,2] :: Array Int
A.indexOf i a
findI xs i' = fromMaybe (List.length xs) . List.findIndex (==i') . toList $ xs
(\x -> findI x (D.fromScalar i)) <$> (D.extractsExcept [D.rank a - 1] a)

a 2 i 1

i = D.asArray [4,5,6] :: Array Int
a = D.array [2,3] [1,2,3,4,5,6] :: Array Int
A.indexOf i a
fmap (findI (D.extractsExcept [D.rank a - 1] a)) (D.extractsExcept [D.rank i - 1] i)

a 1 i 1

i = D.array [3] [1,2,3] :: Array Int
a = D.array [5] [0,3,4,5,1] :: Array Int
A.indexOf i a
fmap (findI a) i

a 1 i 2

i = D.array [2,3] [1..6] :: Array Int
a = D.asArray [3,4,5] :: Array Int
A.indexOf i a
fmap (findI a) i

a 2 i 2

i = D.array [2,3] [1..6] :: Array Int
a = D.array [1,3] [4,5,6] :: Array Int
A.indexOf i a
fmap (findI (D.extractsExcept [D.rank a - 1] a)) (D.extractsExcept [D.rank i - 1] i)

member

-- Shape.takeIndexes [] [0]
-- D.join $ D.extracts [0] (D.toScalar 2)
-- D.join $ D.extracts [0] (D.asSingleton $ D.toScalar 2)

A.member (D.toScalar 2) (D.asArray [1,2,3])
A.member (D.asArray [2]) (D.asArray [1,2,3])
A.member (D.toScalar 5) (D.asArray [1,2,3])
A.member (D.asArray [1,2,3]) (D.asArray [0,3,4,5,1])
A.member (D.asArray [3,4,5]) (D.iota [2,3])
A.member (D.iota [2,3]) (D.asArray [2,3,4])
A.member (D.toScalar 2) (D.iota [2,3])

parser debug pipeline

x = [i|⍏ 6_2_7_0_1_5|]
runParser tokens x
parseT x
xis = parseT x & instructionize
xis
interpI xis
run x
i = parseT x
instructionize $ List.take 1 i
D.folds [0] sum (D.iota 5)
List.drop 2 xis
either viaShow pretty $ interpI $ List.drop 2 xis
a = (D.asArray [1,5,8,2] :: Array Double)
run [i|+0_1_0 0_4_3|]
run [i|+[0_1_0 0_4_3] [1_1_1 1_1_1]|]
runParser tokens "◌1 2"
runParser tokens [i|◌1 2|]
runParser tokens (encodeUtf8 [i|◌1 2|])

development notes

pad

a = D.iota [2] :: Array Int
s' = [3,3] :: [Int]
pretty $ D.pad 69 s' a
pretty $ D.lpad 69 s' a

find & mask

findNoOverlap deconstruction

a = D.konst [4,4] 1 :: Array Int
i = D.konst [2,2] 1 :: Array Int
pretty $ fmap sig $ D.findNoOverlap i a
iexp = rerank (rank a) i
f = find iexp a
cl sh = List.filter (\xs -> P.not (any (>0) (List.init xs))) $ List.filter (P.not . (all (>=0))) $ D.arrayAs $ D.tabulate ((\x -> 2 * x - 1) <$> sh) (\s -> List.zipWith (\x x0 -> x - x0 + 1) s sh)
go r' s = D.index f s && all P.not (D.index r' <$> (List.filter (S.inside x (D.shape f)) $ fmap (List.zipWith (+) s) (cl (shape iexp))))
r = tabulate (shape f) (go r)

cl sh = List.filter (\xs -> P.not (any (>0) (List.init xs))) $ List.filter (P.not . (all (>=0))) $ D.arrayAs $ D.tabulate ((\x -> 2 * x - 1) <$> sh) (\s -> List.zipWith (\x x0 -> x - x0 + 1) s sh)
inside x' x = all id $ List.zipWith (\y' y -> y >= 0 && y < y') x' x
go r' s = D.index f s && all P.not (D.index r' <$> (List.filter (inside (D.shape f)) $ fmap (List.zipWith (+) s) (cl (D.shape iexp))))
r = D.tabulate (D.shape f) (go r)
pretty $ fmap sig $ D.find i a
pretty $ fmap sig r

tests

a = D.iota [2,2] :: Array Int
i = D.toScalar 2 :: Array Int
D.find i a
D.findNoOverlap i a
A.find i a
A.mask i a
a = D.iota [4] :: Array Int
i = D.array [1] [2] :: Array Int
D.find i a
D.findNoOverlap i a
A.find i a
A.mask i a
a = D.iota [2,3,4] :: Array Int
i = D.array [2,2] [0,1,4,5] :: Array Int
D.find i a
D.findNoOverlap i a
A.find i a
pretty $ A.mask i a
a = D.cycle [4,4] (D.iota [3]) :: Array Int
i = D.array [2] [1,2] :: Array Int
pretty $ D.find i a
pretty $ D.findNoOverlap i a
pretty $ A.find i a
pretty $ A.mask i a

a = D.konst [5,5] 1 :: Array Int
i = D.konst [2,2] 1 :: Array Int
D.find i a
pretty $ D.findNoOverlap i a
pretty $ A.find i a
pretty $ A.mask i a

a = D.cycle [4,4] (D.iota [3]) :: Array Int
i = D.array [2,2] [1,2,2,0] :: Array Int
D.find i a
pretty $ D.findNoOverlap i a
pretty $ A.find i a
pretty $ A.mask i a

run [i|⌕ [1_2 2_0] ↯4_4⇡3|]
run [i|⦷ [1_2 2_0] ↯4_4⇡3|]

find

run[i|⌕ [1_2 2_0] .↯4_4_4⇡3|]

a = D.cycle [4,4] (D.iota [3]) :: Array Int
i = D.array [2,2] [1,2,2,0] :: Array Int
pretty a
pretty i
pretty $ A.find a i
ws = D.windows (D.shape i) a
-- D.shape ws :: [Int]
-- pretty ws
-- pretty a
-- fmap (sig . (==i)) (D.extracts (D.arrayAs (D.iota [D.rank i]) <> [D.rank i * 2 .. (D.rank ws - 1)]) ws)

window

D.shape @[Int] $ D.windows [2,2] (D.iota [4,3,2])
pretty $ D.windows [2] (D.iota [4])
pretty $ D.windows [4] (D.iota [6])

Consistent for scalars

D.windows [1] (D.toScalar 5)
:{
run [i|
△ .◫2 .⇡4
△ .◫4 .⇡6
△ ◫2_2 .[1_2_3 4_5_6 7_8_9]
△ .◫¯2 .↯4_4⇡16
△ .◫¯3 .↯4_4⇡16
△ .◫¯1_2 .↯4_4⇡16

|]
:}
:{
run [i|
△ ◫2 ⇡4

|]
:}

keep

i = D.asArray [3,2] :: Array Int
x = D.asArray [8,3,9,2,0] :: Array Int
D.asArray $ fold $ D.zipWithE (replicate) (D.cycle (D.shape x) i) x
i = D.asArray [3,2] :: Array Int
x = D.asArray [8,3,9,2,0] :: Array Int
x2 = D.iota [3,4] :: Array Int
D.join $ D.asArray $ fold $ D.zipWithE replicate (D.cycle (List.take 1 $ D.shape x2) i) (D.extracts [0] x2)

ArrayH pretty

x = D.array [2,2,2,2] ([0..14] <> [100]) :: Array Double
x
pretty x
pretty (ArrayH x)

import Data.Either
t = ptree (fmap showU x)
maxp = D.folds [1] (P.maximum . fmap P.length) (D.join $ D.asArray $ rights t)
s = fmap (fmap ((D.zipWithE (\m a -> lpad '.' m a) maxp))) t
sdoc = mconcat $ fmap (either (\n -> replicate (n-1) mempty) (pure . hsep . fmap pretty . D.arrayAs)) s
sdocMin = D.concatenate 0 (D.konst [max 0 (D.rank x - P.length sdoc)] mempty) (D.asArray sdoc)
rankPrefix = fmap pretty (D.reshapeDef " " [D.length sdocMin] (D.konst [D.rank x - 1] "╷"))
deco = zipWith (<+>) (D.arrayAs rankPrefix) (D.arrayAs sdocMin)
final = (pretty "╭─") <> line <> (vsep deco) <> hang 1 (line <> pretty "╯")
final

x = D.array [2,2] [2, 2.222,200.001,200.01] :: Array Double
pretty (U.ArrayH x)
a = D.konst [2,2] (3 / P.pi) :: Array Double
pretty (U.ArrayH a)
a3 = D.konst [1,1,1] 1
pretty (U.ArrayH a3)
a1 = D.asArray [1..4]
pretty (U.ArrayH a1)

deconstruction

-- x = D.array [2,2] [2, 2.222,200.001,200.01] :: Array Double
-- x = D.array [1,1,1] [1] :: Array Double
x = D.array [2,2,2,2] ([0..14] <> [100]) :: Array Double
dtable = D.maps [1] (\a -> U.lpad '.' (P.maximum (P.length <$> a)) <$> a) (U.showU <$> x)
dtable1 = D.folds [0] (hsep . D.arrayAs . fmap pretty) dtable
dtableMin = D.concatenate 0 (D.konst [max 0 (D.rank x - 1 - D.length dtable1)] mempty) dtable1
rankPrefix = fmap pretty (D.reshapeDef "x" [D.length dtableMin] (D.konst [D.rank x - 1] "╷"))
decotable = D.zipWithE (<+>) rankPrefix dtableMin
final = (pretty "╭─") <> line <> ((vsep . D.arrayAs) decotable) <> hang 1 (line <> pretty "╯")
final
dtable

doctest subscript bug

-- |
--
-- > run [i|ⁿ2 3|]
-- 9
-- > run [i|ⁿ2 [1 2 3]|]
-- [1 4 9]
--
-- >>> 1+1
--
-- | ₙ
--
-- > run [i|ₙ2 8|]
-- 4
-- > run [i|ₙ [2 3 4] [16 27 1024]|]
--
run [i|ⁿ2 3|]
run [i|ⁿ2 [1 2 3]|]
run [i|ₙ2 8|]
run [i|ₙ [2 3 4] [16 27 1024]|]
log 8 / log 2
-- | /ⁿ
--
-- >>> run [i|/ⁿ[]|]
-- 1
-- >>> run [i|/ⁿ [2]|]
-- 2
-- >>> run [i|/ⁿ 2_1|]
-- 2
-- >>> run [i|/ⁿ [1_2_3 4_5_6]|]
-- [4 25 216]
run [i|/ⁿ[]|]
run [i|/ⁿ [2]|]
run [i|/ⁿ 2_1|]
run [i|/ⁿ [1_2_3 4_5_6]|]
-- | /ₙ
--
-- >>> run [i|/ₙ[]|]
-- 1
-- >>> run [i|/ₙ [2]|]
-- 2
-- >>> run [i|/ₙ 2_1|]
-- 2
-- >>> run [i|/ₙ [1_2_3 4_5_6]|]
-- [4 25 216]
run [i|/ₙ[]|]
run [i|/ₙ [2]|] -- 2
run [i|/ₙ 2_8|] -- 3
run [i|/ₙ [1_2_3 4_5_6]|] -- [∞ 2.321928094887362 1.6309297535714575]
logBase 2 8

reduce1U dev

a = D.iota [3,4]
pretty a
(x D.:| xs) = a
x
xs
D.extracts [1] xs
D.zips [0] (D.zipWithE (\x' xs' -> foldl' (+) (D.fromScalar x') xs')) (D.extracts [0] x) (D.extractsExcept [0] xs)


xy a = let (x D.:| xs) = a in D.zipWithE (\a as -> foldl' (+) a as) x (D.extractsExcept [0] xs)
let a3 = D.iota [2,3,4]
reduceU (+) zero a3
xy a3
import Prelude qualified
:t Prelude.mod infinity (Prelude.3)

combo array parsing

x = [i|[2_1_0 0_4_3]|]
runParser tokens x
parseT x
parseT x & instructionize
interpI (List.reverse $ parseI x)
run x
:t D.extracts [0,1]
let a = D.array [2,3,4] [0..23] :: D.Array Int

a' = D.extracts [0,1] a
:t D.drops [(0,0),(1,1)] a'
run [i|/>.[2_1_0 0_4_3]|]
import Huihua.Glyphs
ts = parseT x
:t ts
-- assemble (aArrayLeft *> many aToken <* aArrayRight) [GlyphToken ArrayLeft,GlyphToken ArrayRight]
assemble (aArrayLeft *> many aToken) [GlyphToken ArrayLeft,GlyphToken ArrayRight]

number parsing

run "123. 5"
showU (P.negate 2)

token parsing

basics

runParser tokens "[@u @i @u @a]"
runParser tokens [i|△."Hello, World!"|]
runParser tokens [i|⊂ 1_2 3|]
P.length <$> C.unpack <$> allTheSymbols

interp debug

*** not

x1 = "\194\172" :: ByteString
x1
encodeUtf8 "¬"
C.putStrLn x1
runParser glyph "¬"
runParser glyph x1
runParser glyph (encodeUtf8 "¬")
bs = encodeUtf8 "¬ 3 [0 1]"
interp bs
C.putStrLn bs

ToDo ex1

  • [X] reverse order of arrays
  • [X] reverse order of assembled ops
  • [X] array left bug
  • [X] implement in compute1
  • [ ] refactor
    • do away with raw Ints and Doubles
bs = exPage1

pipeline

bs
C.putStr bs
-- C.lines bs
-- C.lines bs & fmap (runParser tokens)
-- C.lines bs & fmap (runParser_ tokens) & orderUiua
as = assemble' bs
interp as
s
interp (assemble' exPage1)

shapes are ok …

:set -Wno-incomplete-uni-patterns
(Stack (ItemArrayInt x:ItemArrayInt y:xs)) = s3
shape x
shape y
(ItemArrayDouble z) = binOpD (/) (ItemArrayInt y) (ItemArrayInt x)
shape z
C.lines bs & fmap (runParser_ tokens) & orderUiua & assemblef & foldr compute1 (Stack [])

NYI

&p is an effect-only. Nothing is added or subtracted form the stack. --- scope use &i imports ~~~ test scope

All Functions

test isms

https://www.uiua.org/docs/isms

negative bug

This character doesn’t parse properly in a *.hs file. “¯”

:t Negative

Creating the glyph list

Note that direct comparison between a ByteString and it’s representation may not be what you expect eg

symNot = allTheSymbols List.!! 5
C.putStrLn symNot
symNot
"¬" == symNot
"\194\172" == symNot
xs = (zipWith (\s g -> [i|"#{s}" -> pure #{g}|]) allTheSymbols allTheGlyphs :: [ByteString])
traverse_ C.putStrLn xs

traverse_ C.putStrLn allTheSymbols

equality in haskell code

symNot = allTheSymbols List.!! 5
C.putStrLn symNot
symNot
-- traverse_ C.putStrLn (P.take 8 allTheSymbols)
"¬" == symNot
"\194\172" == symNot

Symbol Extraction

:{
symbolsnippet :: ByteString
symbolsnippet = [i|
 <div class="glyph-buttons"><button class="glyph-button glyph-title" data-title="duplicate"><div class="code-font stack-function-button">.</div></button><button class="glyph-button glyph-title" data-title="over"><div class="code-font stack-function-button">,</div></button><button class="glyph-button glyph-title" data-title="(:) flip"><div class="code-font stack-function-button">∶</div></button><button class="glyph-button glyph-title" data-title="pop"><div class="code-font stack-function-button">;</div></button><button class="glyph-button glyph-title" data-title="identity"><div class="code-font stack-function-button">∘</div></button><button class="glyph-button glyph-title" data-title="not"><div class="code-font monadic-function">¬</div></button><button class="glyph-button glyph-title" data-title="sign"><div class="code-font monadic-function">±</div></button><button class="glyph-button glyph-title" data-title="(`) negate"><div class="code-font monadic-function">¯</div></button><button class="glyph-button glyph-title" data-title="absolute value"><div class="code-font monadic-function">⌵</div></button><button class="glyph-button glyph-title" data-title="sqrt"><div class="code-font monadic-function">√</div></button><button class="glyph-button glyph-title" data-title="sine"><div class="code-font monadic-function">○</div></button><button class="glyph-button glyph-title" data-title="floor"><div class="code-font monadic-function">⌊</div></button><button class="glyph-button glyph-title" data-title="ceiling"><div class="code-font monadic-function">⌈</div></button><button class="glyph-button glyph-title" data-title="round"><div class="code-font monadic-function">⁅</div></button><button class="glyph-button glyph-title" data-title="(=) equals"><div class="code-font dyadic-function">=</div></button><button class="glyph-button glyph-title" data-title="(!=) not equals"><div class="code-font dyadic-function">≠</div></button><button class="glyph-button glyph-title" data-title="less than"><div class="code-font dyadic-function">&lt;</div></button><button class="glyph-button glyph-title" data-title="(<=) less or equal"><div class="code-font dyadic-function">≤</div></button><button class="glyph-button glyph-title" data-title="greater than"><div class="code-font dyadic-function">&gt;</div></button><button class="glyph-button glyph-title" data-title="(>=) greater or equal"><div class="code-font dyadic-function">≥</div></button><button class="glyph-button glyph-title" data-title="add"><div class="code-font dyadic-function">+</div></button><button class="glyph-button glyph-title" data-title="subtract"><div class="code-font dyadic-function">-</div></button><button class="glyph-button glyph-title" data-title="(*) multiply"><div class="code-font dyadic-function">×</div></button><button class="glyph-button glyph-title" data-title="(%) divide"><div class="code-font dyadic-function">÷</div></button><button class="glyph-button glyph-title" data-title="modulus"><div class="code-font dyadic-function">◿</div></button><button class="glyph-button glyph-title" data-title="power"><div class="code-font dyadic-function">ⁿ</div></button><button class="glyph-button glyph-title" data-title="logarithm"><div class="code-font dyadic-function">ₙ</div></button><button class="glyph-button glyph-title" data-title="minimum"><div class="code-font dyadic-function">↧</div></button><button class="glyph-button glyph-title" data-title="maximum"><div class="code-font dyadic-function">↥</div></button><button class="glyph-button glyph-title" data-title="atangent"><div class="code-font dyadic-function">∠</div></button><button class="glyph-button glyph-title" data-title="length"><div class="code-font monadic-function">⧻</div></button><button class="glyph-button glyph-title" data-title="shape"><div class="code-font monadic-function">△</div></button><button class="glyph-button glyph-title" data-title="range"><div class="code-font monadic-function">⇡</div></button><button class="glyph-button glyph-title" data-title="first"><div class="code-font monadic-function">⊢</div></button><button class="glyph-button glyph-title" data-title="reverse"><div class="code-font monadic-function">⇌</div></button><button class="glyph-button glyph-title" data-title="deshape"><div class="code-font monadic-function">♭</div></button><button class="glyph-button glyph-title" data-title="bits"><div class="code-font monadic-function">⋯</div></button><button class="glyph-button glyph-title" data-title="transpose"><div class="code-font monadic-function trans">⍉</div></button><button class="glyph-button glyph-title" data-title="rise"><div class="code-font monadic-function">⍏</div></button><button class="glyph-button glyph-title" data-title="fall"><div class="code-font monadic-function">⍖</div></button><button class="glyph-button glyph-title" data-title="where"><div class="code-font monadic-function">⊚</div></button><button class="glyph-button glyph-title" data-title="classify"><div class="code-font monadic-function">⊛</div></button><button class="glyph-button glyph-title" data-title="deduplicate"><div class="code-font monadic-function">⊝</div></button><button class="glyph-button glyph-title" data-title="box"><div class="code-font monadic-function">□</div></button><button class="glyph-button glyph-title" data-title="unbox"><div class="code-font monadic-function">⊔</div></button><button class="glyph-button glyph-title" data-title="match"><div class="code-font dyadic-function">≅</div></button><button class="glyph-button glyph-title" data-title="couple"><div class="code-font dyadic-function">⊟</div></button><button class="glyph-button glyph-title" data-title="join"><div class="code-font dyadic-function">⊂</div></button><button class="glyph-button glyph-title" data-title="select"><div class="code-font dyadic-function">⊏</div></button><button class="glyph-button glyph-title" data-title="pick"><div class="code-font dyadic-function">⊡</div></button><button class="glyph-button glyph-title" data-title="reshape"><div class="code-font dyadic-function">↯</div></button><button class="glyph-button glyph-title" data-title="take"><div class="code-font dyadic-function">↙</div></button><button class="glyph-button glyph-title" data-title="drop"><div class="code-font dyadic-function">↘</div></button><button class="glyph-button glyph-title" data-title="rotate"><div class="code-font dyadic-function">↻</div></button><button class="glyph-button glyph-title" data-title="windows"><div class="code-font dyadic-function">◫</div></button><button class="glyph-button glyph-title" data-title="keep"><div class="code-font dyadic-function">▽</div></button><button class="glyph-button glyph-title" data-title="find"><div class="code-font dyadic-function">⌕</div></button><button class="glyph-button glyph-title" data-title="member"><div class="code-font dyadic-function">∊</div></button><button class="glyph-button glyph-title" data-title="indexof"><div class="code-font dyadic-function">⊗</div></button><button class="glyph-button glyph-title" data-title="reduce"><div class="code-font monadic-modifier">/</div></button><button class="glyph-button glyph-title" data-title="fold"><div class="code-font monadic-modifier">∧</div></button><button class="glyph-button glyph-title" data-title="scan"><div class="code-font monadic-modifier">\\</div></button><button class="glyph-button glyph-title" data-title="each"><div class="code-font monadic-modifier">∵</div></button><button class="glyph-button glyph-title" data-title="rows"><div class="code-font monadic-modifier">≡</div></button><button class="glyph-button glyph-title" data-title="distribute"><div class="code-font monadic-modifier">∺</div></button><button class="glyph-button glyph-title" data-title="table"><div class="code-font monadic-modifier">⊞</div></button><button class="glyph-button glyph-title" data-title="cross"><div class="code-font monadic-modifier">⊠</div></button><button class="glyph-button glyph-title" data-title="repeat"><div class="code-font monadic-modifier">⍥</div></button><button class="glyph-button glyph-title" data-title="group"><div class="code-font monadic-modifier">⊕</div></button><button class="glyph-button glyph-title" data-title="partition"><div class="code-font monadic-modifier">⊜</div></button><button class="glyph-button glyph-title" data-title="invert"><div class="code-font monadic-modifier">⍘</div></button><button class="glyph-button glyph-title" data-title="gap"><div class="code-font monadic-modifier">⋅</div></button><button class="glyph-button glyph-title" data-title="dip"><div class="code-font monadic-modifier">⊙</div></button><button class="glyph-button glyph-title" data-title="both"><div class="code-font monadic-modifier">∩</div></button><button class="glyph-button glyph-title" data-title="fork"><div class="code-font dyadic-modifier">⊃</div></button><button class="glyph-button glyph-title" data-title="bracket"><div class="code-font dyadic-modifier">⊓</div></button><button class="glyph-button glyph-title" data-title="under"><div class="code-font dyadic-modifier">⍜</div></button><button class="glyph-button glyph-title" data-title="level"><div class="code-font dyadic-modifier">⍚</div></button><button class="glyph-button glyph-title" data-title="fill"><div class="code-font dyadic-modifier">⬚</div></button><button class="glyph-button glyph-title" data-title="bind"><div class="code-font dyadic-modifier">'</div></button><button class="glyph-button glyph-title" data-title="if"><div class="code-font dyadic-modifier">?</div></button><button class="glyph-button glyph-title" data-title="try"><div class="code-font dyadic-modifier">⍣</div></button><button class="glyph-button glyph-title" data-title="assert"><div class="code-font dyadic-function">⍤</div></button><button class="glyph-button glyph-title" data-title="call"><div class="code-font variadic-function-button">!</div></button><button class="glyph-button glyph-title" data-title="break"><div class="code-font monadic-function">⎋</div></button><button class="glyph-button glyph-title" data-title="recur"><div class="code-font monadic-function">↬</div></button><button class="glyph-button glyph-title" data-title="random"><div class="code-font noadic-function-button">⚂</div></button><button class="glyph-button glyph-title" data-title="eta"><div class="code-font noadic-function-button">η</div></button><button class="glyph-button glyph-title" data-title="pi"><div class="code-font noadic-function-button">π</div></button><button class="glyph-button glyph-title" data-title="tau"><div class="code-font noadic-function-button">τ</div></button><button class="glyph-button glyph-title" data-title="infinity"><div class="code-font noadic-function-button">∞</div></button><button class="glyph-button glyph-title" data-title="trace"><div class="code-font stack-function-button">~</div></button><button class="glyph-button strand-span" data-title="strand">_</button><button class="glyph-button " data-title="array">[]</button><button class="glyph-button " data-title="box array">{}</button><button class="glyph-button " data-title="function">()</button><button class="glyph-button number-literal-span" data-title="negative (`)">¯</button><button class="glyph-button string-literal-span" data-title="character">@</button><button class="glyph-button string-literal-span" data-title="format/multiline string">$</button><button class="glyph-button string-literal-span" data-title="string">"</button><button class="glyph-button " data-title="binding (=)">←</button><button class="glyph-button " data-title="signature / terminate modifier">|</button><button class="glyph-button comment-span" data-title="comment"></button><!----></div>
|]
:}
bs = elements (markup_ Html symbolsnippet) !! 1
ts = [x | (Content x) <- toList bs]
ts
mapM_ print ts

padSymbols = ".,:◌∘¬±¯⌵√∿⌊⌈⁅=≠<≤>≥+-×÷◿ⁿₙ↧↥∠ℂ⧻△⇡⊢⇌♭¤⋯⍉⍏⍖⊚⊛◴◰□⋕≍⊟⊂⊏⊡↯☇↙↘↻◫▽⌕⦷∊⊗⟔/∧\\∵≡⊞⍚⍥⊕⊜◇⋅⊙⟜⊸∩°⍜⊃⊓⍢⬚⍣⍤⚂ηπτ∞?⸮_[]{}()⟨⟩‿¯@$\"!^←↚~|#" :: ByteString
T.putStrLn $ decodeUtf8Lenient padSymbols
padSymbols == (C.pack $ C.unpack padSymbols)
encodeUtf8 ".,:◌∘¬±¯⌵√∿⌊⌈⁅=≠<≤>≥+-×÷◿ⁿₙ↧↥∠ℂ⧻△⇡⊢⇌♭¤⋯⍉⍏⍖⊚⊛◴◰□⋕≍⊟⊂⊏⊡↯☇↙↘↻◫▽⌕⦷∊⊗⟔/∧\\∵≡⊞⍚⍥⊕⊜◇⋅⊙⟜⊸∩°⍜⊃⊓⍢⬚⍣⍤⚂ηπτ∞?⸮_[]{}()⟨⟩‿¯@$\"!^←↚~|#"
-- print $ C.singleton <$> C.unpack padSymbols
print $ decodeUtf8Lenient $ encodeUtf8 ".,:◌∘¬±¯⌵√∿⌊⌈⁅=≠<≤>≥+-×÷◿ⁿₙ↧↥∠ℂ⧻△⇡⊢⇌♭¤⋯⍉⍏⍖⊚⊛◴◰□⋕≍⊟⊂⊏⊡↯☇↙↘↻◫▽⌕⦷∊⊗⟔/∧\\∵≡⊞⍚⍥⊕⊜◇⋅⊙⟜⊸∩°⍜⊃⊓⍢⬚⍣⍤⚂ηπτ∞?⸮_[]{}()⟨⟩‿¯@$\"!^←↚~|#"
-- print $ C.singleton <$> C.unpack padSymbols
import Data.Text (Text)
import Data.Text qualified as T
import Data.Text.IO qualified as T
symText =  ".,:◌∘¬±¯⌵√∿⌊⌈⁅=≠<≤>≥+-×÷◿ⁿₙ↧↥∠ℂ⧻△⇡⊢⇌♭¤⋯⍉⍏⍖⊚⊛◴◰□⋕≍⊟⊂⊏⊡↯☇↙↘↻◫▽⌕⦷∊⊗⟔/∧\\∵≡⊞⍚⍥⊕⊜◇⋅⊙⟜⊸∩°⍜⊃⊓⍢⬚⍣⍤⚂ηπτ∞?⸮_[]{}()⟨⟩‿¯@$\"!^←↚~|#" :: Text
T.putStrLn symText

huihua's People

Contributors

tonyday567 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.