public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Kawa JTable String[][] arrays
@ 2017-11-09  9:06 Fabian Boucsein
  2017-11-09  9:11 ` Tom Bousso
  2017-11-09  9:35 ` Damien MATTEI
  0 siblings, 2 replies; 6+ messages in thread
From: Fabian Boucsein @ 2017-11-09  9:06 UTC (permalink / raw)
  To: kawa

Hello fellow Kawa scheme users,
 
i am experimenting with JTables in Kawa. I'm stuck with the creation of an String[][] array.
Is ist possible to create one?

Something like this in Java:
String[][] rowData = {
    { "Japan", "245" }, { "USA", "240" }, { "Italy", "220" }
}
  
Also i would like to say thank you, for the creation of such a pleasant to work with Scheme
implementation for the JVM. I love it!
 
Kind regards,
Fabian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kawa JTable String[][] arrays
  2017-11-09  9:06 Kawa JTable String[][] arrays Fabian Boucsein
@ 2017-11-09  9:11 ` Tom Bousso
  2017-11-09 18:14   ` Per Bothner
  2017-11-09  9:35 ` Damien MATTEI
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Bousso @ 2017-11-09  9:11 UTC (permalink / raw)
  To: Fabian Boucsein; +Cc: kawa

Hi Fabian,

You can try something like this: (define data (String[][] (String[] "Japan"
"245") (String[] "Abc" "345")))

-Tom

On Thu, Nov 9, 2017 at 1:06 AM, Fabian Boucsein <Fabian.Boucsein@gmx.de>
wrote:

> Hello fellow Kawa scheme users,
>
> i am experimenting with JTables in Kawa. I'm stuck with the creation of an
> String[][] array.
> Is ist possible to create one?
>
> Something like this in Java:
> String[][] rowData = {
>     { "Japan", "245" }, { "USA", "240" }, { "Italy", "220" }
> }
>
> Also i would like to say thank you, for the creation of such a pleasant to
> work with Scheme
> implementation for the JVM. I love it!
>
> Kind regards,
> Fabian
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kawa JTable String[][] arrays
  2017-11-09  9:06 Kawa JTable String[][] arrays Fabian Boucsein
  2017-11-09  9:11 ` Tom Bousso
@ 2017-11-09  9:35 ` Damien MATTEI
  1 sibling, 0 replies; 6+ messages in thread
From: Damien MATTEI @ 2017-11-09  9:35 UTC (permalink / raw)
  To: kawa

hello Fabian,

i never use JTables in java and not sure it exists something like that in Kawa,
as Scheme does not have multiple array dimensions i write some code do do it:
https://github.com/damien-mattei/library-FunctProg/blob/master/array.scm
i have test it with kawa and it works

i just checked the existence of multidimension array features for scheme and there exists the SRFI 25
https://srfi.schemers.org/srfi-25/srfi-25.html

the latest version of Kawa seems to implement it (i cannot test it on my old installation):
https://www.gnu.org/software/kawa/Arrays.html

hope something is matching the Jtable in a compatible way.
regards,
damien


Le Thursday 09 November 2017 10:06:13 Fabian Boucsein, vous avez écrit :
> Hello fellow Kawa scheme users,
>  
> i am experimenting with JTables in Kawa. I'm stuck with the creation of an String[][] array.
> Is ist possible to create one?
> 
> Something like this in Java:
> String[][] rowData = {
>     { "Japan", "245" }, { "USA", "240" }, { "Italy", "220" }
> }
>   
> Also i would like to say thank you, for the creation of such a pleasant to work with Scheme
> implementation for the JVM. I love it!
>  
> Kind regards,
> Fabian
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kawa JTable String[][] arrays
  2017-11-09  9:11 ` Tom Bousso
@ 2017-11-09 18:14   ` Per Bothner
  2017-11-10 15:44     ` Fabian Boucsein
  0 siblings, 1 reply; 6+ messages in thread
From: Per Bothner @ 2017-11-09 18:14 UTC (permalink / raw)
  To: Tom Bousso, Fabian Boucsein; +Cc: kawa

On 11/09/2017 01:11 AM, Tom Bousso wrote:
> Hi Fabian,
> 
> You can try something like this: (define data (String[][] (String[] "Japan"
> "245") (String[] "Abc" "345")))

Even better:

(define data::String[][] [["Japan" "245"] ["USA" "240"]])
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kawa JTable String[][] arrays
  2017-11-09 18:14   ` Per Bothner
@ 2017-11-10 15:44     ` Fabian Boucsein
  2017-11-10 16:02       ` Per Bothner
  0 siblings, 1 reply; 6+ messages in thread
From: Fabian Boucsein @ 2017-11-10 15:44 UTC (permalink / raw)
  To: Per Bothner; +Cc: Tom Bousso, kawa

Thank you very much Per and Tom.

Per's version works very fine for me. Although i think they should be almost the same. What does ::String[][]? And maybe could you explain the difference between string and String?

Kind regards,
Fabian


Gesendet: Donnerstag, 09. November 2017 um 19:14 Uhr
Von: "Per Bothner" <per@bothner.com>
An: "Tom Bousso" <tombousso@gmail.com>, "Fabian Boucsein" <Fabian.Boucsein@gmx.de>
Cc: kawa@sourceware.org
Betreff: Re: Kawa JTable String[][] arrays
On 11/09/2017 01:11 AM, Tom Bousso wrote:
> Hi Fabian,
>
> You can try something like this: (define data (String[][] (String[] "Japan"
> "245") (String[] "Abc" "345")))

Even better:

(define data::String[][] [["Japan" "245"] ["USA" "240"]])
--
--Per Bothner
per@bothner.com http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kawa JTable String[][] arrays
  2017-11-10 15:44     ` Fabian Boucsein
@ 2017-11-10 16:02       ` Per Bothner
  0 siblings, 0 replies; 6+ messages in thread
From: Per Bothner @ 2017-11-10 16:02 UTC (permalink / raw)
  To: Fabian Boucsein; +Cc: Tom Bousso, kawa

On 11/10/2017 07:44 AM, Fabian Boucsein wrote:
> Thank you very much Per and Tom.
> 
> Per's version works very fine for me. Although i think they should be almost the same. What does ::String[][]? And maybe could you explain the difference between string and String?

'::TYPE' (or with a space as in ':: TYPE') is a "type specifier".
See https://www.gnu.org/software/kawa/Definitions.html.

(define data::String[][] [["Japan" "245"] ["USA" "240"]])

would probably be more readable as

(define data ::String[][] [["Japan" "245"] ["USA" "240"]])

(define data :: String[][] [["Japan" "245"] ["USA" "240"]])

Regardless it specifies that 'data' has the type "String[][]'.
Normally ["Japan" "245"] evaluates to an immutable vector,
but when the required type (in the static context) is a String[]
then the compiler converts it for you.  Similarly for String[][]/

You can write java.lang.String[][] instead of String[][].
They're not quite the same in terms what conversions they
handle, but specify the same data type.

The '[]' means a Java array type (as opposed to the multi-dimensional Scheme arrays).

https://www.gnu.org/software/kawa/Standard-Types.html
explains 'string' versus 'String'.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-10 16:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09  9:06 Kawa JTable String[][] arrays Fabian Boucsein
2017-11-09  9:11 ` Tom Bousso
2017-11-09 18:14   ` Per Bothner
2017-11-10 15:44     ` Fabian Boucsein
2017-11-10 16:02       ` Per Bothner
2017-11-09  9:35 ` Damien MATTEI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).