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

Pages: 1-

javascript = most powerful language

Name: Anonymous 2012-09-07 18:25

if you don't like it, you don't know shit about functional programming

Name: Anonymous 2012-09-07 18:29

2 true, people need to learn function based programing

Name: Anonymous 2012-09-07 18:33

javascript
functional


Please turn in your Knights of the Lambda Calculus (http://en.wikipedia.org/wiki/Knights_of_the_Lambda_Calculus) badge, ``faggot''.

% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded


% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded


% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded


% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded


% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded


% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded


% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded


% node -e '(function (x) { x(x); })(function (x) { x(x); })'

[eval]:1
(function (x) { x(x); })(function (x) { x(x); })
                                  ^
RangeError: Maximum call stack size exceeded

Name: Anonymous 2012-09-07 18:39

i can't believe it went and introduced the concept of closures and all these other languages go and steal them without any sort of attribution

pretty low if you ask me

Name: Anonymous 2012-09-07 18:43

>>3
How do I do this on Scheme?

Name: Anonymous 2012-09-07 18:54

>>5
Answer 1: beautifully !
Answer 2: ((λ (Y) (Y Y)) (λ (Y) (Y Y))

Name: Anonymous 2012-09-07 18:56

>>6
Thanks.

Name: Anonymous 2012-09-07 19:02

>>3
Here, I optimized your code for you:
(function(){arguments.callee()})()

Name: Anonymous 2012-09-07 19:15

>>3,6
Does this have a name?

Name: Anonymous 2012-09-07 19:32

>>9
Yes, it does.

Name: Anonymous 2012-09-07 19:40

>>3
What's your point? It's still functional.

Name: Anonymous 2012-09-07 19:43

>>10
Well, what's the name?

Name: Anonymous 2012-09-07 19:54

>>12
Read SICP.

Name: Anonymous 2012-09-07 20:47

>>13
SICP is a shit

Name: Anonymous 2012-09-07 20:51

>>13
I guess I should. Fuck, I blame Touhou for this procrastination.

Name: Anonymous 2012-09-07 21:14

>>15
Touhou is a shit.

Name: Anonymous 2012-09-07 21:57

>>16
Not really.

Name: Anonymous 2012-09-08 20:21

>>3
haskell, ocaml, clojure, and common lisp don't have TCO.

with es6 decorators, javascript can do tco the same way that python and clojure do.

i have yet to see a recursive function that could not be written just as simply memoized, as a loop, or a series of maps and folds.

Name: Anonymous 2012-09-08 20:26

python
TCO

functions as Third Class Objects

Name: Anonymous 2012-09-09 2:22

>>18

do this one:


(define (a x)
  (display (list 'a x)) (newline)
  (if (= (mod x 2) 0)
    (b (- x 4))
    (c (- x 2) (- x 1) (+ x 3))))

(define (b x)
  (display (list 'b x)) (newline)
  (if (= (mod x 3) 0)
    (a (- x 1))
    (a (- x 3))))

(define (c x y z)
  (display (list 'c x y z)) (newline)
  (cond ((= z 0) (+ x y))
        ((= (mod x z) (mod y z)) (b (abs (- x z))))
        (else (c z x (abs (- y z))))))


(a i) seems to be returning 30 for every i I've tried. You can implement it as


function a(i) { return 30; }


but first you would have to prove that this is correct of course.

Name: Anonymous 2012-09-09 11:18

>>12

the U combinator


(define (U f)
  (f f))


Takes a function as an argument and applies the function to itself.

Then you get an infinite loop when you evaluate


(U U)


unless there is no tail call elimination, in which case the stack overflows.

Name: Anonymous 2012-09-09 13:04

- fun U f = f f;
stdIn:1.12-1.15 Error: operator is not a function [circularity]
  operator: 'Z
  in expression:
    f f

Name: Anonymous 2012-09-09 13:15

You're now watching two strangers discuss your question!
Question to discuss
:
How come so many programming language don't have Lisp's progn? That's a serious deficiency.

Stranger 1: i don't understand, and i'm a hacker...
Stranger 2: (((((I hate lisp)))))
Stranger 1: of course, i'm a physical hacker, and don't often work with code. stranger, what's lisp?
Stranger 2: A frustrating programming language.
Stranger 1: oh. TIL...
Stranger 1: i do work with a little javascript, though.

javascript:document.body.contentEditable='true';%20document.designMode='on';%20void%200

Stranger 1 has disconnected

Name: Anonymous 2013-08-31 23:37



          ,.へ. ,.--、ノL
         Σ____,.>'-‐'ー-'─- 、.,_
        ,..::''"´:::::::::::::::::::::::::::::::::::::::::`':,
       ,:'´::::::::::::::::::__,.:::::-r::::ー-::::、__:::::::〉
       ';:::::_,.::-:_,ゝ -‐''"´ ̄ ̄`"'' <イ┐
      r>,ゝ'"   ,    ;  !   ヾ7
      Y´ /  ,'  /-‐i‐ /| ,イ__ハ  ! ',
       |. ,' ,.ィ|  ,'-;=!、/ レ' 'ァ'ハ`Y ハ|
      _!_レi.-‐!'7 .i  ri     i リ !/',フ
      `iヽ、__ハ.ヽ_`'ー'    __`´ ⊂i ヽ.   ト,       
       ! ! `⊂⊃   i'´ ̄ ァ'-:、 ,.イハ. i  ノ i
 ト.、     ', ',  i  !>.、.,_'、_ 〈::::::::;:〉ァ-、!/_,.イ ,'
 iヘ'ヽ.   ヽハ ハァ'´ ̄`ヽT7´ヾ:-r7   ヽ  ,V
∠_ ゝ_`"''┐  レ' ,'     Y:.}>く{,.r'- 、___r、ソ,.イ
 `ゝ、  ̄ヽヽ、_,イ〈  、  ! ヽ、_:/ ´ ̄ヽ」-'ヽ'、.,__., -、
  !へ/ `/  ハ `ヽ,'_     `i    /:、へ!     )
    へr、/  ,' ', `ヘ>、.,_   _,,..イ   `''ー-、__
      レへ!^ヽ!'⌒´:〉:::::::::7 ̄::::i:::::'、     _i {`ヽ.
             ,:'::::/::}_>く{::::::';::::::',ヽ、.,___,ノ/_つ'
            /::::::_∠::::::::i::::::::':,:::::ヽ.    ̄´
          r,':::::::::[ンヽ」:::::::ハ::::::::::::::::::::ヽ.
          r'>、:;´:::::::::::::::/::::';:::::::::::::::::::::::ト、
          `'-7!>、:;_:::::::;'::::::::i:::::::::::';::::ン_ノ
           /:::::ヽ∠コ>くコニ>ヘ'ニン-「
        Σ7:::::::/         rヽ:::::::';7  
         7`ー/┘          └へ>'i'
         !___/               `ー'

Name: Anonymous 2013-08-31 23:48

>>21
wow, a infinite loop, that sure is useful

Name: Anonymous 2013-09-01 1:09



:::::::::┌──────────────┐:::::::::::::::::::::::
:::::::::::|      __               .| ::::::::::::::::::::::::
:::::::::::|    /´|´\ro、`ヽ‐ 、.          | ::::::::::::::::::::::::
:::::::::::|   ./  |   ハヽo)  |. ヽ        | ::::::::::::::::::::::::
:::::::::::|  |、  ! /-|八.  !   ',.       | ::::::::::::::::::::::::
:::::::::::|  レ\レ'ァrk\/).ノ   |.        | ::::::::::::::::::::::::
:::::::::::|     _ノ jソ' r)/)   ハ、_     .| ::::::::::::::::::::::::
:::::::::::|    l   "  ,ハリ\   '、_`ヽ、 | ::::::::::::::::::::::::
:::::::::::|.    \´  _,. イ、/|./\.  \>、) ! ::::::::::::::::::::::::
:::::::::::|     ` ̄ /`ヽ/||\    `ヽ. \ :::::::::::::::::::::::
:::::::::::|       /\  /`!!  `''ー-- 、 |  ヽ、::::::::::::::::
:::::::::::|      /    Y、_ノノ   \∨レ'   / 〉 ::::::::::::::
:::::::::::|rr‐─ ''´ヽ    /、_     /、}、 Y´_/} ::::::::::::::::
:::::::::::|||        /  |   / ./::::ヽ. >ー ' :::::::::::::   _l  l_   ヽ l /  __l__ __l__l
:::::::::::|||       ./   く|_//:::::::::::::;ハ |:::::::::::::::::::::  _|  !_ | ̄l二l ̄|  ニ _|_|_|_ヽ
:::::::::::|`ヽ.,___,,.. '    /`´::::::::::::::::::::::::::|、:::::::::::::::::::  _|  |_  ┌┼┐ ┌┐r┐! ./
:::::::::::|            /::::::::::::、::::::::::::::::::::::ヽ、:::::::::::::   ノ   |      |    l_! !ニ! Xノ
:::::::::::|            /:::::::::::::::::\:::::::::::::::::::/}r、- 、 ::::     E C C E N T R I C
:::::::::::|          .,'::::::::::::::::::::::::::::::::::::_r'∠_」_」  \
:::::::::::|          l:::::::::::::::::::::::::::::::::// ! :::::: \  |
:::::::::::|         r'、____;;;:: -‐'"/  | :::::::::::: `´
:::::::::::|         ヽr‐‐-ァー--‐''"´    | ::::::::::::::::::::::
:::::::::::|        _,r'-‐‐/            .| ::::::::::::::::::::::
:::::::::::|       (´_二ノ              | ::::::::::::::::::::::
::::::::::::\       \::::::::\           \::::::::::::::::::
   

Name: Anonymous 2013-09-01 2:40



         ト、.,__        /7'iヽ.   八雲 紫  十七歳(自称)
        |:::::! `ヽ、__,,....,,___!::::! l:::|
        ';::::l‐ ''´|::|     /:::/-、|/     ┬ l二l ノ ノ ̄i_,
      / \'、   V   // / `ヽ.   土 l二l イ -‐ァ
     /  、__r-ヽ>' ̄`r‐'"ヽ!-'、、,__   ':,    ノ !_, | _メ、__
     ! r''「>'-‐'"´ ̄ ̄ `ヽ、7_ゝ-、ノ , .i
    r'Y´ / _/l_ ;    ; __!_ `ヽ、/ー、k_    __l_____,!__ -‐ァ  --'--  ノ-┼‐
   rく/  ,' ´/ _」_,ハ   ,ハ_」__` ',  ヽ/ _」_    !  /  --┼‐‐ __'三'__   -┼‐
   「´7   i  ァ'i´ '`!` ',  /' i´ 'ハ`i !  Y、___〉  _,>く..__  、ノ  | 口 」 ____|____
   `イ   ノレ,ハ. '、_,r!  レ'  !,__り.ノ`ハ ハ,.イ                       (自称)
    ノ  )へ/ !"´     .    `"7ノレ' i  `ヽ.
   ´⌒レ〉 ! ヘ.     ._ _,.    ,イ  ',.  '、   `':,
     ,./ ノ   ,!` :.、,       ,.イ /i,. -'‐'"`i `ヽ、  ':,
    ノ,' 〈  r'__,,.イ i`''= '"i. ト、/     i〉ヽ, !く{  i
  ,:'  !   !ヽ(ヘ!:::::'、`ヽ.__,. イ ./:::i    / く」ヽ  i
 /  ノ Y´:::::くンゝ:::::':、/ムヽ/:::;「ト、,____,ハト, レ'  i ハ
 !  〈  i、:;_::::/V':;::::::::Yl+lY::::::/:::!:ヽ、___i_ン7    ノ!〈 i
 ',  .) ハ:::::'':i:::::::::>'::ヽ+l+ン'::/!:::::::::::::!。i   ,:'´ !/_/
  )' (   ';:::::::ヽ;:::::\::::::Y/:/:::::!::::::::::::::::::! / }>!ヘ_」
 くンく{ ヽ. .';::::::::::i`::::::::ヽ:::!':::::::::::::!::::::::::::::::,' .,'  ノ i
    〉 !/i:::::::/::::::::::::::::Yo::::::::::::';:::::::::::::::i iヽ. 〈/
     (l |::::;:'`'':::::::::::::::l;o:::::::::::::ゝ、:;___ノ ,'  '(
       ,ァ'::::::::::::::::::::::;':::::::::::::::::::::::::!/`'(
    _,,..;:'く::::::::::::::::::::::/i::::::::::::::::::::::::::;ゝ,
 r‐''"/ /ヽ、:;______/TL__________;;::イ .ハ
 |::::,:'  ,'    i   !    i   ',   ':,
 |:,'   /     |    ',    :    ':,  ヽ.

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