Haskell – 171 – Sintassi avanzata – 8

Continuo da qui, copio qui.

Liste
Qui il prof Hal (rockz! 💥) dice “to do: put something here” ma poi continua con le liste; probabilmente manca solo un’intro.

funzioni standard per le liste
Recall that the definition of the built-in Haskell list datatype is equivalent to:

data List a = Nil
            | Cons a (List a)

With the exception that Nil is called [] and Cons x xs is called x:xs. This is simply to make pattern matching easier and code smaller. Let’s investigate how some of the standard list functions may be written. Consider map. A definition is given below:

map _ [] = []
map f (x:xs) = f x : map f xs

Here, the first line says that when you map across an empty list, no matter what the function is, you get an empty list back. The second line says that when you map across a list with x as the head and xs as the tail, the result is f applied to x consed onto the result of mapping f on xs.

The filter can be defined similarly:

filter _ [] = []
filter p (x:xs) | p x = x : filter p xs
                | otherwise = filter p xs

How this works should be clear. For an empty list, we return an empty list. For a non empty list, we return the filter of the tail, perhaps with the head on the front, depending on whether it satisfies the predicate p or not.

We can define foldr as:

foldr _ z [] = z
foldr f z (x:xs) = f x (foldr f z xs)

Here, the best interpretation is that we are replacing the empty list ([]) with a particular value and the list constructor (:) with some function. On the first line, we can see the replacement of [] for z. Using backquotes to make f infix, we can write the second line as:

foldr f z (x:xs) = x `f` (foldr f z xs)

From this, we can directly see how : is being replaced by f.

Finally, foldl:

foldl _ z [] =  z
foldl f z (x:xs) = foldl f (f z x) xs

This is slightly more complicated. Remember, z can be thought of as the current state. So if we’re folding across a list which is empty, we simply return the current state. On the other hand, if the list is not empty, it’s of the form x:xs. In this case, we get a new state by appling f to the current state z and the current list element x and then recursively call foldl on xs with this new state.

There is another class of functions: the zip and unzip functions, which respectively take multiple lists and make one or take one lists and split them apart. For instance, zip does the following:

Prelude> zip "hello" [1,2,3,4,5]
[('h',1),('e',2),('l',3),('l',4),('o',5)]

Basically, it pairs the first elements of both lists and makes that the first element of the new list. It then pairs the second elements of both lists and makes that the second element, etc. What if the lists have unequal length? It simply stops when the shorter one stops. A reasonable definition for zip is:

zip [] _ = []
zip _ [] = []
zip (x:xs) (y:ys) = (x,y) : zip xs ys

The unzip function does the opposite. It takes a zipped list and returns the two “original” lists:

Prelude> unzip [('f',1),('o',2),('o',3)]
("foo",[1,2,3])

There are a whole slew of zip and unzip functions, named zip3, unzip3, zip4, unzip4 and so on; the …3 functions use triples instead of pairs; the …4 functions use 4-tuples, etc.

Finally, the function take takes an integer n and a list and returns the first n elements off the list. Correspondingly, drop takes an integer n and a list and returns the result of throwing away the first n elements off the list. Neither of these functions produces an error; if n is too large, they both will just return shorter lists.

list comprehensions
There is some syntactic sugar for dealing with lists whose elements are members of the Enum class (see the section on Instances [qui]), such as Int or Char. If we want to create a list of all the elements from 1 to 10, we can simply write:

Prelude> [1..10]
[1,2,3,4,5,6,7,8,9,10]

We can also introduce an amount to step by:

Prelude> [1,3..10]
[1,3,5,7,9]
Prelude> [1,4..10]
[1,4,7,10]

These expressions are short hand for enumFromTo and enumFromThenTo, respectively. Of course, you don’t need to specify an upper bound. Try the following (but be ready to hit Control+C to stop the computation!):

