Author Topic: Another embeddable Scheme : KSI  (Read 3456 times)

0 Members and 1 Guest are viewing this topic.

RobbeK

  • Sr. Member
  • ****
  • Posts: 368
Another embeddable Scheme : KSI
« on: January 17, 2015, 04:36:54 AM »
Documentation in Russian only , -- seems to have the full numeric tower

http://ksi.sourceforge.net/

also have a look at http://www.lambdanative.org/

best Rob
« Last Edit: January 17, 2015, 05:37:03 AM by RobbeK »

John

  • Hero Member
  • *****
  • Posts: 3280
Re: Another embeddable Scheme : KSI
« Reply #1 on: January 17, 2015, 09:37:00 AM »
Interesting. It seems there is almost as many Lisp languages as there are BASIC.  :o

I'm just a Scheme observer. No more converting, embedding of LISP languages for me. I'm happy with TinyScheme for Script BASIC and have moved on to other things. Please don't let my lack of participation diminished your dreams.

I would be interested in your findings with Gauche. Full featured,. stable, easy to use, extensible, ...? ? ?


Mike Lobanovsky

  • Admin Support Member
  • *****
  • Posts: 1857
Re: Another embeddable Scheme : KSI
« Reply #2 on: January 17, 2015, 09:40:05 AM »
seems to have the full numeric tower

1. No, complex numbers aren't implemented.

2. Also, some weird restrictions as to what can and cannot be defined:

(define 1+ (lambda (x) (+ 1 x)))

reports 1+ as an error caused by bad numeric notation.

3. Doesn't support the (macro) procedure either.

Other deviations are also possible but I didn't bother to investigate any further.

Yet might work a little faster than fully optimized nanoscheme:
  • 28.2 sec ksi
  • 30 sec nanoscheme compiled with -O3
in a doubly recursive (fibonacci 35) benchmark.


(Hehe, the docs contain a translation of r5rs Scheme standard to Russian :) )
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, 2 x nVidia GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

RobbeK

  • Sr. Member
  • ****
  • Posts: 368
Re: Another embeddable Scheme : KSI
« Reply #3 on: January 17, 2015, 03:22:29 PM »
Hi,

@John,  seems exc , both hygienic and classic macro's -- some very interesting math libs , I will have a look at the FFI tomorrow -- could be very very usable (it seems it does a kind of "compile" on the fly -- not sure what is meant - maybe just a kind of parser translating the S-expressions without evaluating them (?   dunno)

@Mike -- well complex numbers seem to work (see attached) but maybe only with the +,-,*,/   forgot to test goniometric functions,powers  etc...  (hard to believe this should be working ...  )  fractions do work too (as you can see)   

best Rob

.

John

  • Hero Member
  • *****
  • Posts: 3280
Re: Another embeddable Scheme : KSI
« Reply #4 on: January 17, 2015, 03:34:22 PM »
Quote from: Rob
... seems it does a kind of "compile" on the fly ...

Like Script BASIC, it's tokenizing the code before execution. Sounds promising from the little time I have spent with gosh.

I noticed the eval() function as well. That's a very nice feature for a Scheme/Lisp language to have. (jealous SB dev/user comment)

On the other hand, I do have the TinyScheme ext. mod. to act as an evaluator.  ::)

Please keep me in the loop as you do your review.
« Last Edit: January 17, 2015, 03:46:50 PM by John »

Mike Lobanovsky

  • Admin Support Member
  • *****
  • Posts: 1857
Re: Another embeddable Scheme : KSI
« Reply #5 on: January 17, 2015, 05:04:36 PM »
Yes Rob,

It can handle complex numbers. I withdraw my Objection 1. It just can't read when I type 0.+5i or 0+5.i or 0.+5.i and throws an error.

Still that's ubnormal IMHO because Gauche, Gambit, and Petite Chez do parse such notation without any problem.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, 2 x nVidia GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

Mike Lobanovsky

  • Admin Support Member
  • *****
  • Posts: 1857
Re: Another embeddable Scheme : KSI
« Reply #6 on: January 17, 2015, 05:08:15 PM »
time I have spent with gosh

Gosh, how gauche is this Gauche! (Fr. crooked) ;D

(jealous SB dev/user comment)

Hehe, manage SB but code in FBSL and be happy. :P
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, 2 x nVidia GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

RobbeK

  • Sr. Member
  • ****
  • Posts: 368
