Python from Wise Guy's Viewpoint

Tomasz Zielonka t.zielonka at students.mimuw.edu.pl
Mon Oct 27 03:53:58 EST 2003


Brian McNamara! napisał:
> prunesquallor at comcast.net once said:
>>Are they happy with something like this?
>>
>>(defun black-hole (x)
>>  #'black-hole)
>>
>>(for non lispers, the funny #' is a namespace operator.
>> The black-hole function gobbles an argument and returns
>> the black-hole function.)
> 
> Finally, an example that I don't think you can type in Haskell.  
> You score a point for that.  :)
> 
> If we have a static type system which admits infinite types, then we
> can assign black-hole a type.  So it's still typeable, just not in any
> common language I can name offhand.  :)

You are making things a bit too complicated. I think you can write
blackHole in Haskell:

blackHole :: a
blackHole = error "black-hole"

*BH> :t blackHole 1 2 3 'a' "ho" (blackHole, 1.2)
blackHole 1 2 3 'a' "ho" (blackHole, 1.2) :: forall t. t

*BH> blackHole 1 2 3 'a' "ho" (blackHole, 1.2)
*** Exception: black-hole

*BH> let _ = blackHole 1 2 3 'a' "ho" (blackHole, 1.2) in "abcdef"
"abcdef"

Best regards,
Tom

-- 
.signature: Too many levels of symbolic links




More information about the Python-list mailing list