Donald Bruce Stewart wrote:
trebla:
I don't know. #math is larger than #accounting. Is it because math is
more mainstream than accounting? I bet it is because math is more
math is more *interesting* than accounting? :-)
With all due respect to accounting, which is a fine profession and a
Thomas Conway wrote:
[great comments on non-strict, static typing, purely functional]
Don't worry, I was just writing a sarcasm to an apparent attitude of X
is rare edge iff I can't figure out X. I have always been believing in
all the points you make.
Andrew Coppin wrote:
Personally, I just try to avoid *all* language extensions - mainly
because most of them are utterly incomprehensible. (But then, perhaps
that's just because they all cover extremely rare edge cases?)
Haskell is an extremely rare edge case to begin with.
Non-strict (most
Donald Bruce Stewart wrote:
Give #haskell is a far larger community than:
#lisp
#erlang
#scheme
#ocaml
As well as
#java
#javascript
#ruby
#lua
#d
#perl6
Maybe we need to reconsider where the (FP) mainstream is now? :-)
I don't know. #math is larger
Dougal Stanton wrote:
do
(hin, hout, herr, ph) - runInteractiveProcess cmd args Nothing Nothing
forkIO $ hPutStr hin content hClose hin
out - hGetContents hout
return (ph, out)
which seems to require threading. If I compile without, it will hang
indefinitely, I presume deadlocked. Is
Hugh Perkins wrote:
What makes a callback different from any other kind of function?
Well... what about inside monads? Does this break purity??? Does this
require adding IO to the monad if the callback function does IO?
As I'm writing this I kindof have this sense inside me that this is
Andrew Coppin wrote:
But what kind of thing would you use a general graph for?
(Rather than some more specific custom data type.)
Representing networks.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Take a look at
http://www.haskell.org/ghc/docs/latest/html/libraries/index.html
There are more elsewhere.
I am actually amazed that we have a comprehensive, widely-distributed
package for graphs and graph algorithms. I can't say the same about
other programming communities (they tend to
Andrew Coppin wrote:
...is everybody else looking at a different web page to me? *blinks*
Everybody is interpreting it differently. (As usual.)
I see an unsafePerformIO. :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Justin Bailey wrote:
On 6/7/07, Grzegorz [EMAIL PROTECTED] wrote:
All this hard work for something that in a lesser language would be the
unimpressive: universe[Milky Way][Sun] ;-P
Well, if you want to get picky there is the '!' operator defined in
Data.Map:
universe ! Milky Way ! Sun
I
Michael T. Richter wrote:
I'm tempted to quote
something about history, learning and repetition now, but won't bother
because I suspect most of the people in this mailing list know the quote
and have learned from history.
Those who have learned from history are bound to helplessly watch it
PR Stanley wrote:
What do the ≤ symbols represent?
I see you are still stuck in ISO-8859-1 and deprived of international
characters and symbols. (And this reply in ISO-8859-1 too accordingly;
normally I use UTF-8.) Unicode and UTF-8 FTW! :)
___
Dan Weston wrote:
Is this true? I thought do (like all sugar) was desugared before
semantic analysis. So long as you have the right =, return, and fail
in scope, I would have thought the desugaring is oblivious to their
definition (and particularly ignorant of instancing of the Monad
Scott Brickner wrote:
It's actually not arbitrary.
[...]
A ≤ B iff A ⊆ B
A ⊆ B iff (x ∊ A) ⇒ (x ∊ B)
Alternatively and dually but equally naturally,
A ≥ B iff A ⊆ B iff (x ∊ A) ⇒ (x ∊ B)
and then we would have False True.
Many of you are platonists rather than formalists; you have a
PR Stanley wrote:
The question, however, still remains: why False = 0 and True 1? I
appreciate that it's so in boolean algebra but why? Why not True = 0 and
False = 1?
A Boolean value denotees veracity whereas an ordered value concerns
magnitude (priority), indeed, order!!
Other members have
Roberto Zunino wrote:
I actually misread the first one as
Control.Monad.Fix.fix ((1:) . tail . scanl (+) 1)
which is quite nice too, although
map (2^) [0..]
would be much simpler! ;-)
We apply a lesson learned from my last derivation. The lesson was to
look at s!!(n+1).
s = 1 : tail
Vincent Kraeutler wrote:
Donald Bruce Stewart wrote:
P.S. Have some cute code:
Control.Monad.Fix.fix ((1:) . scanl (+) 1)
either way, if one of the Masters Of The Shadow Y Style on this list
feels like throwing in another koan or two, you'll have at least one
thankful audience member
Gracjan Polak wrote:
Hi,
I stumbled at some interaction of Control.Monad.State.Strict, mdo and let I do
not understand. The following program:
{-# OPTIONS_GHC -fglasgow-exts #-}
module Main where
import Control.Monad.State.Strict
thenumber :: Float
thenumber = flip execState 1.3 $ mdo
c
Donald Bruce Stewart wrote:
instance Num String anyone? Mwhaha
addString xs ys = add 0 xs ys
where
m = fromEnum (maxBound :: Char) + 1
alu c x y =
let s = c + fromEnum x + fromEnum y
in if s = m then (1, s-m) else (0, s)
add c (x:xs) (y:ys) = case alu c x
Grzegorz wrote:
hammingDistance [] _ = 0
hammingDistance _ [] = 0
hammingDistance (x:xs) (y:ys) | x==y = hammingDistance xs ys
| otherwise = 1 + hammingDistance xs ys
hammingDistance xs ys = h xs ys 0
where
h [] _ n = n
h _ [] n = n
h
PR Stanley wrote:
What is the rationale behind currying?
Given
map :: (a-b) - [a]-[b]
take :: Int - [a] - [a]
I can write map f . take 10 or take 10 map f.
Given
tmap :: (a-b, [a]) - [b]
ttake :: (Int, [a]) - [a]
I have to write \x - tmap(f, ttake(10, x)).
It is not just
This recent development of the thread leads me to these conclusions and
conjectures.
* If you want to demonstrate the mouse to be faster than the keyboard,
you can contrive an experiment to do so. Example: Randomize occurences
of X's in a text, ask to replace them by Y's, but make sure there
Michael T. Richter wrote:
1. A real GUI environment that takes into account some of the HID
advances made in the past 30 years. (Emacs and Vim don't count,
in other words.)
I for my life think HID refers to human input devices: keyboard, mouse,
joystick, gamepad, pedal,
Adrian Hey wrote:
Also, I don't know if the OP was a noob, but telling people (especially
noobs) that if they can't figure out how to solve a problem without
using a global variable then that must be down to inexperience and
general cluelessness on their part just seems wrong to me. It simply
Pixel wrote:
from http://pleac.sourceforge.net/pleac_haskell/numbers.html#AEN118 :
-- read handles both octal and hexadecimal when prefixed with 0x or 0o
-- here are versions adding the prefix and calling read
hex s = read (0x ++ s) :: Integer
oct s = read (0o ++ s) :: Integer
-- hex 45 == 69
A native G-machine --- physical, or chemical, or biological, but not a
repressed simulation over the imperative cpu-memory architecture --- is
the dream of every lazy-functional programmer of great devotion. If only
it became the dominant computing architecture! People would say, Haskell
is
Tony Morris wrote:
My opposition proposed (after some weeding out) that there is a
distinction between Excel, the application, the GUI and Excel, the
language (which we eventually agreed (I think) manifested itself as a
.xls file).
I say Excel is a functional language. If there needs to be the
Albert Y. C. Lai wrote:
I try using WordSet = [String] (plus corresponding change in code) and
get great speedup, actually way more than 3x. There was also a memory
growth phenomenon using Set String, and replacement by [String] stops
that too, now it's constant space (constant = 20M
Nikolay Metchev wrote:
data Face = Ace | Two | Three | Four | Five | Six | Seven | Eight | Nine
| Ten | Jack | Queen | King deriving (Enum, Show, Eq)
listComparator :: (Eq a) = [a] - a - a - Ordering
listComparator xs a b = compare x y
where
x =
I try using WordSet = [String] (plus corresponding change in code) and
get great speedup, actually way more than 3x. There was also a memory
growth phenomenon using Set String, and replacement by [String] stops
that too, now it's constant space (constant = 20M). It is possible to
attribute
Neil Mitchell wrote:
Things
like laziness are cool, but are harder to convince a strict programmer
that they are useful.
Strict programmers like the yield command too. The same behaviour can
be obtained by laziness, with easier reasoning.
That said, strict programmers may or may not like
Joel Reymont wrote:
I'm trying to parse NumExpr NumExpr (example) which should return a
logical expression while parsing numeric terms. I can't figure out how
to make buildExpressionParser do this for me since it takes the type of
the term parser given to it. If I supply a parser for numeric
Albert Y. C. Lai wrote:
However, you can make two uses of buildExpressionParser, one for numeric
expressions and the other for logical expressions. Mutual reference is
no problem since,
OK, I now see this is easier said than done in most common applications
Joel Reymont wrote:
My expression is x + 1 where x can be either Close, or Close[N] or
Close[N] of DataM where N and M are positive integers. What happens in
my case is that 1 + x parses fine but x + 1 doesn't. In fact, I would be
fine with parsing Close + such that it ignores the plus and
Joel Reymont wrote:
Meaning that if a keyword Output is followed by : and an identifier
and then (NumericSimple) then add identifier to the symbol table as a
Number and box it in a constructor.
Then in my lexer I do a lookup to check if I have seen this identifier
and if I have seen one of
Matthias Fischmann wrote:
here is the bug, narrowed to four lines. a function that only
sometimes terminates.
f = do
n - randomRIO (0,5)
let l = replicate n '*'
i = join $ repeat l -- infinite extension
print (take 12 i)
In this paragraph I speak about just this program,
P. R. Stanley wrote:
yes, this is good. So, let's start with A. How would you sope the
problem? What's your algorithm for identifying problems?
What is understanding? Discuss...
To relate a problem to known problems, I think I use a heuristic search
that may bite the bullet and do a
Nicolas Frisby wrote:
My question is: Given products and a fixed point combinator, can any
pure expression be transformed into a corresponding expression that
has just a single use of fix?
If yes, has there been any usage of such a transformation, or is it just
crazy?
Yes.
One use is
P. R. Stanley wrote:
When you write a general solution for a class of problems, as opposed
to a specific solution to a single problem, you have written an algorithm.
Discuss!
Follow this algorithm of three easy steps to solve any problem:
A. understand the problem
B. decompose or reduce it
Sebastian Sylvan wrote:
So here's the strategy:
1. Read tutorials
2. When you get stuck, ask on #haskell
3. Goto 1
(yes I deliberately wrote an imperative algorithm using gotos to
describe how to learn Haskell, and I found it amusing)
It is just a standard transformation away from a
Moreover:
from RealFrac to Int (or Integral): truncate, round, ceiling, or floor,
depending on how you want to lose information.
from Num to Int: there is none with such generality, since there are too
many conceivable variations.
___
Dave Hinton wrote:
Arithmetic operators in haskell appear to require their operands to
have the same type. How can I do arithmetic between operands of
different types?
Alternatively, how do I coerce a value from being an Int to being a Double?
fromIntegral can do this coercion. It is more
Hans van Thiel wrote:
sequence :: Monad m = [m a] - m [a]
You write:
The = used by sequence is the same = in the MyState monad,
since you instantiate m to MyState String. Therefore, sequence
performs all the state transformations correctly, since = is
correct.
So the m becomes MyState String,
Dougal Stanton wrote:
The Maybe construction is very useful for explicitly handling
circumstances where the function cannot produce a sensible answer.
But how far should this notion be taken? When you're writing a function
which you realise may not produce what you want, in what circumstances
Hans van Thiel wrote:
toMyState :: String - MyState String Int
toMyState x = MyStateC (repl1 x)
where the monad is defined as:
data MyState a b = MyStateC ([a] - ([a], b))
instance Monad (MyState a) where
return x = MyStateC (\tb - (tb, x))
(MyStateC st) = f =
MyStateC (\tb
Thomas Nelson wrote:
data ISine = Sine Integer Integer Integer String |
MetaSine Integer Integer Integer [ISine]
Having advised you to use different field names for different record
types last time, I now confuse you by saying you can share field names
in the different cases
All record fields are in the same namespace, and furthermore this is
also the same namespace of functions and class methods. In other words
you cannot have two record types containing the same field name, and you
cannot have a record field and a function using the same name, and you
cannot
h. wrote:
But it does not work as I expected. As long as there is no need to put some
input after having received some output it is no problem, but real interaction
seems not possible.
Right, this particular program works just for a particular interaction.
What real interaction do you have
Call me a technophile, but it saddens me that ASCII has already held us
back for too many decades, and looks like it will still hold us back for
another.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Henning Thielemann wrote:
At
http://www.haskell.org/hawiki/HaskellDbTutorial
it is described, how database queries can be modelled with a monad.
However, I wonder if this is also possible without monads. Say, writing
DB.map col1 $ DB.filter (\row - col2 row == 10+2) myTable
for
SELECT col1
[EMAIL PROTECTED] wrote:
Albert Y. C. Lai wrote:
If and only if the database is a purely functional immutable data
structure, this can be done. [...]
Many interesting databases are not purely functional immutable; most
reside in the external world and can spontaneously change behind your
Bjorn Bringert wrote:
pwrapper is not an HTTP server, though the Haddock comment can make you
think so. pwrapper allows you to talk *CGI* over a TCP port, but I have
no idea why anyone would like to do that.
Here is a scenerio. I want a basic web application: someone makes a
request, and my
301 - 352 of 352 matches
Mail list logo