-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Trying to learn Haskell. I am trying to write a simple function to remove a number from a list without using built-in function (delete...I think). For the sake of simplicity, let's assume that the input parameter is an Integer and the list is an Integer list. Here is the code I have, Please tell me…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm trying to use Haskells Data.Heap module, but I'm incapable of even using it with integers. The only heap I've been capable of using is "empty", which does not take any arguments.
Later on I'll figure out how to instance for my needs, but for now I'd be glad if I was even able to test it with…
>>> More
-
as seen on Programmers
- Search for 'Programmers'
There has been some intermingling of Scala and Haskell communities, and I have noticed now and then people commenting on stuff that's supposed to be easy in Haskell and hard and Scala. Less often (maybe because I read Scala questions, not Haskell ones), I see someone mentioning that something in Scala…
>>> More
-
as seen on Programmers
- Search for 'Programmers'
I have problems installing ghc-mod on my linux machine. cabal worries about "happy" not being available in versione = 1.17:
$ cabal install ghc-mod
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/haskell-src-exts-1.14.0-1357/haskell-src-exts-1.14.0/Setup.hs, /tmp/haskell-src-exts-1…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
fibs :: [Int]
fibs = 0 : 1 : [ a + b | (a, b) <- zip fibs (tail fibs)]
This generates the Fibonacci sequence.
I understand the behaviour of the guards, of :, zip and tail, but I don't understand <-. What is it doing here?
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I had a pretty simple requirement in my Scheme program to execute more
than one statement, in the true condition of a 'if'. . So I write my
code, something like this:
(if (= 1 1)
((expression1) (expression2)) ; these 2 expressions are to be
executed when the condition is true
(expression3)…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
(define (read-all-input)
(local ((define line (bytes->list (read-bytes 4))))
(if (eof-object? line)
empty
(cons line (read-all-input)))))
(void (read-all-input))
The above code fails because bytes-list expects an argument of type byte string, but is given #
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Does R6RS or Chez Scheme v7.9.4 have a library function to check if a list contains duplicate elements?
Alternatively, do either have any built in functionality for sets (which dis-allow duplicate elements)? So far, I've only been able to find an example here.
The problem with that is that it doesn't…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi,
I'm a beginning student in CS, and my classes are mostly in Java. I'm currently going through "Little Schemer" as a self study, and in the process of finding out how to do that I have found numerous references to "implementations" of Scheme. My question is, what are implementations?
Are they…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Isn't it possible to treat functions in Scheme as any other list?
Basically, what I want do to is something like this:
(define (foo) "hello")
(cdr foo) ; or similar, should return the list ((foo) "hello")
I've found a similar discussion about this, and I feel a bit disappointed if this is not…
>>> More