« first day (120 days earlier)      last day (431 days later) » 

 
3 hours later…
05:43
@NinjaBearMonkey oh :| whoops nice catch!
 
11 hours later…
17:01
If you guys are heading more towards functional land are you going to implement pattern matching and the like
@Downgoat @CᴏɴᴏʀO'Bʀɪᴇɴ
 
1 hour later…
18:18
@quartata like regex? Yes we are
Like in Haskell:
f 0 = 0
f n = f n - 1
Oh, for function definitions
It picks the function definition that matches
18:20
It seems sort of vague
Here's a piece of erlang I made back when I was learning it that demonstrates it nicely:
-module(rpn).
-export([rpn/1]).

rpn(Code) when is_list(Code) ->
  rpn(string:tokens(Code, " "), []).

rpn([], Stack) ->
  io:format("Result: ~B~n", [hd(Stack)]);

rpn([Token|Tail], Stack) ->
  rpn(Tail, token_execute(Token, Stack)).

token_execute("+", [Arg1,Arg2|Tail]) ->
  [Arg1 + Arg2|Tail];

token_execute("-", [Arg1,Arg2|Tail]) ->
  [Arg2 - Arg1|Tail];

token_execute("*", [Arg1,Arg2|Tail]) ->
  [Arg1 * Arg2|Tail];

token_execute("/", [Arg1,Arg2|Tail]) ->
  [Arg2 div Arg1|Tail];

token_execute("_", [Arg1|Tail]) ->
How do I specify an even number? An integer?
@CᴏɴᴏʀO'Bʀɪᴇɴ You use a guard
rpn(Num) when is_even(Num)
So when you call rpn("asdf") it goes to the rpn(Code) definiton
Then that calls rpn(string:tokens(Code, " "), []). Since the first argument isn't empty, it goes to rpn([Token|Tail], Stack)
which splits up the list into Token (head) and Tail
Because... A string is a list?
Yeah, that's erlang's fault. Sorry
18:22
Okay, just wondering
Then rpn is recursively called until there are no tokens left, at which point it goes to rpn([], Stack)
token_execute uses pattern matching too
One definition for each token
Does it have precedence?
Like, the result
@CᴏɴᴏʀO'Bʀɪᴇɴ Not exactly sure, I think the most specific definition is first. Like, it would rather have token_execute("+" then token_execute(Generic_Variable
18:28
Oic
That seems like a cool thing to have
@Downgoat what do you think?
@quartata for functions? I hope so, I was thinking about syntax last night
I mean, it really depends on what your goal is
This is very heavy functional
And I know you were going for more OO/procedural at first
Well since class literals dont exist yet cheddar is gonna be 100% functional for the time being. Class literals are a big thing to implement
I'd recommend you really study Scala
It's a successful example of OO/functional
are there any unsuccessful examples of such? those would be helpful as well.
18:33
Uhh I don't know
:P
19:33
@CᴏɴᴏʀO'Bʀɪᴇɴ see cheddar dev pre-v1.0.0-beta.29
19:54
@Downgoat Isn't that the current version?
@quartata no. its the next version if i remember correctly. I'm planning on starting to work on classes today
ಠ_ಠ y u haet classes ;_;
20:19
@Downgoat Have fun!
(by the way don't feel obligated to make cheddar a fully functional language, OO is perfectly respectable :P)
21:14
@CᴏɴᴏʀO'Bʀɪᴇɴ idea for pattern matching: You declare the type signature and then declare the behavior
e.g.:
f :: Number -> Number
f(0) -> 1
f(1) -> 1
f(n) -> f(n - 1) + f(n - 2)
I also want a way to refer to function inside itself. without knowing its name
kinda like arguments.callee
Cannot think of idea
@quartata thx
21:37
@Downgoat you could use J's $: :3
@quartata does that sound like a bad idea
22:10
@Downgoat in all seriousness
f :: Number -> Number
f(n where n < 2) -> 1
f(n) -> $:(n - 1) + $:(n - 2)
left side:
 constant <=> (a) -> a == constant
 n where p(n) <=> (a) -> p(a)
@CᴏɴᴏʀO'Bʀɪᴇɴ what does this mean
@CᴏɴᴏʀO'Bʀɪᴇɴ Hm. This won't play will ternaries. But perhaps I could make $: a special variable without making $ or : valid variable chars
@Downgoat that's what I was thinking.
@Downgoat the stuff inside f
f(left side)
<=> means "is the same as"
hm. should left side be an expression? That way you could do:
function generatePattern(n) {
    f :: Number -> NUmber
    f(n + 1) -> n
}
but you could always do:
f(n where n == 1)
@Downgoat erlang does this with named anonymous functions
fun(f) -> .... f()
> named anonymous functions
22:18
I could see something like f(a,b) -> ...
@Downgoat Yes, shush
then it's not an anonymous function...
@Downgoat No, it is. It just has a name that's local to its own body
@quartata that'll get messed up with patterns as above
@Downgoat (a,b)f -> ?
ew
maybe ok perhaps
(a,b) f -> looks fine
22:20
@Downgoat You could also just use a fixed-point combinator
I think Haskell just has that
22:44
@RohanJhunjhunwala its okay I can move to TNB i think
 
1 hour later…
23:47
@Downgoat +1 for mass deleting branches

« first day (120 days earlier)      last day (431 days later) »