« first day (1897 days earlier)      last day (2945 days later) » 

4:00 PM
@Downgoat How on earth could you do that? It's a keyword.
 
@quartata :P You should've seen what happened when I tried to refactor it out.
 
(let-values ([(a b) (partition (lambda (x) (zero? (bitwise-and x 2)))
                               (shuffle (range 16)))])
  (take (append-map list a b) (random 6 11)))
 
c-c-c-c-combobreaker
 
@quartata ^
 
> undefined = 3
< 3 = $1
 
4:00 PM
@ChrisJester-Young Oh, hahaha
 
@ChrisJester-Young You pointed to the combobreaker message.
 
@Downgoat But.. it's a keyword...
 
Another proof that Javascript is great, if we ever needed one
 
@Fatalize ha
 
@zyabin101 I know, it's full of win.
 
4:01 PM
@quartata why are you so surprised, it's JavaScript
 
The next item in the sequence is HEI
 
@quartata undefined is not a keyword.
It's a predefined property of the global object.
 
@Downgoat But it's A KEYWORD
I don't even see how it was possible for them to do that
 
> undefined = 3
< 3
> undefined
< undefined
 
undefined is a valid name. null is not
@CᴏɴᴏʀO'Bʀɪᴇɴ what browser are you using?
 
4:01 PM
@ChrisJester-Young oh dear
That's horrible
 
@Downgoat Firefox, version the latest.
Which are you using?
 
Safari
SpiderMonkey shell also seems to work
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Firefox, version the latest.
 
@Dennis That means that you must have looked at the same link from the same comment from the same question and be curious about the same thing... Dang.
 
Mock xkcd?
 
4:03 PM
Browser bros?
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Firefox, version latest
 
@Downgoat On loops, you shouldn't have any in Cheddar :P
@muddyfish hi five
 
high five
 
4:04 PM
@ChrisJester-Young Is let*-values a thing?
 
@muddyfish Dilemma. We need to do three high fives.
@muddyfish high five
 
Ah, right, the how do I delete... Ubuntu question from HNQ.
 
@CᴏɴᴏʀO'Bʀɪᴇɴ what.
 
@zyabin101 high five
 
why? loops are so useful.
 
4:05 PM
jk :P
 
oh :|
 
loops are for the weak
 
@Downgoat Well really you can use recursion instead
 
loops are forever
 
But you're probably too lazy to implement tail call optimization
 
4:05 PM
anyone know if you can extend map in JS or if that will cause everything to explode?
 
^
 
@quartata what?
 
@Downgoat when in doubt assume everything will explode
@Downgoat Tail call optimization
323
Q: What Is Tail Call Optimization?

majelbstoatVery simply, what is tail-call optimization? More specifically, Can anyone show some small code snippets where it could be applied, and where not, with an explanation of why?

 
TCO is really great and does all things.
 
@quartata I understand what half of those words mean
 
4:06 PM
@Downgoat read the accepted answer
 
@CᴏɴᴏʀO'Bʀɪᴇɴ HAI
 
@quartata JavaScript didn't do it until ES6 and it's not a bad language
 
@EᴀsᴛᴇʀʟʏIʀᴋ HALLO
 
the simple explanation is: recursion at the end doesn't stack overflow
 
@CᴏɴᴏʀO'Bʀɪᴇɴ HILOO
 
4:07 PM
@zyabin101 If this continues a bit further, we'll have to fill the chat with six high fives!
 
@EᴀsᴛᴇʀʟʏIʀᴋ HOLOOO
 
@Downgoat Uh.. did I ever say that a language is bad because it doesn't have TCO?
 
@EᴀsᴛᴇʀʟʏIʀᴋ o/
 
@CᴏɴᴏʀO'Bʀɪᴇɴ AARDVARK
 
I'm saying you can't reliably use recursion in place of looping without it.
 
4:08 PM
c-c-c-c-combobreaker
 
@EᴀsᴛᴇʀʟʏIʀᴋ HAVARSDF
 
The next item in the sequence is HELOOOO.
 
@quartata ok, I guess I get the basic idea of it. But I have no idea how to implement it
 
nope
AARDVARK FTW!
 
@Downgoat Well, how do you handle function calls currently?
 
@quartata it gets called as a Cheddar program, and has preset variables to what it should inherit.
 
@EᴀsᴛᴇʀʟʏIʀᴋ o/
 
@EᴀsᴛᴇʀʟʏIʀᴋ bai
 
@Downgoat OK, so that means that your cheddar_eval call or whatever goes on JS's internal stack.
 
yeah
 
4:11 PM
Basically TCO is being smart enough to know when a function is just going to return the value of another call, and just replace the first call with the second one
That way only the second one is on the stack instead of both.
 
@quartata where would I store the return value?
 
@Downgoat I don't know how Cheddar works so I can't really answer that
 
Is block-scoping really that important? Cheddar could be a lot faster without it..
 
@Downgoat oh my god yes
Don't even
 
JavaScript doesn't have it and it seems to be fine
 
4:14 PM
Anyways, you can think of TCO as being like this:
 
