Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lis.pl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lisp
lis.pl
Commits
0decbcd5
Commit
0decbcd5
authored
Jun 29, 2015
by
Juergen Nickelsen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.w21.org/home/git/lis.pl
parents
52acf053
9be6b6d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
19 deletions
+11
-19
Builtin.pm
Builtin.pm
+2
-5
Sexp.pm
Sexp.pm
+5
-13
TODO
TODO
+2
-0
tests/001-basics.lisp
tests/001-basics.lisp
+2
-1
No files found.
Builtin.pm
View file @
0decbcd5
...
...
@@ -84,7 +84,7 @@ sub Bignore {
sub
Bsymbol_plist
{
my
(
$sym
)
=
checkargs
(
$_
[
0
],
'
y
');
return
array2list
(
symbol_plist
(
$sym
)
);
return
symbol_plist
(
$sym
);
}
sub
Bget
{
...
...
@@ -107,10 +107,7 @@ sub Bdescribe {
my
(
$ob
)
=
checkargs
(
$_
[
0
],
'
e
');
my
$type
=
Btype_of
(
cons
(
$ob
,
$Nil
));
if
(
$type
==
$t_Symbol
)
{
return
array2list
(
$type
,
symbol_name
(
$ob
),
symbol_value
(
$ob
)
//
$Nil
,
symbol_function
(
$ob
)
//
$Nil
,
symbol_plist
(
$ob
));
return
array2list
(
$type
,
$ob
,
symbol_plist
(
$ob
));
}
elsif
(
$type
==
$t_Function
)
{
return
array2list
(
specialp
(
$ob
)
?
$special
:
$function
,
consp
(
$ob
)
?
$Lambda
:
$builtin
,
...
...
Sexp.pm
View file @
0decbcd5
...
...
@@ -31,40 +31,33 @@ my $cons_counter = 0;
# types of sexprs:
# - literal string or number
# - symbol { name => "name", value => $value, func => $function,
# props => {}}
# - symbol { name => "name", value => $value, func => $function }
# - pair { car => ..., cdr => ... }
# - function { type => 'expr|subr', spec => $is_special, func => $func,
# doc => $doc }
sub
put
{
my
(
$ob
,
$name
,
$value
)
=
@_
;
$ob
->
{
props
}
//
=
{};
return
$ob
->
{
props
}
->
{
symbol_name
(
$name
)}
=
$value
;
return
$ob
->
{
symbol_name
(
$name
)}
=
$value
;
}
sub
get
{
my
(
$ob
,
$name
,
$default
)
=
@_
;
return
$ob
->
{
props
}
->
{
symbol_name
(
$name
)}
//
$default
;
return
$ob
->
{
symbol_name
(
$name
)}
//
$default
;
}
sub
remprop
{
my
(
$ob
,
$name
)
=
@_
;
return
delete
(
$ob
->
{
props
}
->
{
symbol_name
(
$name
)});
return
delete
(
$ob
->
{
symbol_name
(
$name
)});
}
sub
symbol_plist
{
my
(
$ob
)
=
@_
;
my
@plist
=
{};
my
$result
=
$Nil
;
while
((
my
(
$key
,
$value
)
=
each
(
%
{
$ob
->
{
props
}
//
{}
})))
{
while
((
my
(
$key
,
$value
)
=
each
(
%
{
$ob
})))
{
$result
=
cons
(
intern
(
$key
),
cons
(
$value
,
$result
));
}
return
$result
;
for
(
my
$i
=
0
;
$i
<=
$#plist
;
$i
+=
2
)
{
$plist
[
$i
]
=
intern
(
$plist
[
$i
]);
}
return
@plist
;
}
sub
all_symbols
{
...
...
@@ -305,7 +298,6 @@ sub symbol_value {
sub
symbol_function
{
my
(
$ob
)
=
@_
;
return
error
("
not a symbol: %s
",
$ob
)
unless
symbolp
(
$ob
);
return
$ob
->
{
func
};
}
...
...
TODO
View file @
0decbcd5
...
...
@@ -2,6 +2,8 @@
*: to do; @: in progress; #: blocked; +: done; -: rejected
* do something sensible with (describe) for functions
+ command line options like lingo's -e -h -l -q
+ change debug to (format, args, ...) style
...
...
tests/001-basics.lisp
View file @
0decbcd5
(
testcmp
"zerop 0"
'
(
zerop
(
-
3
3
))
"t"
)
(
testcmp
"zerop 0.0"
'
(
zerop
(
-
3.4
3.4
))
"t"
)
(
testcmp
"zerop !0"
'
(
zerop
(
-
3
3.4
))
"nil"
)
(
testcmp
"describe"
'
(
describe
'newsymbol
)
"(symbol \"newsymbol\" nil nil nil)"
)
(
testcmp
"describe"
'
(
describe
'newsymbol
)
'
(
symbol
newsymbol
(
name
"newsymbol"
)))
(
testcmp
"null"
'
(
null
(
null
'a
))
"t"
)
(
testcmp
"not"
'
(
not
(
not
'a
))
"t"
)
(
testcmp
"princ"
'
(
princ
'lala
)
"lala"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment