S
что то вроде document.getById().focus() ?
Size: a a a
S
YP
AK
AR
AK
AK
x = [ { a: 0.5, b: 1.29, c : 3.6 }, { a: 1.5, b: 0.2, c : 7.0, d: 2.0 }, { a: 12.4, b: 0.8, c : 1.1 }, ... ]
Получить генератор списков вроде такого: x = [ { a: 0.5, b: 1.29, c : 3.6, d: 17.0, e: 2.11, f: -5.0 }, { a: 1.5, b: 0.2, c : 7.0, d: 2.0, e: -7.2, f: 10.12 }, { a: 12.4, b: 0.8, c : 1.1, d: 4.4, e: 33.1, f: 19.0 }, ... ]
где d
, e
, f
— рандомные значенияAK
Random.list n <| Random.constant ...
— нет возможности получить индекс для каждого элементаAK
Random.Extra
AK
newtype Fix f = Fix { unFix :: f (Fix f) }
G
newtype Fix f = Fix { unFix :: f (Fix f) }
IR
G
IR
IR
IR
AK
{-# LANGUAGE UndecidableInstances #-}
newtype Fix f = Fix { unFix :: f (Fix f) }
-- Чтобы показывался результат в консоли
instance Show (f (Fix f)) => Show (Fix f) where
showsPrec n x = showParen (n > 10) $ \s ->
"Fix " ++ showsPrec 11 (unFix x) s
zero = Fix Nothing
one = Fix (Just zero)
two = Fix (Just one)
-- Вывод
-- *Main> two
-- Fix (Just (Fix (Just (Fix Nothing))))
G
{-# LANGUAGE UndecidableInstances #-}
newtype Fix f = Fix { unFix :: f (Fix f) }
-- Чтобы показывался результат в консоли
instance Show (f (Fix f)) => Show (Fix f) where
showsPrec n x = showParen (n > 10) $ \s ->
"Fix " ++ showsPrec 11 (unFix x) s
zero = Fix Nothing
one = Fix (Just zero)
two = Fix (Just one)
-- Вывод
-- *Main> two
-- Fix (Just (Fix (Just (Fix Nothing))))
AK
main = text <| Debug.toString <| maybeCata toInt two
type FixMaybe = FixMaybe (Maybe FixMaybe)
maybeCata : (Maybe a -> a) -> FixMaybe -> a
maybeCata alg (FixMaybe node) =
alg (Maybe.map (maybeCata alg) node)
toInt : Maybe Int -> Int
toInt m =
case m of
Just x -> x + 1
Nothing -> 0
zero = FixMaybe Nothing
one = FixMaybe (Just zero)
two = FixMaybe (Just one)