Chat challenge: Write a Python snippet in 140 bytes or less that will make the Prospector issue the most warnings.
 
@zyabin101 140 bytes of unicode
 
function f() { do shit.... return g(); }
function g() { do some other stuff idk }
var x = f()
into
 
@CᴏɴᴏʀO'Bʀɪᴇɴ You were supposed to say BAI not bai. :P
 
@EᴀsᴛᴇʀʟʏIʀᴋ BaI
 
4:15 PM
function f() { do shit.... }
function g() { do some other stuff idk }
f()
var x = g()
That way f and g are never both on the stack.
 
@Downgoat Uhh... Unsupported characters in input
 
@quartata where is g defined?
 
@Downgoat Just suppose it's some other function
 
ok
 
@Downgoat The biggest problem with JS is its lack of block-scoping.
That's why you see people doing ugly things like this: (function () { stuff })()
 
4:17 PM
@quartata ahem let
 
do you really use block-scoping in your everyday code?
 
@Downgoat Every single day
 
because now I have to create a brand new scope for every {}
 
@CᴏɴᴏʀO'Bʀɪᴇɴ wat.
 
4:17 PM
IDK ¯\_(ツ)_/¯
 
@Downgoat If your interpreter is slow because of block-scoping then you're doing something wrong
You should have a brand new scope for every {}
 
I guess I could try to optimize it
but I'm writing it in JS so it's going to be slow no matter what I do
 
Do you have a GitHub?
 
yes
 
no he doesn't
:P
 
4:19 PM
Lemme see this code
 
Uh, I see the parser but I don't see the other codez
 
oh, I haven't pushed to GH
 
Oh, OK
 
hey, does anybody know, is it possible to modify my code on ideone and re-run it without forking it every time?
 
4:21 PM
> Cheddar REPL worksgit add -A!
 
it lets me edit but then still seems to run the old code
 
ok, I pushed
@zyabin101 :|
wtf git
 
@aditsu Yes - editing it works
Dunno if an account is necessary for that or not though, can't remember
 
@Sp3000 well, it's not working for me, it still runs the old code; I don't have an account
 
@quartata Yes.
@quartata Scheme is required to implement proper tail calls, so in fact using tail-recursion for looping in Scheme is idiomatic.
 
4:24 PM
@Downgoat What's a list like in JS? Singly or doubly linked?
 
@Downgoat Oh, look also:
 
@aditsu What the edit window looks like to me
 
what?
 
> Cheddar REPLcd src!
 
4:25 PM
@Downgoat Is a [] a singly or doubly linked list
 
