« first day (136 days earlier)      last day (415 days later) » 

1:43 AM
@Downgoat I'm making a function for a namespace. Let's say I have a string that represents an op (say, "+"). how do I get the behaviour for that op?
 
@ConorO'Brien LHS.Operator.get("+")(LHS, RHS)
where "+" is the string
 
what is LHS?
 
left-hand-side
 
I mean
wtf
I'm not making an operator
 
._.
 
1:45 AM
a function
 
LHS.Operator.get("+") gets a JS function which performs operator behavior?
gaot is confused .__.
 
what is LHS the variable??
 
basically operator behavior is not globally defined. operator behavior is specific to the object. so yeah, LHS is the cheddar object you want to operator upon
 
okay
where do I get LHS
 
are you going to use the operator upon something?
 
1:48 AM
yes
 
lemme make examp,le
new cheddar.func([
    ["inputA", { }]
], function(scope, input) {
    let inputA = input("inputA");
    let one = cheddar.init(cheddar.number, 10, 0, 1);
    // If I want to do `inputA + 1`:
    return inputA.Operator("+")(inputA, one)
});
 
where did LHS go
 
LHS = inputA in this case
 
??
 
1:50 AM
nothing
the way you worded it earlier was confusing
 
>_>
btw added Rationals, functionalized props and shoco compression latest version. you should update if you haven't already
 
how do I update a branch
git pull upstream?
or something
 
@ConorO'Brien git fetch origin then do git merge origin/develop (updated from develop)
if it says you have conflicts do: git merge --abort to abort the merge then do git merge origin/develop -X ours
 
thanks!
do I need to reassemble the stuff
module.js:442
    throw err;
    ^

Error: Cannot find module 'xregexp'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Conor O'Brien\Documents\Programming\cheddar\main\dist\interpreter\core\primitives\Regex.js:13:16)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
@Downgoat
halp
 
npm install
 
2:00 AM
oh
facepalm
 
though that means you haven't updated for a while o_O
i added regexes quite a bit ago
oh well
 
this is the fn-lib branch
 
oh
 
which I haven't worked on in a while :P
npm install is taking a while
Your branch is ahead of 'origin/fn-lib' by 203 commits.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean
._.
cheddar> var a = [1, 2, 3]
cheddar> a[0] = 4
Runtime Error: Left side of assignment is not a reference
@Downgoat please fix
 
2:29 AM
@Downgoat how do I make a release again?
 
3:05 AM
@Downgoat how do I access the list of operators from an api file?
Like, CheddarOperators.has("@>") or something
 
@Downgoat How do I use sqrt?
 
cheddar> sqrt 4
2
 
on Rational
 
I think it's rsqrt
 
nope
 
3:09 AM
idk then. ask the mammal
 
cheddar> sqrt Rational.of(6,7)
Runtime Error: `sqrt` has no behavior for types `nil` and `Rational`
cheddar> sqrt Rational.of(6,7) 2
Syntax Error: Unexpected token at 1:22
1 | sqrt Rational.of(6,7) 2
  |                       ^
cheddar> rsqrt Rational.of(6,7)
Syntax Error: Unexpected token at 1:6
1 | rsqrt Rational.of(6,7)
  |       ^
 
@ΛεγίωνΜάμμαλϠΨΠʹ
cheddar> Rational.of(4,5) - Rational.of(3,4)
Runtime Error: `-` has no behavior for types `Rational` and `Rational`
Please overload the common operators.
cheddar> Rational.of(2.23213123)
125 / 56
cheddar> 125/56
2.232142857142857
@Downgoat if returned inputA.Operator(thing), would that work? or do I need to make it a cheddar func
@Downgoat what happens if I, say, do const thing = require("./stdlibthing"); will I be able to use it as a cheddar func?
 
3:30 AM
Never mind, I found it
cheddar> Rational.rsqrt(Rational.of(6,7))
0.9258200997725514
 
3:42 AM
@ConorO'Brien um src/tokenizer/consts/ops has some tokenizer info. UOP is unary ops and OP is binary ops
@ConorO'Brien uh >_> it's kinda difficult. make a PR to release-1.0.0 and there it can be sorted out.
@ConorO'Brien you'd need ot make it a cheddar func
@ConorO'Brien meaning?
 
@Downgoat how do I use it
@Downgoat ok
@Downgoat I'll do that later. Long and short of it is that I have a fn.bind function that represents the correct & behaviour
 
@LeakyNun if you have any problems with rational library talk to @ΛεγίωνΜάμμαλϠΨΠʹ :P
 
@Downgoat how do I use that programatically
 
@ConorO'Brien import { UOP, OP } from '../../../../tokenizer/consts/ops' I have no idea how many ../ you need though (I just put 4 just like that).
 
@Downgoat I'm in a stdlib thing
subfolder
 
3:45 AM
can you do a pwd and gimme a path?
 
I'm assuming that's like cd
C:\Users\Conor O'Brien\Documents\Programming\cheddar\main\src\stdlib\ns\fn\of.es6
 
../../../tokenizer/consts/ops
 
thanks
what's the dif between import and require
@Downgoat
 
import is ES6 syntax. require is a node-specific function. babel transpiles import to require
though try to import in cheddar code to keep consistency
 
