[Chicken-users] Chicken module and application project source structure

2019-09-23 Thread David Christensen

chicken-users:

For a noob first project, I would like to write a command-line utility 
in Chicken Scheme:


  Usage: update [options] [src] dst

  Copy file src to file dst if contents are different.
  Read STDIN if src is '-' or if src is omitted.

  Options:
  --create  Create dst if it does not exist (default)
  --nocreateExit with error if dst does not exist


I would like to put the functionality into a library source file and put 
the command-line interface into a program source file that includes or 
uses the library.



Is there an convention for Chicken project source directory and file 
structure?



What about toolchain conventions? (E.g. Makefile?)


Is there anything analogous to Perl's h2xs, module-starter, 
ExtUtils::MakeMaker, Module::Build, etc?



David

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Debian 9 amd64 chicken-bin 4.11.0-1 cannot import from undefined module process-context

2019-09-18 Thread David Christensen

On 9/17/19 10:46 PM, Mario Domenech Goulart wrote:

$ wgethttp://code.call-cc.org/releases/5.1.0/chicken-5.1.0.tar.gz
$ tar xzvf chicken-5.1.0.tar.gz 
$ cd chicken-5.1.0

$ make PLATFORM=linux PREFIX=$HOME/local/chicken-5.1.0 install



$ export PATH=$PATH:$HOME/local/chicken-5.1.0/bin



On 9/17/19 11:09 PM, Peter Bex wrote:

You don't need to be root if you set PREFIX to a user-writable
directory.



Remove Debian chicken-bin:

2019-09-17 23:16:26 root@tinkywinky ~
# apt-get remove chicken-bin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer 
required:

  libchicken-dev libchicken8 libpcre3-dev libpcre32-3 libpcrecpp0v5
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  chicken-bin
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 5903 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 115436 files and directories currently installed.)
Removing chicken-bin (4.11.0-1) ...
Processing triggers for man-db (2.7.6.1-2) ...

2019-09-17 23:17:15 root@tinkywinky ~
# apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  libchicken-dev libchicken8 libpcre3-dev libpcre32-3 libpcrecpp0v5
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation, 14.9 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 115333 files and directories currently installed.)
Removing libchicken-dev (4.11.0-1) ...
Removing libchicken8 (4.11.0-1) ...
Removing libpcre3-dev:amd64 (2:8.39-3) ...
Removing libpcre32-3:amd64 (2:8.39-3) ...
Removing libpcrecpp0v5:amd64 (2:8.39-3) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for man-db (2.7.6.1-2) ...


Download Chicken tarball with Firefox.


Checksum:

2019-09-17 23:23:58 dpchrist@tinkywinky 
~/samba/dpchrist/Downloads/c/chicken-scheme

$ ll
total 4109
drwxr-xr-x+  2 dpchrist dpchrist   0 2019-09-17 23:23:17 ./
drwxr-xr-x+ 38 dpchrist dpchrist   0 2019-09-17 23:21:59 ../
-rw-r--r--+  1 dpchrist dpchrist  86 2019-09-17 23:23:04 SHA256SUM
-rw-r--r--+  1 dpchrist dpchrist 4071169 2019-09-17 23:22:04 
chicken-5.1.0.tar.gz


2019-09-17 23:23:42 dpchrist@tinkywinky 
~/samba/dpchrist/Downloads/c/chicken-scheme

$ cat SHA256SUM
5c1101a8d8faabfd500ad69101e0c7c8bd826c68970f89c270640470e7b84b4b 
*chicken-5.1.0.tar.gz


2019-09-17 23:24:05 dpchrist@tinkywinky 
~/samba/dpchrist/Downloads/c/chicken-scheme

$ sha256sum -c SHA256SUM
chicken-5.1.0.tar.gz: OK


Build:

2019-09-17 23:26:31 dpchrist@tinkywinky ~/build
$ tar -xzf ~/samba/dpchrist/Downloads/c/chicken-scheme/chicken-5.1.0.tar.gz

2019-09-17 23:27:17 dpchrist@tinkywinky ~/build
$ cd chicken-5.1.0/

2019-09-17 23:28:23 dpchrist@tinkywinky ~/build/chicken-5.1.0
$ make PLATFORM=linux PREFIX=$HOME/local/chicken-5.1.0 install
echo '#define C_CHICKEN_PROGRAM "chicken"' >> chicken-defaults.h
echo '#ifndef C_INSTALL_CC' >> chicken-defaults.h
echo '# define C_INSTALL_CC "gcc"' >> chicken-defaults.h

install -m 644 ./LICENSE 
"/home/dpchrist/local/chicken-5.1.0/share/chicken/doc"
install -m 644 ./setup.defaults 
"/home/dpchrist/local/chicken-5.1.0/share/chicken"
install -m 644 ./feathers.tcl 
"/home/dpchrist/local/chicken-5.1.0/share/chicken"



Adjust PATH:

2019-09-17 23:47:49 dpchrist@tinkywinky ~
$ export 
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/dpchrist/local/chicken-5.1.0/bin



Test:

2019-09-17 23:49:00 dpchrist@tinkywinky ~
$ cd sandbox/chicken-scheme

2019-09-17 23:49:43 dpchrist@tinkywinky ~/sandbox/chicken-scheme
$ csc -o palindrome palindrome.scm

