shen-ruby 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ShenRuby Release History
2
2
 
3
+ ## 0.3.0 - January 24, 2013
4
+ ### Features
5
+ - Upgrade to Shen 8.0
6
+
3
7
  ## 0.2.0 - January 16, 2013
4
8
  ### Features
5
9
  - Graceful handling of Control-C in ShenRuby REPL [Bruno Deferrari]
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ShenRuby
2
2
  ShenRuby is a Ruby port of the [Shen](http://shenlanguage.org/) programming language. Shen is a modern, functional Lisp that supports pattern matching, currying, and optional static type checking.
3
3
 
4
- ShenRuby supports Shen version 7.1, which was released in December, 2012.
4
+ ShenRuby supports Shen version 8.0, which was released in January, 2013.
5
5
 
6
6
  The ShenRuby project has two primary goals. The first is to be a low barrier-to-entry means for Rubyists to explore Shen. To someone with a working installation of Ruby 1.9.3, a Shen REPL is only a gem install away.
7
7
 
@@ -12,7 +12,7 @@ ShenRuby 0.1.0 began to satisfy the first goal by providing a Shen REPL accessib
12
12
  ## Installation
13
13
  NOTE: ShenRuby requires Ruby 1.9 language features. It has been tested with Ruby 1.9.3-p362. It is not yet working under JRuby or Rubinius.
14
14
 
15
- ShenRuby 0.2.0 is the current release. To install it as gem, use the following command:
15
+ ShenRuby 0.3.0 is the current release. To install it as gem, use the following command:
16
16
 
17
17
  gem install shen-ruby
18
18
 
@@ -21,12 +21,12 @@ ShenRuby 0.2.0 is the current release. To install it as gem, use the following c
21
21
  Once the gem has been installed, the Shen REPL can be launched via the `srrepl` (short for ShenRuby REPL) command. For example:
22
22
 
23
23
  % srrepl
24
- Loading.... Completed in 9.93 seconds.
24
+ Loading.... Completed in 10.29 seconds.
25
25
 
26
26
  Shen 2010, copyright (C) 2010 Mark Tarver
27
- www.shenlanguage.org, version 7.1
27
+ www.shenlanguage.org, version 8
28
28
  running under Ruby, implementation: ruby 1.9.3
29
- port 0.2.0 ported by Greg Spurrier
29
+ port 0.3.0 ported by Greg Spurrier
30
30
 
31
31
 
32
32
  (0-)
@@ -147,6 +147,7 @@ The following features and improvements are among those planned for ShenRuby as
147
147
  - Ability to call Ruby methods directly from Shen
148
148
  - Support for command-line Shen scripts that under ShenRuby
149
149
  - Support for JRuby and Rubinius
150
+ - Thread-safe `ShenRuby::Shen` instances
150
151
  - Improved performance
151
152
 
152
153
  ## Known Limitations
@@ -160,6 +161,6 @@ The following people are gratefully acknowledged for their contributions of code
160
161
  - Bruno Deferrari
161
162
 
162
163
  ## License
163
- Shen is Copyright (c) 2010-2012 Mark Tarver and released under the Shen License. A copy of the Shen License may be found in [shen/license.txt](https://github.com/gregspurrier/shen-ruby/blob/master/shen/license.txt). A detailed description of the license, along with questions and answers, may be found at http://shenlanguage.org/license.html. The entire contents of the [shen directory](https://github.com/gregspurrier/shen-ruby/tree/master/shen), including the implementation of the `ShenRuby::Shen` class, is part of Shen and is subject to the Shen license.
164
+ Shen is Copyright (c) 2010-2013 Mark Tarver and released under the Shen License. A copy of the Shen License may be found in [shen/license.txt](https://github.com/gregspurrier/shen-ruby/blob/master/shen/license.txt). A detailed description of the license, along with questions and answers, may be found at http://shenlanguage.org/license.html. The entire contents of the [shen directory](https://github.com/gregspurrier/shen-ruby/tree/master/shen), including the implementation of the `ShenRuby::Shen` class, is part of Shen and is subject to the Shen license.
164
165
 
165
166
  The remainder of ShenRuby--i.e., everything outside of the shen directory--is Copyright (c) 2012-2013 Greg Spurrier and released under the MIT License. A copy of the MIT License may be found in [MIT_LICENSE.txt](https://github.com/gregspurrier/shen-ruby/blob/master/MIT_LICENSE.txt).
data/bin/srrepl CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
+ root = File.expand_path('../..', __FILE__)
3
+ %w(lib shen/lib).each do |path|
4
+ full_path = File.join(root, path)
5
+ $LOAD_PATH << full_path unless $LOAD_PATH.include? full_path
6
+ end
2
7
  require 'shen_ruby'
3
8
 
4
9
  # Leave gracefully if someone hits Control-C during loading
@@ -1,3 +1,3 @@
1
1
  module ShenRuby
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -115,10 +115,9 @@ module ShenRuby
115
115
  # Returns the result of the last expression evaluated.
116
116
  # Based on the implementation of read-file in reader.shen
117
117
  def eval_string(s)
118
- byte_list = Kl::Cons.list(s.bytes.to_a)
119
- form = __apply(:compile, [:"shen-<st_input>", byte_list, :"read-error"])
118
+ forms = __apply(:"read-from-string", [s])
120
119
  result = nil
121
- form.each { |f| result = __apply(:eval, [f]) }
120
+ forms.each { |f| result = __apply(:eval, [f]) }
122
121
  result
123
122
  end
124
123
  alias_method :"eval-string", :eval_string
@@ -110,16 +110,16 @@ For an explication of this license see http://www.lambdassociates.org/News/june1
110
110
 
111
111
  (set shen-*catch* 0)
112
112
 
113
- (defun shen-initialise_arity_table (V1536)
114
- (cond ((= () V1536) ())
115
- ((and (cons? V1536) (cons? (tl V1536)))
113
+ (defun shen-initialise_arity_table (V1540)
114
+ (cond ((= () V1540) ())
115
+ ((and (cons? V1540) (cons? (tl V1540)))
116
116
  (let DecArity
117
- (put (hd V1536) arity (hd (tl V1536)) (value shen-*property-vector*))
118
- (shen-initialise_arity_table (tl (tl V1536)))))
117
+ (put (hd V1540) arity (hd (tl V1540)) (value shen-*property-vector*))
118
+ (shen-initialise_arity_table (tl (tl V1540)))))
119
119
  (true (shen-sys-error shen-initialise_arity_table))))
120
120
 
121
- (defun arity (V1537)
122
- (trap-error (get V1537 arity (value shen-*property-vector*)) (lambda E -1)))
121
+ (defun arity (V1541)
122
+ (trap-error (get V1541 arity (value shen-*property-vector*)) (lambda E -1)))
123
123
 
124
124
  (shen-initialise_arity_table
125
125
  (cons adjoin
@@ -394,232 +394,236 @@ For an explication of this license see http://www.lambdassociates.org/News/june1
394
394
  (cons
395
395
  1
396
396
  (cons
397
- remove
397
+ read-from-string
398
398
  (cons
399
- 2
399
+ 1
400
400
  (cons
401
- reverse
401
+ remove
402
402
  (cons
403
- 1
403
+ 2
404
404
  (cons
405
- set
405
+ reverse
406
406
  (cons
407
- 2
407
+ 1
408
408
  (cons
409
- simple-error
409
+ set
410
410
  (cons
411
- 1
411
+ 2
412
412
  (cons
413
- snd
413
+ simple-error
414
414
  (cons
415
415
  1
416
416
  (cons
417
- specialise
417
+ snd
418
418
  (cons
419
419
  1
420
420
  (cons
421
- spy
421
+ specialise
422
422
  (cons
423
423
  1
424
424
  (cons
425
- step
425
+ spy
426
426
  (cons
427
427
  1
428
428
  (cons
429
- stinput
429
+ step
430
430
  (cons
431
431
  1
432
432
  (cons
433
- shen-stoutput
433
+ stinput
434
434
  (cons
435
435
  1
436
436
  (cons
437
- string->n
437
+ shen-stoutput
438
438
  (cons
439
439
  1
440
440
  (cons
441
- string?
441
+ string->n
442
442
  (cons
443
443
  1
444
444
  (cons
445
- strong-warning
445
+ string?
446
446
  (cons
447
447
  1
448
448
  (cons
449
- subst
449
+ strong-warning
450
450
  (cons
451
- 3
451
+ 1
452
452
  (cons
453
- symbol?
453
+ subst
454
454
  (cons
455
- 1
455
+ 3
456
456
  (cons
457
- tail
457
+ symbol?
458
458
  (cons
459
459
  1
460
460
  (cons
461
- tl
461
+ tail
462
462
  (cons
463
463
  1
464
464
  (cons
465
- tc
465
+ tl
466
466
  (cons
467
467
  1
468
468
  (cons
469
- tc?
469
+ tc
470
470
  (cons
471
471
  1
472
472
  (cons
473
- thaw
473
+ tc?
474
474
  (cons
475
475
  1
476
476
  (cons
477
- track
477
+ thaw
478
478
  (cons
479
479
  1
480
480
  (cons
481
- trap-error
481
+ track
482
482
  (cons
483
- 2
483
+ 1
484
484
  (cons
485
- tuple?
485
+ trap-error
486
486
  (cons
487
- 1
487
+ 2
488
488
  (cons
489
- type
489
+ tuple?
490
490
  (cons
491
491
  1
492
492
  (cons
493
- return
493
+ type
494
494
  (cons
495
- 3
495
+ 1
496
496
  (cons
497
- shen-undefmacro
497
+ return
498
498
  (cons
499
- 1
499
+ 3
500
500
  (cons
501
- unprofile
501
+ shen-undefmacro
502
502
  (cons
503
503
  1
504
504
  (cons
505
- unify
505
+ unprofile
506
506
  (cons
507
- 4
507
+ 1
508
508
  (cons
509
- unify!
509
+ unify
510
510
  (cons
511
511
  4
512
512
  (cons
513
- union
513
+ unify!
514
514
  (cons
515
- 2
515
+ 4
516
516
  (cons
517
- untrack
517
+ union
518
518
  (cons
519
- 1
519
+ 2
520
520
  (cons
521
- unspecialise
521
+ untrack
522
522
  (cons
523
523
  1
524
524
  (cons
525
- vector
525
+ unspecialise
526
526
  (cons
527
527
  1
528
528
  (cons
529
- vector->
529
+ vector
530
530
  (cons
531
- 3
531
+ 1
532
532
  (cons
533
- value
533
+ vector->
534
534
  (cons
535
- 1
535
+ 3
536
536
  (cons
537
- variable?
537
+ value
538
538
  (cons
539
539
  1
540
540
  (cons
541
- version
541
+ variable?
542
542
  (cons
543
543
  1
544
544
  (cons
545
- warn
545
+ version
546
546
  (cons
547
547
  1
548
548
  (cons
549
- write-to-file
549
+ warn
550
550
  (cons
551
- 2
551
+ 1
552
552
  (cons
553
- y-or-n?
553
+ write-to-file
554
554
  (cons
555
- 1
555
+ 2
556
556
  (cons
557
- +
557
+ y-or-n?
558
558
  (cons
559
- 2
559
+ 1
560
560
  (cons
561
- *
561
+ +
562
562
  (cons
563
563
  2
564
564
  (cons
565
- /
565
+ *
566
566
  (cons
567
567
  2
568
568
  (cons
569
- -
569
+ /
570
570
  (cons
571
571
  2
572
572
  (cons
573
- ==
573
+ -
574
574
  (cons
575
575
  2
576
576
  (cons
577
- shen-<1>
577
+ ==
578
578
  (cons
579
- 1
579
+ 2
580
580
  (cons
581
- <e>
581
+ shen-<1>
582
582
  (cons
583
583
  1
584
584
  (cons
585
- @p
585
+ <e>
586
586
  (cons
587
- 2
587
+ 1
588
588
  (cons
589
- @v
589
+ @p
590
590
  (cons
591
591
  2
592
592
  (cons
593
- @s
593
+ @v
594
594
  (cons
595
595
  2
596
596
  (cons
597
- preclude
597
+ @s
598
598
  (cons
599
- 1
599
+ 2
600
600
  (cons
601
- include
601
+ preclude
602
602
  (cons
603
603
  1
604
604
  (cons
605
- preclude-all-but
605
+ include
606
606
  (cons
607
607
  1
608
608
  (cons
609
- include-all-but
609
+ preclude-all-but
610
610
  (cons
611
611
  1
612
612
  (cons
613
- where
613
+ include-all-but
614
614
  (cons
615
- 2
616
- ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
615
+ 1
616
+ (cons
617
+ where
618
+ (cons
619
+ 2
620
+ ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
617
621
 
618
- (defun systemf (V1538)
619
- (set shen-*system* (adjoin V1538 (value shen-*system*))))
622
+ (defun systemf (V1542)
623
+ (set shen-*system* (adjoin V1542 (value shen-*system*))))
620
624
 
621
- (defun adjoin (V1539 V1540)
622
- (if (element? V1539 V1540) V1540 (cons V1539 V1540)))
625
+ (defun adjoin (V1543 V1544)
626
+ (if (element? V1543 V1544) V1544 (cons V1543 V1544)))
623
627
 
624
628
  (map (lambda X (do (systemf X) X))
625
629
  (cons !
@@ -681,7 +685,7 @@ For an explication of this license see http://www.lambdassociates.org/News/june1
681
685
  (cons vector?
682
686
  (cons unspecialise
683
687
  (cons untrack
684
- (cons unix
688
+ (cons shen-unix
685
689
  (cons union
686
690
  (cons unify
687
691
  (cons unify!
@@ -768,254 +772,256 @@ For an explication of this license see http://www.lambdassociates.org/News/june1
768
772
  (cons
769
773
  read-byte
770
774
  (cons
771
- quit
775
+ read-from-string
772
776
  (cons
773
- put
777
+ quit
774
778
  (cons
775
- preclude
779
+ put
776
780
  (cons
777
- preclude-all-but
781
+ preclude
778
782
  (cons
779
- ps
783
+ preclude-all-but
780
784
  (cons
781
- prolog?
785
+ ps
782
786
  (cons
783
- protect
787
+ prolog?
784
788
  (cons
785
- profile-results
789
+ protect
786
790
  (cons
787
- profile
791
+ profile-results
788
792
  (cons
789
- print
793
+ profile
790
794
  (cons
791
- pr
795
+ print
792
796
  (cons
793
- pos
797
+ pr
794
798
  (cons
795
- package
799
+ pos
796
800
  (cons
797
- output
801
+ package
798
802
  (cons
799
- out
803
+ output
800
804
  (cons
801
- or
805
+ out
802
806
  (cons
803
- open
807
+ or
804
808
  (cons
805
- occurrences
809
+ open
806
810
  (cons
807
- occurs-check
811
+ occurrences
808
812
  (cons
809
- n->string
813
+ occurs-check
810
814
  (cons
811
- number?
815
+ n->string
812
816
  (cons
813
- number
817
+ number?
814
818
  (cons
815
- null
819
+ number
816
820
  (cons
817
- nth
821
+ null
818
822
  (cons
819
- not
823
+ nth
820
824
  (cons
821
- nl
825
+ not
822
826
  (cons
823
- mode
827
+ nl
824
828
  (cons
825
- macro
829
+ mode
826
830
  (cons
827
- macroexpand
831
+ macro
828
832
  (cons
829
- maxinferences
833
+ macroexpand
830
834
  (cons
831
- mapcan
835
+ maxinferences
832
836
  (cons
833
- map
837
+ mapcan
834
838
  (cons
835
- make-string
839
+ map
836
840
  (cons
837
- load
841
+ make-string
838
842
  (cons
839
- loaded
843
+ load
840
844
  (cons
841
- list
845
+ loaded
842
846
  (cons
843
- lineread
847
+ list
844
848
  (cons
845
- limit
849
+ lineread
846
850
  (cons
847
- length
851
+ limit
848
852
  (cons
849
- let
853
+ length
850
854
  (cons
851
- lazy
855
+ let
852
856
  (cons
853
- lambda
857
+ lazy
854
858
  (cons
855
- is
859
+ lambda
856
860
  (cons
857
- intersection
861
+ is
858
862
  (cons
859
- inferences
863
+ intersection
860
864
  (cons
861
- intern
865
+ inferences
862
866
  (cons
863
- integer?
867
+ intern
864
868
  (cons
865
- input
869
+ integer?
866
870
  (cons
867
- input+
871
+ input
868
872
  (cons
869
- include
873
+ input+
870
874
  (cons
871
- include-all-but
875
+ include
872
876
  (cons
873
- in
877
+ include-all-but
874
878
  (cons
875
- if
879
+ in
876
880
  (cons
877
- identical
881
+ if
878
882
  (cons
879
- head
883
+ identical
880
884
  (cons
881
- hd
885
+ head
882
886
  (cons
883
- hdv
887
+ hd
884
888
  (cons
885
- hdstr
889
+ hdv
886
890
  (cons
887
- hash
891
+ hdstr
888
892
  (cons
889
- get
893
+ hash
890
894
  (cons
891
- get-time
895
+ get
892
896
  (cons
893
- gensym
897
+ get-time
894
898
  (cons
895
- function
899
+ gensym
896
900
  (cons
897
- fst
901
+ function
898
902
  (cons
899
- freeze
903
+ fst
900
904
  (cons
901
- format
905
+ freeze
902
906
  (cons
903
- fix
907
+ format
904
908
  (cons
905
- file
909
+ fix
906
910
  (cons
907
- fail
911
+ file
908
912
  (cons
909
- fail-if
913
+ fail
910
914
  (cons
911
- fwhen
915
+ fail-if
912
916
  (cons
913
- findall
917
+ fwhen
914
918
  (cons
915
- false
919
+ findall
916
920
  (cons
917
- shen-enable-type-theory
921
+ false
918
922
  (cons
919
- explode
923
+ shen-enable-type-theory
920
924
  (cons
921
- external
925
+ explode
922
926
  (cons
923
- exception
927
+ external
924
928
  (cons
925
- eval-kl
929
+ exception
926
930
  (cons
927
- eval
931
+ eval-kl
928
932
  (cons
929
- error-to-string
933
+ eval
930
934
  (cons
931
- error
935
+ error-to-string
932
936
  (cons
933
- empty?
937
+ error
934
938
  (cons
935
- element?
939
+ empty?
936
940
  (cons
937
- do
941
+ element?
938
942
  (cons
939
- difference
943
+ do
940
944
  (cons
941
- destroy
945
+ difference
942
946
  (cons
943
- defun
947
+ destroy
944
948
  (cons
945
- define
949
+ defun
946
950
  (cons
947
- defmacro
951
+ define
948
952
  (cons
949
- defcc
953
+ defmacro
950
954
  (cons
951
- defprolog
955
+ defcc
952
956
  (cons
953
- declare
957
+ defprolog
954
958
  (cons
955
- datatype
959
+ declare
956
960
  (cons
957
- cut
961
+ datatype
958
962
  (cons
959
- cn
963
+ cut
960
964
  (cons
961
- cons?
965
+ cn
962
966
  (cons
963
- cons
967
+ cons?
964
968
  (cons
965
- cond
969
+ cons
966
970
  (cons
967
- concat
971
+ cond
968
972
  (cons
969
- compile
973
+ concat
970
974
  (cons
971
- cd
975
+ compile
972
976
  (cons
973
- cases
977
+ cd
974
978
  (cons
975
- call
979
+ cases
976
980
  (cons
977
- close
981
+ call
978
982
  (cons
979
- bind
983
+ close
980
984
  (cons
981
- bound?
985
+ bind
982
986
  (cons
983
- boolean?
987
+ bound?
984
988
  (cons
985
- boolean
989
+ boolean?
986
990
  (cons
987
- bar!
991
+ boolean
988
992
  (cons
989
- assoc
993
+ bar!
990
994
  (cons
991
- arity
995
+ assoc
992
996
  (cons
993
- append
997
+ arity
994
998
  (cons
995
- and
999
+ append
996
1000
  (cons
997
- adjoin
1001
+ and
998
1002
  (cons
999
- <-address
1003
+ adjoin
1000
1004
  (cons
1001
- address->
1005
+ <-address
1002
1006
  (cons
1003
- absvector?
1007
+ address->
1004
1008
  (cons
1005
- absvector
1009
+ absvector?
1006
1010
  (cons
1007
- abort
1011
+ absvector
1008
1012
  (cons
1009
- intmake-string
1013
+ abort
1010
1014
  (cons
1011
- intoutput
1015
+ intmake-string
1012
1016
  (cons
1013
- interror
1014
- ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
1017
+ intoutput
1018
+ (cons
1019
+ interror
1020
+ ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
1015
1021
 
1016
- (defun specialise (V1541)
1017
- (do (set shen-*special* (cons V1541 (value shen-*special*))) V1541))
1022
+ (defun specialise (V1545)
1023
+ (do (set shen-*special* (cons V1545 (value shen-*special*))) V1545))
1018
1024
 
1019
- (defun unspecialise (V1542)
1020
- (do (set shen-*special* (remove V1542 (value shen-*special*))) V1542))
1025
+ (defun unspecialise (V1546)
1026
+ (do (set shen-*special* (remove V1546 (value shen-*special*))) V1546))
1021
1027