Inline array? and len, add PicoLisp fib & fib-let benchmarks
This commit is contained in:
@@ -18,3 +18,4 @@ add_subdirectory(swift)
|
||||
|
||||
add_subdirectory(python)
|
||||
add_subdirectory(scheme)
|
||||
add_subdirectory(picolisp)
|
||||
|
||||
22
koka_bench/picolisp/CMakeLists.txt
Normal file
22
koka_bench/picolisp/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
set(copy_wrapper "../../copy_wrapper.sh")
|
||||
|
||||
set(sources picolisp-fib.l picolisp-fib-let.l)
|
||||
foreach (source IN LISTS sources)
|
||||
|
||||
get_filename_component(name "${source}" NAME_WE)
|
||||
|
||||
set(out_dir "${CMAKE_CURRENT_BINARY_DIR}/out/bench")
|
||||
set(out_path "${out_dir}/${name}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${out_path}
|
||||
COMMAND ${copy_wrapper} "${CMAKE_CURRENT_SOURCE_DIR}/${source}" ${out_dir} ${name}
|
||||
DEPENDS ${source}
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(update-${name} ALL DEPENDS "${out_path}")
|
||||
add_executable(${name}-exe IMPORTED)
|
||||
set_target_properties(${name}-exe PROPERTIES IMPORTED_LOCATION "${out_path}")
|
||||
endforeach ()
|
||||
|
||||
15
koka_bench/picolisp/picolisp-fib-let.l
Executable file
15
koka_bench/picolisp/picolisp-fib-let.l
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#{
|
||||
# Thanks to http://rosettacode.org/wiki/Multiline_shebang#PicoLisp
|
||||
exec pil $0 $1
|
||||
# }#
|
||||
|
||||
|
||||
|
||||
(de fib (N) (cond ((= 0 N) 1)
|
||||
((= 1 N) 1)
|
||||
(1 (let (A (fib (- N 1))
|
||||
B (fib (- N 2))
|
||||
) (+ A B)))))
|
||||
|
||||
(bye (println (fib (car (str (opt))))))
|
||||
13
koka_bench/picolisp/picolisp-fib.l
Executable file
13
koka_bench/picolisp/picolisp-fib.l
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
#{
|
||||
# Thanks to http://rosettacode.org/wiki/Multiline_shebang#PicoLisp
|
||||
exec pil $0 $1
|
||||
# }#
|
||||
|
||||
|
||||
|
||||
(de fib (n) (cond ((= 0 n) 1)
|
||||
((= 1 n) 1)
|
||||
(1 (+ (fib (- n 1)) (fib (- n 2))))))
|
||||
|
||||
(bye (println (fib (car (str (opt))))))
|
||||
Reference in New Issue
Block a user