« first day (474 days earlier)      last day (4691 days later) » 

Xeo
Xeo
03:00
Ouch. My tongue really hurts now. Fuck.
Why did you bite it?
@renatofernandes What is the value of x when the loop ends?
Xeo
Xeo
@RMartinhoFernandes I didn't.
Xeo
Xeo
I just ate a lot of sour stuff, and a lot of crunchy stuff afterwards...
@renatofernandes Right. What do you think will happen if you idelete it?
It won't delete anything.
Xeo
Xeo
03:02
Tche, you got your next +100 badge. :<
I GOT IT THANKSS FELLOW FERNANDES ! :D
i just made another while loop and when x was empty ideleted(x) :D
Xeo
Xeo
I'm thinking of writing a program that outputs nice ascii text for memory analogies in C++ ôo
robot, 13, not 0
Xeo
Xeo
The pointer question. It sets the speed to 13, not 0
@renatofernandes , could you please tell me what we have there?
education? :D
Xeo
Xeo
now everything's fine.
03:06
Ah, look again.
I gotta learn how to use vim's table mode.
Xeo
Xeo
I gotta learn how to use vim.
OK
As I can see you have no clue, right? :)
martinho said when the list is empty i should free memory
Make two separate c files
so thts what i did?
amm i rite?
03:09
:D
@renatofernandes No, that's not what I meant.
when im dont with the list i mean
Yes, but the initialization of your problem is fucked up very well, so his saying is not very contributale to you.
I meant that you can't do it when it's empty. Because idelete can't release an empty list.
done*
how come it works then ? :S
03:10
Lol :)
@DzekTrek What are you saying? It's okay. He's been working on it for the past two hours or something, and we helped him with that.
well, this world would be alive, when you delete something unexistable, right? :)
@RMartinhoFernandes , I saw he doesn't know pretty much anything, now we will teach him what is what.
i kinda noo something oorr amm i that way oof :S
Now, @renatofernandes do you know what does this present?
03:12
while (true) { // first comment this line, and after it below one.
int n; cout << "\n\nSize of the array? "; cin >> n;
@renatofernandes Yes, you need to delete it when you're done. But you need to delete the whole list you constructed in the first loop!
while is a loop, and in this case it strictly says while my condition is true do something in a loop.
while( payement == treu ) { me happy }
yea i know tht :S
How's that relevant? What are you rambling about?
OK :)
03:15
im confused too ? Dzek what exactly are you trying to tell me?
so while( correct == 0 ){} means that code in a loop will apply only when condition is satisfied and true? Right ? :)
yea if condition is false then loop will break ?
correct! :)
That's how while loops work
OK, I think you figure this out. ;)
nt n; cout << "\n\nSize of the array? "; cin >> n;
what can you tell me about this line?
i havent studied array's yet so iunno
also, C, not C++, right?
03:18
lol, are you trolling?
the guy you're trying to help
is in a C class
not C++
@DzekTrek You seem to be the one trolling.
yep, @DerrickTurk.
he has probably never seen std::cout or std::cin before
That app I made for him is C
not C++
03:19
and I think his problems are more conceptual with memory management, and maybe recursive data structures in general
Me, I'm going to try and provide some real help.
@RMartinhoFernandes I made a few glitches for him to see if he knows, but really, trolling?
maybe start from the idea that the assignment builds a cons-style linked list
So, the problem, like I highlighted above, is that you need the whole list you built in the first loop when you delete it, but when the loop ends, x is empty.
Ok, lets see how would @RMartinhoFernandes solve the case
03:20
which is essentially define recursively. that plus the idea of allocate/free pairs on dynamic memory gets you what you need. trying to think of a good way to explain.
But don't provide any code, comment line by line
You can't change that fact that the loop will empty the list, because that's the only way you can iterate through it.
@DerrickTurk , he doesnt know anything, we need to help him from the scratch.
What can you do to keep the original list, so that the loop won't empty it?
i know recursion loops more or less
still learnin thou i know c only for 2 weeeks
03:22
@renatofernandes have you worked in any other languages in the past?
int n; cout << "\n\nSize of the array? "; cin >> n; but where do you see here arrays? :(
scheme
dr.racket
perfect, ok
You used scheme? Awesome.
did a whole course on it lol
03:23
so you're familiar the idea behind the assignment
nice :)
and a bit of java...
That ilist you have there is just like a scheme list.
it's building a linked list, just like in Scheme, out of what are basically "cons cells"
the problem is Scheme is garbage-collected
but how come you have no clue on c++ logic?
03:23
yeaa i understand tht concept
when you "cons"(truct) a cell, memory is dynamically allocated
i havent done c++
and the runtime will reclaim it in the future, when no references to it remain, or maybe something more sophisticated
@DzekTrek Because he didn't learn C++ yet? Is it that hard to grasp?
yeaa im just getting use to this whole memeory allocatin stuff
03:24
cons lists are not very good, IMO
in C, dynamic allocation and reclamation of memory is in your hands
I' m a bad teacher. :(
now, the library provided wraps the C standard library memory allocation/deallocation functions
@renatofernandes It's pretty simple. If you need memory, allocate it. Use it until you don't need it anymore. When you don't need that specific chunk anymore, deallocate it.
but the idea is the same, in every language: "code sandwiches" if you will
allocate x
03:25
@renatofernandes , do you understand what Turk is saying to you ?
do stuff with x
i guess i need to practice moer with it
I don't know ...
03:25
in Scheme, you never have to do the "free x" part yourself
more practice the easier for me to grasp
You seem a bit lost in all this right?
yeaa in scheme, they did it for us
so, I lost the link to the assignment, but your idelete function walks a cons list and frees each node
One Q. do you have a power of control over managment memory in c?
03:26
well yea a lil lost... i need to spend sometime coding in C to fully grasp it
you need to call it when you're done using the list, but you still need to hold a pointer to the head in order to call idelete
mhmm yeaa i understand that now ...
in scheme "pointers" are invisible: everything is an automatically dereferenced pointer, like a C++ reference, but you won't don't need to understand that yet
yeaa out profs told us in C everything is up to us
but in C there's a distinction between a thing and its address, and addresses of things are themselves first-class values
03:28
pretty sure that that is how the hardware works, so good luck not making that distinction
so whereas in Scheme you hold a list by a variable that implicitly dereferences to its head, in C you need to hold a pointer to the head
@DeadMG, yes, but that's not my point
it's a matter of whether it's exposed at the language level
well, you make it sound like there is any language, ever, which did not need to make such a distinction
I can't do pointer arithmetic in Scheme unless it's inside a VM I'm building
yeaa we just started pointer sooo... i still need to understand tht
so what?
03:29
that wasn't my intention, I'm just trying to get him thinking about the surfacing of indirection directly in the syntax
in Scheme, you still have to know whether or not it's a copy or a reference
... never mind.
because it's a fundamental semantic difference
the fact that C's pointers expose additional semantics on top of that isn't especially important
:D true
okayy so if i wanted to print my input in the same order, how would i icons accordingly?
03:31
the point is he's never had to explicitly dereference a "pointer" before, nor maybe has thought about the underlying semantics of the operations in scheme
it doesn't matter how explicit you do or don't make it
the different semantics at hand mean that you must know which you have
... I think we're in violent agreement, of a sort
and if he did Scheme and didn't know, then that just means he can't have gone anywhere significant in it
where's the violent?
and your last point: that's the point I'm trying to make
ok
well, the point that I'm trying to make is that there's jack diddly squat that any language can do to not distinguish between a thing and it's address
03:34
Ok, I have done your 2nd, 3rd and 4th assignment
Haskell doesn't.
but before I give it you I want to know
immutable doesn't count
no dont give it to me
03:34
^^
i want to learn
... unfortunate choice of words? I can tell you feel very strongly about this, but I'm only pointing out that C has syntax and semantics for treating addresses as first-class elements of the language
while many other languages, Scheme included, generally make everything "pointers" that are implicitly dereferenced
:D Excellent!
OK, but before we proceed tell me what you know, but truly
alrite so for part 2
@DerrickTurk Right. But that's not the same thing at all.
you still have "thing" semantics even if you make every explicitly available "thing" an address
03:35
i just know for loops while loops recursion ..... basic C ...
in other words, how do you write { int x [10] = { ... }; int *p = &x[0]; p++; } in scheme?
@renatofernandes Oh, you fixed the delete issue already?
that's irrelevant
I realize you can do the equivalent, but it's the notion that the thing you're manipulating
yes i did martinho
tahnks for ur help
03:36
C++'s references have the same distinctions and they don't offer any kind of pointer arithmetic
is treated by the language as an integral address, on which you can do math
@RMartinhoFernandes good job
YES that's why I compared Scheme's semantics to C++ references 50 lines ago
ok, tell us where you stuck now then
03:36
the fact that you can do things with a reference besides de-reference it is not relevant
and we will help
@DerrickTurk And C++'s references have exactly the same distinction- T vs T&.
which is just as distinguished as T vs T*
in part a we cons'ed thing to the list and produced the first of the list (basically list was backwards of the input) but in p2 i need the same order
when I save a file there is always two copy. file.c and file.c~ what is the difference?
whatever point it is you're trying to make, I concede, because you haven't said anything I disagree with, I just don't understand what it is you're trying to convey. I think "pointer arithmetic" and pointer types as they occur in C are relatively unique to "systems programming" languages, and that it's a distinction worth making.
03:38
@LearningC The ~ file is a backup saved by your text editor.
ok
I think that you're fundamentally confused about WTF is going on here
i think my goal is to make a list tht looks like the input ...
pointer arithmetic and reference semantics have nothing to do with each other.
so i need to solve that first
except that in C, pointers offer both capabilities
03:38
yes!
@RMartinhoFernandes how come the file size is never the same?
that's my point! that's all it was! it's weird to newbies, or so I hear.
@LearningC Because the backup has the old version.
when you talk about "The language distinguishes between T and T*", then that has nothing to do with the fact that you can index on a T*
Once I compile a file how can I run it on windows?
03:40
anyways
I'm going to go back to staring at my LR code again
I have an exam on this shizzle in a couple days
well, you have some function( lorry ) that takes some load from the buffer( factory) and dispatches it to the stockyard( screen )? :D ( sorry, I had to joke )
@LearningC Did you compile it on Windows?
it says that irest and ifirst are functions that return values of the ilist
so use them, combine in order to show your list on the screen
03:41
hey robot, you got a minute?
I compile on Unix I think. Is gcc -o file file.c a unix compiler?
i want to save my inputs in the a list in the same order?
GNU's not unix!
since I have an exam on LR parsing soon, I figured I'd go back to that LR parser generator I was going to write
03:42
@LearningC Well, then you can't run it on Windows. You need a compiler for Windows.
and I'm still not entirely sure wtf's going on
I keep running into the LL problem with left recursion
I ment GNU
so can I get a GNU converter for windows?
@DeadMG Moar. Details.
right
@DeadMG Canonical LR?
"surfaces a distinction syntactically"?
I wrote two panels of my move semantics comic. Then I got distracted here. Sigh.
@renatofernandes what about cout in the mix with for loop that iterates through the list and writes down all the elemnts of that particular list?
I've got a few pages of LR theory right here
but it's not going to produce the human-readable non-table-based parser that I want to generate
@Pubby LR(1) or LALR(1)
show us maybe we can help
03:45
Wait, non-table based LR parser?
yes
Ah, right, now I remember. You wanted to do a recursive ascent, that it?
exactly
I wanted to end up with something that would be much more human-readable
and it would be way more flexible, e.g. allow non-POD return types
in the form of what?
you can always use operator function
@DzekTrek how does tht help me get the list in the same order as inputs
03:48
well, here's the thing
for simple non-left-recursive grammars, it's going to work out fine, mostly
the thing is that I keep running into infinite recursion for left recursion
I was thinking of tracing the left-hand-side of the rule to see if it's left-recursive, then writing a special case to handle it
so you want something like ostream & operator << ( .... ) { ... }
@renatofernandes , please, use logic. I am not good teacher, @RMartinhoFernandes will explain it better.
@DeadMG Are you sure you're not accidentally making a descent?
I'm fairly sure
I can cope just fine with other non-LL constructs like trailing matches
wht im thinking is making a list like in the first question and then reversing it and using it?
but im finding that hard to do :(
no wait, maybe it is a descent?
hm
03:53
ostream & operator<< ( ostream& input , const Letters& let) { input << ' { ' for ( Letters::Elem* init=let.first;int ; init = int -> next) { input << *init-> (..) << ( init-> next ? " " : " ");} return input >> ';''
What is good place to read about recursive ascent?
here is initialization of what you need, because I have no clue how your app functions I used imagination of the Golden Pony.
Just fill with what you need
I go to sleep its 5 AM
now :(
and I have to work so much tommorow.
Xeo
Xeo
Hm. A good idea.
@DeadMG Have you ever constructed a LR by hand?
03:55
@renatofernandes That's a good idea. And you already know how to create a list in reverse order.
Xeo
Xeo
5am here too. And my little brother's birthday is today.
@renatofernandes nite bro. ;)
I have, but that process doesn't output anything like the parser I want to see
Xeo
Xeo
Although I'll probably miss it anyways, thanks to sleeping all day.
@Xeo, :) go and sleep, tommotow is party of your little bro :) I wouldn't miss it
03:56
right
I think that tracing is probably the answer
umm so should use my backward technique to reverse the list again?
The generator needs the logic to construct the table anyway. It just encodes it differently.
Xeo
Xeo
@DzekTrek I hate him. :) I even totally forgot his birthday, until I was suddenly reminded yesterday evening.
Shifts are function calls.
yeah
that's what I thought
03:57
@renatofernandes Exactly.
shift == function call, reduce == return
problem is how do i save my backwarward output as a list
Why would you hate your brother? @Xeo
@renatofernandes Make a new list?
03:58
so what I figure is
Xeo
Xeo
@DzekTrek personal reasons.
so when backward outputs something how would i save the output ?
Xeo
Xeo
Anyways, g'night.
@renatofernandes Save it in another list.
I think I need to write a simple parser to get a better feel of what the result would look like.
the problem is
03:59
Recursive ascents are not common...
don't let any personal reason step aside your brothers love.
when you have more complex shifts, like expression
then the decision is going to be more complicated
alternatively
I need to go now, very tired and eager to sleep!
maybe I just haven't been applying lookahead appropriately
See you folks!
04:03
hmm
I keep thinking it does work, and then my brain keeps throwing back "DOES NOT COMPUTE"
am i approaching this rite
int main(void){
    int number;
    ilist x = iempty();
    ilist y = iempty();
    while (1 == scanf("%d",&number)) {
       x = icons(number, x);
    }
    while(!iempty_huh(x)){
    y = icons (ifirst(x), y);
    x = irest(x);
    }
    while(iempty_huh(x)){
    idelete(x);
    }
    while(!iempty_huh(y)){
    printf("%d\n",ifirst(x));
    y = irest(y);
    }

    return 0;


}
Doesn't look like it...
no, you're right, it doesn't
but I'm not sure how to change it without effectively just refactoring the rule to become right-recursive
okayy i got it work no i set a varialbe i to save the the number of inputs .... i was wondering how do i print that first and then the list?
04:15
yay got compiler on windows
@renatofernandes printf?
do you guys recommend visual studios or Eclipse?
@RMartinhoFernandes How about pastebin.com/3n4Ni3AG
Ok, I believe this is the correct table: pastebin.com/T6n6xWVi. Now I'll see what I can do about the code.
but im print f in the loop, wont it print a lot of times or do i do it outside the loop?
04:18
@DeadMG Looks more like it, but it's missing hooks for the reduces.
what do you mean?
The reduces is where you run the actions.
i got tanks :
:D
that's simple
pastebin.com/sUsWpTr2 (edit: quick mistake)
Hmm.
Try x ++++++++
04:23
huh?
It shifts after the first +, and then doesn't error or anything, because the switch will enter case '+': on the next iteration.
right, because I never checked that the next token was actually an identifier
Still, x+x+x will not run the action until the end.
yeah
I saw that and am in the middle of fixing it
So im on Q4 now .... i have no idea how to approach it
Modify ilist.c (but not ilist.h) as necessary to implement the operations defined so as to meet the following running time constraints:
running time of iempty() is O(1)
running time of iempty_huh(il) is O(1)
running time of icons(in,il) is O(1) assuming running time of malloc(s) is O(s)
running time of ifirst(il) is O(1)
running time of irest(il) is O(1)
running time of ilength(il) is O(1)
running time of idelete(il) is O(n) where n is the number of elements in il.
04:28
Do you know what O-notation means?
the runtime of a function
I know, I know! Can I say it, please?
i think O(1) means it doesnt have loops or anything like tht
?
Damn, the example on Wikipedia is written in Scala.
Like i was looking at some of functions and how can i make them O(1) they looks simplied already
or am i misunderstanding the question?
Ok, what's the action on default for?
Errors?
because the grammar has a semantic action listed for ident as well as expr + ident
wait, I've cocked this up again
Ah, but it will never be entered. Take x + x.
Ah, you noticed.
yes
it is in the incorrect place
is my understand of O(1) right?
I think I have a break in the wrong place
Ok, I guess it's correct now. But the hard part is, how will you generate that?
yes
that was my problem :P
04:41
You don't need to explicitly move return values, btw.
supposedly
I still find that it helps MSVC along
Ah, ok. Nevermind.
The continue you have there can be a break, no?
yes
it was a continue from a previous iteration
although in this case the semantics are identical, I believe
This is to be an expression template powered generator, or a regular generator like Bison?
this is going to be way too complex to power by expression templates
hell, I still haven't changed my lexer to be predictive
the problem is that I've effectively just special-cased left-recursion
by refactoring it into a while loop
Yeah, that looks like something a human would come up with, not a machine.
Unless you had some complexity to the generator to make it that smart.
I could make the machine come up with it if I traced the graph to find left-recursion, I gues
but I don't actually see how that can be avoided
04:50
can somewoen help me to turn this scheme function into C without recursion i.e. iteration....
(define (my-append lst1 lst2)
(cond
[(empty? lst1) lst2]
[else (cons (first lst1)
(my-append (rest lst1) lst2))]))
I just can't see how to express left-recursion with just functional recursion
Ha, I think I can finally understand the example on Wikipedia.
Damn weird Scala syntax.
I'm having trouble linking to the proper stuff for boost::filesystem. I'm using -lboost_system -lboost_filesystem as flags, and I get the following errors:
g++ -pthread -lboost_system -lboost_filesystem    -o dist/Debug/GNU-Linux-x86/server build/Debug/GNU-Linux-x86/Socket.o build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/Request.o
build/Debug/GNU-Linux-x86/main.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
Any ideas?
the problem is
if I were to generate a state table and use that, then how would the semantic actions work?

« first day (474 days earlier)      last day (4691 days later) »