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: Timothy H. <tim...@ma...> - 2003-03-09 22:48:19
|
Hi Boris, On Sunday, March 9, 2003, at 12:55 AM, Boris Tschirschwitz wrote: > Hi. > > Assuming that my ignorance mostly stems from not having studied jscheme > long enough, I checked the list archives for answers, Thanks for checking first! > but I couldn't find > anything and the sf system seems to be really terrible. What made it so horrible? Response time, organization,...? > > I am wondering about the following: If I want to program using classes > and > objects, do I have to make all my structures Java classes, objects, ...? > I wonder if this might restrict me in manipulating these objects in the > scheme way. Yes, this sounds very vague, b/c I am not absolutely sure > what > I am asking and hope that someone on the list might understand it better > than I do. You should look at the webpage: http://jscheme.sourceforge.net/jscheme/src/dclass/dclass.html which describes several approaches for working with Java classes from Jscheme. In summary, the main approaches we've tried are: * don't define any new classes (i.e. use Java as a library language), e.g. see the jlib/Swing.scm library * when this doesn't work, define a wrapper class that allows you to dynamically assign functionality to a Java class from Jscheme (e.g. see the jlib/SchemeCanvas.java class) * for an interface you can use the Proxy class to implement that interface at runtime in Jscheme * for a non-interface, you can use the dclass package to define Java classes in Scheme and compile them to Java, e.g. the weblink above gives an example of defining a class "Compare" in a package "frog". This example is in dclass/test.scm, reproduced below: > > (define-class > (package frog) > (import java.util.Comparator) > (public class Compare implements Comparator) > ;; Design issue, fields must be public for Jscheme code to access. > > (public Procedure predicate) > > (public Compare (Procedure predicate) > (.predicate$ this predicate)) > > (public boolean predicate (Object a Object b) > ((.predicate$ this) a b)) > > (public int compare (Object a Object b) > (cond ((.predicate this a b) -1) > ((.predicate this b a) 1) > (else 0))) > > (public boolean equals (Object that) > (and (eq? (.getClass this) (.getClass that)) > (eq? (.predicate$ this) (.predicate$ that)))) > > (public int hashCode () 0)) > > The following script shows how to run that example: > % java -cp lib/jscheme.jar:src jscheme.REPL Note: we have to add a folder "src" to the classpath as dclass will compile all new classes into this folder.. > > > Jscheme 6.1.0 3/7/2003 http://jscheme.sourceforge.net > > > > (load "elf/basic.scm") > #t > > (load "dclass/dclass.scm") > #t At this point we have loaded in the dclass compiler... we are now ready to compile a new class, we could do this interactively by making a call to > (define-class (package-frog) ....) But that can be error-prone...., so we load it in from a file.... > > (load "dclass/test.scm") ; the compiler echoes the generated code to the console as well as to the file > Writing Java code for frog.Compare to > /Users/tim/Research/Software/jscheme/src/frog/Compare.java > // Generated by Jscheme by tim on Sun Mar 09 04:16:20 EST 2003 > package frog; > import java.util.Comparator; > import jsint.Procedure; > import jscheme.JS; > public class Compare implements Comparator { public Procedure predicate; > public Compare(Procedure predicate) { JS.call(DCLASS_C_Compare0, this, > predicate); > } > private static final Procedure DCLASS_C_Compare0 =(Procedure) > JS.eval("(lambda (this predicate) (.predicate$ this predicate))"); > public boolean predicate(Object a, Object b) { return > JS.booleanValue(JS.call(DCLASS_M_I_predicate1, this, a, b)); > } > private static final Procedure DCLASS_M_I_predicate1 =(Procedure) > JS.eval("(lambda (this a b) ((.predicate$ this) a b))"); > public int compare(Object a, Object b) { return > JS.intValue(JS.call(DCLASS_M_I_compare2, this, a, b)); > } > private static final Procedure DCLASS_M_I_compare2 =(Procedure) > JS.eval("(lambda (this a b) (cond ((.predicate this a b) -1) > ((.predicate this b a) 1) (else 0)))"); > public boolean equals(Object that) { return > JS.booleanValue(JS.call(DCLASS_M_I_equals3, this, that)); > } > private static final Procedure DCLASS_M_I_equals3 =(Procedure) > JS.eval("(lambda (this that) (and (eq? (.getClass this) (.getClass > that)) (eq? (.predicate$ this) (.predicate$ that))))"); > public int hashCode() { return > JS.intValue(JS.call(DCLASS_M_I_hashCode4, this)); > } > private static final Procedure DCLASS_M_I_hashCode4 =(Procedure) > JS.eval("(lambda (this) 0)"); > } > Compiling Java code for frog.Compare and it compiles the new code to src/from/Compare.class where it is immediately available to us > #t > Next we use it to sort two arrays.... using two different comparators c1 and c2 > > (define c (frog.Compare. <)) > frog.Compare@0 > > (define arr #(1 4 2 5 6 79 3 4 8 5 3)) > #(1 4 2 5 6 79 3 4 8 5 3) > > (Arrays.sort arr c) > #null > > arr > #(1 2 3 3 4 4 5 5 6 8 79) > > > (define c2 (frog.Compare. (lambda(x y) (or (< (first x) (first y)) (> > (second x) (second y)))))) .... this is a wierd sorting predicate, you can have A<B and B<A for certain lists A,B, e.g. (1 5) and (4 6) > frog.Compare@0 > > (define arr2 #((1 5) (4 3) (4 6) (5 3) (1 3) (1 6) (5 3) (5 4))) > #((1 5) (4 3) (4 6) (5 3) (1 3) (1 6) (5 3) (5 4)) > > (Arrays.sort arr2 c2) > #null > > arr2 > #((1 6) (1 5) (4 6) (1 3) (4 3) (5 4) (5 3) (5 3)) > > > (exit) > #t > % > I hope this starts to answer your question... > Would it be beneficial to use something like Meroon? Perhaps, but then you may have to worry about interacting with two object systems, Java's and Meroon's. I haven't tried to get Meroon working in Jscheme and it might be interesting! Best, ---Tim--- |
From: Ken A. <kan...@bb...> - 2003-03-09 19:22:02
|
I've been thinking about this too. It's easy to get a runaway computation that you'd like to stop. We could do that by checking for a stop flag that is checked at each procedure call. At 07:01 AM 3/9/2003 -0500, Geoffrey Knauth wrote: >Let's say I'm in the middle of loading a file foo.scm. > >I get part of the way through the file, and then I realize some core data structures are messed up. I want to signal an error and stop loading foo.scm, but I may not want to leave the JScheme interpreter. >Can I do that (leave foo.scm but not JScheme)? > >Geoffrey > > > >------------------------------------------------------- >This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Ken A. <kan...@bb...> - 2003-03-09 19:18:28
|
> (apropos "file") file: open-input-file: {jsint.Primitive open-input-file[1]} open-output-file: {jsint.Primitive open-output-file[1]} call-with-output-file: {jsint.Primitive call-with-output-file[2]} call-with-input-file: {jsint.Primitive call-with-input-file[2]} > (define (frogs n) (+ n 3)) {jsint.Closure frogs[1] (n)} > (apropos "frogs") frogs: {jsint.Closure frogs[1] (n)} At 06:30 AM 3/9/2003 -0500, Geoffrey Knauth wrote: >Something I like in JScheme: > >If I don't remember the arguments to a function, I can just type the name of an application's function: > >e.g., DEMAND_STREAMS_OF_TYPE > >and it will return the number and name of the expected arguments: > >e.g. ... Closure DEMAND_STREAMS_OF_TYPE[2] (type cs-descr) > >How much more would it take to adopt an Emacs-like standard of having an optional initial string representing help text? If the string were a URL, it also could point to online help with markup, while keeping clutter in a user's Scheme code to a minimum. If the URL used quasiquotes, you could have the online help toggle between the JScheme website for core JScheme functions, and a local site when the JScheme user is offline or for help with the JScheme user's own application code. > >Geoffrey > > > >------------------------------------------------------- >This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Timothy H. <tim...@ma...> - 2003-03-09 19:08:07
|
> Hi Boris, > > On Sunday, March 9, 2003, at 12:55 AM, Boris Tschirschwitz wrote: >> Hi. >> >> Assuming that my ignorance mostly stems from not having studied jscheme >> long enough, I checked the list archives for answers, > Thanks for checking first! > >> but I couldn't find >> anything and the sf system seems to be really terrible. > What made it so horrible? Response time, organization,...? > >> >> I am wondering about the following: If I want to program using classes >> and >> objects, do I have to make all my structures Java classes, >> objects, ...? >> I wonder if this might restrict me in manipulating these objects in the >> scheme way. Yes, this sounds very vague, b/c I am not absolutely sure >> what >> I am asking and hope that someone on the list might understand it >> better >> than I do. > > You should look at the webpage: > http://jscheme.sourceforge.net/jscheme/src/dclass/dclass.html > which describes several approaches for working with Java classes from > Jscheme. > > In summary, the main approaches we've tried are: > * don't define any new classes (i.e. use Java as a library language), > e.g. see the jlib/Swing.scm library > * when this doesn't work, define a wrapper class that allows you to > dynamically > assign functionality to a Java class from Jscheme (e.g. see the > jlib/SchemeCanvas.java class) > * for an interface you can use the Proxy class to implement that > interface at runtime in Jscheme > * for a non-interface, you can use the dclass package to define Java > classes in Scheme > and compile them to Java, e.g. the weblink above gives an example > of defining a class > "Compare" in a package "frog". This example is in dclass/test.scm, > reproduced below: >> >> (define-class >> (package frog) >> (import java.util.Comparator) >> (public class Compare implements Comparator) >> ;; Design issue, fields must be public for Jscheme code to access. >> >> (public Procedure predicate) >> >> (public Compare (Procedure predicate) >> (.predicate$ this predicate)) >> >> (public boolean predicate (Object a Object b) >> ((.predicate$ this) a b)) >> >> (public int compare (Object a Object b) >> (cond ((.predicate this a b) -1) >> ((.predicate this b a) 1) >> (else 0))) >> >> (public boolean equals (Object that) >> (and (eq? (.getClass this) (.getClass that)) >> (eq? (.predicate$ this) (.predicate$ that)))) >> >> (public int hashCode () 0)) >> >> > > > The following script shows how to run that example: > >> % java -cp lib/jscheme.jar:src jscheme.REPL > Note: we have to add a folder "src" to the classpath as dclass will > compile all new classes into > this folder.. >> >> >> Jscheme 6.1.0 3/7/2003 http://jscheme.sourceforge.net >> >> >> > (load "elf/basic.scm") >> #t >> > (load "dclass/dclass.scm") >> #t > At this point we have loaded in the dclass compiler... > we are now ready to compile a new class, we could do this interactively > by making a call to > (define-class (package-frog) ....) > But that can be error-prone...., so we load it in from a file.... > >> > (load "dclass/test.scm") > ; the compiler echoes the generated code to the console as well as to > the file >> Writing Java code for frog.Compare to >> /Users/tim/Research/Software/jscheme/src/frog/Compare.java >> // Generated by Jscheme by tim on Sun Mar 09 04:16:20 EST 2003 >> package frog; >> import java.util.Comparator; >> import jsint.Procedure; >> import jscheme.JS; >> public class Compare implements Comparator { public Procedure >> predicate; >> public Compare(Procedure predicate) { JS.call(DCLASS_C_Compare0, this, >> predicate); >> } >> private static final Procedure DCLASS_C_Compare0 =(Procedure) >> JS.eval("(lambda (this predicate) (.predicate$ this predicate))"); >> public boolean predicate(Object a, Object b) { return >> JS.booleanValue(JS.call(DCLASS_M_I_predicate1, this, a, b)); >> } >> private static final Procedure DCLASS_M_I_predicate1 =(Procedure) >> JS.eval("(lambda (this a b) ((.predicate$ this) a b))"); >> public int compare(Object a, Object b) { return >> JS.intValue(JS.call(DCLASS_M_I_compare2, this, a, b)); >> } >> private static final Procedure DCLASS_M_I_compare2 =(Procedure) >> JS.eval("(lambda (this a b) (cond ((.predicate this a b) -1) >> ((.predicate this b a) 1) (else 0)))"); >> public boolean equals(Object that) { return >> JS.booleanValue(JS.call(DCLASS_M_I_equals3, this, that)); >> } >> private static final Procedure DCLASS_M_I_equals3 =(Procedure) >> JS.eval("(lambda (this that) (and (eq? (.getClass this) (.getClass >> that)) (eq? (.predicate$ this) (.predicate$ that))))"); >> public int hashCode() { return >> JS.intValue(JS.call(DCLASS_M_I_hashCode4, this)); >> } >> private static final Procedure DCLASS_M_I_hashCode4 =(Procedure) >> JS.eval("(lambda (this) 0)"); >> } >> Compiling Java code for frog.Compare > and it compiles the new code to src/from/Compare.class where it is > immediately available to us >> #t >> > Next we use it to sort two arrays.... using two different comparators > c1 and c2 >> > (define c (frog.Compare. <)) >> frog.Compare@0 >> > (define arr #(1 4 2 5 6 79 3 4 8 5 3)) >> #(1 4 2 5 6 79 3 4 8 5 3) >> > (Arrays.sort arr c) >> #null >> > arr >> #(1 2 3 3 4 4 5 5 6 8 79) >> >> > (define c2 (frog.Compare. (lambda(x y) (or (< (first x) (first >> y)) (> (second x) (second y)))))) > .... this is a wierd sorting predicate, you can have A<B and B<A for > certain lists A,B, e.g. (1 5) and (4 6) >> frog.Compare@0 >> > (define arr2 #((1 5) (4 3) (4 6) (5 3) (1 3) (1 6) (5 3) (5 4))) >> #((1 5) (4 3) (4 6) (5 3) (1 3) (1 6) (5 3) (5 4)) >> > (Arrays.sort arr2 c2) >> #null >> > arr2 >> #((1 6) (1 5) (4 6) (1 3) (4 3) (5 4) (5 3) (5 3)) >> >> > (exit) >> #t >> % >> > > I hope this starts to answer your question... > >> Would it be beneficial to use something like Meroon? > Perhaps, but then you may have to worry about interacting with two > object > systems, Java's and Meroon's. I haven't tried to get Meroon working in > Jscheme and it might be interesting! > > Best, > ---Tim--- > |
From: Ken A. <kan...@bb...> - 2003-03-09 19:04:35
|
We have not developed an object system for JScheme, however you can define Java classes in JScheme, see http://jscheme.sourceforge.net/jscheme/src/dclass/dclass.html for several ways. There is also http://jscheme.sourceforge.net/jscheme/src/dclass/record.scm for defining simple record structures more easily than using define-class directly. You can also define common lisp like methods. see http://jscheme.sourceforge.net/jscheme/src/elf/iterate.scm I do have a simple prototype based system that i use. I may check it is as an example. One of the main issues of an Object System for JScheme is how it would interact with Java classes. At 09:55 PM 3/8/2003 -0800, Boris Tschirschwitz wrote: >Hi. > >Assuming that my ignorance mostly stems from not having studied jscheme >long enough, I checked the list archives for answers, but I couldn't find >anything and the sf system seems to be really terrible. > >I am wondering about the following: If I want to program using classes and >objects, do I have to make all my structures Java classes, objects, ...? >I wonder if this might restrict me in manipulating these objects in the >scheme way. Yes, this sounds very vague, b/c I am not absolutely sure what >I am asking and hope that someone on the list might understand it better >than I do. >Would it be beneficial to use something like Meroon? > >Boris. > > > > > >------------------------------------------------------- >This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger >for complex code. Debugging C/C++ programs can leave you feeling lost and >disoriented. TotalView can help you find your way. Available on major UNIX >and Linux platforms. Try it free. www.etnus.com >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Geoffrey K. <ge...@kn...> - 2003-03-09 12:01:38
|
Let's say I'm in the middle of loading a file foo.scm. I get part of the way through the file, and then I realize some core data structures are messed up. I want to signal an error and stop loading foo.scm, but I may not want to leave the JScheme interpreter. Can I do that (leave foo.scm but not JScheme)? Geoffrey |
From: Geoffrey K. <ge...@kn...> - 2003-03-09 11:30:46
|
Something I like in JScheme: If I don't remember the arguments to a function, I can just type the name of an application's function: e.g., DEMAND_STREAMS_OF_TYPE and it will return the number and name of the expected arguments: e.g. ... Closure DEMAND_STREAMS_OF_TYPE[2] (type cs-descr) How much more would it take to adopt an Emacs-like standard of having an optional initial string representing help text? If the string were a URL, it also could point to online help with markup, while keeping clutter in a user's Scheme code to a minimum. If the URL used quasiquotes, you could have the online help toggle between the JScheme website for core JScheme functions, and a local site when the JScheme user is offline or for help with the JScheme user's own application code. Geoffrey |
From: Boris T. <bo...@ma...> - 2003-03-09 05:55:46
|
Hi. Assuming that my ignorance mostly stems from not having studied jscheme long enough, I checked the list archives for answers, but I couldn't find anything and the sf system seems to be really terrible. I am wondering about the following: If I want to program using classes and objects, do I have to make all my structures Java classes, objects, ...? I wonder if this might restrict me in manipulating these objects in the scheme way. Yes, this sounds very vague, b/c I am not absolutely sure what I am asking and hope that someone on the list might understand it better than I do. Would it be beneficial to use something like Meroon? Boris. |
From: Ken A. <kan...@bb...> - 2003-03-09 03:19:25
|
This is from light weight languages. We should check out how SISC does continuations. >To: Daniel Weinreb <DLW...@at...> >Cc: Christopher Barber <cb...@cu...>, > Sundar Narasimhan <su...@as...>, mv...@cs..., > eli...@ve..., ll1...@ai... >Subject: Re: Y Store /Closures >From: Matthias Radestock <mat...@so...> >Date: 08 Mar 2003 13:47:34 +0000 >Lines: 44 >User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Portable Code) >Sender: own...@ai... >Old-X-Spam-Status: NO >Old-X-Scanned-By: MIMEDefang 2.28 (www . roaringpenguin . com / mimedefang) >Old-X-Scanned-By: MIMEDefang 2.17 (www . roaringpenguin . com / mimedefang) >X-Scanned-By: Spam Assassin >X-Spam-Status: No, hits=-3.4 required=5.0 > tests=IN_REP_TO > version=2.31 >X-Spam-Level: > >Daniel Weinreb <DLW...@at...> writes: > >> Now, here's what I want to know. Suppose you want to write a web >> app that maintains state between clicks in the fashion I've been describing, >> but you don't want all that state to be lost in case there is a reboot or >> power failure or crash. In the event-driven style, the state can be stored >> persistently, in a file or database system, so that when the next HTTP >> request comes along, you can pick up where you left off, but in a >> conventional >> language-with-continuations scenario, the continuation state is all in >> virtual >> memory and lost when there's a crash. What can anyone recommend? > >When writing continuation-based web apps using the SISC Scheme >interpreter (http://sisc.sourceforge.net) continuations get stored in >the user session of the J2EE app server. SISC continuations are >java-serializable. Many app servers deal with session migration by >serializing the sessions and restoring them on the migration >target. Persistence is accomplished by simply storing the serialized >continuations in a DB. I have run experiments with Tomcat involving the >restarting of the app server in the middle of a workflow - it all works >beautifully. > >As has been pointed out elsewhere, one needs to be careful about >ensuring that cntinuations do not hang on to unnecessary state, >particularly state that is not serializable. Some J2EE objects, such as >http requests are not serializable and are quite prone to ending up in >the continuation, thus breaking serialization. In my SISC web apps I >get around this through some scaffolding that involves storing these >transient objects in what amounts to thread-locals. This happens >transparently to application code. > >Continuations in a user session tend to share a lot of state. So the >storage requirement and (de)serialization runtime cost is actually quite >low for all continuations except the first. Also, serialization of >continuations in SISC never serializes the top-level, i.e. "global" >state, since that would entail serializing pretty much the entire heap >and hence be way too expensive. This, of course, means that application >state should not be stored in the top-level if it is to be >persistent. That's ok though since in most apps the application state is >kept in the DB / some remote EJBs anyway. > > >Matthias. |
From: Robert J. B. <ru...@bb...> - 2003-03-07 19:16:34
|
Tim, I am comfortable with second and third showing an error -- their intended semantics is to treat the sequence of linked pairs as a linear structure and get the numbered element. It is an "implementation detail" that second is the same as cadr. I also support having symbolic methods fourth, ... tenth -- I keep getting burned by their absense. Thanks, Rusty Timothy Hickey wrote: > > On Friday, March 7, 2003, at 11:20 AM, Robert J. Bobrow wrote: > >> Folks, >> I would expect that (cadr x) and (car (cdr x)) would behave >> identically in all circumstances. Yet I find that car and cdr behave >> like Common Lisp and return '() when given '() as an argument (I like >> this, personnaly) and cadr throws an exception when handed '(); >> >> I think the inconsistency is annoying -- I really prefer not to have >> (car (cdr x)) in my code. > > I've fixed that inconsistency, cadr and caddr were treated differently > from all other cadadars > > I have however kept that behavior for second and third. > So (second '(a)) --> error > (cadr '(a)) --> () > Perhaps it would be better to have second and third adhere to the same > semantics of cadr and caddr, > but in a way it makes sense for second/third to give errors if the > lists are too short.... > I'd also like to add third, fourth, fifth, .... up to tenth or so.... > > What do you think? > ---Tim--- > > |
From: Timothy H. <tim...@ma...> - 2003-03-07 18:20:25
|
On Friday, March 7, 2003, at 11:35 AM, Timothy Hickey wrote: > We could easily write a little macro which implements this style > of export: > >> (export (future future? ...) >> (define (future x) ...) >> (define (future? x) ...) >> ... >> ) >> > ;; Here is a version of the macro that implements "export" ;; I create the "bigsym" symbol to strictly include all other symbols ;; and hence be different from them, kind of a gensym.... (define (export Symbols . Body) ; this bigsymbol is guaranteed to be different from all individual symbols (define bigsym (string->symbol (apply string-append (cons "R_" (map .toString Symbols))))) (define (make-defines N S) (if (null? S) () (cons `(set! ,(first S) (list-ref ,bigsym ,N)) (make-defines (+ N 1) (rest S))))) `((lambda (,bigsym) ,@(make-defines 0 Symbols)) (let () ,@Body ,(cons 'list Symbols)) )) e.g. (export '(R S) (set! R 1) (set! S 2)) --> ( (lambda (R_RS) (set! R (list-ref R_RS 0)) (set! S (list-ref R_RS 1))) (let () 1 2 (list R S)) ) Oh... but this will still have problems if list-ref is one of the symbols being exported.... This is why hygeniec macros are nice.... ---Tim--- > > Similarly, we could wriite a macro to import just a few values from a > file >> (import "elf/future.scm" (future future? ...)) > > which could expand to >> (import "elf/future.scm" "HIDDEN:") >> (define future HIDDEN:future) >> (define future? HIDDEN:future?) >> ... > > Other variations could be implemented as well (import-all-but ....) etc. > > ---Tim--- > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The > debugger for complex code. Debugging C/C++ programs can leave you > feeling lost and disoriented. TotalView can help you find your way. > Available on major UNIX and Linux platforms. Try it free. www.etnus.com > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user > |
From: Timothy H. <tim...@ma...> - 2003-03-07 17:19:51
|
On Friday, March 7, 2003, at 11:20 AM, Robert J. Bobrow wrote: > Folks, > I would expect that (cadr x) and (car (cdr x)) would behave > identically in all circumstances. Yet I find that car and cdr behave > like Common Lisp and return '() when given '() as an argument (I like > this, personnaly) and cadr throws an exception when handed '(); > > I think the inconsistency is annoying -- I really prefer not to have > (car (cdr x)) in my code. I've fixed that inconsistency, cadr and caddr were treated differently from all other cadadars I have however kept that behavior for second and third. So (second '(a)) --> error (cadr '(a)) --> () Perhaps it would be better to have second and third adhere to the same semantics of cadr and caddr, but in a way it makes sense for second/third to give errors if the lists are too short.... I'd also like to add third, fourth, fifth, .... up to tenth or so.... What do you think? ---Tim--- |
From: Geoffrey K. <ge...@kn...> - 2003-03-07 16:53:57
|
I ran into something similar this morning. Both (car ()) and (cdr ()) returned (), while according to MIT Scheme, which I use for reference, feeding () to either car or cdr was a no-no. In the case of car, I knew that. In the case of cdr, I had to remember that (cdr ()) was OK in Lisp but not in Scheme. Like Rusty, I don't mind that (cdr ()) returns (), but I have a small problem. I have some expressions to debug that look like (caar (cddr X)) that I'm trying to debug by taking them apart (car (car (cdr (cdr X)))), and I'm getting exceptions in the former but not in the latter. Geoffrey On Friday, March 7, 2003, at 11:20 AM, Robert J. Bobrow wrote: > Folks, > I would expect that (cadr x) and (car (cdr x)) would behave > identically in all circumstances. Yet I find that car and cdr behave > like Common Lisp and return '() when given '() as an argument (I like > this, personnaly) and cadr throws an exception when handed '(); > > I think the inconsistency is annoying -- I really prefer not to have > (car (cdr x)) in my code. > > Any recommendations? > --Rusty Bobrow |
From: Timothy H. <tim...@ma...> - 2003-03-07 16:52:48
|
On Friday, March 7, 2003, at 11:15 AM, Ken Anderson wrote: > Some questions about modules. > > ? is there a way to export symbols? Currently, everything is exported.... > For example, in the elf/future.scm i wanted to export future, future?, > determined?, touch, and i wanted to have the other procedures not show > up in the user's environment. > > Rather than loading a module and seeing the exported symbols, i have to > explictly import it with a prefix say, "f:". or you can import everything without a prefix ... > Then i either have to say > (f:future x) or > (define future f:future) The current implementation allows either a prefixed importation (environment-import "abc.scm" "f:") or a non-prefixed import (environment-import "abc.scm") There is currently no way to import only a selected subset or to export a selected subset... Actually, you can "hack" export using set!, The set! makes the assignment occur in the toplevel environment and the (let () ...) hides all the other assignments ... > ( > (let () ;;; define future, future? etc inside a let() environment > (define (future x) ...) > (define (future? x) ...) > ... > (list future future? ...)) > > (lambda R ;;; use set! to lift these definitions to the global > environment > (set! future (first R)) > (set! future? (second R)) > ...) > ) We could easily write a little macro which implements this style of export: > (export (future future? ...) > (define (future x) ...) > (define (future? x) ...) > ... > ) > Similarly, we could wriite a macro to import just a few values from a file > (import "elf/future.scm" (future future? ...)) which could expand to > (import "elf/future.scm" "HIDDEN:") > (define future HIDDEN:future) > (define future? HIDDEN:future?) > ... Other variations could be implemented as well (import-all-but ....) etc. ---Tim--- |
From: Robert J. B. <ru...@bb...> - 2003-03-07 16:21:29
|
Folks, I would expect that (cadr x) and (car (cdr x)) would behave identically in all circumstances. Yet I find that car and cdr behave like Common Lisp and return '() when given '() as an argument (I like this, personnaly) and cadr throws an exception when handed '(); I think the inconsistency is annoying -- I really prefer not to have (car (cdr x)) in my code. Any recommendations? --Rusty Bobrow |
From: Ken A. <kan...@bb...> - 2003-03-07 16:16:02
|
Some questions about modules. ? is there a way to export symbols? For example, in the elf/future.scm i wanted to export future, future?, determined?, touch, and i wanted to have the other procedures not show up in the user's environment. Rather than loading a module and seeing the exported symbols, i have to explictly import it with a prefix say, "f:". Then i either have to say (f:future x) or (define future f:future) This doesn't seem right. |
From: Ken A. <kan...@bb...> - 2003-03-07 16:05:56
|
At 04:05 PM 3/5/2003 -0500, Geoffrey Knauth wrote: >Tim, thanks for those code examples. I'll keep them for any possible Swing work with threads. > >However the true motivation for the question had to do with launching a few separate processing tasks in their own threads. For example, processes A1 and A2 are prerequisites for B, and we are just wondering if, in staying with JScheme, we might be able to get A1 and A2 to happen more in parallel. It's nice to know we can. This reminded me of a future implementation i just checked in in elf/future.scm (future expression) evaluates expression in a separate thread and returns a future which can be touched to get the value of the future, suspending if it's value isn't available yet. So you have one object that gives you parallelism and syncronization. |
From: <da...@da...> - 2003-03-06 22:57:38
|
I jave been playing around SaxExp.scm using java1.4. It appears that it is supposed to ignore newlines in elements, but i keep getting stuff like this: (vienna "\n " (options "\n " (savepassword "true") (maxrows "500") ..... from this <vienna> <options> <savepassword>true</savepassword> <maxrows>500</maxrows> <tablefont> <family>dialog</family> <style>plain</style> <size>12</size> </tablefont> .. .. do I need to clean the newlines from the xml before I parse it? BTW I set (System.setProperty "org.xml.sax.driver" "org.apache.crimson.parser.XMLReaderImpl") ) in the SaxExp.scm code before compiling thanks davud |
From: Geoffrey K. <ge...@kn...> - 2003-03-05 21:06:01
|
Tim, thanks for those code examples. I'll keep them for any possible Swing work with threads. However the true motivation for the question had to do with launching a few separate processing tasks in their own threads. For example, processes A1 and A2 are prerequisites for B, and we are just wondering if, in staying with JScheme, we might be able to get A1 and A2 to happen more in parallel. It's nice to know we can. Geoffrey On Wednesday, March 5, 2003, at 03:56 PM, Timothy Hickey wrote: > If you are going to start working with Threads and JScheme you might > want to > be careful when working with Swing GUIs. Swing is not thread safe so > it is a > good idea to execute any GUI manipulations in the AWT event queue > thread. > This is done by using >> (javax.swing.SwingUtilities.invokeAndWait (lambda() ...code to be >> executed...)) >> or >> (javax.swing.SwingUtilities.invokeLater (lambda() ...code to be >> executed...)) > They both add the code to the event Queue as a runnable, this should > only be done > from calls that are forked off of the main thread.... > > I usually also wrap the code in a tryCatch so as to catch any errors > that might occur. > Otherwise the errors cause the thread to halt but are otherwise not > observable: > >> (define(invokeAndWait F) >> (javax.swing.SwingUtilities.invokeAndWait (lambda() >> (tryCatch >> (F) >> (lambda(e) (printdebug 'error {ERROR in invokeAndWait: >> [F], [e]\n}))) >> )) >> ) >> ;; where printdebug is the error printing procedure for your >> application.... >> > > > Have fun, > and be careful out there! > ---Tim--- > > > On Wednesday, March 5, 2003, at 03:46 PM, Geoffrey Knauth wrote: > >> Thanks Tim! Just what the doctor ordered. --Geoffrey >> >> On Wednesday, March 5, 2003, at 03:24 PM, Timothy Hickey wrote: >> >>> (synchronize X F) >>> synchronizes the current thread on object X and blocks until it gets >>> the >>> lock on X, at which time it calls (F X) >>> >>> e.g. >>> (synchronize x .wait) gets a lock on x and then gives up all locks >>> and waits until it is notified >>> (synchronize x .notify) gets a lock on x and then notifies some >>> thread waiting on x >>> >>> I often use the idiom >>> (synchronize g (lambda(g) ....)) >>> or >>> (synchronize g (lambda(_) ...)) >>> >>> ---Tim--- >>> >>> On Wednesday, March 5, 2003, at 01:58 PM, Geoffrey Knauth wrote: >>> >>>> I can use Java threads from JScheme. >>>> >>>> But can I make JScheme variables `synchronized' ? >>>> >>>> Geoffrey >>>> >>>> >>>> >>>> ------------------------------------------------------- >>>> This SF.net email is sponsored by: Etnus, makers of TotalView, The >>>> debugger for complex code. Debugging C/C++ programs can leave you >>>> feeling lost and disoriented. TotalView can help you find your way. >>>> Available on major UNIX and Linux platforms. Try it free. >>>> www.etnus.com >>>> _______________________________________________ >>>> Jscheme-user mailing list >>>> Jsc...@li... >>>> https://lists.sourceforge.net/lists/listinfo/jscheme-user >>>> >>> >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Etnus, makers of TotalView, The >> debugger for complex code. Debugging C/C++ programs can leave you >> feeling lost and disoriented. TotalView can help you find your way. >> Available on major UNIX and Linux platforms. Try it free. >> www.etnus.com >> _______________________________________________ >> Jscheme-user mailing list >> Jsc...@li... >> https://lists.sourceforge.net/lists/listinfo/jscheme-user >> > |
From: Timothy H. <tim...@ma...> - 2003-03-05 20:56:15
|
If you are going to start working with Threads and JScheme you might want to be careful when working with Swing GUIs. Swing is not thread safe so it is a good idea to execute any GUI manipulations in the AWT event queue thread. This is done by using > (javax.swing.SwingUtilities.invokeAndWait (lambda() ...code to be > executed...)) > or > (javax.swing.SwingUtilities.invokeLater (lambda() ...code to be > executed...)) They both add the code to the event Queue as a runnable, this should only be done from calls that are forked off of the main thread.... I usually also wrap the code in a tryCatch so as to catch any errors that might occur. Otherwise the errors cause the thread to halt but are otherwise not observable: > (define(invokeAndWait F) > (javax.swing.SwingUtilities.invokeAndWait (lambda() > (tryCatch > (F) > (lambda(e) (printdebug 'error {ERROR in invokeAndWait: > [F], [e]\n}))) > )) > ) > ;; where printdebug is the error printing procedure for your > application.... > Have fun, and be careful out there! ---Tim--- On Wednesday, March 5, 2003, at 03:46 PM, Geoffrey Knauth wrote: > Thanks Tim! Just what the doctor ordered. --Geoffrey > > On Wednesday, March 5, 2003, at 03:24 PM, Timothy Hickey wrote: > >> (synchronize X F) >> synchronizes the current thread on object X and blocks until it gets >> the >> lock on X, at which time it calls (F X) >> >> e.g. >> (synchronize x .wait) gets a lock on x and then gives up all locks and >> waits until it is notified >> (synchronize x .notify) gets a lock on x and then notifies some thread >> waiting on x >> >> I often use the idiom >> (synchronize g (lambda(g) ....)) >> or >> (synchronize g (lambda(_) ...)) >> >> ---Tim--- >> >> On Wednesday, March 5, 2003, at 01:58 PM, Geoffrey Knauth wrote: >> >>> I can use Java threads from JScheme. >>> >>> But can I make JScheme variables `synchronized' ? >>> >>> Geoffrey >>> >>> >>> >>> ------------------------------------------------------- >>> This SF.net email is sponsored by: Etnus, makers of TotalView, The >>> debugger for complex code. Debugging C/C++ programs can leave you >>> feeling lost and disoriented. TotalView can help you find your way. >>> Available on major UNIX and Linux platforms. Try it free. >>> www.etnus.com >>> _______________________________________________ >>> Jscheme-user mailing list >>> Jsc...@li... >>> https://lists.sourceforge.net/lists/listinfo/jscheme-user >>> >> > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The > debugger for complex code. Debugging C/C++ programs can leave you > feeling lost and disoriented. TotalView can help you find your way. > Available on major UNIX and Linux platforms. Try it free. www.etnus.com > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user > |
From: Geoffrey K. <ge...@kn...> - 2003-03-05 20:46:33
|
Thanks Tim! Just what the doctor ordered. --Geoffrey On Wednesday, March 5, 2003, at 03:24 PM, Timothy Hickey wrote: > (synchronize X F) > synchronizes the current thread on object X and blocks until it gets > the > lock on X, at which time it calls (F X) > > e.g. > (synchronize x .wait) gets a lock on x and then gives up all locks and > waits until it is notified > (synchronize x .notify) gets a lock on x and then notifies some thread > waiting on x > > I often use the idiom > (synchronize g (lambda(g) ....)) > or > (synchronize g (lambda(_) ...)) > > ---Tim--- > > On Wednesday, March 5, 2003, at 01:58 PM, Geoffrey Knauth wrote: > >> I can use Java threads from JScheme. >> >> But can I make JScheme variables `synchronized' ? >> >> Geoffrey >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Etnus, makers of TotalView, The >> debugger for complex code. Debugging C/C++ programs can leave you >> feeling lost and disoriented. TotalView can help you find your way. >> Available on major UNIX and Linux platforms. Try it free. >> www.etnus.com >> _______________________________________________ >> Jscheme-user mailing list >> Jsc...@li... >> https://lists.sourceforge.net/lists/listinfo/jscheme-user >> > |
From: Timothy H. <tim...@ma...> - 2003-03-05 20:24:51
|
(synchronize X F) synchronizes the current thread on object X and blocks until it gets the lock on X, at which time it calls (F X) e.g. (synchronize x .wait) gets a lock on x and then gives up all locks and waits until it is notified (synchronize x .notify) gets a lock on x and then notifies some thread waiting on x I often use the idiom (synchronize g (lambda(g) ....)) or (synchronize g (lambda(_) ...)) ---Tim--- On Wednesday, March 5, 2003, at 01:58 PM, Geoffrey Knauth wrote: > I can use Java threads from JScheme. > > But can I make JScheme variables `synchronized' ? > > Geoffrey > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The > debugger for complex code. Debugging C/C++ programs can leave you > feeling lost and disoriented. TotalView can help you find your way. > Available on major UNIX and Linux platforms. Try it free. www.etnus.com > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user > |
From: Geoffrey K. <ge...@kn...> - 2003-03-05 19:04:32
|
I can use Java threads from JScheme. But can I make JScheme variables `synchronized' ? Geoffrey |
From: Timothy H. <tim...@ma...> - 2003-03-04 22:42:53
|
On Tuesday, March 4, 2003, at 05:23 PM, Ken Anderson wrote: > I don't believe anyone has yet, though it has been suggested. > If you know how to do Eclipse plugin's maybe we can wipe up something > together. I have not tried Eclipse yet. I've forwarded this to someone in my group that works with Eclipse. He might have a plug-in for Eclipse already... I let you know what he says. ---Tim--- > > k > At 01:27 PM 3/4/2003 -0800, Boris Tschirschwitz wrote: >> Hello and sorry for polluting your inbox. >> >> Do you know if anyone has written an eclipse plugin for jscheme, yet. >> Sorry, I ask b/c I'd like to use one, not write one. >> >> Thanks, >> Boris. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The > debugger > for complex code. Debugging C/C++ programs can leave you feeling lost > and > disoriented. TotalView can help you find your way. Available on major > UNIX > and Linux platforms. Try it free. www.etnus.com > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user > |
From: Ken A. <kan...@bb...> - 2003-03-04 22:23:41
|
I don't believe anyone has yet, though it has been suggested. If you know how to do Eclipse plugin's maybe we can wipe up something together. I have not tried Eclipse yet. k At 01:27 PM 3/4/2003 -0800, Boris Tschirschwitz wrote: >Hello and sorry for polluting your inbox. > >Do you know if anyone has written an eclipse plugin for jscheme, yet. >Sorry, I ask b/c I'd like to use one, not write one. > >Thanks, >Boris. |