« first day (56 days earlier)      last day (604 days later) » 

6:10 AM
There should also be a memoize flag, when someone thinks a function is gonna be used often
Probably should be defualt for recursive functions
 
 
12 hours later…
6:35 PM
What would you say is more idiomatic, list << list[0] or list * (1 + 1/\length(list))
@El'endiaStarman
 
@quartata The former and it's a lot shorter to write!
 
hehe fair enough
 
The latter would be pretty confusing to near anyone.
But it's intriguing.
 
7:04 PM
Should we have \car and \cdr :P
 
hehehe, well, maybe
Clojure uses first and rest, though.
 
That's weird. head and tail would make more sense
 
Eh, I think those make slightly less sense.
 
What do you think of this:
\nestfor(x, y, z, ..., array) { foo } { bar } { baz } -> \for(x, array) { foo; \for(y, x) { bar; \for(z, y) { baz } } }
Great for multi-dimensional arrays.
 
@quartata Would the ellipsis actually be part of the code?
 
7:19 PM
No.
Pretend I didn't put those there
That was dumb
Anyways, you get the idea right?
 
Almost. I'm wondering why you have \for(y, x). Is that equivalent to Python's for y in x?
 
Yeah.
That's how I was thinking we'd do that.
 
Hmm. I think I had been thinking of something more like \for[y](x).
 
Perl does for $y (@x)
D does foreach(y; x)
 
Oh hey, what if we made \for[a,b,c](x,y,z) be equivalent to for a,b,c in itertools.product(x,y,z)?
 
7:23 PM
Sure
Anyways, check this out:
type:board() {
  grid = \list(" " * 80) * 24;
}

