跳到作品
楚栋浩
菜单关闭

楚栋浩

喜欢编程 喜欢思考

楚栋浩

喜欢编程 喜欢思考

《爱的闭环》

向下滚动,慢慢翻阅

封面01 / 04

书籍

爱的闭环

楚栋浩

回答以下问题

  1. 人生的意义
  2. 如何活着
  3. 如何社交
  4. 如何有效设计
  5. 什么是爱

有效社交

  • 价值是核心
  • 平等是基础
  • 尊重是体现

应用

  1. 活着的目的
  2. 要不要结婚
  3. 要不要生育
  4. 教育的基本逻辑
  5. 人际交往的基本逻辑
  6. AI时代如何定义价值

《爱的闭环》

书籍

爱的
闭环

楚栋浩

回答以下问题

  1. 人生的意义

  2. 如何活着

  3. 如何社交

  4. 如何有效设计

  5. 什么是爱

应用

  1. 活着的目的

  2. 要不要结婚

  3. 要不要生育

  4. 教育的基本逻辑

  5. 人际交往的基本逻辑

  6. AI时代如何定义价值

编程语言

CW编程语言

出发点

C++ 是一门非常优秀的编程语言,但有很多历史包袱、学习路径陡峭

设计取舍

可读性>简单>简洁

已实现的语言特性

基本类型、复合类型(指针、引用、函数指针)、变量定义、函数定义、逻辑语句、结构体定义、继承、多态、RAII、函数重载、运算符重载、命名空间等,最新进展见 项目仓库

代码示例

变量定义

var width i32 := 6;
var height := 7i32;

函数定义

func Add(foo i32, bar i32) i32 {
  foo + bar
}

逻辑语句

func Abs(value i32) i32 {
  if value < 0 {
    -value
  } else {
    value
  }
}

func SumEven(limit i32) i32 {
  var sum := 0i32;
  var value := 1i32;
  while value <= limit {
    if value % 2 == 0 {
      sum += value;
    }
    value++;
  }
  sum
}

结构体、继承、多态

// 基类
struct Shape {
  virtual {
    func Area(this &copy Shape) i32;
  }
}

ctor Shape() {}
dtor Shape() {}

func Area(this &copy Shape) i32 { 0 }

// 派生类与重写
struct Rectangle : Shape {
  virtual {
    override func Area(this &copy Rectangle) i32;
  }
  width i32;
  height i32;
}

ctor Rectangle(width i32, height i32) {
  this.Shape := Shape();
  this.width := width;
  this.height := height;
}

dtor Rectangle() {}

func Area(this &copy Rectangle) i32 {
  this.width * this.height
}

struct Square : Shape {
  virtual {
    override func Area(this &copy Square) i32;
  }
  side i32;
}

ctor Square(side i32) {
  this.Shape := Shape();
  this.side := side;
}

dtor Square() {}

func Area(this &copy Square) i32 {
  this.side * this.side
}

// 多态调用
func GetArea(shape &copy Shape) i32 {
  shape.Area()
}

func Example() i32 {
  var rectangle := Rectangle(6, 7);
  var square := Square(5);
  GetArea(rectangle) + GetArea(square)
}

CW 能力演示

模型推理

用 CW 实现模型推理,编译成 WebAssembly,在浏览器中运行查看对应代码

从几句话开始,看看故事会走向哪里

进入体验区后加载 stories260K

输出

输入处理:尚未开始输出生成:尚未开始

生成的内容会逐步显示在这里
编程语言

CW编程语言

出发点

C++ 是一门非常优秀的编程语言,但有很多历史包袱、学习路径陡峭

设计取舍

可读性>简单>简洁

已实现的语言特性

基本类型、复合类型(指针、引用、函数指针)、变量定义、函数定义、逻辑语句、结构体定义、继承、多态、RAII、函数重载、运算符重载、命名空间等,最新进展见 项目仓库

代码示例

能力演示

变量定义

var width i32 := 6;
var height := 7i32;

函数定义

func Add(foo i32, bar i32) i32 {
  foo + bar
}

逻辑语句

func Abs(value i32) i32 {
  if value < 0 {
    -value
  } else {
    value
  }
}

func SumEven(limit i32) i32 {
  var sum := 0i32;
  var value := 1i32;
  while value <= limit {
    if value % 2 == 0 {
      sum += value;
    }
    value++;
  }
  sum
}

结构体、继承、多态

// 基类
struct Shape {
  virtual {
    func Area(this &copy Shape) i32;
  }
}

ctor Shape() {}
dtor Shape() {}

func Area(this &copy Shape) i32 { 0 }

// 派生类与重写
struct Rectangle : Shape {
  virtual {
    override func Area(this &copy Rectangle) i32;
  }
  width i32;
  height i32;
}

ctor Rectangle(width i32, height i32) {
  this.Shape := Shape();
  this.width := width;
  this.height := height;
}

dtor Rectangle() {}

func Area(this &copy Rectangle) i32 {
  this.width * this.height
}

struct Square : Shape {
  virtual {
    override func Area(this &copy Square) i32;
  }
  side i32;
}

ctor Square(side i32) {
  this.Shape := Shape();
  this.side := side;
}

dtor Square() {}

func Area(this &copy Square) i32 {
  this.side * this.side
}

// 多态调用
func GetArea(shape &copy Shape) i32 {
  shape.Area()
}

func Example() i32 {
  var rectangle := Rectangle(6, 7);
  var square := Square(5);
  GetArea(rectangle) + GetArea(square)
}

CW 能力演示

模型推理

用 CW 实现模型推理,编译成 WebAssembly,在浏览器中运行查看对应代码

从几句话开始,看看故事会走向哪里

点击开始后下载 1.06 MB 权重

输出

输入处理:尚未开始输出生成:尚未开始

生成的内容会逐步显示在这里