Tweetovi

Blokirali ste korisnika/cu @opticsbyexample

Jeste li sigurni da želite vidjeti te tweetove? Time nećete deblokirati korisnika/cu @opticsbyexample

  1. Prikvačeni tweet

    🔍Optics By Example has LAUNCHED! 🥳🎉 Go grab your copy! Learn about the magic of Lenses, Traversals and Folds ✨ Thanks to everyone in the community who's helped make this a reality 😀 RTs appreciated ✅

    Poništi
  2. proslijedio/la je Tweet
    2. velj

    Just launched 'lens-csv'; an optics library for manipulating and querying CSVs! It's a pretty natural operation and basically gives you a simple query and mutation language; effectively SQL for CSVs but as optics!

    Poništi
  3. proslijedio/la je Tweet

    First meetup for the year on Lenses. Thanks a lot to for the venue. We looked at a bit at lens construction using lets-lens repo from data61 and usage examples of lenses from book.

    Poništi
  4. proslijedio/la je Tweet
    21. sij

    I have been reading and it has been a great joy! It taught me a lot. Now what.. papers? 🤔

    Poništi
  5. proslijedio/la je Tweet
    11. sij
    Odgovor korisniku/ci

    i must say, i'm enjoying reading it... kudos!

    Poništi
  6. 11. sij

    Optics By Example is on Sale! For a limited time you can grab the comprehensive guide to lenses, prisms, traversals and more for only $30! That's 50% off the suggested price 😵 If you were waiting for a sale, this is it! 😄

    Poništi
  7. Exploring Algebraic lenses: A brand new type of optic!

    Poništi
  8. In case you missed it the first time around: 🔎Optics By Example is hot off the (digital) presses! Go grab it on leanpub, complete with exercises, in pdf, epub, or mobi 😄 Reviews are positive so far and I'd love to hear what you think

    Poništi
  9. proslijedio/la je Tweet
    14. pro 2019.

    To promote the release of , all day today I'll answer questions about the process of writing a technical book! Ask me about my process, the content, the tools I use, about , etc!

    Poništi
  10. 2. pro 2019.
    Poništi
  11. 1. pro 2019.

    To celebrate the launch of later this month I'm attempting to solve puzzles using only optics (for better or worse). Day 1 went wonderfully: Add your email here to hear when the book launches:

    Poništi
  12. proslijedio/la je Tweet
    26. stu 2019.

    Whipped up a lensy CSV parser tonight! Turned out pretty nice I think; but error handling and inference could still use a smidge more work.

    >>> import Data.Csv.Lens
>>> import Data.ByteString.Lazy as BL

>>> myCsvText <- BL.readFile "./data/simple.csv"
>>> myCsvText ^.. namedCsv . taking 2 rows . column @String "state_code" 
[ "NY"
, "CA"
]

>>> myCsvText ^.. namedCsv . taking 2 rows . _NamedRecord @[M.Map String String]
[ fromList [("population","19540000"), ("state_code","NY")]
, fromList [("population","39560000"), ("state_code","CA")]
]

-- For cs...
    Poništi
  13. Hey everyone! I'll be answering any and all lenses & optics questions you have for the next 2 hours or so. I welcome questions on how to accomplish certain tasks, the lenses ecosystem, even helping with specific problems you're solving at the moment. Bring it on!

    Poništi
  14. 7. stu 2019.

    I wrote a huge chunk about Isos today! very excited to get it in front of people! There are powers untold hidden deep within the unknowns of the lens library, let me be your guide! 🧭🏴‍☠️🗺️

    Poništi
  15. New chapters just released! Learn to write custom traversals from scratch! Get an introduction to Van Laarhoven encoding, learn how to manipulate lists and maps using lenses, and get an introduction to Prisms too!

    Poništi
  16. Meaning of course, that prisms can help you pass your next job interview! Here's a little diddy you might recognize...

    _DividedBy :: Int -> Prism' Int Int
_DividedBy n = prism' embed match
  where
    embed x = x * n
    match x
      | x `mod` n == 0 = Just (x `div` n)
      | otherwise = Nothing


fizzbuzz :: Int -> String
fizzbuzz = show & outside (_DividedBy 3) . mapped .~ "Fizz"
                & outside (_DividedBy 5) . mapped .~ "Buzz"
                & outside (_DividedBy 15) . mapped .~ "FizzBuzz"

>>> traverse_ (putStrLn...
    Prikaži ovu nit
    Poništi
  17. Did you know prisms can be used for any pattern matching, not only Sum-type Constructors? Here's a fun prism which matches on the "pattern" of being divisible by a (non-zero) integer. Chapters on prisms dropping later this week!

    _DividedBy :: Int -> Prism' Int Int
_DividedBy n = prism' embed match
  where
    embed x = x * n
    match x
      | x `mod` n == 0 = Just (x `div` n)
      | otherwise = Nothing
      
>>> 12 ^? _DividedBy 3
Just 4

>>> 12 ^? _DividedBy 5
Nothing

>>> 12 ^? _DividedBy 3 . _DividedBy 4
Just 1

>>> _DividedBy 3 # 4
12

>>> _DividedBy 6 # 2
12
    Prikaži ovu nit
    Poništi
  18. Updates for coming up in just a few days! Learn to write custom traversals by hand, when it's okay to break traversal laws, using lenses to work with indexed data, and an introduction to Prisms: pattern matching using optics! Early Access:

    Poništi
  19. Working hard to come up with small, motivating, and comprehensible Prism examples; getting tricky to find the appropriate subset that's reasonable to teach without getting too archaic! After that, just Isomorphisms to go and the book will be ready for an initial release!

    Poništi
  20. We can use this strange trick to actually *Traverse* functions at a given argument! Betcha didn't know that was even possible!

    import Control.Lens
import Data.Maybe

-- Assert that a given function must be non-negative when given '0'
validateAtZero :: (Int -> Int) -> Maybe (Int -> Int)
validateAtZero = 
  ix 0 %%~ \result -> if result < 0 
                        then Nothing 
                        else Just result

>>> isJust $ validateAtZero (+10)
True
>>> isJust $ validateAtZero (subtract 10)
False
    Prikaži ovu nit
    Poništi

Čini se da učitavanje traje već neko vrijeme.

Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.

    Možda bi vam se svidjelo i ovo:

    ·