2019-09-17 23:50:26 dpchrist@tinkywinky ~/sandbox/chicken-scheme
$ ./palindrome level
level is a palindrome

2019-09-17 23:50:33 dpchrist@tinkywinky ~/sandbox/chicken-scheme
$ ./palindrome label
label isn't a palindrome


Thank you, everyone.  :-)


David

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Debian 9 amd64 chicken-bin 4.11.0-1 cannot import from undefined module process-context

2019-09-18 Thread David Christensen

On 9/17/19 10:36 PM, Vasilij Schneidermann wrote:

Hey David,

You're using version 4 of the compiler, but version 5 of the documentation. You 
can tell the latter by looking for the number in the URL.



Thanks for the tip.


Taking a stab in the dark:

http://wiki.call-cc.org/man/4/The%20User's%20Manual

http://wiki.call-cc.org/man/4/Getting%20started

2019-09-17 22:49:46 dpchrist@tinkywinky ~/sandbox/chicken-scheme-4
$ cat palindrome.scm
;;; http://wiki.call-cc.org/man/4/Getting%20started
;;; downloaded 2019-09-17

(define (palindrome? x)
  (define (check left right)
(if (>= left right)
#t
(and (char=? (string-ref x left) (string-ref x right))
 (check (add1 left) (sub1 right)
  (check 0 (sub1 (string-length x
(let ((arg (car (command-line-arguments
  (display
   (string-append arg
  (if (palindrome? arg)
  " is a palindrome\n"
  " isn't a palindrome\n"

2019-09-17 22:50:17 dpchrist@tinkywinky ~/sandbox/chicken-scheme-4
$ csc -o palindrome palindrome.scm

2019-09-17 22:50:24 dpchrist@tinkywinky ~/sandbox/chicken-scheme-4
$ ./palindrome level
level is a palindrome

2019-09-17 22:50:29 dpchrist@tinkywinky ~/sandbox/chicken-scheme-4
$ ./palindrome liver
liver isn't a palindrome


The current release of Chicken appears to be 5.1.0:

https://code.call-cc.org/


I do not see a Debian backport:

https://packages.debian.org/search?keywords=chicken=names=all=stretch-backports


Only a Sid package (no thanks; I prefer stability):

https://packages.debian.org/search?keywords=chicken=names=all=all


Does anyone have any experiencing compiling, installing, and running 
Chicken 5.1.0 from a source tarball on Debian 9?  Can I do this with a 
normal user account?



David

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Debian 9 amd64 chicken-bin 4.11.0-1 cannot import from undefined module process-context

2019-09-17 Thread David Christensen

chicken-users:

I am Chicken noob with (e-mail addresses redacted):

2019-09-17 22:06:21 root@tinkywinky ~
# cat /etc/debian_version
9.11

2019-09-17 22:10:03 root@tinkywinky ~
# uname -a
Linux tinkywinky 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3 (2019-09-02) 
x86_64 GNU/Linux


2019-09-17 22:15:35 root@tinkywinky ~
# dpkg-query -s chicken-bin
Package: chicken-bin
Status: install ok installed
Priority: optional
Section: lisp
Installed-Size: 5765
Maintainer: Davide Puricelli (evo) 
Architecture: amd64
Source: chicken
Version: 4.11.0-1
Replaces: chicken, chicken-dev
Depends: libc6 (>= 2.4), libchicken8 (>= 4.11.0), libchicken-dev (= 
4.11.0-1)

Conflicts: chicken, chicken-dev
Description: Practical and portable Scheme system - compiler
 CHICKEN is a Scheme compiler which compiles a subset of R5RS into C.
 It uses the ideas presented in Baker's paper "Cheney on the MTA", and
 has a small core and is easily extendable.
 .
 This package contains the compiler.
Homepage: http://www.call-cc.org


I am attempting to follow:

http://wiki.call-cc.org/man/5/Getting%20started


I have created a Scheme program source file:

2019-09-17 22:07:12 dpchrist@tinkywinky ~/sandbox/chicken-scheme
$ cat palindrome.scm
;;; http://wiki.call-cc.org/man/5/Getting%20started
;;; downloaded 2019-09-17

(import (chicken process-context)) ; for "command-line-arguments"

(define (palindrome? x)
  (define (check left right)
(if (>= left right)
#t
(and (char=? (string-ref x left) (string-ref x right))
 (check (add1 left) (sub1 right)
  (check 0 (sub1 (string-length x

(let ((arg (car (command-line-arguments
  (display
   (string-append arg
  (if (palindrome? arg)
  " is a palindrome\n"
  " isn't a palindrome\n"


When I try to compile:

2019-09-17 22:07:15 dpchrist@tinkywinky ~/sandbox/chicken-scheme
$ csc -o palindrome palindrome.scm

Syntax error (import): cannot import from undefined module

process-context

Expansion history:

(##core#begin (import (chicken process-context)))
(import (chicken process-context))<--

Error: shell command terminated with non-zero exit status 17920: 
'/usr/bin/chicken' 'palindrome.scm' -output-file 'palindrome.c'



I appear to be missing the module "chicken process-context", which is 
supposed to be included (?):


http://wiki.call-cc.org/man/5/Included%20modules


Suggestions?


David

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users