'define' not visible in environment created with 'module-environment'
Hi All, I have the following program #!/usr/bin/env -S csi -script ;; -*- mode: scheme -*- (import (chicken pretty-print)) (import (chicken eval)) (module temp * (import scheme) (import (chicken base)) (import (chicken syntax))) (define eval-env (module-environment 'temp)) (pretty-print (eval '(+ 11 19) eval-env)) ; => prints 30 as expected (pretty-print (eval '(define a 15) eval-env)) ; => unbound variable: define What I basically want to implement (later) is a kind of REPL in a "clean" or controlled environment. This program is just a preparatory experiment. What do I have to do / do I have to import (?) into the temp module so that my eval sees 'define'? I've only recently returned to scheme and probably missing s.th. basic. Best Regards + Thanks -- Markus
[Chicken-users] Egg: chicken-update (program)
I've created a simple program to update outdated eggs. At the moment, it only works with the default servers, as it looks through the egg RSS sxml file to determine new versions. By default, it ignores eggs with 'unknown' version (with a toggle to try installing them, alerting you if not found upstream), and you can pin eggs by regex. Other options are passed to chicken-install. I've tested with test-new-egg, here's the release file url: https://code.dieggsy.com/chicken-update/plain/chicken-update.release-info It's probably possible to talk to the server directly and support custom egg servers in the future, but ATM the only way I can think of doing it is to query the server for each egg's version (as henrietta doesn't support listing all eggs with the latest version), and that seems like it could be slow and expensive, esp. with more eggs installed. - Diego _______ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Snowtar C5 patch
> Are you talking abouthttp://snow-fort.org/? Ooh, another handy collection to port to Chicken! Didn't know about this one either. :) > In case you are talking about the old Scheme Now! instead of snow-fort, > IIRC most of those packages have been imported into snow-fort and/or > some other, more modern package collection. Might want to diff the old > snow and snow-fort package listings. I was talking about this one: https://web.archive.org/web/20190203021849/http://snow.iro.umontreal.ca/?tab=Packages It did seem fairly old, and some of that functionality actually is in chicken scheme (tar, digest, hostos, sort, etc.), but there are still some packages that stand out and seem fairly practical. It seems like a lot of it isn't in snow-fort.org, as far as I can tell (pi, tar, digest, rsa, more...). Marc Feeley is who I spoke about emailing earlier - it's only been like a day, I'm not in a rush. Though if you know some other place that code might be, let me know. - Diego _______ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Snowtar C5 patch
Snowtar seems like a useful tool to have. I've made the appropriate C5 compatibility changes (mostly just an egg file and cond-expands for imports), it'd be nice to have this in the C5 repo. I don't think I can actually push these changes upstream myself, or change the release-info file either, so I'm including a patch with my changes attached to this message. Hopefully someone with access can help me out here? I may also port over snowdigest. Additionally, if anyone knows of a mirror for scheme now! packages/code, I'd love to explore these and package some up for C5 (I'm awaiting on a response from the person who maintained the website, as far as I can tell). Looking on web archive, there's some pretty fun and interesting sounding stuff in there. Maybe we could create a snow compatibility egg to avoid code duplication across snow eggs. - Diego diff -uN snowtar-old/snow-compatibility.scm snowtar/snow-compatibility.scm --- snowtar-old/snow-compatibility.scm 2019-09-16 13:47:22.858957823 -0400 +++ snowtar/snow-compatibility.scm 2019-09-16 13:50:39.929497771 -0400 @@ -1,7 +1,9 @@ snow-compatibility.scm -(import (except miscmacros define-macro)) +(cond-expand + (chicken-4 (import (except miscmacros define-macro))) + (chicken-5 (import miscmacros))) (define-syntax-rule (define-alias-syntax new old) @@ -93,7 +95,7 @@ (blob->u8vector/shared (string->blob (get-output-string p (definternal (genport-read-file fname) - (blob->u8vector/shared (string->blob (read-all fname + (blob->u8vector/shared (string->blob (read-string #f fname ;;; homovector diff -uN snowtar-old/snowtar.egg snowtar/snowtar.egg --- snowtar-old/snowtar.egg 1969-12-31 19:00:00.0 -0500 +++ snowtar/snowtar.egg 2019-09-17 01:53:00.038609724 -0400 @@ -0,0 +1,8 @@ +((synopsis "TAR file format packing and unpacking.") + (category parsing) + (license "LGPL-2.1") + (author "Marc Feeley") + (maintainer "felix winkelmann") + (dependencies miscmacros) + (component-options (csc-options "-O3" "-d1")) + (components (extension snowtar (source "snowtar-module.scm" diff -uN snowtar-old/snowtar-module.scm snowtar/snowtar-module.scm --- snowtar-old/snowtar-module.scm 2019-09-16 13:47:23.062294910 -0400 +++ snowtar/snowtar-module.scm 2019-09-16 13:44:44.232858069 -0400 @@ -28,7 +28,11 @@ tar-unpack-u8vector tar-read-file) -(import scheme chicken) +(import scheme) + +(cond-expand + (chicken-4 (import chicken)) + (chicken-5 (import chicken.base))) (include "snowtar.scm") diff -uN snowtar-old/snowtar.scm snowtar/snowtar.scm --- snowtar-old/snowtar.scm 2019-09-16 13:47:23.575637709 -0400 +++ snowtar/snowtar.scm 2019-09-16 13:49:26.181329275 -0400 @@ -1,7 +1,20 @@ snowtar.scm -(use srfi-4 numbers lolevel posix utils data-structures) +(cond-expand + (chicken-4 (use srfi-4 numbers lolevel posix utils data-structures)) + (chicken-5 + (import srfi-4 + chicken.condition + chicken.fixnum + chicken.blob + chicken.string + chicken.io + chicken.memory + chicken.syntax + chicken.time + chicken.file.posix + chicken.file))) (include "snow-compatibility.scm") ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Auto CompletionProblems
Hi and thanks for all the help! I tried what was suggested, but nothing worked... My init.el file is (including other, non related, packages): ``` (require 'package) ;;; Code: (add-to-list 'package-archives '("elpa" . "https://elpa.org/packages/";)) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/";)) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/";)) (package-initialize) ;; bootstrap use-package (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (require 'use-package) ; (setq evil-want-keybinding nil) (use-package python-environment :ensure t) (use-package evil :ensure t :init (setq evil-want-integration t) ;; This is optional since it's already set to t by default. (setq evil-want-keybinding nil) :config (evil-mode 1)) (use-package evil-collection :after evil :ensure t :config (evil-collection-init)) (use-package company :ensure t :config (add-to-list 'company-backends 'company-files) (add-hook 'after-init-hook 'global-company-mode) (setq company-minimum-prefix-length 1) (setq company-idle-delay 0) (company-quickhelp-mode) ) (use-package company-jedi ;;; company-mode completion back-end for Python JEDI :ensure t :config (setq jedi:environment-virtualenv (list (expand-file-name "~/.emacs.d/.python-environments/"))) (add-hook 'python-mode-hook 'jedi:setup) (setq jedi:complete-on-dot t) (setq jedi:use-shortcuts t) (defun config/enable-company-jedi () (add-to-list 'company-backends 'company-jedi)) (add-hook 'python-mode-hook 'config/enable-company-jedi)) (use-package projectile :ensure t :bind-keymap ("C-c p" . projectile-command-map) ) (use-package multiple-cursors :ensure t :config (global-set-key (kbd "C-x c") 'mc/edit-lines) (global-set-key (kbd "C-x x") 'mc/mark-all-like-this) (global-set-key (kbd "M-p") 'mc/mark-previous-like-this) (global-set-key (kbd "M-n") 'mc/mark-next-like-this)) (use-package flycheck :ensure t :config (global-flycheck-mode)) (use-package yasnippet :ensure t :defer 2 :diminish yas-minor-mode :config (setq yas-snippet-dirs '("~/.emacs.d/yasnippet-snippets")) (yas-global-mode 1)) (setq geiser-active-implementations '(chicken)) (setq geiser-scheme-implementation "/home/vag/chicken-scheme/bin/csi") (define-key global-map (kbd "C-c C-f") 'ace-jump-char-mode) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(custom-enabled-themes (quote (wombat))) '(package-selected-packages (quote (neotree yasnippet flycheck multiple-cursors ace-jump-mode company-quickhelp ace-isearch paredit quack ac-geiser scheme-complete geiser chicken-scheme ycm company-jedi python-environment epc projectile racket-mode use-package evil-collection slime evil (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) (set-face-attribute 'default nil :height 150) (setq inferior-lisp-program "/usr/bin/sbcl") (setq scheme-program-name "/home/vag/chicken-scheme/bin/csi -:c") (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t) (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode) (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode) (add-hook 'ielm-mode-hook #'enable-paredit-mode) (add-hook 'lisp-mode-hook #'enable-paredit-mode) (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode) (add-hook 'scheme-mode-hook #'enable-paredit-mode) (global-linum-mode t) (provide 'init) ;;; Init.el ends here ```___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Auto CompletionProblems
> 1. You only ever get auto-completion for the things you have > loaded/imported in the geiser repl. > I know that what should happen, but is isn't what happaning. > 2. Is company mode active? Yes, it works for some things (functions defines with define, for example) > 3. Did you install apropos and chicken-doc, and populated the > documentation database with > > > > $ cd `csi -R chicken.platform -p '(chicken-home)'` > > $ curl https://3e8.org/pub/chicken-doc/chicken-doc-repo-5.tgz | sudo tar zx > No, I didn't do it before, but I tried it now and didn't change anything... > 4. Not sure why you need jedi? That's for python, no? > > On 8/2/19 10:19 AM, EfraimVagner via Chicken-users wrote: > I'm actually not sure, I don't really know what does what, so I just said what I installed. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Auto CompletionProblems
On Friday, August 2, 2019 11:17 AM, EfraimVagner via Chicken-users wrote: > Hi, > So I'm working on a small project to learn Chicken Scheme. I'm using Emacs + > Geiser. > 1. I have an issue that when using coops's classes, I don't get > auto-completion to classes varibles, for example: > > (define-class () [(var 0)]) > (define-method (method (class )) > ;; When typing here (slot-value class 'var) the var won't autocomplete > ) > > 2. When importing eggs, I don't get any completion. For example after > importing coops, define-class and slot-value won't auto-complete. (I believe > that if I were to import my own files, it would still won't work) > > 3. In the Geiser REPL itself, I have no auto-complete at all. > > I'm using company and jedi as my auto-completion tools, does anyone know how > to fix this? Thanks! I forgot 4. No auto completion to built in functions, like print, lambda and etc._______ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Auto CompletionProblems
Hi, So I'm working on a small project to learn Chicken Scheme. I'm using Emacs + Geiser. 1. I have an issue that when using coops's classes, I don't get auto-completion to classes varibles, for example: (define-class () [(var 0)]) (define-method (method (class )) ;; When typing here (slot-value class 'var) the var won't autocomplete ) 2. When importing eggs, I don't get any completion. For example after importing coops, define-class and slot-value won't auto-complete. (I believe that if I were to import my own files, it would still won't work) 3. In the Geiser REPL itself, I have no auto-complete at all. I'm using company and jedi as my auto-completion tools, does anyone know how to fix this? Thanks!_______ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Second Call for Participation: ICFP 2019
rance) Ulf Norell (Gothenburg University, Sweden) Atsushi Ohori (Tohoku University, Japan) Rex Page (University of Oklahoma, USA) Zoe Paraskevopoulou (Princeton University, USA) Nadia Polikarpova (University of California, San Diego, USA) Jonathan Protzenko (Microsoft Research, USA) Tiark Rompf (Purdue University, USA) Andreas Rossberg (Dfinity, Germany) KC Sivaramakrishnan (University of Cambridge, UI) Nicholas Smallbone (Chalmers University of Technology, Sweden) Matthieu Sozeau (Inria, France) Sandro Stucki (Chalmers | University of Gothenburg, Sweden) Don Syme (Microsoft, UK) Zachary Tatlock (University of Washington, USA) Sam Tobin-Hochstadt (Indiana University, USA) Takeshi Tsukada (University of Tokyo, Japan) Tarmo Uustalu (Reykjavik University, Iceland) Benoit Valiron (LRI, CentraleSupelec, Univ. Paris Saclay, France) Daniel Winograd-Cort (University of Pennsylvania, USA) Nicolas Wu (University of Bristol, UK) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Releasing an egg
Hello, I am ready to release an egg and would like to have it published.Do I need special permissions to add this to egg-locations? The egg is an HTTP2 header compression library (HPACK). It is available at https://github.com/shorbaji/hpack. - Omar ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] ffi howto
Hello, I need some help getting started with ffi. I am attempting to bind libuv to scheme code. My chicken scheme code at http://pastebin.com/bwja0yet fails with the following error. The following code fails with the following: Error: bad argument count - received 152135942 but expected 2: 0 Call history: uv.scm:33: uv-default-loop uv.scm:33: uv-idle-init uv.scm:34: uv-idle-start uv.scm:36: uv-default-loop uv.scm:36: uv-run <-- I am attempting to port the following C code. http://pastebin.com/63gP8HFT - Omar ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Chicken manual in Texinfo format
On Fri, Jun 01, 2007 at 12:43:28AM +, Alejandro Forero Cuervo wrote: > > Can you provide a simplistic example of how an egg would be documented > in the wiki using these tags and what the actual html produced would > be? > > Thanks! > Is it possible to have syntax along the lines of the following example. Basically, I want to have fixed section names and some code that checks that all of the required sections are present in the wiki page. Also, it would be nice to have something like the procedure and symbol-table formatting elements in eggdoc. And I would prefer that the HTML generated out of this is as close to the that produced by the eggdoc tool as possible. Or maybe generate sxml that is then parsed using the eggdoc stylesheet? Anyway, here is the minimalistic example. == Name digraph == Description Directed graph in adjacency list format == Author [mailto:[EMAIL PROTECTED]|Ivan Raikov] == History * Version 1.3 Updated the roots procedure to match the documentation * Version 1.0 Initial release == Requires [dyn-vector.html|dyn-vector] == Usage (require-extension digraph) == Download [digraph.egg|digraph.egg] == Documentation The digraph library is an implementation of a directed graph, where the edges are stored as adjacency lists. === Directed graph procedures The digraph object is created by procedure make-digraph, which is the only user-visible procedure defined in this egg: ; Procedure: make-digraph:: NAME INFO [NODE-LIST [SUCC-LIST [PRED-LIST]]] -> SELECTOR The returned selector procedure can take one of the following arguments: ; Describe name: returns the graph name (string or symbol) ; Describe info: returns the graph metadata (arbitrary type) == Examples ;; example adapted from graph example in the Boost library documentation (require-extension srfi-1) (require-extension digraph) (define g (make-digraph 'depgraph "dependency graph")) == License ... _______ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Re: eval and local variables
John Cowan wrote: Chicken Monk scripsit: The way I see it (and which is most likely incorrect :-): regular code has access to variables in the current and enclosing scopes, so the functionality is already there... Yes and no. In particular, in compiled code the compiler can notice exactly which procedures have access to which variables, and only pass the variables that are actually needed, either as additional arguments or as a data structure or (in other Schemes) in registers. If eval were allowed to access locally bound variables, such optimizations would be impossible. Ah, that explains it. I suspected it had something to do with the compiler. Thanks! -- Chicken Monk "God loves ya. And she loves me too." _______ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Re: eval and local variables
Graham Fawcett wrote: Try this instead: (define-macro (eval-with-locals locals expr) `((eval (list 'lambda ',locals ,expr)) ,@locals)) Example: (define z 1000) (let ((x 10) (y 100) (expr '(+ x y z))) (eval-with-locals (x y) expr)) ==> 1110 Cool! It's amazing how much is possible in Scheme. -- Chicken Monk "God loves ya. And she loves me too." _______ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Re: eval and local variables
felix winkelmann wrote: 2. Is it possible to get the "local environment" (which should have access to b and c)? Is there even such a thing, or am I seeing this completely wrong? This is not possible in general, unless you really want to peek into the internal representation of a closure. Thank you for your reply, Felix. You'll have to pardon my ignorance... I am used to Python, where "eval" and "exec" have access to all the variables that regular code has, even in nested scopes. So I was wondering if something similar could be done in Scheme. The way I see it (and which is most likely incorrect :-): regular code has access to variables in the current and enclosing scopes, so the functionality is already there... so maybe it would be possible to have a function (local-environment) that returns an environment containing the local variables? Of course it would need a parent environment, which I don't think environments.egg supports. I will probably need to take a look at the Chicken source code to see how it's *really* implemented. :) Oh, which leads me to another question: I am currently using Chicken 2.6. Judging from the change log, a lot has been changed/added since then. Is the development version stable enough to use for everyday coding, or should I stick with the "official" 2.6 for a while? Thanks, -- Chicken Monk "God loves ya. And she loves me too." _______ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] eval and local variables
Hi, I noticed that the following doesn't work in Chicken: (define a 42) (define (foo b) (let ((c (+ b 1))) (let ((env (interaction-environment))) (eval '(+ a b c) env ; doesn't work with or without the env. (print (foo 3)) Error: unbound variable: b I would expect eval to "know" about b and c as well. The manual, however, points out that it uses (interactive-environment) by default. A few questions: 1. Why is (interactive-environment) the default? (Or, why doesn't eval have access to all the variables that "regular" code would have?) 2. Is it possible to get the "local environment" (which should have access to b and c)? Is there even such a thing, or am I seeing this completely wrong? 3. Are there other ways to make this work? I am aware of the environments egg, but having to manually add values to an environment does not sound very appealing. :-( Of course, it's possible that I completely misunderstand the subject, in which case I would love to be enlightened. :-) Thanks! -- Chicken Monk "God loves ya. And she loves me too." _______ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] eval and local variables
Hi, I noticed that the following doesn't work in Chicken: (define a 42) (define (foo b) (let ((c (+ b 1))) (let ((env (interaction-environment))) (eval '(+ a b c) env ; doesn't work with or without the env. (print (foo 3)) Error: unbound variable: b I would expect eval to "know" about b and c as well. The manual, however, points out that it uses (interactive-environment) by default. A few questions: 1. Why is (interactive-environment) the default? (Or, why doesn't eval have access to all the variables that "regular" code would have?) 2. Is it possible to get the "local environment" (which should have access to b and c)? Is there even such a thing, or am I seeing this completely wrong? 3. Are there other ways to make this work? I am aware of the environments egg, but having to manually add values to an environment does not sound very appealing. :-( Of course, it's possible that I completely misunderstand the subject, in which case I would love to be enlightened. :-) Thanks! -- Chicken Monk "God loves ya. And she loves me too." _______ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Wierd behaviour of process.
On Mon, Jan 15, 2007 at 08:43:27AM +0100, felix winkelmann wrote: > On 1/15/07, Robin Lee Powell <[EMAIL PROTECTED]> wrote: > >On Mon, Jan 15, 2007 at 08:16:58AM +0100, felix winkelmann wrote: > >> On 1/14/07, Robin Lee Powell <[EMAIL PROTECTED]> wrote: > >> > > >> >That made me think that doing a "wait" on the process *is* > >> >behaviour I want, and I should do that. However, process-wait > >> >throws an error if the process has already exited, and I can't > >> >seem to trap it. I tried: > >> > > >> >(condition-case (process-wait pid) (var () #t)) > >> > > >> > >> This should work. Are you running this interactively? > > > >If by interactively you mean with csi: nope; it's in the middle of a > >very complex system with thousands of lines of code in at least 4 > >languages. :-) > > > > Oh, great! ;-) > > Do you use with-exception-handler a lot? This is my first long piece of Scheme code. :-) So, no. > Does the process-wait inside an exception-handler work when run > stand-alone (without the rest of the code)? > > Can you test whether the process is still alive, before doing the > test (perhaps by checking the /proc directory or through some > other hacks)? Ouch. That's all going to take a while; I'll see if I can get back to you. -Robin -- http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ Reason #237 To Learn Lojban: "Homonyms: Their Grate!" Proud Supporter of the Singularity Institute - http://singinst.org/ ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users