Re: survey: string external representation
Thanks to everyone who responded. Based on the collected information, i've cobbled together a runtime check for ‘sql-quote’. It and some tests are in the attached program. To play: guile -s normalize.scm guile -s normalize.scm stupid The code assumes Guile 2 DTRT, but if you have doubts, you can sed -i 's/guile-2/&-not-really/' normalize.scm to disable that assumption. In any case, the program should exit successfully, indicating smooth ‘write’ / ‘read’ round-tripping. This is so (both w/ and w/o "stupid") for Guile 1.4.1.124 and 1.8.7. ___ ;; -*- mode: scheme; coding: utf-8 -*- (define EXIT-VALUE #t) ; optimism (define STUPID? (false-if-exception (string=? "stupid" (cadr (command-line) ;; PostgreSQL groks ‘\xXX’ as an octet w/ hex value XX. ;; It also groks raw octets. This is all fine and good. ;; The problem arises when there is a mix of contiguous ;; raw and \x representations, intended to represent a ;; UTF-8 (say) encoded character. ;; ;; It seems Guile ;; - 1.4 DTRT by doing nothing; ;; - 1.6 ???; ;; - 1.8 fails by \x-escaping inconsistently; ;; - 2.0 doesn't have this problem. (cond-expand (guile-2 (define normalize identity)) (else (use-modules (srfi srfi-13) (srfi srfi-14)) (define normalize (or (let* ((ego (char-set ;; These are not strictly necessary for ;; PostgreSQL, but we include them for ;; (Scheme-only) round-trip testing. ;; Doubtlessly, what doubtful ego! #\" #\\)) (ugh (ucs-range->char-set #o177 #o400 #t ego))) (and (not (char-set-every (lambda (ch) ;; Does the octet xrep unmolested? (char=? ch (string-ref (object->string (string ch)) 1))) (char-set-difference ugh ego))) (or (not STUPID?) (begin (set! ugh ego) #t)) ;; Lame. (lambda (s) (define backslash-x (let ((v (make-vector 256))) (char-set-for-each (lambda (ch) (let ((i (char->integer ch))) (vector-set! v i (string-append "\\x" (number->string i 16) ugh) ;; backslash-x (lambda (ch) (vector-ref v (char->integer ch) (let loop ((start 0) (acc '())) (cond ((string-index s ugh start) => (lambda (idx) (loop (1+ idx) (cons* (backslash-x (string-ref s idx)) (substring/shared s start idx) acc ((zero? start) s) (else (string-concatenate-reverse acc (substring/shared s start ;; Cool. identity (define (try s) (simple-format #t "ORIG:\t~S~%NORM:\t~S~%=>\t~A~%~%" s (normalize s) (let ((round (with-input-from-string (with-output-to-string (lambda () (if (eq? identity normalize) (write s) (begin (display #\") (display (normalize s)) (display #\") read))) (cond ((equal? s round) 'SAME) (else (set! EXIT-VALUE #f);-O (string-append "DIFF: [" (number->string (string-length round)) "]|" round "|")) (simple-format #t "Guile ~A~% LANG: ~S~% normalize: ~S~A~%~%" (version) (getenv "LANG") (procedure-name normalize) (if (and STUPID? (not (eq? normalize identity))) " (but we stupidly revert to degeneracy)" "")) (try "") (try (list->string (map integer->char (iota 256 (try "U+2002: | | (utf-8: E2 80 82)") (try "U+232C: |⌬| (utf-8: E2 80 82)") (try "U+1D7FF: |𝟿| (utf-8: F0 9D 9F BF)") (try "U+2F9B2: |䕫| (utf-8: F0 AF A6 B2)") (try "U+2F9BC: |蜨| (utf-8: F0 AF A6 BC)") (exit EXIT-VALUE)
Re: salutations and web scraping
I have some updates about this issue, should anyone be interested. Il giorno 25 gennaio 2012 18:23, Catonano ha scritto: > > > Il giorno 25 gennaio 2012 10:07, Andy Wingo ha scritto: > >> On Wed 25 Jan 2012 04:56, Daniel Hartwig writes: >> >> > (http-get uri #:version '(1 . 0) ...) >> >> Good point! >> > > yes, good point. I tried, it works. Thanks. This could have been a show > stopper to me. > It seems the show stopped anyway. If you try (define uri (string->uri "http://www.ubuntu.com";)) (http-get uri #:version '(1 . 0)) you'll get a correct result. But if you try with "http://friendfeed.com"; youll'get Unable to connect to database server and that's what happens with my radio station site too. Interestingly, I tried with curl -http1.0 http://friendfeed.com and got a different result. Also, the version indicated in the response from friendfeed is 1.1 while itś 1.0 in the response from www.ubuntu.com So it seems to me that this workaround of indicating a http 1.0 request introduces too much unpredictability from the servers; I'm probably running in a not so common case so some shoddiness in servers configurations is emerging As for curl, I'm not even sure it is fulfilling my whish to use a http 1.0 request, there was such a bug some time ago. I don't wanna know. I didn't try with wget because I couldn't find the right switch. Again, I'm not sure I wanna know So probably this pet project will have to wait some more. At least until the common http 1.1 cases will be covered What do you think ? Thanks you all, people, anyway Bye Catonano
Re: survey: string external representation
Hello, In en_US.UTF-8, guile-1.6.8 ... Cheers, David string-xrep.out Description: Binary data
Re: any thoughts on guile as a kernel extension language
Eric Schulte writes: > The following immediately made me think of guile. > http://netbsd-soc.sourceforge.net/projects/luakern/ It's long since dead, and Linux rather than Hurd, but http://abstractnonsense.com/schemix/ is somewhat relevant. -- Ian Price "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"
Re: 1945 plane shooter scriptable in guile
Thanks for the info, however I do not have the password of the account anymore... If you want I 2012/1/21 erana Owl <0wl...@gmail.com> > Hi, > > I made a '1945 - the battle of midway' clone back in the day. You can > script enemies, moving walls, spaceships etc. in guile. > The project is hosted here: http://forty-two.sf.net/ > > It's a bit dated but you can have fun with it writing plane or spaceship > AIs. Read the README and INSTALL to know how to proceed. > > Enjoy, > Johan >
Re: 1945 plane shooter scriptable in guile
If you want I'll putit online. 2012/1/28 erana Owl <0wl...@gmail.com> > Thanks for the info, however I do not have the password of the account > anymore... > If you want I > > > 2012/1/21 erana Owl <0wl...@gmail.com> > >> Hi, >> >> I made a '1945 - the battle of midway' clone back in the day. You can >> script enemies, moving walls, spaceships etc. in guile. >> The project is hosted here: http://forty-two.sf.net/ >> >> It's a bit dated but you can have fun with it writing plane or spaceship >> AIs. Read the README and INSTALL to know how to proceed. >> >> Enjoy, >> Johan >> > >
Re: 1945 plane shooter scriptable in guile
On Sat, Jan 21, 2012 at 5:29 AM, erana Owl <0wl...@gmail.com> wrote: > Hi, > / > I made a '1945 - the battle of midway' clone back in the day. You can > script enemies, moving walls, spaceships etc. in guile. > The project is hosted here: http://forty-two.sf.net/ > > It's a bit dated but you can have fun with it writing plane or spaceship > AIs. Read the README and INSTALL to know how to proceed. > > Enjoy, > Johan > hi there! I've checked out your project, it's funny! Though some errors I've encountered during compiling time, some header files was missing, it's easy to fix. Besides, I've noticed that you used Guile-1.6 for AI script, why not use brand new Guile-2.x? It's easy too. I did this "upgrade" myself and it works. I think there're some deprecated Guile APIs should be changed: --cut SCM_MAKINUM ==> scm_from_int SCM_INUMP ==> scm_is_integer SCM_INUM ==> scm_to_int SCM_VECTORP ==> scm_is_vector cut end The game is great. But there's frame skip/unsteady problem in the beginning. I didn't find out the reason. Maybe it's the problem of Guile-2.x, because the AI script will be compiled when it's loaded, so there'll be some delay in the beginning of the game. Guile-1.6 is pure interpreted, so I think it'll be OK. I just guess. If it's the final reason, I suggest you pre-compile your AI scripts.
Re: 1945 plane shooter scriptable in guile
On Sat, Jan 28, 2012 at 11:19 AM, erana Owl <0wl...@gmail.com> wrote: > If you want I'll putit online. > > why not put it on gitorious/github? > > 2012/1/28 erana Owl <0wl...@gmail.com> > >> Thanks for the info, however I do not have the password of the account >> anymore... >> If you want I >> >> >> 2012/1/21 erana Owl <0wl...@gmail.com> >> >>> Hi, >>> >>> I made a '1945 - the battle of midway' clone back in the day. You can >>> script enemies, moving walls, spaceships etc. in guile. >>> The project is hosted here: http://forty-two.sf.net/ >>> >>> It's a bit dated but you can have fun with it writing plane or spaceship >>> AIs. Read the README and INSTALL to know how to proceed. >>> >>> Enjoy, >>> Johan >>> >> >> >
libffi not found even if installed in default path
I got the following message from `./configure`: checking for LIBFFI... no configure: error: Package requirements (libffi) were not met: No package 'libffi' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. I then (just in case) installed the latest libffi by hand. Its README indicates that: Libffi will install under /usr/local by default. Indeed: $ find /usr -name 'libffi.*' /usr/lib/libffi.dylib /usr/local/lib/libffi.5.dylib /usr/local/lib/libffi.a /usr/local/lib/libffi.dylib /usr/local/lib/libffi.la /usr/local/lib/pkgconfig/libffi.pc /usr/local/share/info/libffi.info However, it did not help, and the `./configure` still fails with the very same error message. What information can I give you to help me? What should I do to make it work? -- View this message in context: http://old.nabble.com/libffi-not-found-even-if-installed-in-default-path-tp33218407p33218407.html Sent from the Gnu - Guile - User mailing list archive at Nabble.com.
Re: libffi not found even if installed in default path
> From: Thaddee Tyl $ find /usr -name 'libffi.*' > /usr/lib/libffi.dylib > /usr/local/lib/libffi.5.dylib > /usr/local/lib/libffi.a > /usr/local/lib/libffi.dylib > /usr/local/lib/libffi.la > /usr/local/lib/pkgconfig/libffi.pc > /usr/local/share/info/libffi.info > >However, it did not help, and the `./configure` still fails with the very >same error message. > Did you try running configure as something like 'PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure' -Mike