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

Pages: 1-

Scheme help

Name: Anonymous 2007-12-23 19:37

(define (penis)
    (define variable (read))
    (cond
      (= (string-compare variable "penis") 0) (display "son, that's a penis"))
      (= (string-compare variable "cock") 0) (display "son, that's a cock")
      (else (display "niggerpenis"))))
(penis)


Why does this code not work, /prog/?

Name: Anonymous 2007-12-23 19:39

Oh shit, now I see.

Name: Anonymous 2007-12-23 19:39

Your code sample is degrading.

Name: Anonymous 2007-12-23 19:52

>>1
Idiot! If you (read), unless the user writes "cock" (WITH the quotes), you won't get what you want. You should compare symbols!

Name: Anonymous 2007-12-23 20:41

>>4
Symbol halp, sir?

Name: Anonymous 2007-12-23 21:27

Why does this code not work
Because you are not using Haskell.

Name: Anonymous 2007-12-24 4:01

>>6
Fun fact: About 20 Haskell users post on /prog/ regularly. This makes about 70% of Haskell users.

/prog/ - the Haskell haven.

Name: Anonymous 2007-12-24 4:05

>>7
You'd think that if Haskell was any good, writing code would be Haskell heaven. It's more like Typeskell hell though.

Name: Anonymous 2007-12-24 4:05

module Main
    where

import IO

penis = do
    var <- GetLine
    if "penis" == var
    then putStrLn "son, that's a penis"
    else if "cock" == var
         then putStrLn "son, that's a cock"
         else PutStrLn "niggerpenis"


Is this Haskell?

Name: Anonymous 2007-12-24 4:06

fuck I think I fucked up the FORCED INDENTATION OF THE CODE

Name: Anonymous 2007-12-24 4:35

>>8
I don't think you have achieved Satori yet, son.

Name: Anonymous 2007-12-24 4:39

>>11
This might surprise you, but you have neither.

A man who has achieved Satori would never waste his precious time by dealing with the likes of >>8

Too bad >>14 is wring.

Name: DICK DICKSTON 2007-12-24 4:40

s/wring/wrong

Name: Anonymous 2007-12-24 4:50

>>5

(define (penis)
   (define variable (read))
   (cond ((eq? variable 'penis) (display ...))
...
)

Unlike faggot Python, you can indent however you want, too

Name: Anonymous 2007-12-24 5:49

why the FUCK did you start a thread called "scheme help" on /prog/, You total idiot.

Name: Anonymous 2007-12-24 5:50

WTF is with you and your /prog/snake

http://zip.4chan.org/c/res/492916.html

Name: Anonymous 2007-12-24 6:35

>>14
wow, you sound like a real expert. wahhh i'm too stupid to understand whitespace

Name: Anonymous 2007-12-24 8:06

>>14 is an idiot.

You can use the case construct. Something like:
(define (penis)
   (define variable (read))
   (case variable
      ((penis) (display ...))
      ...)))))))))))))

Name: Anonymous 2007-12-24 17:33

>>18
The solution suggested by >>14 worked for me, but I'll probably implement yours, as it seems more logical.

Name: Anonymous 2007-12-24 17:36

>>18
Reading yours, it looks confusing.

If I entered niggercock, would the code look like this?

(define (penis)
   (define variable (read))
   (case variable
      ((niggercock) (display ...))
      ...)))))))))))))


Or like this?

(define (penis)
   (define variable (read))
   (case niggercock
      ((penis) (display ...))
      ...)))))))))))))

Name: Anonymous 2007-12-25 9:22

>>20
no just use this solution.
>>14

Name: Anonymous 2007-12-25 12:08

I WRITE SOLUTIONS IN SCHEME AND APPLICATIONS IN APL.

Name: Anonymous 2007-12-26 5:28

>>20 The first one
>>22 I WRITE SOLUTIONS IN APL AND APPLICATIONS IN SCHEME

Name: Anonymous 2007-12-26 7:43

DON'T HELP HIM!

Name: Anonymous 2009-03-18 3:00

The word pirahna, is all I can think of that rhymes with marijuana

Marijuana MUST be legalized.

Name: Anonymous 2011-02-03 8:42


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