You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(10) |
Jun
(6) |
Jul
(1) |
Aug
(10) |
Sep
(20) |
Oct
(5) |
Nov
(2) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(25) |
Feb
(6) |
Mar
(59) |
Apr
(9) |
May
(3) |
Jun
(13) |
Jul
(6) |
Aug
(16) |
Sep
(14) |
Oct
(12) |
Nov
(4) |
Dec
(10) |
2004 |
Jan
(16) |
Feb
(12) |
Mar
(53) |
Apr
(16) |
May
(43) |
Jun
(40) |
Jul
(48) |
Aug
(20) |
Sep
(23) |
Oct
(27) |
Nov
(33) |
Dec
(8) |
2005 |
Jan
(2) |
Feb
(20) |
Mar
(7) |
Apr
(9) |
May
(2) |
Jun
(6) |
Jul
(5) |
Aug
|
Sep
|
Oct
(3) |
Nov
(3) |
Dec
(6) |
2006 |
Jan
(6) |
Feb
(6) |
Mar
(1) |
Apr
(4) |
May
|
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2007 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
|
Dec
(2) |
2009 |
Jan
(2) |
Feb
|
Mar
(1) |
Apr
|
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ken A. <kan...@bb...> - 2004-06-21 14:12:07
|
The following shows that #{} and {} behave differently. (define (show x) (display {[x]\n}) #t) (define (show# x) (display #{#[x]#\n}#) #t) > (show (map (lambda (i) #{import #[i]##[semi]#\n}#) '(foo bar baz))) import foo; import bar; import baz; #t > (show# (map (lambda (i) #{import #[i]##[semi]#\n}#) '(foo bar baz))) (import foo; import bar; import baz; ) #t The parens should not be there. Iv'e fixed !#{} to be the same as !{}. Another issue is that when generating a Java statement with a ";'" at the end will confuse EMACS paren matching. I've found 2 solutions to this: S1: escape back to scheme #[#\;]# to write the ";" in a way that Emacs will handle properly, or #[semi]# with (define semi ";"). S2: Put the ";" as the last character of a line: #{import #[import]#; }# I hope to have an example of generating a Java Bean. k |
From: Ken A. <kan...@bb...> - 2004-06-18 23:13:28
|
The code/data duality in Scheme messed me up. The right way to think about it is a 12 line compiler that uses 40 lines of data. k |
From: Ken A. <kan...@bb...> - 2004-06-18 23:06:26
|
;;; KRA 18JUN04: { Tim and i have been talking about writing a "book", which would show examples of how things Java programmers like to do can be done more simply in JScheme. Here's an example of something fairly hard to do in Java, though it might not be too hard in other Java scripting languages. Maybe these are the kind of example we should focus on. One of the things i worked on this week was a gui for filtering a collection of objects. This task comes up fairly often, there are 3 projects i know about in my department that do some form of filtering currently. The gui produces the body of an application specific filter. Here's an example: (and (or (tag GeoPoint2D) (tag relativePositionOf)) (or ("icao" "starts with" "K") ("icao" "starts with" "L"))) Notice we meet the requirement of reading and writing this to a file mostly for free. Try that in XML. The compiler for this predicate produces the equlivalent of the code: (lambda (x) (and (or (xTokensContain "GeoPoint2D" x) (xTokensContain "relativePositionOf" x)) (or (.startsWith (.getIcaoId x) "K") (.startsWith (.getIcaoId x) "L")))) which is simply passed to (filter) on the list of objects to get the filtered result. Not bad for a simple 50 line compiler, which seems plenty fast enough. } (load "elf/basic.scm") (define (compilePredicate sexp) (define (compile sexp) (case (car sexp) ((and) `(and ,@(map compile (cdr sexp)))) ((or) `(or ,@(map compile (cdr sexp)))) ((tag) `(xTokensContain ,(.toString (second sexp)) x)) (else (let ((field (cadr (assoc (car sexp) features))) (op (cadr (assoc (second sexp) operators))) (value (.toUpperCase (third sexp)))) `(,op (,field x) ,value))))) (eval `(lambda (x) ,(compile sexp)))) (define features (by 2 '( "accountId" .getAccountId "cnsLocationId" .getCnsLocationId "icao" .getIcaoId "icaoName" .getIcaoName "xCancelDtg" .getXCancelDtg "xEffectiveDtg" .getXEffectiveDtg "xExpireDtg" .getXExpireDtg "xId" .getXId "xLastmodDtg" .getXLastmodDtg "xNrc" .getXNrc "xPart" .getXPart "Qcode" .getXQcode "xText" .getXText "sourceId" .getSourceId "canceling" .getCanceling "isqCanceledDtg" .getIsqCanceledDtg "damlAnnotation" .getDamlAnnotation "inactive" .getInactive "runways" .getRunways "simplification" .getSimplification "regionX" .getRegionX ))) (define operators ;; Operators are binary. (by 2 '( "is" .equals "is not" (lambda (a b) (not (.equals a b))) "is null" (lambda (a ignore) (isNull a)) "contains" contains "starts with" .startsWith "doesn't start with" (lambda (a b) (not (.startsWith a b))) "ends with" .endsWith "doesn't end with" (lambda (a b) (not (.endsWith a b))) "matches" .matches))) |
From: Timothy J. H. <ti...@cs...> - 2004-06-17 22:09:28
|
On Jun 17, 2004, at 8:46 AM, Jonathan A Rees wrote: >> From Scheme 48 (for heaven's sake don't even think about IP): > > (define (modulo x y) > (let ((r (remainder x y))) > (if (> y 0) > (if (< r 0) > (+ r y) > r) > (if (> r 0) > (+ r y) > r)))) Thanks!! > > Easily translated into Java. I used something similar in Java ... case MODULO: c=a1%b1; c= (((c==0)||((c>0)==(b1>0)))?c:c+b1); break; Your code says that if y and r have opposite signs then add y to r, otherwise leave r alone. Mine says the same, but tests first to see if r==0 which short circuits the tests. Your's is easier to understand as well! I'll try to see which is faster.... ---Tim--- > > As I remember it took several iterations to get this right. > > -Jonathan > > > ------------------------------------------------------- > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code > NWMGYKND > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Geoffrey K. <ge...@kn...> - 2004-06-17 14:28:16
|
I think "hack of the day" is a great idea. Literature of many kinds is assembled from small pieces. Where would we be without poets who practice their trade at least a little every day? I wondered why Richard Gabriel suggested programmers shouldn't write a hack a day. At first I thought, it's because good programs address a need. The absence of need plants no seed. But even when poets muse, when they are not driven to write, they strive for purpose and effect. We need little programs as much as we need little poems. Geoffrey -- Geoffrey S. Knauth | http://knauth.org/gsk On Jun 16, 2004, at 16:27, Ken Anderson wrote: > Dick Gabriel http://www.dreamsongs.com/ one said he was forcing > himself to write one poem a day as part of becoming a better writer. > He had several hundred. I asked if there was something like this a > programmer should do. > Unfortunately, he didn't think so. [...] Maybe writing a hack a day > is the first step. |
From: Jonathan A R. <ja...@mu...> - 2004-06-17 12:49:25
|
From Scheme 48 (for heaven's sake don't even think about IP): (define (modulo x y) (let ((r (remainder x y))) (if (> y 0) (if (< r 0) (+ r y) r) (if (> r 0) (+ r y) r)))) Easily translated into Java. As I remember it took several iterations to get this right. -Jonathan |
From: Ken A. <kan...@bb...> - 2004-06-16 20:38:11
|
We have several tests for remainder and modulo, so i'll have to let Tim work out the details. k At 04:15 PM 6/16/2004 -0400, Borislav Iordanov wrote: >Hmm, I'm not sure. It seems % is the same as "remainder"... > >Thanks, >Borislav > >| -----Original Message----- >| From: jsc...@li... >| [mailto:jsc...@li...] On Behalf >| Of Ken Anderson >| Sent: Wednesday, June 16, 2004 3:54 PM >| To: Borislav Iordanov >| Cc: jsc...@li... >| Subject: Re: [Jscheme-user] Modulo function >| >| >| Yes, its broken. For now use >| > (% 0 5) >| 0 >| > (% 7 5) >| 2 >| > >| At 03:33 PM 6/16/2004 -0400, Borislav Iordanov wrote: >| >Hi, >| > >| >I noticed in Jscheme that: >| > >| >(modulo 0 5) => 5 >| > >| >Is this normal behavior? >| > >| >Thanks, >| >Borislav >| > >| > >| > >| >------------------------------------------------------- >| >This SF.Net email is sponsored by The 2004 JavaOne(SM) >| Conference Learn >| >from the experts at JavaOne(SM), Sun's Worldwide Java Developer >| >Conference, June 28 - July 1 at the Moscone Center in San >| Francisco, CA >| >REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code >| >NWMGYKND _______________________________________________ >| >Jscheme-user mailing list >| >Jsc...@li... >| >https://lists.sourceforge.net/lists/listinfo/jscheme-user >| >| >| >| ------------------------------------------------------- >| This SF.Net email is sponsored by The 2004 JavaOne(SM) >| Conference Learn from the experts at JavaOne(SM), Sun's >| Worldwide Java Developer Conference, June 28 - July 1 at the >| Moscone Center in San Francisco, CA REGISTER AND SAVE! >| http://java.sun.com/javaone/sf Priority | Code NWMGYKND >| _______________________________________________ >| Jscheme-user mailing list >| Jsc...@li... >| https://lists.sourceforge.net/lists/listinfo/jscheme-user >| > > > >------------------------------------------------------- >This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference >Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer >Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA >REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Timothy J. H. <ti...@cs...> - 2004-06-16 20:31:37
|
I've fixed the modulo bug in the latest CVS. Also, I've added hash-quasi-strings which I'll describe in more detail later tonight. The idea is that you use #{ and #} to indicate a hash-quasi-string and then you can escape into scheme using #[ and #] This will allow us to easily quote general strings. The advantage here is that the hash-quasi-string can contain curly braces and square braces and double quotes, without needing to "quote" them, thus you can use it go generate C or CSS e.g. this can be used as follows to generate a string representing a Java class with a user-supplied version string... > > (define (prog version) > #{ > public class Test { > int [] a = new int[] { 1,2,3,4,5}; > String version = "#[version#]"; > > public static void main(String[] args) {;} > } > #} > ) > (lambda prog (version)...) > > (prog "abc 6/16/04") > "\n public class Test {\n int [] a = new int[] { > 1,2,3,4,5};\n String version = \"abc 6/16/04\";\n \n > public static void main(String[] args) {;}\n }\n " > > (begin (display (prog "abc 6/16/04")) (newline) (newline) 'yes) > > public class Test { > int [] a = new int[] { 1,2,3,4,5}; > String version = "abc 6/16/04"; > > public static void main(String[] args) {;} > } > > > yes ---Tim--- P.S. if this breaks any code please tell me. It shouldn't have any effect unless you use #{ #} #[ #] somewhere in your code.... On Jun 16, 2004, at 4:15 PM, Borislav Iordanov wrote: > Hmm, I'm not sure. It seems % is the same as "remainder"... > > Thanks, > Borislav > > | -----Original Message----- > | From: jsc...@li... > | [mailto:jsc...@li...] On Behalf > | Of Ken Anderson > | Sent: Wednesday, June 16, 2004 3:54 PM > | To: Borislav Iordanov > | Cc: jsc...@li... > | Subject: Re: [Jscheme-user] Modulo function > | > | > | Yes, its broken. For now use > | > (% 0 5) > | 0 > | > (% 7 5) > | 2 > | > > | At 03:33 PM 6/16/2004 -0400, Borislav Iordanov wrote: > | >Hi, > | > > | >I noticed in Jscheme that: > | > > | >(modulo 0 5) => 5 > | > > | >Is this normal behavior? > | > > | >Thanks, > | >Borislav > | > > | > > | > > | >------------------------------------------------------- > | >This SF.Net email is sponsored by The 2004 JavaOne(SM) > | Conference Learn > | >from the experts at JavaOne(SM), Sun's Worldwide Java Developer > | >Conference, June 28 - July 1 at the Moscone Center in San > | Francisco, CA > | >REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code > | >NWMGYKND _______________________________________________ > | >Jscheme-user mailing list > | >Jsc...@li... > | >https://lists.sourceforge.net/lists/listinfo/jscheme-user > | > | > | > | ------------------------------------------------------- > | This SF.Net email is sponsored by The 2004 JavaOne(SM) > | Conference Learn from the experts at JavaOne(SM), Sun's > | Worldwide Java Developer Conference, June 28 - July 1 at the > | Moscone Center in San Francisco, CA REGISTER AND SAVE! > | http://java.sun.com/javaone/sf Priority | Code NWMGYKND > | _______________________________________________ > | Jscheme-user mailing list > | Jsc...@li... > | https://lists.sourceforge.net/lists/listinfo/jscheme-user > | > > > > ------------------------------------------------------- > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code > NWMGYKND > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Ken A. <kan...@bb...> - 2004-06-16 20:28:11
|
Dick Gabriel http://www.dreamsongs.com/ one said he was forcing himself to write one poem a day as part of becoming a better writer. He had several hundred. I asked if there was something like this a programmer should do. Unfortunately, he didn't think so. Maybe writing a hack a day is the first step. So here's one i started to use yesterday. I wanted a way to remember when i had to leave. If i set a timer and popped up a JOptionPane.showMessageDialog it would appear underneath my EMACS window, so i'd never see it. So i decided to do a beep instead. It actually took a while for me to get my windows machine to beep. Here's the code. (import "java.awt.Toolkit") (import "java.util.Date") ;;; http://www.rgagnon.com/javadetails/java-0001.html ;;; If you are on a Windows machine you may not beep until your reg is ;;; set up right. (define (beep) (.beep (Toolkit.getDefaultToolkit))) (define (sleepUntil date) (Thread.sleep (- (.getTime date) (.getTime (Date.))))) ;;; reminder: String String -> void (define (reminder hour:min message) {Example: (reminder "11:45" "meet at elevator for lunch")} (let* ((d (.toString (Date.))) (d {[(.substring d 0 11)][hour:min]:00[(.substring d 19)]})) (.start (Thread. (lambda () (sleepUntil (Date. d)) (dotimes (i 10) (beep) (Thread.sleep 100L)) (display {It is now [d] [message]\n})))))) |
From: Borislav I. <bor...@ko...> - 2004-06-16 20:16:31
|
Hmm, I'm not sure. It seems % is the same as "remainder"... Thanks, Borislav | -----Original Message----- | From: jsc...@li... | [mailto:jsc...@li...] On Behalf | Of Ken Anderson | Sent: Wednesday, June 16, 2004 3:54 PM | To: Borislav Iordanov | Cc: jsc...@li... | Subject: Re: [Jscheme-user] Modulo function | | | Yes, its broken. For now use | > (% 0 5) | 0 | > (% 7 5) | 2 | > | At 03:33 PM 6/16/2004 -0400, Borislav Iordanov wrote: | >Hi, | > | >I noticed in Jscheme that: | > | >(modulo 0 5) => 5 | > | >Is this normal behavior? | > | >Thanks, | >Borislav | > | > | > | >------------------------------------------------------- | >This SF.Net email is sponsored by The 2004 JavaOne(SM) | Conference Learn | >from the experts at JavaOne(SM), Sun's Worldwide Java Developer | >Conference, June 28 - July 1 at the Moscone Center in San | Francisco, CA | >REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code | >NWMGYKND _______________________________________________ | >Jscheme-user mailing list | >Jsc...@li... | >https://lists.sourceforge.net/lists/listinfo/jscheme-user | | | | ------------------------------------------------------- | This SF.Net email is sponsored by The 2004 JavaOne(SM) | Conference Learn from the experts at JavaOne(SM), Sun's | Worldwide Java Developer Conference, June 28 - July 1 at the | Moscone Center in San Francisco, CA REGISTER AND SAVE! | http://java.sun.com/javaone/sf Priority | Code NWMGYKND | _______________________________________________ | Jscheme-user mailing list | Jsc...@li... | https://lists.sourceforge.net/lists/listinfo/jscheme-user | |
From: Ken A. <kan...@bb...> - 2004-06-16 19:54:33
|
Yes, its broken. For now use > (% 0 5) 0 > (% 7 5) 2 > At 03:33 PM 6/16/2004 -0400, Borislav Iordanov wrote: >Hi, > >I noticed in Jscheme that: > >(modulo 0 5) => 5 > >Is this normal behavior? > >Thanks, >Borislav > > > >------------------------------------------------------- >This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference >Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer >Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA >REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Borislav I. <bor...@ko...> - 2004-06-16 19:33:38
|
Hi, I noticed in Jscheme that: (modulo 0 5) => 5 Is this normal behavior? Thanks, Borislav |
From: Ken A. <kan...@bb...> - 2004-06-14 17:08:25
|
I corresponded with Pixel about this a while ago. See jscheme.Shebang.java. It would certainly be good to see where JScheme would score. k At 08:55 AM 6/13/2004 -0400, Timothy John Hickey wrote: >http://merd.sourceforge.net/pixel/language-study/scripting-language/ > >heres another language comparison site. We ought to add JScheme + standard libs code to >their list.... > > > >------------------------------------------------------- >This SF.Net email is sponsored by the new InstallShield X. > From Windows to Linux, servers to mobile, InstallShield X is the >one installation-authoring solution that does it all. Learn more and >evaluate today! http://www.installshield.com/Dev2Dev/0504 >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Timothy J. H. <tim...@ma...> - 2004-06-13 12:55:16
|
http://merd.sourceforge.net/pixel/language-study/scripting-language/ heres another language comparison site. We ought to add JScheme + standard libs code to their list.... |
From: Jonathan A R. <ja...@mu...> - 2004-06-04 12:31:59
|
There's a nice queue implementation that I first observed in some ML code of John Reppy's. It has a more functional feel to it, is easier to rewrite (I just reconstructed it from memory in about two minutes), is easier to see as being correct (if it is), and avoids the circularity problem. Although 'front' is no longer constant time, the amortized cost of using the data structure is the same as that of the conventional approach. (define (make-queue) (cons '() '())) (define (enqueue item queue) (set-car! queue (cons item (car queue)))) (define (front queue) (if (null? (cdr queue)) (begin (set-cdr! queue (reverse (car queue))) (set-car! queue '()))) (car (cdr queue))) ;error check desirable here (define (dequeue queue) (let ((f (front queue))) (set-cdr! queue (cdr (cdr queue))) f)) (define (empty-queue? q) (and (null? (car q)) (null? (cdr q)))) |
From: Ken A. <kan...@bb...> - 2004-06-03 20:05:35
|
Every year or so, i need a queue. So, i look up Peter Norvig's clever implementation. Here's a JScheme version including synchronized procedures, and an example. k ;;; Norvig's very clever queue, PAIP p 342. ;;; A queue is a (last . contents) pair. ;;; Unfortuantely, it is circular, and thus not printable in Scheme, ;;; so we wrap it in a thunk. (define (queue-contents q) (cdr (q))) (define (make-queue) ;; Build a new queue, with no elements. (let ((q (cons '() '()))) (set-car! q q) (lambda () q))) (define (enqueue item queue) ;; Insert item at the end of the queue. (let ((q (queue))) (set-car! q (set-cdr! (car q) (cons item '())))) queue) (define (dequeue q) ;; Remove an item from the front of the queue. (let ((q (q))) (set-cdr! q (cdr (cdr q))) (if (null? (cdr q)) (set-car! q q))) q) (define (front q) (car (queue-contents q))) (define (empty-queue? q) (null? (queue-contents q))) (define (queue-pop q) (let ((it (front q))) (dequeue q) it)) ;;; Synchronized versions. (define (senqueue item q) ;; Synchronized version of (enqueue). (synchronize q (lambda (q) (enqueue item q) (.notify q)))) (define (squeue-pop q) ;; Synchronized version of (queue-pop) (synchronize q (lambda (q) (let loop () (if (empty-queue? q) (begin (.wait q) (loop)))) (queue-pop q)))) (define (Runner) ;; Example. Returns a procedure that takes a thunk. When the ;; procedure is invoked, the thunk is placed on a queue and a ;; separate Thread executes it. Multiple tasks can be enqueued, the ;; are executed sequentially. (let* ((q (make-queue)) (thread (Thread. (lambda () (let loop ((it (squeue-pop q))) (it) (loop (squeue-pop q))))))) (.start thread) (lambda (action) (senqueue action q)))) |
From: Ken A. <kan...@bb...> - 2004-06-01 15:46:03
|
What you say about string->number is the way i expected it to be have too. parse-java-literal would be a good extension. I think the code is now built in to InputPort. This might be a good place to put it all together and fix other problems. k At 10:27 AM 5/30/2004 -0400, Jonathan A Rees wrote: >This discussion wasn't clear to me but I assume you're going to have > (string->number "011" 8) => 9 > (string->number "011" 10) => 11 >So the question is what to do about > (string->number "011") >My vote as usual is when in doubt follow a Scheme report, because >someone might consult a report when using jscheme. If you want to >have something to parse Java literal syntax, give it a different name; >then you could sensibly extend it to other kinds of literals, e.g. > (parse-java-literal "true") => #t > (parse-java-literal "'t'") => #\t > (parse-java-literal "\"true\"") => "true" >But if the Java literal parser has to have the name string->number >either for backward compatibility or to suit your taste, that's not >terrible; I always give it an explicit radix anyhow. > >Jonathan > > >------------------------------------------------------- >This SF.Net email is sponsored by: Oracle 10g >Get certified on the hottest thing ever to hit the market... Oracle 10g. >Take an Oracle 10g class now, and we'll give you the exam FREE. >http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Jonathan A R. <ja...@mu...> - 2004-05-30 14:29:57
|
This discussion wasn't clear to me but I assume you're going to have (string->number "011" 8) => 9 (string->number "011" 10) => 11 So the question is what to do about (string->number "011") My vote as usual is when in doubt follow a Scheme report, because someone might consult a report when using jscheme. If you want to have something to parse Java literal syntax, give it a different name; then you could sensibly extend it to other kinds of literals, e.g. (parse-java-literal "true") => #t (parse-java-literal "'t'") => #\t (parse-java-literal "\"true\"") => "true" But if the Java literal parser has to have the name string->number either for backward compatibility or to suit your taste, that's not terrible; I always give it an explicit radix anyhow. Jonathan |
From: Ken A. <kan...@bb...> - 2004-05-28 16:31:28
|
OK, we can keep with Java litterals, but (string->number) should convert according to radix. Can you fix that? It's getting in the way of a release. k At 11:04 AM 5/28/2004 -0400, Timothy John Hickey wrote: >On May 28, 2004, at 10:44 AM, Ken Anderson wrote: > >>Now we can't parse a number with a leading "0" even if we say base 10. >>>(string->number "08") >>#f >>>(string->number "08" 10) >This is clearly not good. I'll fix it! > >>#f >>>(string->number "8" 10) >>8 > > > >> >>Can we make this base 8 stuff optional? >We can back out these changes for now if it is causing backward compatibility problems.... > >> Usually when i see a leading 0 in data it is expecting to be interpreted as base 10. For example May is month "05". >We could go back to the original interpretation and have 08 be converted to 8.0.... > >The problem here is that a program can contain > 0100 >and we wouldn't know whether they meant that in base 8 or base 10. >The only time a leading zero number would be base 10 is if it happens to contain an 8 or 9, >this seems like it could generate hard to catch bugs! > >One nice thing we've done with Jscheme is have the literal syntax be almost exactly the same >as Java literal syntax. This makes it easy for Java programmers (and easy for us as we don't have >to write a special manual about the syntax of literals). > >We also have a Scheme literal mode > (set! jsint.U.useJavaMode #f) >which turns off the Java literal mode .... > >For now, we could have a backward compatibility switch that reverts to the old style, >but I think for the future it will be easier for us if we stick to pure Java literal syntax.. > >> >>k >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: Oracle 10g >>Get certified on the hottest thing ever to hit the market... Oracle 10g. >>Take an Oracle 10g class now, and we'll give you the exam FREE. >>http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click >>_______________________________________________ >>Jscheme-user mailing list >>Jsc...@li... >>https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Timothy J. H. <ti...@cs...> - 2004-05-28 15:04:12
|
On May 28, 2004, at 10:44 AM, Ken Anderson wrote: > Now we can't parse a number with a leading "0" even if we say base 10. >> (string->number "08") > #f >> (string->number "08" 10) This is clearly not good. I'll fix it! > #f >> (string->number "8" 10) > 8 > > Can we make this base 8 stuff optional? We can back out these changes for now if it is causing backward compatibility problems.... > Usually when i see a leading 0 in data it is expecting to be > interpreted as base 10. For example May is month "05". We could go back to the original interpretation and have 08 be converted to 8.0.... The problem here is that a program can contain 0100 and we wouldn't know whether they meant that in base 8 or base 10. The only time a leading zero number would be base 10 is if it happens to contain an 8 or 9, this seems like it could generate hard to catch bugs! One nice thing we've done with Jscheme is have the literal syntax be almost exactly the same as Java literal syntax. This makes it easy for Java programmers (and easy for us as we don't have to write a special manual about the syntax of literals). We also have a Scheme literal mode (set! jsint.U.useJavaMode #f) which turns off the Java literal mode .... For now, we could have a backward compatibility switch that reverts to the old style, but I think for the future it will be easier for us if we stick to pure Java literal syntax.. > > k > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle > 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Ken A. <kan...@bb...> - 2004-05-28 14:44:31
|
Now we can't parse a number with a leading "0" even if we say base 10. > (string->number "08") #f > (string->number "08" 10) #f > (string->number "8" 10) 8 Can we make this base 8 stuff optional? Usually when i see a leading 0 in data it is expecting to be interpreted as base 10. For example May is month "05". k |
From: Ken A. <kan...@bb...> - 2004-05-24 17:35:00
|
Chapter 17 of Paul Graham's On Lisp, http://paulgraham.com/onlisptext.html talks about read-macros and dispatch-macro-characters which is what the #{ would be called. Here's the chapter from the hyperspec: http://www.lisp.org/HyperSpec/Body/sec_the_reader_dictionary.html |
From: Timothy J. H. <ti...@cs...> - 2004-05-24 17:33:41
|
On May 24, 2004, at 1:21 PM, Ken Anderson wrote: > What about #{ ... #} and #[ ... #] instead? Hmmmm. So a typical use would look like the following.... (define (js-string zzz) #{ <script> <!-- function qs(el) {if (window.RegExp && window.encodeURIComponent) {var qe=encodeURIComponent(document.f.q.value); if (el.href.indexOf("q=")!=-1) {el.href=el.href.replace(new RegExp("q=[^&$]*"),"q="+qe);} else {el.href+="&q="+qe;}}return 1;} // --> #[zzz #] </script> #} ) The advantage is that the tokens indicating the beginning/end of string status always start with the # character. Yes, I think that is nicer. We then think of #{ #} #[ #] as tokens although #[ and #} denote the ends of strings, while #{ and #] denote the beginnings of strings in different contexts... ---Tim--- > > I liked {{ because it only uses up one character, but using # would > lets us support reader macros. I'll need to remember more of how we > did them in CL. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle > 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Ken A. <kan...@bb...> - 2004-05-24 17:21:22
|
What about #{ ... #} and #[ ... #] instead? I liked {{ because it only uses up one character, but using # would lets us support reader macros. I'll need to remember more of how we did them in CL. |
From: Timothy J. H. <ti...@cs...> - 2004-05-24 15:21:32
|
On May 24, 2004, at 10:40 AM, Rahul wrote: > Hi, > >> There is a relatively simple approach to this problem that doesn't >> require backquoting... >> The idea is just to escape into a regular quoted string with [" ..... >> "] >> e.g. > > That solution would help very much though we would still need to > escape the inner quotes. You might be able to use single quotes in place of double quotes.... Yet another possibility would be to use #{ }# to denote quoted strings where } can appear with in the quoted string, but you would have to backslash any appearance of }# This is lexically similar to the mzscheme style multi-line comments #| ...... |# The downside: it adds two additional characters to a string and it introduces # as a terminating symbol for the first time, and it still requires one to backslash square brackets, which arise in javascript code... The upside: it is very simple to implement and is backwards compatible. Maybe use #[ ]# as escapes into Scheme for these #-quasi-strings... For example, we could include the following chunk of Javascript from google as follows: (define (js-string zzz) #{ <script> <!-- function qs(el) {if (window.RegExp && window.encodeURIComponent) {var qe=encodeURIComponent(document.f.q.value); if (el.href.indexOf("q=")!=-1) {el.href=el.href.replace(new RegExp("q=[^&$]*"),"q="+qe);} else {el.href+="&q="+qe;}}return 1;} // --> #[zzz]# </script> }# ) where the curly braces, square brackets, and various quotes don't need to be quoted and where I've inserted a gratutitous argument using the #[...]# notation. I'm starting to like this approach. It is easy to understand, easy to implement, and handles 95% of the interesting cases (CSS quoting, javascript quoting, probably also SQL and Jython quoting). ---Tim--- > ( quotes are Present often in js but not as common as the { } and [ ] > ,so i guess escaping them wont be that messy) > > ~Rahul > -- > /*With eyes that speak of the Stars, > and magick my very soul, > A Dragon I am Eternal.*/ > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle > 10g.Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |