Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Haskell.

Name: Anonymous 2011-01-30 13:46

This obscure language represents a peculiar corner of the programming language world called functional languages. One of the peculiar things about such languages is that they don’t have variables. Although Haskell isn’t widely known among programmers, those who know of functional languages suspect that they, too, are rather slow

Name: Anonymous 2011-01-30 13:47

It needs to be said very firmly that LISP is not a functional language at all. My suspicion is that the success of Lisp set back the development of a properly functional style of programming by at least ten years. -- David Turner

Name: Anonymous 2011-01-30 13:48

ghc Haskell compiler
;]

Name: Anonymous 2011-01-30 13:50

LISP had its serious shortcomings: its promotion of the idea that a programming language should be able to formulate its own interpreter (which then could be used as the language's definition) has caused a lot of confusion because the incestuous idea of self-definition was fundamentally flawed. -- Edsger Wybe Dijkstra

Name: Anonymous 2011-01-30 15:04

>>4
Fuck off, please.

Name: Anonymous 2011-01-30 15:24

>>5
You cant argue with Dijkstra.

Name: Anonymous 2011-01-30 15:28

>>2
the success of Lisp
OH U

Name: Anonymous 2011-01-30 15:31

>>6
Yeah, because he is loldead.

Name: Anonymous 2011-01-30 17:49

[code]
import Control.Applicative

main = buzzprint.fizzle $  [1..100]

data FizzBuzzer = None Integer|Fizz|Buzz|FizzBuzz

instance Show FizzBuzzer where
    show (None x) = show x
    show Fizz = "Fizz"
    show Buzz = "Buzz"
    show FizzBuzz = "FizzBuzz"

instance Num Bool where
    negate = not
    (+) = (||)
    (*) = (&&)
    fromInteger x |x<=0      = False
                   |otherwise = True
    abs x = x
    signum False = -1
    signum _ = 1

buzzprint::[FizzBuzzer]->IO ()
buzzprint= mapM_ print

fizzle::[Integer]->[FizzBuzzer]
fizzle [] = []
fizzle (fb:fbs) | fizzbuzz  = FizzBuzz:fizzle fbs
                | fizz      = Fizz:fizzle fbs
                | buzz      = Buzz:fizzle fbs
                | otherwise = None fb:fizzle fbs
    where [fizzbuzz,fizz,buzz]= ((:)=<<product) $ map ((==0).(mod fb)) [3,5]
[code]

Name: Anonymous 2011-01-30 17:50

Oh, fuck me. That's what I get for not using {code }

import Control.Applicative

main = buzzprint.fizzle $  [1..100]

data FizzBuzzer =None Integer|Fizz|Buzz|FizzBuzz

instance Show FizzBuzzer where
    show (None x) = show x
    show Fizz = "Fizz"
    show Buzz = "Buzz"
    show FizzBuzz = "FizzBuzz"

instance Num Bool where
    negate = not
    (+) = (||)
    (*) = (&&)
    fromInteger x |x<=0      = False
                   |otherwise = True
    abs x = x
    signum False = -1
    signum _ = 1

buzzprint::[FizzBuzzer]->IO ()
buzzprint= mapM_ print

fizzle::[Integer]->[FizzBuzzer]
fizzle [] = []
fizzle (fb:fbs) | fizzbuzz  = FizzBuzz:fizzle fbs
                | fizz      = Fizz:fizzle fbs
                | buzz      = Buzz:fizzle fbs
                | otherwise = None fb:fizzle fbs
    where [fizzbuzz,fizz,buzz]= ((:)=<<product) $ map ((==0).(mod fb)) [3,5]

Name: Anonymous 2011-01-30 17:59

>>6
lol goto considered harmful

Name: Anonymous 2011-01-30 18:15

>>11
Look at Scheme, it allows gotos (continuations), and this leads to problems, like you cant impement unwind-protect in Scheme. Funckin spaghetti. Java and C#, on the other hand, forbid continuations for security reasons.

Name: Anonymous 2011-01-30 18:25


import Control.Monad.Fix
import Control.Applicative
main = mapM_ print $ take 500 $ thor's_mother

thor's_mother=fix$(<$>)<$>(:)<*>((<$>((:[{- thor's mother -}])<$>))(=<<)<$>(*)<$>(*2))$1

Name: Anonymous 2011-01-30 18:28

>>12
There was a paper on implementing UNWIND-PROTECT in Scheme, but I can't say I've read it. I assume it works by redefining call/cc.

