Re: tabular is not handling "" escapes
Hi Matt, Thanks, I think the default line terminator is the newline character, which would not work on files with DOS-style line endings. Could you call the reader with option eol: "\r\n" to see if this fixes the problem? -Ivan On Fri, Mar 6, 2020 at 11:24 AM Matt Welland wrote: > > Thanks Ivan, I much appreciate the support. > > I tested 1.2 and it does solve the escaped quotes problem. I do now see > another problem. Multi-line cells cause the parser some grief. The attached > test.csv generated from Excel imports fine to gnumeric but fails with an > "unable to parse record" with tabular. > > On Fri, Mar 6, 2020 at 8:16 AM Ivan Raikov wrote: >> >> Hi Matt, >> >> Thank you for using tabular and for reporting this issue. This was >> indeed a bug in the code that handles escaped quotes. I have fixed it >> and have made a new release (1.2). Let me know if you run into any >> other issues. Best regards, >> >> -Ivan >> >> On Thu, Mar 5, 2020 at 2:14 PM Matt Welland wrote: >> > >> > It is common in csv to escape double quotes with double quotes. This does >> > not work in tabular and I was unable to figure out any other mechanism. >> > Replacing the first " with \ did not work and neither did using single >> > quotes around the string. Is there a built in mechanism? The csv files in >> > question come from Microsoft Excel but I tested with a csv from Gnumeric >> > and see the same problem. >> > >> > cat testing.csv >> > Junk,"Joe ""Super"" Duper Guy",zsssy >> > "More Junk",1,2 >> > >> > ../portit pp testing.csv >> > >> > Error: (list->string) bad argument type - not a character: (#\") >> > >> > Call history: >> > >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? >> > utf8-srfi-14.scm:101: iset#iset-contains? <-- >> > >> > Thanks. >> > -- >> > Complexity is your enemy. Any fool can make something complicated. >> > It is hard to keep things simple. - Richard Branson. > > > > -- > -- > Complexity is your enemy. Any fool can make something complicated. > It is hard to keep things simple. - Richard Branson.
Re: tabular is not handling "" escapes
Hi Matt, Thank you for using tabular and for reporting this issue. This was indeed a bug in the code that handles escaped quotes. I have fixed it and have made a new release (1.2). Let me know if you run into any other issues. Best regards, -Ivan On Thu, Mar 5, 2020 at 2:14 PM Matt Welland wrote: > > It is common in csv to escape double quotes with double quotes. This does not > work in tabular and I was unable to figure out any other mechanism. Replacing > the first " with \ did not work and neither did using single quotes around > the string. Is there a built in mechanism? The csv files in question come > from Microsoft Excel but I tested with a csv from Gnumeric and see the same > problem. > > cat testing.csv > Junk,"Joe ""Super"" Duper Guy",zsssy > "More Junk",1,2 > > ../portit pp testing.csv > > Error: (list->string) bad argument type - not a character: (#\") > > Call history: > > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? > utf8-srfi-14.scm:101: iset#iset-contains? <-- > > Thanks. > -- > Complexity is your enemy. Any fool can make something complicated. > It is hard to keep things simple. - Richard Branson.
Re: [ANN] Source code of all eggs as git repositories
Great idea, automatic links from the eggref page to the egg repository/source would be very useful. -Ivan On Fri, Nov 1, 2019 at 5:43 AM plugd via wrote: > > Hi Mario, > > Mario Domenech Goulart writes: > > To fill this gap, we are making available git repositories that contain > > the source code of the whole set of eggs. See [2] for more information > > on how to clone them. > > This is great! Thank you. This reminds me: one thing that I've always > wondered is whether it would be possible to add links directly from the > wiki.call-cc.org/eggref/* pages to the relevant repository. This would > have helped me quite a bit in my early days of using Chicken, as I > remember being very confused about where to find the official repository > associated with any given package. > > Cheers, > Tim > >
Re: [Chicken-users] Silex & Lalr example wanted
Hi Joe, Yes, actually it is in trunk: http://bugs.call-cc.org/browser/project/release/5/lalr/trunk -Ivan On Thu, Jun 6, 2019 at 11:55 AM Joe Anonimist wrote: > > Hey Ivan, > > Thanks for the reply! > > Can't find calc_silex.scm in > > http://chicken.kitten-technologies.co.uk/cache/5/lalr/2.5.1/ > > Am I looking in the wrong place? > > > > > > From: Ivan Raikov > Sent: Thursday, June 6, 2019 4:41 PM > To: Joe Anonimist > Cc: chicken-users@nongnu.org > Subject: Re: [Chicken-users] Silex & Lalr example wanted > > Hi Joe, > > I have added an example use of lalr with silex in the lalr repository > (file calc_silex.scm). Briefly, this is the pattern I use: > > (define-syntax tok > (syntax-rules () > ((tok loc t) (make-lexical-token (quasiquote t) loc #f)) > ((tok loc t l) (make-lexical-token (quasiquote t) loc l > > ;; parser > (include "calc.yy.scm") > ;; lexer > (include "calc.l.scm") > > (define lexer-error error) > > (lexer-init 'port (current-input-port)) > (calc-parser lexer error)) > > > Let me know if you are still having trouble. Best regards, > > Ivan Raikov > > > On Thu, Jun 6, 2019 at 2:10 AM Joe Anonimist wrote: > > > > (newbie) > > > > Hi all, > > > > I am trying to figure out how Silex and Lalr work together. > > The "official" lalr example works but I can't figure out > > how to make it work with Silex. The only example I was able > > to find online is here: > > > > http://compgroups.net/comp.lang.scheme/a-quick-getting-started-example-with-silex-l/1183462 > > > > (apparently posted by another newbie, who actually managed > > to make it work) > > > > but when I follow the steps from the example > > I get the following error: > > > > Error: call of non-procedure: (lr-driver (quote #(((*default* *error*) (ID > > 1)) ((*default* -8)) ((*default* -7)) ((*default* -4) > > ... > > Call history: > > > > [apply-hooks306] (loop (cdr l)) > > [apply-hooks306] (cdr l) > > [apply-hooks306] (pair? l) > > [lexer-init] (lexer-get-func-line IS) > > [lexer-get-func-line] (cdr (assq (quote get-user-line) > > IS)) > > [lexer-get-func-line] (assq (quote get-user-line) IS) > > [lexer-init] (lexer-get-func-getc IS) > > [lexer-get-func-getc] (cdr (assq (quote user-getc) IS)) > > [lexer-get-func-getc] (assq (quote user-getc) IS) > > [lexer-init] (lexer-get-func-ungetc IS) > > [lexer-get-func-ungetc] (cdr (assq (quote user-ungetc) > > IS)) > > [lexer-get-func-ungetc] (assq (quote user-ungetc) IS) > > (print (expr-parser lexer print)) > > (expr-parser lexer print) > > (print (expr-parser lexer print)) > > (expr-parser lexer print) <-- > > > > So I would appreciate any examples of a simple > > "calculator" lexer-parser with Silex/Lalr > > or any pointers how to make them work together. > > > > > > ___ > > 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] Silex & Lalr example wanted
Hi Joe, I have added an example use of lalr with silex in the lalr repository (file calc_silex.scm). Briefly, this is the pattern I use: (define-syntax tok (syntax-rules () ((tok loc t) (make-lexical-token (quasiquote t) loc #f)) ((tok loc t l) (make-lexical-token (quasiquote t) loc l ;; parser (include "calc.yy.scm") ;; lexer (include "calc.l.scm") (define lexer-error error) (lexer-init 'port (current-input-port)) (calc-parser lexer error)) Let me know if you are still having trouble. Best regards, Ivan Raikov On Thu, Jun 6, 2019 at 2:10 AM Joe Anonimist wrote: > > (newbie) > > Hi all, > > I am trying to figure out how Silex and Lalr work together. > The "official" lalr example works but I can't figure out > how to make it work with Silex. The only example I was able > to find online is here: > > http://compgroups.net/comp.lang.scheme/a-quick-getting-started-example-with-silex-l/1183462 > > (apparently posted by another newbie, who actually managed > to make it work) > > but when I follow the steps from the example > I get the following error: > > Error: call of non-procedure: (lr-driver (quote #(((*default* *error*) (ID > 1)) ((*default* -8)) ((*default* -7)) ((*default* -4) > ... > Call history: > > [apply-hooks306] (loop (cdr l)) > [apply-hooks306] (cdr l) > [apply-hooks306] (pair? l) > [lexer-init] (lexer-get-func-line IS) > [lexer-get-func-line] (cdr (assq (quote get-user-line) IS)) > [lexer-get-func-line] (assq (quote get-user-line) IS) > [lexer-init] (lexer-get-func-getc IS) > [lexer-get-func-getc] (cdr (assq (quote user-getc) IS)) > [lexer-get-func-getc] (assq (quote user-getc) IS) > [lexer-init] (lexer-get-func-ungetc IS) > [lexer-get-func-ungetc] (cdr (assq (quote user-ungetc) IS)) > [lexer-get-func-ungetc] (assq (quote user-ungetc) IS) > (print (expr-parser lexer print)) > (expr-parser lexer print) > (print (expr-parser lexer print)) > (expr-parser lexer print) <-- > > So I would appreciate any examples of a simple > "calculator" lexer-parser with Silex/Lalr > or any pointers how to make them work together. > > > ___ > 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] Tangerine Edition penultimate report: how I voted, how you're voting
I thought the Great Compromise of R7RS was to have specifications for both a small and a large language, so that everyone is happy (or at least equally mad :-)) . Isn't the difference with R6RS that R7RS-large draws extensively on SRFIs which are indeed attempts to codify existing practices? On Thu, Jan 17, 2019 at 5:15 PM Per Bothner wrote: > > On 1/16/19 6:27 AM, John Cowan wrote: > > So what is happening is that people are voting for more rather than less, > > as with the Red Edition. This encourages me that I'm going in a sensible > > direction with the large language. > > For the record, I'm extremely leery of the more-is-better approach. > We seem to be adding a large number of very large APIs, which seems > to be contrary to the Scheme ideal of small well-chosen primitives > that work synergistic well together. People were unhappy with R6RS > because of its size and that so much of it was invention rather than > codifying existing practice. R7RS-large is the same - but much more so. > -- > --Per Bothner > p...@bothner.com http://per.bothner.com/ > ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Chicken-hackers] Some questions about CHICKEN 5 eggs and modules
Thanks for making a patch for this issue! -Ivan On Thu, Aug 30, 2018 at 4:14 AM wrote: > > > > So the basic problem is to install multiple sets of files, in separate > > > steps? I think for "scheme-include" components this should be possible, > > > but (as far as I can see) this is not currently possible for "c-include" > > > components (but could be added). > > > > It's for more than that. SPOCK for instance installs its Scheme *and* > > JS runtime into PREFIX/lib/chicken/8/spock/. The latter is neither a > > scheme-include nor a c-include. Feathers installs itself into > > PREFIX/share/chicken/feathers.tcl. I'm not sure what I'd categorize > > these as, but I suspect these eggs cannot be ported until you can > > specify a PREFIX-relative destination directory (as opposed to > > specifying the type of file to be installed). > > Feathers is part of the core system and ths spock stuff could in theory > simply be treated as data and installed/accessed from a diffent location, > so it is already possible, even if not ideal. But a patch is pending, as you > probably know, so no need to panic. > > > felix > ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Chicken-hackers] Some questions about CHICKEN 5 eggs and modules
Yes, exactly, the issue is installing multiple sets of files in different subdirectories of PREFIX/{include,share}. It would be very useful for "c-include" as well as "data" components. Thanks, -Ivan On Tue, Aug 28, 2018 at 1:07 PM wrote: > > > I have a couple of eggs that generate and compile code similar to the > > way chicken-crunch works. These eggs would install header or source > > files that are required for the compilation process. Some of these > > source files belong to distinct functional modules that are organized > > in subdirectories. In CHICKEN 4, it was possible to install these > > files to corresponding subdirectories of CHICKEN_PREFIX/share/chicken, > > thus preserving the logical structure. In CHICKEN 5, this is currently > > not possible, but I think it would be a very convenient feature. We > > can of course define our own conventions and install the additional > > files into subdirectories of $HOME, but it makes more sense to me to > > keep them in the CHICKEN directory hierarchy. I hope this makes sense. > > So the basic problem is to install multiple sets of files, in separate > steps? I think for "scheme-include" components this should be possible, > but (as far as I can see) this is not currently possible for "c-include" > components (but could be added). > > > felix > ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] C5 egg format and data files organized in multiple subdirectories
Hi all, One of my eggs includes a number of data files that are organized in sub-folders, and I was wondering what would be the best way to represent this file structure in the C5 egg file. I see from the documentation that a `destination' property can be specified for data components, but that appears to be an absolute path. Is there a way to specify a relative path, or is there an alternative? Thanks and best regards, -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] backtracking in abnf/lexgen
Nevermind, I see now that the last character of PN_PREFIX can be consumed as part of the repetition rule, and not as the PN_CHARS In that case, I would still suggest the bind combinator: (define (make-prefixed-name char-lst) ;; check that char-lst ends with a PN_CHAR and create a prefixed name object with e.g. string->symbol (define PN_PREFIX (bind make-prefixed-name (concatenation PN_CHARS_BASE (optional-sequence (repetition (alternatives PN_CHARS (char-list/list "."))) )) )) On Mon, Sep 18, 2017 at 2:06 PM, Ivan Raikov <ivan.g.rai...@gmail.com> wrote: > Hi Nathaniel, > > It seems to me that the rules PN_PREFIX and PN_LOCAL already exclude > strings ending with a '.'; e.g. in the case of PN_PREFIX, it must end > with PN_CHARS_BASE or PN_CHARS. I think that the remark about LL1 > means that the various PN rules are just regular expressions. So in > the case of PN_PREFIX I would think that this would work: > > (define PN_PREFIX > (concatenation > PN_CHARS_BASE > (optional-sequence > (concatenation >(repetition > (alternatives PN_CHARS (char-list/list "."))) >PN_CHARS)) > )) > > In other words, a PN_PREFIX either consists of PN_CHARS_BASE, or > PN_CHARSE_BASE followed by an arbitrary combination of PN_CHARS and > '.', followed by PN_CHARS. > Is there a counterexample to this? > > On Mon, Sep 18, 2017 at 4:32 AM, Nathaniel Rudavsky-Brody > <nathaniel.rudav...@gmail.com> wrote: >> Hi Ivan, >> >> Thanks a lot for your explanation. It helped me find the key I'd been >> missing: "The SPARQL grammar is LL(1) when the rules with uppercased names >> are used as terminals." So the uppercased names *do* need some kind of >> backtracking. >> >> My example with the parentheses was a bit silly (indeed I'd misread the >> grammar slightly), but I was trying to illustrate the basic problem which >> still holds: PN_PREFIX and PN_LOCAL can't end with ".": >> >> PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? >> >> PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | >> PLX)* (PN_CHARS | ':' | PLX) )? >> >> (from https://www.w3.org/TR/sparql11-query/#sparqlGrammar) >> >> As I mentioned, I was able to write a simple backtracking star to parse >> these, but it didn't compose well with bar, since bar doesn't send back the >> error which is needed to trigger the backtracking. The best I've been able >> to get working is a "sandbox" combinator (code below) that limits the scope >> of the backtracking, so I don't have to modify anything else in abnf/lexgen >> or my parser. Does it look correct to you? >> >> I hope that since these are the only two places in the grammar that require >> backtracking, and I'm able to isolate it, that the performance hit won't be >> to big...? >> >> Nathaniel >> >> >> >> >> >> >> (define (bstar p) >> (lambda (sk fk strm) >> (let ((try >>(lambda (s) >> (let ((ss (sk s))) >>(if (equal? ss '(error)) #f >>ss) >> (p (lambda (strm1) >>(or >> ((bstar p) try try strm1) >> (sk strm))) >> sk >> strm >> >> (define (sandbox p) >> (lambda (sk fk strm) >> (let ((s (p values err strm))) >> (if (equal? s '(error)) >> (fk strm) >> (sk s) >> >> (define PN_PREFIX >> (concatenation >>PN_CHARS_BASE >>(optional-sequence >> (sandbox >> (concatenation >> (bstar >>(alternatives >> (char-list/lit ".") >> PN_CHARS)) >> PN_CHARS) >> >> >> >> >> On Fri, Sep 15, 2017 at 5:42 PM, Ivan Raikov <ivan.g.rai...@gmail.com> >> wrote: >>> >>> Hi Nathaniel, >>> >>> No problem, thanks for trying to use lexgen and abnf. The excerpt >>> from the grammar does not include the rules for PNAME, or PNAME_NS, >>> but if I understand correctly, you are suggesting that PrefixedName >>> could include parentheses which could cause the closing parenthesis of >>> DataBlockValue to be consumed incorrectly. This would indeed require >>> general backtracking, but it is a bit surprising to me, because >>> usually ABNF grammars avoid backtracking as it can be very costly in >>> terms of memory and computation time. For detailed explanation see >
Re: [Chicken-users] backtracking in abnf/lexgen
Hi Nathaniel, It seems to me that the rules PN_PREFIX and PN_LOCAL already exclude strings ending with a '.'; e.g. in the case of PN_PREFIX, it must end with PN_CHARS_BASE or PN_CHARS. I think that the remark about LL1 means that the various PN rules are just regular expressions. So in the case of PN_PREFIX I would think that this would work: (define PN_PREFIX (concatenation PN_CHARS_BASE (optional-sequence (concatenation (repetition (alternatives PN_CHARS (char-list/list "."))) PN_CHARS)) )) In other words, a PN_PREFIX either consists of PN_CHARS_BASE, or PN_CHARSE_BASE followed by an arbitrary combination of PN_CHARS and '.', followed by PN_CHARS. Is there a counterexample to this? On Mon, Sep 18, 2017 at 4:32 AM, Nathaniel Rudavsky-Brody <nathaniel.rudav...@gmail.com> wrote: > Hi Ivan, > > Thanks a lot for your explanation. It helped me find the key I'd been > missing: "The SPARQL grammar is LL(1) when the rules with uppercased names > are used as terminals." So the uppercased names *do* need some kind of > backtracking. > > My example with the parentheses was a bit silly (indeed I'd misread the > grammar slightly), but I was trying to illustrate the basic problem which > still holds: PN_PREFIX and PN_LOCAL can't end with ".": > > PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? > > PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | > PLX)* (PN_CHARS | ':' | PLX) )? > > (from https://www.w3.org/TR/sparql11-query/#sparqlGrammar) > > As I mentioned, I was able to write a simple backtracking star to parse > these, but it didn't compose well with bar, since bar doesn't send back the > error which is needed to trigger the backtracking. The best I've been able > to get working is a "sandbox" combinator (code below) that limits the scope > of the backtracking, so I don't have to modify anything else in abnf/lexgen > or my parser. Does it look correct to you? > > I hope that since these are the only two places in the grammar that require > backtracking, and I'm able to isolate it, that the performance hit won't be > to big...? > > Nathaniel > > > > > > > (define (bstar p) > (lambda (sk fk strm) > (let ((try >(lambda (s) > (let ((ss (sk s))) >(if (equal? ss '(error)) #f >ss) > (p (lambda (strm1) >(or > ((bstar p) try try strm1) > (sk strm))) > sk > strm > > (define (sandbox p) > (lambda (sk fk strm) > (let ((s (p values err strm))) > (if (equal? s '(error)) > (fk strm) > (sk s) > > (define PN_PREFIX > (concatenation >PN_CHARS_BASE >(optional-sequence > (sandbox > (concatenation > (bstar >(alternatives > (char-list/lit ".") > PN_CHARS)) > PN_CHARS) > > > > > On Fri, Sep 15, 2017 at 5:42 PM, Ivan Raikov <ivan.g.rai...@gmail.com> > wrote: >> >> Hi Nathaniel, >> >> No problem, thanks for trying to use lexgen and abnf. The excerpt >> from the grammar does not include the rules for PNAME, or PNAME_NS, >> but if I understand correctly, you are suggesting that PrefixedName >> could include parentheses which could cause the closing parenthesis of >> DataBlockValue to be consumed incorrectly. This would indeed require >> general backtracking, but it is a bit surprising to me, because >> usually ABNF grammars avoid backtracking as it can be very costly in >> terms of memory and computation time. For detailed explanation see >> e.g. here: http://www.artima.com/pins1ed/combinator-parsing.html#31.10 >> >>Parser combinator libraries such as lexgen tend to favor LL >> grammars and avoid backtracking because the latter requires keeping >> multiple copies of the input stream, and traversing back one token at >> a time until a rule succeeds, which usually ends up being >> prohibitively slow. I suppose a naive backtracking combinator in >> lexgen could be implemented using something analogous to the >> bind/rebind combinators, but instead the argument combinator would be >> applied to the previous copy of the input stream in case of failure. >> But I suspect this would be too slow to be of any practical use. >> >> Are you absolutely certain that the parentheses in PrefixedName can >> occur as something other than in escaped characters? Again, requiring >> left recursion and general backtracking is very unusual for an ABNF >> grammar, so better to make sure you understand the various PN_ rules. >> I
Re: [Chicken-users] backtracking in abnf/lexgen
Hi Nathaniel, No problem, thanks for trying to use lexgen and abnf. The excerpt from the grammar does not include the rules for PNAME, or PNAME_NS, but if I understand correctly, you are suggesting that PrefixedName could include parentheses which could cause the closing parenthesis of DataBlockValue to be consumed incorrectly. This would indeed require general backtracking, but it is a bit surprising to me, because usually ABNF grammars avoid backtracking as it can be very costly in terms of memory and computation time. For detailed explanation see e.g. here: http://www.artima.com/pins1ed/combinator-parsing.html#31.10 Parser combinator libraries such as lexgen tend to favor LL grammars and avoid backtracking because the latter requires keeping multiple copies of the input stream, and traversing back one token at a time until a rule succeeds, which usually ends up being prohibitively slow. I suppose a naive backtracking combinator in lexgen could be implemented using something analogous to the bind/rebind combinators, but instead the argument combinator would be applied to the previous copy of the input stream in case of failure. But I suspect this would be too slow to be of any practical use. Are you absolutely certain that the parentheses in PrefixedName can occur as something other than in escaped characters? Again, requiring left recursion and general backtracking is very unusual for an ABNF grammar, so better to make sure you understand the various PN_ rules. I am happy to help with that, just let me know. -Ivan On Fri, Sep 15, 2017 at 1:45 AM, Nathaniel Rudavsky-Brody <nathaniel.rudav...@gmail.com> wrote: > Hi Ivan, > > Thanks for replying, and sorry for being unclear. By different levels I just > mean that I need a non-greedy * for a low-level rule that gets combined in > different ways higher up. I'm able to write a correct parser by "flattening > out" the rules, but since it's a big grammar (173 rules) that quickly gets > messy. > > Here's an excerpt from the real rules. Practically speaking, the problem is > that by itself, "ex:abc)" is a valid PrefixedName, but in the expression > "(?var) { (ex:abc) }" only "ex:abc" should be parsed as a PrefixedName, and > the ")" as part of the InlineDataFull. > > > PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' > | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' ) > > PLX ::= PERCENT | PN_LOCAL_ESC > > PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | > PLX)* (PN_CHARS | ':' | PLX) )? > > PNAME_LN ::= PNAME > > PrefixedName ::= PNAME_LN | PNAME_NS > > iri ::= IRIREF | PrefixedName > > DataBlockValue ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | > 'UNDEF' > > InlineDataFull ::= ( NIL | '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' | > NIL )* '}' > > > > With my limited understanding of lexgen's internals, I can write a * that > backtracks if it catches an error from a later success continuation, but > this doesn't compose with something like opt that doesn't signal an error: > > (define (bstar p) > (lambda (sk fk strm) > (let ((try >(lambda (s) > (let ((ss (sk s))) >(if (equal? ss '(error)) #f >ss) > (p (lambda (strm1) >(or > ((bstar p) try sk strm1) > (sk strm))) > sk > strm > > > (lex (seq (bstar (lit "a")) (lit "a")) err "ab")) ; => ((a a a a a) (b)) > > but > > (lex (opt (seq (bstar (lit a)) (lit a))) err "ab") ; => (() (a a a a a > b)) > > > Does this make more sense? > > Nathaniel > > > On Thu, Sep 14, 2017 at 9:54 PM, Ivan Raikov <ivan.g.rai...@gmail.com> > wrote: >> >> Hi Nathaniel, >> >> I don't understand what you mean by "different levels" here. Can >> you express your grammar in ABNF notation? >> >>-Ivan >> >> >> On Thu, Sep 14, 2017 at 4:06 AM, Nathaniel Rudavsky-Brody >> <nathaniel.rudav...@gmail.com> wrote: >> > Hi, >> > >> > I was wondering if anyone might have some advice for a beginner's >> > question >> > with abnf/lexgen. Clearly it has something to do with backtracking, and >> > I >> > hope I'm just missing something simple -- 1500 lines into my parser, I'd >> > hate to have to start from scratch with another approach! >> > >> > >> > For matching a string of a's and b's that ends with an "a", clearly >> > >> > >> > (lex (seq (star (ba
Re: [Chicken-users] backtracking in abnf/lexgen
Hi Nathaniel, I don't understand what you mean by "different levels" here. Can you express your grammar in ABNF notation? -Ivan On Thu, Sep 14, 2017 at 4:06 AM, Nathaniel Rudavsky-Brodywrote: > Hi, > > I was wondering if anyone might have some advice for a beginner's question > with abnf/lexgen. Clearly it has something to do with backtracking, and I > hope I'm just missing something simple -- 1500 lines into my parser, I'd > hate to have to start from scratch with another approach! > > > For matching a string of a's and b's that ends with an "a", clearly > > > (lex (seq (star (bar (lit "a") (lit "b"))) >(lit "a")) > error "ababa") ; => error > > > For patterns on the same level, I can do manual backtracking: > > > (define-syntax vac > (syntax-rules () > ((_ fn) (lambda args (apply fn args) > > (define (left-star-seq p1 p2) ; p1*p2 > (vac >(bar > (seq p1 (left-star-seq p1 p2)) > p2))) > > (lex (left-star-seq > (bar (lit "a") (lit "b")) > (lit "a")) > error "ababa") ; => ((#\a #\b #\a #\b #\a) ()) > > > but what if p1 and p2 are on completely different levels, something like: > > > (define p1 (star (bar (lit "a") (lit "b" > (define p2 (lit "a")) > ... > (define q2 (seq q1 p1)) > (define q4 (seq q3 q2)) > (define Word (seq q4 p2)) > > > Is there way to do "composable" backtracking with these tools? (and is the > question even the right one?) > > Thanks for any ideas, > > Nathaniel > > ___ > 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] Distributed-concurrent computing: If Erlang is a 10. . .
Hello Lawrence, I can only speak from my experiences with Chicken and MPI: it was very easy to call the MPI primitives using the Chicken FFI functionality and write code for distributed point distance queries on a cluster with up to 512 MPI processes. All communication was done with vectors of 64-bit floating point numbers; I did occasionally miss the ability to use complex datatypes, but I never attempted to use the MPI datatype interface, which does not seem too difficult to work with. MPI also does not really provide for fault tolerance, so there Erlang might have the edge. So I would expect performance would be on par with Erlang but perhaps you would have less flexibility and options for error handling. -Ivan On Fri, Jan 8, 2016 at 8:46 AM, Lawrence Bottorffwrote: > . . . where might Chicken be concerning distributed-concurrent programming? > How close to Erlang's perfect 10 can you get with Chicken. Of course if > Chicken is even better than a 10, let me hear about it. > > LB > > ___ > 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] [Chicken-hackers] [Proposal] Officially drop SWIG support?
I am not sure SWIG ever worked in Chicken 4, and furthermore I am not sure SWIG itself is that well maintained. At this point Chicken provides a number of good tools for FFI, so there really is no point in trying to support SWIG. -Ivan On Sun, Jun 14, 2015 at 6:53 AM, Peter Bex pe...@more-magic.net wrote: Hello everyone, I was browsing our code a bit and noticed that we have a special swig pointer type. However, there seems no way to construct it from Scheme and as far as I remember, SWIG support has bitrotted to the point of being useless. This is also mentioned in the manual at http://wiki.call-cc.org/man/4/Unit%20lolevel#foreign-pointers Besides, I don't really understand why SWIG needs a special pointer type for it. If you look at the documentation at the SWIG site itself, it is full of pre-CHICKEN 4 anachonisms; it still mentions only units, no modules, it refers to TinyCLOS as the go-to library for OOP, it mentions a program called chicken-config which has been removed before we even migrated CHICKEN to the subversion repository. Behold: http://swig.org/Doc3.0/Chicken.html Since nobody is really maintaining SWIG support in CHICKEN, it may be better to just drop compatibility altogether rather than keep lugging this undead legacy stuff around. Removing some of this may also make some pointer operations faster as we don't need to check for the SWIG pointer type. This is probably a very minimal improvement, though. So what do you all think? Should we drop SWIG support for CHICKEN 5? Is anyone still using SWIG? Cheers, Peter ___ Chicken-hackers mailing list chicken-hack...@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Chicken callbacks
Hello, You will need to define your Scheme procedure with define-external and then you can pass it as a function pointer to C routines. Your list of global events will need to be in static allocated memory (object-evict and friends). Check out section 'Callbacks' in the Chicken manual. Examples of define-external used for C callbacks can be found in e.g. the sundials library, which is an interface to the SUNDIALS solvers written in C. -Ivan On Sun, May 31, 2015 at 12:08 PM, chi chic...@verge.info.tm wrote: If you use a C library that requires callbacks, like libuv for instance, is it possible to write a procedure in chicken that will be guaranteed to return, as the C library requires? Like, by avoiding thread switching or call/cc or something? I was thinking to sort of invert libuv, by using simple callbacks that only updated a global list of active event objects. The libuv main loop would return after a single event came in, and the scheme code could handle the events by checking that active list, and not have to worry about whether they're inside a persnickety C callback. Sort of like how epoll returns a list of active events, and libuv covers that up by dispatching those events to callbacks, and then I would use those callbacks to ...create a list of active events. Would I have to write those simple callbacks in C too? Could those simple C callbacks update a scheme active event list structure without getting longjmp'd? Or maybe the surrounding scheme would read a C structure active list? Come to think on it, epoll returns a list of active events, and doesn't IOCP also return a list of active events? I'm not much familiar with the Microsoft platform. I know Linux's async disk IO methods return a list of active events with no callbacks. (Then Glibc's AIO wraps them up in callbacks AND a thread pool -_-) Pretty sure kqueue doesn't use callbacks either. Most kernel developers are probably going to have a hard time doing anything with callbacks I imagine, since such callbacks would violate the kernel/userspace separation. Almost as if callbacks were a horrible idea in general... If so, I wish there was a cross platform networking library that used each platforms fast event poller, and simply produced a unified interface for events produced, instead of wrapping it up in registering callbacks and all that jazz. Can't think of a non-platform-specific events library that /doesn't/ use callbacks... ___ 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] Mutual recursion w/ comparse
`vac' means `vacuous' because it is just a vacuous macro that delays the application of a function. -Ivan On Thu, May 28, 2015 at 5:24 PM, Matt Gushee m...@gushee.net wrote: Okay, well, I found a solution. I'm using this simple macro: (define-syntax mrp (syntax-rules () ((_ fn) (lambda args (apply function args) Actually, this is just a copy of the 'vac' macro from json-abnf; I changed the name because I had no idea what 'vac' means - whereas 'mrp' stands for 'mutually recursive parser'. So, I wrap the body of the first parser definition in the mutually recursive group, like so: (define dict-value (mrp (any-of integer float number boolean string~ list~ dict))) ... and everything's good. I also saw that comparse provides a similar macro called 'recursive-parser', but for some reason that didn't work when I tried it. Maybe I was using it wrong. I'd still be interested to know if my solution here is the best one, or if there are other good ways to handle this type of situation. -- Matt Gushee On Wed, May 27, 2015 at 6:30 PM, Matt Gushee m...@gushee.net wrote: Hello-- I'm trying to write my first real parser with comparse, but I'm running into some difficulty with mutual recursion. Here's the problematic portion of my code: (define-values (dict dict-content dict-entry dict-value) (let () (define dict~ (enclosed-by (is #\{) dict-content~ (is #\}))) (define dict-content~ (sequence (maybe whitespace) (maybe (sequence dict-entry~ (zero-or-more (sequence separator dict-entry~ (maybe whitespace))) (define dict-entry~ (sequence dict-key (maybe whitespace) (is #\:) (maybe whitespace) dict-value~)) (define dict-value~ (any-of integer float number boolean string~ list~ dict~)) (values dict~ dict-content~ dict-entry~ dict-value~))) But when I try to use these parsers, e.g. (with-input-from-file examples/basic.rsc (lambda () (let-values (((result rest) (parse dict-content (read-all (current-input-port I get this error: Error: call of non-procedure: #unspecified Call history: rascl-parser.scm:166: comparse#sequence rascl-parser.scm:166: comparse#zero-or-more rascl-parser.scm:165: comparse#sequence rascl-parser.scm:165: comparse#maybe rascl-parser.scm:168: comparse#maybe rascl-parser.scm:164: comparse#sequence rascl-parser.scm:171: comparse#maybe rascl-parser.scm:172: comparse#is rascl-parser.scm:173: comparse#maybe rascl-parser.scm:170: comparse#sequence rascl-parser.scm:176: comparse#any-of rascl-parser.scm:177: values parse-basic.scm:13: with-input-from-file parse-basic.scm:14: ##sys#call-with-values parse-basic.scm:16: read-all parse-basic.scm:16: comparse#parse I'm pretty sure the cause is not any of the individual parsers, but rather the way I'm trying to implement mutual recursion. I tried a version with (define dict-value (any-of integer float number boolean string~ list~)) i.e., non-recursive, with all parsers defined with a simple sequence of top-level (define)s, and it worked fine. However, the actual grammar I'm trying to parse is similar, but not identical, to JSON, and calls for nested dictionaries. I looked at the medea source code and tried the approach used there (or as close as I could come), and several other variations, but I always get the same error, or else this one: Error: bad argument count - received 1 but expected 0: #procedure (rascl-parser#dict-content). Obviously I'm doing something wrong, but I can't see what. BTW, I have a closely related but more general question: At first I tried to use top-level defines for all the parsers, and that didn't work at all. I was surprised because I have used mutually recursive procedures many times. But I think I understand now. I think it's because in (define (NAME ARG ...) BODY ...) the BODY expressions are evaluated at runtime, while in (define NAME BODY ...) [which is the form typically used to define comparse parsers], the BODY expressions are evaluated at compile time; thus any symbols referenced in BODY must be previously (in lexical order) defined. Have I got that right? Thanks for any help. -- Matt Gushee ___ 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] Basic abnf usage?
I also think that the question of input stream encoding is orthogonal to the issues of parsing. There is no technical reason why there could not be a unified and extensible Chicken input stream library that can be used by all the different parser libraries available. The problems solved by lexgen/abnf's style of input streams are: 1) handling of different data structures such as strings, char lists, ports, and byte vectors 2) handling of UTF-8 encoding 3) handling input streams with meta data attached to them, such as position information If others agree on having an input stream library with these properties, I think we should work towards a unified solution. -Ivan On Fri, Mar 27, 2015 at 10:32 AM, Moritz Heidkamp mor...@twoticketsplease.de wrote: Hi Matt, On 27 March 2015 18:18 CET, Matt Gushee wrote: BTW, in case you are interested, I was going to use comparse, which is a bit easier to learn (don't know about performance), but found that it didn't support UTF-8, which in my world is not acceptable. as the author of Comparse I wonder how you got that impression? For example, Medea (a JSON parser which is implemented in Comparse) fully supports UTF-8 and even validates it to be well formed. As for performance: I've recently made some improvements to it when used on character based input types (strings and ports, really). In my (grantedly not scientifically rigorous) benchmarks, this makes Medea the fastest of the available JSON parsers for CHICKEN, for example. Moritz ___ 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 HTML, best practice with Chicken
Hello Piotr, The neuromorpho egg is a scraper-like utility to fetch information from a public database with neuronal reconstructions. You can look at the code for examples of page scraping with sxpath. In particular, take a look at the procedures table-alist, extract-metadata, extract-pages-from-search-results. Obviously these are specific to the particular page structure served by NeuroMorpho, but this might help. -Ivan On Sun, Dec 28, 2014 at 6:28 PM, mfv m...@freeshell.de wrote: Hello, I am currently playing around the Chicken and the web. More precisely, I want to make some web link collection and see how well it goes for me when scraping web sites for links and content. Which eggs would you recommend for that? What should I avoid doing? So far, I have been getting the site with http-client, the raw html to sxml with html-parser, and trying to process the resulting list with matchable/srfi-13. I am not sure how much good it will do to use regex on those lists. Are there any packages like Python's Beautifulsoup in the Chicken arsenal? So far, I have some troubles when trying to parse the resulting sxml, both with matchable and string-contains. Cheers, Piotr ps: ze code so far: ;; version 0.0.3 ; high level HTTP client, HTML/SXML parsing library and regular expression ; library (use http-client html-parser matchable srfi-13) ; grab a website (define lnk ; http://onlinelibrary.wiley.com/journal/10.1002/%28ISSN%291521-3773;) (define raw (with-input-from-request lnk #f read-string)) ;; convert site crawl data from html to sxml (define sxml (html-sxml raw)) ;; saving function ;; * display form is more suitable, for it evaluates all those \n and other ;; * specials characters;; * might be good to remove these things from regex ;; * processing, too. (define (savedata somedata filename) (call-with-output-file filename (lambda (p) (let f ((ls somedata)) (unless (null? ls) (display (car ls) p) ; changed: display-write (newline p) (f (cdr ls))) ; check how much the output is parsable.. (savedata sxml output.txt) ;; non-TCO (define (flatten x) (cond ((null? x) '()) ((not (pair? x)) (list x)) (else (append (flatten (car x)) (flatten (cdr x)) (define sxmlflat (flatten sxml)) ;; *** ;; Multi-check procedure is needed to check whether STRING element has: ;; journal-id: 10.1002 ;; link string: issuetoc ;; ;; function: ;; takes list of strings and checks wheather the element has them. ;; AND operator. ;; *** ;; --- member? returns #t if elemnt x is in list lst. ;; --- ref: ;; --- http://stackoverflow.com/questions/14668616/scheme-fold-map-and-filter-functions ;; --- use: (member? a (list a 1)) -- #t (define (member? x lst) (fold (lambda (e r) (or r (equal? e x))) #f lst)) ;; --- string-contains/m returns #t if all strings of list lsstr are in ;; --- string str. ;; --- case insensitive string matching. ;; --- does not check if lsstr is empty. This would return #t. ;; --- use: (string-contains/m Somestring '(10.1002 issuetoc) (define (string-contains/m str lsstr) (if (string? str) (if (not (member? #f (map (lambda (x) (string-contains-ci str x)) lsstr))) #t))) (savedata (filter (lambda (x) (string-contains/m x '(10.1002 http://; toc))) sxmlflat) filtered3.txt) ;; Something is wrong with those bloody strings! ___ 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] Solving the assignment problem using Chicken Scheme by interfacing with libhungarian
Hello, This looks interesting, thanks. What is libhungarian and from where might one obtain it? -Ivan On Mon, Feb 17, 2014 at 5:48 AM, Mathieu mdesr...@hotmail.com wrote: If you ever need to assign agents to tasks. First build a matrix where each row represents a task, each column represents an agent, and each element represents the cost of having an agent performing a specific task. Then sent this matrix to the linked function to obtain a list of pairs representing which agent and task matchups have the minimal overall cost. An example: https://github.com/Mathieu-Desrochers/Scheme-Experimentations/blob/master/documentation/infrastructure/matrix.md#matrix-solve-maximum-assignment-problem The source code: https://github.com/Mathieu-Desrochers/Scheme-Experimentations/blob/master/sources/infrastructure/matrix/matrix-intern.scm *Credits to: http://www.informatik.uni-freiburg.de/~stachnis/ ___ 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] Chicken for python
Hello, There was a similar attempt a couple of years ago, and the results were posted here: http://lists.gnu.org/archive/html/chicken-users/2011-01/msg00179.html This is about embedding a Chicken REPL inside Python, which a little bit different than what you want, but it might be helpful. -Ivan On Sat, Nov 9, 2013 at 8:54 AM, m...@freeshell.de wrote: Hello all, first time post here. I decided to give lisp et al. a go and started to dive into functional programming. Since I come from a Python background, I wonder if there is a chance that one could extend Python with the use of a library compiled by Chicken. CHICKEN produces portable and efficient C, so maybe there is a way to feed some chickens to the snake? For the record, I posted the question at stackoverflow: http://stackoverflow.com/questions/19849048/chicken-for-python-extending-python-with-the-use-of-a-shared-library Any opinions, ideas, comments? Cheers! ___ 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] [Q] Are there any egg for timer based scheduler like cron?
Hi Sungjin, Have you tried the scron egg? -Ivan On Thu, Sep 5, 2013 at 12:58 PM, Sungjin Chun chu...@gmail.com wrote: Hi, I want to create a program which do some tasks with following condition; 1. During 08:00 to 16:00 (hour) of each day, 2. the task will run every 2 seconds (or minutes or so). The time for completing task is very tiny, for example 0.01ms to 1 sec. In Lisp(SBCL), I have used timer package but I cannot find equivalent one for chicken scheme. Thanks in advance. ___ 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] Chicken C interface
The correct way is to not let C manage memory at all ;-P In the mpi egg, I used foreign-primitive and C_alloc as follows: ;; Returns the current MPI time as a floating-point number (define MPI:wtime (foreign-primitive scheme-object () #EOF C_word result; C_word *ptr; ptr = C_alloc (C_SIZEOF_FLONUM); result = C_number(ptr, MPI_Wtime()); C_return (result); EOF )) In various other C interface libraries, I use the following idiom: (define (func arg) ;; determine the size of the result vector (let* ((n (c_func_result_length arg)) ;; allocate memory for the result vector (v (make-f64vector n 0.0))) ;; obtain result (c_func arg v) v)) This of course assumes that the C library you are targeting is structured so as to allow you to determine the result size. This is often the case with various numerical libraries I have had to interface to, but that's a fairly specific use case. -Ivan On Thu, Jun 6, 2013 at 6:45 AM, Dan Leslie d...@ironoxide.ca wrote: Oh dear! Well, it works and I haven't had problems. What's the correct way to go about this? -Dan On 6/5/2013 2:36 PM, Felix wrote: From: Dan Leslie d...@ironoxide.ca Subject: Re: [Chicken-users] Chicken C interface Date: Wed, 05 Jun 2013 08:47:45 -0700 I do this a fair bit in the Allegro egg. Here's an example: https://github.com/dleslie/**allegro-egg/blob/** 985ca2ceef0f5b4028af3f97729f13**cba2976fe5/color.scmhttps://github.com/dleslie/allegro-egg/blob/985ca2ceef0f5b4028af3f97729f13cba2976fe5/color.scm Basically, use C_alloc to allocate the memory required to host both the List structure and the data it is to contain, then use the C_list macro to patch it all together. Note that this code is not correct: C_alloc allocates on the C stack and the data will be invalid once the function returns (Sorry). If this works, then it is just coincidental! cheers, felix __**_ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/**mailman/listinfo/chicken-usershttps://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] Best way to share memory between C and Chicken
I cannot answer your question about performance, but you have prompted me to create a simple example with POSIX shared memory. Attached are two files, producer.c and consumer.scm. The producer (a C program) writes strings to a POSIX shared memory file, and the consumer (a Scheme program) reads them, prints them and then unlinks the buffer. The producer uses mmap, as Dan mentioned in his reply. This may be clunky, but there is no need to worry about synchronization. Using e.g. Linux shmget for shared memory between threads _might_ give you higher performance, but then you have to mess around with semaphores and so on. I will not have time to adapt the code you link to, but I can help if you are having trouble with a particular construct in posix-shm. -Ivan On Sun, May 5, 2013 at 8:07 AM, Jörg F. Wittenberger joerg.wittenber...@softeyes.net wrote: On May 4 2013, Ivan Raikov wrote: I think you can try to have native threads by running a separate instance of the Chicken runtime for each thread, but are you sure that you will really achieve a significant speedup over Unix processes and/or MPI? It's not the early nineties anymore... I suggest prototyping code and running real-world benchmarks first. Hm. I dunno, I'm old school. So far I have at least one case, where I've been resorting to native threads because I didn't see another solution. Maybe you/anybody could enlighten me? The case at hand: I'm running sqlite queries, which can take a long time. I don't want to block the chicken system while those are busy. Worse: I'm using the sqlite VFS to get the actual data blocks ... from chicken, hence the chicken thread MUST not wait for sqlite... (for reference an old version of the code is here http://lists.nongnu.org/** archive/html/chicken-users/**2010-01/msg00046.htmlhttp://lists.nongnu.org/archive/html/chicken-users/2010-01/msg00046.html) As I said: I'm old school - could I really expect a reasonable performance from running a separate sqlite process and cop the data back and forth between the processes? Suggestion how to do this are welcome! On Sat, May 4, 2013 at 8:39 AM, Dan Leslie d...@ironoxide.ca wrote: ... Relatedly, is anyone poking at implementing native threads? I've been digging around a bit but haven't had much time to progress very far. In fact I'm contemplating about this for a while and never got the courage to try. (Especially because I don't see how I could create a half-way meaningful benchmark beforehand to judge the gain/loss early in the development process.) The bottleneck for me is usually blocking on i/o. Wrt. this I do not expect (as in wild guess - no benchmarks done) much from multiple threads. However some things I'm doing are just computations. Am I thinking early nineties style when I assume that chicken will utilize only one cpu core? If so, I'd prefer not spare the others all the time. My problem: I can't see a good way to share chicken-managed memory between threads. I recall having seen a paper on using a dedicated thread for memory allocation...but can't find it anymore. Nevertheless: maybe it would be feasible to do all second gen gc in a dedicated thread and force a minor gc before passing data between threads? Would it? Best /Jörg #include sys/types.h #include sys/mman.h #include sys/stat.h/* For mode constants */ #include unistd.h #include fcntl.h /* For O_* constants */ #include stdio.h #include stdlib.h #include string.h #include errno.h #define BUFFER_SIZE 32768 #define BUFFER_NAME /shmtest1 void buffer_create(int size, int *fileno, char **addr) { int perms = 0600; char *laddr; *addr = 0; *fileno = shm_open(BUFFER_NAME, O_CREAT | O_RDWR, perms); if (errno 0) { perror(failed to create shared memory file handle); exit (1); } if ((ftruncate(*fileno, size)) == -1) {/* Sets the size */ perror(ftruncate failed on shared memory file handle); exit(1); } laddr = (char*)mmap(NULL, size, PROT_WRITE, MAP_SHARED, *fileno, 0); if (errno 0) { perror (failed to mmap shared memory file handle); exit (1); } *addr = laddr; } void buffer_clear(char **sbuff, char *start) { *sbuff = start; } int buffer_size(char *sbuff, char *start) { return (sbuff-start); } void buffer_close(int fileno, char *start) { if ((munmap(start, BUFFER_SIZE)) == -1) { perror(munmap failed on shared buffer); exit(1); } if ((close(fileno)) == -1) { perror(close failed on shared buffer file handle); exit(1); } } void insert_item(char *item, char **shared_buffer, char *shared_start) { int n = strlen(item); memcpy (*shared_buffer, item, n); *shared_buffer = *shared_buffer+n; } int main(int argc, const char **argv) { char *shared_start, *shared_buffer; int shared_fileno; buffer_create(BUFFER_SIZE, shared_fileno
Re: [Chicken-users] Best way to share memory between C and Chicken
Hello, I really strongly advise _against_ using SRFI-4 vectors for 4G files, as I have experienced serious performance issues even with vectors of a few million elements. If your C code is to be linked with your Chicken code, you can pass the pointer to your data from C to Scheme and use SRFI-4 foreign pointers to access it (see unit lolevel for details). If the C code is running as a separate process, you could try using posix-shm to create shared memory between processes and then use foreign pointers in the Chicken process. Ivan On May 4, 2013 3:04 AM, Pedro Melendez pmelen...@pevicom.com wrote: Hi all, Sorry if this question is obvious, but I couldn't find what I were looking for in the documentation so maybe you guys can help me. I am developing a prototype of a server that would serve 3D seismic images across the network. This task requires to process big files (~4 GB) with existing C code that is desirable to maintain. I plan to write the server itself in Chicken scheme but I would need to maintain the existing code in C that opens and process those files. Giving the size of the file, I want to share the memory space between C and Chicken and avoid copying values between areas. Is that even possible? Anyone has an idea on how can I address this? Thanks in advance! Pedro -- T: +1 (416) - 357.5356 Skype ID: pmelendezu ___ 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] Best way to share memory between C and Chicken
Hello, Yes, it seems that copying/moving around large vectors puts a lot of pressure on the memory subsystem. Other than that, SRFI-4 vectors are fine. Ivan On May 4, 2013 7:57 AM, Thomas Chust ch...@web.de wrote: On 2013-05-04 00:26, Ivan Raikov wrote: [...] I really strongly advise _against_ using SRFI-4 vectors for 4G files, as I have experienced serious performance issues even with vectors of a few million elements. [...] Hello, would that be related to the fact that CHICKEN has a copying garbage collector or are there other hidden performance implications of SRFI-4 vectors? Ciao, Thomas -- When C++ is your hammer, every problem looks like your thumb. -- When C++ is your hammer, every problem looks like your thumb. ___ 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] Best way to share memory between C and Chicken
Are you talking about POSIX semaphores, sem_wait(3) and friends, or just the general semaphor data structure? If the former, then the Chicken developers are eagerly awaiting your patches ;-) If the latter, take a look at the synch and mailbox eggs. They have mutex-like functionality that can be used in place of proper semaphores. Ivan On May 4, 2013 7:59 AM, Dan Leslie d...@ironoxide.ca wrote: I was just poking through posix, posix-shm, posix-utils, and posix-extras and it seems that none of them implement semaphores! Am I missing something, or is this actually the case? -Dan On 5/3/2013 3:26 PM, Ivan Raikov wrote: Hello, I really strongly advise _against_ using SRFI-4 vectors for 4G files, as I have experienced serious performance issues even with vectors of a few million elements. If your C code is to be linked with your Chicken code, you can pass the pointer to your data from C to Scheme and use SRFI-4 foreign pointers to access it (see unit lolevel for details). If the C code is running as a separate process, you could try using posix-shm to create shared memory between processes and then use foreign pointers in the Chicken process. Ivan On May 4, 2013 3:04 AM, Pedro Melendez pmelen...@pevicom.com wrote: Hi all, Sorry if this question is obvious, but I couldn't find what I were looking for in the documentation so maybe you guys can help me. I am developing a prototype of a server that would serve 3D seismic images across the network. This task requires to process big files (~4 GB) with existing C code that is desirable to maintain. I plan to write the server itself in Chicken scheme but I would need to maintain the existing code in C that opens and process those files. Giving the size of the file, I want to share the memory space between C and Chicken and avoid copying values between areas. Is that even possible? Anyone has an idea on how can I address this? Thanks in advance! Pedro -- T: +1 (416) - 357.5356 Skype ID: pmelendezu ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing listChicken-users@nongnu.orghttps://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] Best way to share memory between C and Chicken
I think you can try to have native threads by running a separate instance of the Chicken runtime for each thread, but are you sure that you will really achieve a significant speedup over Unix processes and/or MPI? It's not the early nineties anymore... I suggest prototyping code and running real-world benchmarks first. But thanks for your efforts on semaphores. I think wrapping the C API is the easy part, you can probably just use c-pointer for the sem_t type. I am guessing the hard part would be ensuring consistent semantics between Unix and the pinnacle of free-market capitalism, Microsoft Windows. On Sat, May 4, 2013 at 8:39 AM, Dan Leslie d...@ironoxide.ca wrote: Yah, I meant sem_wait et al. I was under the impression that synch and mailbox rely on srfi-18 structures, which would make them 'green' threads-only and not particularly suitable for multi process synchronization. Relatedly, is anyone poking at implementing native threads? I've been digging around a bit but haven't had much time to progress very far. I'm hesitant to take responsibility for writing a semaphore egg, but what the hell. I'll start something on GitHub this weekend. -Dan On 5/3/2013 4:22 PM, Ivan Raikov wrote: Are you talking about POSIX semaphores, sem_wait(3) and friends, or just the general semaphor data structure? If the former, then the Chicken developers are eagerly awaiting your patches ;-) If the latter, take a look at the synch and mailbox eggs. They have mutex-like functionality that can be used in place of proper semaphores. Ivan On May 4, 2013 7:59 AM, Dan Leslie d...@ironoxide.ca wrote: I was just poking through posix, posix-shm, posix-utils, and posix-extras and it seems that none of them implement semaphores! Am I missing something, or is this actually the case? -Dan On 5/3/2013 3:26 PM, Ivan Raikov wrote: Hello, I really strongly advise _against_ using SRFI-4 vectors for 4G files, as I have experienced serious performance issues even with vectors of a few million elements. If your C code is to be linked with your Chicken code, you can pass the pointer to your data from C to Scheme and use SRFI-4 foreign pointers to access it (see unit lolevel for details). If the C code is running as a separate process, you could try using posix-shm to create shared memory between processes and then use foreign pointers in the Chicken process. Ivan On May 4, 2013 3:04 AM, Pedro Melendez pmelen...@pevicom.com wrote: Hi all, Sorry if this question is obvious, but I couldn't find what I were looking for in the documentation so maybe you guys can help me. I am developing a prototype of a server that would serve 3D seismic images across the network. This task requires to process big files (~4 GB) with existing C code that is desirable to maintain. I plan to write the server itself in Chicken scheme but I would need to maintain the existing code in C that opens and process those files. Giving the size of the file, I want to share the memory space between C and Chicken and avoid copying values between areas. Is that even possible? Anyone has an idea on how can I address this? Thanks in advance! Pedro -- T: +1 (416) - 357.5356 Skype ID: pmelendezu ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing listChicken-users@nongnu.orghttps://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] mpi egg - MPI:init error
By the way, I realized that the example in the MPI egg documentation may not be all that clear, so I have updated it and added some comments. This is a very simple example of a master/worker pattern. You are welcome to improve on this with larger data sets or CPU-intensive operations. -Ivan On Fri, Mar 29, 2013 at 11:44 PM, Arthur Maciel arthurmac...@gmail.comwrote: Ivan, thank you for the info. Indeed I don't program anything serious enough to need parallelizing. I am just curious about how far I can get with Chicken. I've seen it doesn't support native threads and I was a bit worried because I thought that 'production' languages for real world tasks should provide them. But now I see there is another way around with the MPI egg. I'm a constant beginner when talking to programming and I'm very curious about PL, especially Chicken Scheme, but almost never I get my hands dirty with code. I really understand what you mean by high level abstractions over basic MPI functionality, but I don't know how to do it. However, I'm quite excited to know Chicken and FPL in more depth and I would like to help on any useful task. When you intend to develop it more, please count on me. Best wishes, Arthur Em 29/03/2013 03:51, Ivan Raikov ivan.g.rai...@gmail.com escreveu: Hi Arthur, I use mpi for parallelizing some moderately-sized number crunching tasks (kd-tree queries over trees of size ~1e5 points. I have primarily used the scatter/gather collective operations for this. Of course, MPI is a bit low-level for a functional programming language, and one day I hope to develop some high level abstractions over the basic MPI functionality. If you have some idea what kind of concurrent patterns you want to use in your application, I can suggest which MPI functions may be of use to you. -Ivan On Fri, Mar 29, 2013 at 9:49 AM, Arthur Maciel arthurmac...@gmail.comwrote: Hello! I'm on: Linux Mint 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux Chicken Scheme Version 4.8.0.1 (stability/4.8.0) (rev 54c391c) linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ] compiled 2013-01-17 on aeryn.xorinia.dim (Darwin) libopenmpi-dev is installed and chicken-install compiled mpi perfectly. But when I run 'csi -e (use srfi-4 mpi) (MPI:init)' I get exactly the same error as the one in salmonella report at http://tests.call-cc.org/master/linux/x86/2013/03/28/salmonella-report/test/mpi.html I don't know how to make it work. Any help is appreciated. BTW, I've got to mpi from http://wiki.call-cc.org/man/4/faq#does-chicken-support-native-threads, but I've seen it is not used by any other egg. Is it really useful to parallel programming? Best wishes, Arthur ___ 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] ANN: civet 0.1, an X(HT)ML templating library
Hi Matt, No need to be apologetic about it -- I am grateful for your feedback on Ersatz, and I am happy to see yet another Chicken library :-) Please share with us your experiences of using different templating libraries. Best, Ivan On Wed, Apr 3, 2013 at 12:58 AM, Matt Gushee m...@gushee.net wrote: Hello, all-- I am proud (and a bit nervous) to announce the first alpha release of a new templating library called Civet. Though I expect it will mainly be useful for web development, it can potentially be used for any type of XML document. By the same token, it does not, and probably never will, support non-XML HTML formats. [oh, and by the way, Ivan Raikov, if you're reading this, I am not entirely abandoning Ersatz--I'll probably still use it for some smaller projects, including the site I've already developed with it] Civet features include: * Insertion of dynamic content via 'variables' * Template inheritance block structure similar to that found in Ersatz or Jinja2. * 'If' with optional 'else' and 'for' loops. * Uses XML files as input, but automatically stores them in SXML form to avoid the need for parsing on every run. Although the Civet package includes all the basic ingredients for an egg, I am not submitting it to the egg directory just yet. The reason for this is that, while most of the above-mentioned features are working to some extent (i.e., I have written unit tests for them, and they all pass, at least on my system), early informal testing with more complex inputs indicates that Civet will not yet work in the real world. I'm hoping that if a few people are interested in this, we might be able to discuss what's going wrong and arrive at a solution. Code and documentation are available at my GitHub repo. You can clone the repo: git clone https://github.com/mgushee/civet.git Or download a tarball: https://github.com/mgushee/civet/archive/release-0.1.tar.gz I believe I have documented most of what you need to know to try Civet. Both the API and the template vocabulary are described in the README.md file included in the distribution. There are also a couple of example templates in the examples/ directory. Hope you like it! -- Matt Gushee ___ 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] mpi egg - MPI:init error
Hi Arthur, I use mpi for parallelizing some moderately-sized number crunching tasks (kd-tree queries over trees of size ~1e5 points. I have primarily used the scatter/gather collective operations for this. Of course, MPI is a bit low-level for a functional programming language, and one day I hope to develop some high level abstractions over the basic MPI functionality. If you have some idea what kind of concurrent patterns you want to use in your application, I can suggest which MPI functions may be of use to you. -Ivan On Fri, Mar 29, 2013 at 9:49 AM, Arthur Maciel arthurmac...@gmail.comwrote: Hello! I'm on: Linux Mint 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux Chicken Scheme Version 4.8.0.1 (stability/4.8.0) (rev 54c391c) linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ] compiled 2013-01-17 on aeryn.xorinia.dim (Darwin) libopenmpi-dev is installed and chicken-install compiled mpi perfectly. But when I run 'csi -e (use srfi-4 mpi) (MPI:init)' I get exactly the same error as the one in salmonella report at http://tests.call-cc.org/master/linux/x86/2013/03/28/salmonella-report/test/mpi.html I don't know how to make it work. Any help is appreciated. BTW, I've got to mpi from http://wiki.call-cc.org/man/4/faq#does-chicken-support-native-threads, but I've seen it is not used by any other egg. Is it really useful to parallel programming? Best wishes, Arthur ___ 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 EMail
Hi Karsten, internet-message provides a parser combinator interface, which is intended to be used as part of other parsers, and the documentation can be a bit confusing. An example of using internet-message is the mbox egg. mbox provides a library mbox-string, which in turn includes a procedure mbox-file-messages: (mbox-file-messages FILENAME-OR-PORT) = MESSAGE LIST Unfortunately, internet-message does not parse MIME parts, so indeed hato is a better choice here. Thanks for your interest and do not hesitate to complain about the documentation :-) -Ivan On Mon, Mar 25, 2013 at 7:27 PM, Karsten Gebbert karsten.gebb...@gmail.comwrote: Hi List, I'm relatively new to chicken and this list, so bear with me :) My aim is to parse EMails (for using with procmail, for instance) but I'm a little stuck/confused by my options. I've been playing with hato-mime.scm (hg cloned from google source project), and I also looked at internet-message, but without trying to sound like I'm complaining, the docs are somewhat meager for the beginner that I definitely am :) So my question is: could somebody point me to some example code for either one or the other library that can get me started? I basicall would like to be able to parse message into they parts (different bodies for content-types, attachments..) and play with them in chicken. Thanks in advance! Karsten __**_ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/**mailman/listinfo/chicken-usershttps://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] More thoughts on Ersatz
Hi Matt, Operator precedence in the ersatz parser was not correct, so I have now fixed it. Expressions consisting of several operators, e.g. {{ if not a b}} should work without having to be parenthesized. I have also added procedures sexpr-tvalue and tvalue-sexpr for easy conversion between s-expressions and template values. So now you can write code such as this: (define (alist-models xs) (map (lambda (x) (cons (car x) (sexpr-tvalue (cdr x xs)) (from-string {% if not (x == 1) %}not one{% endif %} models: (alist-models '((x . 2) Please try out version 1.4 of ersatz and let me know if I need to fix anything else. Thanks for your feedback. -Ivan On Thu, Mar 14, 2013 at 2:05 PM, Matt Gushee m...@gushee.net wrote: Hi, Ivan+group-- On Wed, Mar 13, 2013 at 6:39 PM, Ivan Raikov ivan.g.rai...@gmail.comwrote: 1) {% endblock block_name %}: the current grammar does not accept identifiers after endblock. Is this something required by Jinja? It's not required, but it's allowed. And, as should be obvious, it doesn't really do anything, just possibly makes the template structure more readable. 3) {% if not loop.last %}: this should work. Can you check whether if loop.last works? Okay, I just tried the following two templates: A) {% for word in words %} {{ word }}{% if loop.last %}!{% endif %} {% endfor %} B) {% for word in words %} {{ word }}{% if not loop.last %},{% endif %} {% endfor %} A works for me, but B does not. The error looks like this: Error: (ident-expr-name) invalid identifier expression: #texpr Call history: runtime.scm:52: loop runtime.scm:50: utf8#string-length runtime.scm:52: loop runtime.scm:50: utf8#string-length runtime.scm:961: Tstr runtime.scm:325: tmpl-ctx-buffer runtime.scm:324: display ersatz-lib.scm:204: datatype#invoke-variant-case ersatz-lib.scm:204: display eval.scm:291: eval-statement eval.scm:238: datatype#invoke-variant-case eval.scm:280: select-case eval.scm:275: eval-expr eval.scm:25: datatype#invoke-variant-case eval.scm:84: ident-expr-name runtime.scm:125: error -- I thought the error I got before was in the parser, but I'm not really sure now. I ran the current exercise in CSI, whereas the code I had trouble with before was compiled. By the way, I have Chicken 4.8.0.1 on Arch Linux 32-bit, with Ersatz 1.3. 5) Tvalues: I am an SML/Ocaml groupie and fanatical believer in types :-D But if it will help, I will add a sexpr-tvalue and tvalue-sexpr procedures that can convert between Scheme values and template values. I wouldn't mind that. 6) Yes, you can build templates in-memory. Take a look at the template-statement data type. I will add this to the documentation as well. Okay; I thought that might be the case, but I didn't really understand how to use statements. Maybe now that I've used the library a bit, I'll take another look at statements. 7) Name: 'tori' is a bit too generic, I think. Presumably German is the native language of Chicken, so I chose what I think expresses the nature of templates, yet is somewhat self-deprecating, as ersatz usually means 'poor substitute' in English and my native Bulgarian. Not tori, torii! Okay, I'll explain this. You didn't say whether you got my (possibly not-so-funny) joke or not, but perhaps others will find it slightly amusing. So, this templating library is derived from Jinja. Jinja in Japanese means a Shinto shrine (and by the way, certain shrines are called jingu--hence the name of the OCaml library, Jingoo). Well, most Shinto shrines have a distinctive type of gateway called a *torii*--I'm sure everyone here has seen pictures of them. And note the double 'i'--that signifies a long, or more precisely, doubled vowel sound. Well, now, consider the word 'tori' (with a single 'i'). The fundamental meaning of *tori* is 'bird'--however, when used in reference to food, it usually means a particular kind of bird: chicken! So there you have it! I think it's pretty clever, but if you really prefer Ersatz, I guess I can live with that. But be warned: if you ever get tired of maintaining the egg and I happen to take it over, I will probably change the name (evil laughter). Oh, and by the way [if you're not a (human) language geek, you can skip this part], I am curious as to whether my pun makes sense to Japanese people. See, the distinction between the long and short vowel sounds (as in *torii* vs. *tori*) is often difficult for non-native Japanese speakers--they really sound very similar if your ears are not accustomed to it. Yet, whenever I have complained about this to Japanese people, their response is almost invariable some version of What do you mean? They're completely different. On the other hand, I'm pretty sure I have heard Japanese comedians on a number of occasions making
Re: [Chicken-users] More thoughts on Ersatz
Hi Matt, Thanks for the detailed usage and bug reports and sharing your thoughts with us. Let me try to briefly respond: 1) {% endblock block_name %}: the current grammar does not accept identifiers after endblock. Is this something required by Jinja? 2) super() function: unfortunately, the extends statement is implemented by appending template statements together. ersatz currently has no notion of classes, let alone parent and children classes. 3) {% if not loop.last %}: this should work. Can you check whether if loop.last works? 4) Filters: sorry about the documentation, I will try to document filters soon then. 5) Tvalues: I am an SML/Ocaml groupie and fanatical believer in types :-D But if it will help, I will add a sexpr-tvalue and tvalue-sexpr procedures that can convert between Scheme values and template values. 6) Yes, you can build templates in-memory. Take a look at the template-statement data type. I will add this to the documentation as well. 7) Name: 'tori' is a bit too generic, I think. Presumably German is the native language of Chicken, so I chose what I think expresses the nature of templates, yet is somewhat self-deprecating, as ersatz usually means 'poor substitute' in English and my native Bulgarian. Thanks again for your very useful comments and thoughts, Matt. Best, -Ivan On Wed, Mar 13, 2013 at 1:32 AM, Matt Gushee m...@gushee.net wrote: Hello, Ivan and anyone else who is interested-- Having just finished successfully converting a web site from Python (Flask framework) to Chicken Scheme, I'd like to summarize my observations on the Ersatz template library. And let me say, Ivan, that although I have a few criticisms, I very much appreciate the work you have done to make Ersatz available. Before I discovered it, I was thinking about developing a Jinja-like template library myself, but I doubt that I could have done it as well as you have. And overall I find that Ersatz works very well and is not too difficult to use. UNIMPLEMENTED JINJA2 FEATURES So, first of all, I started out with a set of Jinja2 templates. I was afraid I would have to make major changes to use them with Ersatz, but it turned out I didn't need to change very much. However, I did notice a few Jinja features that are not implemented in Ersatz: 1) {% endblock block_name %} causes a parser error. This is certainly the least important of the issues I found. 2) The super() function is not supported. I was able to work around that limitation but splitting up some blocks. Still, this would be a very convenient feature to have. 3) {% if not loop.last %} also raises a parser error. This was a fairly important feature for me, because I have a couple of templates that generate JSON from arbitrary-length lists of objects, and there needs to be a comma *between* the objects in JSON. So I was doing this: {% for item in items %} { } {% endfor %}{% if not loop.last %}, {% endif %} My solution for Ersatz was to split the list in Scheme code into all-but-last and last components, then do the following in my template: {% for item in items %} { a: {{ item.a }} b: {{ item.b }} c: {{ item.c }} }, {% endfor %} { a: {{ last_item.a }} b: {{ last_item.b }} c: {{ last_item.c }} } And actually, I have since realized a couple of things about this. One is that I could split the list into car cdr, and put a 'first_item' before the 'for' block, with a comma in between. The other is that I need to ensure that 'items' is not an empty list, otherwise there will be an extra comma. Is this the way to do that? Scheme: models: `((items . ,(Tbool #f)) ...) Template: {% if items %} {% for item in items %} , { ... } {% endfor %} {% endif %} FILTERS My application uses several custom filters. I eventually figured out how to do this, but it was rather challenging. First of all, the documentation does not cover how to program a filter. For the record, I found that both the inputs and outputs of user-defined filters need to be tvalues. I also found that when I tried to use a filter that accepted one argument, Ersatz was passing 2 arguments to it. I have no idea what the second argument is supposed to be; I added some code to pretty-print the second argument to a log file, and found that it was an empty list. I'm wondering if you [Ivan] have any recommendations on the best way to write user-defined filters. I can't use the 'func1-arg', 'func2-arg', etc. procedures that you use for the built-in filters, since those procedures are not exported. And in any case, I haven't read the code thoroughly enough to really understand what they are doing. I also found an error in the documentation related to filters. The signature of the
Re: [Chicken-users] Ersatz question
Hi Matt, Thanks for trying again to use Ersatz. The models argument is an alist where the key is a symbol (the name of the variable), and the value is of type tvalue, which is a datatype defined in ersatz-lib.scm. So your example could work as follows: (let* ( (source #EOF {% for p in posts %} div class=blog-post h3{{ p.title }}/h3 div class=post-body {{ p.body }} /div /div {% endfor %} EOF )) (from-string source models: `((posts . ,(Tlist (list (Tobj `((title . ,(Tstr Post One title)) (body . ,(Tstr Post One body)) )) (Tobj `((title . ,(Tstr Post Two title)) (body . ,(Tstr Post Two body)) )) )) ) )) This will create an ersatz template variable called posts which contains a list of Tobj values. Tobj is the wrapper for objects with named fields in Ersatz. It is basically equivalent to an alist, except that the values must be Ersatz values (i.e. tvalue datatype). The above code can be greatly simplified of course, so if you have some typical patterns of template use, just let me know, and I will implement them. Thanks, -Ivan On Wed, Mar 6, 2013 at 3:07 PM, Matt Gushee m...@gushee.net wrote: Hi, folks-- I am trying again to learn how to use Ersatz. I am trying to render pages that display sequences of similar components (e.g. blog posts). The template syntax includes 'for' loops, e.g. {% for p in posts %} div class=blog-post h3{{ p.title }}/h3 div class=post-body {{ p.body }} /div /div {% endfor %} Or ... I'm pretty sure the following would work in Jinja2 (where the 'posts' variable is a list in the form [[post, body] ...]): {% for title, body in posts %} div class=blog-post h3{{ title }}/h3 div class=post-body {{ body }} /div /div {% endfor %} So, do these constructs work in ersatz? If so, what data structures do I want to pass as the models: argument when rendering the templates? Thanks for any info! -- Matt Gushee ___ 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] Ersatz question
The code for your second use case follows below. Ersatz uses the Tset object for destructuring statements such as for title, body in posts. So each post would be a Tset object (which is again represented as a list): (let* ( (source #EOF {% for title, body in posts %} div class=blog-post h3{{ title }}/h3 div class=post-body {{ body }} /div /div {% endfor %} EOF )) (from-string source models: `((posts . ,(Tlist (list (Tset (list (Tstr Post One title) (Tstr Post One body))) (Tset (list (Tstr Post Two title) (Tstr Post Two body))) )) )) ) ) On Wed, Mar 6, 2013 at 3:34 PM, Ivan Raikov ivan.g.rai...@gmail.com wrote: Hi Matt, Thanks for trying again to use Ersatz. The models argument is an alist where the key is a symbol (the name of the variable), and the value is of type tvalue, which is a datatype defined in ersatz-lib.scm. So your example could work as follows: (let* ( (source #EOF {% for p in posts %} div class=blog-post h3{{ p.title }}/h3 div class=post-body {{ p.body }} /div /div {% endfor %} EOF )) (from-string source models: `((posts . ,(Tlist (list (Tobj `((title . ,(Tstr Post One title)) (body . ,(Tstr Post One body)) )) (Tobj `((title . ,(Tstr Post Two title)) (body . ,(Tstr Post Two body)) )) )) ) )) This will create an ersatz template variable called posts which contains a list of Tobj values. Tobj is the wrapper for objects with named fields in Ersatz. It is basically equivalent to an alist, except that the values must be Ersatz values (i.e. tvalue datatype). The above code can be greatly simplified of course, so if you have some typical patterns of template use, just let me know, and I will implement them. Thanks, -Ivan On Wed, Mar 6, 2013 at 3:07 PM, Matt Gushee m...@gushee.net wrote: Hi, folks-- I am trying again to learn how to use Ersatz. I am trying to render pages that display sequences of similar components (e.g. blog posts). The template syntax includes 'for' loops, e.g. {% for p in posts %} div class=blog-post h3{{ p.title }}/h3 div class=post-body {{ p.body }} /div /div {% endfor %} Or ... I'm pretty sure the following would work in Jinja2 (where the 'posts' variable is a list in the form [[post, body] ...]): {% for title, body in posts %} div class=blog-post h3{{ title }}/h3 div class=post-body {{ body }} /div /div {% endfor %} So, do these constructs work in ersatz? If so, what data structures do I want to pass as the models: argument when rendering the templates? Thanks for any info! -- Matt Gushee ___ 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] Segfault with large data-structures
I can also confirm experiencing the same kind of problems with 4.7.0. However, this was always in conjunction with some FFI code, and only recently I began suspecting that segfaults can occur in pure Scheme code. Ivan On Feb 3, 2013 9:11 AM, Arthur Maciel arthurmac...@gmail.com wrote: Jim, I was running 4.8.0.1, but I tried 4.7.0.6 and got the same results. Thanks for the attention. 2013/2/2 Jim Ursetto zbignie...@gmail.com What version of chicken, and if 4.8.0 for example could you try 4.7? On Feb 2, 2013, at 11:51, Arthur Maciel arthurmac...@gmail.com wrote: Hello! I don't know if it is related to Ivan's problem, but when I compile and run this code: (use srfi-69) (define NODES 25) (define EDGES 1000) (define graph (make-hash-table)) (define (insert-edges) (printf ~N Hash-tables - Inserting edges ~N) (do ((n 1 (+ n 1))) ((= n NODES)) (if (= (remainder n 5000) 0) (printf ~S nodes inserted ~N n)) (do ((e 2 (+ e 1))) ((= e (+ 1 EDGES))) (hash-table-update!/default graph n (lambda (edges-list) (if (member e edges-list) edges-list (cons e edges-list))) (list e) (time (insert-edges)) I get this: $ csc list-in-hash-table-partials.scm -o list-partials.scm $ ./list-partials.scm Hash-tables - Inserting edges 5000 nodes inserted 1 nodes inserted 15000 nodes inserted 2 nodes inserted 25000 nodes inserted 3 nodes inserted 35000 nodes inserted 4 nodes inserted Segmentation fault I tried to compile with -O2, -O -d2 and -O3. It doesn't make difference for me: it always present a segfault. Any hint on how to make it work? Thanks! Arthur ___ 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 ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] The odd case of the channel egg's tests failures
Hi all, I also have been encountering some mysterious heap full errors and even segmentation faults when working with large data sets and some tree data structures or srfi-4 vectors. For example, the attached code does not include any FFI stuff, yet it causes segmentation faults when compiled with anything other than -O -d2 options. I will be happy to help write scripts to analyze memory layout logs. Ivan On Thu, Jan 31, 2013 at 10:01 PM, Alaric Snell-Pym ala...@snell-pym.org.ukwrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/31/2013 12:34 PM, Moritz Heidkamp wrote: What I need now is someone encouraging me in such an effort, suggesting various improvements to that work-intensive and toilsome project and who offers reliable support and hacking time. To remain realistic, I would even be happy with someone commenting on just least one or two of these three requests... This seems like a worthy addition to the Chicken debugging toolset but also like a lot of work. I won't discourage you from persuing it, of course, but I'm afraid I won't be able to help with actual hacking due to my ignorance of the relevant internals and the lack of time to become acquainted with them right now. I figured we could encourage Felix to do the internals bit and spit out a log file that the rest of us can learn to make sense of, as a good division of labour! ABS - -- Alaric Snell-Pym http://www.snell-pym.org.uk/alaric/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlEKaxUACgkQRgz/WHNxCGpecwCggj/DR+KYPpWakFNcHEJ6lkjL mUkAn0Inu1LNdVZzHNNexlWMcfwTvxM3 =c/id -END PGP SIGNATURE- ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users srfi-4-utils-test.scm Description: Binary data ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Msgpack implementation for scheme (and some questions)
You are right, I have updated the endian-blob documentation accordingly. Thanks, Ivan On Fri, Feb 1, 2013 at 8:16 AM, Jim Ursetto zbignie...@gmail.com wrote: FYI, the docs for endian-blob don't indicate the ordering of the endian blob after type-endian_blob. From reading the code it's MSB and there's an optional mode arg to these procedures. Should this be documented? Similarly the optional mode argument to byte-blob-endian-blob is documented as being required not optional. Jim On Jan 28, 2013, at 6:18 PM, Ivan Raikov wrote: Hi Hugo, Thanks for your work on msgpack, it seems like an interesting project. Unfortunately, machine floating point formats are complicated, so any related code will be complicated as well. I don't know much about the msgpack protocol, but if representing floating-point numbers as strings is an option, I encourage you to look at fpio ( http://wiki.call-cc.org/eggref/4/fpio ), a BSD-licensed egg for converting floating point numbers to strings and vice versa. endian-blob includes code from GDB, so it cannot be relicensed without approval from the GNU project. Ivan On Tue, Jan 29, 2013 at 5:53 AM, Hugo Arregui hugo.arre...@gmail.comwrote: Hi, Recently I wrote an implementation of msgpack[1], which can be found here[2]. This is my first full project in scheme, so I would appreciate any feedback (please, be destructive). A couple of points already has been mentioned: - Macros to reduce redundancy (I'm reading about them, so I'm expecting to fix this soon). - A non technical but important thing: I'm using endian-blob egg, which is licensed as gpl and it's incompatible with the project license, which is bsd. But, beside that, I have a few questions: 1) To avoid the creation of very heavy structures in tests, i'm using a kind of mock[3], which overrides some procedures, and restores it later. Is this the right way to do it?. In fact, in the egg branch I tried to pack the project as an egg and I think this hack is not working. 2) To access the procedures mentioned in (1), i'm using two modules: msgpack-imple which contains the whole project and it's used for the tests, and msgpack which import msgpack-imple and expose the real interface. Again, is this the right way to do it? 3) To read/write float/double numbers (in ieee754) i'm using endian-blob egg (here[4]), it's there any alternative without implementing the full float/double-binary logic (which seems quite complicated)? Thanks, Hugo. [1] http://msgpack.org/ [2] https://github.com/hugoArregui/msgpack-scheme [3] https://github.com/hugoArregui/msgpack-scheme/blob/master/tests/run.scm#L187 [3] https://github.com/hugoArregui/msgpack-scheme/blob/master/msgpack-imple.scm#L131 ___ 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 ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] The odd case of the channel egg's tests failures
Attached is an even simpler test case that causes segmentation fault even when compiled with -O -d2 options but works fine when run under the interpreter. On Fri, Feb 1, 2013 at 10:02 AM, Ivan Raikov ivan.g.rai...@gmail.comwrote: Hi all, I also have been encountering some mysterious heap full errors and even segmentation faults when working with large data sets and some tree data structures or srfi-4 vectors. For example, the attached code does not include any FFI stuff, yet it causes segmentation faults when compiled with anything other than -O -d2 options. I will be happy to help write scripts to analyze memory layout logs. Ivan On Thu, Jan 31, 2013 at 10:01 PM, Alaric Snell-Pym ala...@snell-pym.org.uk wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/31/2013 12:34 PM, Moritz Heidkamp wrote: What I need now is someone encouraging me in such an effort, suggesting various improvements to that work-intensive and toilsome project and who offers reliable support and hacking time. To remain realistic, I would even be happy with someone commenting on just least one or two of these three requests... This seems like a worthy addition to the Chicken debugging toolset but also like a lot of work. I won't discourage you from persuing it, of course, but I'm afraid I won't be able to help with actual hacking due to my ignorance of the relevant internals and the lack of time to become acquainted with them right now. I figured we could encourage Felix to do the internals bit and spit out a log file that the rest of us can learn to make sense of, as a good division of labour! ABS - -- Alaric Snell-Pym http://www.snell-pym.org.uk/alaric/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlEKaxUACgkQRgz/WHNxCGpecwCggj/DR+KYPpWakFNcHEJ6lkjL mUkAn0Inu1LNdVZzHNNexlWMcfwTvxM3 =c/id -END PGP SIGNATURE- ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users srfi-4-utils-test.scm Description: Binary data ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Msgpack implementation for scheme (and some questions)
Hi Hugo, Thanks for your work on msgpack, it seems like an interesting project. Unfortunately, machine floating point formats are complicated, so any related code will be complicated as well. I don't know much about the msgpack protocol, but if representing floating-point numbers as strings is an option, I encourage you to look at fpio ( http://wiki.call-cc.org/eggref/4/fpio ), a BSD-licensed egg for converting floating point numbers to strings and vice versa. endian-blob includes code from GDB, so it cannot be relicensed without approval from the GNU project. Ivan On Tue, Jan 29, 2013 at 5:53 AM, Hugo Arregui hugo.arre...@gmail.comwrote: Hi, Recently I wrote an implementation of msgpack[1], which can be found here[2]. This is my first full project in scheme, so I would appreciate any feedback (please, be destructive). A couple of points already has been mentioned: - Macros to reduce redundancy (I'm reading about them, so I'm expecting to fix this soon). - A non technical but important thing: I'm using endian-blob egg, which is licensed as gpl and it's incompatible with the project license, which is bsd. But, beside that, I have a few questions: 1) To avoid the creation of very heavy structures in tests, i'm using a kind of mock[3], which overrides some procedures, and restores it later. Is this the right way to do it?. In fact, in the egg branch I tried to pack the project as an egg and I think this hack is not working. 2) To access the procedures mentioned in (1), i'm using two modules: msgpack-imple which contains the whole project and it's used for the tests, and msgpack which import msgpack-imple and expose the real interface. Again, is this the right way to do it? 3) To read/write float/double numbers (in ieee754) i'm using endian-blob egg (here[4]), it's there any alternative without implementing the full float/double-binary logic (which seems quite complicated)? Thanks, Hugo. [1] http://msgpack.org/ [2] https://github.com/hugoArregui/msgpack-scheme [3] https://github.com/hugoArregui/msgpack-scheme/blob/master/tests/run.scm#L187 [3] https://github.com/hugoArregui/msgpack-scheme/blob/master/msgpack-imple.scm#L131 ___ 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] [Q] uri-common has problem with UTF-8 uri.
Hi Peter, I think uri-generic does not silently mangle input upon receiving UTF-8, it just returns #f. I think it is not a bad idea to raise an exception instead. I have not yet had the chance to thoroughly test the UTF-8 mapping constructor, but will try to do this during the weekend. Ivan On Thu, Jan 17, 2013 at 5:45 PM, Peter Bex peter@xs4all.nl wrote: On Thu, Jan 17, 2013 at 09:35:36AM +0900, Ivan Raikov wrote: Hi Peter, I think that allowing raw UTF-8 sequences in uri-generic breaks compatibility with RFC 3986. In other words, if you construct a URI with a UTF-8 sequence that happens to include reserved ASCII characters, those ASCII characters will not get escaped, and you could potentially be sending an invalid URI to a legacy system that does not understand UTF-8. Hi Ivan, I agree with your assessment, but the way it currently silently mangles input isn't ideal. I think it would be good if all constructors raised an exception when receiving octets with the high bit set (this is non-ASCII, which means it falls outside the scope of RFC 3986 so it's acceptable to raise an exception). What are your thoughts on this? If we do this, of course the error message should include a pointer to the new UTF conversion API so people know what to do. My proposed solution is to include a UTF-8 aware constructor to uri-generic and prevent percent decoding of UTF-8 sequences. I believe that this solution is compatible with the IRI to URI mapping scheme described in Section 3.1 of RFC 3987, but indeed I need to extend the uri-generic test suite with more UTF-8 examples to ensure that nothing is broken. I think that any solution will have to give the user choice whether to use ASCII or UTF-8, and not just default to UTF-8. This seems like a good compromise. Unfortunately it means the API will grow quite a bit and make it less easy to use. I'll need to consider what to do with http-client's implicit URI conversion though (it accepts either strings or URI objects). I guess for now I'll keep it the way it is. If people need UTF8 they can use the new conversion procedures. Maybe later I can change it, this should not cause any breakage (unless talking to legacy systems, but those don't accept UTF anyway so if you have UTF-8 input, there's a problem anyway) Cheers, Peter -- http://sjamaan.ath.cx ___ 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] [Q] uri-common has problem with UTF-8 uri.
Hi Peter, I think that allowing raw UTF-8 sequences in uri-generic breaks compatibility with RFC 3986. In other words, if you construct a URI with a UTF-8 sequence that happens to include reserved ASCII characters, those ASCII characters will not get escaped, and you could potentially be sending an invalid URI to a legacy system that does not understand UTF-8. For example, the UTF-8 string пиле consists of the octets D0 BF D0 B8 D0 BB D0 B5. The ASCII codes corresponding to these octets are all outside of the allowed character set defined in RFC 3986 and will correctly get rejected by the uri-reference constructor. However, if we allow UTF-8 string operations in uri-generic, and extend the unreserved character set to include Unicode, these octets will form a valid character sequence and will get accepted by uri-reference without being escaped. If you then send the result of uri-string to a system that does not understand UTF-8, the URI will get rejected. My proposed solution is to include a UTF-8 aware constructor to uri-generic and prevent percent decoding of UTF-8 sequences. I believe that this solution is compatible with the IRI to URI mapping scheme described in Section 3.1 of RFC 3987, but indeed I need to extend the uri-generic test suite with more UTF-8 examples to ensure that nothing is broken. I think that any solution will have to give the user choice whether to use ASCII or UTF-8, and not just default to UTF-8. Ivan On Thu, Jan 17, 2013 at 4:51 AM, Peter Bex peter@xs4all.nl wrote: OK, I took some time to investigate and I pinpointed this problem. This appears to happen due to the use of core srfi-14 and srfi-13 in uri-generic; its char-set operations simply don't deal with anything beyond ASCII. Only by switching to the UTF versions utf8-srfi-14, utf8-srfi-13 and unicode-char-sets this works: Without patch: $ csi -R uri-generic -P '(uri-encode-string 삼계탕)' �%82%BC�%B3%84�%83%95 With patch: $ csi -R uri-generic -P '(uri-encode-string 삼계탕)' %EC%82%BC%EA%B3%84%ED%83%95 Ivan, what do you think about adding the UTF8 dependency, as per the attached patch (against trunk)? ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Q] uri-common has problem with UTF-8 uri.
Hi all, I realized that I replied only to Sungjin and neglected to include the mailing list, so let me repeat. Section 3.1 of RFC 3987 defines a mapping between IRIs and URIs such that UTF-8 sequences are percent-encoded. So I implemented a procedure iri-uri, which percent-encodes a UTF-8 string and passes it to the usual URI constructor in uri-generic. It is intended to work as follows: (iri-uri http://example.com/삼계탕;) = #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %EC%82%BC%EA%B3%84%ED%83%95) query=#f fragment=#f) However, the uri-generic constructor tries to normalize all URIs by percent decoding them, so currently the URL above results in this: #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ �%82%BC�%B3%84�%83%95) query=#f fragment=#f) In other words, parts of the percent-encoded UTF-8 sequences are decoded back to unprintable ASCII characters. So a better solution might indeed be to change iri-uri to pass the percent-encoded sequences directly to make-uri without attempts at percent-decoding normalization. Sungjin's modification to the definition of 'unstructured' is in line with the IRI RFC (except of course we will need to add all other character sets besides Hangul). However, it was already pointed out by Peter and Alex that URIs containing native UTF-8 sequences might results in invalid URLs being sent to systems that do not understand IRIs or UTF-8. I will modify iri-uri to avoid normalization and see if this would produce ok results. Ivan On Tue, Jan 15, 2013 at 12:20 PM, Alex Shinn alexsh...@gmail.com wrote: =삼계탕start=0rows=10http://127.0.0.1:8983/solr/select?q=%EC%82%BC%EA%B3%84%ED%83%95start=0rows=10 ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Q] uri-common has problem with UTF-8 uri.
Hi again, I have now extended the utf8 code in uri-generic, so that UTF-8 sequences are percent-encoded as lists of the form '(% h1 h2 [% h3 h4 ...])). The percent-decoding routine is not going to decode sequences of more that one byte, so that now percent encoding normalization will not interfere with encoded UTF-8 sequences. I have also renamed the iri-uri routine to utf8-string-uri. I think now its behavior is compliant with both RFC 3986 and 3987: (utf8-string-uri http://example.com/삼계탕;) = #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %EC%82%BC%EA%B3%84%ED%83%95) query=#f fragment=#f) (uri-string (utf8-string-uri http://example.com/삼계탕;)) = http://example.com/%EC%82%BC%EA%B3%84%ED%83%95; The code is available here: http://bugs.call-cc.org/browser/release/4/uri-generic/branches/utf8 Sungjin, can you take a look at this code as see if it works for you? Ivan On Tue, Jan 15, 2013 at 1:22 PM, Ivan Raikov ivan.g.rai...@gmail.comwrote: Hi all, I realized that I replied only to Sungjin and neglected to include the mailing list, so let me repeat. Section 3.1 of RFC 3987 defines a mapping between IRIs and URIs such that UTF-8 sequences are percent-encoded. So I implemented a procedure iri-uri, which percent-encodes a UTF-8 string and passes it to the usual URI constructor in uri-generic. It is intended to work as follows: (iri-uri http://example.com/삼계탕;) = #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %EC%82%BC%EA%B3%84%ED%83%95) query=#f fragment=#f) However, the uri-generic constructor tries to normalize all URIs by percent decoding them, so currently the URL above results in this: #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ �%82%BC�%B3%84�%83%95) query=#f fragment=#f) In other words, parts of the percent-encoded UTF-8 sequences are decoded back to unprintable ASCII characters. So a better solution might indeed be to change iri-uri to pass the percent-encoded sequences directly to make-uri without attempts at percent-decoding normalization. Sungjin's modification to the definition of 'unstructured' is in line with the IRI RFC (except of course we will need to add all other character sets besides Hangul). However, it was already pointed out by Peter and Alex that URIs containing native UTF-8 sequences might results in invalid URLs being sent to systems that do not understand IRIs or UTF-8. I will modify iri-uri to avoid normalization and see if this would produce ok results. Ivan On Tue, Jan 15, 2013 at 12:20 PM, Alex Shinn alexsh...@gmail.com wrote: =삼계탕start=0rows=10http://127.0.0.1:8983/solr/select?q=%EC%82%BC%EA%B3%84%ED%83%95start=0rows=10 ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Q] uri-common has problem with UTF-8 uri.
Hi Alex, I understand your point about make-uri, but I want to provide a uri constructor that takes a UTF-8 input string and maps it in accordance with RFC 3986 / 3987. So we still have to perform path and percent-encoding normalization steps for the ASCII portions of the string. make-uri makes no such attempts at normalization and so does not strictly follow RFC 3986. I interpreted Section 3.1 from RFC 3987 to mean that UTF-8 are encoded by taking each octet and applying percent encoding on it. So for the string пиле the octets are D0 BF D0 B8 D0 BB D0 B5 and (utf8-string-uri http://example.com/пиле;) produces #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %D0%BF%D0%B8%D0%BB%D0%B5) query=#f fragment=#f) For the string 삼계탕 the octets are EC 82 BC EA B3 84 ED 83 95 and (utf8-string-uri http://example.com/삼계탕;) produces #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %D0%BF%D0%B8%D0%BB%D0%B5) query=#f fragment=#f) Can you elaborate what is broken about this? Perhaps I do not understand UTF-8 and need to apply a bitmask or something to the octets? Percent-encoded sequences of more than one octet will not get touched by pct-decode in the current implementation, so you will not get double escaping. Percent-encoded sequences of one octet will get decoded if they fall in the unstructured char-set, as per RFC 3986. Ivan This result looks broken. As I noted in my previous mail, the URI representation already handles non-ASCII characters and escapes on output: $ csi -R uri-common #;1 (make-uri scheme: http host: 127.0.0.1 path: '(/ 삼계탕)) #URI-common: scheme=http port=#f host=127.0.0.1 path=(/ 삼계탕) query=#f fragment=#f #;2 (uri-string (make-uri scheme: http host: 127.0.0.1 path: '(/ 삼계탕))) http://127.0.0.1/82%BCB3%8483%95; If you put percent escapes _inside_ the internal path representation, you'll get double escaping. Parsing is a separate matter, and utf8-string-uri should return the URI object without error, but with the unescaped values in the path and query as resulting from the make-uri above. Unrelated, the actual escaped output looks buggy - it looks like some characters like the leading %EC% are getting dropped. -- Alex #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %EC%82%BC%EA%B3%84%ED%83%95) query=#f fragment=#f) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Q] uri-common has problem with UTF-8 uri.
Oops, the second example should have been For the string 삼계탕 the octets are EC 82 BC EA B3 84 ED 83 95 and (utf8-string-uri http://example.com/삼계탕;) produces #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %EC%82%BC%EA%B3%84%ED%83%95) query=#f fragment=#f) Sorry about the confusion. Ivan On Tue, Jan 15, 2013 at 3:03 PM, Ivan Raikov ivan.g.rai...@gmail.comwrote: Hi Alex, I understand your point about make-uri, but I want to provide a uri constructor that takes a UTF-8 input string and maps it in accordance with RFC 3986 / 3987. So we still have to perform path and percent-encoding normalization steps for the ASCII portions of the string. make-uri makes no such attempts at normalization and so does not strictly follow RFC 3986. I interpreted Section 3.1 from RFC 3987 to mean that UTF-8 are encoded by taking each octet and applying percent encoding on it. So for the string пиле the octets are D0 BF D0 B8 D0 BB D0 B5 and (utf8-string-uri http://example.com/пиле;) produces #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %D0%BF%D0%B8%D0%BB%D0%B5) query=#f fragment=#f) For the string 삼계탕 the octets are EC 82 BC EA B3 84 ED 83 95 and (utf8-string-uri http://example.com/삼계탕;) produces #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %D0%BF%D0%B8%D0%BB%D0%B5) query=#f fragment=#f) Can you elaborate what is broken about this? Perhaps I do not understand UTF-8 and need to apply a bitmask or something to the octets? Percent-encoded sequences of more than one octet will not get touched by pct-decode in the current implementation, so you will not get double escaping. Percent-encoded sequences of one octet will get decoded if they fall in the unstructured char-set, as per RFC 3986. Ivan This result looks broken. As I noted in my previous mail, the URI representation already handles non-ASCII characters and escapes on output: $ csi -R uri-common #;1 (make-uri scheme: http host: 127.0.0.1 path: '(/ 삼계탕)) #URI-common: scheme=http port=#f host=127.0.0.1 path=(/ 삼계탕) query=#f fragment=#f #;2 (uri-string (make-uri scheme: http host: 127.0.0.1 path: '(/ 삼계탕))) http://127.0.0.1/82%BCB3%8483%95; If you put percent escapes _inside_ the internal path representation, you'll get double escaping. Parsing is a separate matter, and utf8-string-uri should return the URI object without error, but with the unescaped values in the path and query as resulting from the make-uri above. Unrelated, the actual escaped output looks buggy - it looks like some characters like the leading %EC% are getting dropped. -- Alex #(URI scheme=http authority=#(URIAuth host=example.com port=#f) path=(/ %EC%82%BC%EA%B3%84%ED%83%95) query=#f fragment=#f) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Trouble w/ ersatz
Hi Matt, Thanks for your offer to write documentation. Of course I will be happy to accept your contributions. You are correct that '((a Tstr foo) (x Tstr bar)) is also an alist, but the use of quote means that the Tstr constructor is not evaluated. There is a longer discussion on quote vs. quasiquote on Stack Overflow: http://stackoverflow.com/questions/134887/when-to-use-quote-in-lisp . So the value in your example ends up being a list that consists of the symbol 'Tstr and the string bar. Whereas the evaluation of (Tstr bar) yields a record of type tvalue, which is what the ersatz evaluator understands. One way to construct the models alist without quasiquotation would be the following (list (cons 'a (Tstr foo)) (cons 'x (Tstr bar)) ) This yields the same result as the quasiquotation example, namely that each element of the alist is an ordered pair where the first element is a symbol and the second element is a record of type tvalue. -Ivan On Thu, Nov 8, 2012 at 12:35 PM, Matt Gushee mattgus...@gmail.com wrote: The models argument must be an association list, i.e. a list of dotted pairs of the form (NAME . VALUE) where NAME is a symbol and VALUE is a template value. ... yes, got that ... am I mistaken in thinking that '((a b c) (x y z)) [or '((a Tstr foo) (x Tstr bar))] is effectively an alist, where the cdr of each element is itself a pair? https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] A poor man's continuous integration server with awful+spiffy
Hi all, I recently had the need to automatically produce native binaries for nemo, one of my applications written in Scheme. So I decided to try using awful to construct a simple server script that can fetch the latest version of nemo from svn, compile nemo and its dependencies, make a release tarball, and allow clients to download the latest tarball. With Mario's help, it all worked quite well, so I am attaching the resulting script for posterity. The only difficulty I had was creating a download page that can return one of two types of content: 1) .tar.gz file with correct MIME type and disposition or 2) an HTML page informing the client that a build is currently in progress. The download page specification in awful ended up as follows: (define-page /nemo-download (lambda () (let ((version.path (update-nemo-build))) ;; check if the build lock file exists, meaning a build is currently ;; in progress (if (file-exists? (build-lock-path (car version.path))) `(html (body (p Build in progress, try again later.))) ;; otherwise return the .tar.gz file (lambda () (let ((rel-path (release-file-path (car version.path (parameterize ((root-path (pathname-directory rel-path))) (send-file (pathname-strip-directory rel-path no-template: #t) The send-file procedure is based on send-static-file from spiffy, and its implementation can be seen in the attached file. I hope this is useful for some. -Ivan nemo-ci.scm Description: Binary data ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] lexgen documentation
Hi Matt, Thanks for trying to use lexgen. You are right that I had not created a wiki page for input-classes, this has now been corrected. As for your second question, all identifiers prefixed by char-list/ are created by the following declaration in the example: (import-instance (Token char-list-Token char-list/) (CharLex char-list-CharLex char-list/)) This imports the char-list instances of Token and CharLex and prefixes all their identifiers with char-list/. So if the Token typeclass defines an identifier called 'range', the import-instance declaration will create an identifier char-list/range and so on. I will clarify this in the documentation. Thanks for asking questions and let me know if I can help with anything. Ivan On Sun, Oct 28, 2012 at 2:24 AM, Matt Gushee mattgus...@gmail.com wrote: Hello, everybody-- I am trying to learn how to use lexgen, but I have run into a couple of issues with the documentation: * There is a reference to documentation for the input-classes egg, but that doc either does not exist or has not been posted on the Chicken wiki. * The example code includes several identifiers that do not appear to be defined anywhere: char-list/range, char-list/set, and other similar names-with-slashes. I have checked http://api.call-cc.org/doc/ for the first two of these, and they are not found. Although I have done a bit of work with lexing parsing in the past, I'm no guru, so I'm finding these to be significant obstacles ... is there some alternative documentation that will help me? Thanks for any all tips. -- Matt Gushee ___ 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] uri-generic on Ubuntu 11.04 x86, gcc 4.5.2
Hi Mario, uri-generic seems ok on x86_64 running under Debian testing and compiled with gcc 4.7.1. I will try it out later on Mint Linux, which is an Ubuntu derivative, I believe. Ivan On Fri, Oct 26, 2012 at 2:59 AM, Mario Domenech Goulart mario.goul...@gmail.com wrote: Hi, For the record: Today I tried to install uri-generic with Chicken 4.8.0 on a freshly installed Ubuntu 11.04, on a x86 hardware. When compiling uri-generic.scm, chicken (the program) died with a segfault. So I built Chicken with DEBUGBUILD=1 and could not reproduce the problem. Then I built Chicken using another gcc version and it worked. The problematic gcc version: gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 The one that worked: gcc (Ubuntu/Linaro 4.4.5-15ubuntu1) 4.4.5 Best wishes. Mario -- http://parenteses.org/mario ___ 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] Question about the greediness of the lexgen egg's lex procedure
Hello, Thanks for trying to use lexgen :-) The documentation is out of date; while the initial design of lexgen did use the longest of multiple possible matchings, it turned out to be difficult to control the level of greediness if you wanted longest match only in some situations, but not in others. So the current implementation is indeed based on first possible match. I will update the documentation accordingly. Ivan On Mon, Oct 22, 2012 at 9:32 PM, Sam Hardwick sam.hardw...@gmail.com wrote: If I'm understanding things correctly, the lexgen egg's lex procedure is (at least in some cases) matching based of the order of specification (match the first possible thing), not on longest possible match. Can this be right? The documentation says lex takes a pattern and a string, turns the string into a list of streams (containing one stream), applies the pattern, and returns the longest match. I placed an example of what I mean at http://paste.call-cc.org/paste?id=8196b316bf50c18bb044870f95bbbebb00e5026d . Here, testpat1 will match ... as one . followed by an untokenizable remainder, whereas testpat2 will match ... correctly in its entirety. Sam Hardwick ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken release 4.8.0
Dear all, Chicken 4.8.0 has been made available at the following URL: http://code.call-cc.org/releases/4.8.0/chicken-4.8.0.tar.gz The changes in this release are described in the NEWS file available here: http://code.call-cc.org/releases/4.8.0/NEWS Thanks to all who contributed with bug reports and fixes. Happy hacking, -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken 4.8.0 release candidate 4 now available
Dear all, The fourth and hopefully final release candidate for the upcoming release 4.8.0 of Chicken is now available at the following URL: http://code.call-cc.org/dev-snapshots/2012/09/15/chicken-4.8.0rc4.tar.gz The list of changes in this release is available here: http://code.call-cc.org/dev-snapshots/2012/09/15/NEWS Please try out this release candidate in the next few days and let us know if you encounter any bugs. Thanks to all who have been patiently testing the release candidates. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken 4.8.0 release candidate 1 now available
Dear all, The first release candidate for the upcoming release 4.8.0 of Chicken is now available at the following URL: http://code.call-cc.org/dev-snapshots/2012/08/08/chicken-4.8.0rc1.tar.gz The list of changes in this release is available here: http://code.call-cc.org/dev-snapshots/2012/08/08/NEWS Please try out the release candidate and let us know if you encounter any bugs, either on this mailing list, the Chicken bug tracker, or the IRC channel. In particular, additional testing under Mac OS X and Windows would be appreciated. Please keep in mind that this is a major release that includes numerous important modifications and fixes relative to 4.7.0 and thus proceed with caution if you are upgrading from the last stable release of Chicken. Regards, Ivan Raikov ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] 500 eggs!
Congratulations to all! Looking forward to the next 500 ;-) -Ivan On Jun 15, 2012 1:54 AM, Mario Domenech Goulart mario.goul...@gmail.com wrote: Hi, Yeah, yesterday we've reached 500 eggs! $ chicken-install -list 2 /dev/null | sed '/^$/d' | wc -l 500 Thanks to all egg authors. Eggs are an important part of what we call _practical_ in CHICKEN. Keep the good work. PS: `-list' is only available in versions = 4.7.2. :-) Best wishes. Mario -- http://parenteses.org/mario ___ 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
[Chicken-users] lalr version 2.4.2
Hi all, I have updated the lalr egg to use upstream version 2.4.1, and have changed the license to LGPL-3, in order to match upstream. Release 2.4.2 of the lalr egg also includes a small bug fix to the lr-driver routine. Version 2.4.1 also introduces a new interface for lexical tokens, so it is likely that parser code written for lalr 2.3.x will not compile out of the box. Let me know if you need help with porting your code to the lalr version. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] json-abnf fails to parse booleans
Hello, Thank you for your bug report, and for your efforts to harmonize the different JSON implementations. I have made the changes you suggest, except for the following: - due to a limitation in abnf/lexgen-derived parsers, #f cannot be a value returned by a parser. So the JSON true and false values are represented by '(#t) and '(#f). - I prefer to use the Chicken module system to handle namespace issues, so that instead of renaming the parser procedure, I would import it as (import (prefix json-abnf: json-abnf)). So I have not changed the name of the procedure exported by json-abnf. I have implemented the rest of your suggestions, added or modified the corresponding unit tests, and made a new release of json-abnf. Thanks again for your efforts. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] A proposal for egg category reassignment
Good point, I did not think to check where these eggs are hosted. So here is the revised list; I have marked the eggs not hosted on call-cc.org with an asterisk (*) and I advise their respective authors to correct the categories. And yes, changing the category would also necessitate tagging a new release for each egg. -Ivan Eggs in Uncategorized or invalid category: aes - Cryptography crypto-tools - Cryptography embedded-test - Unit-testing format-compiler/format-compiler-base - Input/Output sets - Algorithms and data-structures simple-logging - Input/Output * freetds - Databases * kalaha - Miscellaneous * hmac - Cryptography * ssql - Databases * ssql-postgresql - Databases Eggs in Miscellaneous: condition-utils - Language extensions dsssl-utils - Language extensions error-utils - Language extensions expand-full - Language extensions hashes - Algorithms and data-structures latch - Language extensions posix-utils - OS interface procedure-decoration - Language extensions s48-modules - Language extensions shell - Tools srfi-34 - Language extensions stalin - Code generation variable-item - Language extensions * smsmatrix - Networking * efax - Networking Peter Bex peter@xs4all.nl writes: Note that not all eggs may be hosted on Subversion, and you may not have access to them all. Furthermore, the new system requires eggs to be tagged before the category is changed (it shows the information from the latest release, ie that which you will get if you simply chicken-install it). ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] A proposal for egg category reassignment
Of course, these are just suggestions. Networking was the closest to Communication which would have been a more appropriate category for smsmatrix and efax. It's not that Miscellaneous is not correct, I would just like to keep it from becoming too populous, if possible. -Ivan Peter Bex peter@xs4all.nl writes: On Tue, Oct 11, 2011 at 12:51:29PM +0900, Ivan Raikov wrote: efax - Networking smsmatrix - Networking I don't really consider sending fax or SMS messages networking. Both happen to use a webservice to do this, but does that make it a networking egg? Of course I can change the category if Miscellaneous really is not the correct category for this. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] A proposal for egg category reassignment
Ok, I will not touch those then. Thanks, -Ivan Alaric Snell-Pym ala...@snell-pym.org.uk writes: Eggs in Uncategorized or invalid category: aes - Cryptography crypto-tools - Cryptography I've done these, just not tagged a new version yet, so it's still showing them as invalid! (I put them in crypto when it should have been crypt...) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] A proposal for egg category reassignment
Hi all, It seems that the egg categories Uncategorized or invalid and Miscellaneous have swelled quite a bit since the last time there was a major reorganization. So I propose to reassign the categories of the eggs listed below to what I like to believe are more sensible categories. If an egg belongs to you, and you do NOT want me to change the category, please let me know within a week or so. If you think a different category is a better match, then please let me know as well. Thanks, -Ivan Proposed egg category reorganization: Eggs in Uncategorized or invalid category: aes - Cryptography crypto-tools - Cryptography embedded-test - Unit-testing format-compiler/format-compiler-base - Input/Output freetds - Databases kalaha - Miscellaneous hmac - Cryptography sets - Algorithms and data-structures simple-logging - Input/Output ssql - Databases ssql-postgresql - Databases Eggs in Miscellaneous: condition-utils - Language extensions dsssl-utils - Language extensions efax - Networking error-utils - Language extensions expand-full - Language extensions hashes - Algorithms and data-structures latch - Language extensions posix-utils - OS interface procedure-decoration - Language extensions s48-modules - Language extensions smsmatrix - Networking shell - Tools srfi-34 - Language extensions stalin - Code generation variable-item - Language extensions ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Porting modules to Chicken from other Schemes?
Hello, It depends on whether the module uses features specific to the other Scheme implementation. I find that the biggest impediments to porting to Chicken are non-hygienic macros, object oriented systems (often implemented as non-hygienic macros :-), and elaborate FFI constructs, which unfortunately vary widely between implementations. For example, there is a really nice Scheme package for solving partial differential equations, written by Brad Lucier, which very unfortunately uses an object-oriented package called Meroon. While there was a port of Meroon for Chicken 3, it was very very old, and is insanely hard to port it to Chicken 4. Likewise, there are nice language extensions for Racket that depend on some very advanced macrology that could in theory be ported to Chicken, but again would require a lot of work and understanding. I have been getting in the habit of scanning the repositories of other Schemes and other functional languages, and porting packages that I think I might use in my work, or would be generally useful for Chicken. Although I would not call this an organized effort I am willing to help others with porting work, so let me know if you have specific packages in mind. I find it easiest to port libraries written in Standard ML or non-object-oriented Ocaml. Because the ML languages have a very small core and no macros, programs written in them use a small set of functional idioms that are straightforwardly mapped to Scheme. Sadly, Standard ML no longer has a user community to speak of, but Ocaml has been picking up lately, and there have been some interesting new projects at the Ocaml Forge. I also like to peruse the Haskell Hackage database, which is currently the largest active package repository for a functional language. I find it that it is not hard to port Haskell libraries that are written in the subset of Haskell that overlaps with ML. However, Haskell and GHC have some very advanced type extensions that could make it hard or impossible to port a package. But generally the Haskell libraries are of very high quality, so at least their source is instructive to read. -Ivan John Gabriele jmg3...@gmail.com writes: Hi, How much work is generally required to port modules from other Schemes to Chicken? Are there any organized efforts to gather free software modules from elsewhere, port them to Chicken, and add them to the egg repository (similar to how, say, Debian packages software into .deb packages)? Thanks, ---John ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Grumpy comments on eggs and an idea.
Hi guys, I must admit that the documentation is a bit obtuse, but I laughed at Matt's characterization that the interface is for geniuses :-) I am now creating turn key string-specialized variants of csv and mbox (which suffers from the same problem as csv), and updating the documentation, and should have the new versions released in the next few hours. Thanks for your feedback and thoughts. There is absolutely no problem with creating simplified variants of csv (and everything else abnf based), so just let me know if things don't work for you. I wrote the abnf-based eggs mostly for myself, since at the time people in the Chicken community were more interested in bitching about licenses rather than being productive and implementing basic RFCs and other necessities, but I am happy to get constructive suggestions and to improve those eggs accordingly. -Ivan On Tue, Sep 6, 2011 at 6:44 PM, Moritz Heidkamp mor...@twoticketsplease.de wrote: Hi Matt, Matt Welland estifo...@gmail.com writes: After a long day of work and being very much in the mode of just getting the job done I ran into the need to parse csv. Cool. I know that there is an egg for that. After installing the csv egg I looked at the documentation and my heart sunk. This was not an egg written for mortals but for scheme Gods, something I am not now nor ever will be. I thought that perhaps the Chicken 3 egg (which I knew to be usable by mere mortals) would compile under chicken 4.X and went to dig for the code but on the way I happened across the eggs page, odd, what is csv-xml? It sounded complicated but proved to be the old, easy to use code! Add (use csv-xml) and a single line of code (csv-list ...) and I was done. I found myself in exactly the same situation recently. Unfortunately, csv-xml was not yet available back then so I went with Ruby as I was in just getting the job done mode, as well. Ivan, maybe you could change the egg documentation to be a bit more elaborate, e.g. explain the example a bit? Or how about adding some pre-made convenience parser fuctions that can be parameterized by passing arguments? Alternatively we could just add a link to csv-xml saying something like if you don't have any special parsing needs see the csv-xml egg. This gave me an idea for an enhancement to the eggs page. How about adding tags to eggs and a mechanism to filter on the tags at the top of the page? I'm not suggesting that this is a high priority but maybe something that could be added the next time those pages are refactored. Some useful tags might be: application, alpha, beta, production, advanced, for-geniuses-only I think there is a tag mechanism in the wiki already, not sure how or if it's used though. Oh, and thank you to both the csv and csv-xml egg authors. Even though I can't easily figure out how to use the csv egg I'm certain it is very elegant and powerful and although the name threw me off I very much appreciate the continued availability and simplicity of the csv-xml egg. I concur, thanks for the great code guys! Moritz ___ 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] type problem with mbox egg
Hello, Moritz, Thanks for using the mbox library. The documentation was not up-to-date, which has been fixed now. Some time ago, I generalized the parsing procedures of mbox so that they can take different types of input streams. I have now created an additional module, mbox-string, which is a version of mbox specialized to operate on strings. If you use mbox-file-messages from the mbox-string library, it will work as below (i.e. it takes a filename string or port argument). Please update your installation of mbox, try it out and let me know if you are still having problems. -Ivan On Tue, Sep 6, 2011 at 9:01 AM, Moritz Wilhelmy mw+chic...@wzff.de wrote: Hello, I have following problem with the mbox egg: Invoking mbox-file-messages always gives me a call of non-procedure error. #;5 (mbox-file-messages foo) Error: call of non-procedure: foo Call history: syntax (mbox-file-messages foo) eval (mbox-file-messages foo) -- According to the documentation, the argument to mbox-file-messages is supposed to be a filename. I'm new to chicken, so I expected it to be my fault, but apparently it isn't. (Please tell me if I'm doing something stupid anyway). Best regards, Moritz ___ 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] Results of the Chicken survey
Hi Christian, To generate the HTML form for the survey, I used the ssax, sxml-transforms, and html-form libraries. The SXML template and script to generate the HTML are now in the chicken-infrastructure repository. To process the mbox with emails sent from the survey form, and generate CSV files with survey data, I used the formular and csv libraries. The script that generated aggregate survey data is also in the infrastructure repository. As for the charts, unfortunately I had to create those semi-manually, using LibreOffice Calc and Draw. A good data plotting library for Chicken would be a most welcome addition :-) As for your comments on the survey itself, you raise good points. I added the name and email fields as a way to filter out potential spammers. But since I did not get any spam submissions during the month the survey was open, I think we can do without those fields in the future. You are right that I should have sent a reminder email, but I was quite busy the past two months, and forgot to do this. Now that the basic survey infrastructure has been created, making new surveys will be less time consuming, so hopefully we'll be able to focus on publicity :-) -Ivan Christian Kellermann ck...@pestilenz.org writes: Hi Ivan, * Ivan Raikov ivan.g.rai...@gmail.com [110825 04:25]: Please let me know if you have any comments or suggestions on how to improve the survey. Thanks, Thanks for going through all the hassle to get it up and running and for putting the results into the wiki. Apart from the results I wanted to know how you did the graphs and the form. As I gathered they were done by eggs of yours? Could you elaborate on that a bit? Now that the survey is over I also want to add some feedback of mine: * There were lots of mandatory questions, including personal details. Some people on reddit for example posted that this has put them off from taking part. It did not put me off but maybe that is a thing to reconsider next time. * We did not advertise this survey much, although I doubt it would have drawn thousands of people to the site :) But maybe we could have a reminder posting near the end of the voting period. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Results of the Chicken survey
Dear all, Thanks to everybody who responded to the Chicken survey. I have posted the results here: http://wiki.call-cc.org/survey2011 Please let me know if you have any comments or suggestions on how to improve the survey. Thanks, -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] State of Chicken 2011 Survey
Hi all, Inspired by Stephen Eilert's post about the State of Clojure survey, I created a simple State of Chicken survey form, which is available here: http://www.irp.oist.jp/raikov/chicken2011/ Please fill out the survey by Monday, August 15 2011. I will collect the data, but will not publish personally identifiable information, only a summary of the results. Please let me know if you have any questions or comments about the survey. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken release 4.7.0
Dear all, CHICKEN 4.7.0 has been made available at the following URL: http://code.call-cc.org/releases/4.7.0/chicken-4.7.0.tar.gz The changes in this release are described in the NEWS file available here: http://code.call-cc.org/releases/4.7.0/NEWS It has been eight months since the last stable release of CHICKEN, and this release includes a large number of changes, so be careful if upgrading from CHICKEN 4.6.0 or older. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] 4.6.7 development snapshot available
Will there be release candidates too? I don't know - I thought the snapshots have more or less the status of RCs. Ivan, what do you think? I also consider the snapshots to be more or less release candidates. So everybody, please make sure to test the 4.6.7 snapshot in the next week or so. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] German Lisp Workshop at the CCC in Cologne
We should not limit ourselves to libraries written in C! Ocaml has the same issue with readline, since it uses a funky French license, and one of their solutions is ledit, an rlwrap-like program implemented entirely in Ocaml. Chicken already has all the bindings to the core C I/O functions, so it might not be too much work to implement some minimal command-line history. -Ivan John Cowan co...@mercury.ccil.org writes: Moritz Heidkamp scripsit: One thing almost every participant wondered about was that csi didn't provide readline support out of the box. The answer is that supplying readline by default would require csi to be released under the GPL. There are two ways around this problem that I can think of: 1) We could use editline (aka libedit) by default rather than readline. 2) We could supply two versions of the csi main program, one with readline support under the GPL, and one without under the BSD. This is what Pure http://pure-lang.googlecode.com does. It has to be done by the copyright holder, because a licensee can't just remove the feature from a program that requires it to be under the GPL and make it not GPL any more, but the licensor can violate their own license if they want. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] German Lisp Workshop at the CCC in Cologne
Apparently, there is also a Common Lisp implementation of readline (MIT-licensed): http://common-lisp.net/project/linedit/ It looks baroque, but perhaps bits and pieces can be scavenged for a minimal Chicken readline. -Ivan John Cowan co...@mercury.ccil.org writes: 1) We could use editline (aka libedit) by default rather than readline. 2) We could supply two versions of the csi main program, one with readline support under the GPL, and one without under the BSD. This is what Pure http://pure-lang.googlecode.com does. It has to be done by the copyright holder, because a licensee can't just remove the feature from a program that requires it to be under the GPL and make it not GPL any more, but the licensor can violate their own license if they want. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] German Lisp Workshop at the CCC in Cologne
Of course, you will always be able to install the readline egg. This is about providing minimal readline functionality to new users who don't know yet about chicken-install, and who run csi expecting to have command history and perhaps completion available to them. I don't think we have to reinvent all of the readline functionality. -Ivan Evan Hanson vnh...@gmail.com writes: Chicken already has all the bindings to the core C I/O functions, so it might not be too much work to implement some minimal command-line history. -Ivan Keep in mind, though, that readline provides a lot more than just history (like completion, or my beloved vi mode...). Seems like a lot of functionality to reinvent IMO... Though perhaps editline or linenoise provide these? Evan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Save the Gazette!
Hi Alaric, Thanks for volunteering to write editorial content. As for your requests, I believe that you can already do 2) by using the Trac RSS feed: http://bugs.call-cc.org/timeline?ticket=onchangeset=onmilestone=offwiki=offmax=50daysback=7format=rss Obviously you can set the 'daysback' parameter to whatever you wish. Reasonable RSS readers allow you to filter the feed by creator and other criteria. I don't remember the URL to the git browser, but perhaps there is an RSS option there as well. As for 4), one can probably replace the creator tag in the RSS XML with the user's real name, rather than messing with the wiki or HTML. -Ivan Alaric Snell-Pym ala...@snell-pym.org.uk writes: When a community agrees it'd be cool to do something on a regular basis, to begin with, there's a lot of enthusiasm and volunteering, so things go well. However, a crucial point comes at which producing that thing starts to become a chore, no matter how popular the product is. At this point, if measures are not put into place to make it continue, it dies out. The Gazette is reaching that point, and I want to save it. I am happy to write editorial content such as recipes and mailing-list summaries, as long as I have time (and it doesn't take me long, I'm notoriously verbose in even the simplest of emails ;-), but I can't (personally) stomach the tedious part: going through the svn and git commit logs to find out what's happened, and then mapping git/svn identities to real names and people's pages on the wiki. So, I propose that you lot should automate it for me. I want: 1) The users page on the wiki to, in parens or brackets or something, after each person's name, list their various identities used in IRC / svn usernames / etc. so they can be easily tallied together 2) A script that, when run in a local svn checkout, or maybe by talking direct to SVN, lists all the eggs that have seen commits in a specified time period (with the option of right up to now as the end of the time period); and then lists the commit messages and revision numbers (for deeper investigation, if required) for each. For extra points, make sure that tagging a version of an egg is clearly indicated somehow (eg, TAGGED 1.5). This should all be a relatively simple matter of parsing the svn logs. 3) A script that, when run in a local git checkout, or maybe by talking direct to the core git repo, lists all the commits in a specified time period, grouped by branch. 4) All scripts should map usernames found in svn/git to displayed names via a function that defaults to identity. Somebody else please write a function to replace this, that looks in the wiki page and parses it to map svn/git identities to Wiki markup for the user's user page with their full name as the anchor text, that can be inserted into the above scripts to make wonderful magic happen. For bonus points, the output of scripts (2) and (3) could be actual markup for putting straight into the gazette, say as a bulleted list, just requiring editing to remove useless commits and to add editorial insight. Super special bonus point: 5) Write a script that, given a date range, parses the mailing list archive into wiki markup for a list of links to the posts in the archive, along with links to the user's pages as per (4), grouped by thread. I think that the above are relatively bite-sized chunks that people who want to see the Gazette continue should be able to manage between them; if the above are done then, if needed, I'd be willing to pioneer alone with running them each week (or every other week at worst) and writing some content around them! So, volunteers please :-) ABS ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] matchable 3.0 and SRFI-9 records
Thanks for restoring my sanity ;-) This was breaking a substantial amount of code I am working on. -Ivan Alex Shinn alexsh...@gmail.com writes: On Sun, Feb 13, 2011 at 6:52 PM, Ivan Raikov ivan.g.rai...@gmail.com wrote: It appears that the following pattern no longer works with matchable 3.0 (Chicken 4.6.5): Sorry about that, stupid copypaste error, fixed now. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] matchable 3.0 and SRFI-9 records
Hi all, It appears that the following pattern no longer works with matchable 3.0 (Chicken 4.6.5): (use matchable) (define-record-type test (make-test x y z) test? (xtest-x) (ytest-y) (ztest-z)) (match-let ((($ test x y z) (make-test 'a 1 two))) (print x y z)) Error: (match) no matching pattern Call history: syntax [failure37] (quote660 match661) syntax [failure37] (##core#quote match661) ... etc ... Does this mean that SRFI-9 record matching is no longer supported? -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] New eggs: npdiff, format-textdiff
Hi Daishi, I did not implement unified diff support, since detailed documentation about the format was non-existent three years ago. But I have noticed that now there are at least two informal technical discussions of the unified diff algorithm in the blogosphere, so I will give it a try and see if I can adapt the context diff module to produce unified diffs. I don't have much time to experiment with this, though, so I cannot promise it will work. -Ivan Daishi Kato dai...@axlight.com writes: It works, now. Thanks a lot. So, does it support the unified diff? No docs found on the wiki. I prefer the unified diff to the context diff. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] New eggs: npdiff, format-textdiff
Hello, Thanks for trying to use format-textdiff. The problem below was actually caused by a bug in npdiff, which has been fixed in npdiff release 1.13. Please update your copy of npdiff and try again. Let me know if you encounter any other issues with those eggs. -Ivan Daishi Kato dai...@axlight.com writes: Hi all, Anybody using format-textdiff? I encountered the following problem: CHICKEN (c)2008-2010 The Chicken Team (c)2000-2007 Felix L. Winkelmann Version 4.6.1 linux-unix-gnu-x86 [ manyargs dload ptables ] compiled 2010-09-25 on lobule (Linux) #;1 (use format-textdiff) #;2 (textdiff (with-input-from-string abc\n read-lines) (with-input-from-string def\n read-lines)) Error: bad argument count - received 4 but expected 6: #procedure Call history: ##sys#call-with-values vector-lib#check-index values make-vector vector-list ##sys#call-with-values vector-lib#check-index values make-vector vector-list-- ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Anyone looked at making an egg for clutter?
Unfortunately, Clutter has a very extensive and large API, as is commonly the case the systems like GTK/Cairo/Qt, etc. For example, the Haskell bindings for Clutter take up almost 100KB compressed, which is enormous for a library in a functional programming language. And even with the great FFI tools provided by Chicken, one still needs to figure out how to effectively wrap the non-trivial data structures used by Clutter and its underlying APIs. I think that a more appropriate functional approach might be to develop a bitmap equivalent of Functional Post Script that can interface with a minimal low-level display library such as ezxdisp. In that way, abstract definitions of GUI elements can be mapped on to any API for bitmap display. -Ivan Matthew Welland m...@kiatoa.com writes: Just curious clutter-project.org ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] CHICKEN release 4.6.0
Hi all, CHICKEN 4.6.0 has been released and is available at the following URL: http://code.call-cc.org/releases/4.6.0/chicken-4.6.0.tar.gz The changes in this release are described in the NEWS file available here: http://code.call-cc.org/releases/4.6.0/NEWS -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] A proposal for the egg index
Hi Alaric, The script that generates egg pages is make-egg-index.scm (found under directory scripts in the core Chicken distribution). I like the idea of linking to the source, so let's see what the egg table would look like if this link is added. Although it might make more sense to add this link to the salmonella reports page, since this would be more of interest to developers. As for the discussion, I think it is better if we keep all discussions in one place (e.g. the users mailing list). Having too many scattered places for discussion would make it more difficult to track information and questions related to one egg. -Ivan Alaric Snell-Pym ala...@snell-pym.org.uk writes: Re http://wiki.call-cc.org/chicken-projects/egg-index-4.html Here's a few ideas I had. Do people think there's merit in them? 1) Alongside/under the version link for each egg, provide a browse source link to http://bugs.call-cc.org/browser/release/4/EGG/tags/VERSION or to http://bugs.call-cc.org/browser/release/4/EGG/trunk if there's no tags. Perhaps a link to /trunk as well labelled browse trunk source if there IS a tag. This will make it easy for people to dive in and see how an egg works under the hood. 2) For each egg, a link to http://wiki.call-cc.org/eggref/4/EGG/discussion or some such, to encourage user feedback, feature requests, etc. Where's the tool that generates this page live, anyway? If there's interest in either of the above, I'm happy to propose a patch. ABS ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken release 4.5.0
Hi all, Chicken 4.5.0 has been released and is available here: http://chicken.wiki.br/releases/4.5.0/chicken-4.5.0.tar.gz The list of changes is described in the NEWS file available here: http://chicken.wiki.br/releases/4.5.0/NEWS -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Interfacing to Non-C Languages
Hello, I use the pyffi library to call the UNO functions of OpenOffice from Scheme. It works ok since Python is well integrated with C. I am not familiar with the C interface of FreeBasic, but you can take a look at pyffi to see how it is structured. -Ivan Karl Winterling kwinterl...@gmail.com writes: Hi, I sort of wanted to know if anyone uses Chicken with systems languages other than C and C++, like, say, FreeBasic. It might be neat to have an egg for gfxlib. ---Karl ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Bounty for an egg or two.
Hi Matt, The URL you have included below points to the home page of the General Polygon Clipper, a different library unrelated to FastGEO. As for FastGEO, it can be compiled by the Free Pascal Compiler, which can compile procedures to use the C calling convention, but beyond that I don't know if there would be any issues involved. I would think that it should be fairly straightforward to compile FastGEO with C calling convention and see if you get any errors. Another thing is that I found the FastGEO source code to be quite clear and readable, so it might be easier to port some of its procedures to Scheme, using SRFI-4 vectors and appropriate record types. This might be simpler than messing around with the Pascal code. -Ivan Matthew Welland m...@kiatoa.com writes: Thanks Ivan and Felix for taking a look. FastGEO looks promising, I'll dig a little deeper into it. Can you comment on how tough creating an interface to gpc would be? I see that it has Haskell, Java, Lua, Octave, Perl, Python etc. bindings which might indicate it is a bit easier to interface to than cgal. http://www.cs.man.ac.uk/~toby/alan/software//index.html#gpc On Sunday 04 April 2010 05:45:16 pm Ivan Raikov wrote: I don't know about Ogre3D, but I also found cgal to have an especially FFI-unfriendly API. Speaking of computational geometry libraries, I came across a library called FastGEO: http://www.partow.net/projects/fastgeo/index.html It is written in Object Pascal, but I found its interface to be quite simple, and I think it would not be altogether difficult to either port it to Scheme, or compile it with cdecl calling convention and use Chicken's FFI to call its procedures. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Bounty for an egg or two.
I don't know about Ogre3D, but I also found cgal to have an especially FFI-unfriendly API. Speaking of computational geometry libraries, I came across a library called FastGEO: http://www.partow.net/projects/fastgeo/index.html It is written in Object Pascal, but I found its interface to be quite simple, and I think it would not be altogether difficult to either port it to Scheme, or compile it with cdecl calling convention and use Chicken's FFI to call its procedures. -Ivan Felix fe...@call-with-current-continuation.org writes: From: Matthew Welland m...@kiatoa.com Subject: [Chicken-users] Bounty for an egg or two. Date: Thu, 1 Apr 2010 21:53:52 -0700 I'd like some help in getting some eggs made: 1. An interface to cgal 2. An interface to Ogre3d Phew - these are heavyweight and it seems that they use templates extensively. I don't think Swig is the right way to go, though: I don't know if the chicken backend is actively maintained, and it is not ported to chicken 4 yet, AFAIK. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Next Chicken release (4.4.0)
Hi all, The next release of Chicken, 4.4.0, is currently in the process of testing and preparation. It will be based on development snapshot 4.3.7, available for download here: http://chicken.wiki.br/dev-snapshots/2010/03/01/chicken-4.3.7.tar.gz Please download it and test it, and let me know if you encounter any problems. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Next Chicken release (4.4.0)
Hi Peter, Neither the snapshot tarball, nor the release tarball include the bootstrap directory, because they include the generated .c files instead. If there is a compelling case to do otherwise, I can of course change the tarball scripts. I am not aware of any major differences between the release tarball script and the development snapshot one, except that the release includes generated HTML documentation. The scripts are in the Chicken SVN repository and can be accessed here: http://www.irp.oist.jp/trac/chicken/browser/maintenance -Ivan Peter Bex peter@xs4all.nl writes: On Mon, Mar 01, 2010 at 04:57:23PM +0900, Ivan Raikov wrote: Hi all, The next release of Chicken, 4.4.0, is currently in the process of testing and preparation. It will be based on development snapshot 4.3.7, available for download here: http://chicken.wiki.br/dev-snapshots/2010/03/01/chicken-4.3.7.tar.gz Please download it and test it, and let me know if you encounter any problems. When I tried it, I couldn't find a bootstrap directory. Is this intentional or an omission? If intentional, what changes will this version go through to obtain a final release and how do we know that that version will work as expected if we can't test it as-is? Cheers, Peter ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] endian-port
Hello, Actually, the endian-blob egg in Chicken 4 is meant to take over the functionality of endian-port. Your port of endian-port would probably have to rely on the wrappers generated by swig, which are not especially readable or maintainable. Unfortunately, I don't have Chicken 3 installed anymore, so I cannot help with this particular problem, but take a look at endian-blob and let me know if it would be suitable for your needs. -Ivan Shawn Rutledge shawn.t.rutle...@gmail.com writes: I'm having trouble reading back a float from a file that I just wrote: (use endian-port) (let ([outp (port-endian-port (open-output-file eptest))]) (endian-port-write-ieee-float32 outp 5.25) (close-endian-port outp)) (let ([inp (port-endian-port (open-input-file eptest))]) (print (endian-port-read-ieee-float32 inp)) (close-endian-port inp)) it returns #f. This was with chicken 3, but I managed to compile that egg for chicken 4 as well, and it acts the same: /usr/bin/csc -feature compiling-extension -setup-mode -O2 -d0 -s -o endian-port.so endian-port.scm endian_lowio_wrap.c endian_lowio_lib.c floatformat.c endian_lowio.scm -lchicken -ldl -lm #;1 (load endian-port.so) ; loading endian-port.so ... ; loading /usr/lib64/chicken/4/iset.so ... so apparently porting that egg is going to be fairly trivial. Maybe I'll give it a shot if someone will create the directory under release/4? Functions like endian_lowio_read_int8 return by value, but endian_lowio_read_ieee_float32 set a value into a passed pointer, so wonder why that is... anyway seems to be where the problem is. Maybe it's done that way because of NaN? But usually NaN is a valid value, and can be tested for with isnan(). ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken release 4.3.0
Hi all, Chicken 4.3.0 has been released. It can be downloaded from here: http://www.call-with-current-continuation.org/chicken-4.3.0.tar.gz A list of the changes in this release can be found at http://chicken.wiki.br/releases/4.3.0/NEWS Let me know if there are any problems. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Computational geometry for chicken?
Hello, Are you really sure that you need a library that is as general as CGAL? Perhaps you should start by defining the exact requirements of the application you are interested in, and that should guide you in determining what kind of data structures and algorithms you need. For example, if all you are interested in is union and intersection of 2D objects, a quad-tree [1] might be sufficient, and I would not be surprised if there is a functional quad-tree implementation available online. So defining your requirements first might save you some labor. -Ivan [1] http://en.wikipedia.org/wiki/Quadtree Matthew Welland m...@kiatoa.com writes: I don't see anything in the eggs list that does the trick so I need some basic polygon computational geometry operations, namely; AND, OR, XOR, NOT. Any suggestions how to go about this? I have some slow, incomplete and buggy code I wrote a long time ago that I could resurrect and slap into shape but I think a proper egg accessing a C library would be a better solution. I'm guessing the right answer is to eggify http://www.cgal.org/ but that looks like a daunting task. Suggestions, insights and pointers appreciated. Free book on the subject for anyone interested: http://www.freetechbooks.com/computational-geometry-methods-and- applications-t557.html ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] How to report a bug?
Hi Jeronimo, Just before where it says you must fill in your name and e-mail address, it says that you must email me to register a username and password on the Chicken Trac instance. So send me your preferred username and password encoded with htpasswd (or in plain text), and I will set up the account for you. -Ivan Jeronimo Pellegrini j...@aleph0.info writes: On Sun, Nov 08, 2009 at 06:57:36PM -0500, Mario Domenech Goulart wrote: Hi Jeronimo Hi Mario! You can use the Chicken Trac (http://www.irp.oist.jp/trac/chicken/) to fill a bug report. I tried, but the start page says you must fill in your name and e-mail address on the settings page in order to submit or comment on tickets. I didn't find the settings page, and filling in my name and email in the preferences page didn't help (I still see no option to create a ticket). J. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Computational geometry for chicken?
Hi Matt, I am not an expert in the field, and I am not at work, so my access to scientific journals is limited, but a quick and careless Google search reveals several papers that discuss efficient set operations on polygons using quad trees: _Using quadtrees to represent spatial data_ Hanan Samet in _Computer Architectures for Spatially Distributed Data_. PDF available online: http://www.cs.umd.edu/~hjs/pubs/Samet85k.pdf In this paper, the author briefly mentions algorithms for obtaining polygon union and intersection with quadtrees, and refers to several other papers for details, of which papers at least one is available online: _Operations on Images Using Quad Trees_ Gregory Hunter and Kenneth Steiglitz in IEEE Transactions on Pattern Analysis and Machine Intelligence. PDF available online: http://www.cs.princeton.edu/~ken/quadtrees79.pdf There seem to be several other relevant papers, but since they are from the late 70s and early 80s, not all seem to have electronic editions available. There also seems to be a Haskell implementation of quad-tree: http://www.opensubscriber.com/message/haskell-c...@haskell.org/11477331.html This is probably something worth checking out, the author might be interested in similar problems to what you are interested in. -Ivan Matthew Welland m...@kiatoa.com writes: I definitely need only a very small subset of what CGAL can do. For now at least I need 2D polygon operations. I'm not familiar with how a quad tree is used in polygon operations. Do you have a reference? I see lots of very interesting stuff on quad trees (although quite a bit of it is pay to read) and they look very useful. For comparison here is a description of how one implementation of polygon operations was done: http://boolean.klaasholwerda.nl/bool.html#document Matt -=- ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Was crunch really discontinued? Is there an alternative?
Hello, If matrix multiplication is what you are interested in, then you could consider using the Chicken bindings for the BLAS and ATLAS libraries: http://chicken.wiki.br/eggref/4/blas http://chicken.wiki.br/eggref/4/atlas-lapack -Ivan Jeronimo Pellegrini j...@aleph0.info writes: Hello! I've been looking for some Scheme implementation that is suitable for number crunching and also supports SRFIs like 42 (eager comprehension), 45 (laziness), 25 (multidimensional arrays), and some others. So, I have tested Chicken, Bigloo and Gambit. There seems to be a necessary trade-off between number of SRFIs and number-chunching speed, unfortunately. I have written a program that repeatedly multiply matrices as a very simplistic benchmark (because it is the kind of thing I'd like to do very fast). The result was: bigloo 0.52s gambit 2.70s chicken 8.70s This is for compiled Scheme, with all possible optimizations turned on. The problem is that if it takes 1 hour for C code, I would then expect at least the same for bigloo, and at least 17 times more for Chicken -- or something close to that (it may even be a lot less, like 10 hours, but it's still too much time, unfortunately). So, going through the mailing list archives I learned about crunch, which seems to be awesome, but was being discontinued as of February: http://lists.gnu.org/archive/html/chicken-users/2009-02/msg00082.html (This would be my #1 option!) And I also found messages mentioning Pre-Scheme: http://lists.gnu.org/archive/html/chicken-users/2009-02/msg00109.html But neither of them is listed as an Egg in the eggs index here: http://chicken.wiki.br/chicken-projects/egg-index-4.html So, my question is -- was crunch really discontinued? What about the Pre-Scheme extension? Or is there anything similar? Thank you a lot! J. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Re: chicken-install should use sudo -v
I agree that chicken-install should not use sudo. The implicit invocation of sudo violates the principle of least astonishment, and presents a potential risk for users who do not understand the security implications of this approach. I opposed the inclusion of the sudo mis-feature in chicken-setup, but it nevertheless got included into chicken-install without much discussion on the mailing list. When in sudo mode, chicken-install tries to minimize sudo invocations by only calling it for filesystem operations, such as cp and mv, but this results in the possibility of command spoofing on systems where sudo has not been built with the SECURE_PATH option. Some Linux distributions, such as Debian, have sudo built with reasonably secure defaults, but there is no way to guarantee this for all systems on which chicken-install is run. The sudo mode is bad idea, has no precedent in similar systems, such as PLT Scheme and Hackage, and should not be used. -Ivan Aleksej Saushev a...@inbox.ru writes: Hello! John Cowan co...@ccil.org writes: Currently when you install an egg with many dependencies using the -s (sudo) switch, you have to wait to enter your password until the first time chicken-install invokes sudo. If, on detecting the -s switch, chicken-install immediately ran sudo -v, the password would be requested at the top. This variant of sudo does not run any command. Older sudo's that don't understand -v will just report an error, and no harm done. No, chicken ought not to use sudo, which is non-standard and unavailable on all non-gnu platforms, unless you install it. And there're many users around who don't use sudo at all since PAM provides enough functionality. I don't know about corresponding BSDauth solution, but I'm almost sure there's one. If you can provide plan with single authentication point and installing all built packages at once, that would be nice. Otherwise, just don't enforce sudo. As for me, I don't think that giving sudo privileges to chicken-install is good idea, since it may do too much under the hood and you're not even warned by password prompt. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Bignums in core
I agree that bignums do not automatically equal slower (fixnum) performance. For example, see here: http://people.csail.mit.edu/jaffer/CNS/interpreter-branch Also, the Glasgow Haskell Compiler wiki has some notes on replacing GMP: http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes -Ivan John Cowan co...@ccil.org writes: Nicholas Indy Ray scripsit: Bignums are nice and all, but I hardly see it as a practical necessity. Plus if I had to choose between fix/flonums or bignums and slower number performance, I'd choose the prior, that is why I use chicken! Bignums don't hurt performance much unless you use them. Ratios can hurt performance, but I'm not proposing them: / should still return a flonum if the mathematical result is not an integer. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken release 4.2.0
Hi all, Chicken 4.2.0 has been released. It can be downloaded from here: http://www.call-with-current-continuation.org/chicken-4.2.0.tar.gz Let me know if there are any problems. -Ivan On Thu, Sep 17, 2009 at 6:08 PM, Ivan Raikov ivan.g.rai...@gmail.com wrote: Hi all, I have merged Chicken trunk with the prerelease branch in the SVN repository, and I plan on making release 4.2.0 of Chicken within a week from today. This release will be based on development snapshot 4.1.9, but including the topological-sort procedure and some bug fixes to chicken-install. I am testing the prerelease with salmonella under Linux and MacOS X. Please try it out and let me know if there are any problems. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chicken pre-release 4.2.0
Hi all, I have merged Chicken trunk with the prerelease branch in the SVN repository, and I plan on making release 4.2.0 of Chicken within a week from today. This release will be based on development snapshot 4.1.9, but including the topological-sort procedure and some bug fixes to chicken-install. I am testing the prerelease with salmonella under Linux and MacOS X. Please try it out and let me know if there are any problems. -Ivan ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Proposed procedure movement in Chicken 4
Hi Kon, Good idea in principle. Unit extras and utils should be dissolved altogether, if possible. Can I ask you to wait until Chicken 4.2.0 is released? I will merge trunk into the prerelease branch this weekend, and start testing it, so if you can start making your changes to trunk after the weekend, I would much appreciate it. Thanks, -Ivan Kon Lovett klov...@pacbell.net writes: Hi Folks, These are planned changes to the unit structure of Chicken 4: 1) Unit utils 'read-all' - Unit extras. 2) Unit utils 'qs', 'system*', 'compile-file-options', 'compile- file' - Unit files. 3) Unit extras random stuff - Unit utils 4) Unit files pathname stuff - Unit pathname 5) Unit extras - Unit io 6) Unit data-structures functionals+combinators - combinators I want to perform 1 - 3 soon, and 4 - 6 after. Comments? Best Wishes, Kon ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Scheme Steering Committee Questions
Hi Kon, I would be curious to know what their position is on the SRFI process with respect to the Scheme standard. R6RS is deliberately incompatible with SRFI-1, and I see this as an attempt to subvert the SRFI process. Does the current Scheme Steering Committee consider it necessary to incorporate widely adopted SRFIs in future revisions of the standard? -Ivan Kon Lovett klov...@pacbell.net writes: Hi Folks, Aug 30th I will be meeting w/ some members of the Scheme Steering Committee (Olin Shivers, William D Clinger, and maybe Marc Feeley). Any questions you want me to ask? Best Wishes, Kon ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Chicken 4 development snapshots
I don't know enough about how the RSS feeds are constructed to answer this question. I will have to discuss with Mario and see what we can do. I can only say that there will have to be a separate run of Salmonella for Chicken 3 and 4, respectively, but I have no idea how the build logs are parsed. -Ivan Peter Bex peter@xs4all.nl writes: What will happen to the personalized Salmonella build report RSS feeds? Will it show chicken 3 _and_ chicken 4 build reports, or just chicken 4? Do people need to configure something special to get build reports for either version? ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users