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 J. H. <tim...@ma...> - 2004-03-02 04:11:25
|
On Monday, March 1, 2004, at 09:59 PM, Enrique Ricoy Belloc wrote: > I've started using Jscheme, I want to implement the > following code, but > don't know quite how to handle the URL[] definition: > > > URL[] urls = new URL[] { > new File("C:\\Program Files\\Microsoft SQL Server 2000 > Driver for > JDBC\\lib\\msbase.jar").toURL(), > new File("C:\\Program Files\\Microsoft SQL Server 2000 > Driver for > JDBC\\lib\\mssqlserver.jar").toURL(), > new File("C:\\Program Files\\Microsoft SQL Server 2000 > Driver for > JDBC\\lib\\msutil.jar").toURL() > }; I tend to use the (list->array TYPE LIST) procedure which converts a list into an array of the specified type. So, to convert a list L of filenames into an array of URLs you could use the following procedure: > (define (filenames->urlarray L) (list->array java.net.URL.class (map .toURL (map java.io.File. L)))) ...... which could be applied as follows: > (define z (filenames->urlarray (list "lib/jscheme.jar" "lib/applet.jar"))) ..... > z #(file:/Users/tim/Research/Software/jscheme/lib/jscheme.jar file:/Users/tim/Research/Software/jscheme/lib/applet.jar) Hope this helps, ---Tim--- P.S. You can access array elements with (Array.get z n) and (Array.set z n v), e.g. > (Array.get z 0) ... > (Array.set z 1 (Array.get z 0)) ... > URLClassLoader loader = new URLClassLoader(urls); > Driver d = (Driver) Class.forName(driverStr, true, > loader).newInstance(); This would rewrite to (define loader (URLClassLoader. urls)) (define d (.newInstance (Class.forName driverStr #t loader))) > > --end-- > > __________________________________ > Do you Yahoo!? > Get better spam protection with Yahoo! Mail. > http://antispam.yahoo.com/tools > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Enrique R. B. <ri...@ya...> - 2004-03-02 03:12:03
|
I've started using Jscheme, I want to implement the following code, but don't know quite how to handle the URL[] definition: URL[] urls = new URL[] { new File("C:\\Program Files\\Microsoft SQL Server 2000 Driver for JDBC\\lib\\msbase.jar").toURL(), new File("C:\\Program Files\\Microsoft SQL Server 2000 Driver for JDBC\\lib\\mssqlserver.jar").toURL(), new File("C:\\Program Files\\Microsoft SQL Server 2000 Driver for JDBC\\lib\\msutil.jar").toURL() }; URLClassLoader loader = new URLClassLoader(urls); Driver d = (Driver) Class.forName(driverStr, true, loader).newInstance(); --end-- __________________________________ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools |
From: Shankar U. <sh...@co...> - 2004-03-02 00:11:37
|
Ken Anderson wrote: > if (INTERRUPTABLE) interruptCheck(); ... > public static void interrupt (Thread t) { > INTERRUPTABLE = true; > t.interrupt(); > } Beware of race conditions! Swap the order of those two statements below (in interrupt()), and it'll be safer.. |
From: Ken A. <kan...@bb...> - 2004-03-01 23:28:54
|
My experience with JScheme is that calling a method to check if you've been interrupted is too costly. So i esentially do if (INTERRUPTABLE) interruptCheck(); interruptCheck() looks like: /** Maybe interrupt this thread of execution. **/ public static void interruptCheck() { if (INTERRUPTABLE && Thread.currentThread().interrupted()) { INTERRUPTABLE = false; throw new JschemeThrowable("Execution was interrupted."); } } To interrupt a thread you call the static method: /** Interrupt execution on thread <tt>t</tt>. **/ public static void interrupt (Thread t) { INTERRUPTABLE = true; t.interrupt(); } You may need something different in BeanShell. We put the INTERRUPTABLE check in the main evaluator loop, at function calls, and in 14 other places for built in procedures - while loops for things like appending or mapping over lists which can be long. But you can get along with just the check in the evaluator to start with. k At 04:20 PM 3/1/2004 -0600, Pat wrote: >On Mon, Mar 01, 2004 at 02:09:38PM -0800, Shankar Unni wrote: >> >> That might not work reliably either. Consider (for the sake of form): >> >> while (true) { >> try { >> while (true) ; >> } catch (Exception e) {} >> } >> >> Now *that*'s practically uninterruptible, unless you catch it in the tiny >> windows outside the try block. > >Yah, that's what I meant by adding the hooks to our looping control structures >as well as the main loop. There are only a few places necessary to cover all >of those cases, I think... > >I'm speaking of script code of course... If Java code does that we're hosed ;) > > >Pat > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >_______________________________________________ >Beanshell-users mailing list >Bea...@li... >https://lists.sourceforge.net/lists/listinfo/beanshell-users |
From: Ken A. <kan...@bb...> - 2004-02-17 15:16:10
|
You're right. In CVS I've added vector-fill!, string-copy and string-fill! and made the documentation more accurate. Thanks for pointing it out. k At 06:24 PM 2/16/2004 -0500, Borislav Iordanov wrote: >Hi all, > >'vector-fill!' is undefined. Might there be something wrong with the >build I'm using, or is it just not implemented. The docs say it should >be.... |
From: Borislav I. <bor...@ko...> - 2004-02-16 23:28:13
|
Hi all, 'vector-fill!' is undefined. Might there be something wrong with the build I'm using, or is it just not implemented. The docs say it should be.... Thanks, Boris |
From: Ken A. <kan...@bb...> - 2004-02-16 20:22:46
|
At 08:08 PM 2/14/2004 -0800, david wrote: >can the compile extend classes and override methods, >or do I need to do that with java? The compiler can't do this, but there is dclass/dclass.scm which lets you define Java classes in Scheme. dclass/record.scm lets you define simple "record" classes easily. If you want to implement an interface you can use elf/proxy.scm to use Java Proxy classes. |
From: Ken A. <kan...@bb...> - 2004-02-12 17:55:06
|
I tried the user interface out, but i could not seem to get it to define a procedure. Unfortunately, the documentation is in Italian. The internals look very different from JScheme. They use a JJTree parser to read scheme. k At 12:01 PM 2/12/2004 -0500, Borislav Iordanov wrote: >It's normal nobody has heard of it: the project was registered in >sourceforge 10 days ago and there are no releases so far. > >Boris > >| -----Original Message----- >| From: jsc...@li... >| [mailto:jsc...@li...] On Behalf >| Of Michael R Head >| Sent: Thursday, February 12, 2004 11:43 AM >| To: JScheme Users >| Subject: [Jscheme-user] scheme4j >| >| >| http://sourceforge.net/projects/scheme4j/ >| >| I follow the sourceforge file releases RSS feed and noticed >| this project today. In case anybody else here hasn't heard of >| it (google didn't seem to know scheme4j), here's info: >| >| "Scheme4j is a scheme interpreter written in java, with a >| nice GUI, a complete help, an innovative scheme debugger, >| good performances. Scheme4j, for the moment, is not a >| complete R5RS scheme standard interpreter, but we're working >| to make it R5RS complian" >| >| mike >| >| -- >| Michael R Head <bu...@zc...> >| ZClipse -- OpenSource Eclipse plugins >| >| >| >| ------------------------------------------------------- >| SF.Net is sponsored by: Speed Start Your Linux Apps Now. >| Build and deploy apps & Web services for Linux with >| a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user > > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Borislav I. <bor...@ko...> - 2004-02-12 17:03:25
|
It's normal nobody has heard of it: the project was registered in sourceforge 10 days ago and there are no releases so far. Boris | -----Original Message----- | From: jsc...@li... | [mailto:jsc...@li...] On Behalf | Of Michael R Head | Sent: Thursday, February 12, 2004 11:43 AM | To: JScheme Users | Subject: [Jscheme-user] scheme4j | | | http://sourceforge.net/projects/scheme4j/ | | I follow the sourceforge file releases RSS feed and noticed | this project today. In case anybody else here hasn't heard of | it (google didn't seem to know scheme4j), here's info: | | "Scheme4j is a scheme interpreter written in java, with a | nice GUI, a complete help, an innovative scheme debugger, | good performances. Scheme4j, for the moment, is not a | complete R5RS scheme standard interpreter, but we're working | to make it R5RS complian" | | mike | | -- | Michael R Head <bu...@zc...> | ZClipse -- OpenSource Eclipse plugins | | | | ------------------------------------------------------- | SF.Net is sponsored by: Speed Start Your Linux Apps Now. | Build and deploy apps & Web services for Linux with | a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Jscheme-user mailing list Jsc...@li... https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Michael R H. <bu...@zc...> - 2004-02-12 16:47:36
|
http://sourceforge.net/projects/scheme4j/ I follow the sourceforge file releases RSS feed and noticed this project today. In case anybody else here hasn't heard of it (google didn't seem to know scheme4j), here's info: "Scheme4j is a scheme interpreter written in java, with a nice GUI, a complete help, an innovative scheme debugger, good performances. Scheme4j, for the moment, is not a complete R5RS scheme standard interpreter, but we're working to make it R5RS complian" mike -- Michael R Head <bu...@zc...> ZClipse -- OpenSource Eclipse plugins |
From: Timothy J. H. <tim...@ma...> - 2004-02-05 21:14:32
|
On Thursday, February 5, 2004, at 03:27 PM, david wrote: > Is there any way to get a reference to the applet window > in the jscheme applet? > I want to use live connect to access the dom. > > This is how a java applet does it. > JSObject win = JSObject.getWindow(this); In the latest version of the webapp, a URL which requests a file FILENAME.scmapp will cause the webapp to generate a webpage containing an applet whose code is in FILENAME.scm That code must contain a procedure (install applet) which will be called with the applet object with the applet is initialized. Using this approach, the code for testapplet.scm would be ;; testapplet,.scm (import "whateverpackageJSObjectisin") (define (install applet) (define win (JSObject.getWindow applet)) ... do something with JSObject... ) I'll try to release this latest webapp over the weekend. (and hopefully do a full Sourceforge release of Jscheme as Ken had suggested a few weeks ago .....) ---Tim--- > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: <da...@da...> - 2004-02-05 20:38:48
|
Is there any way to get a reference to the applet window in the jscheme applet? I want to use live connect to access the dom. This is how a java applet does it. JSObject win = JSObject.getWindow(this); |
From: Timothy J. H. <tim...@ma...> - 2004-02-05 03:28:18
|
Hi David and Ken, On Tuesday, February 3, 2004, at 02:43 PM, Ken Anderson wrote: > At 11:14 AM 2/3/2004 -0800, david wrote: >> Thanks >> It eventually came back to me.. >> I just downloaded and installed the jetty based tutorial. >> I may include this by in the linux distro I am working on. >> If it's okay with you. > > Best to check with Tim. Its OK with me, but I'm putting together a better version soon so you might want to wait. (See below...) When do you want your next linux distro release to be? > >> I am thinking Jscheme and Mozilla/XUL make a pretty good combination. >> Is Anybody doing anything with this ? It think it might be a good combination and no one that I know of is working on it.... > > First i've heard about XUL. I looked into it. Its sort of a JLIB-like approach to GUI building but using XML rather than Scheme expressions. http://xul.sourceforge.net/ There are several versions in Java (basically XML parsers for this particular XML language) For example, http://thinlet.sourceforge.net/calculator.html Gives an example of a calculator applet where the GUI is given in XUL by <panel gap="4" top="4" left="4"> <textfield name="number1" columns="4" /> <label text="+" /> <textfield name="number2" columns="4" /> <button text="=" action="calculate(number1.text, number2.text, result)" /> <textfield name="result" editable="false" /> </panel> The Java source that uses this XUL file is package thinlet.demo; import thinlet.*; public class Calculator extends Thinlet { public Calculator() throws Exception { add(parse("calculator.xml")); } public static void main(String[] args) throws Exception { new FrameLauncher("Calculator", new Calculator(), 320, 240); } } public void calculate(String number1, String number2, Object result) { try { int i1 = Integer.parseInt(number1); int i2 = Integer.parseInt(number2); setString(result, "text", String.valueOf(i1 + i2)); } catch (NumberFormatException nfe) { getToolkit().beep(); } } In JScheme with JLIB we could do this as (define (install applet) (define lib (jlib.Swing.load)) ;; Layout and component properties (define G (let* ((H (java.util.Hashtable.)) (L (lambda(name) (lambda(x) (.put H name x))))) (row (textfield "" 4 (L "number1")) (label "+") (textfield "" 4 (L "number2")) (button "=" (action (lambda(e) (calc H)))) (textfield "" 4 (L "result") (lambda(x) (.setEditable x #f))) (button "beep" (action (lambda(e) (.java.awt.Toolkit.beep (.java.applet.Applet.getToolkit applet))))) ))) ;; event handling (define (calc H) (tryCatch (writeexpr (.get H "result") (+ (readexpr (.get H "number1")) (readexpr (.get H "number2")))) (lambda(e) (.java.awt.Toolkit.beep (.java.applet.Applet.getToolkit applet))))) (.add applet G) ) But with a little macrology and mini-language building, we ought to be able to get something even cleaner.... or... we could write a XUL->S-expression parser and then evaluate the S-expression to get a JLIB widget.... You can try this example at the links below, but I didn't get the beep to work... I'll have to look into it some other time (maybe I need getDefaultTooklit instead of getToolkit??) http://tat.cs.brandeis.edu:8090/spr04/tjhickey/calc.scmapp to run the applet http://tat.cs.brandeis.edu:8090/spr04/tjhickey/calc.scmV to see the "validated applet" http://tat.cs.brandeis.edu:8090/spr04/tjhickey/calc.scm to see the plain code (which is the only thing I actually wrote!) > > k > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Ken A. <kan...@bb...> - 2004-02-04 23:12:03
|
At 11:14 AM 2/3/2004 -0800, david wrote: >Thanks >It eventually came back to me.. >I just downloaded and installed the jetty based tutorial. >I may include this by in the linux distro I am working on. >If it's okay with you. Best to check with Tim. >I am thinking Jscheme and Mozilla/XUL make a pretty good combination. >Is Anybody doing anything with this ? First i've heard about XUL. k |
From: Ken A. <kan...@bb...> - 2004-02-04 20:55:38
|
I've enclosed some code that will allow you to redefine Java classes in a running JDK 1.4.2 application. It uses the Java Debugging Interface (JDI) to open a debugging session with itself. Currently you cannot change the number of fields or methods in the class, or its position in the class hierarchy, so basically only method behavior can be changed. This is another baby step toward Common Lisp. k |
From: Ken A. <kan...@bb...> - 2004-02-02 22:10:58
|
I tried sending an earlier version of this message, but i got hints that it is in mail limbo somewhere. Constructing an object can be verbose in Java, because often you need a temporary variable followed by a raft of setter calls. The raft grows even larger if some fields have values that must be constructed the same way. Here's an example from the JabberBeans API (though you can probably find bigger examples in uses of Swing): IQAuthBuilder iqa = new IQAuthBuilder(); iqa.setUser(user); iqa.setPassword(password); iqa.setResource(resource); InfoQueryBuilder iqb = new InfoQueryBuilder(); iqb.setType("set"); iqb.setIdentifier("set-1"); iqb.addExtension(iqa); Some languages, like Python and Common Lisp, lets you construct an object and initialize it with keyword value pairs. Tim's JLIB even does this one better by bypassing the keyword altogether and just allowing extra arguments to be assigned to the "most appropriate" field. For example you can make a red Quit button with (Button "Quit" Color.red$) or (Button Color.red$ "Quit"). Unfortunately this requires you to come up with a different API than the underlying Java, and there may not be a good choice of "most appropriate" field, if for example, all the fields are Strings. Here's a procedure (with object .method val ... .method val ...) that generalizes keyword value pairs. The keywords are Javadot methods and they can take more than on value: (define (with what . kvs) (define (method? x) (instanceof x JavaMethod.class)) (define (op kvs) (if (null? kvs) what (if (method? (car kvs)) (args (car kvs) '() (cdr kvs)) (error {expected operator, but got [(car kvs)]})))) (define (args method sofar kvs) (if (null? kvs) (begin (apply method what (reverse sofar)) what) (if (method? (car kvs)) (begin (apply method what (reverse sofar)) (op kvs)) (args method (cons (car kvs) sofar) (cdr kvs))))) (op kvs)) Here's what the above Java code might look like in JScheme: (with (InfoQueryBuilder.) .setType "set" .setIdentifier "set-1 .addExtension (.build (with (IQAuthBuilder.) .setUsername user .setPassword password .setResource resource)))))) Here's another example constructing an FTP client using an API from http://www.enterprisedt.com/downloads.html: (define (ftpClient user password remoteMachine directory) (define ftpc (with (FTPClient. remoteMachine) .debugResponses #t .login user password)) (if (not (or (not directory) (isNull directory) (equal? directory ""))) (.chdir ftpc directory)) ftpc) The .login method takes two arguments. The nice thing about this idiom is that objects can be initialized where they're needed and remain anonymous in many cases. We could gain some performance by writing this as a macro, but this hasn't been an issue so far. k |
From: Ken A. <kan...@bb...> - 2004-01-26 12:40:05
|
Jython code can be more compact than Java's for several reasons. One is you don't need type declarations. But this doesn't help much if you put one assignment on a line, though it does help with really long ones. The other thing that helps is that you can do constructors with keyword arguments. Tim's JLib has a nice variant on this where the construct guesses which setter should get which argument based on its type. Something like this: (button "Quit" Color.red$) - to make a red JButton labled "Quit". For this to work, you need to define button and other procedures that parallel what Java offers. Here's an alternative (with) that uses methods as keywords: (with (FTPClient. remoteMachine) .debugResponses #t .login user password) This is equlivalent to 4 lines: (let ((it (FTPClient. remoteMachine))) (.debugResponses it #t) (.login it user password) it) Here's a procedural version, though we could do a macro version that would do most of the work at read time. (define (with what . kvs) (define (method? x) (instanceof x JavaMethod.class)) (define (op kvs) (if (null? kvs) what (if (method? (car kvs)) (args (car kvs) '() (cdr kvs)) (error {expected operator, but got [(car kvs)]})))) (define (args method sofar kvs) (if (null? kvs) (begin (apply method what (reverse sofar)) what) (if (method? (car kvs)) (begin (apply method what (reverse sofar)) (op kvs)) (args method (cons (car kvs) sofar) (cdr kvs))))) (op kvs)) |
From: Timothy J. H. <tim...@ma...> - 2004-01-23 03:48:38
|
On Thursday, January 22, 2004, at 03:00 PM, Jonathan A Rees wrote: > (quotient 2436456447L 1048576L) This has been fixed in the latest CVS, as were related problems with modulo and remainder. Thanks for the bug report! ---Tim--- > % java -cp lib/jscheme.jar jscheme.REPL > Jscheme 6.2 1/22/2004 http://jscheme.sourceforge.net > > > (quotient 2436456447L 1048576L) > 2323L > > (modulo 2436456447L 1048576L) > 614399L > > (remainder 2436456447L 1048576L) > 614399L > > (modulo -2436456447L 1048576L ) > 434177L > > (remainder -2436456447L 1048576L ) > -614399L > > (modulo 2436456447L -1048576L ) > -434177L > > (remainder 2436456447L -1048576L ) > 614399L |
From: Jonathan A R. <ja...@mu...> - 2004-01-22 20:07:09
|
(quotient 2436456447L 1048576L) => -1772 |
From: Ken A. <kan...@bb...> - 2004-01-21 18:09:22
|
Geoffrey asked about synchronized methods in JScheme. A procedure with no arguments is a Java Runnable so you can create threads easily: (.start (Thread. (lambda () (do-the-real-work...))) There is a (synchronize) procedure that takes an object and a procedure of one argument: (synchronize x (lambda (x) (do-horrible-side-effect x) ...)) The file elf/future.scm is a implementation of multilisp's future idea. k |
From: Aubrey J. <ag...@al...> - 2004-01-21 04:19:42
|
| Date: Mon, 19 Jan 2004 16:38:46 -0500 | From: Ken Anderson <kan...@bb...> | | At 12:16 AM 1/16/2004 -0500, Aubrey Jaffer wrote: | >Having #null distinct from #f has caused 3 errors in jscheme.init. | >What purpose does having #null different from '(), #t, and #f serve? | | The short answer is this we chose to distinquish #null from '() or | #f so we could distinguish between them, though i don't think the | argument was strong either way. I agree that checking for #null is | annoying, but what are you actually proposing? I think those functions should return #f for failure. |
From: Ken A. <kan...@bb...> - 2004-01-19 21:39:06
|
At 12:16 AM 1/16/2004 -0500, Aubrey Jaffer wrote: >Having #null distinct from #f has caused 3 errors in jscheme.init. >What purpose does having #null different from '(), #t, and #f serve? The short answer is this we chose to distinquish #null from '() or #f so we could distinguish between them, though i don't think the argument was strong either way. I agree that checking for #null is annoying, but what are you actually proposing? Here are the usages of #null that i see: (define (getenv path) (define prop (System.getProperty path)) (and (not (eq? prop #null)) prop)) (and (or (slib.zip-on-classpath?) (not eq? (Scheme.openResource "slib/require.scm") #null)) "slib/") (define (file-exists? f) (not (eq? (Scheme.open f) #null))) Since Scheme.openResource and Scheme.open are under our control, returning #f would be more convenient in Scheme. But what should the type signature of the methods be in Java? Currently they are InputPort methods(String). So, currently #null is a potential return value. Since opening something that could be a file, a resource or a URL is useful perhaps it should be a JScheme primitive that returns #f. In fact, these procedures were only used in Java. I generalized (load) and (call-with-input-file) to do this because i realized it made slib support and remote code sharing easier. If we made #null the same as '() we'd still have to do a test in the conditionals above, but we'd have only one procedure (null?). If you're proposing treating #null as #f in conditionals that might make some JScheme code cleaner. k |
From: Ken A. <kan...@bb...> - 2004-01-06 22:01:31
|
At 05:19 PM 1/5/2004 -0500, bor...@ko... wrote: >Hi Ken, Timothy > >| Your definition is wrong. Try this: >| (define fact >| (let ((one (BigInteger. "1"))) >| (lambda (n) >| (if (= 0 (.intValue n)) >| one >| (.multiply n (fact (.subtract n one))))))) > >I feel ridiculous...., I typed this quickly just to check whether >BigInteger actually worked well before sending the email. Actually, i didn't see the problem until i ran my own fact in PLT Scheme and as you said, it came back right away. Then i tried yours in JScheme and it took over the machine. I don't see why it didn't run out of stack or memory eventually. > >| >And then I had to stop the evaluation of (fact (BigInteger "1000")) >| >after 20 minutes on a 1.6GHZ, 512MB laptop. Scheme >| implementations that >| >I've played with in the past would return the result almost >| right away >| >on much slower machines. >| > >| >Anyway, the concern is really practical, not just for the >| sake of it. >| >I'm getting integer overflows while trying to solve a very practical >| >problem. >| >| Have you tried using longs? > >No, I will. It may well work in my particular situation....However, in >InputPort.readWholeNumber the U.toNum(long) method is always invoked >regardless of how the number is written. And that method will yield an >Integer object whenever the constant is within the Java int range. Wouldn't >that matter in subsequent calculations? Again, I am only superficially >familiar with the code, I just starated using Jscheme. I don't think so, unless there's a JScheme bug you should report. U.toNum(long) will return an Integer or a Long, but arithmetic will work with mixed Integer and Long values. Just make sure you seed your comutation with a Long, and the result should be a Long. If that overflows, you need BigIntegers. >| >If you have thought about this and have ideas about what to do, I am >| >willing to help with coding, testing etc. >| > >| >BTW, I think Jscheme is great! >| >| Thanks! >| >| I've been thinking there should be an extension library that >| would let you do this. Perhaps we can develop one. Here's a >| simple one that provides big integers and big rational >| numbers, i've been playing with. > >I think this makes sense, but only as a workaround. When typing gets so >fine grained, and in a language without operator/function overloading, it >becomes quite difficult to make a program evolve, reuse libraries with >algorithms that one needs etc. I can't always know in advance whether I >need a big integer, a long or a 32 bit value, I can't use a library written >with longs for my "big integer problem". The fact that if I want to work Perhaps my example code confused you. What i'm proposing is one or more libraries that extend JScheme current math capabilites. You load them and + - * / ... work with all Java Primitive types as well as bignums say. This can be done with (define-method) which can handler case conversion for you. The code i sent you converted everything to BigInteger which is not idea. >with, say, precisely 32-bit integers is really cool, but I shouldn't be >forced to make that decision when I am not getting anything out of it. > >Perhaps there is a problem with the Java interfacing - those number type >distinctions seem important only for that purpose. But probably a sensible Probably, but it isn't required for a Scheme to handle bignums. So while we followed Java for compatibility JScheme is also a Scheme, though maybe not an ideal one. >method resolution can be easily found. Also, wasn't there a type casting >syntax in Jscheme for Java method invokation? I don't understand your question. JScheme lforages at the reflection interface of Java. There is no way to type cast through reflection. Typecasting is a Java issue, not a JScheme one. >I would say that it makes sense to represent integers in Jscheme with a >BigInteger whenever a Java modifier is not used in a number constant. The problem with this is that JScheme has worked hard to be a Scheme but also to snuggle close to Java. To do this we decided to use Java types whenever possible. So, if x is an Integer (.foo bar (* x x)) will work even if it overflows. I agree, that may not be ideal program behavior. But if we took your approach you'd have to write something like (.foo bar (->Integer (* x x)). Perhaps by working with you we can come up with a good approach. I'd start with a JScheme library. k |
From: Michael R H. <bu...@zc...> - 2004-01-06 11:06:53
|
On Mon, 2003-12-29 at 08:08, Ken Anderson wrote: > Thanks for your work on JScheme in Eclipse! > > I have downloaded your plugin, and put it in the eclispe plugin > directory. Is that all i need to do? I such a beginner. I can't > seem to get the update manager to show me new plugins i can download. > Is there a way to do that, or do i just find them in at the plugin > website and install them myself? I've used Eclipse for so long, it's hard for me to realize what's obvious and non-obvious. Thanks for taking the role of the eclipse-beginner for me ;-) I'm a little unfamiliar with the update manager. Currently, the update manager is a bit tricky to use, IMHO. Plus, since I always set up a shared installation of Eclipse, it's not so useful to me, so I don't use it. However, I do know that you need to add various bookmarks to URLs (like http://zclipse.org/updates) to the "Sites to Visit" region. Then you should see available updates in that same view. So first of all, I've only tested the JScheme plugin with Eclipse 2.1 (through 2.1.2), so if you got one of the 3.0 milestones, it might be issueful. If you're using 2.1.2, then the contents of org.zclipse.jscheme_0.1.6.zip should be extracted to the plugins directory inside eclipse's home directory (so eclipse/plugins/org.zclipse.jscheme_0.1.6/plugin.xml should exist). Once that's there, then you should restart eclipse and everything _should_ work. I assume you got that far since you said below that you have the hilighting working. Since the "running man" icon isn't there, I'm betting you're not in the Java perspective. I'm always in that perspective. Anyway, there are two ways to make the running man icon appear: one is to simply switch to the Java Perspective (Window/Open Perspective/Java); the other is to customize the current perspective to show it (Window/Customize Perspective, drill down through "Other" and check off "Launch"). I think I will be adding a feature to auto-jump to the new JScheme perspective, thereby adding the laucnh buttons, when a .scm file is created or opened, if it turns out not to be too hard. > > How hard would it be to run JScheme inside Eclipse, like i do in EMACS? My needs for the plugin called for running each JScheme program in a separate JVM. I don't think it would be too hard add a button that just launched REPL into the console for user interaction. In fact, you, as a user can do this rather simply by creating an (empty) .scm file, and running it with the launcher. After launching the empty .scm file, Eclipse should raise the console view and display the familiar line "Jscheme 6.1.1 5/5/2003 http://jscheme.sourceforge.net" followed by the angle prompt. Keyboard input in that view will be sent to System.in of REPL. It might not be hard to add a button that would send the current file to System.in of the REPL process, but it's not one of my 1.0 critical features, and it could possibly be a bit hairy to implement if some obvious API isn't there or doesn't work the way I expect. I'll add that to my future TODO, though. Launching REPL from withing Eclipse's own Java process would be a bit trickier, since I don't know where System.in or System.out would be. > > At 12:30 PM 12/28/2003 -0900, Michael R Head wrote: > >I've been spending some time with my JScheme plugin for Eclipse again (I > >just added matching parenthesis highlighting to the version in CVS), and > >I've come to a point at which I have to really parse the input buffer to > >add the next features on my TODO: > >http://cvs.zclipse.org/viewcvs.py/zclipse/org.zclipse.jscheme/TODO?view=markup > > One of the things on your todo list is a code formatter. Why don't > you use the pretty printer, src/elf/eopl2/jscheme/genwrite.scm Good idea. I might see about doing that on my flight back to Boston tomorrow night. I really ought to have a reasonable way to have the plugin run JScheme programs on the source files. I hadn't thought to look for such a thing, since I figured a code formatter/pretty printer would be a good way to exercise the syntax tree. but exercising a JScheme callout feature might be a better and easier short term goal. > > > >For details on the plugin: http://www.zclipse.org/projects/jscheme > > > >I've toyed with rolling my own parser (which I've started twice: once > >ad-hoc, and once from the r4rs spec), writing a SableCC grammar for > > Yes, i've tried it from the spec too. > Personally, i void tools like this because it takes a long time for me > to learn how to use them. Instead i use a simpler technique i can > remember. I first got the idea from Henry Baker: > http://citeseer.nj.nec.com/cache/papers/cs/24786/http:zSzzSzlinux.rice.eduzSz~rahulzSzhbakerzSzPrag-Parse.pdf/baker91pragmatic.pdf Cool. I've used SableCC in the past and really like the parsers it generates compared to JLex+JavaCUP and JavaCC (they're very OO and present a very traversable syntax tree). I've found that hand-coded parsers to be a bit harder to manipulate, but I will definitely check out the links you provided. > > I now tend to use a functional state machine style. See the read-case > macro in > http://openmap.bbn.com/~kanderso/lisp/performing-lisp/pl-io.ps > > I wrote a corba idl tokenizer in this style in 274 lines while Sun's > input to lex was 353. That's certainly not a bad metric for success ;-) > I don't see why JScheme isn't perfect for this. You don't need > downcasts or the visitor pattern. http://norvig.com/design-patterns/ > shows that in Lisp many patterns are unnecessary or trivial. Yeah, doing it right in JScheme might be the easiest way. My only concern is that I want to be able to recover from unbalanced parentheses as gracefully as I can, which seems easier if I can write code that interacts with the parser. I have been considering about extending my plugin with JScheme, but haven't been quite prepared to think about the details of that quite yet, as I'm still trying to figure out which Eclipse hooks need to be used to do everything I need, and adding a language barrier at this point would complicate things (for me, anyway). As far as downcasting goes, my concern is not the actual downcast itself, but the ability to use static typing as much as possible. The point of the visitor pattern, for me, is to ensure that the compiler spits errors when the AST changes. My language preference is for strong- and static- typing, hence why I wanted to do the Eclipse plugin in the first place -- I'm mostly a Java developer that from time to time hacks on some JScheme apps, but there's no need to start a religious war: my most important directive here is to find the quick-but-not-dirty solutions, if that happens to mean implementing things on the JScheme side, then I'm all for it ;-) > I've been thinking that InputPort has grown to be a fairly big mess. > I've been thinking about rewriting it in a (read-case) like macro in > JScheme that expands to Java code. If you'd like to work on that with > me, we can add stuff to better support Eclipse. Keeping track of file > and line numbers would even help in reporting JScheme errors. That would be cool. From my point of view, if it could spit back a Java-based AST (with line and column numbers, comments, ...), then it would be perfect, but as long as all the data is available, I could also easily work with JScheme, too -- since that's clearly a very natural way to work with trees of lists. Let me know what I can do to help, mike -- Michael R Head <bu...@zc...> ZClipse -- OpenSource Eclipse plugins |
From: <bor...@ko...> - 2004-01-05 23:13:20
|
Hi Ken, Timothy | Your definition is wrong=2E Try this: | (define fact=20 | (let ((one (BigInteger=2E "1"))) | (lambda (n) | (if (=3D 0 (=2EintValue n))=20 | one | (=2Emultiply n (fact (=2Esubtract n one))))))) I feel ridiculous=2E=2E=2E=2E, I typed this quickly just to check whether BigInteger actually worked well before sending the email=2E =20 | >And then I had to stop the evaluation of (fact (BigInteger "1000"))=20 | >after 20 minutes on a 1=2E6GHZ, 512MB laptop=2E Scheme=20 | implementations that=20 | >I've played with in the past would return the result almost=20 | right away=20 | >on much slower machines=2E | > | >Anyway, the concern is really practical, not just for the=20 | sake of it=2E=20 | >I'm getting integer overflows while trying to solve a very practical=20= | >problem=2E |=20 | Have you tried using longs? No, I will=2E It may well work in my particular situation=2E=2E=2E=2EHowev= er, in InputPort=2EreadWholeNumber the U=2EtoNum(long) method is always invoked regardless of how the number is written=2E And that method will yield an Integer object whenever the constant is within the Java int range=2E Would= n't that matter in subsequent calculations? Again, I am only superficially familiar with the code, I just starated using Jscheme=2E | >If you have thought about this and have ideas about what to do, I am=20= | >willing to help with coding, testing etc=2E | > | >BTW, I think Jscheme is great! |=20 | Thanks! |=20 | I've been thinking there should be an extension library that=20 | would let you do this=2E Perhaps we can develop one=2E Here's a=20 | simple one that provides big integers and big rational=20 | numbers, i've been playing with=2E I think this makes sense, but only as a workaround=2E When typing gets so fine grained, and in a language without operator/function overloading, it becomes quite difficult to make a program evolve, reuse libraries with algorithms that one needs etc=2E I can't always know in advance whether I need a big integer, a long or a 32 bit value, I can't use a library writte= n with longs for my "big integer problem"=2E The fact that if I want to work= with, say, precisely 32-bit integers is really cool, but I shouldn't be forced to make that decision when I am not getting anything out of it=2E Perhaps there is a problem with the Java interfacing - those number type distinctions seem important only for that purpose=2E But probably a sensib= le method resolution can be easily found=2E Also, wasn't there a type casting= syntax in Jscheme for Java method invokation?=20 I would say that it makes sense to represent integers in Jscheme with a BigInteger whenever a Java modifier is not used in a number constant=2E Thanks for your responses! Best, Boris -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web=2Ecom/ =2E |