the worse thing is that if I compile and run it on my machine (I've just installed that language), it just totally blows up
 
@quartata In JS? [] is an array.
which is neither singly or doubly linked.
It's not a linked structure at all.
 
@ChrisJester-Young Oh, not quite as glamorous as I thought
 
@Sp3000 so, can you make a change and run it again?
and check the output
 
4:26 PM
OK, so does JS have any better collections? :P
 
@quartata yes
Map and Set
 
Uh...
Anything else? :P
 
@aditsu Yep - as you can see in the screenshot the stdout's not for the code I have there - I can click "submit" and stdout updates
 
@quartata yes
{} (ObjectSS)
@zyabin101 git is weird.
 
Well, not a lot you can do there then.
 
4:27 PM
(actually, more correctly - the input/output window is the part that updates)
 
@quartata Immutable.js is a JS library that provides persistent data structures.
 
@Sp3000 oh, I don't have a submit button, I have a green button that says "ideone it"
 
@ChrisJester-Young so does jQuery
 
Ah... try an account? :/
 
4:28 PM
Gee, I don't know what to say.
Do you want to use another library? :P
 
ಠ_ಠ
I'd rather try to get it to work on my computer
 
@aditsu Oh, I wasn't talking to you.
 
Libraries are for the weak, unless if its your own
 
@quartata brb adding jquer to cheddar
 
Sorry.
@Downgoat oh god please no
 
4:29 PM
^^^
 
@quartata I wasn't talking to you either
 
@aditsu Oh
 
@Downgoat NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
 
19 hours ago, by Downgoat
@QPaysTaxes don't worry, it's a joke; I would never do such a horrible thing
 
Don't joke about such terrible things
 
4:31 PM
I also said the quoted message in a response to a NOOOOOO when I said if I should make a jquery interface for Cheddar
@CᴏɴᴏʀO'Bʀɪᴇɴ like Python?
 
@Downgoat python isn't as bad as jQuery. proceed.
 
ಠ_ಠ
 
@CᴏɴᴏʀO'Bʀɪᴇɴ ಠ_ಠ
 
@EᴀsᴛᴇʀʟʏIʀᴋ bAi
 
4:33 PM
should I completely disallow using reserved keywords as property/method names?
 
@Downgoat example?
 
@Downgoat yes, why would you even consider otherwise
 
When you are waiting 1 hour to friggin leave.........
@Downgoat yes.
 
@quartata e.g. should any of the following be allowed: foo.for.bar foo['for'].bar foo.for()
 
As properties, maybe
 
4:34 PM
No.
 
okay
 
@CᴏɴᴏʀO'Bʀɪᴇɴ ...
I mean, how could you even define it in a class
 
if(if.if.if()) {}
 
a = {}; a.for = 3;
 
But this isn't JS
This is an actual OO language
 
4:35 PM
class foo {
    for := "sfdkjasdkfhiwensdfhas"
}
 
class class {
class := "class"
}
not confusing enough
 
@quartata JS is OO
 
also should word operators be allowed as property names?
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Right, but JS is prototype-inheritance. This is class-based and it wouldn't work here
@Downgoat no
 
@quartata JS has classes
 
4:37 PM
e.g. you can do 2 + (sqrt 4). Does this mean sqrt should be a reserved keyword?
@CᴏɴᴏʀO'Bʀɪᴇɴ but not real classes
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Does it allow you to define instance variables that are reserved keywords?
 
If so I don't even know how that works
 
(sqrt 4) are you seriously gonna use lisp syntax in this
 
4:37 PM
It doesn't.
 
I'm not a JS class expert because its not on firefox
 
My mind is boggled at all this ridiculous stuff
 
@Fatalize no
 
@Fatalize It's parens >_>
 
@EᴀsᴛᴇʀʟʏIʀᴋ phew
 
4:38 PM
@Fatalize Actually cheddar syntax.....
 
2 + sqrt 4 will also work
you can even do 2 root 4
 
@quartata I mean, JS already is stupid enough, it has at least enough sense not to do that. :P
\o/ 21 minutes till Isleward!
 
@CᴏɴᴏʀO'Bʀɪᴇɴ JS classes are just syntax sugar for .prototypeing
 
@Downgoat Oh well.
 
#lang racket
(let*-values (
  [(side1 side2) (partition (lambda (x) (zero? (bitwise-and x 2))) (shuffle (range 16)))]
  [(chunks) (append-map list side1 side2)]
  [(rooms) (random 6 11)])
  (for ([chunk chunks] [room rooms])
    (displayln chunk)
  )
)
@ChrisJester-Young Soo much better
 
4:41 PM
@Downgoat its not just that.
 
yes it is
that is all it is
 
@quartata Good. Now you just need to fix your dangling parens and you're sorted. :-)
 
@ChrisJester-Young Uh do I have extra parens somewhere
 
@quartata No, you need to move all the closing parens you have up to the previous lines.
 
@Downgoat things like super, private etc are new features
 
4:45 PM
there is no private
super is syntax sugar for a.prototype = Object.create(b.prototype)
 
i meant calling super methods
 
> (println (string-append "Hello, " (read) "!"))
"Andrew"
"Hello, Andrew!"
> (println (string-append "Hello, " (read) "!"))
123
|string-append: contract violation
|  expected: string?
|  given: 123
|  argument position: 2nd
|  other arguments...:
|   "Hello, "
|   "!"
|  context...:
|   P:\ath\to\Racket\collects\racket\private\misc.rkt:87:7
 
private is in works
 
In my code, how should I refer to the world of variables? i.e. what should I name the object that contains variables?
 
you have to understand that while prototype will not get any new features, class is just starting up.
 
4:47 PM
Okay, the greeting works, but requires to surround the name in quotes. Now this is awkward. >:|
 
@Optimizer no?
 
@MarsUltor I'm not sure what you have in mind.
 
And I can't greet an integer, which is okay, because a name can't be an integer.
Think about how awkward discussions can be if we call PPCG users by their User No.'s.
 
Hello 183551!
 
@Downgoat Not chat User No.'s, PPCG User No.'s.
 
4:51 PM
oh, sorry, 48538
 
"12012, pull Vitsy?"
 
- What's your name?
- FN2187
 
> Absolutely do not place closing brackets on their own lines.
Well oops
 
@Fatalize is FN21817 your full name or just your first?
 
Not excluding that the clone is being requested by 44713!
Now that is awkward. >:|
 
4:53 PM
@CᴏɴᴏʀO'Bʀɪᴇɴ Same. (i hope quartata never sees this)
 
@EᴀsᴛᴇʀʟʏIʀᴋ why? :P
 
Because I have told him in no uncertain terms how much perl sucks.
but hey, i started learning it! :P
 
I haven't ;P
 
Racket geeks: is there a command that takes standard input as a string?
 
(read-string
 
4:55 PM
@zyabin101 (read-line (current-input-port) 'any)
 
@ChrisJester-Young Is this better?
#lang racket
(let*-values (
  [(side1 side2) (partition (lambda (x) (zero? (bitwise-and x 2))) (shuffle (range 16)))]
  [(chunks) (append-map list side1 side2)]
  [(rooms) (random 6 11)])
  (for ([chunk chunks] [room rooms])
    (displayln chunk)))
 
@Downgoat vv
 
Or does the opening paren need to be one line 2
 
> (println (string-append "Hello, " (read-line (current-input-port) 'any) "!"))
"Hello, !"
I'm using a REPL.
 
@zyabin101 It won't work in the REPL
 
4:56 PM
^
 

« first day (1897 days earlier)      last day (2945 days later) »