Fix typo and implement dummy version (without api calls) in chicken scheme

This commit is contained in:
heyarne 2022-07-08 15:36:58 +02:00
commit f08114fa0d
2 changed files with 43 additions and 11 deletions

View file

@ -11,20 +11,49 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib; lib = pkgs.lib;
# FIXME: Lua is borked at the moment :( # FIXME: Lua is borked at the moment :(
# lua = pkgs.lua5_3.withPackages(ps: with ps; [ lua = pkgs.lua5_3.withPackages(ps: with ps; [
# readline readline
# # cjson cjson
# # http http
# luarocks luarocks
# ]); ]);
# fennel = pkgs.fennel.override { lua = lua; }; fennel = pkgs.fennel.override { lua = lua; };
gambit = pkgs.callPackage "${nixpkgs.outPath}/pkgs/development/compilers/gambit/build.nix" rec {
version = "4.9.4";
git-version = version;
src = pkgs.fetchFromGitHub {
owner = "gambit";
repo = "gambit";
rev = "3bbd8a2959670c145f73cd25740d99a6834ac787";
sha256 = "111hhqkmn9knqbyfzxxg81sshyh3p6n7ywp32vrhx1ckqdk7rcjf";
};
};
in { in {
devShells.default = pkgs.mkShell rec { devShells.default = pkgs.mkShell rec {
buildInputs = [ buildInputs = [
lua
# fennel
pkgs.chicken pkgs.chicken
# pkgs.guile_3_0 # pkgs.guile_3_0
# pkgs.gcc
# pkgs.gambit
]; ];
# LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
};
packages.default = pkgs.mkDerivation rec {
buildInputs = [
pkgs.chicken
# pkgs.guile_3_0
pkgs.gcc
pkgs.gambit
];
buildPhase = ''
chicken ./main.scm -explicit-use
gcc
'';
LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
}; };
}); });
} }

View file

@ -1,9 +1,10 @@
(import (chicken io) (import (chicken io)
(chicken process-context) (chicken process-context)
(chicken random)) (chicken random)
(chicken format))
(define *api-url* (get-environment-variable "MASTODON_API_URL")) (define *api-url* (get-environment-variable "MASTODON_API_URL"))
(define *access-tolen* (get-environment-variable "MASTODON_ACCESS_TOKEN")) (define *access-token* (get-environment-variable "MASTODON_ACCESS_TOKEN"))
(define (file-lines file-path) (define (file-lines file-path)
(let ((file (open-input-file file-path))) (let ((file (open-input-file file-path)))
@ -28,4 +29,6 @@
(cons (car ls) (list-remove-nth (cdr ls) (- n 1))))) (cons (car ls) (list-remove-nth (cdr ls) (- n 1)))))
(let ((nth (pseudo-random-integer (length lines)))) (let ((nth (pseudo-random-integer (length lines))))
(display (list-nth lines nth))) (display "Seize the means of ")
(display (list-nth lines nth))
(display "\n"))