Re: [Chicken-users] Parsing Simple Markup
Did I already recommend this? Sorry if that's a duplication. One more example of SXML together with SRFI 110 sweet expressions (indent sensitive LISP syntax). Those two blend well together. I'm using them embedded in XML (XSLT) here: http://ball.askemos.org/Aa176138e655369f8c01c3044ced70cfc (Be sure to view this as source, not in the browser!) Remarks: a) this is served from Chicken b) it's a rather simple but complete payment system, docs coming up here: http://ball.askemos.org/A0cd6168e9408c9c095f700d7c6ec3224/?_v=search_id=1856_go=2 Wilma, Fred and Bamm-Bamm are each running the script above. Best /Jörg Am 21.09.2014 um 22:34 schrieb Arthur Maciel: Dear Yves, with SXML you could write transformation rules as Peter has shown in www.more-magic.net/docs/scheme/sxslt.pdf http://www.more-magic.net/docs/scheme/sxslt.pdf. I'm not experienced with SXML, but AFAIK they would generate a similar effect as the procedures in your example below. Best wishes, Arthur 2014-09-21 17:06 GMT-03:00 Yves Cloutier yves.clout...@gmail.com mailto:yves.clout...@gmail.com: Hello Oleg, Thank you for your recommendations too. I actually just came back from the local library where I picked up The Scheme Programming Language. You know, reading through your reply, it was the last part that made me think about something. If I can convert my input to the format: (bold text) (indent 5 text) (bold (smallcap (size 2 text))) Could I not define each of these as functions (or procedures), and then just call an (eval ' ) procedure to do my output? For example (keeping in mind I'm only just getting familiar with Scheme syntax!): (define (bold (text) (print the opening tag for the command 'bold') (print the string 'text') (print the closing tag for the command 'bold')) (define (indent (indent-value text) (print the opening tag for the command 'indent' with value of 'indent-value') (print the string 'text') (print the closing tag for the command 'indent')) Actually due to the possible presence of nested commands, it should probably be something more generic, since in the last example: (bold (smallcap (size 2 text))) what the procedure 'bold' would be taking in is not a string text, but rather an expression...so this is where I guess things would need to be recursive. Once my document has been converted into one big s-expression, and procedures defined accordingly, then I could just (eval ) it..couldn't I? (eval '(bold text) (indent 5 text) (bold (smallcap (size 2 text Or something along those lines? If this is the casebrilliant! ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Parsing Simple Markup
Hi, Actually due to the possible presence of nested commands, it should probably be something more generic, since in the last example: (bold (smallcap (size 2 text))) what the procedure 'bold' would be taking in is not a string text, but rather an expression...so this is where I guess things would need to be recursive. The evaluation rules will evaluate things in the correct order. So (size 2 text) will be evaluated first, then (smallcap ) and then (bold ). It's deliberately unspecified in which order 2 or text will be evaluated in. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] T-DOSE 2014?
On Fri, Jun 20, 2014 at 01:55:26PM +0200, Peter Bex wrote: See y'all at T-DOSE! Just a quick reminder and an update that the schedule has been published: http://www.t-dose.org/2014/schedule/full Cheers, Peter -- http://www.more-magic.net ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Termite revival
Hello dear users of the fowl, I’ve been wondering for quite some time now on how to revive the Termite project. Looks like I started a new implementation of the API using CHICKEN facilities instead of trying the (now seemingly dead) original implementation. I’d like some reviews before going further, because I based my implementation on the assumption that thread signaling and exceptions handlers are thread safe. It’s just a draft for now, and many things are still subject to changes. I also found a very odd bug here: try sending a message to a dead thread, it looks like the thunk is called again. Thank you is advance. ;; Code begins here (use srfi-18 data-structures matchable) (define mailbox (make-parameter #f)) (define lastmail (make-parameter '(#t . #f))) (define ((handle-signal hdl) s) (cond ((and (pair? s) (eqv? (car s) 'message-send)) (queue-add! (mailbox) (cdr s))) ((and (symbol? s) (eqv? s 'message-receive)) (let ((m (mailbox))) (if (queue-empty? m) (lastmail '(#t . #f)) (lastmail `(#f . ,(queue-remove! m)) (else (hdl s (define (install-signal-handler) (current-exception-handler (handle-signal (current-exception-handler (define (setup-thread) (mailbox (make-queue)) (install-signal-handler)) (define self current-thread) (define (?) (signal 'message-receive) (let ((last (lastmail))) (if (car last) (begin (thread-suspend! (current-thread)) (?)) (cdr last (define (! pid msg) (thread-signal! pid (cons 'message-send msg)) msg) (define (spawn thunk) ; FIXME ; We need a way to ensure that the custom exception handler is set up ; before anybody has the PID of the thread. ; One way would be to make a tag in the spawner. The child would send that ; tag to its parent, which would receive it with `??` (which is not yet ; implemented) (let* ((pid (make-thread (lambda () (setup-thread) ; (! parent tag) (thunk) (thread-start! pid) ; (?? (cut eqv? tag )) pid)) ; Primordial thread setup (setup-thread) ; Tests ; Lots-of-threads-and-messages test (define primordial (self)) (define message-number 100) (define thread-number 1000) (define (spam) (let loop ((i message-number)) (unless (zero? i) (! primordial i) (loop (sub1 i) (let loop ((i thread-number)) (unless (zero? i) (spawn spam) (loop (sub1 i (let loop ((i (* thread-number message-number))) (unless (zero? i) (?) (loop (sub1 i (assert (zero? (queue-length (mailbox ; Ping-pong test (define (pong-server) (let ((m (?))) (match m ((pid 'ping) (! pid 'pong) (pong-server)) (else (pong-server) (define pong (spawn pong-server)) (thread-sleep! 1) ; make sure the pong thread is set up (see note in (spawn)) (! pong `(,(self) ping)) (assert (eqv? (?) 'pong)) -- Envoyé depuis ma GameBoy. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] 'make check' of chicken 4.9.0.1 on alpine linux 3.0.4 i686 with musl c-library (after a successful build).
Hello, Below is a log of 'bash-$ make check PLATFORM=linux' on the platform listed in the subject of this email. I'm hoping to get CHICKEN to build and check successfully with the musl C library. Thanks, Zachary Storer (aka zacts) -- make -f ./Makefile.linux CONFIG= check make[1]: Entering directory '/home/zacts/chicken-4.9.0.1' cd tests; sh runtests.sh version tests ... Checking major and minor version numbers against chicken-version... ok Checking the registered feature chicken-major.minor... ok compiler tests ... /home/zacts/chicken-4.9.0.1/tests/../chicken 'compiler-tests.scm' -output-file 'a.c' -types ../types.db -ignore-repository -verbose -include-path /home/zacts/chicken-4.9.0.1/tests/.. Warning: in toplevel procedure `foo': (compiler-tests.scm:9) in procedure call to `bar11', expected 0 arguments, but was given 1 argument Note: global variable `foo#bar' is only locally visible and never used Note: global variable `bla#blabla' is only locally visible and never used 'gcc' 'a.c' -o 'a.o' -c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -I/home/zacts/chicken-4.9.0.1/tests/.. -I/usr/local/include/chicken rm a.c 'gcc' 'a.o' -o 'a.out' -L/home/zacts/chicken-4.9.0.1/tests/.. -Wl,-R/home/zacts/chicken-4.9.0.1/tests/.. -L/usr/local/lib -Wl,-R/usr/local/lib -lchicken -lm -ldl rm a.o 12 12 12 12 12 bar 1 2 3 1 2 3 :1:2:3 1 2 3 Good, unrepresentable C strings cause errors compiler inlining tests ... /home/zacts/chicken-4.9.0.1/tests/../chicken 'inlining-tests.scm' -output-file 'a.c' -types ../types.db -ignore-repository -verbose -include-path /home/zacts/chicken-4.9.0.1/tests/.. -optimize-level 3 'gcc' 'a.c' -o 'a.o' -c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -I/home/zacts/chicken-4.9.0.1/tests/.. -I/usr/local/include/chicken rm a.c 'gcc' 'a.o' -o 'a.out' -L/home/zacts/chicken-4.9.0.1/tests/.. -Wl,-R/home/zacts/chicken-4.9.0.1/tests/.. -L/usr/local/lib -Wl,-R/usr/local/lib -lchicken -lm -ldl rm a.o scrutiny tests ... /home/zacts/chicken-4.9.0.1/tests/../chicken 'typematch-tests.scm' -output-file 'a.c' -types ../types.db -ignore-repository -verbose -include-path /home/zacts/chicken-4.9.0.1/tests/.. -specialize -no-warnings 'gcc' 'a.c' -o 'a.o' -c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -w -I/home/zacts/chicken-4.9.0.1/tests/.. -I/usr/local/include/chicken rm a.c 'gcc' 'a.o' -o 'a.out' -L/home/zacts/chicken-4.9.0.1/tests/.. -Wl,-R/home/zacts/chicken-4.9.0.1/tests/.. -L/usr/local/lib -Wl,-R/usr/local/lib -lchicken -lm -ldl rm a.o check fixnum 123 check string abc check symbol (quote abc) check char x check true #t check false #f check number (+ 1 2) check (list fixnum) (quote (1)) check (list symbol) (quote (a)) check (list fixnum) (list 1) check pair (quote (1 . 2)) check procedure + check vector (quote #(1)) check null (quote ()) check input-port (current-input-port) check blob (make-blob 10) check pointer (address-pointer 0) check pointer-vector (make-pointer-vector 1) check locative (make-locative a) check (struct promise) (##sys#make-structure (quote promise)) check (pair fixnum float) (quote (1 . 2.3)) check (vector symbol) (quote #(a)) check (list string) (quote (ok)) specialize fixnum specialize not fixnum specialize string specialize not string specialize symbol specialize not symbol specialize char specialize not char specialize true specialize not true specialize false specialize not false specialize (list fixnum) specialize not (list fixnum) specialize pair specialize not pair specialize procedure specialize not procedure specialize (vector fixnum) specialize not (vector fixnum) specialize null specialize not null specialize undefined specialize not undefined specialize input-port specialize not input-port specialize blob specialize not blob specialize pointer specialize not pointer specialize pointer-vector specialize not pointer-vector specialize locative specialize not locative specialize (struct promise) specialize not (struct promise) specialize (pair fixnum float) specialize not (pair fixnum float) specialize (vector symbol) specialize not (vector symbol) specialize (or (list fixnum) symbol) specialize not (or (list fixnum) symbol) specialize (list fixnum) specialize not (list fixnum) specialize (or null pair) specialize not (or null pair) check predicate true boolean? check predicate false boolean? check predicate pair pair? check predicate null null? check predicate symbol symbol? check predicate number number? check predicate number number? check predicate fixnum exact? check predicate number real? check predicate number complex? check predicate float inexact? check predicate char char? check predicate string string? check predicate vector vector? check