Prelude> [1..]
[1,2,3,4,5,6,7,8,9,10,11,12{Interrupted!}

è velocissimissimo, troppo.

Probably yours printed a few thousand more elements than this. As we said before, Haskell is lazy. That means that a list of all numbers from 1 on is perfectly well formed and that’s exactly what this list is. Of course, if you attempt to print the list (which we’re implicitly doing by typing it in the interpreter), it won’t halt. But if we only evaluate an initial segment of this list, we’re fine:

Prelude> take 3 [1..]
[1,2,3]
Prelude> take 3 (drop 5 [1..])
[6,7,8]

This comes in useful if, say, we want to assign an ID to each element in a list. Without laziness we’d have to write something like this:

assignID :: [a] -> [(a,Int)]
assignID l = zip l [1..length l]

Which means that the list will be traversed twice. However, because of laziness, we can simply write:

assignID l = zip l [1..]

And we’ll get exactly what we want. We can see that this works:

Prelude> assignID l = zip l [1..]
Prelude> assignID "hello"
[('h',1),('e',2),('l',3),('l',4),('o',5)]

Finally, there is some useful syntactic sugar for map and filter, based on standard set-notation in mathematics. In math, we would write something like

to mean the set of all values of f when applied to elements of s which satisfy p. This is equivalent to the Haskell statement map f (filter p s). However, we can also use more math-like notation and write [f x | x <- s, p x]. While in math the ordering of the statements on the side after the pipe is free, it is not so in Haskell. We could not have put p x before x <- s otherwise the compiler wouldn’t know yet what x was. We can use this to do simple string processing. Suppose we want to take a string, keep only the uppercase letters and convert those to lowercase. We could do this in either of the following two equivalent ways:

Prelude> import Data.Char
Prelude Data.Char> map toLower (filter isUpper "Hello World")
"hw"
Prelude Data.Char> [toLower x | x <- "Hello World", isUpper x]
"hw"

These two are equivalent, and, depending on the exact functions you’re using, one might be more readable than the other. There’s more you can do here, though. Suppose you want to create a list of pairs, one for each point between (0,0) and (5,7) below the diagonal. Doing this manually with lists and maps would be cumbersome and possibly difficult to read. It couldn’t be easier than with list comprehensions:

Prelude> [(x,y) | x <- [1..5], y <- [x..7]]
[(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,2),(2,3),(2,4),(2,5),(2,6),
(2,7),(3,3),(3,4),(3,5),(3,6),(3,7),(4,4),(4,5),(4,6),(4,7),(5,5),(5,6),(5,7)]

sì, sono andato a capo.

If you reverse the order of the x <- and y <- clauses, the order in which the space is traversed will be reversed (of course, in that case, y could no longer depend on x and you would need to make x depend on y but this is trivial).

👽

Annunci

cit. & loll – 92

Ecco la nuova rassegna cit.osa e lollosa come sempre 😋

You are smart enough to be a software developer
::: aprilwensel

Know how to learn
::: CodeWisdom

X: I’m looking for some advice to improve our business. Can you help?
::: swardley

The plural of ‘anecdote’
::: SecureSamurai

It’s painful watching (most) Senators talk about technology
::: Anthony

Twitter doesn’t get better than this
::: laurenduca

Facebook
::: Mr_Berman

Yet another reason to use R instead of Python
::: darinself

Quelli che tengono 20 account fake su twitter
::: Genjuro75

in general zuck says
::: emenietti

That moment when you give somebody a full solution to a problem on Stack Overflow and instantly regret it
non concordo ma riporto
::: _Tomalak

Rich Rogers

My brain now consistently disambiguates an isolated occurrence of the word “transformer” as “syntax transformer”
::: lexi_lambda

Privacy, il #Congresso americano interroga #Zuckerberg
::: Kotiomkin

Before you switch a developer from one task to another
::: RichRogersIoT

“AI will fix this”
::: rcalo

When someone says: ‘I want a programming language in which I need only say what I wish done’
::: CompSciFact

due to the current state of computers and software
::: albertomoss

If you really want to do something
::: RichRogersIoT

Sorry, I haven’t been on Twitter in a while
::: colmtobin

So #Zuckerberg says that they delete data once you delete it
::: maxschrems

A sysop, according to Google
::: marcelsalathe

Programs, like people, get old
::: AgileFortune

Nel curriculum del cugino ci sta scritto
::: glipari

when you’re reminded you wrote the world’s biggest social network in PHP
::: iamdevloper

Keep your code absolutely simple
::: CodeWisdom

Questo è veramente un commento rude
::: thek3nger

The 1990s saw a boom in internet metaphors like “superhighways” “global villages,” “infobahns”
::: manisha72617183

1980: “I bet there will be flying cars in the future”
::: ViciousVish

Right click on a website and choose Inspect (Element)
::: peteruhnak

#LifeGoals #BeLikeElon
::: Scribbles646

牛人
::: ushihito

Yesterday, in a tweet, we poked fun at the #PHP programming language
::: TheRegister

machine learning blockchain blockchain
::: aloria

Lovely haskell-jp logo
::: volothamp

How to move all your friends to another messaging app (such as Telegram, Signal, Wire)
::: volothamp

Firefox and Firefox Nightly
::: TacoPhox

The log file at the beginning of the universe
::: climagic

Last century electricity disrupted every single industrial vertical. This century AI will do the same
::: RichRogersIoT

Is Carnegie Mellon heaven?
::: justinesherry

Everything I know about programming I’ve learned because I wanted to plot something or help others plot something
::: thomasp85

i can’t quite believe this is a real product
::: iximeow

The best programmers are self-motivated: just give them an opportunity to rock & stay out of the way
::: RichRogersIoT

My friends, expecting a beautiful high resolution image taken by a professional astrophotographer: So Anna, what does that star you study actually look like?
::: AnnaGHughes

Whatsapp
::: Beppe Beppetti

Smart team
::: RichRogersIoT

Always wanted to travel back in time to try fighting a younger version of yourself?
::: RichRogersIoT

won the best paper award @programmingconf ! #prog18
::: didierverna

Nothing seems so easy as another engineer’s problem
::: mattie

For real: I believe the odds of Zuckerberg actually being a robot are very, very low
::: xiann

During the twilight years of this century, I believe humans will be unrecognizable from what they are today. Humans will take flight and soar
::: TEDTalks

#Zuckerbergtestimony
::: Flizzar

how’s your day going?
::: porges

The internet is the best school ever created
::: RichRogersIoT

A perfect programming language should have
::: TheMichaelBurge

It’s surprising to realize that it doesn’t exist any death/trash metal band called NullPointerException
::: mariofusco

A user interface should be so simple
::: CodeWisdom

functions, how to
::: pasiphae_goals

tfw a rubyist learns Haskell
il guaio è che è sensato
::: mattoflambda

The aim of logic programming is to provide the programmer with techniques for decomposing a problem into two separate problems
::: SICPQuotes

Tip of the Day™: Tape a small mirror over your webcam
::: mikkotweets2013

Friends
::: marcelsalathe

R2-Tea-2
::: DepressedDarth

The more I learn about the open source community
::: dloss

Myth (?): if you feel blocked or stuck, the project is too hard
uh! ne ho parlato più volte per me; scopro che vale anche per altri 😁
::: impossibus

Where did you acquire your knowledge of the Unix? A magical fountain?
::: climagic

Cleaning out my browser cookies and logins after a visit to #Facebook
::: vboykis

So you’ve deleted your Facebook account. Now what?
::: sehnaoui

If you torture data sufficiently
::: RichRogersIoT

i feel *extremely* seen
::: hatwell

Quantum computing simplifies #lisp programming
::: didierverna

Code is not just a conversation between you and the machine
::: manisha72617183

Haskell – 170 – Sintassi avanzata – 7

Continuo da qui, copio qui.

Tipi di dati (datatypes) rivisti
I know by this point you’re probably terribly tired of hearing about datatypes. They are, however, incredibly important, otherwise I wouldn’t devote so much time to them. Datatypes offer a sort of notational convenience if you have, for instance, a datatype that holds many many values. These are called named fields.

campi con nome
Consider a datatype whose purpose is to hold configuration settings. Usually when you extract members from this type, you really only care about one or possibly two of the many settings. Moreover, if many of the settings have the same type, you might often find yourself wondering “wait, was this the fourth or fifth element?” One thing you could do would be to write accessor functions. Consider the following made-up configuration type for a terminal program:

data Configuration =
  Configuration String          -- user name
                String          -- local host
                String          -- remote host
                Bool            -- is guest?
                Bool            -- is super user?
                String          -- current directory
                String          -- home directory
                Integer         -- time connected
            deriving (Eq, Show)

You could then write accessor functions, like (I’ve only listed a few):

getUserName (Configuration un _ _ _ _ _ _ _) = un
getLocalHost (Configuration _ lh _ _ _ _ _ _) = lh
getRemoteHost (Configuration _ _ rh _ _ _ _ _) = rh
getIsGuest (Configuration _ _ _ ig _ _ _ _) = ig
...

You could also write update functions to update a single element. Of course, now if you add an element to the configuration, or remove one, all of these functions now have to take a different number of arguments. This is highly annoying and is an easy place for bugs to slip in. However, there’s a solution. We simply give names to the fields in the datatype declaration, as follows:

data Configuration =
  Configuration { username      :: String,
                  localhost     :: String,
                  remotehost    :: String,
                  isguest       :: Bool,
                  issuperuser   :: Bool,
                  currentdir    :: String,
                  homedir       :: String,
                  timeconnected :: Integer
                }

This will automatically generate the following accessor functions for us:

username :: Configuration -> String
localhost :: Configuration -> String
...

Moreover, it gives us very convenient update methods. Here is a short example for a “post working directory” and “change directory” like functions that work on Configurations:

changeDir :: Configuration -> String -> Configuration
changeDir cfg newDir =
    -- make sure the directory exists
    if directoryExists newDir
      then -- change our current directory
           cfg{currentdir = newDir}
      else error "directory does not exist"

postWorkingDir :: Configuration -> String
  -- retrieve our current directory
postWorkingDir cfg = currentdir cfg

So, in general, to update the field x in a datatype y to z, you write y{x=z}. You can change more than one; each should be separated by commas, for instance, y{x=z, a=b, c=d}.

You can of course continue to pattern match against Configurations as you did before. The named fields are simply syntactic sugar; you can still write something like:

getUserName (Configuration un _ _ _ _ _ _ _) = un

But there is little reason to. Finally, you can pattern match against named fields as in:

getHostData (Configuration {localhost=lh,remotehost=rh})
  = (lh,rh)

This matches the variable lh against the localhost field on the Configuration and the variable rh against the remotehost field on the Configuration. These matches of course succeed. You could also constrain the matches by putting values instead of variable names in these positions, as you would for standard datatypes.

You can create values of Configuration in the old way as shown in the first definition below, or in the named-field’s type, as shown in the second definition below:

initCFG =
  Configuration "nobody" "nowhere" "nowhere"
                False False "/" "/" 0
initCFG' =
  Configuration
     { username="nobody",
       localhost="nowhere",
       remotehost="nowhere",
       isguest=False,
       issuperuser=False,
       currentdir="/",
       homedir="/",
       timeconnected=0 }

Though the second is probably much more understandable unless you litter your code with comments.

👽

Haskell – 169 – Sintassi avanzata – 6

Continuo da qui, copio qui.

Dichiarazioni d’istanze
Argomento lungo, da suddividere in più posts.

In order to declare a type to be an instance of a class, you need to provide an instance declaration for it. Most classes provide what’s called a “minimal complete definition.” This means the functions which must be implemented for this class in order for its definition to be satisfied. Once you’ve written these functions for your type, you can declare it an instance of the class.

la classe Eq
The Eq class has two members (i.e., two functions):

(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool

The first of these type signatures reads that the function == is a function which takes two as which are members of Eq and produces a Bool. The type signature of /= (not equal) is identical. A minimal complete definition for the Eq class requires that either one of these functions be defined (if you define ==, then /= is defined automatically by negating the result of ==, and vice versa). These declarations must be provided inside the instance declaration.

This is best demonstrated by example. Suppose we have our color example, repeated here for convenience:

data Color
    = Red
    | Orange
    | Yellow
    | Green
    | Blue
    | Purple
    | White
    | Black
    | Custom Int Int Int  -- R G B components

We can define Color to be an instance of Eq by the following declaration:

instance Eq Color where
  Red == Red = True
  Orange == Orange = True
  Yellow == Yellow = True
  Green == Green = True
  Blue == Blue = True
  Purple == Purple = True
  White == White = True
  Black == Black = True
  (Custom r g b) == (Custom r' g' b') =
      r == r' && g == g' && b == b'
  _ == _ = False

The first line here begins with the keyword instance telling the compiler that we’re making an instance declaration. It then specifies the class, Eq, and the type, Color which is going to be an instance of this class. Following that, there’s the where keyword. Finally there’s the method declaration.

The first eight lines of the method declaration are basically identical. The first one, for instance, says that the value of the expression Red == Red is equal to True. Lines two through eight are identical. The declaration for custom colors is a bit different. We pattern match Custom on both sides of ==. On the left hand side, we bind r, g and b to the components, respectively. On the right hand side, we bind r', g' and b' to the components. We then say that these two custom colors are equal precisely when r == r', g == g' and b == b' are all equal. The fallthrough says that any pair we haven’t previously declared as equal are unequal.

la classe Show
The Show class is used to display arbitrary values as strings. This class has three methods:

show :: Show a => a -> String
showsPrec :: Show a => Int -> a -> String -> String
showList :: Show a => [a] -> String -> String

A minimal complete definition is either show or showsPrec (we will talk about showsPrec later — it’s in there for efficiency reasons). We can define our Color datatype to be an instance of Show with the following instance declaration:

instance Show Color where
  show Red = "Red"
  show Orange = "Orange"
  show Yellow = "Yellow"
  show Green = "Green"
  show Blue = "Blue"
  show Purple = "Purple"
  show White = "White"
  show Black = "Black"
  show (Custom r g b) =
    "Custom " ++ show r ++ " " ++
    show g ++ " " ++ show b

This declaration specifies exactly how to convert values of type Color to Strings. Again, the first eight lines are identical and simply take a Color and produce a string. The last line for handling custom colors matches out the RGB components and creates a string by concatenating the result of showing the components individually (with spaces in between and “Custom” at the beginning).

altre classi importanti
There are a few other important classes which I will mention briefly because either they are commonly used or because we will be using them shortly. I won’t provide example instance declarations; how you can do this should be clear by now.

la classe Ord
The ordering class, the functions are:

compare :: Ord a => a -> a -> Ordering
(<=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
(<) :: Ord a => a -> a -> Bool
min :: Ord a => a -> a -> a
max :: Ord a => a -> a -> a

Almost any of the functions alone is a minimal complete definition; it is recommended that you implement compare if you implement only one, though. This function returns a value of type Ordering which is defined as:

data Ordering = LT | EQ | GT

So, for instance, we get:

Prelude> compare 5 7
LT
Prelude> compare 6 6
EQ
Prelude> compare 8 6
GT

In order to declare a type to be an instance of Ord you must already have declared it an instance of Eq (in other words, Ord is a subclass of Eq — more about this in the section on Classes [prossimamente]).

la classe Enum
The Enum class is for enumerated types; that is, for types where each element has a successor and a predecessor. Its methods are:

pred :: Enum a => a -> a
succ :: Enum a => a -> a
toEnum :: Enum a => Int -> a
fromEnum :: Enum a => a -> Int
enumFrom :: Enum a => a -> [a]
enumFromThen :: Enum a => a -> a -> [a]
enumFromTo :: Enum a => a -> a -> [a]
enumFromThenTo :: Enum a => a -> a -> a -> [a]

The minimal complete definition contains both toEnum and fromEnum, which converts from and to Ints. The pred and succ functions give the predecessor and successor, respectively. The enum functions enumerate lists of elements. For instance, enumFrom x lists all elements after x; enumFromThen x step lists all elements starting at x in steps of size step. The To functions end the enumeration at the given element.

la classe Num
The Num class provides the standard arithmetic operations:

(-) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a
(+) :: Num a => a -> a -> a
negate :: Num a => a -> a
signum :: Num a => a -> a
abs :: Num a => a -> a
fromInteger :: Num a => Integer -> a

All of these are obvious except for perhaps negate which is the unary minus. That is, negate x means -x.

la classe Read
The Read class is the opposite of the Show class. It is a way to take a string and read in from it a value of arbitrary type. The methods for Read are:

readsPrec :: Read a => Int -> String -> [(a, String)]
readList :: String -> [([a], String)]

The minimal complete definition is readsPrec. The most important function related to this is read, which uses readsPrec as:

read s = fst (head (readsPrec 0 s))

This will fail if parsing the string fails. You could define a maybeRead function as:

maybeRead s =
  case readsPrec 0 s of
    [(a,_)] -> Just a
    _ -> Nothing

How to write and use readsPrec directly will be discussed further in the examples.

contesti di classe
Suppose we are defining the Maybe datatype from scratch. The definition would be something like:

data Maybe a = Nothing
             | Just a

Now, when we go to write the instance declarations, for, say, Eq, we need to know that a is an instance of Eq otherwise we can’t write a declaration. We express this as:

instance Eq a => Eq (Maybe a) where
  Nothing == Nothing = True
  (Just x) == (Just x') = x == x'

This first line can be read “That a is an instance of Eq implies (=>) that Maybe a is an instance of Eq.”

derivare classi
Writing obvious Eq, Ord, Read and Show classes like these is tedious and should be automated. Luckily for us, it is. If you write a datatype that’s “simple enough” (almost any datatype you’ll write unless you start writing fixed point types), the compiler can automatically derive some of the most basic classes. To do this, you simply add a deriving clause to after the datatype declaration, as in:

data Color
    = Red
    | ...
    | Custom Int Int Int  -- R G B components
    deriving (Eq, Ord, Show, Read)

This will automatically create instances of the Color datatype of the named classes. Similarly, the declaration:

data Maybe a = Nothing
             | Just a
             deriving (Eq, Ord, Show, Read)

derives these classes just when a is appropriate.

All in all, you are allowed to derive instances of Eq, Ord, Enum, Bounded, Show and Read. There is considerable work in the area of “polytypic programming” or “generic programming” which, among other things, would allow for instance declarations for any class to be derived. This is much beyond the scope of this tutorial; instead, I refer you to the literature.

👽

Haskell – 168 – Sintassi avanzata – 5

Continuo da qui, copio qui.

Guardie
Guards can be thought of as an extension to the pattern matching facility. They enable you to allow piecewise function definitions to be taken according to arbitrary boolean expressions. Guards appear after all arguments to a function but before the equals sign, and are begun with a vertical bar. We could use guards to write a simple function which returns a string telling you the result of comparing two elements:

comparison x y | x < y = "The first is less"
               | x > y = "The second is less"
               | otherwise = "They are equal"

You can read the vertical bar as “such that.” So we say that the value of comparison x y “such that” x is less than y is “The first is less.” The value such that x is greater than y is “The second is less” and the value otherwise is “They are equal”. The keyword otherwise is simply defined to be equal to True and thus matches anything that falls through that far. So, we can see that this works:

Prelude> :l comp
[1 of 1] Compiling Main             ( comp.hs, interpreted )
Ok, modules loaded: Main.
*Main> comparison 5 10
"The first is less"
*Main> comparison 10 5
"The second is less"
*Main> comparison 7 7
"They are equal"
*Main> comparison "alpha" "beta"
"The first is less"
*Main> comparison "zeta" "lambda"
"The second is less"

Guards are applied in conjunction with pattern matching. When a pattern matches, all of its guards are tried, consecutively, until one matches. If none match, then pattern matching continues with the next pattern.

One nicety about guards is that where clauses are common to all guards. So another possible definition for our isBright function from the previous section would be:

isBright2 c | r == 255 = True
            | g == 255 = True
            | b == 255 = True
            | otherwise = False
    where (r,g,b) = colorToRGB c

The function is equivalent to the previous version, but performs its calculation slightly differently. It takes a color, c, and applies colorToRGB to it, yielding an RGB triple which is matched (using pattern matching!) against (r,g,b). This match succeeds and the values r, g and b are bound to their respective values. The first guard checks to see if r is 255 and, if so, returns True. The second and third guard check g and b against 255, respectively and return true if they match. The last guard fires as a last resort and returns False.

Post troppo breve? Sì ma l’argomento successivo è lunghissimissimo.

👽

Visto nel Web – 336

Un altra rassegna troppo lunga, c’è Facebook, privacy, censura, e tanto altro che ho wisto nel Web.

“Operant Conditioning by Software Bugs” not too many people read this piece when I posted it, but I still like it
certo 😁😁😁
#:tip, suggerimenti
::: johnregehr

Standing ovation for @Snowden at John Perry Barlow memorial at @internetarchive
#:Web, Internet
::: giovannidamiola

Mystified by monad metaphors? Maybe more will help. Refresh the page to get a new one
#:programmazione funzionale
::: TheMichaelBurge ::: Hillelogram ::: TheMichaelBurge ::: BUTAC ::: You Tube

Today I learned that Mathematica was built around open standards using a permissive license and was wholesale embraced in both industry and academia
loll, forza Jupyter
#:linguaggi di programmazione
::: ivanov ::: jakevdp

Apprezzo che riferiate dell’oscuramento di @butacit ma vorrei pure ricordare che l’articolo incriminato era partito in reazione allo spazio e credibilità concessi dal TG1 Medicina all’oncologo naturopata in questione. Quali provvedimenti prenderete perché non si ripeta?
#:caos informativo, fake news, bufale
::: f_bartoloni ::: sdallagata ::: MedBunker ::: disinformatico ::: fabiochiusi ::: MauroV1968 ::: emenietti ::: Airi_Talk ::: ilpost ::: cmnit

Una ‘querela-bavaglio’ da 39 milioni di euro
#:media #:censura
::: paoloigna1 ::: 7Corriere

Abbiamo l’ordine di non farla entrare
#:politica #:media #:censura
::: jacopo_iacoboni ::: nonleggerlo ::: MauroV1968 ::: Kuzzo74 ::: cmnit ::: mante ::: paolacontini64 ::: ritadv100 ::: jacopo_iacoboni ::: jacopo_iacoboni ::: senzasinistra ::: LaStampa ::: gignico ::: lbianchetti ::: sebmessina1 ::: antoniopolito1 ::: jacopo_iacoboni ::: mante

Those who study neither history nor politics are doomed to sound really stupid
#:protagonisti
::: ianbremmer

Torvalds Opposes Tying UEFI Secure Boot to Kernel Lockdown Mode
#:sistemi operativi
::: Slashdot

Okay, time to admit it: I’m running a free online course on applied category theory, with over 250 students, based on Fong and Spivak’s “Seven Sketches in Compositionality”
#:programming, codice, snippet
::: johncarlosbaez

Verifying myself: Keybase.io
#:sicurezza, spionaggio, virus
::: jeanqasaur

Take extra caution with obscure tech brands. Take a pause and do some research
#:sicurezza, spionaggio, virus
::: nytimes

Python Script to download hundreds of images from ‘Google Images’. It is a ready-to-run code!
#:linguaggi di programmazione
::: rasbt

E niente, in questa analisi di @CBlengio c’è tutto, ma proprio tutto. Provo a fare delle postille che mi sono venute in mente leggendolo
#:Web, Internet
::: carolafrediani

Making cloud-native computing universal and sustainable
#:open source
::: cialunet

Very good article, showing how difficult it is to enforce anti-hate speech policies when haters get smart, and the platform is not. We’re at a point in which even a shutdown appears to make (some) sense. And that is wrong
#:social media
::: fabiochiusi

I’ve been at @RedHat for 10 years today
#:open source
::: richsharples

My unpublished op-ed on #Facebook is one sentence long: “I’ve been studying Facebook and privacy for over 10 years, and nothing from the past few weeks is surprising in the least”
#:social media
::: michaelzimmer

Ci siamo… l’#OpenSource entra nella #PA
#:open source
::: umbr0s

Facebook Donated To 46 of 55 Members On Committee That Will Question Zuckerberg
#:sicurezza, spionaggio, virus
::: Slashdot

‘Big Brother’ In India Requires Fingerprint Scans For Food, Phones, Finances
#:privacy
::: Slashdot

Berkeley Offers Its Data Science Course Online For Free
#:dati, raccolta #:scuola, educazione
::: Slashdot

Is Microsoft Trying To Make Windows 10 Mail Worse?
#:applicazioni, programmi
::: Slashdot

I’ve downloaded for free: Born, a mediterranean #typography #font for text designed by @carlosdetoro. Get it
#:open source
::: italovignoli

Tim Cook Says Ads That Follow You Online Are ‘Creepy’
#:ad, pubblicità
::: Slashdot

An interactive guide to learning Rust
#:linguaggi di programmazione
::: Gianlucadfiore

Here’s a great overview of modern garbage collection technology. It’s a multidimensional design problem with fascinating tradeoffs at every step
#:linguaggi di programmazione
::: tikhonjelvis

Social e Instant Messaging & Dati – Oltre a Facebook, come usano i dati delle persone le principali piattaforme social e app di messaggistica istantanea
#:social media
::: pedroelrey

How to create LaTeX documents with Emacs
#:applicazioni, programmi
::: cialunet

5 steps to building a cloud that meets your users’ needs
#:Web, Internet
::: cialunet

The current state of Linux video editing
#:applicazioni, programmi
::: cialunet

Article 13 can destroy my startup
#:copyright e brevetti
::: communia_eu

Palantir Had No Policy On Social Media Data Collection Prior To 2015
#:sicurezza, spionaggio, virus
::: fabiochiusi

Dear Developer, The Web Isn’t About You
mooolto importante
#:Web, Internet
::: laura_nobilis

RSS is undead
#:Web, Internet #:social media
::: samim

“#Telegram è pericoloso”. Come dire: i coltelli da cucina sono letali se invece di utilizzarli per affettare il salame, ammazzi ii vicino di pianerottolo
#:social media
::: SergioGridelli

I added a video to a @YouTube playlist TdP-2018-L11: Introduzione alla ricorsione
#:linguaggi di programmazione
::: fulcorno

Rather than asking if people should delete Facebook, we are asking: What privacy protections should users have a right to expect, whether they decide to leave or use a platform like Facebook?
#:privacy
::: EFF

Il dipartimento per la Sicurezza Usa vuole monitorare 290mila media, influencer e blogger. Qualcuno si preoccupa. Ma per il portavoce del governo sono complottisti paranoici
#:privacy
::: carolafrediani

And… I started a blog!
#:Web, Internet
::: heathercmiller

Facebook Suspends Another Data Analytics Firm After CNBC Discovers It Was Using Tactics like Cambridge Analytica
#:privacy
::: Slashdot

In light of the CubeYou news, just a reminder that the University of Cambridge Psychometrics Center has this huge Facebook user database being used for questionable purposes
#:privacy
::: kashhill

JavaFastPFOR: A simple integer compression library in Java
#:linguaggi di programmazione
::: lemire

Git turns 13, Linux and SSH commands to know, Python programming, and more
#:novità
::: cialunet

Two-Thirds of Tweeted Links Come From Bots, Report Says
#:social media #:sicurezza, spionaggio, virus
::: Slashdot

Ho scritto un nuovo post sul blog, sperando non sia l’ultimo
#:Web, Internet
::: Conceal_DF

The State of Game Development in Rust
#:linguaggi di programmazione #:games
::: RustLibHunt ::: thek3nger

So how did Stack Overflow become a haven for bullies? As someone on the site might respond, “This really isn’t that hard to understand.”
#:Web, Internet
::: aprilwensel

If the research efforts are truly independent, this is great news. We definitely need more research around data manipulation and abuse, especially concerning elections. More data = less sensationalism. More realism, less fiction. Which is good.
#:sicurezza, spionaggio, virus
::: fabiochiusi ::: zeynep ::: CraigSilverman

Windows File Manager released as open source by Microsoft
#:open source
::: mikko

Intel admits a load of its CPUs have Spectre v2 flaw that can’t be fixed
#:bug
::: hthetiot

Steve Wozniak Drops Facebook: ‘The Profits Are All Based On the User’s Info’
#:privacy #:protagonisti
::: Slashdot

China Is Forcing People To Download An App That Tells Them To Delete “Dangerous” Photos
#:censura
::: fabiochiusi

Python and Numpy running in the browser
#:linguaggi di programmazione
::: MDroettboom

‘Erotic Review’ Blocks US Internet Users To Prepare For Government Crackdown
#:censura
::: Slashdot

Cosa rischia Zuckerberg dopo l’audizione al Congresso Usa L’ombra di sanzioni dalla Commissione federale per il commercio. La possibilità di interventi normativi. Il Ceo di Facebook si prepara per i suoi due giorni più lunghi
#:privacy #:social media #:protagonisti
::: carolafrediani

Getting started with JavaParser: analyzing Java Code programmatically
#:linguaggi di programmazione
::: ftomasse

Don’t Give Away Historic Details About Yourself
#:privacy
::: Slashdot

REPL.it Color, Effects, and Emojis (Liven Up Your POSIX Terminal App)
#:linguaggi di programmazione #:Web, Internet
::: robmuh

Teaching the C memory model tomorrow and number representations on Thursday. Tell me your favorite memory- and number-related software bugs!
#:linguaggi di programmazione
::: jeanqasaur

Analysis | 14 years of Mark Zuckerberg saying sorry, not sorry
#:protagonisti
::: BrendanEich

Recent iOS Update Kills Functionality On iPhone 8s Repaired With Aftermarket Screens
#:dispositivi mobili
::: Slashdot

Strano che ci sia svegliando adesso, ma non è mai troppo tardi. L’unico possibilità che abbiamo contro lo strapotere di talune multinazionali e quella di indentarne il fatturato…
#:ditte
::: thefreecircle

Many people asked me what lawmakers should ask Mark Zuckerberg. Here’s my answer: Nothing. Instead, they should get to work and pass legislation to fix the reckless surveillance in the digital economy
#:social media
::: zeynep

How Much VR User Data Is Oculus Giving To Facebook?
#:privacy
::: Slashdot

we should all be thinking of ways to reintroduce competition into the digital economy
#:Web, Internet
::: tedeschini

Turns out using the @twitter mobile version on desktop is 100x better then the desktop version
#:dispositivi mobili
::: Alexintosh

In difesa delle “fake news”
#:Web, Internet
::: L_estinto

1/? Today Mark Zuckerberg testifies before the Senate Judiciary and Commerce Committee (Live stream here
#:privacy
::: privacyint

This is really impressive. I knew there‘s money in the game, but those numbers blew me away
#:games
::: dhauenstein

Facebook Launches Bug Bounty Program To Report Data Thieves
#:privacy
::: Slashdot

As we all listen to @finkd apologize to congress for the umpteenth time, it’s important to remember that @facebook’s leaking user data isn’t new or an accident
#:sicurezza, spionaggio, virus
::: ashk4n

Sarà la volta buona, o una soluzione senza usabilità, o un nuovo canale di attacco? “Login with no password
#:Web, Internet
::: fulcorno ::: brucel

Some Facebook Employees Are Quitting or Asking To Switch Departments Over Ethical Concerns
#:ditte
::: Slashdot

Firefox Follows Chrome and Blocks the Loading of Most FTP Resources
#:Web, Internet
::: Slashdot

Mozilla’s new report on internet health in 2018 has important info
#:Web, Internet
::: accessnow

To celebrate 10 years, we’ve collected some our favorite moments and milestones—just a few ways you’ve pushed software forward
#:Web, Internet
::: github

Emergency Alert Systems Used Across the US Can Be Easily Hijacked
#:sicurezza, spionaggio, virus
::: Slashdot

FTC Warns Manufacturers That ‘Warranty Void If Removed’ Stickers Break the Law
#:hardware
::: Slashdot

Why Does “=” Mean Assignment?
#:storia
::: marcelsalathe

8 Ways to Become a Better Coder
#:programming, codice, snippet
::: RichRogersIoT

Twitter Says It Will Comply With Honest Ads Act To Combat Russia Social Media Meddling
#:ad, pubblicità
::: Slashdot

Democratic Senators Propose ‘Privacy Bill of Rights’ To Prevent Websites From Sharing Or Selling Sensitive Info Without Opt-In Consent
#:censura
::: Slashdot

And they call me a criminal
#:Web, Internet
::: Snowden

Zuckerberg Testimony: Facebook AI Will Curb Hate Speech In 5 To 10 Years
#:Web, Internet
::: Slashdot

Apple Must Pay Patent Troll More Than $500 Million In iMessage Case
#:copyright e brevetti
::: Slashdot

Python 2 will be replaced with Python 3 in the next Red Hat Enterprise Linux (RHEL) major release
#:linguaggi di programmazione
::: BitIntegrity

One of my minor annoyances with python doctest is inability to reliably test dict outputs
#:linguaggi di programmazione
::: jakevdp

Copyright rules shouldn’t restrict the ability of teachers, researchers and students to access material for educational purposes
#:copyright e brevetti
::: eduint

La #Russia si appresta a mettere al bando #Telegram
#:social media #:censura
::: sdallagata

Check the most unfair terms and conditions of educational licences in Europe, our new research report
#:copyright e brevetti
::: communia_eu

An implementation of Coq’s Calculus of Inductive Construction in 1100 lines of Racket
#:language Racket
::: TheMichaelBurge

I’m looking for a command line tool to let me schedule twitter posts without having to enter a bunch of data manually into a web form like Tweetdeck. Any suggestions?
#:social media
::: doughellmann ::: doughellmann

Tech Giants Like Amazon and Facebook Should Be Regulated, Disrupted, or Broken Up: Mozilla Foundation
#:Web, Internet #:ditte
::: Slashdot

Spotify Is Planning a New Version of Its Free Music Service
#:Web, Internet
::: Slashdot

This slide from #AnacondaCON might be of interest to some…
#:linguaggi di programmazione
::: pwang

WebAssembly definitely feels like the future; and also the end of what I’ve known as the web since mid-90s
#:Web, Internet
::: humphd

Read our new white paper, “The Challenge of using C in Safety-Critical Applications”
#:linguaggi di programmazione
::: PolySync

why a #newpypi codebase is necessary, what’s new, what features are going away, and what to expect in the near future
#:linguaggi di programmazione
::: brainwane

Ecco perché fallire significa fare esperienza
#:scuola, educazione
::: SergioGridelli

@mariofusco (@redhat, @DroolsRules, Java Champion) will show us how to implement laziness in Java
#:linguaggi di programmazione
::: aheritier

‘Fuchsia Is Not Linux’: Google Publishes Documentation Explaining Their New OS
#:sistemi operativi
::: Slashdot

Google’s Phone App Is Getting the Power To Send Spam Calls Straight To Voicemail
#:spam
::: Slashdot

Hydrogen v2.4.0 is out with the latest in Vega + Vega-lite spec. With the coming Altair 2.0 you’ll have full interactive charts
#:linguaggi di programmazione
::: nteractio

Steve Jobs talks at MIT in 1992 about NeXT, competing in the market, software development, objects
#:storia
::: RainerJoswig

Getting started with Jenkins Pipelines
#:linguaggi di programmazione
::: cialunet

I just released Cerberus 1.2 with a number of relvant fixes and some new features
#:linguaggi di programmazione
::: nicolaiarocci

Apple Starts Alerting Users That It Will End 32-Bit App Support On the Mac
#:sistemi operativi
::: Slashdot

“Practically Accurate Floating-Point Math” is a good title for a good article, but somehow I want to call it “Rational Floating-Point Math”
#:programming, codice, snippet
::: wallingf

A complete #compiler to x86 in one page for my lecture today
#:programming, codice, snippet
::: joepolitz

If you didn’t see this oped by @alvarombedoya yesterday, read it now
#:privacy
::: katecrawford

I fear that the laws that’ll be proposed after the Facebook hearings are going to be convoluted and, like most laws, have all sorts of messy consequences. I’m starting to believe that a simple approach might be better
#:social media
::: zephoria

Just cut the second release candidate of Altair version 2.0: lots of bug fixes, more examples, improved documentation, and support for more frontends
#:linguaggi di programmazione
::: jakevdp

New blog post “Making an IDE Plugin for DrRacket”
#:language Racket
::: VideoLang

C# is awesome
#:linguaggi di programmazione
::: The Ubuntu Incident

I added a video to a @YouTube AmI-2018-L09: Building web applications with Flask – basics
#:programming, codice, snippet
::: fulcorno

are there any good Linux kernel books from the last decade?
#:sistemi operativi
::: johnregehr

Some Android Device Makers Are Lying About Security Patch Updates
#:sicurezza, spionaggio, virus
::: Slashdot

you wanted it, you got it: here’s a picture of me somehow making the new Racket 7 macro expander go into an infinite loop introducing #%app over and over again
#:language Racket
::: lexi_lambda

Cyber-Espionage Groups Are Increasingly Leveraging Routers in Their Attacks
#:sicurezza, spionaggio, virus
::: Slashdot

Moving Beyond Defensive Programming: Guidelines for Practical Correctness Through Type Signatures
#:programming, codice, snippet
::: nescalas

An Egyptian journalist made this
#:privacy
::: asadabukhalil

Mark Zuckerberg Refuses to Admit How Facebook Works
#:social media
::: fabiochiusi

It’s Surprisingly Easy To Make Government Records Public on Google Books
#:Web, Internet #:media
::: Slashdot

Facebook Doesn’t Expect Revenue Impact Over Privacy Concerns
#:ditte
::: dseetharaman

People who are focusing on Mark Zuckerberg’s testimony to Congress are missing the point. What happens to Facebook in Europe is far more important – and the stakes just got far, far higher this morning thanks to a legal decision in Ireland
#:privacy
::: henryfarrell

Cops Around the Country Can Now Unlock iPhones, Records Show
#:privacy
::: Slashdot

Nearly 1 In 10 Americans Have Deleted Their Facebook Account Over Privacy Concerns, Survey Claims
#:social media
::: Slashdot ::: micke_fi

In 2012, Nokia was on the verge of extinction, unable to compete with industry behemoths Apple and Android. Today, Nokia is number two in the $100 billion-dollar global wireless market
#:ditte
::: mikko

Another APT heavily targeting Middle Eastern targets
#:sicurezza, spionaggio, virus
::: x0rz

The biggest problem with social networking sites & apps is that they fundamentally don’t understand the concept of consent
#:social media
::: manisha72617183

Just wondering how the GDPR “delete all my personal data” rule plays out with the blockchain “you can’t change anything in the blockchain” rule – same question for databases with write append only data stores
#:sicurezza, spionaggio, virus #:privacy #:blockchain e crypto*
::: joeerl

Revealed: Aleksandr Kogan collected Facebook users’ direct messages. People who logged into This Is Your Digital Life shared their news feed, timeline, posts and messages
#:privacy
::: shapshak

Such hypocrisy… politicians grill #Zuckerberg about the importance of privacy, while simultaneously supporting the world’s largest surveillance apparatus
#:privacy
::: ErikVoorhees

Despite the awful questioning, Zuckerberg’s hearing gave us clues about what Facebook plans to do about its data scandal: not much
#:ditte
::: jamesrbuk

3 open source apps for Windows
#:applicazioni, programmi
::: cialunet

Did you notice #Zuckerberg attempts to redefine the very definition of “privacy” as what we share, not what he collects?
#:privacy
::: profcarroll

I wrote a piece for @Slate @FutureTenseNow on why Zuckerberg’s pledge to give GDPR-inspired controls to Americans is hollow inside
#:privacy
::: mikarv

Large ISPs that have spent countless hours fighting meaningful privacy protections are suddenly using the Facebook fracas to call for new privacy laws. Why? They know they’ll probably be the ones writing the legislation
#:privacy
::: rankingrights

Fear and insecurity dominate as #media make #infotainment out of #Italy’s election
media, anche queli di carta e la tele
#:media
::: EJNetwork

Moscow court rules in favor of FSB to block @telegram in Russia
#:censura
::: Lucian_Kim ::: AFP ::: hronir

Russian lawmakers drafted a new version of their latest lousy idea to regulate social media. But just how bad is it? Nine questions, asked and answered
#:censura
::: meduza_en ::: fabiochiusi

Il prologo poco conosciuto del caso Cambridge Analytica
punta alla seconda parte di una serie di tre, fondamentali. L’autrice c’è su Twitter come @NuovoeUtile (sì, confesso, la conoscono tutti tranne me)
#:sicurezza, spionaggio, virus
::: marcodelmastro

A Berlin court has ordered Facebook not to block a user and not to delete a comment made by that user, even though it breached the social network’s community standards
#:social media
::: fabiochiusi

This is an interesting lineup of former FB people with differing perspectives on the behemoth that they, to a greater or lesser extent, helped create
#:ditte
::: antoniogm

Hello
#:social media
::: hello

My top 3 “extremely easy and practical security tips” that I highly recommend to anyone
#:sicurezza, spionaggio, virus
::: marcelsalathe

A great analysis of #webapps and their rising popularity by @futurepaul of @verge. Touches on many of the reasons why the @kaiostech #mobileOS is entirely web-based!
#:Web, Internet #:dispositivi mobili
::: KaiOStech

Google loses landmark ‘right to be forgotten’ case
#:privacy
::: fabiochiusi

Google Chrome To Boost User Privacy by Improving Cookies Handling Procedure
#:privacy
::: Slashdot

Apprendo (e potevo immaginare) che le scuole sono “bombardate” di offerte per adeguamento #GDPR
#:scuola, educazione
::: madbob

Telegram is Riddled With Tens of Thousands of Piracy Channels; Apple and Google Have Ignored Requests From Creators To Take Action
#:pirateria
::: Slashdot

Apple Sued an Independent iPhone Repair Shop Owner and Lost
#:ditte
::: Slashdot

In a Leaked Memo, Apple Warns Employees to Stop Leaking Information
#:ditte
::: Slashdot

The HP Garage where the company Hewlett-Packard was founded
#:storia
::: MikkoEerola1

Haskell’s async library is such a undersold part of the language. Folks are so conditioned to assume async is hard (even by certain folks in the haskell community) they tend to avoid the amazing power they have sitting just within reach
OK, panic! cioè riusirò ad arrivarci?
#:programmazione funzionale
::: KirinDave

Go: the Good, the Bad and the Ugly
#:linguaggi di programmazione
::: thek3nger

This should be illegal
#:Web, Internet
::: marcelsalathe

semplice tool per creare mappe concettuali a partire da testo formattato
#:applicazioni, programmi
::: madbob

Stiamo costruendo una #distopia solo per fare in modo che le persone facciano clic sugli annunci
#:Web, Internet
::: sdallagata

mypy 0.590 is out!
#:linguaggi di programmazione
::: gvanrossum

In fact, there’s polling to indicate that Trump is more trusted as a source of information than the news media— by Republicans
#:caos informativo, fake news, bufale
::: jayrosen_nyu

daily-tweeter 0.1.0
#:applicazioni, programmi
::: doughellmann

15 Types of Regression you should know
#:programming, codice, snippet
::: marcelsalathe

I think it’s finally ready to be merged! Here’s the longest Hackett commit message to date on rewriting the internal type representation. Nothing flashy to demo, unfortunately, since it’s a purely internal change, but it should hopefully unblock a few things going forward
#:programmazione funzionale #:language Racket
::: lexi_lambda

Some of my takeaways from #KnowJS
#:linguaggi di programmazione
::: The_Power_Coder

Facebook Uses Artificial Intelligence to Predict Your Future Actions for Advertisers, Says Confidential Document
#:privacy
::: fabiochiusi

How It Became Normal to Ignore Texts and Emails
#:Web, Internet
::: RadioProzac

Haskell – 167 – Sintassi avanzata – 4

Continuo da qui, copio qui.

Pattern matching
Pattern matching is one of the most powerful features of Haskell (and most functional programming languages). It is most commonly used in conjunction with case expressions, which we have already seen in the section on Functions [qui]. Let’s return to our Color example from the section on Datatypes [qui]. I’ll repeat the definition we already had for the datatype:

data Color
  = Red
  | Orange
  | Yellow
  | Green
  | Blue
  | Purple
  | White
  | Black
  | Custom Int Int Int  -- R G B components
  deriving (Show,Eq)

We then want to write a function that will convert between something of type Color and a triple of Ints, which correspond to the RGB values, respectively. Specifically, if we see a Color which is Red, we want to return (255,0,0), since this is the RGB value for red. So we write that (remember that piecewise function definitions are just case statements):

colorToRGB Red = (255,0,0)

If we see a Color which is Orange, we want to return (255,128,0); and if we see Yellow, we want to return (255,255,0), and so on. Finally, if we see a custom color, which is comprised of three components, we want to make a triple out of these, so we write:

colorToRGB Orange = (255,128,0)
colorToRGB Yellow = (255,255,0)
colorToRGB Green  = (0,255,0)
colorToRGB Blue   = (0,0,255)
colorToRGB Purple = (255,0,255)
colorToRGB White  = (255,255,255)
colorToRGB Black  = (0,0,0)
colorToRGB (Custom r g b) = (r,g,b)

Then, in our interpreter, if we type (metto il codice precedente in Colors.hs):

Prelude> :l Colors
[1 of 1] Compiling Main             ( Colors.hs, interpreted )
Ok, modules loaded: Main.
*Main> colorToRGB Yellow
(255,255,0)

What is happening is this: we create a value, call it x, which has value Yellow. We then apply this to colorToRGB. We check to see if we can “match” x against Red. This match fails because according to the definition of Eq{Color}, Red is not equal to Yellow. We continue down the definitions of colorToRGB and try to match Yellow against Orange. This fails, too. We the try to match Yellow against Yellow, which succeeds, so we use this function definition, which simply returns the value (255,255,0), as expected.

Suppose instead, we used a custom color:

*Main> colorToRGB (Custom 50 200 100)
(50,200,100)

We apply the same matching process, failing on all values from Red to Black. We then get to try to match Custom 50 200 100 against Custom r g b. We can see that the Custom part matches, so then we go see if the subelements match. In the matching, the variables r, g and b are essentially wild cards, so there is no trouble matching r with 50, g with 200 and b with 100. As a “side-effect” of this matching, r gets the value 50, g gets the value 200 and b gets the value 100. So the entire match succeeded and we look at the definition of this part of the function and bundle up the triple using the matched values of r, g and b.

We can also write a function to check to see if a Color is a custom color or not:

isCustomColor (Custom _ _ _) = True
isCustomColor _ = False

When we apply a value to isCustomColor it tries to match that value against Custom _ _ _. This match will succeed if the value is Custom x y z for any x, y and z. The _ (underscore) character is a “wildcard” and will match anything, but will not do the binding that would happen if you put a variable name there. If this match succeeds, the function returns True; however, if this match fails, it goes on to the next line, which will match anything and then return False.

For some reason we might want to define a function which tells us whether a given color is “bright” or not, where my definition of “bright” is that one of its RGB components is equal to 255 (admittedly an arbitrary definition, but it’s simply an example). We could define this function as:

isBright = isBright' . colorToRGB
  where isBright' (255,_,_) = True
        isBright' (_,255,_) = True
        isBright' (_,_,255) = True
        isBright' _         = False

Let’s dwell on this definition for a second. The isBright function is the composition of our previously defined function colorToRGB and a helper function isBright', which tells us if a given RGB value is bright or not. We could replace the first line here with isBright c = isBright' (colorToRGB c) but there is no need to explicitly write the parameter here, so we don’t. Again, this function composition style of programming takes some getting used to, so I will try to use it frequently in this tutorial.

The isBright' helper function takes the RGB triple produced by colorToRGB. It first tries to match it against (255,_,_) which succeeds if the value has 255 in its first position. If this match succeeds, isBright' returns True and so does isBright. The second and third line of definition check for 255 in the second and third position in the triple, respectively. The fourth line, the fallthrough, matches everything else and reports it as not bright.

We might want to also write a function to convert between RGB triples and Colors. We could simply stick everything in a Custom constructor, but this would defeat the purpose; we want to use the Custom slot only for values which don’t match the predefined colors. However, we don’t want to allow the user to construct custom colors like (600,-40,99) since these are invalid RGB values. We could throw an error if such a value is given, but this can be difficult to deal with. Instead, we use the Maybe datatype. This is defined (in the Prelude) as:

data Maybe a = Nothing
             | Just a

The way we use this is as follows: our rgbToColor function returns a value of type Maybe Color. If the RGB value passed to our function is invalid, we return Nothing, which corresponds to a failure. If, on the other hand, the RGB value is valid, we create the appropriate Color value and return Just that. The code to do this is:

rgbToColor 255   0   0 = Just Red
rgbToColor 255 128   0 = Just Orange
rgbToColor 255 255   0 = Just Yellow
rgbToColor   0 255   0 = Just Green
rgbToColor   0   0 255 = Just Blue
rgbToColor 255   0 255 = Just Purple
rgbToColor 255 255 255 = Just White
rgbToColor   0   0   0 = Just Black
rgbToColor   r   g   b =
  if 0 <= r && r <= 255 &&
     0 <= g && g <= 255 &&
     0 <= b && b <= 255
    then Just (Custom r g b)
    else Nothing   -- invalid RGB value

The first eight lines match the RGB arguments against the predefined values and, if they match, rgbToColor returns Just the appropriate color. If none of these matches, the last definition of rgbToColor matches the first argument against r, the second against g and the third against b (which causes the side-effect of binding these values). It then checks to see if these values are valid (each is greater than or equal to zero and less than or equal to 255). If so, it returns Just (Custom r g b); if not, it returns Nothing corresponding to an invalid color.

Using this, we can write a function that checks to see if a right RGB value is valid:

rgbIsValid r g b = rgbIsValid' (rgbToColor r g b)
  where rgbIsValid' (Just _) = True
        rgbIsValid' _        = False

Here, we compose the helper function rgbIsValid' with our function rgbToColor. The helper function checks to see if the value returned by rgbToColor is Just anything (the wildcard). If so, it returns True. If not, it matches anything and returns False.

Pattern matching isn’t magic, though. You can only match against datatypes; you cannot match against functions. For instance, the following is invalid:

f x = x + 1

g (f x) = x

Even though the intended meaning of g is clear (i.e., g x = x - 1), the compiler doesn’t know in general that f has an inverse function, so it can’t perform matches like this.

👽

Haskell – 166 – Sintassi avanzata – 3

Continuo da qui, copio qui.

Applicazione parziale
Partial application is when you take a function which takes n arguments and you supply it with < n of them. When discussing Sections, we saw a form of “partial application” in which functions like + were partially applied. For instance, in the expression map (+1) [1,2,3], the section (+1) is a partial application of +. This is because + really takes two arguments, but we’ve only given it one.

Partial application is very common in function definitions and sometimes goes by the name “η (eta) reduction“. For instance, suppose we are writing a function lcaseString which converts a whole string into lower case. We could write this as:

lcaseString s = map toLower s

Here, there is no partial application (though you could argue that applying no arguments to toLower could be considered partial application). However, we notice that the application of s occurs at the end of both lcaseString and of map toLower. In fact, we can remove it by performing eta reduction, to get:

lcaseString = map toLower

Now, we have a partial application of map: it expects a function and a list, but we’ve only given it the function.

This all is related to the type of map, which is (a -> b) -> ([a] -> [b]), when all parentheses are included. In our case, toLower is of type Char -> Char. Thus, if we supply this function to map, we get a function of type [Char] -> [Char], as desired.

Now, consider the task of converting a string to lowercase and removing all non letter characters. We might write this as:

lcaseLetters s = map toLower (filter isAlpha s)

But note that we can actually write this in terms of function composition:

lcaseLetters s = (map toLower . filter isAlpha) s

And again, we’re left with an eta reducible function:

lcaseLetters = map toLower . filter isAlpha

Writing functions in this style is very common among advanced Haskell users. In fact it has a name: point-free programming (not to be confused with pointless programming). It is called point free because in the original definition of lcaseLetters, we can think of the value s as a point on which the function is operating. By removing the point from the function definition, we have a point-free function.

A function similar to (.) is ($). Whereas (.) is function composition, ($) is function application. The definition of ($) from the Prelude is very simple:

f $ x = f x

However, this function is given very low fixity, which means that it can be used to replace parentheses. For instance, we might write a function:

foo x y = bar y (baz (fluff (ork x)))

However, using the function application function, we can rewrite this as:

foo x y = bar y $ baz $ fluff $ ork x

This moderately resembles the function composition syntax. The ($) function is also useful when combined with other infix functions. For instance, we cannot write:

Prelude> putStrLn "5+3=" ++ show (5+3)

:1:1: error:
    • Couldn't match expected type ‘[Char]’ with actual type ‘IO ()’
    • In the first argument of ‘(++)’, namely ‘putStrLn "5+3="’
      In the expression: putStrLn "5+3=" ++ show (5 + 3)
      In an equation for ‘it’: it = putStrLn "5+3=" ++ show (5 + 3)

because this is interpreted as (putStrLn "5+3=") ++ (show (5+3)), which makes no sense. However, we can fix this by writing instead:

Prelude> putStrLn $ "5+3=" ++ show (5+3)
5+3=8

Which works fine.

Consider now the task of extracting from a list of tuples all the ones whose first component is greater than zero. One way to write this would be:

fstGt0 l = filter (\ (a,b) -> a>0) l

We can first apply eta reduction to the whole function, yielding:

fstGt0 = filter (\ (a,b) -> a>0)

Now, we can rewrite the lambda function to use the fst function instead of the pattern matching:

fstGt0 = filter (\x -> fst x > 0)

Now, we can use function composition between fst and > to get:

fstGt0 = filter (\x -> ((>0) . fst) x)

And finally we can eta reduce:

fstGt0 = filter ((>0).fst)

This definition is simultaneously shorter and easier to understand than the original. We can clearly see exactly what it is doing: we’re filtering a list by checking whether something is greater than zero. What are we checking? The fst element.

While converting to point free style often results in clearer code, this is of course not always the case. For instance, converting the following map to point free style yields something nearly uninterpretable:

foo = map (\x -> sqrt (3+4*(x^2)))
foo = map (sqrt . (3+) . (4*) . (^2))

There are a handful of combinators defined in the Prelude which are useful for point free programming:

  • uncurry takes a function of type a -> b -> c and converts it into a function of type (a,b) -> c. This is useful, for example, when mapping across a list of pairs:
    Prelude> map (uncurry (*)) [(1,2),(3,4),(5,6)]
    [2,12,30]
  • curry is the opposite of uncurry and takes a function of type (a,b) -> c and produces a function of type a -> b -> c.
  • flip reverse the order of the first two arguments to a function. That is, it takes a function of type a -> b -> c and produces a function of type b -> a -> c. For instance, we can sort a list in reverse order by using flip compare:
    Prelude> Data.List.sortBy compare [5,1,8,3]
    [1,3,5,8]
    Prelude> Data.List.sortBy (flip compare) [5,1,8,3]
    [8,5,3,1]

    This is the same as saying:
    Prelude> Data.List.sortBy (\a b -> compare b a) [5,1,8,3]
    [8,5,3,1]

    only shorter.

Of course, not all functions can be written in point free style. For instance:

square x = x*x

Cannot be written in point free style, without some other combinators. For instance, if we can define other functions, we can write:

pair x = (x,x)
square = uncurry (*) . pair

But in this case, this is not terribly useful.

esercizi
Convert the following functions into point-free style, if possible.

func1 x l = map (\y -> y*x) l in point-free style diventa func1 x = map (*x)

func2 f g l = filter f (map g l) in point-free style diventa func2 f g = filter f . map g

func3 f l = l ++ map f l non è possibile convertirla

func4 l = map (\y -> y+2)
              (filter (\z -> z `elem` [1..10])
                      (5:l))

in point-free style diventa func4 = map (+2) . filter (`elem` [1..10]) . (5:)

func5 f l = foldr (\x y -> f (y,x)) 0 l in point-free style diventa func5 = flip foldr 0 . flip . curry

, copyato.

You might have been tempted to try to write func2 as filter f . map, trying to eta-reduce off the g. In this case, this isn’t possible. This is because the function composition operator (.) has type (b -> c) -> (a -> b) -> (a -> c). In this case, we’re trying to use map as the second argument. But map takes two arguments, while (.) expects a function which takes only one.

👽

AI, innovazioni e blockchain – 17

Dopo lo show di Mark Zuck si continua con l’usuale rassegna comprendente anche l’intelligenza artificiale, una cosa che piace molto a Mark. E non solo, ecco 💥

Microsoft plans to invest $5B in IoT over the next 4 years. IoT is a transformative technology. Last century electricity brought machines & factories to life. This century IoT & AI will bring machines & factories to life in entirely new ways
#:Internet of things
::: RichRogersIoT

Bitcoin combines all three
#:blockchain e crypto*
::: el33th4xor

I’m thrilled to finally share a huge announcement. Today @TEDTalks is launching a new initiative that aims to revolutionize how we change the world. It’s called The Audacious Project: Collaborative Philanthropy for Bold Ideas
#:innovazioni, futuro
::: TEDchris

Casaleggio vuole implementare Rousseau con la tecnologia blockchain, ma i registri distribuiti funzionano x i sistemi di voto? Il caso della Sierra Leone e della Colombia dicono di si ma restano aperte molte questioni a partire dall’accesso alla banda
#:blockchain e crypto*
::: gabriella_roux

Chainspotting: Building Exploit Chains with Logic Bugs
#:blockchain e crypto*
::: mobilesecurity_

The Scientific Paper Is Obsolete. Here’s What’s Next
#:media
::: marcelsalathe

Hacker Uses Exploit To Generate Verge Cryptocurrency Out of Thin Air
#:sicurezza, spionaggio, virus #:blockchain e crypto*
::: Slashdot

Coinbase Launches Early-Stage Venture Fund
#:blockchain e crypto*
::: Slashdot

Police officers in Dubai tested out a new mode of transportation
#:innovazioni, futuro
::: businessinsider

Unocoin, one of India’s largest cryptocurrency exchanges, stated that no banks have terminated relationships with local trading platforms, and that the Indian central bank’s recent statement does not change the legal status of cryptocurrencies in India
#:blockchain e crypto*
::: iamjosephyoung ::: TheNextWeb

At a minimum, any company or any AI researcher considering whether to work with the military on a project with potentially dangerous or risky AI applications should be asking these questions
#:artificial intelligence
::: EFF

It’s fashinating: w/ negligible exceptions, almost every single line that you can read on newspapers about Bitcoin & related topics are ABSOLUTELY wrong/false. Not just slightly incorrect or oversimplified: the complete, exact OPPOSITE of reality!
io sono per evitare –paraticamente sempre– stili roboanti, nèh
#:blockchain e crypto*
::: giacomozucco

Elon Musk warns A.I. could create an ‘immortal dictator from which we can never escape’
#:artificial intelligence
::: fabiochiusi ::: amasad

Monero Just Hard Forked — and It Resulted in Four New Projects
#:blockchain e crypto*
::: databreak ::: amasad

Can crypto central banking survive: can cypherpunks continue to print their own money?
#:blockchain e crypto*
::: leashless

Roberto Cingolani: «Ho paura della stupidità umana, non dell’intelligenza artificiale»
#:artificial intelligence
::: Linkiesta

Città di Torino: “così con la blockchain miglioriamo i servizi ai cittadini”
#:blockchain e crypto*
::: fulcorno

GPU Prices Soar as Bitcoin Miners Buy Up Hardware To Build Rigs
#:blockchain e crypto*
::: Slashdot

Professor Milton Friedman predicting Bitcoin in 1999!!!
#:blockchain e crypto*
::: GemCrypto

California May Soon Allow Passengers In Driverless Cars
#:automazione
::: Slashdot

#GoogleHome è il maggiordomo digitale ideato dal colosso di Mountain View. Efficace, semplicissimo da installare e usare. Google era già entrato da tempo nelle nostre case, adesso ci parliamo pure
#:innovazioni, futuro
::: SergioGridelli

Why is that light on? What does that mean? Do I need to know right now? Or can it wait?” IBM Distinguished Engineer @LisaSeacat illustrates next level context aware #AI and #IoT with #WatsonAssistant — a true game changer for automotive applications!
#:artificial intelligence #:automazione
::: IBMIoT

#Bitcoin trades below $7k as BofAML calls cryptos a #bubble
#:blockchain e crypto*
::: Schuldensuehner

Amazon spent nearly $23 billion on R&D last year — more than any other U.S. company
#:ditte
::: emenietti

Today we release our full report on Algorithmic Impact Assessments, a framework for accountability and oversight of AI + algorithmic decision making in public agencies
#:artificial intelligence
::: AINowInstitute

It’s interesting to see how “algorithm” has become a bogeyman among people who write about tech, even people who tend to be relatively well informed. It’s as if people want “algorithm” to become the new “radiation”
#:algoritmi, codice
::: danluu

All Apple Operations Now Run Off 100 Percent Renewable Energy
#:ditte
::: Slashdot

Blockchain, Part I: Introduction and Cryptocurrency
#:blockchain e crypto*
::: Gianlucadfiore

It’s natural to worry about the practicalities of new designs. There’s a wonderful discussion in medium about camera owners worrying about *batteries* being unreliable. Times have changed!
#:innovazioni, futuro
::: _wilfredh

Celebrating all things #robot on this #NationalRoboticsWeek
#:robots
::: SciRobotics

Intelligenza artificiale, l’Ue non vuole restare indietro e investe due miliardi entro il 2019
#:artificial intelligence
::: la Stampa

this is why we’re in this place
#:innovazioni, futuro #:politica
::: fmanjoo

Japan Could Have More Than 3 Million Cryptocurrency Traders
#:blockchain e crypto*
::: Slashdot

Avete presente quella cosa per cui a chi ha un martello tutto sembra un chiodo? Ecco
#:blockchain e crypto*
::: cmnit

Our new working paper on Blockchain and evolutionary and institutional economics
#:blockchain e crypto*
::: profjasonpotts

Why taking the survey?
#:blockchain e crypto*
::: Alexintosh

Great talk by @mikko on #cyberarmsrace #cybersecurityand the implications of the #IoT #Revolution
#:Internet of things
::: couch_patrick

I’ve been told it’s a bubble
#:blockchain e crypto*
::: Alexintosh

Interesting how almost all arguments Zuckerberg makes about Facebook getting “better” revolve around AI
#:artificial intelligence
::: marcelsalathe

I am creating a video series and a few conference talks about Machine Learning/AI for the web and human interfaces
#:artificial intelligence
::: codepo8

The crypto bubble, like the dot-com bubble, is creating the infrastructure that will enable the technologies of the future to be built
#:blockchain e crypto*
::: medialab

The US Military Desperately Wants To Weaponize AI
#:artificial intelligence
::: Slashdot

How Will Automation Affect Different US Cities?
#:automazione
::: Slashdot

He forgot he had his computer mining Bitcoins in his garage
#.bch
::: mikkotweets2013

AI enables mass customization for increasingly narrow markets
#:artificial intelligence
::: RichRogersIoT

Introducing TensorFlow Probability: a probabilistic programming toolbox for machine learning
#:linguaggi di programmazione
::: DataSciFact

Una targa intelligente aggiornata via #OTA? Da maggio, a #Dubai parte la sperimentazione
#:innovazioni, futuro
::: SergioGridelli

È necessario conoscere perfettamente le regole per poterle trasgredire. È la cultura che rende trasgressivi, non l’ignoranza
#:innovazioni, futuro
::: JacopoVeneziani

The EC Vice President called on Europe ”to become a leader in #digital technologies by working on #Blockchain innovation as well as #ArtificialIntelligence development”
#:blockchain e crypto* #:artificial intelligence
::: tokens24

FDA Approves AI-Powered Software To Detect Diabetic Retinopathy
#:artificial intelligence
::: Slashdot

Bitcoin price breaks $8,000 for the first time since late March after rising by more than $1,000 within 30 minutes
#:blockchain e crypto*
::: iamjosephyoung

A Wanted Man in China Has Been Caught Because of Facial Recognition Software
#:artificial intelligence
::: Slashdot

Audizione Zuckerberg – 2

Ho raccolto i link –quasi esclusivamente tweets– relativi alla seconda giornata dell’Audizione di Mark Zuckerberg, dopo il Senato la Camera dei Rappresentanti. Come già detto è una rassegna parziale, filtrata da me e solo con provenienza da chi seguo. Ma per la prassi di Twitter ho trovato tanti cinguettatori nuovi, se avessi tempo ce ne sarebbero diversi (quanti? a handful (cit.)) da followare.
I Rappresentanti sono più incisivi dei Senatori, parecchio. E mi sembra che i tweeps stiano virando verso una direzione precisa –o sto seguendo un campione non rappresentativo?
Al solito, ottimo –mi ripeto– Fabio Chiusi 😋

Mark Zuckerberg outwits Congress
::: JimVandeHei

Day 2 of Mark Zuckerberg’s Testimony: What to Watch For
::: fabiochiusi

Mark Zuckerberg testified before Congress for 5 hours yesterday — and things got weird
::: verge

Senator, we run ads
::: emenietti

This is a crucial rebuke of Zuckerberg’s vision for the future of social media. Automatic filtering is not a way to improve democracy; it is a way to seriously endanger it, though. So if that’s the goal, mission accomplished!
::: fabiochiusi

This Senate committee was useful to illustrate a growing – and very pressing – problem. The difficultly for politicians to hold complex, obtuse technology (and those who build it) accountable
::: JamieJBartlett

It would be cool to see Zuckerberg questioned by people who know how Facebook works
::: danpfeiffer

Si riparte: seconda udienza di Zuckerberg
::: fabiochiusi

“While Facebook has certainly grown, I worry it has not matured,” Mr. Walden said. “I think it is time to ask whether Facebook may have moved too fast and broken too many things”
::: ceciliakang

Crucial point. Did Zuckerberg read the ToS?
::: fabiochiusi

Pallone fails to get a straight answer out of Zuck over whether Facebook will commit to data minimisation through its defaults (today’s interrogators seem a lot more sussed than the senators)
::: superglaze

I wrote about how the format of the #zuckerberg hearings is hostile to substantive questioning—and all the ways Zuckerberg is shrewdly exploiting that
::: WillOremus

Zuck tells Rush Facebook removed the ability for discriminatory ad targeting after the ProPublica investigation
::: superglaze

amounts received by each Congressperson from Facebook since 2014 as they speak in this hearing
::: sarahjeong

L’audizione di #Zuckerberg al Senato USA è stata una completa messa in scena. È questa l’opinione della giurista e politica @ZephyrTeachout. Il congresso non dovrebbe cercare il consenso di Facebook per varare nuove leggi a protezione della privacy
::: scinet_it

Zuckerberg’s playbook for skirting tough questions
::: WillOremus

What Zuckerberg doesn’t mention is that at least 3 of those 8 apps are owned by Facebook
::: AsherSchechter

Facebook has contributed to so much damage BECAUSE Zuck and others mean to do good things for people. The idealism is the problem. There is a fine line between pledging to do no evil and believing you can do no wrong
::: sivavaid

There’s also the consideration of members who would benefit from Facebook’s stock not tanking
::: RobertMaguire_

la cosa affascinante è che i membri del congresso continuano a chiedere a zuckerberg se facebook applicherà una norma ue come la gdpr (regole privacy più complete)
::: emenietti ::: superglaze

Contemplating the Zuckerberg hearings yesterday, I’m asking myself if going forward the Privacy industry (@Google @facebook & rest of Silicon Valley) will be regulated by Washington or Brussels. Because if Washington won’t pass a bill this year it will have abdicated that role
::: RogerEntner

No one is asking #Zuckerberg why he thought it was ok for #Facebook to share users’ friends’ data without consent in the first place. That was the default for years
::: michaelzimmer

Zuckerberg confirms that Facebook GDPR privacy controls will extend to everyone around the world. That’s nice. But now it’s up to US lawmakers to demand similar requirements in the U.S. and of all tech companies
::: JoannaStern

Facebook has not experienced a decrease in user interaction following the Cambridge Analytica revelations, Zuckerberg confirms
::: Kantrowitz

Zuckerberg on the “download your data” tool & GDPR: “I believe that all of your information is in the file”. No, that’s not true. It’s not all of your personal data. See the experience of @podehaye in @TheEconomist
::: F_Kaltheuner

In general this hearing is more focused, aggressive than the Senate’s. Many congresspeople barraging Zuck with “yes-or-no” Qs after his long answers yesterday. Rep. DeGette’s questions include repeatedly asking Zuck whether or not he’s the CEO of Facebook when he pleads ignorance
::: TowCenter

This line of questioning by @USRepMikeDoyle captures exactly the issues @FTC is likely to look at when considering whether @Facebook violated the consent decree
::: ashk4n

A handful
::: fabiochiusi

It’s extremely easy to believe. Zuckerberg is not greedy, he’s eager to shape society according to idealistic values and he can’t understand why people don’t just trust him to do what is right. Utopianists are far more dangerous than the greedy
::: matthewstoller

Caso #CambridgeAnalytica. I Garanti Privacy Ue a Mark Zuckerberg: “Non basta dire ‘mi dispiace’ “. Il Gruppo “Articolo 29” istituisce un Gruppo di lavoro sui social media
::: meobaldo

Congress needs to ask: Does Joseph Chancellor, who started at the company in Cambridge to harvest Facebook user data for Cambridge Analytica, still work at Facebook, and if so, why? Facebook’s website says he still works there
::: aprilaser

Mark Zuckerburg getting roasted on Twitch with robot emojis is peak 2018
::: TristanACooper

Caso Facebook, @AstroSamantha sospende gli aggiornamenti alla sua pagina e invita gli utenti a riflettere sull’utilizzo della piattaforma
::: andreabettini

Castor asks Zuckerberg whether the company is collecting information on people without Facebook accounts, cuts him off when he tries to give a discursive answer. Zuckerberg really tries to talk over her. “You’re collecting medical data, right?” Zuckerberg: “Congresswoman, yes.”
::: TowCenter

Yes! This is a question! Kogan’s sale to C. Analytica is not. About 1/4 of the apps I install on my Android phone used to ask for access to my contacts. Until v6, I either agreed or didn’t get the app
::: callmeike

Pretty unconvincingly, I might add
::: fabiochiusi

Sarbanes asking Zuckerberg all the paperwork for FB embeds in the campaigns of Trump and other candidates
::: fabiochiusi

Sarbanes: “Facebook is becoming a sort of self-regulating superstructure for political discourse. The question is are we the people going to regulate our political dialogue, or are you Mark Zuckerberg going to end up regulating political discourse?”
::: matthewstoller

Facebook does track browsing activity. It does so through the like button on outside websites and the Facebook Pixel. Zuckerberg appears unwilling to say this
::: Kantrowitz

Whoa. FB just notified advertisers about new terms for data collection and targeting…as Zuck testifies
::: antoniogm

Getting (a bit) of some clarity on how many people review content at Facebook. Zuckerberg just said they have 27,000 full time employees, and roughly 20,000 people reviewing content full and part time
::: sheeraf

Welch: anche noi, anche il Congresso deve fare mea culpa, i problemi che stiamo discutendo oggi erano ampiamente prevedibili e non abbiamo fatto nulla per anni. (*applausi*)
::: fabiochiusi

Here’s a fascinating factual question: how does Facebook store the browsing data they get from Like buttons and Facebook Pixel?
::: alexismadrigal

Zuck’s answer to @RepMcNerney’s question re: “@Facebook’s collection of browsing history” was disingenuous
::: ashk4n

Zuckerberg just said he’s “not familiar” with the term “shadow profiles.” That is bullshit of the highest order
::: WillOremus ::: mikarv ::: alexhern ::: fabiochiusi ::: Slashdot

Facebook’s dealings with data brokers are a lot more complex than Mark Zuckerberg is letting on: FB’s data capture and identity-targeting tech is so far ahead now that it’s beating the data brokers at their own game
::: drewharwell

And then there’s the Like button on websites around the web: “If you’re logged into Facebook and visit a website with the Like button, your browser sends us information about your visit”
::: Kantrowitz

What Facebook offers is not portability of your Facebook data but a personal archive of the content you’ve posted. Those are two very different things
::: KevinBankston

You can expect the entire tech press corps to be following up on this point over the next day
::: CaseyNewton

#Zuckerberg keeps saying Facebook will solve its problems with AI. Here’s why that’s not really gonna happen
::: JohnPaczkowski

“What was Facemash and is still up and running” asks Congressman Long. Gees. #Zuckerberg (Although bringing that site up clearly made Zuck uncomfortable)
::: JamieJBartlett

Congressmen floating the ‘FB listening to your microphone’ conspiracy theory to Zuck, complete with personal anecdote
::: antoniogm

Who here believes Facebook is unethical?
::: eaton

University of Cambridge responds to Zuckerberg
::: fabiochiusi

Zuckerberg: Facebook has an anti-terrorism team of 200 people. And yet: 99% of ISIS and Al Qaeda material is flagged by “tools”
::: fabiochiusi

Zuckerberg on the idea of a Digital Consumer Protection Agency: it “deserves consideration”
::: fabiochiusi

.@CongressmanRuiz: We can’t exclusively rely on private companies to self regulate, would you be willing to follow guidelines from something like a digital consumer protection agency?
::: Recode

Just landed in the US – every screen in customs has the Zuckerberg hearing live. Guy behind me in line says: ‘Damn, this AI thing he keeps talking about better be real smart, because it’s got a huge mess to clean up’
::: katecrawford

Zuck, correcting earlier testimony, comes out and admits that Like button impressions are ingested by the topic targeting engine, and used in Ads
::: antoniogm

Er, hello Zuck. I think you may have just lied to Congress. Facebook has done no such thing
::: carolecadwalla

1/ I spent years in the Senate working to pass privacy bills – and seeing the flood of lobbyists that follows. I worry that any effort to pass a broad, EU-style law to protect all “personal data” will be co-opted by Silicon Valley
::: alvarombedoya

Mark Zuckerberg: “I think the GDPR in general is going to be a very positive step for the internet”
::: KurtWagner8

Dingel reminding Zuck all the basic things about his company he claimed to not know. It’s quite a lot, actually
::: fabiochiusi ::: dseetharaman ::: fabiochiusi ::: BuzzFeedNews

“What You Don’t Know About How #Facebook Uses Your #Data”–and other “common parts of people’s experience on the #internet”
::: IEthics

AP captures photo of Zuckerberg Congressional testimony notes
::: tqbf

Zuckerberg can’t say how many webpages have the data-tracking Facebook Like button, Facebook Share button, and Facebook Pixel
::: Kantrowitz

Impressione a caldo sulla seconda udienza di Zuckerberg. Molto più tosta della prima
::: fabiochiusi

#Zuckerberg mentioned AI more than 20 times during his hearing today
::: JohnPaczkowski

#Zuckerberg’s emphasis on privacy settings “called to mind a line of the financial industry’s post-crisis defense: Borrowers should have read the fine print” See also @jathansadowski on the blame-the-victim rhetoric of “cyber-hygiene”
::: FrankPasquale

Listen carefully and you discover a stunning truth about government regulations
::: jeffreyatucker

The Personality Traits That Put You At Risk For Smartphone Addiction
::: Slashdot

I Downloaded the Information That Facebook Has on Me. Yikes
::: marcelsalathe

THIS is both why Facebook is a $500 Billion company and why it craves to know every detail about your personal life. Micro targeting
::: marcelsalathe

Heark, fellow olds! Gather ‘round as I put on my crotchety historian hat, for I have something to say: We’ve seen the rise and fall of friendster, napster, myspace and many more. We’ll live to see the fall of facebook too, an empire built on sand. Keep digging 😉
::: histoftech

Facebook itself is a metaphor in so many ways. It uses the analogy of the freshman lookbook. It uses friendship as a metaphor to describe any connection. It uses a newspaper to describe its feed of events, and like a newspaper editorial board, it will curate what you see
::: manisha72617183

Want to see a list of all the advertisers providing FB with data about you?
::: metaviv

Forty times the internet mogul told lawmakers he had no answers at hand and would get back to them later
::: fabiochiusi

Former Facebook employee says journalists have overhyped priacy
::: CraigSilverman

Zuckerberg has now repeatedly said that Facebook will increasingly move toward AI automatically taking down and even *blocking* posts
::: KevinBankston

E anche
::: aanand

Altri link, simili, forse meno fondamentali ma –secondo me– da vedere
::: fabiochiusi ::: fabiochiusi ::: fabiochiusi ::: fabiochiusi ::: superglaze ::: Kantrowitz ::: yayitsrob ::: Kantrowitz ::: alexeheath ::: MikeIsaac ::: alexhern ::: TowCenter ::: WillOremus ::: MatthewTeague ::: TonyRomm ::: lercionotizie ::: halhod ::: hronir ::: la Stampa ::: rasmus_kleis

La prima giornata è qui.