Live data from Hacker News

TypeCell, open source TypeScript notebooks live programming environment

typecell.org

11–20 of 26 posts

Re: TypeCell, open source TypeScript notebooks live programming environment

#11
post #6

I have been waiting a long for this I use Quokka.js but I hate that the free version is almost useless

They rebranded it into “console ninja”, with a more generous (and actually (extremely) useful) free tier for the extension. I can highly recommend it!

Re: TypeCell, open source TypeScript notebooks live programming environment

#12
post #8

Cool. This may be a bit nitpicky, but most of the interactive JavaScript environments I have seen with auto-run ("evaluates as-you-type"), including this one, freeze in the following case. for (let i = 0; i

An easy way to correct this is injecting a watchdog function call at the end of every for and while loop. It’s a trivial AST transformation that’s relatively fool proof as opposed to trying to figure out what condition would progress the loop. The semantics of the watchdog depend on the use case and ideally you can transform the evaled code in an async wrapper. Set a global variable to the current time on animation frames and then throw an exception inside the watchdog when it times out (when difference between the global variable and current time is > x ms).

Re: TypeCell, open source TypeScript notebooks live programming environment

#13
post #8

Cool. This may be a bit nitpicky, but most of the interactive JavaScript environments I have seen with auto-run ("evaluates as-you-type"), including this one, freeze in the following case. for (let i = 0; i

No problem, there's an NPM package for that!

(no, I'm not kidding: https://www.npmjs.com/package/halting-problem)

Re: TypeCell, open source TypeScript notebooks live programming environment

#14
Trying out the thing, and since this is ycombinator after all:

  type Lazy = () => A;
  const lazy = (f: Lazy) => {
    let thunk: Lazy = () => { throw null; }
    thunk = () => {
      const y = f();
      thunk = () => y
      return y;
    };
    return thunk;
  };
  const tap = (f: Lazy) => Lazy>, a: Lazy): Lazy => 
    lazy(() => f()(a)());
  
  const ap = (f: any, a: any): any => tap(f, a);
  
  const y = (f : (a: Lazy) => Lazy): Lazy => ap(((x: any) => ap(ap(f, x), x)),((x: any) => ap(ap(f,x),x)));
  
  type Cat = {
    name: string,
    friend: Cat,
    prefersDryFood: boolean,
    foodPerWeek: number
  };
  export const cat = y(self => lazy(() => ({
    name: "lol",
    friend: self(),
    prefersDryFood: false,
    foodPerWeek: 4,
  })))();

Breaks typescript though. Also, the laziness won't work here.

Re: TypeCell, open source TypeScript notebooks live programming environment

#15

Trying out the thing, and since this is ycombinator after all: type Lazy = () => A; const lazy = (f: Lazy ) => { let thunk: Lazy = () => { throw null; } thunk = () => { const y = f(); thunk = () => y return y; }; return thunk; }; const tap = (f: Lazy ) => Lazy >, a: Lazy ): Lazy => lazy(() => f()(a)()); const ap = (f: any, a: any): any => tap (f, a); const y = (f : (a: Lazy ) => Lazy ): Lazy => ap(((x: any) => ap(ap(…

Though you need to replace:

  return thunk; 
with:

  return () => thunk();
Otherwise the assignment in thunk does nothing.

Re: TypeCell, open source TypeScript notebooks live programming environment

#16
I'd like to see this as a live code-sharing tool. Sometimes when interviewing candidates I'm using codeshare.io, but that doesn't have "live compilation". This would be great for that. I'm missing some features, and they're expected as it's in alpha, but I don't want to keep them from you: 1. vim mode (ace editor could be nice for this?), 2. a way to share with a not logged-in user 3. dark mode 4. maybe I'm missing it, but having a `console.log` not being in the output is unintuitive

Re: TypeCell, open source TypeScript notebooks live programming environment

#18
First demo I tried was `Visualize weather data with two React chart libraries`, and all I see is an error at the bottom.

> Something went wrong: TypeError: Cannot read properties of null (reading 'useRef')

Appears to be an issue with the charting library used here at a glance?

Re: TypeCell, open source TypeScript notebooks live programming environment

#19

Trying out the thing, and since this is ycombinator after all: type Lazy = () => A; const lazy = (f: Lazy ) => { let thunk: Lazy = () => { throw null; } thunk = () => { const y = f(); thunk = () => y return y; }; return thunk; }; const tap = (f: Lazy ) => Lazy >, a: Lazy ): Lazy => lazy(() => f()(a)()); const ap = (f: any, a: any): any => tap (f, a); const y = (f : (a: Lazy ) => Lazy ): Lazy => ap(((x: any) => ap(ap(…

Though you need to replace: return thunk; with: return () => thunk(); Otherwise the assignment in thunk does nothing.

Whoops, forgot to eta expand.

Re: TypeCell, open source TypeScript notebooks live programming environment

#20

so, observablehq. i like it. what's the pricing, and can you save private docs?

Observable doesn't have TypeScript support, which is a real drag. Their embeds also don't show code, so it's not very useful as a teaching tool in a blog post for example. However, they don't charge for embedding, so that's not a problem per se.
Post reply on HN