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
d16bee4f
Commit
d16bee4f
authored
Jul 04, 2015
by
Juergen Nickelsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
min, max
parent
fc914b17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
Fundamental.lisp
Fundamental.lisp
+20
-0
TODO
TODO
+3
-1
tests/037-minmax.lisp
tests/037-minmax.lisp
+10
-0
No files found.
Fundamental.lisp
View file @
d16bee4f
;; fundamental predefined Lisp functions
;(debug t)
(
defun
max
(
&rest
numargs
)
"return the biggest of all (numeric) arguments"
(
if
(
null
(
cdr
numargs
))
(
car
numargs
)
(
let
((
a
(
car
numargs
))
(
b
(
apply
#'
max
(
cdr
numargs
))))
(
if
(
<
a
b
)
b
a
))))
(
defun
min
(
&rest
numargs
)
"return the smallest of all (numeric) arguments"
(
if
(
null
(
cdr
numargs
))
(
car
numargs
)
(
let
((
a
(
car
numargs
))
(
b
(
apply
#'
min
(
cdr
numargs
))))
(
if
(
<
a
b
)
a
b
))))
(
defun
apropos
(
match
)
(
sort
(
filter
#'
(
lambda
(
sym
)
(
re-match
match
(
symbol-name
sym
)))
(
symbols
))
...
...
TODO
View file @
d16bee4f
...
...
@@ -6,7 +6,9 @@
* more of alists
* min, max; floor ceiling, round
* floor, ceiling, round
+ min, max
+ "isqrt", "return the integer square root of numeric ARG"
...
...
tests/037-minmax.lisp
0 → 100644
View file @
d16bee4f
(
testcmp
"max 1"
'
(
max
)
nil
)
(
testcmp
"max 2"
'
(
max
3
)
3
)
(
testcmp
"max 3"
'
(
max
3
4
5
2
54
6
9
3
5
7
)
54
)
(
testcmp
"max 4"
'
(
max
3
-4
5
-2
54
-6
9
-3
5
-7
)
54
)
(
testcmp
"min 1"
'
(
min
)
nil
)
(
testcmp
"min 2"
'
(
min
3
)
3
)
(
testcmp
"min 3"
'
(
min
3
4
5
2
54
6
9
3
5
7
)
2
)
(
testcmp
"min 4"
'
(
min
3
-4
5
-2
54
-6
9
-3
5
-7
)
-7
)
(
testcmp
"min 5"
'
(
min
4
2
4
2
4
2
7
1
19
)
1
)
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