func:generate() {
  board = board();

  side1 = {n : \and(n,2) == 0, 0 <= n < 16, n \in \N};
  side2 = {n : \and(n,2) == 2, 0 <= n < 16, n \in \N};

  side1 ~= \order -> \list -> \shuffle;
  side2 ~= \order -> \list -> \shuffle;

  \for(room, [6,11] ~ \random -> \range) {
    chunkNum = (room % 2 == 0 ? \pop(side1) : \pop(side2));
    chunkPoint = 20 * (chunkNum % 4) + 5 * (chunkNum / 4)i;
    randomPoint = \random(20) + \re(chunkPoint) + (\random(5) + \im(chunkPoint))i;
This is a port of a random ASCII dungeon room generator I made
 
Awesome.
 
Once this runs, Pytek is ready to be put on Github IMO
There's a few new things in there
\order tries to create an ordered set by imposing the natural ordering of the types in the set
 
> board = board();
 
@El'endiaStarman Is that not right? :P
 
This would actually be board:board(), I think.
 
7:28 PM
Oh, OK.
 
Which is really confusing. :P
 
I'll rename the variable to newBoard then
 
If you had done foo = board();, that would instead be board:foo();.
 
Wait, what?
 
board is a type now.
 
7:29 PM
Right...
Oh.
Doesn't that create a new instance of board?
 
It should, yeah?
 
All right, just checking.
 
Anyway, continuing reading...
 
\rectangle(x+yi, a+bi) would create something like [x+yi, a+yi, a+bi, x+bi]
\and is bitwise AND. I wasn't sure what we were going to do for that
 
The side1 variable is a set builder, right? Those are {|}, not {:}.
 
7:31 PM
@El'endiaStarman Oh, oops
{:} would be a dictionary
 
@quartata \bitand, I was thinking. That could work, though.
 
In case you're confused by the way, \and(n,2) is second least significant bit. The first is {0, 1, 4, 5, 8, 9, 12, 13} and the second is {2, 3, 6, 7, 10, 11, 14, 15}
The algorithm divides the terminal window up into 19x4 chunks with 1x4 and 19x1 "dead space" pockets between them.
Then it alternates picking chunks from the left and right side
It then picks a random point inside that chunk and draws a rectangle from the random point to the farthest corner of the chunk
 
\in will just be in.
 
Oops, I noticed another mistake.
<corner, max : \abs(corner - randomPoint) > \abs(max - randomPoint)> should be <corner, max : \abs(corner - randomPoint) <=> \abs(max - randomPoint)>
 
Oooh, I like ~=.
 
7:34 PM
Yeah, I thought you would. :P
 
How does \slices work?
 
\slices is overlapping slices, like CJam's ew.
 
Little example?
 
[a,b,c,d] -> [[a,b],[b,c],[c,d]]
 
How does Pytek know the size of the slice? Is it an option that's 2 by default?
 
7:41 PM
Yeah.
You could do \slices[size=3](array) too
 
> \range(\im(point1), \im(point2))
This will be allowed.
However, [\im(point1)..\im(point2)] is more Pytekish. :P
 
I was going to do .. but I wasn't sure if that was exclusive or inclusive
 
Exclusive/inclusive is adjusted by the delimiters.
 
Ahh right
I remember now
I'll change that one second
 
Also, I'm okay with \re and \im, but perhaps it would be better to do \real and \imag?
 
7:45 PM
Up to you.
Both are fine to me
 
type:board() {
  grid = \list(" " * 80) * 24;
}

func:generate() {
  board = board:board();

  side1 = {n | \and(n,2) == 0, 0 <= n < 16, n in \N};
  side2 = {n | \and(n,2) == 2, 0 <= n < 16, n in \N};

  side1 ~= \order -> \list -> \shuffle;
  side2 ~= \order -> \list -> \shuffle;

  \for(room, [6,11] ~ \random -> \range) {
    chunkNum = (room % 2 == 0 ? \pop(side1) : \pop(side2));
    chunkPoint = 20 * (chunkNum % 4) + 5 * (chunkNum / 4)i;
    randomPoint = \random(20) + \re(chunkPoint) + (\random(5) + \im(chunkPoint))i;
Updated codez
 
> board = board:board()
UGH :P
That line should just be board:foo(), period.
 
@El'endiaStarman But what's the foo() do?
Oh, forgot to mention. The SKIP option to nestfor doesn't execute the first code block the first time going through the loop
That comes up enough that I thought it would be useful.
Beats a boolean flag
 
7:49 PM
@quartata ....hmm. I'll have to think on that.
 
And \termcap[TCLEAR]() clears the terminal using ANSI control codes
 
@quartata I like that idea.
Oooh...
    \for(edge, \slices(roomPoints << roomPoints[0])) {
      point1, point2 = edge;

->

    \for[point1, point2](\slices(roomPoints << roomPoints[0])){
 
I just realized that the \nestfor can be done with a \join and a \map but oh well
@El'endiaStarman nice
 
> (chunkNum / 4)i
 
Do you like the \max custom comparator idea?
@El'endiaStarman yesh?
 
7:57 PM
This will have to be (chunkNum / 4)*1i.
 
Ah, OK.
I figured as much
 
So, actually, you would probably want to do 5i * (chunkNum/4) instead.
@quartata I think it's great. :D
@quartata Oh, I figured out why I was thinking that way. func:foo(){}.
Blitz 2D/3D would do it like foo.board = New board.
....and I just realized that it doesn't have a constructor function. You have to write one yourself.
Wow. How did I program so well in this language...? :P
 
8:38 PM
@quartata, what do you think of changing ~ to ~>? That would link it with -> more clearly.
 
8:59 PM
@El'endiaStarman Hmm
Sure
 
alright
I'll work on the symbol table thing today.
 
@El'endiaStarman The equivalent (and annoying) statement in D was corners[maxIndex(map!(corner => abs(corner - randomPoint))(corners))];
And I had to implement maxIndex myself which was double annoying
 
We should also have \index be modifiable by passing it a function.
 
In case you were curious, here's the original D program. It's a little more complicated because it pretty-prints the rooms in CP437 with corners and stuff:
import std.algorithm : map, remove;
import std.complex;
import std.conv : to;
import std.random : randomShuffle, uniform;
import std.stdio : write, writeln;

enum CornerMode {
  UP, DOWN
}

public class Board {
  public char[80][24] grid; // grid of 80 points ((0,0) to (79,79)). Origin is in the upper left corner.

  public static Board generate() {
    Board board = new Board();

    /* We split the screen into 19x4 chunks (with 1x4 and 19x1 "dead space" pockets between them). */
    auto side1 = [0, 1, 4, 5, 8, 9, 12, 13]; // left side of the screen
Ranges are the equivalent of our sequences; a generalized form of lists
 
Ah-huh.
....ooh, is there any meaning to [ [1,2] .. [3,4] ]?
 
9:12 PM
Hmm
I don't know, have we thought of an ordering for lists?
 
I would think that would be what Python uses for sorting, which is lexicographical order, just like for strings.
 
Well then that doesn't work; that would be an infinite sequence
Hmm
It could be [1..3, 2..4]
 
So, [[1,2,3], [2,3,4]].
I actually thought of it as being two corners of a rectangle, so the result would be [[1,2], [1,3], [1,4], [2,2], [2,3], [2,4], [3,2], [3,3], [3,4]].
 
Huh, that's interesting too
 
I'm not really set on either. Just something to think about.
 
10:02 PM
@El'endiaStarman How should a chain be called niladically?
A unary ~>?
 
...example?
 
If I wanted to call a chain with no argument.
 
Just don't have the ~>?
 
Unary ~> would just be ~>(chain body)
@El'endiaStarman But then you can't store a chain in a variable which I wanted to be able to do
 
@quartata Ye sure about that? :P
 
10:04 PM
x = asdf -> blah; .... a~>x
If you use a chain a lot I'd think it would be useful
 
func:foo = \sqrt -> \square
 
It's the closest we have currently to a varity lambda so
Also, side1 ~>= ... is pretty ugly. Can we just do side1 ~= for that?
 
@quartata ...yeah.
Maybe it would be better to just stick with ~.
 
I like ~>.
I'm just not sure how I feel about ~>=.
 
yeah
Let's just do ~> and ~= and say why we chose that in the docs.
 
10:10 PM
k
 
 
1 hour later…
11:39 PM
Few things I thought of on a walk:
1. We should have a constant I = 1i
2. Should we have a tree type?
3. Numbers should start as long/double internally and upgrade to arbitrary precision on overflow/underflow
@El'endiaStarman
 
@quartata Yes. We could also have a rational: type.
@quartata I think so, yes. We'll have to think on the best way to initialize and work with such a type.
@quartata Why, though? And, suppose someone wants that name for their own variable? (I guess that's not too different from being unable to use certain keywords, but still.)
 
I don't see why anyone would use capital I though
 
I think that's erroneous reasoning.
I've seen such arguments made multiple times and in many cases, there's a relatively easy counter-example.
 
OK, how about a \complex constructor that takes the real and imaginary parts
 
Why is that useful over a + bi (or a + b*1i)?
 
11:51 PM
Because *1i looks super ugly
That's why I want an alternative
 
So, instead of a + b * 1i, it would be a + b * I?
 

« first day (56 days earlier)      last day (604 days later) »