Name: Anonymous 2011-01-30 18:29

>>13
More like thor's_mother = map (2^) [0..], amirite?

Name: Anonymous 2011-01-30 18:33

Name: >>16 2011-01-30 18:41

I guess I'm too slow, >>14 already mentioned it.

You're right, it redefines call/cc, but that's what they call abstraction.

Name: Anonymous 2011-01-30 18:53

???????????????????????????? ???????????????????????????????????????? ???????????? ???????????????????????????????????????????????? ???????????????????????????? ???????? ???????????????????????????????????????????????? ???????????????????????????????????????????????? ???????????? ???????????????????????????????????????? ???????????????????????????????????????????????????? ???????? ???????????? ???????????????? ???????? ????????????????????????????????????????????
???????????????????????????????? ????????????????????????????????, ???????????????????????????????????????? ???????????????????????? ???????????????????? ???????? ???????????? ????????????????????????????????, ???? ???????????????????????????? ???????????????????????????????????????????? ???????? ????????????????????????????, ????????????????????, ????????????????-???????????????????????????? ???????????????????????? ???????????????? ???????????????? ????????????????????????
???????????????????????????????????????? ???????????????????????????????????????? ???????????????????????????????????????????????????? ???????? ???????????????? ???????? ???????????????????????????? ???????????? ???????????????????????? ???????????? ???????????????????????????????????????????????? ???????????????????????????? ???????????? ???????????? ????????????.

???????? ???????? ???? ???????????????? ???????? ???????????????????????? ????????????, ???????????????????????????? ???????? ???????????????????????? ???????????????????? ???????????? ???????????????????????????? ???????????? ???????? ???????????????????????? ???????????? ???????????????????????????????????? ???????????????????? ???????? ???????????? ????????????????????????????????.

Name: Anonymous 2011-01-30 19:01

>>1
Obvious troll.  Haskell has two different kinds of variables, type variables and value variables.  For example, the definition of id shows both:

id :: forall a. a -> a
id x = x


Here, "a" is a type variable.  Every time you call "id", and most times you even use "id" as a value, that type variable takes the value necessary to make the program type check.  This incurs no runtime penalty -- the types are stripped from the program during compilation, like most languages with static type systems.

Then "x" is a value variable.  Each time you call "id", "x" has a different value.  That is, it varies.  Hence, variable.

Some people have the misconception that Haskell has no variables.  This is like saying that "Why is it that northwestern American English speakers don't have an accent?"  Of course they have accents, because an accent is, by definition, "the way they pronounce words".  Because they do pronounce words, they have an accent.  And because a variable is by definition "something that varies", Haskell must indeed have variables.

You just can't change the value which a variable holds, unless you're using an IORef or similar.

Name: >>14 2011-01-30 19:06

>>17
It wasn't a criticism ;), it's how I've seen one-shot continuations, and dynamic-wind implemented.

Name: Anonymous 2011-01-30 19:30

>>12
IMHO that's one of those idiotic CL misconceptions. You either:
1. Unwind and can't re-enter anymore, getting the same behaviour as in CL unwind-protect.
Or
2. Set a finalizer on an object and let the GC handle it, which is the right thing to do in 90% of the cases anyway.

Creating a difference between ``final'' and ``temporary'' exits really seems like a solution looking for a problem.

Further reading:
http://www.nhplace.com/kent/PFAQ/unwind-protect-vs-continuations-overview.html
http://mumble.net/~campbell/blag.txt 2009-03-28

To end on a positive note, let me recite the beautiful dynamic-wind implementation from http://www.cs.hmc.edu/~fleck/envision/scheme48/meeting/node7.html . Understanding it is satori.