oh
const fork = require("./fork");
how to make that import
 
3:56 AM
its okay if you're using require though
@ConorO'Brien import fork from "./fork";
 
hey can you help me with something. my code is erroring and I don't know why
 
if (c.den > 1000 || Math.abs(A.num / A.den - frac) < 0.0001)
    break;
@ConorO'Brien see above
The accuracy is only to 0.0001
 
@LeakyNun oh, interesting
 
@ConorO'Brien yeah?
 
import { UOP, OP } from "../../../tokenizer/consts/ops";
import fork from "./fork";

const ops = [
    "+", "*", "**", "-", "^",
    "&", "|", "/", "%", "@\""
];     // TODO: make dynamic

const parse = (str) => {
    let tokens = [];
    for(let i = 0; i < str.length; i++){
        if(!ops.some(x => x[0] === str[i])) continue;

        let build = "";
        while(ops.some(x => x.indexOf(build + str[i]) >= 0)){
            build += str[i++];
        }
        i--;
        tokens.push(build);
    }
is "of.es6"
cheddar> fn.of("+ * -")
readline.js:945
            throw err;
            ^

TypeError: str.Operator is not a function
    at CheddarFunction.body (C:\Users\Conor O'Brien\Documents\Programming\cheddar\main\dist\stdlib\ns\fn\of.js:56:45)
    at CheddarFunction.exec (C:\Users\Conor O'Brien\Documents\Programming\cheddar\main\dist\interpreter\core\env\func.js:142:29)
    at eval_prop (C:\Users\Conor O'Brien\Documents\Programming\cheddar\main\dist\interpreter\core\eval\prop.js:160:33)
    at CheddarEval.step (C:\Users\Conor O'Brien\Documents\Programming\cheddar\main\dist\interpreter\core\eval\e
is the error
 
4:02 AM
hm ok lemme see
what is str in str.Operator?
btw there's a third argument to a cheddar.func callback. it returns a js array of the passed arguments
["args", { Splat: true }] -> [ ["args", { Splat: true }] ]
 
@Downgoat in this case? it's "+ * -"
@Downgoat oh
 
your console.log is what's thorwing the error. Make return str.Operator(e)(..._input("args").value) into:
let args = _input("args").value;
return args[0].Operator.get(str)(args[0], args[1])
i think thats what you want
but i have no idea what e is
 
@Downgoat What exactly is coverage? A goal?
 
4:08 AM
right
 
@ConorO'Brien fork? like in J?
 
.Operator is only a property of Cheddar objects. It's a JS Map object so you gotta use get
 
@LeakyNun yes
 
:o
@Downgoat Would you redirect M to Math and R to Rational for alias?
 
why?
@Downgoat same error
 
4:10 AM
For convenience, that we wouldn't have to type a long name for it
 
after changes
 
@LeakyNun 100% coverage is the dream. coverage is how much of code is actually tested. The reason is, is that PRs, deployment, etc. they all run the tests to see if anyhting is borked. When you submit a PR, tests run so we can see if anyhting is borken. these tests have saved my many times from accidentally pushing a commit with a broken feature or so. problem is only around ~70% of the codebase is tested (coverage). So 30% of the code could be borked and no one woul know
 
@Downgoat So as soon as you have 100% coverage you will release it?
 
he already has released it >_>
 
alright
 
4:13 AM
@ConorO'Brien can you explain to me what you're trying to do? I assume str is a string which is the operator to use. what if they are more than two args?
 
ok
string is filled with operators
liek "+ * -"
I parse it with parse
to give ["+", "*", "-"]
I map each to its operator
then I call fork on the result
 
oh ok
i see
so args is the arguments to pass to the operator?
 
wait
tyes
 
@Downgoat Feature request: fork(f,g,h)=(a,b)->g(f(a,b),h(a,b))
(instead of the complicated tokenization that @ConorO'Brien would like to implement)
 
@LeakyNun I already implemented it.
fn.fork
 
4:18 AM
This can take functions other than the traditional operators?
 
yes
this is fn.of, a different function.
 
@ConorO'Brien How does that work?
cheddar> fn.fork
Runtime Error: Attempted to access undefined variable `fn`
 
I haven't pushed fn yet.
it's a namespace.
 
Alright
 
@ConorO'Brien ok. so there shouldn't be more than 3 items in args
 
4:20 AM
@Downgoat yes
 
@ConorO'Brien try this inside the fork:
new cheddar.func(
    ["LHS", { }],
    ["RHS", { Optional: true }],
    function(_scope, _input){
        let LHS = input("LHS");
        let RHS = input("RHS");

        return LHS.Operator.get(e)(RHS ? LHS : null, RHS || LHS);
    }
)
 
 
7 hours later…
11:03 AM
@LeakyNun WHAT IS IT
Note to all: I've given in, I'll just overload the default operators for Rationals.
4
@Downgoat ^ plz pin
 
 
4 hours later…
3:30 PM
@ΛεγίωνΜάμμαλϠΨΠʹ :D THANK YOU SO MUCH
 
4:11 PM
@ΛεγίωνΜάμμαλϠΨΠʹ :D TYVVVVM
 
 
6 hours later…
10:16 PM
> Thank You Virtual Machine
 

« first day (136 days earlier)      last day (415 days later) »