Re: Another embeddable Scheme : KSI
« Reply #7 on: January 18, 2015, 03:38:37 AM »
Hi ,

It's a pity , Ksi can not do macro's - otherwise a personalized notation for complex numbers could be set up easily.
with functions then :
(define (complex x y)
  (+ x (* y (sqrt -1))))

It's amazing how left means a kind of evil in all languages while right is mmm...  right  (gauche et droite , en franšais)
gauchir in french is to turn aside.  But most obvious it is in Latin :    sinister  :-\
(i'm educated by jesuit priests - i know those meanings )
German/Flemish link , links etc..  also related with tricky , not right (obviously ), not trustworthy ,  etc ...
Maybe in Slavic languages on ideological grounds there may have been a kind of rehabilitation -- the similarity between red and beautiful is pure coincidence probably  ???

(eval )   together with (quote ) the core of Lisp
(eval ) turns data into code
(quote ) turns code into data

strangely , (eval ) takes two arguments in Gauche (maybe the new R7 ?)
but it has lazy evaluation and lazy lists if needed , this is great !!!! , makes Haskell style evaluations possible :
take all natural numbers ,from these those smaller than 400 , from these those ending on an 8 etc...
non-lazy it is simply impossible to take all the natural numbers  -- Racket Scheme can do something similar , but the technique is different (in-naturals)  iirc

The documentation related with FFI (Gauche) i can find it Japanese only ..  there are some packages (inclusive a C-wrapper) but most of them linking jap documentation
http://practical-scheme.net/wiliki/wiliki.cgi/Gauche:Packages?l=en   

addendum : (on an old 'puter - running Linux )

gosh> (define (fib n)
        (if (<= n 2) 1
          (+ (fib (- n 1)) (fib (- n 2)))))
fib
gosh> (fib 10)
55
gosh> (time (fib 35))
;(time (fib 35))
; real   1.996
; user   1.920
; sys    0.000
9227465
gosh>

TCO ???   

best Rob

CLISP : (compiled)

[1]> (defun fib(n)
       (if (<= n 2) 1
        (+ (fib (- n 2)) (fib (- n 1)))))
FIB
[2]> (compile 'fib)
FIB ;
NIL ;
NIL
 (time (fib 35))
Real time: 3.569223 sec.
Run time: 3.428 sec.
Space: 0 Bytes
9227465

Austin Kyoto CL

GCL (GNU Common Lisp)  2.6.10 CLtL1    Apr  2 2014 14:19:37
Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.
Temporary directory for compiler files set to /tmp/

>(defun fib(n)
       (if (<= n 2) 1
        (+ (fib (- n 2)) (fib (- n 1)))))

FIB

>(compile 'fib)

Compiling /tmp/gazonk_3770_0.lsp.
End of Pass 1. 
End of Pass 2. 
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling /tmp/gazonk_3770_0.lsp.
Loading /tmp/gazonk_3770_0.o
start address -T 0x8a3658 Finished loading /tmp/gazonk_3770_0.o
#<compiled-function FIB>
NIL
NIL

>(time (fib 35))

real time       :      0.370 secs
run-gbc time    :      0.349 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
9227465

Racket Scheme :
Welcome to DrRacket, version 5.3.6 [3m].
Language: racket; memory limit: 256 MB.
> (time (fib 35))
cpu time: 3600 real time: 3780 gc time: 0
9227465

Gauche is faster than a bytecode compiler with GNU Lightning JIT  8)
(CLISP uses identical compiling and the benchmarks are almost identical too)


the smart way -- single recursion helper function with accumulators :
Gauche :


gosh> (define (fib* n ac1 ac2)
        (if (<= n 2) ac2
         (fib* (- n 1) ac2 (+ ac1 ac2))))
fib*
 
gosh> (define (fib n) (fib* n 1 1))
fib
gosh> (fib 10)
55
gosh> (time (fib 35))
;(time (fib 35))
; real   0.000
; user   0.000
; sys    0.000
9227465
gosh> (time (fib 350))
;(time (fib 350))
; real   0.000
; user   0.000
; sys    0.000
6254449428820551641549772190170184190608177514674331726439961915653414425
gosh> (time (fib 3500))
;(time (fib 3500))
; real   0.008
; user   0.000
; sys    0.000
1280135297794681361535851368251019615389004811220654459648376511830868987540265505171364974834834706416086262
7646405505933262857592852159799990171859295742335236316746591763614040818482237939154359893181581472587852884
5711814356562816020703656120345663431005792446926782064141406206872674044496382612109555705276756054608939403
0800102574975205658250391412325901852365363002434324044270784834496952752239227846352109757430196574621413655
7788378862833442132501334389894536958226513322505258154742912078748396889544371486921415398348419636895720011
1230649716136282989616442150717747827588840460128198812637224475960962985001698982034192388374058622072865322
851268191822192497641904232912275607663029887240803055414422300714028137340125
gosh> (time (fib 35000))
;(time (fib 35000))
; real   0.433
; user   0.380
; sys    0.000
1651671774188865369804424388786818731955799225064552005474226085878901080409589735151395201321742005395540690
3829337049126031699652129206494332659014089694279271694809329170065221692511552858870051428317761966248074598
6253421922385670478266846213547032439642584001450558909553719826098421710268912957077158693928792925379019916
5376216436868444698087460099581559988756552107606831539838011737981877013975802544173532175465633762456296414
7028942624794379918283386616553714865480402160046622613356847332852440420274846454409055393152586115816117061
7884871263454155267691359120119950576704628540114965142501599781262190726995988947257368315932519868273795666
2299617799018470552939428838803374308316315271109456322742245154718445193863308929352945368630071676440354480
8372969207696145551545739998285719149288104929941726657020770787647950349233488010656094493167817302845593427
7935266405362429880773920282115071945936446154164299037149461466172166323358591716576115987992871749264172532
7026625106503014188675390865164353635482103603918565708637499224869183370419944144792487440134026318129305117
6201268267972213282987820657385240560469357304396726174488004668502749339915746555392509001865014565905135056
5303186005392292261817260122746681355664780122298914430271900270005318683014089524074500278041106120530017476
0219157649669122097906099746732648916266464218859250204031379678109012664789330431191841534764322977535500149
0059392144943444384279609000598263191943129433769588117396389360899397918393776397436824884801318850581108037
8306179701063528122074407932016734931997738201827962788252907820792000120949551342309092055811713248596117837
1505989499071507737327520696698549083264078160176626963388911499243857825618432453831339540493517471965830367
8142297514217065978280117714418398154741342241254020563664726876676640317204769837237777457571035829151430066
8976734030896117836623534284128936211520850732440792931606953670062529591908436944038309940032895197566902267
8168224685664666192803949838022864044413163133927381105808160387082401773032057602851675264898995916626636541
9001629657720377152139245918255277475090244816186714371506129553764951142867578523490137378039021340394340769
2245327249952818808045201607415157960627724712997504860491366104838943082722948052643733986462559636025991548
7074424340072047373492478400351995303222647465106693465730939044953331627737184520959260847343527482278298468
9284577348065060752219525641296874410581360636265810703999026853596889744095475351559690132745449885451210483
6309931343034463058868445133304544226765391492086832291814447867299470701487551160423010232768094612497747656
5240090492131611825405642741228838410162840989165712863328219481002387376267072640052596020466217506553548406
4957263988430106371635165646720507130742427790766771676286770501791272781059306594897900451027223946233993378
1106705528760510309854032455476356747284059317323293076350480450282934233234522543171992887217430703187855951
8414809138605075729206255349273864012849085221103591934373501925737642379407569348578255835903397446227922524
3709241317354201185957182739460662022821177692721059533009495690015945749122762140502939709400727559309806547
9571034481067663451959354198117102362272353968081188573202453952998540878667238414916361870649407831535147187
0581368094614089872743470050036227524470334518194920290116513368291712388449704921831579105916153219887855004
1297495542511400153017198312190601927176352678652679600413496620040577325404745159856763788925207787868359986
5144135404383258584420900684191673392507214539717214479419736816612537859820744215776251850199474013471638017
8498724449871313168247654188084416517450955970526803818905931541066764255832397932184305373360846122327243263
1040657990109218973305973229918473407030920644553945536388369812827066220073599103873966861090226372561020895
1331401185110905414373042426400697815209389705127488915173729717549745026080461353674348353073939957593077670
2177826895145466169578035517014836106197346885220027954254378020083412461105466096081835517212844928590525029
6524135677656151241168230659061552078273054310862969845101151511311764881960899111055497610542934237576225453
4104732766293551813684980657524407967879936829067375762656398463475250230475078449776832268726903223182617994
7498678024579935309916663728660092928745242248869343090459957775266589030317377607653516916135539524047019994
5601010810545144442712073259361655138393023884214087345084335280976399768643978120203967668170743704727591990
7377534534170552492965743910250815415155965797000654343125124927409334928334579963008634071032160244829271629
4821270117079659397470918427437535354450612626900658232234517571332407629096888517410369603975212114331435599
3221274863923347970795806110680997714029329797519935887226689441309552430103709337178834609239487113262794070
7005358236332553721490731361118431986029600018656340608123057917438368315767018914573664660076346874384310510
7601304310693081701478893525855966190433563021856620362980160258427794358643719644961680366739108511046240507
7586099676362398580087698272353952537835485026890781578510005499400067275071614969779792153211609901694495631
7464406346572260127318930307361589717942146734791288254948385736858250437136160293369515574640049490643860742
5942713576993760014208574234726201508760055885871871041144800347720718055879840189116783695111252923437684400
3729915774504306744325455672391339174367369171461956346330087500703839705414362755005728251098768451477683649
7898315600649262769502269245655620944991162464874800898742026053840719887016402392453077867123003666424537433
8900080049754103066554561152741567209601140327073108635803214009704241011541487111722190244677781859068588612
1308883836237805526686702323712952877083926676770393642278180214811010488914047215639584671307951656117448012
2617398281061940951304136765707280326281039085619859666185561456394171613273291848786698066996614855449327190
4163588500829013507029848864322090535809758552892721005377145620125933904748370664405843925959213220878774959
8024089110687385618456049893981661681512828213442279513063095505142901947704101594285654306600005942965333681
8995047043217370894018133047822129736422713494840381888109076537861138149704890097376856173711280434034340383
9261361910015218157337101894935126937384988839594734555486992475812655091780951897137216704330128543535552964
8886474856663287125147957011492016491306686088177097342840658400099443881897843146477600536436582455330216185
3061898599811358021923527268253438188679248176525258420787047034793275225849868221534870306519954980900296286
6806213178262239223820990481199640707399837983034201547992697436910465360259510288894244836241025837215177598
4244962584458259024509052330017891760525496649666983253823346338294381798129894852731097047981527811342771693
4989849609818261185011575810789507243628661620385055717476497558723409777781786897018390915058370994829427181
1767806884952913437662745811930864550614299822399641691804680635881864591159364918779462768641886200207407645
0812550342124849588003357844835291639332147160306650555730009078285315646172707917330974284850116967676840632
9137407080491910791489517210161651270830760981420859893396456344883032804862577722938465527120214267427480050
6415412122468422228396501641257678204279905072768520682407692060487706808633091544183731100412032810542353630
830543323125
gosh>

« Last Edit: January 18, 2015, 04:55:16 AM by RobbeK »

jack

  • Full Member
  • ***
  • Posts: 112
Re: Another embeddable Scheme : KSI
« Reply #8 on: January 18, 2015, 03:55:02 PM »
RobbeK, the timing for gauche is amazing.

Mike Lobanovsky

  • Admin Support Member
  • *****
  • Posts: 1857
Re: Another embeddable Scheme : KSI
« Reply #9 on: January 18, 2015, 11:36:24 PM »
Quote from: Rob
Maybe in Slavic languages on ideological grounds there may have been a kind of rehabilitation
Not at all. Левый in Russian means 1) left 2) fake, phony, fraudulent, untrustful, unreliable. :D

Quote from: Jack
RobbeK, the timing for gauche is amazing.
Absolutely.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, 2 x nVidia GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

John

  • Hero Member
  • *****
  • Posts: 3280
Re: Another embeddable Scheme : KSI
« Reply #10 on: January 19, 2015, 12:05:13 AM »
My graphic impression of Gauche



RobbeK

  • Sr. Member
  • ****
  • Posts: 368
Re: Another embeddable Scheme : KSI
« Reply #11 on: January 19, 2015, 11:27:01 AM »
 8)     