(define *here* (list #f))

(define original-cwcc call-with-current-continuation)

(define (call-with-current-continuation proc)
  (let ((here *here*))
    (original-cwcc
     (lambda (cont)
       (proc
        (lambda results
          (reroot! here)
          (apply cont results)))))))

(define (dynamic-wind before during after)
  (let ((here *here*))
    (reroot! (cons (cons before after) here))
    (call-with-values
     during
     (lambda results
       (reroot! here)
       (apply values results)))))

(define (reroot! there)
  (if (not (eq? *here* there))
      (begin
        (reroot! (cdr there))
        (let ((before (caar there))
              (after (cdar there)))
          (set-car! *here* (cons after before))
          (set-cdr! *here* there)
          (set-car! there #f)
          (set-cdr! there '())
          (set! *here* there)
          (before)))))

Name: Anonymous 2011-01-30 19:39

>>19
Obvious troll.  Haskell has two different kinds of variables, type variables and value variables.
…except that neither of those are variables.  They're bindings.

Name: Anonymous 2011-01-30 19:46

>>22
Please read me the title of section 3.2 of the Haskell report.

Name: Anonymous 2011-01-30 19:53

>>22

you seem confused.  a binding is a pair (variable, value), so x = 3 is a binding of the variable x to the value 3.  in haskell, once a varible has a binding then it retains that same binding for the duration of its scope, as opposed to imperative languages which let you change the value of a variable after it has entered scope.

this is why i recommend people fucking pay attention in those required cs classes like compilers/languages.  there are two kinds of programmers: those who took compilers/languages and those who still think that x<<2 is faster than x*4.

Name: Anonymous 2011-01-31 5:38

>>21
>Set a finalizer on an object and let the GC handle it, which is the right thing to do in 90% of the cases anyway.
If only filesystem used immutable files and called GC, when out of disk memory.

Name: Anonymous 2011-01-31 6:16

>>24
Variable means "entity that varies". But in Haskell variables are constant, you cant setf them.

Name: Anonymous 2011-01-31 6:17

>>24
It is in ASM. Especially those ARM machines with hardware barrel shifters.

Name: Anonymous 2011-01-31 6:17

>>26
In fact, Haskell variables arent even a value cells, they're so called `thunks`.

Name: Anonymous 2011-01-31 6:19

>>28
Needless to say, that using thunks instead of variables makes Haskell slower than Ruby.

Name: Anonymous 2011-01-31 6:32

>>24
those who still think that x<<2 is faster than x*4.
"x<<n" is an idiom, which explicitly states that:
1. programmer wants fast multiplication by a power of two.
2. you will've no troubles translating this code to ASM
3. naive compiler for obscure hardware will have no troubles
4. compiling without optimizations would still produce fast code

Name: Anonymous 2011-01-31 6:39

>>15
More like thor's_mother = iterate (*2) 1, amirite?

Name: Anonymous 2011-01-31 6:43

>>30
Even GCC optimizes multiplication by powers of 2. I suspect (hope) >>24 is talking about compilers, not chips.

Name: Anonymous 2011-01-31 6:50

>>32
do chips optimize muls/divs by 2^n?

Name: Anonymous 2011-01-31 7:13

>>33
Generally not, but a few might under certain circumstances. I'm not sure why you're asking though.

Name: Anonymous 2011-01-31 9:44

>>34
So, on x86 division by 4 has the same speed as division by 11?

Name: Anonymous 2011-01-31 10:06

>>35
Stop being fallacious.
Anyway, division by a number is multiplication by its reciprocal, and division by a constant can be optimised to a multiplication and a right shift.

Name: Anonymous 2011-01-31 10:06

>>35
You'll have to provide a listing if you want an answer to that.

Name: Anonymous 2011-01-31 10:07

>>36
yhbt

Name: Anonymous 2011-01-31 10:32

>>26
Variable means "entity that varies". But in Haskell variables are constant, you cant setf them.

First of all, "can't" is a contradiction of "cannot" and thus requires an apostrophe. If you cant even properly grammar, how can you hope to achieve intellectual clarity of ideas?

Then, to your question: in a definition \x -> x * 2 2 is a constant, because it's value cant vary between applications of the function. While the value of x most definitely can, thats why its a variable. Clearly, reading SICP by itself doesnt make make you a better programmer.

Name: Anonymous 2011-01-31 10:52

First of all, "can't" is a contradiction of "cannot" and thus requires an apostrophe. If you cant even properly grammar, how can you hope to achieve intellectual clarity of ideas?
Autist detected.

Name: Anonymous 2011-01-31 10:54

If you cant even properly grammar
verbing a noun

Name: Anonymous 2011-01-31 10:56

>>39
In your example X is an argument, not a variable cell.

Name: Anonymous 2011-01-31 10:57

>>41,40
YHBT

Name: Anonymous 2011-01-31 10:59

>>39
2 is a constant, because it's value cant vary between applications of the function.
If we implement integers as mutable strings, then it can:

*&"2" = 3;

Name: Anonymous 2011-01-31 11:08

integers as mutable strings
But why would you do that in the first place?

Name: Anonymous 2011-01-31 11:15

>>45
In order to leverage yhbt                                             .

Name: Anonymous 2011-01-31 11:44

>>42
I'm not >>39, but in lambda calculus, arguments are called ``bound variables´´, extern bindings (from the outer scope) are called ``free variables´´.
In mathematics, a variable is indeed ``constant'', you don't setf them in the middle of an expression, but they can be any value, depending on what the function is called with.

Now, we all know that Haskell is for pure functional mathematical faggots, therefore it has variables, in the mathematical sense.

The bound variables/free variables thing applies also to Lisp, due to its resemblance with lambda calculus.

Name: Anonymous 2011-01-31 11:59

>>45
They are done this way in the first place. Computer circuitry manipulates bitstrings.

Name: Anonymous 2011-01-31 12:01

>>47
It needs to be said very firmly that LISP is not a functional language at all. My suspicion is that the success of Lisp set back the development of a properly functional style of programming by at least ten years. -- David Turner

Lisp owes its survival specifically to the fact that its programs are lists, which everyone, including me, has regarded as a disadvantage. -- John McCarthy

Name: Anonymous 2011-01-31 12:11

I'm a huge faggot please rape my face. -- >>49

Name: Anonymous 2011-01-31 12:14

>>49
These men speak truth. Listen to them.

Name: Anonymous 2011-01-31 12:16

>>49
Professor David Turner is a British computer scientist.

He has a D.Phil. from the University of Oxford. He has held professorships at Queen Mary College, London, University of Texas at Austin and the University of Kent at Canterbury, where he now retains the post of Emeritus Professor.

He is currently (2004) Professor of Computation at Middlesex University, England.

He is best known for inventing combinator graph reduction and for designing and implementing three seminal functional programming languages SASL, KRC and Miranda, the last of which was awarded a medal for Technical Achievement by the British Computer Society (BCS Awards, 1990).

Name: Anonymous 2011-01-31 12:17

"SASL, KRC and Miranda" were led to invention of Haskell.

Name: Anonymous 2011-01-31 12:18

>>50
Try to ignore troll posts.

Name: Anonymous 2011-01-31 12:27

ding ding ding dubs

Name: Anonymous 2011-01-31 12:29

>>55 is a faggot

Name: >>57 2011-01-31 12:58

Name: Anonymous 2011-01-31 12:58

>>57
*** Exception: stack overflow

Name: Anonymous 2011-01-31 17:32

>>58
[b]Please optimize your Exceptions !
*** Exception: stack pointer monadic overflow

Name: Anonymous 2013-08-31 22:40



          ____       \
       r‐'7ヽ、 `ハ`二ヽ-、  ∠
    r-く  ヽ,>'"⌒ヽハ`ー‐くト、/
    _,!  ヽ/   /ハゝ/rヘ   ヽ.
    ! __,.ィ/   //'´  ,  ',ハ   ',
   rイ/   / 、 ハ ! /|  i ハ   ハ>
   ノイ / / ソ,!=ヽ、レ' | ./_,!イ!  i
  イ /!, ヘハ/ヘ!,_r:ソ`' レ' ト_ハ/!  i,
  〈イ  ハイ ハ 〃"    ,  〃!./|  ||>
  /ン / /レY〉.u  , ー‐-┐ ハ/レi/|\
 ,.イrく V  〈X!へ、 !_____ン,.ィ'|y〉ハヽ<
 ,.イ ̄7ヽ、〈Xト-、`>ーr<へィ二_ヽ、 、\,.、
 Y´ヽi、__/⌒y〉:::`'ーt-イ/::i 「i-‐-.、 i } }  V\/\/\
 !/:::::::::ヽ、 iヽ<:::`ヽ[_]':::::i l_!‐-- i〉、
./k:::::::::::::::::::ムヘ__>:::::::/ハヽ:::::::ゝ'ゝ_ノ i

Name: Anonymous 2013-09-01 0:11



               _,,.. -─- 、.,
            ,  '´          ` 、
          /                ヽ
        ., '    / /   、    \   ':,
        /    ., '   '     '  /`l '   ', 
       ;     /    |       |, ' /l | |  l__
       |    ' ;'  /'、   ト、 / /-‐ `'ー-<´r|
       |    !/-‐/ __ 、  | ∨    l    ∨        :
      、_.ノ    |!、ァ七7ヾ \| / lト、ヽ  、    ハ       ..:::..
      `7、   、ヘ 乂_.ノ  / 八 \\  .ノ |ゝ     ,. -─- 、       :
      ∠..-\  \"     '     \」   _,.‐ァ'| ...  /    丶*\     ..::..
      :.  | `ーハ      | ミヽ      ー'/ |!  :::... {  ノ   、_)   ',   :::  ::
     ..::   ,:|  | ム、  r 、   /`!、__ ` ニ./ 八    ', * ー'´ __  }   _,,,...,,,__
   ,. -─- /,'   ;/  |l≧ノ }/ /  _` ー./| /   ` ーァ  、   , 「  -─-<:::::::::::::l {
 /ー   -//  ,'_,,. イ∨ ´   /-‐'"ノ, イ ト、   `' 、   `/ニ=-::::::::::::::::::::`ヽ:::://
/  / .//;'   ;´  / .|     ‐''イ   |   ! \     ヽ ,'::::/!::::::;::::::;:::::::l::::ヽ:::::∨
  ‐、, ' /  {   .{ r-- }   _,,.イ´  ̄` ;  |/  ヽ.  \ |:::/メ/|::::/|:::ノ!:::::ハ::::::l
  ./  .{  ∧   \ヽ_」___{_r- =   /   '/   ',    レ'-r_ァ' レ 、_l二」:::/:::}:::::|> :
ヽ_ {   ' / ' 、  「´       `ヽ、, '   /´    |  , // "     ゝ-'レ'|:::/::::::l  ::
  ノ   l |   ,ハ /  !   /  //   イ      |//::{   `rー-‐ァ   "/_]:::/l::{ :::
   

Name: Anonymous 2013-09-01 1:42



                    .|
      _,,....  __ _          |  ご  温
    ,. '" ,.ィ二7___!_`r-、.       |  
  ., ' /7'´   `   `!-ゝ_    |  ざ  州
  i   !/  /  ハ i    `ヽ!.   .|  
  i  /! ./ /-/-! ハ__ i !.    |  い  蜜
  ノイ レイ /,.-=、 !/ レ'iハ ,ゝ   | 
  i   ノ iイ"     . ´`!イ´    |  ま  柑
 ノ   !ハYト、.  、__ , "ハ〉   ∠
.〈r、  /ゝ- 、!>.、 __,,.インi      !.  す  で
  !ヘレ'/   `ヽ7ヽ!ヽ.Y)ヽ〉     ヽ、____________
    ,!     〉:ム:::}><{
へ___/!ゝk'-‐ヘ':::!_ハ」i_!ヘ!、
「 /::::::::`ヽ.  ヽ、:イ-ヽ.. ヽ. ,.- 、___,.--、
kヽ/:::::::::::::::::>、.  ヽ、__.ヽ、_,.'--'、: : ヽ-:、)、
:::`>、_二ゝ、ニr-'ヽ、   r'二 ̄ ̄ ̄ ̄ ̄ ̄フ
::/:::::::::!Y  r‐─‐'‐`'ー--‐'´ ̄ ̄ ̄ ̄ ̄ ̄
/::::::::::::)(   \ 
::::::/::::::Y)   ',|ヽ二二二二二二二二二二二

Name: Anonymous 2013-09-01 3:13



      ,. -‐'"´ ̄`''ー-‐')         /
   ト、/  ,. '"´ ̄ ̄`(`' ソ、       ;
   ; '  //   /    ヽ Y 、\       |
  /   / '  /,{    ト ハ  「 `      ,ゝ
  {   l  { /イ∧   ハァr、!ハノ       (
  '、 ' ル {f斤ヽ\/ {リ !{ ヽ、. 。 o ○ ` 、.,_           __.ノ
   ノイ/  l{弋り    .   Y、,ハ           `、.,__ノ´ ̄ ̄
  '´7 人   、`     _  人イ
   {ヘ.  >,、,>、 _/レ'  ̄`ヽ、
  /  `ヽ r'ヘ、 \{「、ヽ、     ':,
  ;    /´-、 \_r ァ‐ヽrへ r‐r- 、 :
  {   .{    \  ゝ_ノ/)::'"´`ヽ} |
  、  :,      ヽ  __/ / )::::<()::ト i
   ヽ ヽ、    ∨ヽ-、/ }:::::::::_ノ} リ
     `'ーヘ   /\/ l/`il`て_,,.イ
        ;  ./   ゝ--イ{|    |
      / { ri'      /}{ 、   /
      ,:'  /ヽ、    , '__}{__」`T´
    .l rく   ヽ--'´ /ヽ ∨

Don't change these.
Name: Email:
Entire Thread Thread List