Print

Print


Ordinary keyboards are uniary,
as in each key has one meaning.
Very unlike piano, where one can strike several keys at once.

A Binary keyboard one can use in hexadecimal, and with 8 fingers can
represent a byte.

so with just 8 keys, 256 characters.

Software,

we have 8 keys,
2 sets of 4,
for 256 combinations,
can use time delay interrupt,
or press space once letter selected.

<pre>
keyToNumber :: String -- Keys in order of increasing magnitude
                    -> String -- keys to interpret
                    -> Integer -- binary value of keys
</pre>
de be binary number from keys to num

elspru@ji-zma:~/2/binaryKeyboard$ runhaskell binaryKeyboard.hs
"jkl;fdsa" "sd; sdlj ds;l sd;l sd;kjl"
[104,101,108,108,111]
hello

can use pure asciii,
but also good for developing new alphabets,
perhaps based on phonetics,
i.e. empties at 0x00 vowels at 0x10, plosives at 0x20, fricatives at
0x30 and so on

Haskell Source Code
<pre>
-- binaryKeyboard.hs by Andrii Lowki Zvorygin for We You Net
module Main
  where

import Data.Char
import System.IO
import System.Environment
main =
  do
    args <- getArgs
    let keys = args !! 0
        value = args !! 1
        num = keysToNumber keys value
        nums = keyStringToNumber keys value
        text = integersToByteString
    putStrLn $ show nums
    putStrLn $ integersToByteString nums

integersToByteString :: [Integer] -- input integers
                     -> String -- string output
integersToByteString [] = []
integersToByteString integers =
    let first = fromInteger $ head integers
        rest = tail integers
    in chr first : integersToByteString rest

keysToNumber :: String -- Keys in order of increasing magnitude
             -> String -- keys to interpret
             -> Integer -- binary value of keys
keysToNumber [] value = 0
keysToNumber keys value =
    let firstKey = head keys
        continue = 2*(keysToNumber (tail keys) value)
    in
    if elem firstKey value
        then 1 + continue
        else continue

keyStringToNumber :: String -- keys in order of increasing magnitude
                  -> String -- keys seperated by spaces
                  -> [Integer] -- Integer array
keyStringToNumber keys [] = []
keyStringToNumber keys manyValues =
    let letters = words manyValues
        first = head letters
        rest = unwords $ tail letters
    in keysToNumber keys first : keyStringToNumber keys rest
</pre>