laurent.orseau
2021-8-18 09:06:41

At the same time, it could well be implemented this way when you use vector-copy and friends, i.e., copy-on-write. I don’t know how it’s implemented though


badkins
2021-8-18 14:23:45

Someone mentioned Richard Gabriel’s “The Why of Y” in another thread. I’d be curious to see what the following looks like in Rhombus: #lang racket (define ((fac q) n) (if (< n 2) 1 (* n (q (- n 1))))) (define Y (λ (f) (let ([ g (λ (h) (λ (x) ((f (h h)) x))) ]) (g g)))) ((Y fac) 10)


sorawee
2021-8-18 14:54:08

#lang rhombus let factMaker: fun (fact): fun (n): if n < 2: \| 1 \| n * fact(n - 1) let Y: fun (f): let g: fun (h): fun (x): f(h(h))(x) g(g) let fact: Y(factMaker) fact(10) My indentation on if branches is probably “wrong” according to the current proposal, but I like it this way.

Note that I used let everywhere. Using define is kinda “cheating”, because you can accidentally use recursion.


badkins
2021-8-18 15:15:03

Awesome - thanks!


samdphillips
2021-8-18 17:06:06

Oh I was wondering why you didn’t use fun more often. That makes sense.


samdphillips
2021-8-18 17:06:57

More often for the top level forms that is


soegaard2
2021-8-18 17:16:46

Fun fact: fact benchmarks now contain fun fact.


samdphillips
2021-8-18 18:42:21

@ben.knoble brought up on Discord that places don’t inherit (current-directory) and I wrote up a feature request (https://github.com/racket/racket/issues/3965) if anyone wants to chime in on this.


gamburg.m
2021-8-18 19:56:49

@gamburg.m has joined the channel


hj93
2021-8-18 22:35:38

If anybody is kind enough with their time could you give me some feedback on my GitHub? One question I’m trying to answer is if These projects are good enough to get software engineering interviews. There are some projects in racket and Common Lisp and Python. thanks. Here’s my GitHub: http://github.com/jobhdez\|github.com/jobhdez


notjack
2021-8-19 02:46:00

it doesn’t need to be copy-on-write, there just needs to be two subtypes of vector? - one for real vectors and one for subvector views