5 ms·
Factor is general-purpose and you can write most anything you want at this point. Here's tar in Factor: https://github.com/slavapestov/factor/blob/master/extr
by gre 12y ago
Factor is general-purpose and you can write most anything you want at this point.
Here's tar in Factor:
https://github.com/slavapestov/factor/blob/master/extra/tar/tar.factor https://github.com/slavapestov/factor/blob/master/extra/tar/...
For untarring the linux kernel, Factor tar beats /usr/bin/tar on my Mac by 1s, but 30s vs 6s on Linux for some reason. Could be SSD vs spinning disk, or worse i/o code on Linux. Funnily, there are about 10 files that differ in case only, and Mac file system is case-insensitive by default, so you can't even untar the linux kernel correctly.
Here's host using the dns client library:
https://github.com/slavapestov/factor/blob/master/extra/tools/dns/dns.factor https://github.com/slavapestov/factor/blob/master/extra/tool...
https://github.com/slavapestov/factor/blob/master/extra/dns/dns.factor https://github.com/slavapestov/factor/blob/master/extra/dns/...
I wrote it because gethostbyname is blocking and Factor has nonblocking i/o for everything else.
There's a cross-platform disk usage tool that outputs the same stuff as df but works on Windows too:
https://github.com/slavapestov/factor/blob/master/basis/tools/files/files.factor https://github.com/slavapestov/factor/blob/master/basis/tool...
USE: tools.files file-systems.
There's a high-level library for doing whatever you want with unix users/groups:
https://github.com/slavapestov/factor/blob/master/basis/unix/users/users-tests.factor https://github.com/slavapestov/factor/blob/master/basis/unix...
effective-user-name [ ] with-effective-user
effective-user-id [ ] with-effective-user
all-users
https://github.com/slavapestov/factor/blob/master/basis/unix/groups/groups-tests.factor https://github.com/slavapestov/factor/blob/master/basis/unix...
effective-group-name [ ] with-effective-group
effective-group-id [ ] with-effective-group
all-groups
Graphics demo--raytraced spheres using GLSL on a checkerboard pattern, spheres each play their own music:
https://github.com/slavapestov/factor/tree/master/extra/gpu/demos/raytrace https://github.com/slavapestov/factor/tree/master/extra/gpu/...
https://github.com/slavapestov/factor/blob/master/extra/gpu/demos/raytrace/raytrace.factor https://github.com/slavapestov/factor/blob/master/extra/gpu/...
The main file that sets up the world and loads the shaders and sound is 130 lines and reuses the game library.