|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Aug 2002
Messaggi: 2518
|
[Haskell] Tipo di una funzione
Sinceramente non so se in questo forum esiste qualcuno che abbia mai programmato in Haskell, ma ci provo ugualmente.
Non riesco a capire perchè a questa funzione: multxyz = x∗y∗z è associato questo tipo: mult :: Int -> (Int -> (Int -> Int)) quando nella descrizione sul libro di Haskell dice che questa funzione non fa altro che fare il prodotto di quei tre numeri acquisendo i numeri uno ad uno. Cioè matematicamente non dovrebbe essere un dominio del tipo INTxINTxINT -> INT ? perchè Haskell lo descrive in quella forma strana li? Vi ringrazio in anticipo per qualsiasi aiuto, guylmaster. |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Jul 2005
Città: Bologna
Messaggi: 1130
|
http://en.wikipedia.org/wiki/Currying
In realtà in Haskell quella è una funzione che prende un intero e restituisce una funzione che prende un intero e a sua volta restituisce una funzione che prende un intero e torna un intero. Mi spiego, no?
__________________
-> The Motherfucking Manifesto For Programming, Motherfuckers |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Oct 2007
Città: Padova
Messaggi: 4131
|
*edit=sparato vaccata
(adesso vado e mi imparo Haskell, mi imparo
__________________
As long as you are basically literate in programming, you should be able to express any logical relationship you understand. If you don’t understand a logical relationship, you can use the attempt to program it as a means to learn about it. (Chris Crawford) Ultima modifica di banryu79 : 12-10-2011 alle 15:09. |
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Jul 2005
Città: Bologna
Messaggi: 1130
|
Quote:
Ci sono almeno un paio di libri online ben fatti e che puoi scaricare a ufo: http://book.realworldhaskell.org/read/ http://learnyouahaskell.com/chapters (di questo mi pare ci sia anche la versione per kindle in giro da qualche parte se ti interessa)
__________________
-> The Motherfucking Manifesto For Programming, Motherfuckers |
|
|
|
|
|
|
#5 | |
|
Senior Member
Iscritto dal: Oct 2007
Città: Padova
Messaggi: 4131
|
[OT]
Quote:
Se hai un quick link per una versione kindle gratuita me lo gireresti (anche via PM)? Son qua che smanetto con la Haskell Platform e mi sto divertendo un mondo (hai presente quella bella sensazione che provi quando tutto è nuovo e non sai ancora un razzo di quello che ti aspetta? Ecco, una cosa così
__________________
As long as you are basically literate in programming, you should be able to express any logical relationship you understand. If you don’t understand a logical relationship, you can use the attempt to program it as a means to learn about it. (Chris Crawford) |
|
|
|
|
|
|
#6 | |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
Codice:
mult 6 7 8 Codice:
(((mult 6) 7) 8) Per confronto, la funzione equivalente che prende come argomento tre interi e restituisce un intero si scrive nel modo seguente. Codice:
mult :: (Int,Int,Int) -> Int mult (x,y,z) = x∗y∗z ... mult (6,7,8) In un certo senso quindi funzioni che prendono piu' argomenti in Haskell non esistono
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele Ultima modifica di marco.r : 12-10-2011 alle 22:02. |
|
|
|
|
|
|
#7 |
|
Senior Member
Iscritto dal: Aug 2002
Messaggi: 2518
|
Qualcuno sa darmi il link diretto per scaricare Huge98 per MacOS? perchè sto impazzendo per trovarlo ma nulla (si trova solo un pacchetto enorme da utilizzare assieme ad Xcode, ma non è ciò che mi interessa). Altrimenti mi toccherà farlo girare su xp virtualizzato.
Ah dimenticavo, ma manuali in italiano proprio non se ne trovano? |
|
|
|
|
|
#8 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Intendi forse Hugs98 ?
http://cvs.haskell.org/Hugs/pages/downloading.htm
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
|
|
|
|
#9 | |
|
Senior Member
Iscritto dal: Aug 2002
Messaggi: 2518
|
Quote:
|
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 20:57.




