Rob

RobbeK

  • Sr. Member
  • ****
  • Posts: 368
Re: Another embeddable Scheme : KSI
« Reply #12 on: January 19, 2015, 03:09:59 PM »
Hi,

NewLISP isn't much slower ...

;;------------------  code

(macro (car L) (L 0))
(macro (cadr L) ((rest L) 0))

;;or
;;   (define car (lambda-macro (L) (expand '(L 0))))
;;   (define cadr  (lambda-macro (L) (expand '((rest L) 0))))

(define (fib n)
   (let ((seq (list 0L 1L)))
    (dotimes (i n)
       (setq seq (list (cadr seq) (+ (car seq) (cadr seq)))))
(car seq)))

;;--------------------------------------  REPL

newLISP v.10.6.0 32-bit on Linux IPv4/6 libffi, options: newlisp -h

>
(lambda-macro (L) (expand '(L 0)))
(lambda-macro (L) (expand '((rest L) 0)))
(lambda (n)
 (let ((seq (list 0L 1L)))
  (dotimes (i n)
   (setq seq (list ((rest seq) 0) (+ (seq 0) ((rest seq) 0)))))
  (seq 0)))
> (time (setq a (fib 35000)))
573.276
> (time (setq a (fib 35000)))
551.615
> a
1651671774188865369804424388786818731955799225064552005474226085878901080409589735151395201321742005395540690
3829337049126031699652129206494332659014089694279271694809329170065221692511552858870051428317761966248074598
6253421922385670478266846213547032439642584001450558909553719826098421710268912957077158693928792925379019916
5376216436868444698087460099581559988756552107606831539838011737981877013975802544173532175465633762456296414
7028942624794379918283386616553714865480402160046622613356847332852440420274846454409055393152586115816117061
7884871263454155267691359120119950576704628540114965142501599781262190726995988947257368315932519868273795666
2299617799018470552939428838803374308316315271109456322742245154718445193863308929352945368630071676440354480
8372969207696145551545739998285719149288104929941726657020770787647950349233488010656094493167817302845593427
7935266405362429880773920282115071945936446154164299037149461466172166323358591716576115987992871749264172532
7026625106503014188675390865164353635482103603918565708637499224869183370419944144792487440134026318129305117
6201268267972213282987820657385240560469357304396726174488004668502749339915746555392509001865014565905135056
5303186005392292261817260122746681355664780122298914430271900270005318683014089524074500278041106120530017476
0219157649669122097906099746732648916266464218859250204031379678109012664789330431191841534764322977535500149
0059392144943444384279609000598263191943129433769588117396389360899397918393776397436824884801318850581108037
8306179701063528122074407932016734931997738201827962788252907820792000120949551342309092055811713248596117837
1505989499071507737327520696698549083264078160176626963388911499243857825618432453831339540493517471965830367
8142297514217065978280117714418398154741342241254020563664726876676640317204769837237777457571035829151430066
8976734030896117836623534284128936211520850732440792931606953670062529591908436944038309940032895197566902267
8168224685664666192803949838022864044413163133927381105808160387082401773032057602851675264898995916626636541
9001629657720377152139245918255277475090244816186714371506129553764951142867578523490137378039021340394340769
2245327249952818808045201607415157960627724712997504860491366104838943082722948052643733986462559636025991548
7074424340072047373492478400351995303222647465106693465730939044953331627737184520959260847343527482278298468
9284577348065060752219525641296874410581360636265810703999026853596889744095475351559690132745449885451210483
6309931343034463058868445133304544226765391492086832291814447867299470701487551160423010232768094612497747656
5240090492131611825405642741228838410162840989165712863328219481002387376267072640052596020466217506553548406
4957263988430106371635165646720507130742427790766771676286770501791272781059306594897900451027223946233993378
1106705528760510309854032455476356747284059317323293076350480450282934233234522543171992887217430703187855951
8414809138605075729206255349273864012849085221103591934373501925737642379407569348578255835903397446227922524
3709241317354201185957182739460662022821177692721059533009495690015945749122762140502939709400727559309806547
9571034481067663451959354198117102362272353968081188573202453952998540878667238414916361870649407831535147187
0581368094614089872743470050036227524470334518194920290116513368291712388449704921831579105916153219887855004
1297495542511400153017198312190601927176352678652679600413496620040577325404745159856763788925207787868359986
5144135404383258584420900684191673392507214539717214479419736816612537859820744215776251850199474013471638017
8498724449871313168247654188084416517450955970526803818905931541066764255832397932184305373360846122327243263
1040657990109218973305973229918473407030920644553945536388369812827066220073599103873966861090226372561020895
1331401185110905414373042426400697815209389705127488915173729717549745026080461353674348353073939957593077670
2177826895145466169578035517014836106197346885220027954254378020083412461105466096081835517212844928590525029
6524135677656151241168230659061552078273054310862969845101151511311764881960899111055497610542934237576225453
4104732766293551813684980657524407967879936829067375762656398463475250230475078449776832268726903223182617994
7498678024579935309916663728660092928745242248869343090459957775266589030317377607653516916135539524047019994
5601010810545144442712073259361655138393023884214087345084335280976399768643978120203967668170743704727591990
7377534534170552492965743910250815415155965797000654343125124927409334928334579963008634071032160244829271629
4821270117079659397470918427437535354450612626900658232234517571332407629096888517410369603975212114331435599
3221274863923347970795806110680997714029329797519935887226689441309552430103709337178834609239487113262794070
7005358236332553721490731361118431986029600018656340608123057917438368315767018914573664660076346874384310510
7601304310693081701478893525855966190433563021856620362980160258427794358643719644961680366739108511046240507
7586099676362398580087698272353952537835485026890781578510005499400067275071614969779792153211609901694495631
7464406346572260127318930307361589717942146734791288254948385736858250437136160293369515574640049490643860742
5942713576993760014208574234726201508760055885871871041144800347720718055879840189116783695111252923437684400
3729915774504306744325455672391339174367369171461956346330087500703839705414362755005728251098768451477683649
7898315600649262769502269245655620944991162464874800898742026053840719887016402392453077867123003666424537433
8900080049754103066554561152741567209601140327073108635803214009704241011541487111722190244677781859068588612
1308883836237805526686702323712952877083926676770393642278180214811010488914047215639584671307951656117448012
2617398281061940951304136765707280326281039085619859666185561456394171613273291848786698066996614855449327190
4163588500829013507029848864322090535809758552892721005377145620125933904748370664405843925959213220878774959
8024089110687385618456049893981661681512828213442279513063095505142901947704101594285654306600005942965333681
8995047043217370894018133047822129736422713494840381888109076537861138149704890097376856173711280434034340383
9261361910015218157337101894935126937384988839594734555486992475812655091780951897137216704330128543535552964
8886474856663287125147957011492016491306686088177097342840658400099443881897843146477600536436582455330216185
3061898599811358021923527268253438188679248176525258420787047034793275225849868221534870306519954980900296286
6806213178262239223820990481199640707399837983034201547992697436910465360259510288894244836241025837215177598
4244962584458259024509052330017891760525496649666983253823346338294381798129894852731097047981527811342771693
4989849609818261185011575810789507243628661620385055717476497558723409777781786897018390915058370994829427181
1767806884952913437662745811930864550614299822399641691804680635881864591159364918779462768641886200207407645
0812550342124849588003357844835291639332147160306650555730009078285315646172707917330974284850116967676840632
9137407080491910791489517210161651270830760981420859893396456344883032804862577722938465527120214267427480050
6415412122468422228396501641257678204279905072768520682407692060487706808633091544183731100412032810542353630
830543323125L

best,Rob
>

RobbeK

  • Sr. Member
  • ****
  • Posts: 368
Re: Another embeddable Scheme : KSI
« Reply #13 on: January 20, 2015, 12:33:49 AM »
However,
.. using a compiler CL with labels (identical with Scheme's letrec  ,  the recursive let )



GCL (GNU Common Lisp)  2.6.10 CLtL1    Apr  2 2014 14:19:37
Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.
Temporary directory for compiler files set to /tmp/

>(defun fib (x)
   (labels  ((fib* (n a b)
              (if (< n 3) b
                (fib* (1- n) b (+ a b)))))
  (fib* x 1 1)))

FIB

>(compile 'fib)

Compiling /tmp/gazonk_3346_0.lsp.
End of Pass 1. 

;; Note: Tail-recursive call of FIB* was replaced by iteration.
End of Pass 2. 
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling /tmp/gazonk_3346_0.lsp.
Loading /tmp/gazonk_3346_0.o
start address -T 0x8a36e0 Finished loading /tmp/gazonk_3346_0.o
#<compiled-function FIB>
NIL
NIL

>(time (fib 35000))

real time       :      0.159 secs
run-gbc time    :      0.079 secs
child run time  :      0.000 secs
gbc time        :      0.019 secs
165167177418886536980442  ....   etc

John

  • Hero Member
  • *****
  • Posts: 3280
Re: Another embeddable Scheme : KSI
« Reply #14 on: January 20, 2015, 01:11:21 AM »
3 10ths of a second difference between compiled and interpretive doesn't seem that far apart for real world Lisp applications.

Have you tried GNU/MIT Scheme on Linux yet?